[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Thu, 6 Feb 2014 10:11:07 +0000 (11:11 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Thu, 6 Feb 2014 10:11:07 +0000 (11:11 +0100)
2014-02-06  Pascal Obry  <obry@adacore.com>

* prj-util.adb (For_Interface_Sources): Fix handling of required
bodies for aggregate libs.

2014-02-06  Robert Dewar  <dewar@adacore.com>

* nlists.ads: Minor comment clarifications.

2014-02-06  Robert Dewar  <dewar@adacore.com>

* gnat1drv.adb (Adjust_Global_Switches): Set Modify_Tree_For_C
if gnatd.V set.
* opt.ads (Modify_Tree_For_C): New flag.
* output.ads, output.adb (Last_Char): New function.

2014-02-06  Pascal Obry  <obry@adacore.com>

* projects.texi, prj-env.adb (Initialize_Default_Project_Path): Add
share/gpr for cross-builds.

From-SVN: r207542

gcc/ada/ChangeLog
gcc/ada/gnat1drv.adb
gcc/ada/nlists.ads
gcc/ada/opt.ads
gcc/ada/output.adb
gcc/ada/output.ads
gcc/ada/prj-env.adb
gcc/ada/prj-util.adb
gcc/ada/projects.texi

index ddd91dc..87a36e6 100644 (file)
@@ -1,3 +1,24 @@
+2014-02-06  Pascal Obry  <obry@adacore.com>
+
+       * prj-util.adb (For_Interface_Sources): Fix handling of required
+       bodies for aggregate libs.
+
+2014-02-06  Robert Dewar  <dewar@adacore.com>
+
+       * nlists.ads: Minor comment clarifications.
+
+2014-02-06  Robert Dewar  <dewar@adacore.com>
+
+       * gnat1drv.adb (Adjust_Global_Switches): Set Modify_Tree_For_C
+       if gnatd.V set.
+       * opt.ads (Modify_Tree_For_C): New flag.
+       * output.ads, output.adb (Last_Char): New function.
+
+2014-02-06  Pascal Obry  <obry@adacore.com>
+
+       * projects.texi, prj-env.adb (Initialize_Default_Project_Path): Add
+       share/gpr for cross-builds.
+
 2014-02-06  Robert Dewar  <dewar@adacore.com>
 
        * exp_util.ads, checks.adb, sem_prag.adb, prj-util.adb, sem_ch13.adb:
index f5c312a..cfa89b1 100644 (file)
@@ -117,6 +117,12 @@ procedure Gnat1drv is
          Relaxed_RM_Semantics := True;
       end if;
 
+      --  -gnatd.V enables special C expansion mode
+
+      if Debug_Flag_Dot_VV then
+         Modify_Tree_For_C := True;
+      end if;
+
       --  -gnatd.E sets Error_To_Warning mode, causing selected error messages
       --  to be treated as warnings instead of errors.
 
index 5fd66de..42c280e 100644 (file)
@@ -346,7 +346,9 @@ package Nlists is
    function No (List : List_Id) return Boolean;
    pragma Inline (No);
    --  Tests given Id for equality with No_List. This allows notations like
-   --  "if No (Statements)" as opposed to "if Statements = No_List".
+   --  "if No (Statements)" as opposed to "if Statements = No_List". Note that
+   --  an empty list gives False for this test, as opposed to Is_Empty_List
+   --  which gives True either for No_List or for an empty list.
 
    function Present (List : List_Id) return Boolean;
    pragma Inline (Present);
index 1b192a0..c52435b 100644 (file)
@@ -996,6 +996,13 @@ package Opt is
    --  GNATMAKE
    --  Set to True if minimal recompilation mode requested
 
+   Modify_Tree_For_C : Boolean := False;
+   --  GNAT
+   --  If this switch is set True (currently it is set only by -gnatd.V), then
+   --  certain meaning-preserving transformations are applied to the tree to
+   --  make it easier to interface with back ends that implement C semantics.
+   --  There is a section in Sinfo which describes the transformations made.
+
    Multiple_Unit_Index : Int := 0;
    --  GNAT
    --  This is set non-zero if the current unit is being compiled in multiple
index da3c25d..901c922 100644 (file)
@@ -181,6 +181,19 @@ package body Output is
         (Cur_Indentation + Indentation_Amount) mod Indentation_Limit;
    end Indent;
 
+   ---------------
+   -- Last_Char --
+   ---------------
+
+   function Last_Char return Character is
+   begin
+      if Next_Col /= 1 then
+         return Buffer (Next_Col - 1);
+      else
+         return ASCII.NUL;
+      end if;
+   end Last_Char;
+
    -------------
    -- Outdent --
    -------------
index bcbca57..715a26a 100644 (file)
@@ -137,6 +137,10 @@ package Output is
    procedure Write_Line (S : String);
    --  Equivalent to Write_Str (S) followed by Write_Eol;
 
+   function Last_Char return Character;
+   --  Returns last character written on the current line, or null if the
+   --  current line is (so far) empty.
+
    function Column return Pos;
    pragma Inline (Column);
    --  Returns the number of the column about to be written (e.g. a value of 1
index b50481e..43bc578 100644 (file)
@@ -148,7 +148,7 @@ package body Prj.Env is
       if Recursive then
 
          --  If it is the first time we call this function for this project,
-         --  compute the source path
+         --  compute the source path.
 
          if Project.Ada_Include_Path = null then
             Buffer := new String (1 .. Buffer_Initial);
@@ -292,7 +292,6 @@ package body Prj.Env is
       for Index in
         Object_Path_Table.First .. Object_Path_Table.Last (Object_Paths)
       loop
-
          --  If it is, remove it, and add it as the last one
 
          if Object_Paths.Table (Index) = Object_Dir then
@@ -323,9 +322,10 @@ package body Prj.Env is
       Buffer      : in out String_Access;
       Buffer_Last : in out Natural)
    is
-      Current    : String_List_Id := Source_Dirs;
+      Current    : String_List_Id;
       Source_Dir : String_Element;
    begin
+      Current := Source_Dirs;
       while Current /= Nil_String loop
          Source_Dir := Shared.String_Elements.Table (Current);
          Add_To_Path (Get_Name_String (Source_Dir.Display_Value),
@@ -359,11 +359,10 @@ package body Prj.Env is
             --  Note: the order of the conditions below is important, since
             --  it ensures a minimal number of string comparisons.
 
-            if (J = Path'First
-                or else Path (J - 1) = Path_Separator)
+            if (J = Path'First or else Path (J - 1) = Path_Separator)
               and then
                 (J + Dir'Length > Path'Last
-                 or else Path (J + Dir'Length) = Path_Separator)
+                  or else Path (J + Dir'Length) = Path_Separator)
               and then Dir = Path (J .. J + Dir'Length - 1)
             then
                return True;
@@ -426,13 +425,14 @@ package body Prj.Env is
       Shared       : Shared_Project_Tree_Data_Access;
       Source_Paths : in out Source_Path_Table.Instance)
    is
-      Current    : String_List_Id := Source_Dirs;
+      Current    : String_List_Id;
       Source_Dir : String_Element;
       Add_It     : Boolean;
 
    begin
       --  Add each source directory
 
+      Current := Source_Dirs;
       while Current /= Nil_String loop
          Source_Dir := Shared.String_Elements.Table (Current);
          Add_It := True;
@@ -1088,15 +1088,17 @@ package body Prj.Env is
 
          Unit := Units_Htable.Get_First (In_Tree.Units_HT);
          while Unit /= null loop
+
             --  Check for body
 
             if not Main_Project_Only
               or else
                 (Unit.File_Names (Impl) /= null
-                 and then Unit.File_Names (Impl).Project = The_Project)
+                  and then Unit.File_Names (Impl).Project = The_Project)
             then
                declare
                   Current_Name : File_Name_Type;
+
                begin
                   --  Case of a body present
 
@@ -1365,8 +1367,8 @@ package body Prj.Env is
                 (Namet.Get_Name_String
                    (Unit.File_Names (Spec).File) = Original_Name
                  or else (Unit.File_Names (Spec).Path /= No_Path_Information
-                          and then
-                            Namet.Get_Name_String
+                           and then
+                             Namet.Get_Name_String
                                (Unit.File_Names (Spec).Path.Name) =
                                                            Original_Name))
             then
@@ -1481,7 +1483,6 @@ package body Prj.Env is
       Write_Line ("List of Sources:");
 
       Unit := Units_Htable.Get_First (In_Tree.Units_HT);
-
       while Unit /= No_Unit_Index loop
          Write_Str  ("   ");
          Write_Line (Namet.Get_Name_String (Unit.Name));
@@ -2121,6 +2122,21 @@ package body Prj.Env is
 
                   Add_Str_To_Name_Buffer
                     ("lib" & Directory_Separator & "gnat");
+
+                  --  $prefix/$target/share/gpr
+
+                  Add_Str_To_Name_Buffer
+                    (Path_Separator & Prefix.all & Target_Name);
+
+                  --  Note: Target_Name has a trailing / when it comes from
+                  --  Sdefault.
+
+                  if Name_Buffer (Name_Len) /= '/' then
+                     Add_Char_To_Name_Buffer (Directory_Separator);
+                  end if;
+
+                  Add_Str_To_Name_Buffer
+                    ("share" & Directory_Separator & "gpr");
                end if;
 
                --  $prefix/share/gpr
@@ -2172,8 +2188,8 @@ package body Prj.Env is
      (Self : Project_Search_Path;
       Path : String) return String_Access
    is
-      First  : Natural;
-      Last   : Natural;
+      First : Natural;
+      Last  : Natural;
 
    begin
       if Current_Verbosity = High then
@@ -2328,15 +2344,15 @@ package body Prj.Env is
             Result :=
               Try_Path_Name
                 (Self,
-                 Directory & Directory_Separator &
-                   File & Project_File_Extension);
+                 Directory & Directory_Separator
+                 & File & Project_File_Extension);
          end if;
 
          --  Then we try <directory>/<file_name>
 
          if Result = null then
-            Result := Try_Path_Name
-                       (Self, Directory & Directory_Separator & File);
+            Result :=
+              Try_Path_Name (Self, Directory & Directory_Separator & File);
          end if;
       end if;
 
index 625bae1..d369ae2 100644 (file)
@@ -530,7 +530,11 @@ package body Prj.Util is
       --  Now handle the bodies and separates if needed
 
       if Deps.Length /= 0 then
-         Iter := For_Each_Source (Tree, Project);
+         if Project.Qualifier = Aggregate_Library then
+            Iter := For_Each_Source (Tree);
+         else
+            Iter := For_Each_Source (Tree, Project);
+         end if;
 
          loop
             Sid := Element (Iter);
index 1040a6d..dcc108d 100644 (file)
@@ -1254,6 +1254,9 @@ the search stops:
   @item @file{<prefix>/<target>/lib/gnat}
   (for @command{gnatmake} in all cases, and for @command{gprbuild} if option
   @option{--target} is specified)
+  @item @file{<prefix>/<target>/share/gpr}
+  (for @command{gnatmake} in all cases, and for @command{gprbuild} if option
+  @option{--target} is specified)
   @item @file{<prefix>/share/gpr/}
   (for @command{gnatmake} and @command{gprbuild})
   @item @file{<prefix>/lib/gnat/}