summaryrefslogtreecommitdiff
path: root/gcc/ada/mlib-prj.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-15 15:46:57 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-15 15:46:57 +0000
commitd1a942e47088eb7fd10091a7aeb366d852e7d406 (patch)
treecf1142dd403f99e75300ca6822d5c4d182a98b74 /gcc/ada/mlib-prj.adb
parent6938bdf83f5ac8a41e29d9416c447095002970d1 (diff)
downloadgcc-d1a942e47088eb7fd10091a7aeb366d852e7d406.tar.gz
2005-03-08 Vincent Celier <celier@adacore.com>
* mlib-tgt-tru64.adb, mlib-tgt-aix.adb, mlib-tgt-irix.adb, mlib-tgt-hpux.adb, mlib-tgt-linux.adb, mlib-tgt-solaris.adb, mlib-tgt-vms-alpha.adb, mlib-tgt-vms-ia64.adb, mlib-tgt-mingw.adb, mlib-tgt-vxworks.adb, mlib-tgt-lynxos.adb (Library_Exist_For, Library_File_Name_For): Add new parameter In_Tree to specify the project tree: needed by the project manager. Adapt to changes in project manager using new parameter In_Tree. Remove local imports, use functions in System.CRTL. * make.adb, clean.adb, gnatcmd.adb (Project_Tree): New constant needed to use the project manager. * makeutl.ads, makeutl.adb (Linker_Options_Switches): New parameter In_Tree to designate the project tree. Adapt to changes in the project manager, using In_Tree. * mlib-prj.ads, mlib-prj.adb (Build_Library, Check_Library, Copy_Interface_Sources): Add new parameter In_Tree to specify the project tree: needed by the project manager. (Build_Library): Check that Arg'Length >= 6 before checking if it contains "--RTS=...". * mlib-tgt.ads, mlib-tgt.adb (Library_Exist_For, Library_File_Name_For): Add new parameter In_Tree to specify the project tree: needed by the project manager. * prj.ads, prj.adb: Major modifications to allow several project trees in memory at the same time. Change tables to dynamic tables and hash tables to dynamic hash tables. Move tables and hash tables from Prj.Com (in the visible part) and Prj.Env (in the private part). Move some constants from the visible part to the private part. Make other constants deferred. (Project_Empty): Make it a variable, not a function (Empty_Project): Add parameter Tree. Returns the data with the default naming data of the project tree Tree. (Initialize): After updating Std_Naming_Data, copy its value to the component Naming of Project Empty. (Register_Default_Naming_Scheme): Use and update the default naming component of the project tree, instead of the global variable Std_Naming_Data. (Standard_Naming_Data): Add defaulted parameter Tree. If project tree Tree is not defaulted, return the default naming data of the Tree. (Initial_Buffer_Size): Constant moved from private part (Default_Ada_Spec_Suffix_Id, Default_Ada_Body_Suffix_Id, Slash_Id); new variables initialized in procedure Initialize. (Add_To_Buffer): Add two in out parameters to replace global variables Buffer and Buffer_Last. (Default_Ada_Spec_Suffix, Default_Body_Spec_Suffix, Slash): New functions. Adapt to changes to use new type Project_Tree_Ref and dynamic tables and hash tables. (Initialize, Reset, register-Default_Namng-Scheme): Add a new parameter for the project tree. (Project_Tree_Data, Project_Tree_Ref, No_Project): Declare types and constant at the beginning of the package spec, so that they cane be used in subprograms before their full declarations. (Standard_Naming_Data): Add defaulted parameter of type Project_Node_Ref (Empty_Project): Add parameter of type Project_Node_Ref (Private_Project_Tree_Data): Add component Default_Naming of type Naming_Data. (Buffer, Buffer_Last): remove global variables (Add_To_Buffer): Add two in out parameters to replace global variables Buffer and Buffer_Last. (Current_Packages_To_Check): Remove global variable (Empty_Name): Move to private part (No-Symbols): Make it a constant (Private_Project_Tree_Data): New type for the private part of the project tree data. (Project_Tree_Data): New type for the data of a project tree (Project_Tree_Ref): New type to designate a project tree (Initialize, Reset, register-Default_Namng-Scheme): Add a new parameter for the project tree. * prj-attr.ads: Add with Table; needed, as package Prj no longer imports package Table. * prj-com.adb: Remove empty, no longer needed body * prj-com.ads: Move most of the content of this package to package Prj. * prj-dect.ads, prj-dect.adb (Parse): New parameters In_Tree to designate the project node tree and Packages_To_Check to replace global variable Current_Packages_To_Check. Add new parameters In_Tree and Packages_To_Check to local subprograms, when needed. Adapt to changes in project manager with project node tree In_Tree. * prj-env.ads, prj-env.adb: Add new parameter In_Tree to designate the project tree to most subprograms. Move tables and hash tables to private part of package Prj. Adapt to changes in project manager using project tree In_Tree. * prj-makr.adb (Tree): New constant to designate the project node tree Adapt to change in project manager using project node tree Tree * prj-nmsc.ads, prj-nmsc.adb (Check_Stand_Alone_Library): Correctly display the Library_Src_Dir and the Library_Dir. Add new parameter In_Tree to designate the project node tree to most subprograms. Adapt to changes in the project manager, using project tree In_Tree. (Check_Naming_Scheme): Do not alter the casing on platforms where the casing of file names is not significant. (Check): Add new parameter In_Tree to designate the * prj-pars.ads, prj-pars.adb (Parse): Add new parameter In_Tree to designate the project tree. Declare a project node tree to call Prj.Part.Parse and Prj.Proc.Process * prj-part.ads, prj-part.adb (Buffer, Buffer_Last): Global variables, to replace those that were in the private part of package Prj. Add new parameter In__Tree to designate the project node tree to most subprograms. Adapt to change in Prj.Tree with project node tree In_Tree. (Post_Parse_Context_Clause): When specifying the project node of a with clause, indicate that it is a limited with only if there is "limited" in the with clause, not necessarily when In_Limited is True. (Parse): Add new parameter In_Tree to designate the project node tree * prj-pp.ads, prj-pp.adb (Pretty_Print): Add new parameter In_Tree to designate the project node tree. Adapt to change in Prj.Tree with project node tree In_Tree. * prj-proc.ads, prj-proc.adb (Recursive_Process): Specify the project tree In_Tree in the call to function Empty_Process to give its initial value to the project data Processed_Data. Add new parameters In_Tree to designate the project tree and From_Project_Node_Tree to designate the project node tree to several subprograms. Adapt to change in project manager with project tree In_Tree and project node tree From_Project_Node_Tree. * prj-strt.ads, prj-strt.adb (Buffer, Buffer_Last): Global variables, to replace those that were in the private part of package Prj. Add new parameter In_Tree to designate the project node tree to most subprograms. Adapt to change in Prj.Tree with project node tree In_Tree. * prj-tree.ads, prj-tree.adb: Add new parameter of type Project_Node_Tree_Ref to most subprograms. Use this new parameter to store project nodes in the designated project node tree. (Project_Node_Tree_Ref): New type to designate a project node tree (Tree_Private_Part): Change table to dynamic table and hash tables to dynamic hash tables. * prj-util.ads, prj-util.adb: Add new parameter In_Tree to designate the project tree to most subprograms. Adapt to changes in project manager using project tree In_Tree. * makegpr.adb (Project_Tree): New constant needed to use project manager. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96481 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/mlib-prj.adb')
-rw-r--r--gcc/ada/mlib-prj.adb126
1 files changed, 83 insertions, 43 deletions
diff --git a/gcc/ada/mlib-prj.adb b/gcc/ada/mlib-prj.adb
index 03ca2d0ee96..541f485665b 100644
--- a/gcc/ada/mlib-prj.adb
+++ b/gcc/ada/mlib-prj.adb
@@ -224,6 +224,7 @@ package body MLib.Prj is
procedure Copy_Interface_Sources
(For_Project : Project_Id;
+ In_Tree : Project_Tree_Ref;
Interfaces : Argument_List;
To_Dir : Name_Id);
-- Copy the interface sources of a SAL to directory To_Dir
@@ -294,6 +295,7 @@ package body MLib.Prj is
procedure Build_Library
(For_Project : Project_Id;
+ In_Tree : Project_Tree_Ref;
Gnatbind : String;
Gnatbind_Path : String_Access;
Gcc : String;
@@ -315,7 +317,7 @@ package body MLib.Prj is
-- On OpenVMS, set to True if library needs to be linked with
-- g-trasym.obj.
- Data : Project_Data := Projects.Table (For_Project);
+ Data : Project_Data := In_Tree.Projects.Table (For_Project);
Object_Directory_Path : constant String :=
Get_Name_String (Data.Object_Directory);
@@ -484,15 +486,15 @@ package body MLib.Prj is
elsif P /= No_Project then
declare
- Data : Project_Data := Projects.Table (For_Project);
-
+ Data : Project_Data :=
+ In_Tree.Projects.Table (For_Project);
begin
while Data.Extends /= No_Project loop
if P = Data.Extends then
return True;
end if;
- Data := Projects.Table (Data.Extends);
+ Data := In_Tree.Projects.Table (Data.Extends);
end loop;
end;
end if;
@@ -668,7 +670,8 @@ package body MLib.Prj is
---------------------
procedure Process_Project (Project : Project_Id) is
- Data : constant Project_Data := Projects.Table (Project);
+ Data : constant Project_Data :=
+ In_Tree.Projects.Table (Project);
Imported : Project_List := Data.Imported_Projects;
Element : Project_Element;
@@ -683,7 +686,8 @@ package body MLib.Prj is
-- we have a proper reverse order for the libraries.
while Imported /= Empty_Project_List loop
- Element := Project_Lists.Table (Imported);
+ Element :=
+ In_Tree.Project_Lists.Table (Imported);
if Element.Project /= No_Project then
Process_Project (Element.Project);
@@ -718,7 +722,8 @@ package body MLib.Prj is
for Index in reverse 1 .. Library_Projs.Last loop
Current := Library_Projs.Table (Index);
- Get_Name_String (Projects.Table (Current).Library_Dir);
+ Get_Name_String
+ (In_Tree.Projects.Table (Current).Library_Dir);
Opts.Increment_Last;
Opts.Table (Opts.Last) :=
new String'("-L" & Name_Buffer (1 .. Name_Len));
@@ -732,7 +737,8 @@ package body MLib.Prj is
new String'
("-l" &
Get_Name_String
- (Projects.Table (Current).Library_Name));
+ (In_Tree.Projects.Table
+ (Current).Library_Name));
end loop;
end Process_Imported_Libraries;
@@ -812,7 +818,8 @@ package body MLib.Prj is
Binder_Package : constant Package_Id :=
Value_Of
(Name => Name_Binder,
- In_Packages => Data.Decl.Packages);
+ In_Packages => Data.Decl.Packages,
+ In_Tree => In_Tree);
begin
if Binder_Package /= No_Package then
@@ -821,8 +828,9 @@ package body MLib.Prj is
Value_Of
(Name => Name_Default_Switches,
In_Arrays =>
- Packages.Table
- (Binder_Package).Decl.Arrays);
+ In_Tree.Packages.Table
+ (Binder_Package).Decl.Arrays,
+ In_Tree => In_Tree);
Switches : Variable_Value := Nil_Variable_Value;
Switch : String_List_Id := Nil_String;
@@ -833,7 +841,8 @@ package body MLib.Prj is
Value_Of
(Index => Name_Ada,
Src_Index => 0,
- In_Array => Defaults);
+ In_Array => Defaults,
+ In_Tree => In_Tree);
if not Switches.Default then
Switch := Switches.Values;
@@ -841,8 +850,10 @@ package body MLib.Prj is
while Switch /= Nil_String loop
Add_Argument
(Get_Name_String
- (String_Elements.Table (Switch).Value));
- Switch := String_Elements.Table (Switch).Next;
+ (In_Tree.String_Elements.Table
+ (Switch).Value));
+ Switch := In_Tree.String_Elements.
+ Table (Switch).Next;
end loop;
end if;
end if;
@@ -862,8 +873,10 @@ package body MLib.Prj is
Interface_ALIs.Reset;
Processed_ALIs.Reset;
- for Source in 1 .. Com.Units.Last loop
- Unit := Com.Units.Table (Source);
+ for Source in Unit_Table.First ..
+ Unit_Table.Last (In_Tree.Units)
+ loop
+ Unit := In_Tree.Units.Table (Source);
if Unit.File_Names (Body_Part).Name /= No_Name
and then Unit.File_Names (Body_Part).Path /= Slash
@@ -944,8 +957,8 @@ package body MLib.Prj is
declare
Arg : String_Ptr renames Args.Table (Index);
begin
- if
- Arg (Arg'First + 2 .. Arg'First + 5) = "RTS="
+ if Arg'Length >= 6 and then
+ Arg (Arg'First + 2 .. Arg'First + 5) = "RTS="
then
Add_Argument (Arg.all);
exit;
@@ -959,7 +972,9 @@ package body MLib.Prj is
-- Set the paths
Set_Ada_Paths
- (Project => For_Project, Including_Libraries => True);
+ (Project => For_Project,
+ In_Tree => In_Tree,
+ Including_Libraries => True);
-- Display the gnatbind command, if not in quiet output
@@ -982,7 +997,9 @@ package body MLib.Prj is
-- Set the paths
Set_Ada_Paths
- (Project => For_Project, Including_Libraries => True);
+ (Project => For_Project,
+ In_Tree => In_Tree,
+ Including_Libraries => True);
-- Invoke <gcc> -c b$$<lib>.adb
@@ -1076,7 +1093,8 @@ package body MLib.Prj is
if Link then
-- If attribute Library_GCC was specified, get the driver name
- Library_GCC := Value_Of (Name_Library_GCC, Data.Decl.Attributes);
+ Library_GCC :=
+ Value_Of (Name_Library_GCC, Data.Decl.Attributes, In_Tree);
if not Library_GCC.Default then
Driver_Name := Library_GCC.Value;
@@ -1086,7 +1104,7 @@ package body MLib.Prj is
-- options.
Library_Options :=
- Value_Of (Name_Library_Options, Data.Decl.Attributes);
+ Value_Of (Name_Library_Options, Data.Decl.Attributes, In_Tree);
if not Library_Options.Default then
declare
@@ -1095,7 +1113,8 @@ package body MLib.Prj is
begin
while Current /= Nil_String loop
- Element := String_Elements.Table (Current);
+ Element :=
+ In_Tree.String_Elements.Table (Current);
Get_Name_String (Element.Value);
if Name_Len /= 0 then
@@ -1240,7 +1259,7 @@ package body MLib.Prj is
exit when Data.Extends = No_Project;
In_Main_Object_Directory := False;
- Data := Projects.Table (Data.Extends);
+ Data := In_Tree.Projects.Table (Data.Extends);
end loop;
-- Add the -L and -l switches for the imported Library Project Files,
@@ -1416,7 +1435,7 @@ package body MLib.Prj is
-- the library directory (by Copy_ALI_Files, below).
if Standalone then
- Data := Projects.Table (For_Project);
+ Data := In_Tree.Projects.Table (For_Project);
declare
Iface : String_List_Id := Data.Lib_Interface_ALIs;
@@ -1424,11 +1443,14 @@ package body MLib.Prj is
begin
while Iface /= Nil_String loop
- ALI := String_Elements.Table (Iface).Value;
+ ALI :=
+ In_Tree.String_Elements.Table (Iface).Value;
Interface_ALIs.Set (ALI, True);
- Get_Name_String (String_Elements.Table (Iface).Value);
+ Get_Name_String
+ (In_Tree.String_Elements.Table (Iface).Value);
Add_Argument (Name_Buffer (1 .. Name_Len));
- Iface := String_Elements.Table (Iface).Next;
+ Iface :=
+ In_Tree.String_Elements.Table (Iface).Next;
end loop;
Iface := Data.Lib_Interface_ALIs;
@@ -1440,9 +1462,11 @@ package body MLib.Prj is
-- interface. If it is not the case, output a warning.
while Iface /= Nil_String loop
- ALI := String_Elements.Table (Iface).Value;
+ ALI := In_Tree.String_Elements.Table
+ (Iface).Value;
Process (ALI);
- Iface := String_Elements.Table (Iface).Next;
+ Iface :=
+ In_Tree.String_Elements.Table (Iface).Next;
end loop;
end if;
end;
@@ -1453,7 +1477,8 @@ package body MLib.Prj is
-- copy directory or because the interface copy directory is the
-- same as the library directory.
- Copy_Dir := Projects.Table (For_Project).Library_Dir;
+ Copy_Dir :=
+ In_Tree.Projects.Table (For_Project).Library_Dir;
Clean (Copy_Dir);
-- Call procedure to build the library, depending on the build mode
@@ -1502,21 +1527,26 @@ package body MLib.Prj is
-- Copy interface sources if Library_Src_Dir specified
if Standalone
- and then Projects.Table (For_Project).Library_Src_Dir /= No_Name
+ and then In_Tree.Projects.Table
+ (For_Project).Library_Src_Dir /= No_Name
then
-- Clean the interface copy directory, if it is not also the
-- library directory. If it is also the library directory, it
-- has already been cleaned before generation of the library.
- if Projects.Table (For_Project).Library_Src_Dir /= Copy_Dir then
- Copy_Dir := Projects.Table (For_Project).Library_Src_Dir;
+ if In_Tree.Projects.Table
+ (For_Project).Library_Src_Dir /= Copy_Dir
+ then
+ Copy_Dir := In_Tree.Projects.Table
+ (For_Project).Library_Src_Dir;
Clean (Copy_Dir);
end if;
Copy_Interface_Sources
(For_Project => For_Project,
- Interfaces => Arguments (1 .. Argument_Number),
- To_Dir => Copy_Dir);
+ In_Tree => In_Tree,
+ Interfaces => Arguments (1 .. Argument_Number),
+ To_Dir => Copy_Dir);
end if;
end if;
@@ -1553,8 +1583,11 @@ package body MLib.Prj is
-- Check_Library --
-------------------
- procedure Check_Library (For_Project : Project_Id) is
- Data : constant Project_Data := Projects.Table (For_Project);
+ procedure Check_Library
+ (For_Project : Project_Id; In_Tree : Project_Tree_Ref)
+ is
+ Data : constant Project_Data :=
+ In_Tree.Projects.Table (For_Project);
begin
-- No need to build the library if there is no object directory,
@@ -1566,7 +1599,8 @@ package body MLib.Prj is
then
declare
Current : constant Dir_Name_Str := Get_Current_Dir;
- Lib_Name : constant Name_Id := Library_File_Name_For (For_Project);
+ Lib_Name : constant Name_Id :=
+ Library_File_Name_For (For_Project, In_Tree);
Lib_TS : Time_Stamp_Type;
Obj_TS : Time_Stamp_Type;
@@ -1613,7 +1647,8 @@ package body MLib.Prj is
-- Library must be rebuilt
- Projects.Table (For_Project).Need_To_Build_Lib := True;
+ In_Tree.Projects.Table
+ (For_Project).Need_To_Build_Lib := True;
exit;
end if;
end if;
@@ -1682,6 +1717,7 @@ package body MLib.Prj is
procedure Copy_Interface_Sources
(For_Project : Project_Id;
+ In_Tree : Project_Tree_Ref;
Interfaces : Argument_List;
To_Dir : Name_Id)
is
@@ -1711,8 +1747,10 @@ package body MLib.Prj is
begin
Unit_Loop :
- for Index in 1 .. Com.Units.Last loop
- Data := Com.Units.Table (Index);
+ for Index in Unit_Table.First ..
+ Unit_Table.Last (In_Tree.Units)
+ loop
+ Data := In_Tree.Units.Table (Index);
for J in Data.File_Names'Range loop
if Data.File_Names (J).Project = For_Project
@@ -1738,7 +1776,9 @@ package body MLib.Prj is
-- Change the working directory to the object directory
Change_Dir
- (Get_Name_String (Projects.Table (For_Project).Object_Directory));
+ (Get_Name_String
+ (In_Tree.Projects.Table
+ (For_Project).Object_Directory));
for Index in Interfaces'Range loop