Commit 229db351 by Arnaud Charlet

[multiple changes]

2010-10-22  Ed Schonberg  <schonberg@adacore.com>

	* sem_util.adb (May_Be_Lvalue): An actual in a function call can be an
	lvalue in Ada2012, if the function has in-out parameters.

2010-10-22  Robert Dewar  <dewar@adacore.com>

	* cstand.adb, einfo.adb, exp_attr.adb, sem_prag.adb, sem_vfpt.adb,
	sem_ch10.adb: Minor reformatting.

2010-10-22  Sergey Rybin  <rybin@adacore.com>

	* gnat_ugn.texi: Remove most of the content of gnatcheck chapter.

2010-10-22  Ed Schonberg  <schonberg@adacore.com>

	* sem_attr.adb: Handle indexed P'old.

From-SVN: r165817
parent 23c799b1
2010-10-22 Ed Schonberg <schonberg@adacore.com>
* sem_util.adb (May_Be_Lvalue): An actual in a function call can be an
lvalue in Ada2012, if the function has in-out parameters.
2010-10-22 Robert Dewar <dewar@adacore.com>
* cstand.adb, einfo.adb, exp_attr.adb, sem_prag.adb, sem_vfpt.adb,
sem_ch10.adb: Minor reformatting.
2010-10-22 Sergey Rybin <rybin@adacore.com>
* gnat_ugn.texi: Remove most of the content of gnatcheck chapter.
2010-10-22 Ed Schonberg <schonberg@adacore.com>
* sem_attr.adb: Handle indexed P'old.
2010-10-22 Geert Bosch <bosch@adacore.com> 2010-10-22 Geert Bosch <bosch@adacore.com>
* cstand.adb (Build_Float_Type): Set Float_Rep according to platform. * cstand.adb (Build_Float_Type): Set Float_Rep according to platform.
......
...@@ -146,7 +146,6 @@ package body CStand is ...@@ -146,7 +146,6 @@ package body CStand is
if AAMP_On_Target then if AAMP_On_Target then
Set_Float_Rep (E, AAMP); Set_Float_Rep (E, AAMP);
else else
Set_Float_Rep (E, IEEE_Binary); Set_Float_Rep (E, IEEE_Binary);
end if; end if;
......
...@@ -406,7 +406,6 @@ package body Einfo is ...@@ -406,7 +406,6 @@ package body Einfo is
-- Is_Compilation_Unit Flag149 -- Is_Compilation_Unit Flag149
-- Has_Pragma_Elaborate_Body Flag150 -- Has_Pragma_Elaborate_Body Flag150
-- (unused) Flag151
-- Entry_Accepted Flag152 -- Entry_Accepted Flag152
-- Is_Obsolescent Flag153 -- Is_Obsolescent Flag153
-- Has_Per_Object_Constraint Flag154 -- Has_Per_Object_Constraint Flag154
...@@ -516,6 +515,7 @@ package body Einfo is ...@@ -516,6 +515,7 @@ package body Einfo is
-- OK_To_Reference Flag249 -- OK_To_Reference Flag249
-- Has_Predicates Flag250 -- Has_Predicates Flag250
-- (unused) Flag151
-- (unused) Flag251 -- (unused) Flag251
-- (unused) Flag252 -- (unused) Flag252
-- (unused) Flag253 -- (unused) Flag253
......
...@@ -4773,10 +4773,10 @@ package body Exp_Attr is ...@@ -4773,10 +4773,10 @@ package body Exp_Attr is
begin begin
case Float_Rep (Btyp) is case Float_Rep (Btyp) is
-- For vax fpt types, call appropriate routine in special -- For vax fpt types, call appropriate routine in special
-- vax floating point unit. We do not have to worry about -- vax floating point unit. No need to worry about loads in
-- loads in this case, since these types have no signalling -- this case, since these types have no signalling NaN's.
-- NaN's.
when VAX_Native => Expand_Vax_Valid (N); when VAX_Native => Expand_Vax_Valid (N);
......
...@@ -3645,6 +3645,23 @@ package body Sem_Attr is ...@@ -3645,6 +3645,23 @@ package body Sem_Attr is
--------- ---------
when Attribute_Old => when Attribute_Old =>
-- The attribute reference is a primary. If expressions follow, the
-- attribute reference is an indexable object, so rewrite the node
-- accordingly.
if Present (E1) then
Rewrite (N,
Make_Indexed_Component (Loc,
Prefix =>
Make_Attribute_Reference (Loc,
Prefix => Relocate_Node (Prefix (N)),
Attribute_Name => Name_Old),
Expressions => Expressions (N)));
Analyze (N);
return;
end if;
Check_E0; Check_E0;
Set_Etype (N, P_Type); Set_Etype (N, P_Type);
...@@ -3669,8 +3686,8 @@ package body Sem_Attr is ...@@ -3669,8 +3686,8 @@ package body Sem_Attr is
Subp : Entity_Id := Current_Subprogram; Subp : Entity_Id := Current_Subprogram;
function Process (N : Node_Id) return Traverse_Result; function Process (N : Node_Id) return Traverse_Result;
-- Check that N does not contain references to local variables -- Check that N does not contain references to local variables or
-- or other local entities of Subp. -- other local entities of Subp.
------------- -------------
-- Process -- -- Process --
...@@ -3706,10 +3723,10 @@ package body Sem_Attr is ...@@ -3706,10 +3723,10 @@ package body Sem_Attr is
if Present (Enclosing_Subprogram (Current_Subprogram)) then if Present (Enclosing_Subprogram (Current_Subprogram)) then
-- Check that there is no reference to the enclosing -- Check that there is no reference to the enclosing
-- subprogram local variables. Otherwise, we might end -- subprogram local variables. Otherwise, we might end up
-- up being called from the enclosing subprogram and thus -- being called from the enclosing subprogram and thus using
-- using 'Old on a local variable which is not defined -- 'Old on a local variable which is not defined at entry
-- at entry time. -- time.
Subp := Enclosing_Subprogram (Current_Subprogram); Subp := Enclosing_Subprogram (Current_Subprogram);
Check_No_Local (P); Check_No_Local (P);
...@@ -3755,8 +3772,7 @@ package body Sem_Attr is ...@@ -3755,8 +3772,7 @@ package body Sem_Attr is
elsif Is_Entity_Name (P) elsif Is_Entity_Name (P)
and then Is_Pure (Entity (P)) and then Is_Pure (Entity (P))
then then
Error_Attr_P Error_Attr_P ("prefix of% attribute must not be declared pure");
("prefix of % attribute must not be declared pure");
end if; end if;
end if; end if;
......
...@@ -2562,11 +2562,10 @@ package body Sem_Ch10 is ...@@ -2562,11 +2562,10 @@ package body Sem_Ch10 is
Present (Renamed_Entity (Entity (Selector_Name (Pref)))) Present (Renamed_Entity (Entity (Selector_Name (Pref))))
and then Entity (Selector_Name (Pref)) /= Par_Name and then Entity (Selector_Name (Pref)) /= Par_Name
then then
-- The prefix is a child unit that denotes a renaming declaration.
-- The prefix is a child unit that denotes a renaming -- Replace the prefix directly with the renamed unit, because the
-- declaration. Replace the prefix directly with the renamed -- rest of the prefix is irrelevant to the visibility of the real
-- unit, because the rest of the prefix is irrelevant to the -- unit.
-- visibility of the real unit.
Rewrite (Pref, New_Occurrence_Of (Par_Name, Sloc (Pref))); Rewrite (Pref, New_Occurrence_Of (Par_Name, Sloc (Pref)));
exit; exit;
......
...@@ -1197,16 +1197,18 @@ package body Sem_Prag is ...@@ -1197,16 +1197,18 @@ package body Sem_Prag is
Typ : constant Entity_Id := Etype (Comp_Id); Typ : constant Entity_Id := Etype (Comp_Id);
function Inside_Generic_Body (Id : Entity_Id) return Boolean; function Inside_Generic_Body (Id : Entity_Id) return Boolean;
-- Determine whether entity Id appears inside a generic body -- Determine whether entity Id appears inside a generic body.
-- Shouldn't this be in a more general place ???
------------------------- -------------------------
-- Inside_Generic_Body -- -- Inside_Generic_Body --
------------------------- -------------------------
function Inside_Generic_Body (Id : Entity_Id) return Boolean is function Inside_Generic_Body (Id : Entity_Id) return Boolean is
S : Entity_Id := Id; S : Entity_Id;
begin begin
S := Id;
while Present (S) and then S /= Standard_Standard loop while Present (S) and then S /= Standard_Standard loop
if Ekind (S) = E_Generic_Package if Ekind (S) = E_Generic_Package
and then In_Package_Body (S) and then In_Package_Body (S)
...@@ -1338,6 +1340,7 @@ package body Sem_Prag is ...@@ -1338,6 +1340,7 @@ package body Sem_Prag is
procedure Check_First_Subtype (Arg : Node_Id) is procedure Check_First_Subtype (Arg : Node_Id) is
Argx : constant Node_Id := Get_Pragma_Arg (Arg); Argx : constant Node_Id := Get_Pragma_Arg (Arg);
Ent : constant Entity_Id := Entity (Argx); Ent : constant Entity_Id := Entity (Argx);
begin begin
if Is_First_Subtype (Ent) then if Is_First_Subtype (Ent) then
null; null;
...@@ -2195,7 +2198,6 @@ package body Sem_Prag is ...@@ -2195,7 +2198,6 @@ package body Sem_Prag is
if Error_Msg_Name_1 = Name_Precondition then if Error_Msg_Name_1 = Name_Precondition then
Error_Msg_Name_1 := Name_Pre; Error_Msg_Name_1 := Name_Pre;
elsif Error_Msg_Name_1 = Name_Postcondition then elsif Error_Msg_Name_1 = Name_Postcondition then
Error_Msg_Name_1 := Name_Post; Error_Msg_Name_1 := Name_Post;
end if; end if;
......
...@@ -7897,17 +7897,24 @@ package body Sem_Util is ...@@ -7897,17 +7897,24 @@ package body Sem_Util is
when N_Explicit_Dereference => when N_Explicit_Dereference =>
return False; return False;
-- Function call arguments are never lvalues -- Positional parameter for subprogram, entry, or accept call.
-- In older versions of Ada function call arguments are never
-- lvalues. In Ada2012 functions can have in-out parameters.
when N_Function_Call => when N_Function_Call |
return False; N_Procedure_Call_Statement |
-- Positional parameter for procedure, entry, or accept call
when N_Procedure_Call_Statement |
N_Entry_Call_Statement | N_Entry_Call_Statement |
N_Accept_Statement N_Accept_Statement
=> =>
if Nkind (P) = N_Function_Call
and then Ada_Version < Ada_2012
then
return False;
end if;
-- The following mechanism is clumsy and fragile. A single
-- flag set in Resolve_Actuals would be preferable ???
declare declare
Proc : Entity_Id; Proc : Entity_Id;
Form : Entity_Id; Form : Entity_Id;
......
...@@ -37,6 +37,7 @@ package body Sem_VFpt is ...@@ -37,6 +37,7 @@ package body Sem_VFpt is
procedure Set_D_Float (E : Entity_Id) is procedure Set_D_Float (E : Entity_Id) is
VAXDF_Digits : constant := 9; VAXDF_Digits : constant := 9;
begin begin
Init_Size (Base_Type (E), 64); Init_Size (Base_Type (E), 64);
Init_Alignment (Base_Type (E)); Init_Alignment (Base_Type (E));
...@@ -56,6 +57,7 @@ package body Sem_VFpt is ...@@ -56,6 +57,7 @@ package body Sem_VFpt is
procedure Set_F_Float (E : Entity_Id) is procedure Set_F_Float (E : Entity_Id) is
VAXFF_Digits : constant := 6; VAXFF_Digits : constant := 6;
begin begin
Init_Size (Base_Type (E), 32); Init_Size (Base_Type (E), 32);
Init_Alignment (Base_Type (E)); Init_Alignment (Base_Type (E));
...@@ -75,6 +77,7 @@ package body Sem_VFpt is ...@@ -75,6 +77,7 @@ package body Sem_VFpt is
procedure Set_G_Float (E : Entity_Id) is procedure Set_G_Float (E : Entity_Id) is
VAXGF_Digits : constant := 15; VAXGF_Digits : constant := 15;
begin begin
Init_Size (Base_Type (E), 64); Init_Size (Base_Type (E), 64);
Init_Alignment (Base_Type (E)); Init_Alignment (Base_Type (E));
...@@ -94,6 +97,7 @@ package body Sem_VFpt is ...@@ -94,6 +97,7 @@ package body Sem_VFpt is
procedure Set_IEEE_Long (E : Entity_Id) is procedure Set_IEEE_Long (E : Entity_Id) is
IEEEL_Digits : constant := 15; IEEEL_Digits : constant := 15;
begin begin
Init_Size (Base_Type (E), 64); Init_Size (Base_Type (E), 64);
Init_Alignment (Base_Type (E)); Init_Alignment (Base_Type (E));
...@@ -113,6 +117,7 @@ package body Sem_VFpt is ...@@ -113,6 +117,7 @@ package body Sem_VFpt is
procedure Set_IEEE_Short (E : Entity_Id) is procedure Set_IEEE_Short (E : Entity_Id) is
IEEES_Digits : constant := 6; IEEES_Digits : constant := 6;
begin begin
Init_Size (Base_Type (E), 32); Init_Size (Base_Type (E), 32);
Init_Alignment (Base_Type (E)); Init_Alignment (Base_Type (E));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment