Commit 8d80ff64 by Arnaud Charlet

[multiple changes]

 2013-07-08  Robert Dewar  <dewar@adacore.com>

	* sem_ch8.adb, exp_ch3.adb: Minor reformatting.

2013-07-08  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_ch4.adb (Expand_N_Op_Eq): When comparing two
	Bounded_Strings, use the predefined equality function of the
	root Super_String type.

From-SVN: r200760
parent b2c28399
2013-07-08 Robert Dewar <dewar@adacore.com>
* sem_ch8.adb, exp_ch3.adb: Minor reformatting.
2013-07-08 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch4.adb (Expand_N_Op_Eq): When comparing two
Bounded_Strings, use the predefined equality function of the
root Super_String type.
2013-07-08 Hristian Kirtchev <kirtchev@adacore.com> 2013-07-08 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch4.adb (Create_Alternative): Removed. * exp_ch4.adb (Create_Alternative): Removed.
......
...@@ -7283,16 +7283,17 @@ package body Exp_Ch3 is ...@@ -7283,16 +7283,17 @@ package body Exp_Ch3 is
-- When compiling in Ada 2012 mode, ensure that the accessibility -- When compiling in Ada 2012 mode, ensure that the accessibility
-- level of the subpool access type is not deeper than that of the -- level of the subpool access type is not deeper than that of the
-- pool_with_subpools. This check is not performed on .NET/JVM -- pool_with_subpools.
-- since these targets do not support pools. The check is omitted
-- on profiles that lack package System.Storage_Pools.Subpools.
elsif Ada_Version >= Ada_2012 elsif Ada_Version >= Ada_2012
and then Present (Associated_Storage_Pool (Def_Id)) and then Present (Associated_Storage_Pool (Def_Id))
-- Omit this check on .NET/JVM where pools are not supported
and then VM_Target = No_VM and then VM_Target = No_VM
-- ??? Temporary workaround until restriction No_Storage_Pools -- Omit this check for the case of a configurable run-time that
-- is implemented. -- does not provide package System.Storage_Pools.Subpools.
and then RTE_Available (RE_Root_Storage_Pool_With_Subpools) and then RTE_Available (RE_Root_Storage_Pool_With_Subpools)
then then
......
...@@ -7242,6 +7242,27 @@ package body Exp_Ch4 is ...@@ -7242,6 +7242,27 @@ package body Exp_Ch4 is
Build_Equality_Call Build_Equality_Call
(TSS (Root_Type (Typl), TSS_Composite_Equality)); (TSS (Root_Type (Typl), TSS_Composite_Equality));
-- When comparing two Bounded_Strings, use the primitive equality of
-- the root Super_String type.
elsif Is_Bounded_String (Typl) then
Prim :=
First_Elmt (Collect_Primitive_Operations (Root_Type (Typl)));
while Present (Prim) loop
exit when Chars (Node (Prim)) = Name_Op_Eq
and then Etype (First_Formal (Node (Prim))) =
Etype (Next_Formal (First_Formal (Node (Prim))))
and then Base_Type (Etype (Node (Prim))) = Standard_Boolean;
Next_Elmt (Prim);
end loop;
-- A Super_String type should always have a primitive equality
pragma Assert (Present (Prim));
Build_Equality_Call (Node (Prim));
-- Otherwise expand the component by component equality. Note that -- Otherwise expand the component by component equality. Note that
-- we never use block-bit comparisons for records, because of the -- we never use block-bit comparisons for records, because of the
-- problems with gaps. The backend will often be able to recombine -- problems with gaps. The backend will often be able to recombine
...@@ -10718,11 +10739,11 @@ package body Exp_Ch4 is ...@@ -10718,11 +10739,11 @@ package body Exp_Ch4 is
Expand_Composite_Equality (Nod, Etype (C), Expand_Composite_Equality (Nod, Etype (C),
Lhs => Lhs =>
Make_Selected_Component (Loc, Make_Selected_Component (Loc,
Prefix => New_Lhs, Prefix => New_Lhs,
Selector_Name => New_Reference_To (C, Loc)), Selector_Name => New_Reference_To (C, Loc)),
Rhs => Rhs =>
Make_Selected_Component (Loc, Make_Selected_Component (Loc,
Prefix => New_Rhs, Prefix => New_Rhs,
Selector_Name => New_Reference_To (C, Loc)), Selector_Name => New_Reference_To (C, Loc)),
Bodies => Bodies); Bodies => Bodies);
......
...@@ -3300,14 +3300,14 @@ package body Sem_Ch8 is ...@@ -3300,14 +3300,14 @@ package body Sem_Ch8 is
------------------------ ------------------------
procedure Attribute_Renaming (N : Node_Id) is procedure Attribute_Renaming (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N); Loc : constant Source_Ptr := Sloc (N);
Nam : constant Node_Id := Name (N); Nam : constant Node_Id := Name (N);
Spec : constant Node_Id := Specification (N); Spec : constant Node_Id := Specification (N);
New_S : constant Entity_Id := Defining_Unit_Name (Spec); New_S : constant Entity_Id := Defining_Unit_Name (Spec);
Aname : constant Name_Id := Attribute_Name (Nam); Aname : constant Name_Id := Attribute_Name (Nam);
Form_Num : Nat := 0; Form_Num : Nat := 0;
Expr_List : List_Id := No_List; Expr_List : List_Id := No_List;
Attr_Node : Node_Id; Attr_Node : Node_Id;
Body_Node : Node_Id; Body_Node : Node_Id;
...@@ -3323,9 +3323,7 @@ package body Sem_Ch8 is ...@@ -3323,9 +3323,7 @@ package body Sem_Ch8 is
-- and the GNAT attribute 'Img, which GNAT treats as renameable. -- and the GNAT attribute 'Img, which GNAT treats as renameable.
if not Is_Non_Empty_List (Parameter_Specifications (Spec)) then if not Is_Non_Empty_List (Parameter_Specifications (Spec)) then
if Aname /= Name_AST_Entry if Aname /= Name_AST_Entry and then Aname /= Name_Img then
and then Aname /= Name_Img
then
Error_Msg_N Error_Msg_N
("subprogram renaming an attribute must have formals", N); ("subprogram renaming an attribute must have formals", N);
return; return;
...@@ -3344,8 +3342,8 @@ package body Sem_Ch8 is ...@@ -3344,8 +3342,8 @@ package body Sem_Ch8 is
-- there are no subtypes involved. -- there are no subtypes involved.
Rewrite (Parameter_Type (Param_Spec), Rewrite (Parameter_Type (Param_Spec),
New_Reference_To New_Reference_To
(Base_Type (Entity (Parameter_Type (Param_Spec))), Loc)); (Base_Type (Entity (Parameter_Type (Param_Spec))), Loc));
end if; end if;
if No (Expr_List) then if No (Expr_List) then
...@@ -3498,13 +3496,13 @@ package body Sem_Ch8 is ...@@ -3498,13 +3496,13 @@ package body Sem_Ch8 is
P : constant Node_Id := Prefix (Nam); P : constant Node_Id := Prefix (Nam);
begin begin
-- The prefix of 'Img is an object that is evaluated for -- The prefix of 'Img is an object that is evaluated for each call
-- each call of the function that renames it. -- of the function that renames it.
if Aname = Name_Img then if Aname = Name_Img then
Preanalyze_And_Resolve (P); Preanalyze_And_Resolve (P);
-- For all other attribute renamings, the prefix is a subtype. -- For all other attribute renamings, the prefix is a subtype
else else
Find_Type (P); Find_Type (P);
......
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