sem_aggr.adb, [...]: Minor reformatting & code reorganization.
authorRobert Dewar <dewar@adacore.com>
Fri, 1 Aug 2014 09:57:04 +0000 (09:57 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 1 Aug 2014 09:57:04 +0000 (11:57 +0200)
2014-08-01  Robert Dewar  <dewar@adacore.com>

* sem_aggr.adb, exp_atag.adb, layout.adb, nlists.adb, nlists.ads,
exp_attr.adb, exp_ch9.adb, par-ch12.adb, exp_aggr.adb,
exp_ch3.adb: Minor reformatting & code reorganization.

From-SVN: r213439

gcc/ada/ChangeLog
gcc/ada/exp_aggr.adb
gcc/ada/exp_atag.adb
gcc/ada/exp_attr.adb
gcc/ada/exp_ch3.adb
gcc/ada/exp_ch9.adb
gcc/ada/layout.adb
gcc/ada/nlists.adb
gcc/ada/nlists.ads
gcc/ada/par-ch12.adb
gcc/ada/sem_aggr.adb

index 08dc0bc956fae1e66a385071bf966abacb129c7b..0d4085f44dd85e1115da564bac45f65bc8cde278 100644 (file)
@@ -1,3 +1,9 @@
+2014-08-01  Robert Dewar  <dewar@adacore.com>
+
+       * sem_aggr.adb, exp_atag.adb, layout.adb, nlists.adb, nlists.ads,
+       exp_attr.adb, exp_ch9.adb, par-ch12.adb, exp_aggr.adb,
+       exp_ch3.adb: Minor reformatting & code reorganization.
+
 2014-08-01  Robert Dewar  <dewar@adacore.com>
 
        * gnat_rm.texi: Remove VMS specific rules for pragma Ident.
index 4638537a010c787f806ca5f0cc6157af4a51fb75..557e3c82dfef756e74fa8e86406c66bd30823862 100644 (file)
@@ -1163,9 +1163,9 @@ package body Exp_Aggr is
 
             if Needs_Finalization (Ctype) then
                Append_To (L,
-                 Make_Init_Call (
-                   Obj_Ref => New_Copy_Tree (Indexed_Comp),
-                   Typ     => Ctype));
+                 Make_Init_Call
+                   (Obj_Ref => New_Copy_Tree (Indexed_Comp),
+                    Typ     => Ctype));
             end if;
 
          else
@@ -1262,9 +1262,9 @@ package body Exp_Aggr is
                   and then Nkind (Expr) = N_Aggregate)
             then
                Append_To (L,
-                 Make_Adjust_Call (
-                   Obj_Ref => New_Copy_Tree (Indexed_Comp),
-                   Typ     => Comp_Type));
+                 Make_Adjust_Call
+                   (Obj_Ref => New_Copy_Tree (Indexed_Comp),
+                    Typ     => Comp_Type));
             end if;
          end if;
 
@@ -1406,11 +1406,12 @@ package body Exp_Aggr is
 
          --  Construct the final loop
 
-         Append_To (S, Make_Implicit_Loop_Statement
-                         (Node             => N,
-                          Identifier       => Empty,
-                          Iteration_Scheme => L_Iteration_Scheme,
-                          Statements       => L_Body));
+         Append_To (S,
+           Make_Implicit_Loop_Statement
+             (Node             => N,
+              Identifier       => Empty,
+              Iteration_Scheme => L_Iteration_Scheme,
+              Statements       => L_Body));
 
          --  A small optimization: if the aggregate is initialized with a box
          --  and the component type has no initialization procedure, remove the
@@ -1513,11 +1514,12 @@ package body Exp_Aggr is
 
          --  Construct the final loop
 
-         Append_To (S, Make_Implicit_Loop_Statement
-                         (Node             => N,
-                          Identifier       => Empty,
-                          Iteration_Scheme => W_Iteration_Scheme,
-                          Statements       => W_Body));
+         Append_To (S,
+           Make_Implicit_Loop_Statement
+             (Node             => N,
+              Identifier       => Empty,
+              Iteration_Scheme => W_Iteration_Scheme,
+              Statements       => W_Body));
 
          return S;
       end Gen_While;
@@ -1604,7 +1606,7 @@ package body Exp_Aggr is
       then
          Append_To (New_Code,
            Make_Assignment_Statement (Loc,
-             Name => New_Copy_Tree (Into),
+             Name       => New_Copy_Tree (Into),
              Expression =>
                Unchecked_Convert_To (Typ,
                  Make_Integer_Literal (Loc, Uint_0))));
@@ -2186,7 +2188,7 @@ package body Exp_Aggr is
 
             Append_To (L,
               Make_Procedure_Call_Statement (Loc,
-                Name =>
+                Name                   =>
                   New_Occurrence_Of
                     (Find_Prim_Op (Init_Typ, Name_Initialize), Loc),
                 Parameter_Associations => New_List (New_Copy_Tree (Ref))));
@@ -2510,9 +2512,9 @@ package body Exp_Aggr is
                  and then not Is_Limited_Type (Etype (Ancestor))
                then
                   Append_To (Assign,
-                    Make_Adjust_Call (
-                      Obj_Ref => New_Copy_Tree (Ref),
-                      Typ     => Etype (Ancestor)));
+                    Make_Adjust_Call
+                      (Obj_Ref => New_Copy_Tree (Ref),
+                       Typ     => Etype (Ancestor)));
                end if;
 
                Append_To (L,
@@ -2628,9 +2630,8 @@ package body Exp_Aggr is
             if Nkind (N) = N_Aggregate then
                Append_To (L,
                  Make_Procedure_Call_Statement (Loc,
-                   Name =>
-                     New_Occurrence_Of
-                       (Base_Init_Proc (CPP_Parent), Loc),
+                   Name                   =>
+                     New_Occurrence_Of (Base_Init_Proc (CPP_Parent), Loc),
                    Parameter_Associations => New_List (
                      Unchecked_Convert_To (CPP_Parent,
                        New_Copy_Tree (Lhs)))));
@@ -2655,10 +2656,10 @@ package body Exp_Aggr is
          if Is_CPP_Constructor_Call (Expression (Comp)) then
             Append_List_To (L,
               Build_Initialization_Call (Loc,
-                Id_Ref            => Make_Selected_Component (Loc,
-                                       Prefix        => New_Copy_Tree (Target),
-                                       Selector_Name =>
-                                         New_Occurrence_Of (Selector, Loc)),
+                Id_Ref            =>
+                  Make_Selected_Component (Loc,
+                    Prefix        => New_Copy_Tree (Target),
+                    Selector_Name => New_Occurrence_Of (Selector, Loc)),
                 Typ               => Etype (Selector),
                 Enclos_Type       => Typ,
                 With_Default_Init => True,
@@ -2911,13 +2912,13 @@ package body Exp_Aggr is
                  and then not Is_Limited_Type (Comp_Type)
                then
                   Append_To (L,
-                    Make_Adjust_Call (
-                      Obj_Ref => New_Copy_Tree (Comp_Expr),
-                      Typ     => Comp_Type));
+                    Make_Adjust_Call
+                      (Obj_Ref => New_Copy_Tree (Comp_Expr),
+                       Typ     => Comp_Type));
                end if;
             end if;
 
-         --  ???
+         --  comment would be good here ???
 
          elsif Ekind (Selector) = E_Discriminant
            and then Nkind (N) /= N_Extension_Aggregate
@@ -2955,9 +2956,9 @@ package body Exp_Aggr is
                   Make_Raise_Constraint_Error (Loc,
                     Condition =>
                       Make_Op_Ne (Loc,
-                        Left_Opnd => New_Copy_Tree (Node (D_Val)),
+                        Left_Opnd  => New_Copy_Tree (Node (D_Val)),
                         Right_Opnd => Expression (Comp)),
-                      Reason => CE_Discriminant_Check_Failed));
+                    Reason    => CE_Discriminant_Check_Failed));
 
                else
                   --  Find self-reference in previous discriminant assignment,
@@ -4199,7 +4200,7 @@ package body Exp_Aggr is
 
                Append_To (Indexes,
                  Make_Range (Loc,
-                   Low_Bound =>  Make_Integer_Literal (Loc, 1),
+                   Low_Bound  => Make_Integer_Literal (Loc, 1),
                    High_Bound => Make_Integer_Literal (Loc, Num)));
             end loop;
 
@@ -4209,11 +4210,10 @@ package body Exp_Aggr is
             --  positional. Retrieve each dimension bounds (computed earlier).
 
             for D in 1 .. Number_Dimensions (Typ) loop
-               Append (
+               Append_To (Indexes,
                  Make_Range (Loc,
-                    Low_Bound  => Aggr_Low  (D),
-                    High_Bound => Aggr_High (D)),
-                 Indexes);
+                   Low_Bound  => Aggr_Low  (D),
+                   High_Bound => Aggr_High (D)));
             end loop;
          end if;
 
@@ -6097,11 +6097,11 @@ package body Exp_Aggr is
                   Discriminant := First_Stored_Discriminant (Base_Type (Typ));
                   while Present (Discriminant) loop
                      New_Comp :=
-                       New_Copy_Tree (
-                         Get_Discriminant_Value (
-                             Discriminant,
-                             Typ,
-                             Discriminant_Constraint (Typ)));
+                       New_Copy_Tree
+                         (Get_Discriminant_Value
+                            (Discriminant,
+                              Typ,
+                              Discriminant_Constraint (Typ)));
                      Append (New_Comp, Constraints);
                      Next_Stored_Discriminant (Discriminant);
                   end loop;
@@ -6173,8 +6173,7 @@ package body Exp_Aggr is
                        Make_Component_Association (Loc,
                          Choices    =>
                            New_List (New_Occurrence_Of (Comp, Loc)),
-                         Expression =>
-                           New_Comp));
+                         Expression => New_Comp));
 
                      Analyze_And_Resolve (New_Comp, Etype (Comp));
                   end if;
@@ -7135,8 +7134,7 @@ package body Exp_Aggr is
 
                for I in UI_To_Int (Intval (Lo)) .. UI_To_Int (Intval (Hi))
                loop
-                  Append_To
-                    (Expressions (Agg), New_Copy (Expression (Expr)));
+                  Append_To (Expressions (Agg), New_Copy (Expression (Expr)));
 
                   --  The copied expression must be analyzed and resolved.
                   --  Besides setting the type, this ensures that static
index 36e7dc6abcf4b7e0388055300dfb951aa37640fd..bd5f9e26eca8306f0e0c8a9537fa73ba91133221 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 2006-2013, Free Software Foundation, Inc.         --
+--          Copyright (C) 2006-2014, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -99,10 +99,11 @@ package body Exp_Atag is
 
       Append_To (Stmts,
         Make_Assignment_Statement (Loc,
-          Name => Make_Identifier (Loc, Name_uC),
+          Name       => Make_Identifier (Loc, Name_uC),
           Expression =>
             Make_Function_Call (Loc,
-              Name => New_Occurrence_Of (RTE (RE_Get_Prim_Op_Kind), Loc),
+              Name                   =>
+                New_Occurrence_Of (RTE (RE_Get_Prim_Op_Kind), Loc),
               Parameter_Associations => New_List (
                 Tag_Node,
                 Make_Identifier (Loc, Name_uS)))));
@@ -415,9 +416,9 @@ package body Exp_Atag is
 
             Append_To (Result,
               Make_Assignment_Statement (Loc,
-                Name =>
+                Name      =>
                   Make_Indexed_Component (Loc,
-                    Prefix =>
+                    Prefix      =>
                       Make_Explicit_Dereference (Loc,
                         Unchecked_Convert_To
                           (Node (Last_Elmt (Access_Disp_Table (Typ))),
@@ -428,7 +429,7 @@ package body Exp_Atag is
                Expression =>
                  Unchecked_Convert_To (RTE (RE_Prim_Ptr),
                    Make_Attribute_Reference (Loc,
-                     Prefix => New_Occurrence_Of (E, Loc),
+                     Prefix         => New_Occurrence_Of (E, Loc),
                      Attribute_Name => Name_Unrestricted_Access))));
          end if;
 
@@ -455,7 +456,7 @@ package body Exp_Atag is
          if not CPP_Table (J) then
             Prepend_To (Result,
               Make_Assignment_Statement (Loc,
-                Name =>
+                Name       =>
                   Make_Explicit_Dereference (Loc,
                     Unchecked_Convert_To
                       (Node (Last_Elmt (Access_Disp_Table (CPP_Typ))),
@@ -550,14 +551,14 @@ package body Exp_Atag is
 
                         Append_To (Result,
                           Make_Assignment_Statement (Loc,
-                            Name =>
+                            Name       =>
                               Make_Indexed_Component (Loc,
-                                Prefix =>
+                                Prefix      =>
                                   Make_Explicit_Dereference (Loc,
                                     Unchecked_Convert_To
                                       (Node
                                         (Last_Elmt
-                                          (Access_Disp_Table (Iface))),
+                                           (Access_Disp_Table (Iface))),
                                        New_Occurrence_Of (Typ_Tag, Loc))),
                                 Expressions =>
                                    New_List
@@ -566,7 +567,7 @@ package body Exp_Atag is
                             Expression =>
                               Unchecked_Convert_To (RTE (RE_Prim_Ptr),
                                 Make_Attribute_Reference (Loc,
-                                  Prefix => New_Occurrence_Of (E, Loc),
+                                  Prefix         => New_Occurrence_Of (E, Loc),
                                   Attribute_Name =>
                                     Name_Unrestricted_Access))));
                      end if;
@@ -584,7 +585,7 @@ package body Exp_Atag is
                      if not Prims_Table (J) then
                         Insert_After (Last_Nod,
                           Make_Assignment_Statement (Loc,
-                            Name =>
+                            Name       =>
                               Make_Explicit_Dereference (Loc,
                                 Unchecked_Convert_To
                                  (Node (Last_Elmt (Access_Disp_Table (Iface))),
index d42018a55b901e6e27a73acb89b7b61f23f9a1ca..9b307954ca151e7b0037d1ddbe63823d3038af41 100644 (file)
@@ -459,14 +459,14 @@ package body Exp_Attr is
             Append_To (Alt_List,
               Make_Case_Statement_Alternative (Loc,
                 Discrete_Choices => New_Copy_List (Discrete_Choices (Variant)),
-                Statements =>
+                Statements       =>
                   Make_VS_Case (E, Component_List (Variant), Discrs)));
             Next_Non_Pragma (Variant);
          end loop;
 
          Append_To (Result,
            Make_Case_Statement (Loc,
-             Expression =>
+             Expression   =>
                Make_Selected_Component (Loc,
                  Prefix        => Make_Identifier (Loc, Name_X),
                  Selector_Name => New_Copy (Name (Variant_Part (CL)))),
index 7774d09f3c2939151bba03df8c7f6d9e009d15d9..48008b02998748dddbe572435b9a1c39d139c03e 100644 (file)
@@ -2350,8 +2350,7 @@ package body Exp_Ch3 is
 
             if not Null_Present (Type_Definition (N)) then
                Append_List_To (Body_Stmts,
-                 Build_Init_Statements (
-                   Component_List (Type_Definition (N))));
+                 Build_Init_Statements (Component_List (Type_Definition (N))));
             end if;
 
          --  N is a Derived_Type_Definition with a possible non-empty
@@ -4459,8 +4458,7 @@ package body Exp_Ch3 is
             --  the case statement switch. Their value is added when an
             --  equality call on unchecked unions is expanded.
 
-            Append_List_To (Stmts,
-              Make_Eq_Case (Typ, Comps, New_Discrs));
+            Append_List_To (Stmts, Make_Eq_Case (Typ, Comps, New_Discrs));
          end;
 
       --  Normal case (not unchecked union)
index 48044dbfc46ed0cb65e8bf5d2e18c2c5bc2b9953..55cd2a21e6cc9a0b867e3ed94434e3efee4bfacd 100644 (file)
@@ -10624,14 +10624,13 @@ package body Exp_Ch9 is
          Params : constant List_Id := New_List;
 
       begin
-         Append (
+         Append_To (Params,
            Make_Attribute_Reference (Loc,
              Prefix         => New_Occurrence_Of (Qnam, Loc),
-             Attribute_Name => Name_Unchecked_Access),
-           Params);
-         Append (Select_Mode,                  Params);
-         Append (New_Occurrence_Of (Ann, Loc),  Params);
-         Append (New_Occurrence_Of (Xnam, Loc), Params);
+             Attribute_Name => Name_Unchecked_Access));
+         Append_To (Params, Select_Mode);
+         Append_To (Params, New_Occurrence_Of (Ann, Loc));
+         Append_To (Params, New_Occurrence_Of (Xnam, Loc));
 
          return
            Make_Procedure_Call_Statement (Loc,
@@ -11351,6 +11350,7 @@ package body Exp_Ch9 is
             Append (Cases, Stats);
          end;
       end if;
+
       Append (End_Lab, Stats);
 
       --  Replace accept statement with appropriate block
index 2692c8bb2b38b3f3bf134fd1d4b4db29c6e7750c..7721eefdd9d3c23a8904bae2eb7f03c01f9c2506 100644 (file)
@@ -2195,13 +2195,12 @@ package body Layout is
                            D_List := New_List;
                            D_Entity := First_Discriminant (E);
                            while Present (D_Entity) loop
-                              Append (
+                              Append_To (D_List,
                                 Make_Selected_Component (Loc,
                                   Prefix        =>
                                     Make_Identifier (Loc, Vname),
                                   Selector_Name =>
-                                    New_Occurrence_Of (D_Entity, Loc)),
-                                D_List);
+                                    New_Occurrence_Of (D_Entity, Loc)));
 
                               D_Entity := Next_Discriminant (D_Entity);
                            end loop;
index 41b5ac2e08c75b3175ac65f422fc8af908ba73bd..dcb5dd41cb714e5d1b117eae7c11f6e1cf8a0af8 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2013, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -744,8 +744,8 @@ package body Nlists is
 
       else
          NL := New_List;
-         E := First (List);
 
+         E := First (List);
          while Present (E) loop
             if Comes_From_Source (E) then
                Append (New_Copy (E), NL);
index 9b73bfee17b56209fdd83d6f0938c5a6089ea3e8..5950b4a71ab79a9736436684f0dd3e106eda7afd 100644 (file)
@@ -225,9 +225,9 @@ package Nlists is
 
    procedure Append (Node : Node_Or_Entity_Id; To : List_Id);
    --  Appends Node at the end of node list To. Node must be a non-empty node
-   --  that is not already a member of a node list, and To must be a
-   --  node list. An attempt to append an error node is ignored without
-   --  complaint and the list is unchanged.
+   --  that is not already a member of a node list, and To must be a node list.
+   --  An attempt to append an error node is ignored without complaint and the
+   --  list is unchanged.
 
    procedure Append_To (To : List_Id; Node : Node_Or_Entity_Id);
    pragma Inline (Append_To);
index 839697c766357211e86caf1c535a70c5bb4e315a..39169e1fc808761905c7b1fb296bf4ea04507438 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2013, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -168,6 +168,7 @@ package body Ch12 is
 
          if Token = Tok_Use then
             Append (P_Use_Clause, Decls);
+
          else
             --  Parse a generic parameter declaration
 
index bf9b24f24048322f947f67d2e18777075c8c990e..e5dfcaac365294931697e302fb54a824db2e939e 100644 (file)
@@ -4355,13 +4355,12 @@ package body Sem_Aggr is
                            end if;
 
                            if Needs_Box then
-                              Append
-                                (Make_Component_Association (Loc,
-                                   Choices     =>
-                                     New_List (Make_Others_Choice (Loc)),
-                                   Expression  => Empty,
-                                      Box_Present => True),
-                                 Component_Associations (Aggr));
+                              Append_To (Component_Associations (Aggr),
+                                Make_Component_Association (Loc,
+                                  Choices     =>
+                                    New_List (Make_Others_Choice (Loc)),
+                                  Expression  => Empty,
+                                  Box_Present => True));
                            end if;
                         end Propagate_Discriminants;
 
@@ -4400,14 +4399,14 @@ package body Sem_Aggr is
                               while Present (Comp) loop
                                  if Ekind (Comp) = E_Component then
                                     if not Is_Record_Type (Etype (Comp)) then
-                                       Append
-                                         (Make_Component_Association (Loc,
+                                       Append_To
+                                         (Component_Associations (Expr),
+                                          Make_Component_Association (Loc,
                                             Choices     =>
                                               New_List
                                                (Make_Others_Choice (Loc)),
                                             Expression  => Empty,
-                                               Box_Present => True),
-                                          Component_Associations (Expr));
+                                               Box_Present => True));
                                     end if;
                                     exit;
                                  end if;