summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_prag.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-01 13:47:34 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-01 13:47:34 +0000
commitbcde54d511448e977038b4355b233a418a42c0d3 (patch)
treee8a236c8e7a4c783a814ba81952ae78a2118a9b8 /gcc/ada/sem_prag.adb
parent6fa4bf38f688997d4dbe222e7423642e63459425 (diff)
downloadgcc-bcde54d511448e977038b4355b233a418a42c0d3.tar.gz
2014-08-01 Hristian Kirtchev <kirtchev@adacore.com>
* sem_attr.adb (Analyze_Attribute): Preanalyze and resolve the prefix of attribute Loop_Entry. * sem_prag.adb (Analyze_Pragma): Verify the placement of pragma Loop_Variant with respect to an enclosing loop (if any). (Contains_Loop_Entry): Update the parameter profile and all calls to this routine. * sem_res.adb (Resolve_Call): Code reformatting. Do not ask for the corresponding body before determining the nature of the ultimate alias's declarative node. 2014-08-01 Robert Dewar <dewar@adacore.com> * gnat1drv.adb, sem_ch4.adb: Minor reformatting. 2014-08-01 Robert Dewar <dewar@adacore.com> * sem_eval.adb (Rewrite_In_Raise_CE): Don't try to reuse inner constraint error node since it is a list member. 2014-08-01 Robert Dewar <dewar@adacore.com> * sem_warn.adb: Minor reformatting. 2014-08-01 Eric Botcazou <ebotcazou@adacore.com> * einfo.adb (Underlying_Type): Return the underlying full view of a private type if present. * freeze.adb (Freeze_Entity): Build a single freeze node for partial, full and underlying full views, if any. * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Private_Type>: Add a missing guard before the access to the Underlying_Full_View. * gcc-interface/trans.c (process_freeze_entity): Deal with underlying full view if present. * gcc-interface/utils.c (make_dummy_type): Avoid superfluous work. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@213463 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_prag.adb')
-rw-r--r--gcc/ada/sem_prag.adb35
1 files changed, 19 insertions, 16 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index da089301e41..5a3a255a441 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -10926,20 +10926,17 @@ package body Sem_Prag is
Pragma_Assume |
Pragma_Loop_Invariant =>
Assert : declare
- Expr : Node_Id;
- Newa : List_Id;
-
- Has_Loop_Entry : Boolean;
- -- Set True by
-
- function Contains_Loop_Entry return Boolean;
- -- Tests if Expr contains a Loop_Entry attribute reference
+ function Contains_Loop_Entry (Expr : Node_Id) return Boolean;
+ -- Determine whether expression Expr contains a Loop_Entry
+ -- attribute reference.
-------------------------
-- Contains_Loop_Entry --
-------------------------
- function Contains_Loop_Entry return Boolean is
+ function Contains_Loop_Entry (Expr : Node_Id) return Boolean is
+ Has_Loop_Entry : Boolean := False;
+
function Process (N : Node_Id) return Traverse_Result;
-- Process function for traversal to look for Loop_Entry
@@ -10964,11 +10961,15 @@ package body Sem_Prag is
-- Start of processing for Contains_Loop_Entry
begin
- Has_Loop_Entry := False;
Traverse (Expr);
return Has_Loop_Entry;
end Contains_Loop_Entry;
+ -- Local variables
+
+ Expr : Node_Id;
+ Newa : List_Id;
+
-- Start of processing for Assert
begin
@@ -10989,17 +10990,19 @@ package body Sem_Prag is
Check_Optional_Identifier (Arg1, Name_Check);
Expr := Get_Pragma_Arg (Arg1);
- -- Special processing for Loop_Invariant or for other cases if
- -- a Loop_Entry attribute is present.
+ -- Special processing for Loop_Invariant, Loop_Variant or for
+ -- other cases where a Loop_Entry attribute is present. If the
+ -- assertion pragma contains attribute Loop_Entry, ensure that
+ -- the related pragma is within a loop.
if Prag_Id = Pragma_Loop_Invariant
- or else Contains_Loop_Entry
+ or else Prag_Id = Pragma_Loop_Variant
+ or else Contains_Loop_Entry (Expr)
then
- -- Check restricted placement, must be within a loop
-
Check_Loop_Pragma_Placement;
- -- Do preanalyze to deal with embedded Loop_Entry attribute
+ -- Perform preanalysis to deal with embedded Loop_Entry
+ -- attributes.
Preanalyze_Assert_Expression (Expression (Arg1), Any_Boolean);
end if;