]> gcc.gnu.org Git - gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Wed, 20 Apr 2016 09:08:55 +0000 (11:08 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 20 Apr 2016 09:08:55 +0000 (11:08 +0200)
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

gcc/ada/ChangeLog
gcc/ada/exp_util.adb
gcc/ada/lib-xref.adb
gcc/ada/sem_attr.adb
gcc/ada/sem_ch5.adb

index fd077b3b01f72b04a8dd931daf83318597c52691..e6bc859a22a1139fa59bde12fa5dc6a912d2bde9 100644 (file)
@@ -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
index 2bed3f64c9d560389a256173b18399198314b0e6..8ffbfa31bf0e59092259cb6f4abfa5b988ff587c 100644 (file)
@@ -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
index 4751cd326663a92bd4f4e8d4c00038af779325d3..d64b4b25d2288a2750d907fab6888123b0b3fcde 100644 (file)
@@ -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
index 66c6432dddfdf73f50a9e29a4ae8a39e3cffb9f7..a9bb2ff8240f73a3b1421256d064d4b01f61a4d7 100644 (file)
@@ -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
index 2309ada48a2126500e6e65c287a357292ea2cc0c..1a9692cbdb6ff88738a97deeabd0f06bf38a0268 100644 (file)
@@ -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;
This page took 0.104838 seconds and 5 git commands to generate.