]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2009-04-24 Robert Dewar <dewar@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 24 Apr 2009 13:22:53 +0000 (13:22 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 24 Apr 2009 13:22:53 +0000 (13:22 +0000)
* prj-env.adb, prj-proc.adb, prj.adb, prj.ads,
rtsfind.adb: Minor reformatting.
Minor code reorganization

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

gcc/ada/ChangeLog
gcc/ada/prj-env.adb
gcc/ada/prj-proc.adb
gcc/ada/prj.adb
gcc/ada/prj.ads
gcc/ada/rtsfind.adb

index d9b8f016454466aff0dd3f28bccdca4279171ad6..df3650ff6f4f4903970eae781b20482d6fd635c1 100644 (file)
@@ -1,3 +1,9 @@
+2009-04-24  Robert Dewar  <dewar@adacore.com>
+
+       * prj-env.adb, prj-proc.adb, prj.adb, prj.ads,
+       rtsfind.adb: Minor reformatting.
+       Minor code reorganization
+
 2009-04-24  Arnaud Charlet  <charlet@adacore.com>
 
        * mlib-prj.adb: Use friendlier english identifier.
index e3cdf4cae57a49ac2b97cf5a9bc759e1e55f97af..decd68832e0590ca6202efb64c439e81d642b473 100644 (file)
@@ -155,10 +155,10 @@ package body Prj.Env is
       procedure Add (Project : Project_Id; Dummy : in out Boolean) is
          pragma Unreferenced (Dummy);
          Path : constant Path_Name_Type :=
-           Get_Object_Directory
-             (In_Tree, Project,
-              Including_Libraries => Including_Libraries,
-              Only_If_Ada         => False);
+                  Get_Object_Directory
+                    (In_Tree, Project,
+                     Including_Libraries => Including_Libraries,
+                     Only_If_Ada         => False);
       begin
          if Path /= No_Path then
             Add_To_Path (Get_Name_String (Path), In_Tree);
@@ -1323,7 +1323,9 @@ package body Prj.Env is
 
       procedure For_Project (Prj : Project_Id; Dummy : in out Integer) is
          pragma Unreferenced (Dummy);
+
          Data : Project_Data renames In_Tree.Projects.Table (Prj);
+
       begin
          --  ??? Set_Ada_Paths has a different behavior for library project
          --  files, should we have the same ?
@@ -1361,6 +1363,7 @@ package body Prj.Env is
 
       procedure For_Project (Prj : Project_Id; Dummy : in out Integer) is
          pragma Unreferenced (Dummy);
+
          Data       : Project_Data renames In_Tree.Projects.Table (Prj);
          Current    : String_List_Id := Data.Source_Dirs;
          The_String : String_Element;
@@ -1656,6 +1659,7 @@ package body Prj.Env is
      (Project             : Project_Id;
       In_Tree             : Project_Tree_Ref;
       Including_Libraries : Boolean)
+
    is
       Source_FD : File_Descriptor := Invalid_FD;
       Object_FD : File_Descriptor := Invalid_FD;
@@ -1678,14 +1682,17 @@ package body Prj.Env is
 
       procedure Recursive_Add (Project : Project_Id; Dummy : in out Boolean) is
          pragma Unreferenced (Dummy);
+
          Data : constant Project_Data := In_Tree.Projects.Table (Project);
          Path : Path_Name_Type;
+
       begin
          --  ??? This is almost the equivalent of For_All_Source_Dirs
+
          if Process_Source_Dirs then
 
-            --  Add to path all source directories of this project if
-            --  there are Ada sources.
+            --  Add to path all source directories of this project if there are
+            --  Ada sources.
 
             if Has_Ada_Sources (In_Tree.Projects.Table (Project)) then
                Add_To_Source_Path (Data.Source_Dirs, In_Tree);
@@ -1711,8 +1718,8 @@ package body Prj.Env is
    --  Start of processing for Set_Ada_Paths
 
    begin
-      --  If it is the first time we call this procedure for
-      --  this project, compute the source path and/or the object path.
+      --  If it is the first time we call this procedure for this project,
+      --  compute the source path and/or the object path.
 
       if In_Tree.Projects.Table (Project).Include_Path_File = No_Path then
          Process_Source_Dirs := True;
index e4ffe49824e277e4b913f407c995a223d2fca319..03d5220b5626c2001771b1b40a8ed52985a54892 100644 (file)
@@ -281,8 +281,10 @@ package body Prj.Proc is
 
       procedure Check_All_Projects is new
         For_Every_Project_Imported (Recursive_Check_Data, Recursive_Check);
+
       Data : Recursive_Check_Data :=
         (In_Tree, Dir'Unchecked_Access, When_No_Sources);
+
    begin
       Check_All_Projects (Project, In_Tree, Data, Imported_First => True);
 
@@ -333,11 +335,11 @@ package body Prj.Proc is
       Naming_Restricted : Boolean;
       In_Tree           : Project_Tree_Ref)
    is
-      V1  : Variable_Id := From.Attributes;
-      V2  : Variable_Id := No_Variable;
+      V1  : Variable_Id;
+      V2  : Variable_Id      := No_Variable;
       Var : Variable;
-      A1  : Array_Id := From.Arrays;
-      A2  : Array_Id := No_Array;
+      A1  : Array_Id;
+      A2  : Array_Id         := No_Array;
       Arr : Array_Data;
       E1  : Array_Element_Id;
       E2  : Array_Element_Id := No_Array_Element;
@@ -351,6 +353,7 @@ package body Prj.Proc is
 
       --  First single attributes
 
+      V1 := From.Attributes;
       while V1 /= No_Variable loop
 
          --  Copy the attribute
@@ -384,16 +387,16 @@ package body Prj.Proc is
 
       --  Then the associated array attributes
 
+      A1 := From.Arrays;
       while A1 /= No_Array loop
-
          Arr := In_Tree.Arrays.Table (A1);
          A1  := Arr.Next;
 
          if not Naming_Restricted or else
            (Arr.Name /= Snames.Name_Body
-            and then Arr.Name /= Snames.Name_Spec
-            and then Arr.Name /= Snames.Name_Implementation
-            and then Arr.Name /= Snames.Name_Specification)
+             and then Arr.Name /= Snames.Name_Spec
+             and then Arr.Name /= Snames.Name_Implementation
+             and then Arr.Name /= Snames.Name_Specification)
          then
             --  Remove the Next component
 
@@ -530,22 +533,21 @@ package body Prj.Proc is
                      end if;
 
                      Last := String_Element_Table.Last
-                       (In_Tree.String_Elements);
+                               (In_Tree.String_Elements);
+
                      In_Tree.String_Elements.Table (Last) :=
-                       (Value    =>
-                          String_Value_Of
-                            (The_Current_Term,
-                             From_Project_Node_Tree),
-                        Index    =>
-                          Source_Index_Of
-                            (The_Current_Term, From_Project_Node_Tree),
+                       (Value         => String_Value_Of
+                                           (The_Current_Term,
+                                            From_Project_Node_Tree),
+                        Index         => Source_Index_Of
+                                           (The_Current_Term,
+                                            From_Project_Node_Tree),
                         Display_Value => No_Name,
-                        Location      =>
-                          Location_Of
-                            (The_Current_Term,
-                             From_Project_Node_Tree),
-                        Flag     => False,
-                        Next     => Nil_String);
+                        Location      => Location_Of
+                                           (The_Current_Term,
+                                            From_Project_Node_Tree),
+                        Flag          => False,
+                        Next          => Nil_String);
                end case;
 
             when N_Literal_String_List =>
@@ -561,8 +563,8 @@ package body Prj.Proc is
                begin
                   if Present (String_Node) then
 
-                     --  If String_Node is nil, it is an empty list,
-                     --  there is nothing to do
+                     --  If String_Node is nil, it is an empty list, there is
+                     --  nothing to do
 
                      Value := Expression
                        (Project                => Project,
@@ -579,8 +581,8 @@ package body Prj.Proc is
 
                      if Result.Values = Nil_String then
 
-                        --  This literal string list is the first term
-                        --  in a string list expression
+                        --  This literal string list is the first term in a
+                        --  string list expression
 
                         Result.Values :=
                           String_Element_Table.Last (In_Tree.String_Elements);
index eb7f653a4110eb8f899e26e4319df6f1f8ee46c2..ab1439dd38a20af73d9ad20cbc234a9a655bbd86 100644 (file)
@@ -498,9 +498,9 @@ package body Prj is
    --------------------------------
 
    procedure For_Every_Project_Imported
-     (By         : Project_Id;
-      In_Tree    : Project_Tree_Ref;
-      With_State : in out State;
+     (By             : Project_Id;
+      In_Tree        : Project_Tree_Ref;
+      With_State     : in out State;
       Imported_First : Boolean := False)
    is
       use Project_Boolean_Htable;
@@ -517,6 +517,7 @@ package body Prj is
       procedure Recursive_Check (Project : Project_Id) is
          Data : Project_Data renames In_Tree.Projects.Table (Project);
          List : Project_List;
+
       begin
          if not Get (Seen, Project) then
             Set (Seen, Project, True);
@@ -1204,12 +1205,14 @@ package body Prj is
    ---------------------
 
    function Has_Ada_Sources (Data : Project_Data) return Boolean is
-      Lang : Language_Ptr := Data.Languages;
+      Lang : Language_Ptr;
+
    begin
       if Data.Ada_Sources /= Nil_String then
          return True;
       end if;
 
+      Lang := Data.Languages;
       while Lang /= No_Language_Index loop
          if Lang.Name = Name_Ada then
             return Lang.First_Source /= No_Source;
@@ -1225,14 +1228,17 @@ package body Prj is
    -------------------------
 
    function Has_Foreign_Sources (Data : Project_Data) return Boolean is
-      Lang : Language_Ptr := Data.Languages;
+      Lang : Language_Ptr;
+
    begin
+      Lang := Data.Languages;
       while Lang /= No_Language_Index loop
          if Lang.Name /= Name_Ada
            and then Lang.First_Source /= No_Source
          then
             return True;
          end if;
+
          Lang := Lang.Next;
       end loop;
 
@@ -1245,10 +1251,10 @@ package body Prj is
 
    function Contains_ALI_Files (Dir : Path_Name_Type) return Boolean is
       Dir_Name : constant String := Get_Name_String (Dir);
-      Direct : Dir_Type;
-      Name   : String (1 .. 1_000);
-      Last   : Natural;
-      Result : Boolean := False;
+      Direct   : Dir_Type;
+      Name     : String (1 .. 1_000);
+      Last     : Natural;
+      Result   : Boolean := False;
 
    begin
       Open (Direct, Dir_Name);
@@ -1267,8 +1273,8 @@ package body Prj is
       return Result;
 
    exception
-      --  If there is any problem, close the directory if open and return
-      --  True; the library directory will be added to the path.
+      --  If there is any problem, close the directory if open and return True.
+      --  The library directory will be added to the path.
 
       when others =>
          if Is_Open (Direct) then
@@ -1289,11 +1295,12 @@ package body Prj is
       Only_If_Ada         : Boolean := False) return Path_Name_Type
    is
       Data : Project_Data renames In_Tree.Projects.Table (Project);
+
    begin
       if (Data.Library and Including_Libraries)
         or else
           (Data.Object_Directory /= No_Path_Information
-           and then (not Including_Libraries or else not Data.Library))
+            and then (not Including_Libraries or else not Data.Library))
       then
          --  For a library project, add the library ALI directory if there is
          --  no object directory or if the library ALI directory contains ALI
@@ -1316,10 +1323,12 @@ package body Prj is
 
          elsif not Data.Virtual then
             declare
-               Add_Object_Dir : Boolean    := not Only_If_Ada;
-               Prj            : Project_Id := Project;
+               Add_Object_Dir : Boolean;
+               Prj            : Project_Id;
 
             begin
+               Add_Object_Dir := not Only_If_Ada;
+               Prj := Project;
                while not Add_Object_Dir and then Prj /= No_Project loop
                   if Has_Ada_Sources (In_Tree.Projects.Table (Prj)) then
                      Add_Object_Dir := True;
@@ -1334,6 +1343,7 @@ package body Prj is
             end;
          end if;
       end if;
+
       return No_Path;
    end Get_Object_Directory;
 
@@ -1342,10 +1352,13 @@ package body Prj is
    -----------------------------------
 
    function Ultimate_Extending_Project_Of
-     (Proj : Project_Id; In_Tree : Project_Tree_Ref) return Project_Id
+     (Proj    : Project_Id;
+      In_Tree : Project_Tree_Ref) return Project_Id
    is
-      Prj : Project_Id := Proj;
+      Prj : Project_Id;
+
    begin
+      Prj := Proj;
       while In_Tree.Projects.Table (Prj).Extended_By /= No_Project loop
          Prj := In_Tree.Projects.Table (Prj).Extended_By;
       end loop;
@@ -1373,8 +1386,10 @@ package body Prj is
 
       procedure Add_To_List (Prj : Project_Id) is
          Element : constant Project_Element :=
-           (Prj, In_Tree.Projects.Table (Project).All_Imported_Projects);
-         List : Project_List;
+                     (Prj,
+                      In_Tree.Projects.Table (Project).All_Imported_Projects);
+         List    : Project_List;
+
       begin
          --  Check that the project is not already in the list. We know the one
          --  passed to Recursive_Add have never been visited before, but the
@@ -1402,9 +1417,12 @@ package body Prj is
 
       procedure Recursive_Add (Prj : Project_Id; Dummy : in out Boolean) is
          pragma Unreferenced (Dummy);
+
          Prj2    : Project_Id;
+
       begin
          --  A project is not importing itself
+
          if Project /= Prj then
             Prj2 := Ultimate_Extending_Project_Of (Prj, In_Tree);
             Add_To_List (Prj2);
index 7dca8c7b9909d3fd43e620b27735ad04d0da9897..c86db3ef7fed951cd04eb3be54a7e98851cad37f 100644 (file)
@@ -1527,9 +1527,9 @@ package Prj is
         (Project    : Project_Id;
          With_State : in out State);
    procedure For_Every_Project_Imported
-     (By         : Project_Id;
-      In_Tree    : Project_Tree_Ref;
-      With_State : in out State;
+     (By             : Project_Id;
+      In_Tree        : Project_Tree_Ref;
+      With_State     : in out State;
       Imported_First : Boolean := False);
    --  Call Action for each project imported directly or indirectly by project
    --  By, as well as extended projects.
index 774cce1296d581090f001a723fc9539b6db37468..7dbd135e8751cd7e82a735ef72d84ce4f165b9d2 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2008, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2009, 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- --
@@ -1381,7 +1381,7 @@ package body Rtsfind is
         Name_Modular_IO     => Ada_Wide_Wide_Text_IO_Modular_IO);
 
    begin
-      --  Nothing to do if name is not identifier or a selected component
+      --  Nothing to do if name is not an identifier or a selected component
       --  whose selector_name is not an identifier.
 
       if Nkind (Nam) = N_Identifier then