diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2016-04-18 14:48:42 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2016-04-18 14:48:42 +0200 |
commit | a65dcb0d6ebb2f0d5c7570f6477baedeb81464c1 (patch) | |
tree | 01bc4b041a83ae527795ebd6050f3e69044be10d /gcc | |
parent | 7b3ccbbf0e4f9cde4fdb5ed9cfb6aebd93554240 (diff) | |
download | gcc-a65dcb0d6ebb2f0d5c7570f6477baedeb81464c1.zip gcc-a65dcb0d6ebb2f0d5c7570f6477baedeb81464c1.tar.gz gcc-a65dcb0d6ebb2f0d5c7570f6477baedeb81464c1.tar.bz2 |
[multiple changes]
2016-04-18 Ed Schonberg <schonberg@adacore.com>
* sem_prag.adb (Analyze_Pragma, case Test_Case): Improve error
message for wrong placement of aspect Test_Case.
2016-04-18 Hristian Kirtchev <kirtchev@adacore.com>
* einfo.ads: Update the documentation of attribute Renamed_Object.
* exp_spark.adb (Expand_Potential_Renaming): Reimplemented.
2016-04-18 Gary Dismukes <dismukes@adacore.com>
* exp_ch4.adb (Optimize_Length_Comparison): Return immediately
in the case of AAMP (same as for use of the -gnatd.P switch) to
suppress this optimization, which avoids creating a dependence
on the 64-bit arithmetic package.
From-SVN: r235144
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 17 | ||||
-rw-r--r-- | gcc/ada/einfo.ads | 21 | ||||
-rw-r--r-- | gcc/ada/exp_ch4.adb | 6 | ||||
-rw-r--r-- | gcc/ada/exp_spark.adb | 32 | ||||
-rw-r--r-- | gcc/ada/sem_prag.adb | 7 |
5 files changed, 62 insertions, 21 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b637472..b72d524 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,20 @@ +2016-04-18 Ed Schonberg <schonberg@adacore.com> + + * sem_prag.adb (Analyze_Pragma, case Test_Case): Improve error + message for wrong placement of aspect Test_Case. + +2016-04-18 Hristian Kirtchev <kirtchev@adacore.com> + + * einfo.ads: Update the documentation of attribute Renamed_Object. + * exp_spark.adb (Expand_Potential_Renaming): Reimplemented. + +2016-04-18 Gary Dismukes <dismukes@adacore.com> + + * exp_ch4.adb (Optimize_Length_Comparison): Return immediately + in the case of AAMP (same as for use of the -gnatd.P switch) to + suppress this optimization, which avoids creating a dependence + on the 64-bit arithmetic package. + 2016-04-18 Arnaud Charlet <charlet@adacore.com> * exp_ch4.adb: Update comment. diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index 1fb29e4d..76520c8 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -3886,17 +3886,16 @@ package Einfo is -- package can see the entities in the package via the renaming. -- Renamed_Object (Node18) --- Defined in all objects (constants, variables, components, formal --- parameters, generic formal parameters, and loop parameters). --- ??? Defined in discriminants? --- Set non-Empty if the object was declared by a renaming declaration, --- in which case it references the tree node for the name of the renamed --- object. This is only possible for the variable and constant cases. --- For formal parameters, this field is used in the course of inline --- expansion, to map the formals of a subprogram into the corresponding --- actuals. For formals of a task entry, it denotes the local renaming --- that replaces the actual within the accept statement. The field is --- Empty otherwise (it is always empty for loop parameters). +-- Defined in components, constants, discriminants, formal parameters, +-- generic formals, loop parameters, and variables. Set to non-Empty if +-- the object was declared by a renaming declaration. For constants and +-- variables, the attribute references the tree node for the name of the +-- renamed object. For formal parameters, the field is used in inlining +-- and maps the entities of all formal parameters of a subprogram to the +-- entities of the corresponding actuals. For formals of a task entry, +-- the attribute denotes the local renaming that replaces the actual +-- within an accept statement. For all remaining cases (discriminants, +-- loop parameters) the field is Empty. -- Renaming_Map (Uint9) -- Defined in generic subprograms, generic packages, and their diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 08b99a3..2e7b36b 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -12806,9 +12806,11 @@ package body Exp_Ch4 is return; end if; - -- Nothing to do if special -gnatd.P debug flag set + -- Nothing to do if special -gnatd.P debug flag set or target is AAMP. + -- For AAMP the 64-bit arithmetic package would get dragged in, which + -- we want to avoid, plus this optimization has limited benefit on AAMP. - if Debug_Flag_Dot_PP then + if Debug_Flag_Dot_PP or else AAMP_On_Target then return; end if; diff --git a/gcc/ada/exp_spark.adb b/gcc/ada/exp_spark.adb index 0fb5040..d1e97fc 100644 --- a/gcc/ada/exp_spark.adb +++ b/gcc/ada/exp_spark.adb @@ -31,6 +31,7 @@ with Exp_Util; use Exp_Util; with Sem_Res; use Sem_Res; with Sem_Util; use Sem_Util; with Sinfo; use Sinfo; +with Tbuild; use Tbuild; package body Exp_SPARK is @@ -117,16 +118,35 @@ package body Exp_SPARK is ------------------------------- procedure Expand_Potential_Renaming (N : Node_Id) is - E : constant Entity_Id := Entity (N); - T : constant Entity_Id := Etype (N); + Id : constant Entity_Id := Entity (N); + Loc : constant Source_Ptr := Sloc (N); + Typ : constant Entity_Id := Etype (N); + Ren_Id : Node_Id; begin -- Replace a reference to a renaming with the actual renamed object - if Ekind (E) in Object_Kind and then Present (Renamed_Object (E)) then - Rewrite (N, New_Copy_Tree (Renamed_Object (E))); - Reset_Analyzed_Flags (N); - Analyze_And_Resolve (N, T); + if Ekind (Id) in Object_Kind then + Ren_Id := Renamed_Object (Id); + + if Present (Ren_Id) then + + -- The renamed object is an entity when instantiating generics + -- or inlining bodies. In this case the renaming is part of the + -- mapping "prologue" which links actuals to formals. + + if Nkind (Ren_Id) in N_Entity then + Rewrite (N, New_Occurrence_Of (Ren_Id, Loc)); + + -- Otherwise the renamed object denotes a name + + else + Rewrite (N, New_Copy_Tree (Ren_Id)); + Reset_Analyzed_Flags (N); + end if; + + Analyze_And_Resolve (N, Typ); + end if; end if; end Expand_Potential_Renaming; diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 8d212fe..27a44d8 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -21739,7 +21739,8 @@ package body Sem_Prag is -- Otherwise the placement is illegal else - Pragma_Misplaced; + Error_Pragma + ("pragma % must be specified within a package declaration"); return; end if; @@ -21778,7 +21779,9 @@ package body Sem_Prag is -- Otherwise the placement is illegal else - Pragma_Misplaced; + Error_Pragma + ("pragma % must be applied to a library-level subprogram " + & "declaration"); return; end if; |