aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2016-04-20 11:08:55 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2016-04-20 11:08:55 +0200
commite361e9a1dbb5b357207de2b6459b8f69f96420da (patch)
tree601763d688f331606803f2039b3d8354dfdcc11a /gcc
parentd67ffa886d642c7a08441023971a3c5099b58d4e (diff)
downloadgcc-e361e9a1dbb5b357207de2b6459b8f69f96420da.zip
gcc-e361e9a1dbb5b357207de2b6459b8f69f96420da.tar.gz
gcc-e361e9a1dbb5b357207de2b6459b8f69f96420da.tar.bz2
[multiple changes]
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. From-SVN: r235242
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog14
-rw-r--r--gcc/ada/exp_util.adb16
-rw-r--r--gcc/ada/lib-xref.adb3
-rw-r--r--gcc/ada/sem_attr.adb26
-rw-r--r--gcc/ada/sem_ch5.adb14
5 files changed, 40 insertions, 33 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index fd077b3..e6bc859 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,17 @@
+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
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index 2bed3f6..8ffbfa3 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -4075,22 +4075,6 @@ package body Exp_Util is
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
diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb
index 4751cd3..d64b4b2 100644
--- a/gcc/ada/lib-xref.adb
+++ b/gcc/ada/lib-xref.adb
@@ -1174,8 +1174,7 @@ package body Lib.Xref is
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
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 66c6432..a9bb2ff 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -3917,10 +3917,30 @@ package body Sem_Attr is
-- 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
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index 2309ada..1a9692c 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -30,7 +30,6 @@ with Einfo; use Einfo;
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;
@@ -1997,16 +1996,6 @@ package body Sem_Ch5 is
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);
@@ -2019,7 +2008,7 @@ package body Sem_Ch5 is
-- 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
@@ -2313,6 +2302,7 @@ package body Sem_Ch5 is
else
Set_Etype (Def_Id, Get_Cursor_Type (Typ));
+ Check_Reverse_Iteration (Etype (Iter_Name));
end if;
end if;