OSDN Git Service

2009-11-30 Robert Dewar <dewar@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 30 Nov 2009 10:34:43 +0000 (10:34 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 30 Nov 2009 10:34:43 +0000 (10:34 +0000)
* s-stchop-vxworks.adb: Add comment.

2009-11-30  Emmanuel Briot  <briot@adacore.com>

* make.adb, prj.adb, prj.ads (Compute_All_Imported_Projects): Now acts
on the whole tree, to better share code with gprbuild.
(Length): New subprogram, to share code in gprbuild.
(Project_Data): Remove fields that are only needed when compiling a
  project in gprbuild (where we use local variables instead)
* osint.adb, osint.ads: Added minor comment on memory management

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

gcc/ada/ChangeLog
gcc/ada/make.adb
gcc/ada/osint.adb
gcc/ada/osint.ads
gcc/ada/prj.adb
gcc/ada/prj.ads
gcc/ada/s-stchop-vxworks.adb

index 6effdb8..bde300e 100644 (file)
@@ -1,3 +1,16 @@
+2009-11-30  Robert Dewar  <dewar@adacore.com>
+
+       * s-stchop-vxworks.adb: Add comment.
+
+2009-11-30  Emmanuel Briot  <briot@adacore.com>
+
+       * make.adb, prj.adb, prj.ads (Compute_All_Imported_Projects): Now acts
+       on the whole tree, to better share code with gprbuild.
+       (Length): New subprogram, to share code in gprbuild.
+       (Project_Data): Remove fields that are only needed when compiling a
+       project in gprbuild (where we use local variables instead)
+       * osint.adb, osint.ads: Added minor comment on memory management
+
 2009-11-30  Sergey Rybin  <rybin@adacore.com>
 
        * gnat_ugn.texi: Update gnatcheck doc.
index 39a3046..252be1b 100644 (file)
@@ -6875,24 +6875,15 @@ package body Make is
 
          --  We add the source directories and the object directories to the
          --  search paths.
+         --  ??? Why do we need these search directories, we already know the
+         --  locations from parsing the project, except for the runtime which
+         --  has its own directories anyway
 
          Add_Source_Directories (Main_Project, Project_Tree);
          Add_Object_Directories (Main_Project);
 
          Recursive_Compute_Depth (Main_Project);
-
-         --  For each project compute the list of the projects it imports
-         --  directly or indirectly.
-
-         declare
-            Proj : Project_List;
-         begin
-            Proj := Project_Tree.Projects;
-            while Proj /= null loop
-               Compute_All_Imported_Projects (Proj.Project);
-               Proj := Proj.Next;
-            end loop;
-         end;
+         Compute_All_Imported_Projects (Project_Tree);
 
       else
 
index ae04481..46c322f 100644 (file)
@@ -138,6 +138,7 @@ package body Osint is
       Path_Len  : Integer) return String_Access;
    --  Converts a C String to an Ada String. Are we doing this to avoid withing
    --  Interfaces.C.Strings ???
+   --  Caller must free result
 
    function Include_Dir_Default_Prefix return String_Access;
    --  Same as exported version, except returns a String_Access
index 2fa2561..8353908 100644 (file)
@@ -210,6 +210,7 @@ package Osint is
    --  Convert a canonical syntax directory specification to host syntax.
    --  The Prefix_Style flag is currently ignored but should be set to
    --  False.
+   --  Caller must free result
 
    function To_Host_File_Spec
      (Canonical_File : String) return String_Access;
index d42e711..d097c1d 100644 (file)
@@ -86,8 +86,6 @@ package body Prj is
                       Libgnarl_Needed                => Unknown,
                       Symbol_Data                    => No_Symbols,
                       Interfaces_Defined             => False,
-                      Include_Path                   => null,
-                      Include_Data_Set               => False,
                       Source_Dirs                    => Nil_String,
                       Source_Dir_Ranks               => No_Number_List,
                       Object_Directory               => No_Path_Information,
@@ -98,12 +96,11 @@ package body Prj is
                       Languages                      => No_Language_Index,
                       Decl                           => No_Declarations,
                       Imported_Projects              => null,
+                      Include_Path_File              => No_Path,
                       All_Imported_Projects          => null,
                       Ada_Include_Path               => null,
-                      Imported_Directories_Switches  => null,
                       Ada_Objects_Path               => null,
                       Objects_Path                   => null,
-                      Include_Path_File              => No_Path,
                       Objects_Path_File_With_Libs    => No_Path,
                       Objects_Path_File_Without_Libs => No_Path,
                       Config_File_Name               => No_Path,
@@ -704,7 +701,6 @@ package body Prj is
 
    begin
       if Project /= null then
-         Free (Project.Include_Path);
          Free (Project.Ada_Include_Path);
          Free (Project.Objects_Path);
          Free (Project.Ada_Objects_Path);
@@ -1055,7 +1051,8 @@ package body Prj is
    -- Compute_All_Imported_Projects --
    -----------------------------------
 
-   procedure Compute_All_Imported_Projects (Project : Project_Id) is
+   procedure Compute_All_Imported_Projects (Tree : Project_Tree_Ref) is
+      Project : Project_Id;
 
       procedure Recursive_Add (Prj : Project_Id; Dummy : in out Boolean);
       --  Recursively add the projects imported by project Project, but not
@@ -1103,10 +1100,16 @@ package body Prj is
         new For_Every_Project_Imported (Boolean, Recursive_Add);
 
       Dummy : Boolean := False;
+      List  : Project_List;
 
    begin
-      Free_List (Project.All_Imported_Projects, Free_Project => False);
-      For_All_Projects (Project, Dummy);
+      List := Tree.Projects;
+      while List /= null loop
+         Project := List.Project;
+         Free_List (Project.All_Imported_Projects, Free_Project => False);
+         For_All_Projects (Project, Dummy);
+         List := List.Next;
+      end loop;
    end Compute_All_Imported_Projects;
 
    -------------------
@@ -1207,6 +1210,23 @@ package body Prj is
          Require_Obj_Dirs           => Require_Obj_Dirs);
    end Create_Flags;
 
+   ------------
+   -- Length --
+   ------------
+
+   function Length
+     (Table : Name_List_Table.Instance; List : Name_List_Index) return Natural
+   is
+      Count : Natural := 0;
+      Tmp   : Name_List_Index := List;
+   begin
+      while Tmp /= No_Name_List loop
+         Count := Count + 1;
+         Tmp := Table.Table (Tmp).Next;
+      end loop;
+      return Count;
+   end Length;
+
 begin
    --  Make sure that the standard config and user project file extensions are
    --  compatible with canonical case file naming.
index 453a7ca..f161a81 100644 (file)
@@ -316,6 +316,10 @@ package Prj is
       Table_Increment      => 100);
    --  The table for lists of names
 
+   function Length
+     (Table : Name_List_Table.Instance; List : Name_List_Index) return Natural;
+   --  Return the number of elements in that list
+
    type Number_List_Index is new Nat;
    No_Number_List : constant Number_List_Index := 0;
 
@@ -839,9 +843,10 @@ package Prj is
    --  If Only_If_Ada is True, then No_Name will be returned when the project
    --  doesn't Ada sources.
 
-   procedure Compute_All_Imported_Projects (Project : Project_Id);
-   --  Compute, the list of the projects imported directly or indirectly by
-   --  project Project. The result is stored in Project.All_Imported_Projects
+   procedure Compute_All_Imported_Projects (Tree : Project_Tree_Ref);
+   --  For all projects in the tree, compute the list of the projects imported
+   --  directly or indirectly by project Project. The result is stored in
+   --  Project.All_Imported_Projects for each project
 
    function Ultimate_Extending_Project_Of
      (Proj : Project_Id) return Project_Id;
@@ -1163,17 +1168,9 @@ package Prj is
       --  True if attribute Interfaces is declared for the project or any
       --  project it extends.
 
-      Include_Path : String_Access := null;
-      --  The search source path for the project. Used as the value for an
-      --  environment variable, specified by attribute Include_Path
-      --  (<language>). The names of the environment variables are in component
-      --  Include_Path of the records Language_Config.
-
       Include_Path_File : Path_Name_Type := No_Path;
-      --  The path name of the of the source search directory file
-
-      Include_Data_Set : Boolean := False;
-      --  Set True when Imported_Directories_Switches or Include_Path are set
+      --  The path name of the of the source search directory file.
+      --  This is only used by gnatmake
 
       Source_Dirs : String_List_Id := Nil_String;
       --  The list of all the source directories
@@ -1190,10 +1187,6 @@ package Prj is
       -- Miscellaneous --
       -------------------
 
-      Imported_Directories_Switches : Argument_List_Access := null;
-      --  List of the source search switches (-I<source dir>) to be used
-      --  when compiling.
-
       Ada_Objects_Path : String_Access := null;
       --  The cached value of ADA_OBJECTS_PATH for this project file. Do not
       --  use this field directly outside of the compiler, use
index 9552d57..1f8ad2d 100644 (file)
@@ -129,6 +129,9 @@ package body System.Stack_Checking.Operations is
 
       Get_Stack_Info (Stack_Info'Access);
 
+      --  In s-stchop.adb, we check for overflow in the following operations,
+      --  but we have no such check in this vxworks version. Why not ???
+
       if Stack_Grows_Down then
          Limit := Stack_Info.Base - Storage_Offset (Stack_Info.Size);
       else