[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
This commit is contained in:
Arnaud Charlet 2016-04-18 14:48:42 +02:00
parent 7b3ccbbf0e
commit a65dcb0d6e
5 changed files with 62 additions and 21 deletions

View File

@ -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.

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;