+2016-04-20 Javier Miranda <miranda@adacore.com>
+
+ * sem_ch5.adb (Analyze_Iterator_Specification): Remove transient
+ scope associated with the renaming object declaration.
+ * exp_util.adb (Insert_Actions): Remove handling of iterator
+ loop marked as requiring the secondary stack.
+
+2016-04-20 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_attr.adb (Analyze_Attribute, case 'Image): Implement
+ AI12-0124, which extends the functionality of the attribute so it
+ reflects the semantics of GNAT 'Img when applied to scalar types.
+ * lib-xref.adb: minor whitespace layout fix.
+
2016-04-20 Vincent Celier <celier@adacore.com>
* clean.adb (Gnatclean): Fail if project file specified and
end if;
return;
-
- -- Iteration scheme located in a transient scope
-
- elsif Nkind (P) = N_Iteration_Scheme
- and then Present (Wrapped_Node)
- then
- -- If the enclosing iterator loop is marked as requiring the
- -- secondary stack then the actions must be inserted in the
- -- transient scope.
-
- if Uses_Sec_Stack
- (Find_Enclosing_Iterator_Loop (Current_Scope))
- then
- Store_Before_Actions_In_Scope (Ins_Actions);
- return;
- end if;
end if;
-- Statements, declarations, pragmas, representation clauses
while Present (Formal) loop
if Ekind (Formal) = E_In_Parameter then
- if Nkind (Parameter_Type (Parent (Formal)))
- = N_Access_Definition
+ if Nkind (Parameter_Type (Parent (Formal))) = N_Access_Definition
then
Generate_Reference (E, Formal, '^', False);
else
-- Image --
-----------
- when Attribute_Image => Image :
- begin
+ when Attribute_Image => Image : begin
Check_SPARK_05_Restriction_On_Attribute;
- Check_Scalar_Type;
+
+ -- AI12-00124-1 : The ARG has adopted the GNAT semantics of 'Img
+ -- for scalar types, so that the prefix can be an object and not
+ -- a type, and there is no need for an argument. Given this vote
+ -- of confidence from the ARG, simplest is to transform this new
+ -- usage of 'Image into a reference to 'Img.
+
+ if Ada_Version > Ada_2005
+ and then Is_Object_Reference (P)
+ and then Is_Scalar_Type (P_Type)
+ then
+ Rewrite (N,
+ Make_Attribute_Reference (Loc,
+ Prefix => Relocate_Node (P),
+ Attribute_Name => Name_Img));
+ Analyze (N);
+ return;
+
+ else
+ Check_Scalar_Type;
+ end if;
+
Set_Etype (N, Standard_String);
if Is_Real_Type (P_Type) then
with Errout; use Errout;
with Expander; use Expander;
with Exp_Ch6; use Exp_Ch6;
-with Exp_Ch7; use Exp_Ch7;
with Exp_Util; use Exp_Util;
with Freeze; use Freeze;
with Ghost; use Ghost;
Name =>
New_Copy_Tree (Iter_Name, New_Sloc => Loc));
- -- Create a transient scope to ensure that all the temporaries
- -- generated by Remove_Side_Effects as part of processing this
- -- renaming declaration (if any) are attached by Insert_Actions
- -- to it. It has no effect on the generated code if no actions
- -- are added to it (see Wrap_Transient_Declaration).
-
- if not Is_Array_Type (Typ) and then Expander_Active then
- Establish_Transient_Scope (Name (Decl), Sec_Stack => True);
- end if;
-
Insert_Actions (Parent (Parent (N)), New_List (Decl));
Rewrite (Name (N), New_Occurrence_Of (Id, Loc));
Set_Etype (Id, Typ);
-- Iterate is not a reserved name. What matters is that the return type
-- of the function is an iterator type.
- elsif Is_Entity_Name (Iter_Name) or else not Expander_Active then
+ elsif Is_Entity_Name (Iter_Name) then
Analyze (Iter_Name);
if Nkind (Iter_Name) = N_Function_Call then
else
Set_Etype (Def_Id, Get_Cursor_Type (Typ));
+ Check_Reverse_Iteration (Etype (Iter_Name));
end if;
end if;