aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/contracts.adb
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2017-01-06 11:56:16 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2017-01-06 12:56:16 +0100
commit533e3abc48268dd8eee0c63ddcf133e7a14b370d (patch)
treee8e7f4a54bb69880fbcb93c3100b1f285bc23820 /gcc/ada/contracts.adb
parenta62e6287d91309dd07957739d5a000fc0b0073c9 (diff)
downloadgcc-533e3abc48268dd8eee0c63ddcf133e7a14b370d.zip
gcc-533e3abc48268dd8eee0c63ddcf133e7a14b370d.tar.gz
gcc-533e3abc48268dd8eee0c63ddcf133e7a14b370d.tar.bz2
snames.ads-tmpl (Renamed): New name for the pragma argument.
2017-01-06 Bob Duff <duff@adacore.com> * snames.ads-tmpl (Renamed): New name for the pragma argument. * par-ch2.adb: Allow the new pragma (with analysis deferred to Sem_Prag). * sinfo.ads, sinfo.adb (Map_Pragma_Name, Pragma_Name_Mapped): Keep a mapping from new pragma names to old names. * sem_prag.adb: Check legality of pragma Rename_Pragma, and implement it by calling Map_Pragma_Name. * checks.adb, contracts.adb, einfo.adb, errout.adb, * exp_attr.adb, exp_ch3.adb, exp_ch6.adb, exp_ch7.adb, exp_ch9.adb, * exp_prag.adb, exp_util.adb, freeze.adb, frontend.adb, ghost.adb, * inline.adb, lib-writ.adb, scans.adb, scans.ads, sem_attr.adb, * sem_aux.adb, sem_ch10.adb, sem_ch13.adb, sem_ch6.adb, sem_ch9.adb, * sem_elab.adb, sem_res.adb, sem_util.adb, sem_util.ads, * sem_warn.adb: Call Pragma_Name_Mapped instead of Pragma_Name as appropriate. From-SVN: r244144
Diffstat (limited to 'gcc/ada/contracts.adb')
-rw-r--r--gcc/ada/contracts.adb32
1 files changed, 15 insertions, 17 deletions
diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb
index cd74cfcd..7ed7e41 100644
--- a/gcc/ada/contracts.adb
+++ b/gcc/ada/contracts.adb
@@ -115,16 +115,14 @@ package body Contracts is
-- Local variables
- Prag_Nam : Name_Id;
-
- -- Start of processing for Add_Contract_Item
-
- begin
-- A contract must contain only pragmas
pragma Assert (Nkind (Prag) = N_Pragma);
- Prag_Nam := Pragma_Name (Prag);
+ Prag_Nam : constant Name_Id := Pragma_Name_Mapped (Prag);
+
+ -- Start of processing for Add_Contract_Item
+ begin
-- Create a new contract when adding the first item
if No (Items) then
@@ -577,7 +575,7 @@ package body Contracts is
Prag := Contract_Test_Cases (Items);
while Present (Prag) loop
- Prag_Nam := Pragma_Name (Prag);
+ Prag_Nam := Pragma_Name_Mapped (Prag);
if Prag_Nam = Name_Contract_Cases then
@@ -606,7 +604,7 @@ package body Contracts is
Prag := Classifications (Items);
while Present (Prag) loop
- Prag_Nam := Pragma_Name (Prag);
+ Prag_Nam := Pragma_Name_Mapped (Prag);
if Prag_Nam = Name_Depends then
Depends := Prag;
@@ -1021,7 +1019,7 @@ package body Contracts is
Prag := Classifications (Items);
while Present (Prag) loop
- Prag_Nam := Pragma_Name (Prag);
+ Prag_Nam := Pragma_Name_Mapped (Prag);
if Prag_Nam = Name_Initial_Condition then
Init_Cond := Prag;
@@ -1787,7 +1785,7 @@ package body Contracts is
if Present (Items) then
Prag := Contract_Test_Cases (Items);
while Present (Prag) loop
- if Pragma_Name (Prag) = Name_Contract_Cases then
+ if Pragma_Name_Mapped (Prag) = Name_Contract_Cases then
Expand_Pragma_Contract_Cases
(CCs => Prag,
Subp_Id => Subp_Id,
@@ -1840,7 +1838,7 @@ package body Contracts is
if Present (Items) then
Prag := Pre_Post_Conditions (Items);
while Present (Prag) loop
- if Pragma_Name (Prag) = Post_Nam then
+ if Pragma_Name_Mapped (Prag) = Post_Nam then
Append_Enabled_Item
(Item => Build_Pragma_Check_Equivalent (Prag),
List => Stmts);
@@ -1862,7 +1860,7 @@ package body Contracts is
-- Note that non-matching pragmas are skipped
if Nkind (Decl) = N_Pragma then
- if Pragma_Name (Decl) = Post_Nam then
+ if Pragma_Name_Mapped (Decl) = Post_Nam then
Append_Enabled_Item
(Item => Build_Pragma_Check_Equivalent (Decl),
List => Stmts);
@@ -1904,7 +1902,7 @@ package body Contracts is
if Present (Items) then
Prag := Pre_Post_Conditions (Items);
while Present (Prag) loop
- if Pragma_Name (Prag) = Name_Postcondition then
+ if Pragma_Name_Mapped (Prag) = Name_Postcondition then
Append_Enabled_Item
(Item => Build_Pragma_Check_Equivalent (Prag),
List => Stmts);
@@ -1924,7 +1922,7 @@ package body Contracts is
if Present (Items) then
Prag := Pre_Post_Conditions (Items);
while Present (Prag) loop
- if Pragma_Name (Prag) = Name_Postcondition
+ if Pragma_Name_Mapped (Prag) = Name_Postcondition
and then Class_Present (Prag)
then
Append_Enabled_Item
@@ -2191,7 +2189,7 @@ package body Contracts is
if Present (Items) then
Prag := Pre_Post_Conditions (Items);
while Present (Prag) loop
- if Pragma_Name (Prag) = Name_Precondition
+ if Pragma_Name_Mapped (Prag) = Name_Precondition
and then Class_Present (Prag)
then
Check_Prag :=
@@ -2240,7 +2238,7 @@ package body Contracts is
if Present (Items) then
Prag := Pre_Post_Conditions (Items);
while Present (Prag) loop
- if Pragma_Name (Prag) = Name_Precondition then
+ if Pragma_Name_Mapped (Prag) = Name_Precondition then
Prepend_To_Decls_Or_Save (Prag);
end if;
@@ -2265,7 +2263,7 @@ package body Contracts is
-- Note that non-matching pragmas are skipped
if Nkind (Decl) = N_Pragma then
- if Pragma_Name (Decl) = Name_Precondition then
+ if Pragma_Name_Mapped (Decl) = Name_Precondition then
Prepend_To_Decls_Or_Save (Decl);
end if;