Commit a0367a97 by Arnaud Charlet

[multiple changes]

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
parent ce3904da
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> 2014-02-06 Robert Dewar <dewar@adacore.com>
* exp_util.ads, checks.adb, sem_prag.adb, prj-util.adb, sem_ch13.adb: * exp_util.ads, checks.adb, sem_prag.adb, prj-util.adb, sem_ch13.adb:
......
...@@ -117,6 +117,12 @@ procedure Gnat1drv is ...@@ -117,6 +117,12 @@ procedure Gnat1drv is
Relaxed_RM_Semantics := True; Relaxed_RM_Semantics := True;
end if; 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 -- -gnatd.E sets Error_To_Warning mode, causing selected error messages
-- to be treated as warnings instead of errors. -- to be treated as warnings instead of errors.
......
...@@ -346,7 +346,9 @@ package Nlists is ...@@ -346,7 +346,9 @@ package Nlists is
function No (List : List_Id) return Boolean; function No (List : List_Id) return Boolean;
pragma Inline (No); pragma Inline (No);
-- Tests given Id for equality with No_List. This allows notations like -- 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; function Present (List : List_Id) return Boolean;
pragma Inline (Present); pragma Inline (Present);
......
...@@ -996,6 +996,13 @@ package Opt is ...@@ -996,6 +996,13 @@ package Opt is
-- GNATMAKE -- GNATMAKE
-- Set to True if minimal recompilation mode requested -- 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; Multiple_Unit_Index : Int := 0;
-- GNAT -- GNAT
-- This is set non-zero if the current unit is being compiled in multiple -- This is set non-zero if the current unit is being compiled in multiple
......
...@@ -181,6 +181,19 @@ package body Output is ...@@ -181,6 +181,19 @@ package body Output is
(Cur_Indentation + Indentation_Amount) mod Indentation_Limit; (Cur_Indentation + Indentation_Amount) mod Indentation_Limit;
end Indent; 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 -- -- Outdent --
------------- -------------
......
...@@ -137,6 +137,10 @@ package Output is ...@@ -137,6 +137,10 @@ package Output is
procedure Write_Line (S : String); procedure Write_Line (S : String);
-- Equivalent to Write_Str (S) followed by Write_Eol; -- 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; function Column return Pos;
pragma Inline (Column); pragma Inline (Column);
-- Returns the number of the column about to be written (e.g. a value of 1 -- Returns the number of the column about to be written (e.g. a value of 1
......
...@@ -148,7 +148,7 @@ package body Prj.Env is ...@@ -148,7 +148,7 @@ package body Prj.Env is
if Recursive then if Recursive then
-- If it is the first time we call this function for this project, -- 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 if Project.Ada_Include_Path = null then
Buffer := new String (1 .. Buffer_Initial); Buffer := new String (1 .. Buffer_Initial);
...@@ -292,7 +292,6 @@ package body Prj.Env is ...@@ -292,7 +292,6 @@ package body Prj.Env is
for Index in for Index in
Object_Path_Table.First .. Object_Path_Table.Last (Object_Paths) Object_Path_Table.First .. Object_Path_Table.Last (Object_Paths)
loop loop
-- If it is, remove it, and add it as the last one -- If it is, remove it, and add it as the last one
if Object_Paths.Table (Index) = Object_Dir then if Object_Paths.Table (Index) = Object_Dir then
...@@ -323,9 +322,10 @@ package body Prj.Env is ...@@ -323,9 +322,10 @@ package body Prj.Env is
Buffer : in out String_Access; Buffer : in out String_Access;
Buffer_Last : in out Natural) Buffer_Last : in out Natural)
is is
Current : String_List_Id := Source_Dirs; Current : String_List_Id;
Source_Dir : String_Element; Source_Dir : String_Element;
begin begin
Current := Source_Dirs;
while Current /= Nil_String loop while Current /= Nil_String loop
Source_Dir := Shared.String_Elements.Table (Current); Source_Dir := Shared.String_Elements.Table (Current);
Add_To_Path (Get_Name_String (Source_Dir.Display_Value), Add_To_Path (Get_Name_String (Source_Dir.Display_Value),
...@@ -359,11 +359,10 @@ package body Prj.Env is ...@@ -359,11 +359,10 @@ package body Prj.Env is
-- Note: the order of the conditions below is important, since -- Note: the order of the conditions below is important, since
-- it ensures a minimal number of string comparisons. -- it ensures a minimal number of string comparisons.
if (J = Path'First if (J = Path'First or else Path (J - 1) = Path_Separator)
or else Path (J - 1) = Path_Separator)
and then and then
(J + Dir'Length > Path'Last (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) and then Dir = Path (J .. J + Dir'Length - 1)
then then
return True; return True;
...@@ -426,13 +425,14 @@ package body Prj.Env is ...@@ -426,13 +425,14 @@ package body Prj.Env is
Shared : Shared_Project_Tree_Data_Access; Shared : Shared_Project_Tree_Data_Access;
Source_Paths : in out Source_Path_Table.Instance) Source_Paths : in out Source_Path_Table.Instance)
is is
Current : String_List_Id := Source_Dirs; Current : String_List_Id;
Source_Dir : String_Element; Source_Dir : String_Element;
Add_It : Boolean; Add_It : Boolean;
begin begin
-- Add each source directory -- Add each source directory
Current := Source_Dirs;
while Current /= Nil_String loop while Current /= Nil_String loop
Source_Dir := Shared.String_Elements.Table (Current); Source_Dir := Shared.String_Elements.Table (Current);
Add_It := True; Add_It := True;
...@@ -1088,15 +1088,17 @@ package body Prj.Env is ...@@ -1088,15 +1088,17 @@ package body Prj.Env is
Unit := Units_Htable.Get_First (In_Tree.Units_HT); Unit := Units_Htable.Get_First (In_Tree.Units_HT);
while Unit /= null loop while Unit /= null loop
-- Check for body -- Check for body
if not Main_Project_Only if not Main_Project_Only
or else or else
(Unit.File_Names (Impl) /= null (Unit.File_Names (Impl) /= null
and then Unit.File_Names (Impl).Project = The_Project) and then Unit.File_Names (Impl).Project = The_Project)
then then
declare declare
Current_Name : File_Name_Type; Current_Name : File_Name_Type;
begin begin
-- Case of a body present -- Case of a body present
...@@ -1365,8 +1367,8 @@ package body Prj.Env is ...@@ -1365,8 +1367,8 @@ package body Prj.Env is
(Namet.Get_Name_String (Namet.Get_Name_String
(Unit.File_Names (Spec).File) = Original_Name (Unit.File_Names (Spec).File) = Original_Name
or else (Unit.File_Names (Spec).Path /= No_Path_Information or else (Unit.File_Names (Spec).Path /= No_Path_Information
and then and then
Namet.Get_Name_String Namet.Get_Name_String
(Unit.File_Names (Spec).Path.Name) = (Unit.File_Names (Spec).Path.Name) =
Original_Name)) Original_Name))
then then
...@@ -1481,7 +1483,6 @@ package body Prj.Env is ...@@ -1481,7 +1483,6 @@ package body Prj.Env is
Write_Line ("List of Sources:"); Write_Line ("List of Sources:");
Unit := Units_Htable.Get_First (In_Tree.Units_HT); Unit := Units_Htable.Get_First (In_Tree.Units_HT);
while Unit /= No_Unit_Index loop while Unit /= No_Unit_Index loop
Write_Str (" "); Write_Str (" ");
Write_Line (Namet.Get_Name_String (Unit.Name)); Write_Line (Namet.Get_Name_String (Unit.Name));
...@@ -2121,6 +2122,21 @@ package body Prj.Env is ...@@ -2121,6 +2122,21 @@ package body Prj.Env is
Add_Str_To_Name_Buffer Add_Str_To_Name_Buffer
("lib" & Directory_Separator & "gnat"); ("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; end if;
-- $prefix/share/gpr -- $prefix/share/gpr
...@@ -2172,8 +2188,8 @@ package body Prj.Env is ...@@ -2172,8 +2188,8 @@ package body Prj.Env is
(Self : Project_Search_Path; (Self : Project_Search_Path;
Path : String) return String_Access Path : String) return String_Access
is is
First : Natural; First : Natural;
Last : Natural; Last : Natural;
begin begin
if Current_Verbosity = High then if Current_Verbosity = High then
...@@ -2328,15 +2344,15 @@ package body Prj.Env is ...@@ -2328,15 +2344,15 @@ package body Prj.Env is
Result := Result :=
Try_Path_Name Try_Path_Name
(Self, (Self,
Directory & Directory_Separator & Directory & Directory_Separator
File & Project_File_Extension); & File & Project_File_Extension);
end if; end if;
-- Then we try <directory>/<file_name> -- Then we try <directory>/<file_name>
if Result = null then if Result = null then
Result := Try_Path_Name Result :=
(Self, Directory & Directory_Separator & File); Try_Path_Name (Self, Directory & Directory_Separator & File);
end if; end if;
end if; end if;
......
...@@ -530,7 +530,11 @@ package body Prj.Util is ...@@ -530,7 +530,11 @@ package body Prj.Util is
-- Now handle the bodies and separates if needed -- Now handle the bodies and separates if needed
if Deps.Length /= 0 then 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 loop
Sid := Element (Iter); Sid := Element (Iter);
......
...@@ -1254,6 +1254,9 @@ the search stops: ...@@ -1254,6 +1254,9 @@ the search stops:
@item @file{<prefix>/<target>/lib/gnat} @item @file{<prefix>/<target>/lib/gnat}
(for @command{gnatmake} in all cases, and for @command{gprbuild} if option (for @command{gnatmake} in all cases, and for @command{gprbuild} if option
@option{--target} is specified) @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/} @item @file{<prefix>/share/gpr/}
(for @command{gnatmake} and @command{gprbuild}) (for @command{gnatmake} and @command{gprbuild})
@item @file{<prefix>/lib/gnat/} @item @file{<prefix>/lib/gnat/}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment