aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorYannick Moy <moy@adacore.com>2013-04-22 10:58:05 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2013-04-22 12:58:05 +0200
commitee40cdc0f9f75125839fe7267c1fe7da2b665c42 (patch)
tree2ec2991b4b703486a13a1e342cad99b4003d833a /gcc/ada
parent807b4ca20242c2fb813218ac9361e5e9a8aac6b5 (diff)
downloadgcc-ee40cdc0f9f75125839fe7267c1fe7da2b665c42.zip
gcc-ee40cdc0f9f75125839fe7267c1fe7da2b665c42.tar.gz
gcc-ee40cdc0f9f75125839fe7267c1fe7da2b665c42.tar.bz2
exp_prag.adb (Expand_Pragma_Loop_Variant): Rewrite pragma as null statement if ignored.
2013-04-22 Yannick Moy <moy@adacore.com> * exp_prag.adb (Expand_Pragma_Loop_Variant): Rewrite pragma as null statement if ignored. * sem_ch6.adb (Expand_Contract_Cases): Do nothing if pragma is ignored. * sem_prag.adb (Analyze_Pragma): Keep analyzing ignored pragmas. From-SVN: r198135
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/exp_prag.adb9
-rw-r--r--gcc/ada/sem_ch6.adb7
-rw-r--r--gcc/ada/sem_prag.adb26
4 files changed, 24 insertions, 25 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 616d249..2885785 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,10 @@
+2013-04-22 Yannick Moy <moy@adacore.com>
+
+ * exp_prag.adb (Expand_Pragma_Loop_Variant): Rewrite pragma as
+ null statement if ignored.
+ * sem_ch6.adb (Expand_Contract_Cases): Do nothing if pragma is ignored.
+ * sem_prag.adb (Analyze_Pragma): Keep analyzing ignored pragmas.
+
2013-04-22 Hristian Kirtchev <kirtchev@adacore.com>
* sem_prag.adb (Analyze_Contract_Case): New routine.
diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb
index 4e41efe..38efb86 100644
--- a/gcc/ada/exp_prag.adb
+++ b/gcc/ada/exp_prag.adb
@@ -1062,6 +1062,15 @@ package body Exp_Prag is
-- Start of processing for Expand_Pragma_Loop_Variant
begin
+ -- If pragma is not enabled, rewrite as Null statement. If pragma is
+ -- disabled, it has already been rewritten as a Null statement.
+
+ if Is_Ignored (N) then
+ Rewrite (N, Make_Null_Statement (Loc));
+ Analyze (N);
+ return;
+ end if;
+
-- Locate the enclosing loop for which this assertion applies. In the
-- case of Ada 2012 array iteration, we might be dealing with nested
-- loops. Only the outermost loop has an identifier.
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index b061a5d..ddd0a90 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -11595,6 +11595,13 @@ package body Sem_Ch6 is
-- Start of processing for Expand_Contract_Cases
begin
+ -- Do nothing if pragma is not enabled. If pragma is disabled, it has
+ -- already been rewritten as a Null statement.
+
+ if Is_Ignored (CCs) then
+ return;
+ end if;
+
-- Create the counter which tracks the number of case guards that
-- evaluate to True.
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 64bc2e7..66d772c 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -6768,7 +6768,7 @@ package body Sem_Prag is
Check_Applicable_Policy (N);
- -- If pragma is disable, rewrite as Null statement and skip analysis
+ -- If pragma is disabled, rewrite as Null statement and skip analysis
if Is_Disabled (N) then
Rewrite (N, Make_Null_Statement (Loc));
@@ -8733,14 +8733,6 @@ package body Sem_Prag is
GNAT_Pragma;
Check_Arg_Count (1);
- -- Completely ignore if not enabled
-
- if Is_Ignored (N) then
- Rewrite (N, Make_Null_Statement (Loc));
- Analyze (N);
- return;
- end if;
-
-- Check the placement of the pragma
if not Is_List_Member (N) then
@@ -13893,14 +13885,6 @@ package body Sem_Prag is
Check_Arg_Count (1);
Check_Loop_Pragma_Placement;
- -- Completely ignore if not enabled
-
- if Is_Ignored (N) then
- Rewrite (N, Make_Null_Statement (Loc));
- Analyze (N);
- return;
- end if;
-
Preanalyze_Assert_Expression (Expression (Arg1), Any_Boolean);
-- Transform pragma Loop_Invariant into equivalent pragma Check
@@ -13964,14 +13948,6 @@ package body Sem_Prag is
Check_At_Least_N_Arguments (1);
Check_Loop_Pragma_Placement;
- -- Completely ignore if not enabled
-
- if Is_Ignored (N) then
- Rewrite (N, Make_Null_Statement (Loc));
- Analyze (N);
- return;
- end if;
-
-- Process all increasing / decreasing expressions
Variant := First (Pragma_Argument_Associations (N));