gnatcmd.adb, [...] (Shared_Project_Tree_Data): new type An aggregate project and its aggregated trees need to share the common...
2011-08-03 Emmanuel Briot <briot@adacore.com> * gnatcmd.adb, prj-proc.adb, prj-proc.ads, make.adb, mlib-prj.adb, prj.adb, prj.ads, makeutl.adb, makeutl.ads, clean.adb, prj-nmsc.adb, prj-util.adb, prj-util.ads, prj-conf.adb, prj-conf.ads, prj-env.adb, prj-env.ads (Shared_Project_Tree_Data): new type An aggregate project and its aggregated trees need to share the common data structures used for lists of strings, packages,... This makes the code simpler since otherwise we have to pass the root tree (also used for the configuration file data) in addition to the current project tree. This also avoids ambiguities as to which tree should be used. And finally this saves a bit of memory. (For_Every_Project_Imported): new parameter Tree. Since aggregated projects are using a different tree, we need to let the caller know which tree to use to manipulate the returned project. From-SVN: r177261
This commit is contained in:
parent
9fde638da6
commit
40ecf2f5d1
|
@ -1,3 +1,19 @@
|
|||
2011-08-03 Emmanuel Briot <briot@adacore.com>
|
||||
|
||||
* gnatcmd.adb, prj-proc.adb, prj-proc.ads, make.adb, mlib-prj.adb,
|
||||
prj.adb, prj.ads, makeutl.adb, makeutl.ads, clean.adb, prj-nmsc.adb,
|
||||
prj-util.adb, prj-util.ads, prj-conf.adb, prj-conf.ads, prj-env.adb,
|
||||
prj-env.ads (Shared_Project_Tree_Data): new type
|
||||
An aggregate project and its aggregated trees need to share the common
|
||||
data structures used for lists of strings, packages,... This makes the
|
||||
code simpler since otherwise we have to pass the root tree (also used
|
||||
for the configuration file data) in addition to the current project
|
||||
tree. This also avoids ambiguities as to which tree should be used.
|
||||
And finally this saves a bit of memory.
|
||||
(For_Every_Project_Imported): new parameter Tree.
|
||||
Since aggregated projects are using a different tree, we need to let
|
||||
the caller know which tree to use to manipulate the returned project.
|
||||
|
||||
2011-08-03 Robert Dewar <dewar@adacore.com>
|
||||
|
||||
* prj-proc.adb, exp_util.ads, exp_ch9.adb, make.adb, prj-ext.adb,
|
||||
|
|
|
@ -1170,7 +1170,7 @@ package body Clean is
|
|||
Executable :=
|
||||
Executable_Of
|
||||
(Main_Project,
|
||||
Project_Tree,
|
||||
Project_Tree.Shared,
|
||||
Main_Source_File,
|
||||
Current_File_Index);
|
||||
|
||||
|
@ -1425,7 +1425,7 @@ package body Clean is
|
|||
-- Add source directories and object directories to the search paths
|
||||
|
||||
Add_Source_Directories (Main_Project, Project_Tree);
|
||||
Add_Object_Directories (Main_Project);
|
||||
Add_Object_Directories (Main_Project, Project_Tree);
|
||||
end if;
|
||||
|
||||
Osint.Add_Default_Search_Dirs;
|
||||
|
@ -1440,7 +1440,7 @@ package body Clean is
|
|||
Value : String_List_Id := Main_Project.Mains;
|
||||
begin
|
||||
while Value /= Prj.Nil_String loop
|
||||
Main := Project_Tree.String_Elements.Table (Value);
|
||||
Main := Project_Tree.Shared.String_Elements.Table (Value);
|
||||
Osint.Add_File
|
||||
(File_Name => Get_Name_String (Main.Value),
|
||||
Index => Main.Index);
|
||||
|
|
|
@ -255,6 +255,7 @@ procedure GNATCmd is
|
|||
|
||||
procedure Set_Library_For
|
||||
(Project : Project_Id;
|
||||
Tree : Project_Tree_Ref;
|
||||
Libraries_Present : in out Boolean);
|
||||
-- If Project is a library project, add the correct -L and -l switches to
|
||||
-- the linker invocation.
|
||||
|
@ -445,7 +446,7 @@ procedure GNATCmd is
|
|||
B_Start.all &
|
||||
MLib.Fil.Ext_To
|
||||
(Get_Name_String
|
||||
(Project_Tree.String_Elements.Table
|
||||
(Project_Tree.Shared.String_Elements.Table
|
||||
(Main).Value),
|
||||
"ci"));
|
||||
|
||||
|
@ -463,13 +464,13 @@ procedure GNATCmd is
|
|||
"b__" &
|
||||
MLib.Fil.Ext_To
|
||||
(Get_Name_String
|
||||
(Project_Tree.String_Elements.Table
|
||||
(Main).Value),
|
||||
(Project_Tree.Shared
|
||||
.String_Elements.Table (Main).Value),
|
||||
"ci"));
|
||||
end if;
|
||||
|
||||
Main :=
|
||||
Project_Tree.String_Elements.Table (Main).Next;
|
||||
Main := Project_Tree.Shared.String_Elements.Table
|
||||
(Main).Next;
|
||||
end loop;
|
||||
|
||||
if Proj.Project.Library then
|
||||
|
@ -960,7 +961,7 @@ procedure GNATCmd is
|
|||
-- Check if there are library project files
|
||||
|
||||
if MLib.Tgt.Support_For_Libraries /= None then
|
||||
Set_Libraries (Project, Libraries_Present);
|
||||
Set_Libraries (Project, Project_Tree, Libraries_Present);
|
||||
end if;
|
||||
|
||||
-- If there are, add the necessary additional switches
|
||||
|
@ -1236,8 +1237,10 @@ procedure GNATCmd is
|
|||
|
||||
procedure Set_Library_For
|
||||
(Project : Project_Id;
|
||||
Tree : Project_Tree_Ref;
|
||||
Libraries_Present : in out Boolean)
|
||||
is
|
||||
pragma Unreferenced (Tree);
|
||||
Path_Option : constant String_Access :=
|
||||
MLib.Linker_Library_Path_Option;
|
||||
|
||||
|
@ -1870,7 +1873,7 @@ begin
|
|||
Prj.Util.Value_Of
|
||||
(Name => Tool_Package_Name,
|
||||
In_Packages => Project.Decl.Packages,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
|
||||
Element : Package_Element;
|
||||
|
||||
|
@ -1884,7 +1887,7 @@ begin
|
|||
|
||||
begin
|
||||
if Pkg /= No_Package then
|
||||
Element := Project_Tree.Packages.Table (Pkg);
|
||||
Element := Project_Tree.Shared.Packages.Table (Pkg);
|
||||
|
||||
-- Packages Gnatls and Gnatstack have a single attribute
|
||||
-- Switches, that is not an associative array.
|
||||
|
@ -1894,7 +1897,7 @@ begin
|
|||
Prj.Util.Value_Of
|
||||
(Variable_Name => Snames.Name_Switches,
|
||||
In_Variables => Element.Decl.Attributes,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
|
||||
-- Packages Binder (for gnatbind), Cross_Reference (for
|
||||
-- gnatxref), Linker (for gnatlink), Finder (for gnatfind),
|
||||
|
@ -1926,14 +1929,14 @@ begin
|
|||
Prj.Util.Value_Of
|
||||
(Name => Name_Switches,
|
||||
In_Arrays => Element.Decl.Arrays,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
Name_Len := 0;
|
||||
Add_Str_To_Name_Buffer (Main.all);
|
||||
The_Switches := Prj.Util.Value_Of
|
||||
(Index => Name_Find,
|
||||
Src_Index => 0,
|
||||
In_Array => Switches_Array,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
end if;
|
||||
|
||||
if The_Switches.Kind = Prj.Undefined then
|
||||
|
@ -1941,12 +1944,12 @@ begin
|
|||
Prj.Util.Value_Of
|
||||
(Name => Name_Default_Switches,
|
||||
In_Arrays => Element.Decl.Arrays,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
The_Switches := Prj.Util.Value_Of
|
||||
(Index => Name_Ada,
|
||||
Src_Index => 0,
|
||||
In_Array => Switches_Array,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
end if;
|
||||
end if;
|
||||
|
||||
|
@ -1973,7 +1976,7 @@ begin
|
|||
when Prj.List =>
|
||||
Current := The_Switches.Values;
|
||||
while Current /= Prj.Nil_String loop
|
||||
The_String := Project_Tree.String_Elements.
|
||||
The_String := Project_Tree.Shared.String_Elements.
|
||||
Table (Current);
|
||||
|
||||
declare
|
||||
|
@ -2024,7 +2027,7 @@ begin
|
|||
Prj.Util.Value_Of
|
||||
(Name => Name_Compiler,
|
||||
In_Packages => Project.Decl.Packages,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
|
||||
Element : Package_Element;
|
||||
|
||||
|
@ -2054,7 +2057,7 @@ begin
|
|||
end if;
|
||||
end loop;
|
||||
|
||||
Element := Project_Tree.Packages.Table (Pkg);
|
||||
Element := Project_Tree.Shared.Packages.Table (Pkg);
|
||||
|
||||
-- If there is a single main and there is compilation
|
||||
-- switches specified in the project file, use them.
|
||||
|
@ -2069,12 +2072,12 @@ begin
|
|||
Prj.Util.Value_Of
|
||||
(Name => Name_Switches,
|
||||
In_Arrays => Element.Decl.Arrays,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
The_Switches := Prj.Util.Value_Of
|
||||
(Index => Main_Id,
|
||||
Src_Index => 0,
|
||||
In_Array => Switches_Array,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
end if;
|
||||
|
||||
-- Otherwise, get the Default_Switches ("Ada")
|
||||
|
@ -2084,12 +2087,12 @@ begin
|
|||
Prj.Util.Value_Of
|
||||
(Name => Name_Default_Switches,
|
||||
In_Arrays => Element.Decl.Arrays,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
The_Switches := Prj.Util.Value_Of
|
||||
(Index => Name_Ada,
|
||||
Src_Index => 0,
|
||||
In_Array => Switches_Array,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
end if;
|
||||
|
||||
-- If there are switches specified, put them in the
|
||||
|
@ -2112,8 +2115,8 @@ begin
|
|||
when Prj.List =>
|
||||
Current := The_Switches.Values;
|
||||
while Current /= Prj.Nil_String loop
|
||||
The_String :=
|
||||
Project_Tree.String_Elements.Table (Current);
|
||||
The_String := Project_Tree.Shared.String_Elements
|
||||
.Table (Current);
|
||||
|
||||
declare
|
||||
Switch : constant String :=
|
||||
|
@ -2244,7 +2247,7 @@ begin
|
|||
Prj.Util.Value_Of
|
||||
(Name => Name_Builder,
|
||||
In_Packages => Project.Decl.Packages,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
|
||||
Variable : Variable_Value :=
|
||||
Prj.Util.Value_Of
|
||||
|
@ -2252,7 +2255,7 @@ begin
|
|||
Attribute_Or_Array_Name =>
|
||||
Name_Global_Configuration_Pragmas,
|
||||
In_Package => Pkg,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
|
||||
begin
|
||||
if (Variable = Nil_Variable_Value
|
||||
|
@ -2265,7 +2268,7 @@ begin
|
|||
Attribute_Or_Array_Name =>
|
||||
Name_Global_Config_File,
|
||||
In_Package => Pkg,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
end if;
|
||||
|
||||
if Variable /= Nil_Variable_Value
|
||||
|
@ -2283,7 +2286,7 @@ begin
|
|||
Prj.Util.Value_Of
|
||||
(Name => Name_Compiler,
|
||||
In_Packages => Project.Decl.Packages,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
|
||||
Variable : Variable_Value :=
|
||||
Prj.Util.Value_Of
|
||||
|
@ -2291,7 +2294,7 @@ begin
|
|||
Attribute_Or_Array_Name =>
|
||||
Name_Local_Configuration_Pragmas,
|
||||
In_Package => Pkg,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
|
||||
begin
|
||||
if (Variable = Nil_Variable_Value
|
||||
|
@ -2304,7 +2307,7 @@ begin
|
|||
Attribute_Or_Array_Name =>
|
||||
Name_Local_Config_File,
|
||||
In_Package => Pkg,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
end if;
|
||||
|
||||
if Variable /= Nil_Variable_Value
|
||||
|
|
|
@ -1288,7 +1288,8 @@ package body Make is
|
|||
|
||||
Switch_List := Switches.Values;
|
||||
while Switch_List /= Nil_String loop
|
||||
Element := Project_Tree.String_Elements.Table (Switch_List);
|
||||
Element :=
|
||||
Project_Tree.Shared.String_Elements.Table (Switch_List);
|
||||
Get_Name_String (Element.Value);
|
||||
|
||||
if Name_Len > 0 then
|
||||
|
@ -2301,7 +2302,7 @@ package body Make is
|
|||
Prj.Util.Value_Of
|
||||
(Name => Name_Compiler,
|
||||
In_Packages => Arguments_Project.Decl.Packages,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
|
||||
if Compiler_Package /= No_Package then
|
||||
|
||||
|
@ -2332,7 +2333,7 @@ package body Make is
|
|||
|
||||
begin
|
||||
while Current /= Nil_String loop
|
||||
Element := Project_Tree.String_Elements.
|
||||
Element := Project_Tree.Shared.String_Elements.
|
||||
Table (Current);
|
||||
Number := Number + 1;
|
||||
Current := Element.Next;
|
||||
|
@ -2348,7 +2349,7 @@ package body Make is
|
|||
Current := Switches.Values;
|
||||
|
||||
for Index in New_Args'Range loop
|
||||
Element := Project_Tree.String_Elements.
|
||||
Element := Project_Tree.Shared.String_Elements.
|
||||
Table (Current);
|
||||
Get_Name_String (Element.Value);
|
||||
|
||||
|
@ -3851,14 +3852,14 @@ package body Make is
|
|||
Prj.Util.Value_Of
|
||||
(Name => Name_Builder,
|
||||
In_Packages => The_Packages,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
|
||||
if Gnatmake /= No_Package then
|
||||
Global_Attribute := Prj.Util.Value_Of
|
||||
(Variable_Name => Name_Global_Configuration_Pragmas,
|
||||
In_Variables => Project_Tree.Packages.Table
|
||||
In_Variables => Project_Tree.Shared.Packages.Table
|
||||
(Gnatmake).Decl.Attributes,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
Global_Attribute_Present :=
|
||||
Global_Attribute /= Nil_Variable_Value
|
||||
and then Get_Name_String (Global_Attribute.Value) /= "";
|
||||
|
@ -3894,14 +3895,14 @@ package body Make is
|
|||
Prj.Util.Value_Of
|
||||
(Name => Name_Compiler,
|
||||
In_Packages => The_Packages,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
|
||||
if Compiler /= No_Package then
|
||||
Local_Attribute := Prj.Util.Value_Of
|
||||
(Variable_Name => Name_Local_Configuration_Pragmas,
|
||||
In_Variables => Project_Tree.Packages.Table
|
||||
In_Variables => Project_Tree.Shared.Packages.Table
|
||||
(Compiler).Decl.Attributes,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
Local_Attribute_Present :=
|
||||
Local_Attribute /= Nil_Variable_Value
|
||||
and then Get_Name_String (Local_Attribute.Value) /= "";
|
||||
|
@ -4183,7 +4184,7 @@ package body Make is
|
|||
if Main_Project = No_Project then
|
||||
GNAT.OS_Lib.Spawn (Globalizer_Path.all, Globalizer_Args, Success);
|
||||
else
|
||||
Globalize_Dirs (Main_Project);
|
||||
Globalize_Dirs (Main_Project, Project_Tree);
|
||||
end if;
|
||||
end Globalize;
|
||||
|
||||
|
@ -4535,7 +4536,7 @@ package body Make is
|
|||
Prj.Util.Value_Of
|
||||
(Name_Languages,
|
||||
Main_Project.Decl.Attributes,
|
||||
Project_Tree);
|
||||
Project_Tree.Shared);
|
||||
|
||||
Current : String_List_Id;
|
||||
Element : String_Element;
|
||||
|
@ -4551,7 +4552,7 @@ package body Make is
|
|||
Current := Languages.Values;
|
||||
Look_For_Foreign :
|
||||
while Current /= Nil_String loop
|
||||
Element := Project_Tree.String_Elements.
|
||||
Element := Project_Tree.Shared.String_Elements.
|
||||
Table (Current);
|
||||
Get_Name_String (Element.Value);
|
||||
To_Lower (Name_Buffer (1 .. Name_Len));
|
||||
|
@ -4574,12 +4575,13 @@ package body Make is
|
|||
-- line.
|
||||
|
||||
Get_Name_String
|
||||
(Project_Tree.String_Elements.Table (Value).Value);
|
||||
(Project_Tree.Shared.String_Elements.Table
|
||||
(Value).Value);
|
||||
|
||||
declare
|
||||
Main_Name : constant String :=
|
||||
Get_Name_String
|
||||
(Project_Tree.String_Elements.Table
|
||||
(Project_Tree.Shared.String_Elements.Table
|
||||
(Value).Value);
|
||||
Proj : constant Project_Id :=
|
||||
Prj.Env.Project_Of
|
||||
|
@ -4591,10 +4593,10 @@ package body Make is
|
|||
At_Least_One_Main := True;
|
||||
Osint.Add_File
|
||||
(Get_Name_String
|
||||
(Project_Tree.String_Elements.Table
|
||||
(Project_Tree.Shared.String_Elements.Table
|
||||
(Value).Value),
|
||||
Index =>
|
||||
Project_Tree.String_Elements.Table
|
||||
Project_Tree.Shared.String_Elements.Table
|
||||
(Value).Index);
|
||||
|
||||
elsif not Foreign_Language then
|
||||
|
@ -4605,7 +4607,7 @@ package body Make is
|
|||
end if;
|
||||
end;
|
||||
|
||||
Value := Project_Tree.String_Elements.Table
|
||||
Value := Project_Tree.Shared.String_Elements.Table
|
||||
(Value).Next;
|
||||
end loop;
|
||||
|
||||
|
@ -4765,19 +4767,19 @@ package body Make is
|
|||
Prj.Util.Value_Of
|
||||
(Name => Name_Builder,
|
||||
In_Packages => The_Packages,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
|
||||
Binder_Package : constant Prj.Package_Id :=
|
||||
Prj.Util.Value_Of
|
||||
(Name => Name_Binder,
|
||||
In_Packages => The_Packages,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
|
||||
Linker_Package : constant Prj.Package_Id :=
|
||||
Prj.Util.Value_Of
|
||||
(Name => Name_Linker,
|
||||
In_Packages => The_Packages,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
|
||||
Default_Switches_Array : Array_Id;
|
||||
|
||||
|
@ -4832,20 +4834,20 @@ package body Make is
|
|||
|
||||
Global_Compilation_Array := Prj.Util.Value_Of
|
||||
(Name => Name_Global_Compilation_Switches,
|
||||
In_Arrays => Project_Tree.Packages.Table
|
||||
In_Arrays => Project_Tree.Shared.Packages.Table
|
||||
(Builder_Package).Decl.Arrays,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
|
||||
Default_Switches_Array :=
|
||||
Project_Tree.Packages.Table
|
||||
Project_Tree.Shared.Packages.Table
|
||||
(Builder_Package).Decl.Arrays;
|
||||
|
||||
while Default_Switches_Array /= No_Array and then
|
||||
Project_Tree.Arrays.Table (Default_Switches_Array).Name /=
|
||||
Name_Default_Switches
|
||||
Project_Tree.Shared.Arrays.Table (Default_Switches_Array).Name
|
||||
/= Name_Default_Switches
|
||||
loop
|
||||
Default_Switches_Array :=
|
||||
Project_Tree.Arrays.Table (Default_Switches_Array).Next;
|
||||
Default_Switches_Array := Project_Tree.Shared.Arrays.Table
|
||||
(Default_Switches_Array).Next;
|
||||
end loop;
|
||||
|
||||
if Global_Compilation_Array /= No_Array_Element and then
|
||||
|
@ -4854,7 +4856,7 @@ package body Make is
|
|||
Errutil.Error_Msg
|
||||
("Default_Switches forbidden in presence of " &
|
||||
"Global_Compilation_Switches. Use Switches instead.",
|
||||
Project_Tree.Arrays.Table
|
||||
Project_Tree.Shared.Arrays.Table
|
||||
(Default_Switches_Array).Location);
|
||||
Errutil.Finalize;
|
||||
Make_Failed
|
||||
|
@ -4899,15 +4901,15 @@ package body Make is
|
|||
Name_Default_Switches,
|
||||
In_Package =>
|
||||
Builder_Package,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
|
||||
Switches : constant Array_Element_Id :=
|
||||
Prj.Util.Value_Of
|
||||
(Name => Name_Switches,
|
||||
In_Arrays =>
|
||||
Project_Tree.Packages.Table
|
||||
Project_Tree.Shared.Packages.Table
|
||||
(Builder_Package).Decl.Arrays,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
|
||||
Other_Switches : constant Variable_Value :=
|
||||
Prj.Util.Value_Of
|
||||
|
@ -4916,13 +4918,13 @@ package body Make is
|
|||
Attribute_Or_Array_Name
|
||||
=> Name_Switches,
|
||||
In_Package => Builder_Package,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
|
||||
begin
|
||||
if Other_Switches /= Nil_Variable_Value then
|
||||
if not Quiet_Output
|
||||
and then Switches /= No_Array_Element
|
||||
and then Project_Tree.Array_Elements.Table
|
||||
and then Project_Tree.Shared.Array_Elements.Table
|
||||
(Switches).Next /= No_Array_Element
|
||||
then
|
||||
Write_Line
|
||||
|
@ -4977,7 +4979,7 @@ package body Make is
|
|||
begin
|
||||
while Global_Compilation_Array /= No_Array_Element loop
|
||||
Global_Compilation_Elem :=
|
||||
Project_Tree.Array_Elements.Table
|
||||
Project_Tree.Shared.Array_Elements.Table
|
||||
(Global_Compilation_Array);
|
||||
|
||||
Get_Name_String (Global_Compilation_Elem.Index);
|
||||
|
@ -4999,7 +5001,8 @@ package body Make is
|
|||
|
||||
while List /= Nil_String loop
|
||||
Elem :=
|
||||
Project_Tree.String_Elements.Table (List);
|
||||
Project_Tree.Shared.String_Elements.Table
|
||||
(List);
|
||||
|
||||
if Elem.Value /= No_Name then
|
||||
Add_Switch
|
||||
|
@ -5431,7 +5434,8 @@ package body Make is
|
|||
|
||||
Executable :=
|
||||
Prj.Util.Executable_Of
|
||||
(Main_Project, Project_Tree, Main_Source_File, Main_Index);
|
||||
(Main_Project, Project_Tree.Shared,
|
||||
Main_Source_File, Main_Index);
|
||||
end if;
|
||||
end if;
|
||||
|
||||
|
@ -6337,13 +6341,13 @@ package body Make is
|
|||
Prj.Util.Value_Of
|
||||
(Name => Name_Binder,
|
||||
In_Packages => The_Packages,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
|
||||
Linker_Package : constant Prj.Package_Id :=
|
||||
Prj.Util.Value_Of
|
||||
(Name => Name_Linker,
|
||||
In_Packages => The_Packages,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
|
||||
begin
|
||||
-- We fail if we cannot find the main source file
|
||||
|
@ -6848,7 +6852,7 @@ package body Make is
|
|||
-- has its own directories anyway
|
||||
|
||||
Add_Source_Directories (Main_Project, Project_Tree);
|
||||
Add_Object_Directories (Main_Project);
|
||||
Add_Object_Directories (Main_Project, Project_Tree);
|
||||
|
||||
Recursive_Compute_Depth (Main_Project);
|
||||
Compute_All_Imported_Projects (Project_Tree);
|
||||
|
@ -8457,7 +8461,7 @@ package body Make is
|
|||
(Source_File => Source_File,
|
||||
Source_Lang => Name_Ada,
|
||||
Source_Prj => Project,
|
||||
Pkg_Name => Project_Tree.Packages.Table (In_Package).Name,
|
||||
Pkg_Name => Project_Tree.Shared.Packages.Table (In_Package).Name,
|
||||
Project_Tree => Project_Tree,
|
||||
Value => Switches,
|
||||
Is_Default => Is_Default,
|
||||
|
|
|
@ -695,7 +695,7 @@ package body Makeutl is
|
|||
Prj.Util.Value_Of
|
||||
(Name => Pkg_Name,
|
||||
In_Packages => Project.Decl.Packages,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
Lang : Language_Ptr;
|
||||
|
||||
begin
|
||||
|
@ -706,7 +706,7 @@ package body Makeutl is
|
|||
(Name => Name_Id (Source_File),
|
||||
Attribute_Or_Array_Name => Name_Switches,
|
||||
In_Package => Pkg,
|
||||
In_Tree => Project_Tree,
|
||||
Shared => Project_Tree.Shared,
|
||||
Allow_Wildcards => True);
|
||||
end if;
|
||||
|
||||
|
@ -756,7 +756,7 @@ package body Makeutl is
|
|||
(Name => Name_Find,
|
||||
Attribute_Or_Array_Name => Name_Switches,
|
||||
In_Package => Pkg,
|
||||
In_Tree => Project_Tree,
|
||||
Shared => Project_Tree.Shared,
|
||||
Allow_Wildcards => True);
|
||||
end if;
|
||||
|
||||
|
@ -776,7 +776,7 @@ package body Makeutl is
|
|||
(Name => Name_Find,
|
||||
Attribute_Or_Array_Name => Name_Switches,
|
||||
In_Package => Pkg,
|
||||
In_Tree => Project_Tree,
|
||||
Shared => Project_Tree.Shared,
|
||||
Allow_Wildcards => True);
|
||||
end if;
|
||||
end;
|
||||
|
@ -790,7 +790,7 @@ package body Makeutl is
|
|||
(Name => Source_Lang,
|
||||
Attribute_Or_Array_Name => Name_Switches,
|
||||
In_Package => Pkg,
|
||||
In_Tree => Project_Tree,
|
||||
Shared => Project_Tree.Shared,
|
||||
Force_Lower_Case_Index => True);
|
||||
end if;
|
||||
|
||||
|
@ -800,7 +800,7 @@ package body Makeutl is
|
|||
(Name => All_Other_Names,
|
||||
Attribute_Or_Array_Name => Name_Switches,
|
||||
In_Package => Pkg,
|
||||
In_Tree => Project_Tree,
|
||||
Shared => Project_Tree.Shared,
|
||||
Force_Lower_Case_Index => True);
|
||||
end if;
|
||||
|
||||
|
@ -810,7 +810,7 @@ package body Makeutl is
|
|||
(Name => Source_Lang,
|
||||
Attribute_Or_Array_Name => Name_Default_Switches,
|
||||
In_Package => Pkg,
|
||||
In_Tree => Project_Tree);
|
||||
Shared => Project_Tree.Shared);
|
||||
end if;
|
||||
end Get_Switches;
|
||||
|
||||
|
@ -910,14 +910,21 @@ package body Makeutl is
|
|||
(Project : Project_Id;
|
||||
In_Tree : Project_Tree_Ref) return String_List
|
||||
is
|
||||
procedure Recursive_Add (Proj : Project_Id; Dummy : in out Boolean);
|
||||
procedure Recursive_Add
|
||||
(Proj : Project_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
Dummy : in out Boolean);
|
||||
-- The recursive routine used to add linker options
|
||||
|
||||
-------------------
|
||||
-- Recursive_Add --
|
||||
-------------------
|
||||
|
||||
procedure Recursive_Add (Proj : Project_Id; Dummy : in out Boolean) is
|
||||
procedure Recursive_Add
|
||||
(Proj : Project_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
Dummy : in out Boolean)
|
||||
is
|
||||
pragma Unreferenced (Dummy);
|
||||
|
||||
Linker_Package : Package_Id;
|
||||
|
@ -928,7 +935,7 @@ package body Makeutl is
|
|||
Prj.Util.Value_Of
|
||||
(Name => Name_Linker,
|
||||
In_Packages => Proj.Decl.Packages,
|
||||
In_Tree => In_Tree);
|
||||
Shared => In_Tree.Shared);
|
||||
|
||||
Options :=
|
||||
Prj.Util.Value_Of
|
||||
|
@ -936,7 +943,7 @@ package body Makeutl is
|
|||
Index => 0,
|
||||
Attribute_Or_Array_Name => Name_Linker_Options,
|
||||
In_Package => Linker_Package,
|
||||
In_Tree => In_Tree);
|
||||
Shared => In_Tree.Shared);
|
||||
|
||||
-- If attribute is present, add the project with
|
||||
-- the attribute to table Linker_Opts.
|
||||
|
@ -958,7 +965,7 @@ package body Makeutl is
|
|||
begin
|
||||
Linker_Opts.Init;
|
||||
|
||||
For_All_Projects (Project, Dummy, Imported_First => True);
|
||||
For_All_Projects (Project, In_Tree, Dummy, Imported_First => True);
|
||||
|
||||
Last_Linker_Option := 0;
|
||||
|
||||
|
@ -974,7 +981,7 @@ package body Makeutl is
|
|||
begin
|
||||
Options := Linker_Opts.Table (Index).Options;
|
||||
while Options /= Nil_String loop
|
||||
Option := In_Tree.String_Elements.Table (Options).Value;
|
||||
Option := In_Tree.Shared.String_Elements.Table (Options).Value;
|
||||
Get_Name_String (Option);
|
||||
|
||||
-- Do not consider empty linker options
|
||||
|
@ -991,7 +998,7 @@ package body Makeutl is
|
|||
Including_L_Switch => True);
|
||||
end if;
|
||||
|
||||
Options := In_Tree.String_Elements.Table (Options).Next;
|
||||
Options := In_Tree.Shared.String_Elements.Table (Options).Next;
|
||||
end loop;
|
||||
end;
|
||||
end loop;
|
||||
|
|
|
@ -40,7 +40,8 @@ package Makeutl is
|
|||
-- Failing procedure called from procedure Test_If_Relative_Path below. May
|
||||
-- be redirected.
|
||||
|
||||
Project_Tree : constant Project_Tree_Ref := new Project_Tree_Data;
|
||||
Project_Tree : constant Project_Tree_Ref :=
|
||||
new Project_Tree_Data (Is_Root_Tree => True);
|
||||
-- The project tree
|
||||
|
||||
Source_Info_Option : constant String := "--source-info=";
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
-- --
|
||||
-- B o d y --
|
||||
-- --
|
||||
-- Copyright (C) 2001-2010, AdaCore --
|
||||
-- Copyright (C) 2001-2011, AdaCore --
|
||||
-- --
|
||||
-- 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- --
|
||||
|
@ -901,7 +901,7 @@ package body MLib.Prj is
|
|||
Value_Of
|
||||
(Name => Name_Binder,
|
||||
In_Packages => For_Project.Decl.Packages,
|
||||
In_Tree => In_Tree);
|
||||
Shared => In_Tree.Shared);
|
||||
|
||||
begin
|
||||
if Binder_Package /= No_Package then
|
||||
|
@ -910,9 +910,9 @@ package body MLib.Prj is
|
|||
Value_Of
|
||||
(Name => Name_Default_Switches,
|
||||
In_Arrays =>
|
||||
In_Tree.Packages.Table
|
||||
In_Tree.Shared.Packages.Table
|
||||
(Binder_Package).Decl.Arrays,
|
||||
In_Tree => In_Tree);
|
||||
Shared => In_Tree.Shared);
|
||||
|
||||
Switches : Variable_Value := Nil_Variable_Value;
|
||||
Switch : String_List_Id := Nil_String;
|
||||
|
@ -924,7 +924,7 @@ package body MLib.Prj is
|
|||
(Index => Name_Ada,
|
||||
Src_Index => 0,
|
||||
In_Array => Defaults,
|
||||
In_Tree => In_Tree);
|
||||
Shared => In_Tree.Shared);
|
||||
|
||||
if not Switches.Default then
|
||||
Switch := Switches.Values;
|
||||
|
@ -932,9 +932,9 @@ package body MLib.Prj is
|
|||
while Switch /= Nil_String loop
|
||||
Add_Argument
|
||||
(Get_Name_String
|
||||
(In_Tree.String_Elements.Table
|
||||
(In_Tree.Shared.String_Elements.Table
|
||||
(Switch).Value));
|
||||
Switch := In_Tree.String_Elements.
|
||||
Switch := In_Tree.Shared.String_Elements.
|
||||
Table (Switch).Next;
|
||||
end loop;
|
||||
end if;
|
||||
|
@ -1277,7 +1277,8 @@ package body MLib.Prj is
|
|||
-- If attribute Library_Options was specified, add these options
|
||||
|
||||
Library_Options := Value_Of
|
||||
(Name_Library_Options, For_Project.Decl.Attributes, In_Tree);
|
||||
(Name_Library_Options, For_Project.Decl.Attributes,
|
||||
In_Tree.Shared);
|
||||
|
||||
if not Library_Options.Default then
|
||||
declare
|
||||
|
@ -1287,7 +1288,7 @@ package body MLib.Prj is
|
|||
begin
|
||||
Current := Library_Options.Values;
|
||||
while Current /= Nil_String loop
|
||||
Element := In_Tree.String_Elements.Table (Current);
|
||||
Element := In_Tree.Shared.String_Elements.Table (Current);
|
||||
Get_Name_String (Element.Value);
|
||||
|
||||
if Name_Len /= 0 then
|
||||
|
@ -1756,12 +1757,12 @@ package body MLib.Prj is
|
|||
while Iface /= Nil_String loop
|
||||
ALI :=
|
||||
File_Name_Type
|
||||
(In_Tree.String_Elements.Table (Iface).Value);
|
||||
(In_Tree.Shared.String_Elements.Table (Iface).Value);
|
||||
Interface_ALIs.Set (ALI, True);
|
||||
Get_Name_String
|
||||
(In_Tree.String_Elements.Table (Iface).Value);
|
||||
(In_Tree.Shared.String_Elements.Table (Iface).Value);
|
||||
Add_Argument (Name_Buffer (1 .. Name_Len));
|
||||
Iface := In_Tree.String_Elements.Table (Iface).Next;
|
||||
Iface := In_Tree.Shared.String_Elements.Table (Iface).Next;
|
||||
end loop;
|
||||
|
||||
Iface := For_Project.Lib_Interface_ALIs;
|
||||
|
@ -1775,9 +1776,10 @@ package body MLib.Prj is
|
|||
while Iface /= Nil_String loop
|
||||
ALI :=
|
||||
File_Name_Type
|
||||
(In_Tree.String_Elements.Table (Iface).Value);
|
||||
(In_Tree.Shared.String_Elements.Table (Iface).Value);
|
||||
Process (ALI);
|
||||
Iface := In_Tree.String_Elements.Table (Iface).Next;
|
||||
Iface :=
|
||||
In_Tree.Shared.String_Elements.Table (Iface).Next;
|
||||
end loop;
|
||||
end if;
|
||||
end;
|
||||
|
|
|
@ -101,6 +101,17 @@ package body Prj.Conf is
|
|||
pragma No_Return (Raise_Invalid_Config);
|
||||
-- Raises exception Invalid_Config with given message
|
||||
|
||||
procedure Apply_Config_File
|
||||
(Config_File : Prj.Project_Id;
|
||||
Project_Tree : Prj.Project_Tree_Ref);
|
||||
-- Apply the configuration file settings to all the projects in the
|
||||
-- project tree. The Project_Tree must have been parsed first, and
|
||||
-- processed through the first phase so that all its projects are known.
|
||||
--
|
||||
-- Currently, this will add new attributes and packages in the various
|
||||
-- projects, so that when the second phase of the processing is performed
|
||||
-- these attributes are automatically taken into account.
|
||||
|
||||
--------------------
|
||||
-- Add_Attributes --
|
||||
--------------------
|
||||
|
@ -110,6 +121,7 @@ package body Prj.Conf is
|
|||
Conf_Decl : Declarations;
|
||||
User_Decl : in out Declarations)
|
||||
is
|
||||
Shared : constant Shared_Project_Tree_Data_Access := Project_Tree.Shared;
|
||||
Conf_Attr_Id : Variable_Id;
|
||||
Conf_Attr : Variable;
|
||||
Conf_Array_Id : Array_Id;
|
||||
|
@ -130,10 +142,8 @@ package body Prj.Conf is
|
|||
Conf_Attr_Id := Conf_Decl.Attributes;
|
||||
User_Attr_Id := User_Decl.Attributes;
|
||||
while Conf_Attr_Id /= No_Variable loop
|
||||
Conf_Attr :=
|
||||
Project_Tree.Variable_Elements.Table (Conf_Attr_Id);
|
||||
User_Attr :=
|
||||
Project_Tree.Variable_Elements.Table (User_Attr_Id);
|
||||
Conf_Attr := Shared.Variable_Elements.Table (Conf_Attr_Id);
|
||||
User_Attr := Shared.Variable_Elements.Table (User_Attr_Id);
|
||||
|
||||
if not Conf_Attr.Value.Default then
|
||||
if User_Attr.Value.Default then
|
||||
|
@ -142,8 +152,7 @@ package body Prj.Conf is
|
|||
-- value of the configuration attribute.
|
||||
|
||||
User_Attr.Value := Conf_Attr.Value;
|
||||
Project_Tree.Variable_Elements.Table (User_Attr_Id) :=
|
||||
User_Attr;
|
||||
Shared.Variable_Elements.Table (User_Attr_Id) := User_Attr;
|
||||
|
||||
elsif User_Attr.Value.Kind = List
|
||||
and then Conf_Attr.Value.Values /= Nil_String
|
||||
|
@ -164,22 +173,20 @@ package body Prj.Conf is
|
|||
-- Create new list
|
||||
|
||||
String_Element_Table.Increment_Last
|
||||
(Project_Tree.String_Elements);
|
||||
(Shared.String_Elements);
|
||||
New_List := String_Element_Table.Last
|
||||
(Project_Tree.String_Elements);
|
||||
(Shared.String_Elements);
|
||||
|
||||
-- Value of attribute is new list
|
||||
|
||||
User_Attr.Value.Values := New_List;
|
||||
Project_Tree.Variable_Elements.Table (User_Attr_Id) :=
|
||||
User_Attr;
|
||||
Shared.Variable_Elements.Table (User_Attr_Id) := User_Attr;
|
||||
|
||||
loop
|
||||
|
||||
-- Get each element of configuration list
|
||||
|
||||
Conf_Elem :=
|
||||
Project_Tree.String_Elements.Table (Conf_List);
|
||||
Conf_Elem := Shared.String_Elements.Table (Conf_List);
|
||||
New_Elem := Conf_Elem;
|
||||
Conf_List := Conf_Elem.Next;
|
||||
|
||||
|
@ -189,8 +196,7 @@ package body Prj.Conf is
|
|||
-- first element of user list, and we are done.
|
||||
|
||||
New_Elem.Next := User_List;
|
||||
Project_Tree.String_Elements.Table
|
||||
(New_List) := New_Elem;
|
||||
Shared.String_Elements.Table (New_List) := New_Elem;
|
||||
exit;
|
||||
|
||||
else
|
||||
|
@ -198,12 +204,10 @@ package body Prj.Conf is
|
|||
-- new list.
|
||||
|
||||
String_Element_Table.Increment_Last
|
||||
(Project_Tree.String_Elements);
|
||||
(Shared.String_Elements);
|
||||
New_Elem.Next :=
|
||||
String_Element_Table.Last
|
||||
(Project_Tree.String_Elements);
|
||||
Project_Tree.String_Elements.Table
|
||||
(New_List) := New_Elem;
|
||||
String_Element_Table.Last (Shared.String_Elements);
|
||||
Shared.String_Elements.Table (New_List) := New_Elem;
|
||||
New_List := New_Elem.Next;
|
||||
end if;
|
||||
end loop;
|
||||
|
@ -217,11 +221,11 @@ package body Prj.Conf is
|
|||
|
||||
Conf_Array_Id := Conf_Decl.Arrays;
|
||||
while Conf_Array_Id /= No_Array loop
|
||||
Conf_Array := Project_Tree.Arrays.Table (Conf_Array_Id);
|
||||
Conf_Array := Shared.Arrays.Table (Conf_Array_Id);
|
||||
|
||||
User_Array_Id := User_Decl.Arrays;
|
||||
while User_Array_Id /= No_Array loop
|
||||
User_Array := Project_Tree.Arrays.Table (User_Array_Id);
|
||||
User_Array := Shared.Arrays.Table (User_Array_Id);
|
||||
exit when User_Array.Name = Conf_Array.Name;
|
||||
User_Array_Id := User_Array.Next;
|
||||
end loop;
|
||||
|
@ -230,11 +234,11 @@ package body Prj.Conf is
|
|||
-- do a shallow copy of the full associative array.
|
||||
|
||||
if User_Array_Id = No_Array then
|
||||
Array_Table.Increment_Last (Project_Tree.Arrays);
|
||||
Array_Table.Increment_Last (Shared.Arrays);
|
||||
User_Array := Conf_Array;
|
||||
User_Array.Next := User_Decl.Arrays;
|
||||
User_Decl.Arrays := Array_Table.Last (Project_Tree.Arrays);
|
||||
Project_Tree.Arrays.Table (User_Decl.Arrays) := User_Array;
|
||||
User_Decl.Arrays := Array_Table.Last (Shared.Arrays);
|
||||
Shared.Arrays.Table (User_Decl.Arrays) := User_Array;
|
||||
|
||||
else
|
||||
-- Otherwise, check each array element
|
||||
|
@ -242,12 +246,12 @@ package body Prj.Conf is
|
|||
Conf_Array_Elem_Id := Conf_Array.Value;
|
||||
while Conf_Array_Elem_Id /= No_Array_Element loop
|
||||
Conf_Array_Elem :=
|
||||
Project_Tree.Array_Elements.Table (Conf_Array_Elem_Id);
|
||||
Shared.Array_Elements.Table (Conf_Array_Elem_Id);
|
||||
|
||||
User_Array_Elem_Id := User_Array.Value;
|
||||
while User_Array_Elem_Id /= No_Array_Element loop
|
||||
User_Array_Elem :=
|
||||
Project_Tree.Array_Elements.Table (User_Array_Elem_Id);
|
||||
Shared.Array_Elements.Table (User_Array_Elem_Id);
|
||||
exit when User_Array_Elem.Index = Conf_Array_Elem.Index;
|
||||
User_Array_Elem_Id := User_Array_Elem.Next;
|
||||
end loop;
|
||||
|
@ -257,15 +261,14 @@ package body Prj.Conf is
|
|||
-- user array.
|
||||
|
||||
if User_Array_Elem_Id = No_Array_Element then
|
||||
Array_Element_Table.Increment_Last
|
||||
(Project_Tree.Array_Elements);
|
||||
Array_Element_Table.Increment_Last (Shared.Array_Elements);
|
||||
User_Array_Elem := Conf_Array_Elem;
|
||||
User_Array_Elem.Next := User_Array.Value;
|
||||
User_Array.Value :=
|
||||
Array_Element_Table.Last (Project_Tree.Array_Elements);
|
||||
Project_Tree.Array_Elements.Table (User_Array.Value) :=
|
||||
Array_Element_Table.Last (Shared.Array_Elements);
|
||||
Shared.Array_Elements.Table (User_Array.Value) :=
|
||||
User_Array_Elem;
|
||||
Project_Tree.Arrays.Table (User_Array_Id) := User_Array;
|
||||
Shared.Arrays.Table (User_Array_Id) := User_Array;
|
||||
|
||||
-- Otherwise, if the value is a string list, prepend the
|
||||
-- user array element with the conf array element value.
|
||||
|
@ -283,23 +286,22 @@ package body Prj.Conf is
|
|||
begin
|
||||
loop
|
||||
Conf_List_Elem :=
|
||||
Project_Tree.String_Elements.Table
|
||||
(Conf_List);
|
||||
Shared.String_Elements.Table (Conf_List);
|
||||
String_Element_Table.Increment_Last
|
||||
(Project_Tree.String_Elements);
|
||||
(Shared.String_Elements);
|
||||
Next :=
|
||||
String_Element_Table.Last
|
||||
(Project_Tree.String_Elements);
|
||||
Project_Tree.String_Elements.Table (Next) :=
|
||||
(Shared.String_Elements);
|
||||
Shared.String_Elements.Table (Next) :=
|
||||
Conf_List_Elem;
|
||||
|
||||
if Previous = Nil_String then
|
||||
User_Array_Elem.Value.Values := Next;
|
||||
Project_Tree.Array_Elements.Table
|
||||
Shared.Array_Elements.Table
|
||||
(User_Array_Elem_Id) := User_Array_Elem;
|
||||
|
||||
else
|
||||
Project_Tree.String_Elements.Table
|
||||
Shared.String_Elements.Table
|
||||
(Previous).Next := Next;
|
||||
end if;
|
||||
|
||||
|
@ -308,8 +310,8 @@ package body Prj.Conf is
|
|||
Conf_List := Conf_List_Elem.Next;
|
||||
|
||||
if Conf_List = Nil_String then
|
||||
Project_Tree.String_Elements.Table
|
||||
(Previous).Next := Link;
|
||||
Shared.String_Elements.Table (Previous).Next :=
|
||||
Link;
|
||||
exit;
|
||||
end if;
|
||||
end loop;
|
||||
|
@ -454,9 +456,10 @@ package body Prj.Conf is
|
|||
-----------------------
|
||||
|
||||
procedure Apply_Config_File
|
||||
(Config_File : Prj.Project_Id;
|
||||
Project_Tree : Prj.Project_Tree_Ref)
|
||||
(Config_File : Prj.Project_Id;
|
||||
Project_Tree : Prj.Project_Tree_Ref)
|
||||
is
|
||||
Shared : constant Shared_Project_Tree_Data_Access := Project_Tree.Shared;
|
||||
Conf_Decl : constant Declarations := Config_File.Decl;
|
||||
Conf_Pack_Id : Package_Id;
|
||||
Conf_Pack : Package_Element;
|
||||
|
@ -467,47 +470,67 @@ package body Prj.Conf is
|
|||
Proj : Project_List;
|
||||
|
||||
begin
|
||||
Debug_Output ("Applying config file to a project tree");
|
||||
|
||||
Proj := Project_Tree.Projects;
|
||||
while Proj /= null loop
|
||||
if Proj.Project /= Config_File then
|
||||
User_Decl := Proj.Project.Decl;
|
||||
Add_Attributes
|
||||
(Project_Tree => Project_Tree,
|
||||
Conf_Decl => Conf_Decl,
|
||||
User_Decl => User_Decl);
|
||||
(Project_Tree => Project_Tree,
|
||||
Conf_Decl => Conf_Decl,
|
||||
User_Decl => User_Decl);
|
||||
|
||||
Conf_Pack_Id := Conf_Decl.Packages;
|
||||
while Conf_Pack_Id /= No_Package loop
|
||||
Conf_Pack := Project_Tree.Packages.Table (Conf_Pack_Id);
|
||||
Conf_Pack := Shared.Packages.Table (Conf_Pack_Id);
|
||||
|
||||
User_Pack_Id := User_Decl.Packages;
|
||||
while User_Pack_Id /= No_Package loop
|
||||
User_Pack := Project_Tree.Packages.Table (User_Pack_Id);
|
||||
User_Pack := Shared.Packages.Table (User_Pack_Id);
|
||||
exit when User_Pack.Name = Conf_Pack.Name;
|
||||
User_Pack_Id := User_Pack.Next;
|
||||
end loop;
|
||||
|
||||
if User_Pack_Id = No_Package then
|
||||
Package_Table.Increment_Last (Project_Tree.Packages);
|
||||
Package_Table.Increment_Last (Shared.Packages);
|
||||
User_Pack := Conf_Pack;
|
||||
User_Pack.Next := User_Decl.Packages;
|
||||
User_Decl.Packages :=
|
||||
Package_Table.Last (Project_Tree.Packages);
|
||||
Project_Tree.Packages.Table (User_Decl.Packages) :=
|
||||
User_Pack;
|
||||
User_Decl.Packages := Package_Table.Last (Shared.Packages);
|
||||
Shared.Packages.Table (User_Decl.Packages) := User_Pack;
|
||||
|
||||
else
|
||||
Add_Attributes
|
||||
(Project_Tree => Project_Tree,
|
||||
Conf_Decl => Conf_Pack.Decl,
|
||||
User_Decl => Project_Tree.Packages.Table
|
||||
(User_Pack_Id).Decl);
|
||||
(Project_Tree => Project_Tree,
|
||||
Conf_Decl => Conf_Pack.Decl,
|
||||
User_Decl =>
|
||||
Shared.Packages.Table (User_Pack_Id).Decl);
|
||||
end if;
|
||||
|
||||
Conf_Pack_Id := Conf_Pack.Next;
|
||||
end loop;
|
||||
|
||||
Proj.Project.Decl := User_Decl;
|
||||
|
||||
-- For aggregate projects, we need to apply the config to all
|
||||
-- their aggregated trees as well.
|
||||
|
||||
if Proj.Project.Qualifier = Aggregate then
|
||||
declare
|
||||
List : Aggregated_Project_List :=
|
||||
Proj.Project.Aggregated_Projects;
|
||||
begin
|
||||
while List /= null loop
|
||||
Debug_Output
|
||||
("Recursively apply config to aggregated tree",
|
||||
List.Project.Name);
|
||||
Apply_Config_File
|
||||
(Config_File,
|
||||
Project_Tree => List.Tree);
|
||||
List := List.Next;
|
||||
end loop;
|
||||
end;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
Proj := Proj.Next;
|
||||
|
@ -524,9 +547,10 @@ package body Prj.Conf is
|
|||
Project_Tree : Prj.Project_Tree_Ref;
|
||||
Target : String := "") return Boolean
|
||||
is
|
||||
Shared : constant Shared_Project_Tree_Data_Access := Project_Tree.Shared;
|
||||
Variable : constant Variable_Value :=
|
||||
Value_Of
|
||||
(Name_Target, Config_File.Decl.Attributes, Project_Tree);
|
||||
(Name_Target, Config_File.Decl.Attributes, Shared);
|
||||
Tgt_Name : Name_Id := No_Name;
|
||||
OK : Boolean;
|
||||
|
||||
|
@ -585,6 +609,7 @@ package body Prj.Conf is
|
|||
Automatically_Generated : out Boolean;
|
||||
On_Load_Config : Config_File_Hook := null)
|
||||
is
|
||||
Shared : constant Shared_Project_Tree_Data_Access := Project_Tree.Shared;
|
||||
|
||||
At_Least_One_Compiler_Command : Boolean := False;
|
||||
-- Set to True if at least one attribute Ide'Compiler_Command is
|
||||
|
@ -655,7 +680,7 @@ package body Prj.Conf is
|
|||
Value_Of
|
||||
(Name_Source_Dirs,
|
||||
Project.Decl.Attributes,
|
||||
Project_Tree);
|
||||
Shared);
|
||||
|
||||
if Variable = Nil_Variable_Value
|
||||
or else Variable.Default
|
||||
|
@ -665,7 +690,7 @@ package body Prj.Conf is
|
|||
Value_Of
|
||||
(Name_Source_Files,
|
||||
Project.Decl.Attributes,
|
||||
Project_Tree);
|
||||
Shared);
|
||||
return Variable = Nil_Variable_Value
|
||||
or else Variable.Default
|
||||
or else Variable.Values /= Nil_String;
|
||||
|
@ -690,10 +715,7 @@ package body Prj.Conf is
|
|||
-- Hash table to keep the languages used in the project tree
|
||||
|
||||
IDE : constant Package_Id :=
|
||||
Value_Of
|
||||
(Name_Ide,
|
||||
Project.Decl.Packages,
|
||||
Project_Tree);
|
||||
Value_Of (Name_Ide, Project.Decl.Packages, Shared);
|
||||
|
||||
Prj_Iter : Project_List;
|
||||
List : String_List_Id;
|
||||
|
@ -714,7 +736,7 @@ package body Prj.Conf is
|
|||
Value_Of
|
||||
(Name_Languages,
|
||||
Prj_Iter.Project.Decl.Attributes,
|
||||
Project_Tree);
|
||||
Shared);
|
||||
|
||||
if Variable = Nil_Variable_Value
|
||||
or else Variable.Default
|
||||
|
@ -730,7 +752,7 @@ package body Prj.Conf is
|
|||
Value_Of
|
||||
(Name_Languages,
|
||||
Prj_Iter.Project.Extends.Decl.Attributes,
|
||||
Project_Tree);
|
||||
Shared);
|
||||
Check_Default :=
|
||||
Variable /= Nil_Variable_Value
|
||||
and then Variable.Values = Nil_String;
|
||||
|
@ -741,7 +763,7 @@ package body Prj.Conf is
|
|||
Value_Of
|
||||
(Name_Default_Language,
|
||||
Prj_Iter.Project.Decl.Attributes,
|
||||
Project_Tree);
|
||||
Shared);
|
||||
|
||||
if Variable /= Nil_Variable_Value
|
||||
and then not Variable.Default
|
||||
|
@ -765,7 +787,7 @@ package body Prj.Conf is
|
|||
|
||||
List := Variable.Values;
|
||||
while List /= Nil_String loop
|
||||
Elem := Project_Tree.String_Elements.Table (List);
|
||||
Elem := Shared.String_Elements.Table (List);
|
||||
|
||||
Get_Name_String (Elem.Value);
|
||||
To_Lower (Name_Buffer (1 .. Name_Len));
|
||||
|
@ -800,7 +822,7 @@ package body Prj.Conf is
|
|||
(Name,
|
||||
Attribute_Or_Array_Name => Name_Compiler_Command,
|
||||
In_Package => IDE,
|
||||
In_Tree => Project_Tree,
|
||||
Shared => Shared,
|
||||
Force_Lower_Case_Index => True);
|
||||
|
||||
declare
|
||||
|
@ -857,7 +879,7 @@ package body Prj.Conf is
|
|||
Value_Of
|
||||
(Name_Object_Dir,
|
||||
Project.Decl.Attributes,
|
||||
Project_Tree);
|
||||
Shared);
|
||||
|
||||
Gprconfig_Path : String_Access;
|
||||
Success : Boolean;
|
||||
|
@ -1261,6 +1283,7 @@ package body Prj.Conf is
|
|||
On_Load_Config : Config_File_Hook := null;
|
||||
Reset_Tree : Boolean := True)
|
||||
is
|
||||
Shared : constant Shared_Project_Tree_Data_Access := Project_Tree.Shared;
|
||||
Main_Config_Project : Project_Id;
|
||||
Success : Boolean;
|
||||
|
||||
|
@ -1289,7 +1312,7 @@ package body Prj.Conf is
|
|||
Value_Of
|
||||
(Name_Object_Dir,
|
||||
Main_Project.Decl.Attributes,
|
||||
Project_Tree);
|
||||
Shared);
|
||||
|
||||
begin
|
||||
if Obj_Dir = Nil_Variable_Value or else Obj_Dir.Default then
|
||||
|
|
|
@ -162,17 +162,6 @@ package Prj.Conf is
|
|||
-- processed (and Packages_To_Check is used to indicate which packages
|
||||
-- should be processed)
|
||||
|
||||
procedure Apply_Config_File
|
||||
(Config_File : Prj.Project_Id;
|
||||
Project_Tree : Prj.Project_Tree_Ref);
|
||||
-- Apply the configuration file settings to all the projects in the
|
||||
-- project tree. The Project_Tree must have been parsed first, and
|
||||
-- processed through the first phase so that all its projects are known.
|
||||
--
|
||||
-- Currently, this will add new attributes and packages in the various
|
||||
-- projects, so that when the second phase of the processing is performed
|
||||
-- these attributes are automatically taken into account.
|
||||
|
||||
procedure Add_Default_GNAT_Naming_Scheme
|
||||
(Config_File : in out Prj.Tree.Project_Node_Id;
|
||||
Project_Tree : Prj.Tree.Project_Node_Tree_Ref);
|
||||
|
|
|
@ -76,7 +76,7 @@ package body Prj.Env is
|
|||
|
||||
procedure Add_To_Path
|
||||
(Source_Dirs : String_List_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
Shared : Shared_Project_Tree_Data_Access;
|
||||
Buffer : in out String_Access;
|
||||
Buffer_Last : in out Natural);
|
||||
-- Add to Ada_Path_Buffer all the source directories in string list
|
||||
|
@ -91,7 +91,7 @@ package body Prj.Env is
|
|||
|
||||
procedure Add_To_Source_Path
|
||||
(Source_Dirs : String_List_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
Shared : Shared_Project_Tree_Data_Access;
|
||||
Source_Paths : in out Source_Path_Table.Instance);
|
||||
-- Add to Ada_Path_B all the source directories in string list
|
||||
-- Source_Dirs, if any. Increment Ada_Path_Length.
|
||||
|
@ -122,17 +122,25 @@ package body Prj.Env is
|
|||
Buffer : String_Access;
|
||||
Buffer_Last : Natural := 0;
|
||||
|
||||
procedure Add (Project : Project_Id; Dummy : in out Boolean);
|
||||
procedure Add
|
||||
(Project : Project_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
Dummy : in out Boolean);
|
||||
-- Add source dirs of Project to the path
|
||||
|
||||
---------
|
||||
-- Add --
|
||||
---------
|
||||
|
||||
procedure Add (Project : Project_Id; Dummy : in out Boolean) is
|
||||
procedure Add
|
||||
(Project : Project_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
Dummy : in out Boolean)
|
||||
is
|
||||
pragma Unreferenced (Dummy);
|
||||
begin
|
||||
Add_To_Path (Project.Source_Dirs, In_Tree, Buffer, Buffer_Last);
|
||||
Add_To_Path
|
||||
(Project.Source_Dirs, In_Tree.Shared, Buffer, Buffer_Last);
|
||||
end Add;
|
||||
|
||||
procedure For_All_Projects is
|
||||
|
@ -150,7 +158,8 @@ package body Prj.Env is
|
|||
|
||||
if Project.Ada_Include_Path = null then
|
||||
Buffer := new String (1 .. 4096);
|
||||
For_All_Projects (Project, Dummy);
|
||||
For_All_Projects
|
||||
(Project, In_Tree, Dummy, Include_Aggregated => True);
|
||||
Project.Ada_Include_Path := new String'(Buffer (1 .. Buffer_Last));
|
||||
Free (Buffer);
|
||||
end if;
|
||||
|
@ -159,7 +168,8 @@ package body Prj.Env is
|
|||
|
||||
else
|
||||
Buffer := new String (1 .. 4096);
|
||||
Add_To_Path (Project.Source_Dirs, In_Tree, Buffer, Buffer_Last);
|
||||
Add_To_Path
|
||||
(Project.Source_Dirs, In_Tree.Shared, Buffer, Buffer_Last);
|
||||
|
||||
declare
|
||||
Result : constant String := Buffer (1 .. Buffer_Last);
|
||||
|
@ -176,20 +186,28 @@ package body Prj.Env is
|
|||
|
||||
function Ada_Objects_Path
|
||||
(Project : Project_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
Including_Libraries : Boolean := True) return String_Access
|
||||
is
|
||||
Buffer : String_Access;
|
||||
Buffer_Last : Natural := 0;
|
||||
|
||||
procedure Add (Project : Project_Id; Dummy : in out Boolean);
|
||||
procedure Add
|
||||
(Project : Project_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
Dummy : in out Boolean);
|
||||
-- Add all the object directories of a project to the path
|
||||
|
||||
---------
|
||||
-- Add --
|
||||
---------
|
||||
|
||||
procedure Add (Project : Project_Id; Dummy : in out Boolean) is
|
||||
pragma Unreferenced (Dummy);
|
||||
procedure Add
|
||||
(Project : Project_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
Dummy : in out Boolean)
|
||||
is
|
||||
pragma Unreferenced (Dummy, In_Tree);
|
||||
Path : constant Path_Name_Type :=
|
||||
Get_Object_Directory
|
||||
(Project,
|
||||
|
@ -214,7 +232,7 @@ package body Prj.Env is
|
|||
|
||||
if Project.Ada_Objects_Path = null then
|
||||
Buffer := new String (1 .. 4096);
|
||||
For_All_Projects (Project, Dummy);
|
||||
For_All_Projects (Project, In_Tree, Dummy);
|
||||
|
||||
Project.Ada_Objects_Path := new String'(Buffer (1 .. Buffer_Last));
|
||||
Free (Buffer);
|
||||
|
@ -291,7 +309,7 @@ package body Prj.Env is
|
|||
|
||||
procedure Add_To_Path
|
||||
(Source_Dirs : String_List_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
Shared : Shared_Project_Tree_Data_Access;
|
||||
Buffer : in out String_Access;
|
||||
Buffer_Last : in out Natural)
|
||||
is
|
||||
|
@ -299,7 +317,7 @@ package body Prj.Env is
|
|||
Source_Dir : String_Element;
|
||||
begin
|
||||
while Current /= Nil_String loop
|
||||
Source_Dir := In_Tree.String_Elements.Table (Current);
|
||||
Source_Dir := Shared.String_Elements.Table (Current);
|
||||
Add_To_Path (Get_Name_String (Source_Dir.Display_Value),
|
||||
Buffer, Buffer_Last);
|
||||
Current := Source_Dir.Next;
|
||||
|
@ -395,7 +413,7 @@ package body Prj.Env is
|
|||
|
||||
procedure Add_To_Source_Path
|
||||
(Source_Dirs : String_List_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
Shared : Shared_Project_Tree_Data_Access;
|
||||
Source_Paths : in out Source_Path_Table.Instance)
|
||||
is
|
||||
Current : String_List_Id := Source_Dirs;
|
||||
|
@ -406,7 +424,7 @@ package body Prj.Env is
|
|||
-- Add each source directory
|
||||
|
||||
while Current /= Nil_String loop
|
||||
Source_Dir := In_Tree.String_Elements.Table (Current);
|
||||
Source_Dir := Shared.String_Elements.Table (Current);
|
||||
Add_It := True;
|
||||
|
||||
-- Check if the source directory is already in the table
|
||||
|
@ -461,7 +479,10 @@ package body Prj.Env is
|
|||
Iter : Source_Iterator;
|
||||
Source : Source_Id;
|
||||
|
||||
procedure Check (Project : Project_Id; State : in out Integer);
|
||||
procedure Check
|
||||
(Project : Project_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
State : in out Integer);
|
||||
-- Recursive procedure that put in the config pragmas file any non
|
||||
-- standard naming schemes, if it is not already in the file, then call
|
||||
-- itself for any imported project.
|
||||
|
@ -482,23 +503,24 @@ package body Prj.Env is
|
|||
-- Check --
|
||||
-----------
|
||||
|
||||
procedure Check (Project : Project_Id; State : in out Integer) is
|
||||
pragma Unreferenced (State);
|
||||
procedure Check
|
||||
(Project : Project_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
State : in out Integer)
|
||||
is
|
||||
pragma Unreferenced (State, In_Tree);
|
||||
Lang : constant Language_Ptr :=
|
||||
Get_Language_From_Name (Project, "ada");
|
||||
Naming : Lang_Naming_Data;
|
||||
|
||||
begin
|
||||
if Current_Verbosity = High then
|
||||
Write_Str ("Checking project file """);
|
||||
Write_Str (Namet.Get_Name_String (Project.Name));
|
||||
Write_Str (""".");
|
||||
Write_Eol;
|
||||
Debug_Output ("Checking project file:", Project.Name);
|
||||
end if;
|
||||
|
||||
if Lang = null then
|
||||
if Current_Verbosity = High then
|
||||
Write_Line (" Languages does not contain Ada, nothing to do");
|
||||
Debug_Output ("Languages does not contain Ada, nothing to do");
|
||||
end if;
|
||||
|
||||
return;
|
||||
|
@ -665,7 +687,8 @@ package body Prj.Env is
|
|||
|
||||
-- Check the naming schemes
|
||||
|
||||
Check_Imported_Projects (For_Project, Dummy, Imported_First => False);
|
||||
Check_Imported_Projects
|
||||
(For_Project, In_Tree, Dummy, Imported_First => False);
|
||||
|
||||
-- Visit all the files and process those that need an SFN pragma
|
||||
|
||||
|
@ -767,7 +790,10 @@ package body Prj.Env is
|
|||
procedure Put_Name_Buffer;
|
||||
-- Put the line contained in the Name_Buffer in the global buffer
|
||||
|
||||
procedure Process (Project : Project_Id; State : in out Integer);
|
||||
procedure Process
|
||||
(Project : Project_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
State : in out Integer);
|
||||
-- Generate the mapping file for Project (not recursively)
|
||||
|
||||
---------------------
|
||||
|
@ -789,7 +815,11 @@ package body Prj.Env is
|
|||
-- Process --
|
||||
-------------
|
||||
|
||||
procedure Process (Project : Project_Id; State : in out Integer) is
|
||||
procedure Process
|
||||
(Project : Project_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
State : in out Integer)
|
||||
is
|
||||
pragma Unreferenced (State);
|
||||
Source : Source_Id;
|
||||
Suffix : File_Name_Type;
|
||||
|
@ -874,7 +904,7 @@ package body Prj.Env is
|
|||
Debug_Increase_Indent ("Create mapping file ", Name_Id (Name));
|
||||
end if;
|
||||
|
||||
For_Every_Imported_Project (Project, Dummy);
|
||||
For_Every_Imported_Project (Project, In_Tree, Dummy);
|
||||
|
||||
declare
|
||||
Last : Natural;
|
||||
|
@ -1174,16 +1204,26 @@ package body Prj.Env is
|
|||
-- For_All_Object_Dirs --
|
||||
-------------------------
|
||||
|
||||
procedure For_All_Object_Dirs (Project : Project_Id) is
|
||||
procedure For_Project (Prj : Project_Id; Dummy : in out Integer);
|
||||
procedure For_All_Object_Dirs
|
||||
(Project : Project_Id;
|
||||
Tree : Project_Tree_Ref)
|
||||
is
|
||||
procedure For_Project
|
||||
(Prj : Project_Id;
|
||||
Tree : Project_Tree_Ref;
|
||||
Dummy : in out Integer);
|
||||
-- Get all object directories of Prj
|
||||
|
||||
-----------------
|
||||
-- For_Project --
|
||||
-----------------
|
||||
|
||||
procedure For_Project (Prj : Project_Id; Dummy : in out Integer) is
|
||||
pragma Unreferenced (Dummy);
|
||||
procedure For_Project
|
||||
(Prj : Project_Id;
|
||||
Tree : Project_Tree_Ref;
|
||||
Dummy : in out Integer)
|
||||
is
|
||||
pragma Unreferenced (Dummy, Tree);
|
||||
begin
|
||||
-- ??? Set_Ada_Paths has a different behavior for library project
|
||||
-- files, should we have the same ?
|
||||
|
@ -1201,7 +1241,7 @@ package body Prj.Env is
|
|||
-- Start of processing for For_All_Object_Dirs
|
||||
|
||||
begin
|
||||
Get_Object_Dirs (Project, Dummy);
|
||||
Get_Object_Dirs (Project, Tree, Dummy);
|
||||
end For_All_Object_Dirs;
|
||||
|
||||
-------------------------
|
||||
|
@ -1212,14 +1252,21 @@ package body Prj.Env is
|
|||
(Project : Project_Id;
|
||||
In_Tree : Project_Tree_Ref)
|
||||
is
|
||||
procedure For_Project (Prj : Project_Id; Dummy : in out Integer);
|
||||
procedure For_Project
|
||||
(Prj : Project_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
Dummy : in out Integer);
|
||||
-- Get all object directories of Prj
|
||||
|
||||
-----------------
|
||||
-- For_Project --
|
||||
-----------------
|
||||
|
||||
procedure For_Project (Prj : Project_Id; Dummy : in out Integer) is
|
||||
procedure For_Project
|
||||
(Prj : Project_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
Dummy : in out Integer)
|
||||
is
|
||||
pragma Unreferenced (Dummy);
|
||||
Current : String_List_Id := Prj.Source_Dirs;
|
||||
The_String : String_Element;
|
||||
|
@ -1230,7 +1277,7 @@ package body Prj.Env is
|
|||
|
||||
if Has_Ada_Sources (Project) then
|
||||
while Current /= Nil_String loop
|
||||
The_String := In_Tree.String_Elements.Table (Current);
|
||||
The_String := In_Tree.Shared.String_Elements.Table (Current);
|
||||
Action (Get_Name_String (The_String.Display_Value));
|
||||
Current := The_String.Next;
|
||||
end loop;
|
||||
|
@ -1244,7 +1291,7 @@ package body Prj.Env is
|
|||
-- Start of processing for For_All_Source_Dirs
|
||||
|
||||
begin
|
||||
Get_Source_Dirs (Project, Dummy);
|
||||
Get_Source_Dirs (Project, In_Tree, Dummy);
|
||||
end For_All_Source_Dirs;
|
||||
|
||||
-------------------
|
||||
|
@ -1541,7 +1588,10 @@ package body Prj.Env is
|
|||
Buffer : String_Access := new String (1 .. Buffer_Initial);
|
||||
Buffer_Last : Natural := 0;
|
||||
|
||||
procedure Recursive_Add (Project : Project_Id; Dummy : in out Boolean);
|
||||
procedure Recursive_Add
|
||||
(Project : Project_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
Dummy : in out Boolean);
|
||||
-- Recursive procedure to add the source/object paths of extended/
|
||||
-- imported projects.
|
||||
|
||||
|
@ -1549,7 +1599,11 @@ package body Prj.Env is
|
|||
-- Recursive_Add --
|
||||
-------------------
|
||||
|
||||
procedure Recursive_Add (Project : Project_Id; Dummy : in out Boolean) is
|
||||
procedure Recursive_Add
|
||||
(Project : Project_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
Dummy : in out Boolean)
|
||||
is
|
||||
pragma Unreferenced (Dummy);
|
||||
|
||||
Path : Path_Name_Type;
|
||||
|
@ -1563,7 +1617,8 @@ package body Prj.Env is
|
|||
-- Ada sources.
|
||||
|
||||
if Has_Ada_Sources (Project) then
|
||||
Add_To_Source_Path (Project.Source_Dirs, In_Tree, Source_Paths);
|
||||
Add_To_Source_Path
|
||||
(Project.Source_Dirs, In_Tree.Shared, Source_Paths);
|
||||
end if;
|
||||
end if;
|
||||
|
||||
|
@ -1621,7 +1676,7 @@ package body Prj.Env is
|
|||
-- then call the recursive procedure Add for Project.
|
||||
|
||||
if Process_Source_Dirs or Process_Object_Dirs then
|
||||
For_All_Projects (Project, Dummy);
|
||||
For_All_Projects (Project, In_Tree, Dummy);
|
||||
end if;
|
||||
|
||||
-- Write and close any file that has been created. Source_FD is not set
|
||||
|
|
|
@ -88,6 +88,7 @@ package Prj.Env is
|
|||
|
||||
function Ada_Objects_Path
|
||||
(Project : Project_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
Including_Libraries : Boolean := True) return String_Access;
|
||||
-- Get the ADA_OBJECTS_PATH of a Project file. For the first call, compute
|
||||
-- it and cache it. When Including_Libraries is False, do not include the
|
||||
|
@ -149,7 +150,9 @@ package Prj.Env is
|
|||
|
||||
generic
|
||||
with procedure Action (Path : String);
|
||||
procedure For_All_Object_Dirs (Project : Project_Id);
|
||||
procedure For_All_Object_Dirs
|
||||
(Project : Project_Id;
|
||||
Tree : Project_Tree_Ref);
|
||||
-- Iterate through all the object directories of a project, including those
|
||||
-- of imported or modified projects.
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -72,7 +72,7 @@ package Prj.Proc is
|
|||
From_Project_Node : Project_Node_Id;
|
||||
From_Project_Node_Tree : Project_Node_Tree_Ref;
|
||||
Env : in out Prj.Tree.Environment;
|
||||
Reset_Tree : Boolean := True);
|
||||
Reset_Tree : Boolean := True);
|
||||
-- Performs the two phases of the processing
|
||||
|
||||
end Prj.Proc;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
-- --
|
||||
-- B o d y --
|
||||
-- --
|
||||
-- Copyright (C) 2001-2010, Free Software Foundation, Inc. --
|
||||
-- Copyright (C) 2001-2011, 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- --
|
||||
|
@ -129,7 +129,7 @@ package body Prj.Util is
|
|||
|
||||
procedure Duplicate
|
||||
(This : in out Name_List_Index;
|
||||
In_Tree : Project_Tree_Ref)
|
||||
Shared : Shared_Project_Tree_Data_Access)
|
||||
is
|
||||
Old_Current : Name_List_Index;
|
||||
New_Current : Name_List_Index;
|
||||
|
@ -137,20 +137,20 @@ package body Prj.Util is
|
|||
begin
|
||||
if This /= No_Name_List then
|
||||
Old_Current := This;
|
||||
Name_List_Table.Increment_Last (In_Tree.Name_Lists);
|
||||
New_Current := Name_List_Table.Last (In_Tree.Name_Lists);
|
||||
Name_List_Table.Increment_Last (Shared.Name_Lists);
|
||||
New_Current := Name_List_Table.Last (Shared.Name_Lists);
|
||||
This := New_Current;
|
||||
In_Tree.Name_Lists.Table (New_Current) :=
|
||||
(In_Tree.Name_Lists.Table (Old_Current).Name, No_Name_List);
|
||||
Shared.Name_Lists.Table (New_Current) :=
|
||||
(Shared.Name_Lists.Table (Old_Current).Name, No_Name_List);
|
||||
|
||||
loop
|
||||
Old_Current := In_Tree.Name_Lists.Table (Old_Current).Next;
|
||||
Old_Current := Shared.Name_Lists.Table (Old_Current).Next;
|
||||
exit when Old_Current = No_Name_List;
|
||||
In_Tree.Name_Lists.Table (New_Current).Next := New_Current + 1;
|
||||
Name_List_Table.Increment_Last (In_Tree.Name_Lists);
|
||||
Shared.Name_Lists.Table (New_Current).Next := New_Current + 1;
|
||||
Name_List_Table.Increment_Last (Shared.Name_Lists);
|
||||
New_Current := New_Current + 1;
|
||||
In_Tree.Name_Lists.Table (New_Current) :=
|
||||
(In_Tree.Name_Lists.Table (Old_Current).Name, No_Name_List);
|
||||
Shared.Name_Lists.Table (New_Current) :=
|
||||
(Shared.Name_Lists.Table (Old_Current).Name, No_Name_List);
|
||||
end loop;
|
||||
end if;
|
||||
end Duplicate;
|
||||
|
@ -174,7 +174,7 @@ package body Prj.Util is
|
|||
|
||||
function Executable_Of
|
||||
(Project : Project_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
Shared : Shared_Project_Tree_Data_Access;
|
||||
Main : File_Name_Type;
|
||||
Index : Int;
|
||||
Ada_Main : Boolean := True;
|
||||
|
@ -189,7 +189,7 @@ package body Prj.Util is
|
|||
Prj.Util.Value_Of
|
||||
(Name => Name_Builder,
|
||||
In_Packages => The_Packages,
|
||||
In_Tree => In_Tree);
|
||||
Shared => Shared);
|
||||
|
||||
Executable : Variable_Value :=
|
||||
Prj.Util.Value_Of
|
||||
|
@ -197,7 +197,7 @@ package body Prj.Util is
|
|||
Index => Index,
|
||||
Attribute_Or_Array_Name => Name_Executable,
|
||||
In_Package => Builder_Package,
|
||||
In_Tree => In_Tree);
|
||||
Shared => Shared);
|
||||
|
||||
Lang : Language_Ptr;
|
||||
|
||||
|
@ -266,8 +266,8 @@ package body Prj.Util is
|
|||
Prj.Util.Value_Of
|
||||
(Variable_Name => Name_Executable_Suffix,
|
||||
In_Variables =>
|
||||
In_Tree.Packages.Table (Builder_Package).Decl.Attributes,
|
||||
In_Tree => In_Tree);
|
||||
Shared.Packages.Table (Builder_Package).Decl.Attributes,
|
||||
Shared => Shared);
|
||||
|
||||
if Suffix_From_Project /= Nil_Variable_Value
|
||||
and then Suffix_From_Project.Value /= No_Name
|
||||
|
@ -340,7 +340,7 @@ package body Prj.Util is
|
|||
Index => 0,
|
||||
Attribute_Or_Array_Name => Name_Executable,
|
||||
In_Package => Builder_Package,
|
||||
In_Tree => In_Tree);
|
||||
Shared => Shared);
|
||||
end if;
|
||||
end;
|
||||
end if;
|
||||
|
@ -554,24 +554,26 @@ package body Prj.Util is
|
|||
In_Tree : Project_Tree_Ref;
|
||||
Lower_Case : Boolean := False)
|
||||
is
|
||||
Shared : constant Shared_Project_Tree_Data_Access := In_Tree.Shared;
|
||||
|
||||
Current_Name : Name_List_Index;
|
||||
List : String_List_Id;
|
||||
Element : String_Element;
|
||||
Last : Name_List_Index :=
|
||||
Name_List_Table.Last (In_Tree.Name_Lists);
|
||||
Name_List_Table.Last (Shared.Name_Lists);
|
||||
Value : Name_Id;
|
||||
|
||||
begin
|
||||
Current_Name := Into_List;
|
||||
while Current_Name /= No_Name_List
|
||||
and then In_Tree.Name_Lists.Table (Current_Name).Next /= No_Name_List
|
||||
and then Shared.Name_Lists.Table (Current_Name).Next /= No_Name_List
|
||||
loop
|
||||
Current_Name := In_Tree.Name_Lists.Table (Current_Name).Next;
|
||||
Current_Name := Shared.Name_Lists.Table (Current_Name).Next;
|
||||
end loop;
|
||||
|
||||
List := From_List;
|
||||
while List /= Nil_String loop
|
||||
Element := In_Tree.String_Elements.Table (List);
|
||||
Element := Shared.String_Elements.Table (List);
|
||||
Value := Element.Value;
|
||||
|
||||
if Lower_Case then
|
||||
|
@ -581,15 +583,14 @@ package body Prj.Util is
|
|||
end if;
|
||||
|
||||
Name_List_Table.Append
|
||||
(In_Tree.Name_Lists, (Name => Value, Next => No_Name_List));
|
||||
(Shared.Name_Lists, (Name => Value, Next => No_Name_List));
|
||||
|
||||
Last := Last + 1;
|
||||
|
||||
if Current_Name = No_Name_List then
|
||||
Into_List := Last;
|
||||
|
||||
else
|
||||
In_Tree.Name_Lists.Table (Current_Name).Next := Last;
|
||||
Shared.Name_Lists.Table (Current_Name).Next := Last;
|
||||
end if;
|
||||
|
||||
Current_Name := Last;
|
||||
|
@ -808,8 +809,9 @@ package body Prj.Util is
|
|||
function Value_Of
|
||||
(Index : Name_Id;
|
||||
In_Array : Array_Element_Id;
|
||||
In_Tree : Project_Tree_Ref) return Name_Id
|
||||
Shared : Shared_Project_Tree_Data_Access) return Name_Id
|
||||
is
|
||||
|
||||
Current : Array_Element_Id;
|
||||
Element : Array_Element;
|
||||
Real_Index : Name_Id := Index;
|
||||
|
@ -821,7 +823,7 @@ package body Prj.Util is
|
|||
return No_Name;
|
||||
end if;
|
||||
|
||||
Element := In_Tree.Array_Elements.Table (Current);
|
||||
Element := Shared.Array_Elements.Table (Current);
|
||||
|
||||
if not Element.Index_Case_Sensitive then
|
||||
Get_Name_String (Index);
|
||||
|
@ -830,7 +832,7 @@ package body Prj.Util is
|
|||
end if;
|
||||
|
||||
while Current /= No_Array_Element loop
|
||||
Element := In_Tree.Array_Elements.Table (Current);
|
||||
Element := Shared.Array_Elements.Table (Current);
|
||||
|
||||
if Real_Index = Element.Index then
|
||||
exit when Element.Value.Kind /= Single;
|
||||
|
@ -848,7 +850,7 @@ package body Prj.Util is
|
|||
(Index : Name_Id;
|
||||
Src_Index : Int := 0;
|
||||
In_Array : Array_Element_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
Shared : Shared_Project_Tree_Data_Access;
|
||||
Force_Lower_Case_Index : Boolean := False;
|
||||
Allow_Wildcards : Boolean := False) return Variable_Value
|
||||
is
|
||||
|
@ -864,7 +866,7 @@ package body Prj.Util is
|
|||
return Nil_Variable_Value;
|
||||
end if;
|
||||
|
||||
Element := In_Tree.Array_Elements.Table (Current);
|
||||
Element := Shared.Array_Elements.Table (Current);
|
||||
|
||||
Real_Index_1 := Index;
|
||||
|
||||
|
@ -877,7 +879,7 @@ package body Prj.Util is
|
|||
end if;
|
||||
|
||||
while Current /= No_Array_Element loop
|
||||
Element := In_Tree.Array_Elements.Table (Current);
|
||||
Element := Shared.Array_Elements.Table (Current);
|
||||
Real_Index_2 := Element.Index;
|
||||
|
||||
if not Element.Index_Case_Sensitive
|
||||
|
@ -912,7 +914,7 @@ package body Prj.Util is
|
|||
Index : Int := 0;
|
||||
Attribute_Or_Array_Name : Name_Id;
|
||||
In_Package : Package_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
Shared : Shared_Project_Tree_Data_Access;
|
||||
Force_Lower_Case_Index : Boolean := False;
|
||||
Allow_Wildcards : Boolean := False) return Variable_Value
|
||||
is
|
||||
|
@ -927,14 +929,14 @@ package body Prj.Util is
|
|||
The_Array :=
|
||||
Value_Of
|
||||
(Name => Attribute_Or_Array_Name,
|
||||
In_Arrays => In_Tree.Packages.Table (In_Package).Decl.Arrays,
|
||||
In_Tree => In_Tree);
|
||||
In_Arrays => Shared.Packages.Table (In_Package).Decl.Arrays,
|
||||
Shared => Shared);
|
||||
The_Attribute :=
|
||||
Value_Of
|
||||
(Index => Name,
|
||||
Src_Index => Index,
|
||||
In_Array => The_Array,
|
||||
In_Tree => In_Tree,
|
||||
Shared => Shared,
|
||||
Force_Lower_Case_Index => Force_Lower_Case_Index,
|
||||
Allow_Wildcards => Allow_Wildcards);
|
||||
|
||||
|
@ -944,9 +946,9 @@ package body Prj.Util is
|
|||
The_Attribute :=
|
||||
Value_Of
|
||||
(Variable_Name => Attribute_Or_Array_Name,
|
||||
In_Variables => In_Tree.Packages.Table
|
||||
(In_Package).Decl.Attributes,
|
||||
In_Tree => In_Tree);
|
||||
In_Variables => Shared.Packages.Table
|
||||
(In_Package).Decl.Attributes,
|
||||
Shared => Shared);
|
||||
end if;
|
||||
end if;
|
||||
|
||||
|
@ -957,7 +959,7 @@ package body Prj.Util is
|
|||
(Index : Name_Id;
|
||||
In_Array : Name_Id;
|
||||
In_Arrays : Array_Id;
|
||||
In_Tree : Project_Tree_Ref) return Name_Id
|
||||
Shared : Shared_Project_Tree_Data_Access) return Name_Id
|
||||
is
|
||||
Current : Array_Id;
|
||||
The_Array : Array_Data;
|
||||
|
@ -965,10 +967,10 @@ package body Prj.Util is
|
|||
begin
|
||||
Current := In_Arrays;
|
||||
while Current /= No_Array loop
|
||||
The_Array := In_Tree.Arrays.Table (Current);
|
||||
The_Array := Shared.Arrays.Table (Current);
|
||||
if The_Array.Name = In_Array then
|
||||
return Value_Of
|
||||
(Index, In_Array => The_Array.Value, In_Tree => In_Tree);
|
||||
(Index, In_Array => The_Array.Value, Shared => Shared);
|
||||
else
|
||||
Current := The_Array.Next;
|
||||
end if;
|
||||
|
@ -980,7 +982,7 @@ package body Prj.Util is
|
|||
function Value_Of
|
||||
(Name : Name_Id;
|
||||
In_Arrays : Array_Id;
|
||||
In_Tree : Project_Tree_Ref) return Array_Element_Id
|
||||
Shared : Shared_Project_Tree_Data_Access) return Array_Element_Id
|
||||
is
|
||||
Current : Array_Id;
|
||||
The_Array : Array_Data;
|
||||
|
@ -988,7 +990,7 @@ package body Prj.Util is
|
|||
begin
|
||||
Current := In_Arrays;
|
||||
while Current /= No_Array loop
|
||||
The_Array := In_Tree.Arrays.Table (Current);
|
||||
The_Array := Shared.Arrays.Table (Current);
|
||||
|
||||
if The_Array.Name = Name then
|
||||
return The_Array.Value;
|
||||
|
@ -1003,7 +1005,7 @@ package body Prj.Util is
|
|||
function Value_Of
|
||||
(Name : Name_Id;
|
||||
In_Packages : Package_Id;
|
||||
In_Tree : Project_Tree_Ref) return Package_Id
|
||||
Shared : Shared_Project_Tree_Data_Access) return Package_Id
|
||||
is
|
||||
Current : Package_Id;
|
||||
The_Package : Package_Element;
|
||||
|
@ -1011,7 +1013,7 @@ package body Prj.Util is
|
|||
begin
|
||||
Current := In_Packages;
|
||||
while Current /= No_Package loop
|
||||
The_Package := In_Tree.Packages.Table (Current);
|
||||
The_Package := Shared.Packages.Table (Current);
|
||||
exit when The_Package.Name /= No_Name
|
||||
and then The_Package.Name = Name;
|
||||
Current := The_Package.Next;
|
||||
|
@ -1023,7 +1025,7 @@ package body Prj.Util is
|
|||
function Value_Of
|
||||
(Variable_Name : Name_Id;
|
||||
In_Variables : Variable_Id;
|
||||
In_Tree : Project_Tree_Ref) return Variable_Value
|
||||
Shared : Shared_Project_Tree_Data_Access) return Variable_Value
|
||||
is
|
||||
Current : Variable_Id;
|
||||
The_Variable : Variable;
|
||||
|
@ -1031,8 +1033,7 @@ package body Prj.Util is
|
|||
begin
|
||||
Current := In_Variables;
|
||||
while Current /= No_Variable loop
|
||||
The_Variable :=
|
||||
In_Tree.Variable_Elements.Table (Current);
|
||||
The_Variable := Shared.Variable_Elements.Table (Current);
|
||||
|
||||
if Variable_Name = The_Variable.Name then
|
||||
return The_Variable.Value;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
-- --
|
||||
-- S p e c --
|
||||
-- --
|
||||
-- Copyright (C) 2001-2010, Free Software Foundation, Inc. --
|
||||
-- Copyright (C) 2001-2011, 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- --
|
||||
|
@ -29,7 +29,7 @@ package Prj.Util is
|
|||
|
||||
function Executable_Of
|
||||
(Project : Project_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
Shared : Shared_Project_Tree_Data_Access;
|
||||
Main : File_Name_Type;
|
||||
Index : Int;
|
||||
Ada_Main : Boolean := True;
|
||||
|
@ -61,7 +61,7 @@ package Prj.Util is
|
|||
|
||||
procedure Duplicate
|
||||
(This : in out Name_List_Index;
|
||||
In_Tree : Project_Tree_Ref);
|
||||
Shared : Shared_Project_Tree_Data_Access);
|
||||
-- Duplicate a name list
|
||||
|
||||
function Value_Of
|
||||
|
@ -73,7 +73,7 @@ package Prj.Util is
|
|||
function Value_Of
|
||||
(Index : Name_Id;
|
||||
In_Array : Array_Element_Id;
|
||||
In_Tree : Project_Tree_Ref) return Name_Id;
|
||||
Shared : Shared_Project_Tree_Data_Access) return Name_Id;
|
||||
-- Get a single string array component. Returns No_Name if there is no
|
||||
-- component Index, if In_Array is null, or if the component is a String
|
||||
-- list. Depending on the attribute (only attributes may be associative
|
||||
|
@ -85,7 +85,7 @@ package Prj.Util is
|
|||
(Index : Name_Id;
|
||||
Src_Index : Int := 0;
|
||||
In_Array : Array_Element_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
Shared : Shared_Project_Tree_Data_Access;
|
||||
Force_Lower_Case_Index : Boolean := False;
|
||||
Allow_Wildcards : Boolean := False) return Variable_Value;
|
||||
-- Get a string array component (single String or String list). Returns
|
||||
|
@ -101,7 +101,7 @@ package Prj.Util is
|
|||
Index : Int := 0;
|
||||
Attribute_Or_Array_Name : Name_Id;
|
||||
In_Package : Package_Id;
|
||||
In_Tree : Project_Tree_Ref;
|
||||
Shared : Shared_Project_Tree_Data_Access;
|
||||
Force_Lower_Case_Index : Boolean := False;
|
||||
Allow_Wildcards : Boolean := False) return Variable_Value;
|
||||
-- In a specific package:
|
||||
|
@ -117,7 +117,7 @@ package Prj.Util is
|
|||
(Index : Name_Id;
|
||||
In_Array : Name_Id;
|
||||
In_Arrays : Array_Id;
|
||||
In_Tree : Project_Tree_Ref) return Name_Id;
|
||||
Shared : Shared_Project_Tree_Data_Access) return Name_Id;
|
||||
-- Get a string array component in an array of an array list. Returns
|
||||
-- No_Name if there is no component Index, if In_Arrays is null, if
|
||||
-- In_Array is not found in In_Arrays or if the component is a String list.
|
||||
|
@ -125,7 +125,7 @@ package Prj.Util is
|
|||
function Value_Of
|
||||
(Name : Name_Id;
|
||||
In_Arrays : Array_Id;
|
||||
In_Tree : Project_Tree_Ref) return Array_Element_Id;
|
||||
Shared : Shared_Project_Tree_Data_Access) return Array_Element_Id;
|
||||
-- Returns a specified array in an array list. Returns No_Array_Element
|
||||
-- if In_Arrays is null or if Name is not the name of an array in
|
||||
-- In_Arrays. The caller must ensure that Name is in lower case.
|
||||
|
@ -133,7 +133,7 @@ package Prj.Util is
|
|||
function Value_Of
|
||||
(Name : Name_Id;
|
||||
In_Packages : Package_Id;
|
||||
In_Tree : Project_Tree_Ref) return Package_Id;
|
||||
Shared : Shared_Project_Tree_Data_Access) return Package_Id;
|
||||
-- Returns a specified package in a package list. Returns No_Package
|
||||
-- if In_Packages is null or if Name is not the name of a package in
|
||||
-- Package_List. The caller must ensure that Name is in lower case.
|
||||
|
@ -141,7 +141,7 @@ package Prj.Util is
|
|||
function Value_Of
|
||||
(Variable_Name : Name_Id;
|
||||
In_Variables : Variable_Id;
|
||||
In_Tree : Project_Tree_Ref) return Variable_Value;
|
||||
Shared : Shared_Project_Tree_Data_Access) return Variable_Value;
|
||||
-- Returns a specified variable in a variable list. Returns null if
|
||||
-- In_Variables is null or if Variable_Name is not the name of a
|
||||
-- variable in In_Variables. Caller must ensure that Name is lower case.
|
||||
|
|
110
gcc/ada/prj.adb
110
gcc/ada/prj.adb
|
@ -404,6 +404,7 @@ package body Prj is
|
|||
|
||||
procedure For_Every_Project_Imported
|
||||
(By : Project_Id;
|
||||
Tree : Project_Tree_Ref;
|
||||
With_State : in out State;
|
||||
Include_Aggregated : Boolean := True;
|
||||
Imported_First : Boolean := False)
|
||||
|
@ -411,7 +412,8 @@ package body Prj is
|
|||
use Project_Boolean_Htable;
|
||||
Seen : Project_Boolean_Htable.Instance := Project_Boolean_Htable.Nil;
|
||||
|
||||
procedure Recursive_Check (Project : Project_Id);
|
||||
procedure Recursive_Check
|
||||
(Project : Project_Id; Tree : Project_Tree_Ref);
|
||||
-- Check if a project has already been seen. If not seen, mark it as
|
||||
-- Seen, Call Action, and check all its imported projects.
|
||||
|
||||
|
@ -419,29 +421,34 @@ package body Prj is
|
|||
-- Recursive_Check --
|
||||
---------------------
|
||||
|
||||
procedure Recursive_Check (Project : Project_Id) is
|
||||
procedure Recursive_Check
|
||||
(Project : Project_Id; Tree : Project_Tree_Ref)
|
||||
is
|
||||
List : Project_List;
|
||||
Agg : Aggregated_Project_List;
|
||||
|
||||
begin
|
||||
if not Get (Seen, Project) then
|
||||
-- Even if a project is aggregated multiple times, we will only
|
||||
-- return it once.
|
||||
|
||||
Set (Seen, Project, True);
|
||||
|
||||
if not Imported_First then
|
||||
Action (Project, With_State);
|
||||
Action (Project, Tree, With_State);
|
||||
end if;
|
||||
|
||||
-- Visit all extended projects
|
||||
|
||||
if Project.Extends /= No_Project then
|
||||
Recursive_Check (Project.Extends);
|
||||
Recursive_Check (Project.Extends, Tree);
|
||||
end if;
|
||||
|
||||
-- Visit all imported projects
|
||||
|
||||
List := Project.Imported_Projects;
|
||||
while List /= null loop
|
||||
Recursive_Check (List.Project);
|
||||
Recursive_Check (List.Project, Tree);
|
||||
List := List.Next;
|
||||
end loop;
|
||||
|
||||
|
@ -453,13 +460,13 @@ package body Prj is
|
|||
Agg := Project.Aggregated_Projects;
|
||||
while Agg /= null loop
|
||||
pragma Assert (Agg.Project /= No_Project);
|
||||
Recursive_Check (Agg.Project);
|
||||
Recursive_Check (Agg.Project, Agg.Tree);
|
||||
Agg := Agg.Next;
|
||||
end loop;
|
||||
end if;
|
||||
|
||||
if Imported_First then
|
||||
Action (Project, With_State);
|
||||
Action (Project, Tree, With_State);
|
||||
end if;
|
||||
end if;
|
||||
end Recursive_Check;
|
||||
|
@ -467,7 +474,7 @@ package body Prj is
|
|||
-- Start of processing for For_Every_Project_Imported
|
||||
|
||||
begin
|
||||
Recursive_Check (Project => By);
|
||||
Recursive_Check (Project => By, Tree => Tree);
|
||||
Reset (Seen);
|
||||
end For_Every_Project_Imported;
|
||||
|
||||
|
@ -484,18 +491,25 @@ package body Prj is
|
|||
is
|
||||
Result : Source_Id := No_Source;
|
||||
|
||||
procedure Look_For_Sources (Proj : Project_Id; Src : in out Source_Id);
|
||||
procedure Look_For_Sources
|
||||
(Proj : Project_Id;
|
||||
Tree : Project_Tree_Ref;
|
||||
Src : in out Source_Id);
|
||||
-- Look for Base_Name in the sources of Proj
|
||||
|
||||
----------------------
|
||||
-- Look_For_Sources --
|
||||
----------------------
|
||||
|
||||
procedure Look_For_Sources (Proj : Project_Id; Src : in out Source_Id) is
|
||||
procedure Look_For_Sources
|
||||
(Proj : Project_Id;
|
||||
Tree : Project_Tree_Ref;
|
||||
Src : in out Source_Id)
|
||||
is
|
||||
Iterator : Source_Iterator;
|
||||
|
||||
begin
|
||||
Iterator := For_Each_Source (In_Tree => In_Tree, Project => Proj);
|
||||
Iterator := For_Each_Source (In_Tree => Tree, Project => Proj);
|
||||
while Element (Iterator) /= No_Source loop
|
||||
if Element (Iterator).File = Base_Name then
|
||||
Src := Element (Iterator);
|
||||
|
@ -517,22 +531,23 @@ package body Prj is
|
|||
if In_Extended_Only then
|
||||
Proj := Project;
|
||||
while Proj /= No_Project loop
|
||||
Look_For_Sources (Proj, Result);
|
||||
Look_For_Sources (Proj, In_Tree, Result);
|
||||
exit when Result /= No_Source;
|
||||
|
||||
Proj := Proj.Extends;
|
||||
end loop;
|
||||
|
||||
elsif In_Imported_Only then
|
||||
Look_For_Sources (Project, Result);
|
||||
Look_For_Sources (Project, In_Tree, Result);
|
||||
|
||||
if Result = No_Source then
|
||||
For_Imported_Projects
|
||||
(By => Project,
|
||||
Tree => In_Tree,
|
||||
With_State => Result);
|
||||
end if;
|
||||
else
|
||||
Look_For_Sources (No_Project, Result);
|
||||
Look_For_Sources (No_Project, In_Tree, Result);
|
||||
end if;
|
||||
|
||||
return Result;
|
||||
|
@ -604,12 +619,9 @@ package body Prj is
|
|||
|
||||
Prj.Attr.Initialize;
|
||||
|
||||
Set_Name_Table_Byte
|
||||
(Name_Project, Token_Type'Pos (Tok_Project));
|
||||
Set_Name_Table_Byte
|
||||
(Name_Extends, Token_Type'Pos (Tok_Extends));
|
||||
Set_Name_Table_Byte
|
||||
(Name_External, Token_Type'Pos (Tok_External));
|
||||
Set_Name_Table_Byte (Name_Project, Token_Type'Pos (Tok_Project));
|
||||
Set_Name_Table_Byte (Name_Extends, Token_Type'Pos (Tok_Extends));
|
||||
Set_Name_Table_Byte (Name_External, Token_Type'Pos (Tok_External));
|
||||
Set_Name_Table_Byte
|
||||
(Name_External_As_List, Token_Type'Pos (Tok_External_As_List));
|
||||
end if;
|
||||
|
@ -716,6 +728,9 @@ package body Prj is
|
|||
begin
|
||||
while List /= null loop
|
||||
Tmp := List.Next;
|
||||
|
||||
Free (List.Tree);
|
||||
|
||||
Unchecked_Free (List);
|
||||
List := Tmp;
|
||||
end loop;
|
||||
|
@ -731,6 +746,7 @@ package body Prj is
|
|||
Project.Aggregated_Projects := new Aggregated_Project'
|
||||
(Path => Path,
|
||||
Project => No_Project,
|
||||
Tree => null,
|
||||
Next => Project.Aggregated_Projects);
|
||||
end Add_Aggregated_Project;
|
||||
|
||||
|
@ -888,13 +904,16 @@ package body Prj is
|
|||
|
||||
begin
|
||||
if Tree /= null then
|
||||
Name_List_Table.Free (Tree.Name_Lists);
|
||||
Number_List_Table.Free (Tree.Number_Lists);
|
||||
String_Element_Table.Free (Tree.String_Elements);
|
||||
Variable_Element_Table.Free (Tree.Variable_Elements);
|
||||
Array_Element_Table.Free (Tree.Array_Elements);
|
||||
Array_Table.Free (Tree.Arrays);
|
||||
Package_Table.Free (Tree.Packages);
|
||||
if Tree.Is_Root_Tree then
|
||||
Name_List_Table.Free (Tree.Shared.Name_Lists);
|
||||
Number_List_Table.Free (Tree.Shared.Number_Lists);
|
||||
String_Element_Table.Free (Tree.Shared.String_Elements);
|
||||
Variable_Element_Table.Free (Tree.Shared.Variable_Elements);
|
||||
Array_Element_Table.Free (Tree.Shared.Array_Elements);
|
||||
Array_Table.Free (Tree.Shared.Arrays);
|
||||
Package_Table.Free (Tree.Shared.Packages);
|
||||
end if;
|
||||
|
||||
Source_Paths_Htable.Reset (Tree.Source_Paths_HT);
|
||||
Source_Files_Htable.Reset (Tree.Source_Files_HT);
|
||||
|
||||
|
@ -917,13 +936,21 @@ package body Prj is
|
|||
begin
|
||||
-- Visible tables
|
||||
|
||||
Name_List_Table.Init (Tree.Name_Lists);
|
||||
Number_List_Table.Init (Tree.Number_Lists);
|
||||
String_Element_Table.Init (Tree.String_Elements);
|
||||
Variable_Element_Table.Init (Tree.Variable_Elements);
|
||||
Array_Element_Table.Init (Tree.Array_Elements);
|
||||
Array_Table.Init (Tree.Arrays);
|
||||
Package_Table.Init (Tree.Packages);
|
||||
if Tree.Is_Root_Tree then
|
||||
-- We cannot use 'Access here:
|
||||
-- "illegal attribute for discriminant-dependent component"
|
||||
-- However, we know this is valid since Shared and Shared_Data have
|
||||
-- the same lifetime and will always exist concurrently.
|
||||
Tree.Shared := Tree.Shared_Data'Unrestricted_Access;
|
||||
Name_List_Table.Init (Tree.Shared.Name_Lists);
|
||||
Number_List_Table.Init (Tree.Shared.Number_Lists);
|
||||
String_Element_Table.Init (Tree.Shared.String_Elements);
|
||||
Variable_Element_Table.Init (Tree.Shared.Variable_Elements);
|
||||
Array_Element_Table.Init (Tree.Shared.Array_Elements);
|
||||
Array_Table.Init (Tree.Shared.Arrays);
|
||||
Package_Table.Init (Tree.Shared.Packages);
|
||||
end if;
|
||||
|
||||
Source_Paths_Htable.Reset (Tree.Source_Paths_HT);
|
||||
Source_Files_Htable.Reset (Tree.Source_Files_HT);
|
||||
Replaced_Source_HTable.Reset (Tree.Replaced_Sources);
|
||||
|
@ -1110,7 +1137,10 @@ package body Prj is
|
|||
procedure Compute_All_Imported_Projects (Tree : Project_Tree_Ref) is
|
||||
Project : Project_Id;
|
||||
|
||||
procedure Recursive_Add (Prj : Project_Id; Dummy : in out Boolean);
|
||||
procedure Recursive_Add
|
||||
(Prj : Project_Id;
|
||||
Tree : Project_Tree_Ref;
|
||||
Dummy : in out Boolean);
|
||||
-- Recursively add the projects imported by project Project, but not
|
||||
-- those that are extended.
|
||||
|
||||
|
@ -1118,8 +1148,12 @@ package body Prj is
|
|||
-- Recursive_Add --
|
||||
-------------------
|
||||
|
||||
procedure Recursive_Add (Prj : Project_Id; Dummy : in out Boolean) is
|
||||
pragma Unreferenced (Dummy);
|
||||
procedure Recursive_Add
|
||||
(Prj : Project_Id;
|
||||
Tree : Project_Tree_Ref;
|
||||
Dummy : in out Boolean)
|
||||
is
|
||||
pragma Unreferenced (Dummy, Tree);
|
||||
List : Project_List;
|
||||
Prj2 : Project_Id;
|
||||
|
||||
|
@ -1163,7 +1197,7 @@ package body Prj is
|
|||
while List /= null loop
|
||||
Project := List.Project;
|
||||
Free_List (Project.All_Imported_Projects, Free_Project => False);
|
||||
For_All_Projects (Project, Dummy);
|
||||
For_All_Projects (Project, Tree, Dummy, Include_Aggregated => False);
|
||||
List := List.Next;
|
||||
end loop;
|
||||
end Compute_All_Imported_Projects;
|
||||
|
|
|
@ -1094,6 +1094,7 @@ package Prj is
|
|||
type Aggregated_Project_List is access all Aggregated_Project;
|
||||
type Aggregated_Project is record
|
||||
Path : Path_Name_Type;
|
||||
Tree : Project_Tree_Ref;
|
||||
Project : Project_Id;
|
||||
Next : Aggregated_Project_List;
|
||||
end record;
|
||||
|
@ -1400,41 +1401,68 @@ package Prj is
|
|||
type Private_Project_Tree_Data is private;
|
||||
-- Data for a project tree that is used only by the Project Manager
|
||||
|
||||
type Project_Tree_Data is
|
||||
record
|
||||
Name_Lists : Name_List_Table.Instance;
|
||||
Number_Lists : Number_List_Table.Instance;
|
||||
String_Elements : String_Element_Table.Instance;
|
||||
Variable_Elements : Variable_Element_Table.Instance;
|
||||
Array_Elements : Array_Element_Table.Instance;
|
||||
Arrays : Array_Table.Instance;
|
||||
Packages : Package_Table.Instance;
|
||||
Projects : Project_List;
|
||||
type Shared_Project_Tree_Data is record
|
||||
Name_Lists : Name_List_Table.Instance;
|
||||
Number_Lists : Number_List_Table.Instance;
|
||||
String_Elements : String_Element_Table.Instance;
|
||||
Variable_Elements : Variable_Element_Table.Instance;
|
||||
Array_Elements : Array_Element_Table.Instance;
|
||||
Arrays : Array_Table.Instance;
|
||||
Packages : Package_Table.Instance;
|
||||
end record;
|
||||
type Shared_Project_Tree_Data_Access is access all Shared_Project_Tree_Data;
|
||||
-- The data that is shared among multiple trees, when these trees are
|
||||
-- loaded through the same aggregate project.
|
||||
-- To avoid ambiguities, limit the number of parameters to the
|
||||
-- subprograms (we would have to parse the "root project tree" since this
|
||||
-- is where the configuration file was loaded, in addition to the project's
|
||||
-- own tree) and make the comparison of projects easier, all trees store
|
||||
-- the lists in the same tables.
|
||||
|
||||
Replaced_Sources : Replaced_Source_HTable.Instance;
|
||||
-- The list of sources that have been replaced by sources with
|
||||
-- different file names.
|
||||
type Project_Tree_Data (Is_Root_Tree : Boolean := True) is record
|
||||
-- The root tree is the one loaded by the user from the command line.
|
||||
-- Is_Root_Tree is only false for projects aggregated within a root
|
||||
-- aggregate project.
|
||||
|
||||
Replaced_Source_Number : Natural := 0;
|
||||
-- The number of entries in Replaced_Sources
|
||||
Projects : Project_List;
|
||||
-- List of projects in this tree
|
||||
|
||||
Units_HT : Units_Htable.Instance;
|
||||
-- Unit name to Unit_Index (and from there to Source_Id)
|
||||
Replaced_Sources : Replaced_Source_HTable.Instance;
|
||||
-- The list of sources that have been replaced by sources with
|
||||
-- different file names.
|
||||
|
||||
Source_Files_HT : Source_Files_Htable.Instance;
|
||||
-- Base source file names to Source_Id list.
|
||||
Replaced_Source_Number : Natural := 0;
|
||||
-- The number of entries in Replaced_Sources
|
||||
|
||||
Source_Paths_HT : Source_Paths_Htable.Instance;
|
||||
-- Full path to Source_Id
|
||||
Units_HT : Units_Htable.Instance;
|
||||
-- Unit name to Unit_Index (and from there to Source_Id)
|
||||
|
||||
Source_Info_File_Name : String_Access := null;
|
||||
-- The name of the source info file, if specified by the builder
|
||||
Source_Files_HT : Source_Files_Htable.Instance;
|
||||
-- Base source file names to Source_Id list.
|
||||
|
||||
Source_Info_File_Exists : Boolean := False;
|
||||
-- True when a source info file has been successfully read
|
||||
Source_Paths_HT : Source_Paths_Htable.Instance;
|
||||
-- Full path to Source_Id
|
||||
|
||||
Private_Part : Private_Project_Tree_Data;
|
||||
end record;
|
||||
Source_Info_File_Name : String_Access := null;
|
||||
-- The name of the source info file, if specified by the builder
|
||||
|
||||
Source_Info_File_Exists : Boolean := False;
|
||||
-- True when a source info file has been successfully read
|
||||
|
||||
Private_Part : Private_Project_Tree_Data;
|
||||
|
||||
Shared : Shared_Project_Tree_Data_Access;
|
||||
-- The shared data for this tree and all aggregated trees.
|
||||
|
||||
case Is_Root_Tree is
|
||||
when True =>
|
||||
Shared_Data : aliased Shared_Project_Tree_Data;
|
||||
-- Do not access directly, only through Shared.
|
||||
|
||||
when False =>
|
||||
null;
|
||||
end case;
|
||||
end record;
|
||||
-- Data for a project tree
|
||||
|
||||
procedure Expect (The_Token : Token_Type; Token_Image : String);
|
||||
|
@ -1463,9 +1491,11 @@ package Prj is
|
|||
type State is limited private;
|
||||
with procedure Action
|
||||
(Project : Project_Id;
|
||||
Tree : Project_Tree_Ref;
|
||||
With_State : in out State);
|
||||
procedure For_Every_Project_Imported
|
||||
(By : Project_Id;
|
||||
Tree : Project_Tree_Ref;
|
||||
With_State : in out State;
|
||||
Include_Aggregated : Boolean := True;
|
||||
Imported_First : Boolean := False);
|
||||
|
@ -1488,6 +1518,9 @@ package Prj is
|
|||
-- If Include_Aggregated is True, then an aggregate project will recurse
|
||||
-- into the projects it aggregates. Otherwise, the latter are never
|
||||
-- returned
|
||||
--
|
||||
-- The Tree argument passed to the callback is required in the case of
|
||||
-- aggregated projects, since they might not be using the same tree as 'By'
|
||||
|
||||
function Extend_Name
|
||||
(File : File_Name_Type;
|
||||
|
|
Loading…
Reference in New Issue