OSDN Git Service

2010-10-22 Robert Dewar <dewar@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 22 Oct 2010 10:04:20 +0000 (10:04 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 22 Oct 2010 10:04:20 +0000 (10:04 +0000)
* exp_ch5.adb, par-ch4.adb, par-ch5.adb, sem_ch5.adb, sinfo.ads: Minor
reformatting.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165814 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/exp_ch5.adb
gcc/ada/par-ch4.adb
gcc/ada/par-ch5.adb
gcc/ada/sem_ch5.adb
gcc/ada/sinfo.ads

index 5e656f9..a640b46 100644 (file)
@@ -1,3 +1,8 @@
+2010-10-22  Robert Dewar  <dewar@adacore.com>
+
+       * exp_ch5.adb, par-ch4.adb, par-ch5.adb, sem_ch5.adb, sinfo.ads: Minor
+       reformatting.
+
 2010-10-22  Arnaud Charlet  <charlet@adacore.com>
 
        * a-locale.adb: Minor code clean up.
index b0a4d49..5fe2c48 100644 (file)
@@ -2760,13 +2760,12 @@ package body Exp_Ch5 is
       Isc        : constant Node_Id    := Iteration_Scheme (N);
       I_Spec     : constant Node_Id    := Iterator_Specification (Isc);
       Id         : constant Entity_Id  := Defining_Identifier (I_Spec);
-      Container  : constant Entity_Id :=  Entity (Name (I_Spec));
+      Container  : constant Entity_Id  :=  Entity (Name (I_Spec));
+      Typ        : constant Entity_Id  := Etype (Container);
 
-      Typ        : constant Entity_Id := Etype (Container);
-
-      Cursor     : Entity_Id;
-      New_Loop   : Node_Id;
-      Stats      : List_Id;
+      Cursor   : Entity_Id;
+      New_Loop : Node_Id;
+      Stats    : List_Id;
 
    begin
       if Is_Array_Type (Typ) then
@@ -2809,7 +2808,6 @@ package body Exp_Ch5 is
             end;
 
          else
-
             --  for Index in Array loop ...
 
             --  The cursor (index into the array) is the source Id
@@ -2832,31 +2830,29 @@ package body Exp_Ch5 is
                 End_Label        => Empty);
          end if;
 
+      --  Iterators over containers
+
       else
+         --  In both cases these require a cursor of the proper type
 
-         --  Iterators over containers. In both cases these require a cursor of
-         --  the proper type.
+         --    Cursor : P.Cursor_Type := Container.First;
+         --    while Cursor /= P.No_Element loop
 
-         --  Cursor : P.Cursor_Type := Container.First;
-         --  while Cursor /= P.No_Element loop
+         --       Obj : P.Element_Type renames Element (Cursor);
+         --       --  For the "of" form, the element name renames the element
+         --       --  designated by the cursor.
 
-         --     Obj : P.Element_Type renames Element (Cursor);
-         --     --  For the "of" form, the element name renames the element
-         --     --  designated by the cursor.
+         --       Statements;
+         --       P.Next (Cursor);
+         --    end loop;
 
-         --     Statements;
-         --     P.Next (Cursor);
-         --  end loop;
-         --
          --  with the obvious replacements if "reverse" is specified.
 
          declare
             Element_Type  : constant Entity_Id := Etype (Id);
             Pack          : constant Entity_Id := Scope (Etype (Container));
-
             Name_Init     : Name_Id;
             Name_Step     : Name_Id;
-
             Cond          : Node_Id;
             Cursor_Decl   : Node_Id;
             Renaming_Decl : Node_Id;
@@ -2866,7 +2862,6 @@ package body Exp_Ch5 is
 
             if Of_Present (I_Spec) then
                Cursor := Make_Temporary (Loc, 'C');
-
             else
                Cursor := Id;
             end if;
index 8ab04ef..5e26def 100644 (file)
@@ -2536,7 +2536,7 @@ package body Ch4 is
          raise Error_Resync;
       end if;
 
-      Scan;
+      Scan; -- past SOME
       I_Spec := P_Loop_Parameter_Specification;
 
       if Nkind (I_Spec) = N_Loop_Parameter_Specification then
index de5883a..400b3e1 100644 (file)
@@ -1570,6 +1570,7 @@ package body Ch5 is
       Scan; -- past FOR
       Iter_Scheme_Node := New_Node (N_Iteration_Scheme, Token_Ptr);
       Spec := P_Loop_Parameter_Specification;
+
       if Nkind (Spec) = N_Loop_Parameter_Specification then
          Set_Loop_Parameter_Specification (Iter_Scheme_Node, Spec);
       else
@@ -1750,6 +1751,7 @@ package body Ch5 is
 
    function P_Iterator_Specification (Def_Id : Node_Id) return Node_Id is
       Node1 : Node_Id;
+
    begin
       Node1 :=  New_Node (N_Iterator_Specification, Token_Ptr);
       Set_Defining_Identifier (Node1, Def_Id);
@@ -1776,7 +1778,6 @@ package body Ch5 is
       end if;
 
       Set_Name (Node1, P_Name);
-
       return Node1;
    end P_Iterator_Specification;
 
index a4963be..e79da0a 100644 (file)
@@ -1734,6 +1734,8 @@ package body Sem_Ch5 is
    --  Start of processing for Analyze_Iteration_Scheme
 
    begin
+      --  Why is following check needed ???
+
       if Analyzed (N) then
          return;
       end if;
@@ -1806,9 +1808,8 @@ package body Sem_Ch5 is
                      if Nkind (DS) = N_Function_Call
                        or else
                          (Is_Entity_Name (DS)
-                            and then not Is_Type (Entity (DS)))
+                           and then not Is_Type (Entity (DS)))
                      then
-
                         --  This is an iterator specification. Rewrite as such
                         --  and analyze.
 
@@ -1823,7 +1824,6 @@ package body Sem_Ch5 is
                                           Empty,
                                         Reverse_Present     =>
                                           Reverse_Present (LP));
-
                         begin
                            Set_Iterator_Specification (N, I_Spec);
                            Set_Loop_Parameter_Specification (N, Empty);
@@ -1981,8 +1981,8 @@ package body Sem_Ch5 is
       Subt      : constant Node_Id := Subtype_Indication (N);
       Container : constant Node_Id := Name (N);
 
-      Ent       : Entity_Id;
-      Typ       : Entity_Id;
+      Ent : Entity_Id;
+      Typ : Entity_Id;
 
    begin
       Enter_Name (Def_Id);
@@ -1998,15 +1998,15 @@ package body Sem_Ch5 is
       if Is_Array_Type (Typ) then
          if Of_Present (N) then
             Set_Etype (Def_Id, Component_Type (Typ));
-
          else
             Set_Etype (Def_Id, Etype (First_Index (Typ)));
          end if;
 
-      else
-         --  Iteration over a container
+      --  Iteration over a container
 
+      else
          Set_Ekind (Def_Id, E_Loop_Parameter);
+
          if Of_Present (N) then
 
             --  Find the Element_Type in the package instance that defines the
@@ -2023,7 +2023,6 @@ package body Sem_Ch5 is
             end loop;
 
          else
-
             --  Find the Cursor type in similar fashion
 
             Ent := First_Entity (Scope (Typ));
index 3608ad8..186b789 100644 (file)
@@ -1544,10 +1544,6 @@ package Sinfo is
    --    is used for properly setting out of range values for use by pragmas
    --    Initialize_Scalars and Normalize_Scalars.
 
-   --  Of_Present (Flag16)
-   --  Present in N_Iterator_Specification nodes, to mark the Ada 2012 iterator
-   --  form over arrays and containers.
-
    --  Original_Discriminant (Node2-Sem)
    --    Present in identifiers. Used in references to discriminants that
    --    appear in generic units. Because the names of the discriminants may be
@@ -4220,6 +4216,8 @@ package Sinfo is
       --  Of_Present (Flag16)
       --  Subtype_Indication (Node5)
 
+      --  Note: The Of_Present flag distinguishes the two forms
+
       --------------------------
       -- 5.6  Block Statement --
       --------------------------
@@ -11758,6 +11756,7 @@ package Sinfo is
    pragma Inline (Inherited_Discriminant);
    pragma Inline (Instance_Spec);
    pragma Inline (Intval);
+   pragma Inline (Iterator_Specification);
    pragma Inline (Is_Accessibility_Actual);
    pragma Inline (Is_Asynchronous_Call_Block);
    pragma Inline (Is_Component_Left_Opnd);
@@ -11821,6 +11820,7 @@ package Sinfo is
    pragma Inline (Null_Exclusion_In_Return_Present);
    pragma Inline (Null_Record_Present);
    pragma Inline (Object_Definition);
+   pragma Inline (Of_Present);
    pragma Inline (Original_Discriminant);
    pragma Inline (Original_Entity);
    pragma Inline (Others_Discrete_Choices);
@@ -12072,6 +12072,7 @@ package Sinfo is
    pragma Inline (Set_Inherited_Discriminant);
    pragma Inline (Set_Instance_Spec);
    pragma Inline (Set_Intval);
+   pragma Inline (Set_Iterator_Specification);
    pragma Inline (Set_Is_Accessibility_Actual);
    pragma Inline (Set_Is_Asynchronous_Call_Block);
    pragma Inline (Set_Is_Component_Left_Opnd);
@@ -12136,6 +12137,7 @@ package Sinfo is
    pragma Inline (Set_Null_Exclusion_In_Return_Present);
    pragma Inline (Set_Null_Record_Present);
    pragma Inline (Set_Object_Definition);
+   pragma Inline (Set_Of_Present);
    pragma Inline (Set_Original_Discriminant);
    pragma Inline (Set_Original_Entity);
    pragma Inline (Set_Others_Discrete_Choices);