diff options
Diffstat (limited to 'gcc/ada/mlib-prj.adb')
-rw-r--r-- | gcc/ada/mlib-prj.adb | 126 |
1 files changed, 83 insertions, 43 deletions
diff --git a/gcc/ada/mlib-prj.adb b/gcc/ada/mlib-prj.adb index 03ca2d0..541f485 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 |