aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_attr.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2016-10-12 14:33:50 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2016-10-12 14:33:50 +0200
commitfc3a3580dad5f061d1ac645ddb8b0c78889d10a8 (patch)
treefede0c12c626ebdcfb62006d351e6274b14a2242 /gcc/ada/sem_attr.adb
parent7504523eca9e01f30629b7bc22da57546ccd488d (diff)
downloadgcc-fc3a3580dad5f061d1ac645ddb8b0c78889d10a8.zip
gcc-fc3a3580dad5f061d1ac645ddb8b0c78889d10a8.tar.gz
gcc-fc3a3580dad5f061d1ac645ddb8b0c78889d10a8.tar.bz2
[multiple changes]
2016-10-12 Jerome Lambourg <lambourg@adacore.com> * init.c: Make sure to call finit on x86_64-vx7 to reinitialize the FPU unit. 2016-10-12 Arnaud Charlet <charlet@adacore.com> * lib-load.adb (Load_Unit): Generate an error message even when Error_Node is null. 2016-10-12 Ed Schonberg <schonberg@adacore.com> * lib-writ.adb (Write_ALI): Disable optimization related to transitive limited_with clauses for now. 2016-10-12 Javier Miranda <miranda@adacore.com> * sem_attr.adb (Analyze_Attribute_Old_Result): Generating C code handle 'old located in inlined _postconditions procedures. (Analyze_Attribute [Attribute_Result]): Handle 'result when rewriting the attribute as a reference to the formal parameter _Result of inlined _postconditions procedures. 2016-10-12 Tristan Gingold <gingold@adacore.com> * s-rident.ads (Profile_Info): Remove Max_Protected_Entries restriction from GNAT_Extended_Ravenscar * sem_ch9.adb (Analyze_Protected_Type_Declaration): Not a controlled type on restricted runtimes. 2016-10-12 Gary Dismukes <dismukes@adacore.com> * sem_ch3.adb (Derive_Subprogram): Add test for Is_Controlled of Parent_Type when determining whether an inherited subprogram with one of the special names Initialize, Adjust, or Finalize should be derived with its normal name even when inherited as a private operation (which would normally result in the inherited operation having a special "hidden" name). 2016-10-12 Ed Schonberg <schonberg@adacore.com> * sem_res.adb (Resolve_Call): If a function call returns a limited view of a type replace it with the non-limited view, which must be available when compiling call. This was already done elsewhere for non-overloaded calls, but needs to be done after resolution if function name is overloaded. 2016-10-12 Javier Miranda <miranda@adacore.com> * a-tags.adb (IW_Membership [private]): new overloaded subprogram that factorizes the code needed to check if a given type implements an interface type. (IW_Membership [public]): invoke the new internal IW_Membership function. (Is_Descendant_At_Same_Level): Fix this routine to implement RM 3.9 (12.3/3) From-SVN: r241036
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r--gcc/ada/sem_attr.adb38
1 files changed, 26 insertions, 12 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index c0be95d..cd7691f 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -1358,13 +1358,23 @@ package body Sem_Attr is
-- appear on a subprogram renaming, when the renamed entity is an
-- attribute reference.
- if not Nkind_In (Subp_Decl, N_Abstract_Subprogram_Declaration,
- N_Entry_Declaration,
- N_Generic_Subprogram_Declaration,
- N_Subprogram_Body,
- N_Subprogram_Body_Stub,
- N_Subprogram_Declaration,
- N_Subprogram_Renaming_Declaration)
+ -- Generating C code the internally built nested _postcondition
+ -- subprograms are inlined; after expanded, inlined aspects are
+ -- located in the internal block generated by the frontend.
+
+ if Nkind (Subp_Decl) = N_Block_Statement
+ and then Modify_Tree_For_C
+ and then In_Inlined_Body
+ then
+ null;
+
+ elsif not Nkind_In (Subp_Decl, N_Abstract_Subprogram_Declaration,
+ N_Entry_Declaration,
+ N_Generic_Subprogram_Declaration,
+ N_Subprogram_Body,
+ N_Subprogram_Body_Stub,
+ N_Subprogram_Declaration,
+ N_Subprogram_Renaming_Declaration)
then
return;
end if;
@@ -5276,6 +5286,9 @@ package body Sem_Attr is
-- Local variables
+ In_Inlined_C_Postcondition : constant Boolean :=
+ Modify_Tree_For_C and then In_Inlined_Body;
+
Legal : Boolean;
Pref_Id : Entity_Id;
Spec_Id : Entity_Id;
@@ -5309,10 +5322,7 @@ package body Sem_Attr is
-- 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
+ if No (Spec_Id) and then In_Inlined_C_Postcondition then
Spec_Id := Entity (P);
elsif not Legal then
@@ -5325,7 +5335,11 @@ package body Sem_Attr is
-- Instead, rewrite the attribute as a reference to formal parameter
-- _Result of the _Postconditions procedure.
- if Chars (Spec_Id) = Name_uPostconditions then
+ if Chars (Spec_Id) = Name_uPostconditions
+ or else
+ (In_Inlined_C_Postcondition
+ and then Nkind (Parent (Spec_Id)) = N_Block_Statement)
+ then
Rewrite (N, Make_Identifier (Loc, Name_uResult));
-- The type of formal parameter _Result is that of the function