summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_attr.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2016-06-14 12:37:54 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2016-06-14 12:37:54 +0000
commitc8dfb75f1a223e0cef87bb2be0c99594969b6dc3 (patch)
treeeb700e1338bceabade0d1558530388a890e27c95 /gcc/ada/sem_attr.adb
parent14c96e30732caa87ac434dad535442d459169378 (diff)
downloadgcc-c8dfb75f1a223e0cef87bb2be0c99594969b6dc3.tar.gz
2016-06-14 Javier Miranda <miranda@adacore.com>
* sem_attr.adb (Analyze_Attribute_Old_Result): Adding assertion. (Analyze_Attribute [Attribute_Old]): Generating C handle analysis of 'old in inlined postconditions. (Analyze_Attribute [Attribute_Result]): Generating C handle analysis of 'result in inlined postconditions. * exp_attr.adb (Expand_N_Attribute_Reference [Attribute_Old]): Generating C handle expansion of 'old in inlined postconditions. * inline.adb (Declare_Postconditions_Result): New subprogram. * sem_ch12.adb (Copy_Generic_Node): Copy pragmas generated from aspects when generating C code since pre/post conditions are inlined and the frontend inlining relies on this routine to perform inlining. * exp_ch6.adb (Inlined_Subprogram): Replace Generate_C_Code by Modify_Tree_For_C. * exp_unst.adb (Visit_Node): Searching for up-level references skip entities defined in inlined subprograms. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@237437 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r--gcc/ada/sem_attr.adb27
1 files changed, 24 insertions, 3 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 30d33d213e2..a0740f0d3e7 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -1379,10 +1379,13 @@ package body Sem_Attr is
-- Hence, in this context, the spec_id of _postconditions is the
-- enclosing scope.
- if Generate_C_Code
+ if Modify_Tree_For_C
and then Chars (Spec_Id) = Name_uParent
and then Chars (Scope (Spec_Id)) = Name_uPostconditions
then
+ -- This situation occurs only when preanalyzing the inlined body
+ pragma Assert (not Full_Analysis);
+
Spec_Id := Scope (Spec_Id);
pragma Assert (Is_Inlined (Spec_Id));
end if;
@@ -4886,7 +4889,16 @@ package body Sem_Attr is
-- the case, then the aspect or pragma is illegal. Return as analysis
-- cannot be carried out.
- if not Legal then
+ -- The exception to this rule is when generating C since in this case
+ -- postconditions are inlined.
+
+ if No (Spec_Id)
+ and then Modify_Tree_For_C
+ and then In_Inlined_Body
+ then
+ Spec_Id := Entity (P);
+
+ elsif not Legal then
return;
end if;
@@ -5297,7 +5309,16 @@ package body Sem_Attr is
-- the case, then the aspect or pragma is illegal. Return as analysis
-- cannot be carried out.
- if not Legal then
+ -- The exception to this rule is when generating C since in this case
+ -- postconditions are inlined.
+
+ if No (Spec_Id)
+ and then Modify_Tree_For_C
+ and then In_Inlined_Body
+ then
+ Spec_Id := Entity (P);
+
+ elsif not Legal then
return;
end if;