Commit 5969611f by Robert Dewar Committed by Arnaud Charlet

exp_ch7.adb, [...]: Minor reformatting.

2011-08-04  Robert Dewar  <dewar@adacore.com>

	* exp_ch7.adb, make.adb, sem_ch10.adb, bindgen.adb, sem_res.adb,
	exp_ch4.adb, makeutl.adb: Minor reformatting.

From-SVN: r177365
parent 6367dd30
2011-08-04 Robert Dewar <dewar@adacore.com>
* exp_ch7.adb, make.adb, sem_ch10.adb, bindgen.adb, sem_res.adb,
exp_ch4.adb, makeutl.adb: Minor reformatting.
2011-08-04 Emmanuel Briot <briot@adacore.com> 2011-08-04 Emmanuel Briot <briot@adacore.com>
* make.adb, makeutl.adb, makeutl.ads (Make): major refactoring. * make.adb, makeutl.adb, makeutl.ads (Make): major refactoring.
......
...@@ -1665,6 +1665,10 @@ package body Bindgen is ...@@ -1665,6 +1665,10 @@ package body Bindgen is
procedure Gen_Header; procedure Gen_Header;
-- Generate the header of the finalization routine -- Generate the header of the finalization routine
----------------
-- Gen_Header --
----------------
procedure Gen_Header is procedure Gen_Header is
begin begin
WBI (" procedure finalize_library is"); WBI (" procedure finalize_library is");
...@@ -1685,6 +1689,8 @@ package body Bindgen is ...@@ -1685,6 +1689,8 @@ package body Bindgen is
WBI (" begin"); WBI (" begin");
end Gen_Header; end Gen_Header;
-- Start of processing for Gen_Finalize_Library_Ada
begin begin
for E in reverse Elab_Order.First .. Elab_Order.Last loop for E in reverse Elab_Order.First .. Elab_Order.Last loop
Unum := Elab_Order.Table (E); Unum := Elab_Order.Table (E);
...@@ -1954,7 +1960,7 @@ package body Bindgen is ...@@ -1954,7 +1960,7 @@ package body Bindgen is
if U.Unit_Kind /= 'p' or else U.Is_Generic then if U.Unit_Kind /= 'p' or else U.Is_Generic then
null; null;
-- That aren't an interface to a stand alone library -- .. that are not interfaces to a stand alone library
elsif U.SAL_Interface then elsif U.SAL_Interface then
null; null;
......
...@@ -4078,9 +4078,13 @@ package body Exp_Ch7 is ...@@ -4078,9 +4078,13 @@ package body Exp_Ch7 is
function Get_Global_Pool_For_Access_Type (T : Entity_Id) return Entity_Id is function Get_Global_Pool_For_Access_Type (T : Entity_Id) return Entity_Id is
begin begin
if Opt.True_VMS_Target -- Access types whose size is smaller than System.Address size can
and then Esize (T) = 32 -- exit only on VMS. We can't use the usual global pool which returns
then -- an object of type Address as truncation will make it invalid.
-- To handle this case, VMS has a dedicated global pool that returns
-- addresses that fit into 32 bit accesses.
if Opt.True_VMS_Target and then Esize (T) = 32 then
return RTE (RE_Global_Pool_32_Object); return RTE (RE_Global_Pool_32_Object);
else else
return RTE (RE_Global_Pool_Object); return RTE (RE_Global_Pool_Object);
......
...@@ -612,9 +612,9 @@ package body Make is ...@@ -612,9 +612,9 @@ package body Make is
-- when using project files. -- when using project files.
procedure Queue_Library_Project_Sources; procedure Queue_Library_Project_Sources;
-- For all library project, if the library file does not exist, -- For all library project, if the library file does not exist, put all the
-- put all the project sources in the queue, and flag the project -- project sources in the queue, and flag the project so that the library
-- so that the library is generated. -- is generated.
procedure Compute_Switches_For_Main procedure Compute_Switches_For_Main
(Main_Source_File : in out File_Name_Type; (Main_Source_File : in out File_Name_Type;
...@@ -641,12 +641,15 @@ package body Make is ...@@ -641,12 +641,15 @@ package body Make is
Executable : File_Name_Type := No_File; Executable : File_Name_Type := No_File;
Is_Last_Main : Boolean; Is_Last_Main : Boolean;
Stop_Compile : out Boolean); Stop_Compile : out Boolean);
-- Build all source files for a given main file. -- Build all source files for a given main file
-- Current_Main_Index, if not zero, the index of the current main unit in --
-- its source file. -- Current_Main_Index, if not zero, is the index of the current main unit
-- in its source file.
--
-- Stand_Alone_Libraries is set to True when there are Stand-Alone -- Stand_Alone_Libraries is set to True when there are Stand-Alone
-- Libraries, so that gnatbind is invoked with the -F switch to force -- Libraries, so that gnatbind is invoked with the -F switch to force
-- checking of elaboration flags. -- checking of elaboration flags.
--
-- Stop_Compile is set to true if we should not try to compile any more -- Stop_Compile is set to true if we should not try to compile any more
-- of the main units -- of the main units
...@@ -669,9 +672,8 @@ package body Make is ...@@ -669,9 +672,8 @@ package body Make is
(Non_Std_Executable : Boolean := False; (Non_Std_Executable : Boolean := False;
Executable : File_Name_Type := No_File; Executable : File_Name_Type := No_File;
Main_ALI_File : File_Name_Type); Main_ALI_File : File_Name_Type);
-- Perform the link of a single executable. -- Perform the link of a single executable. The ali file corresponds
-- The ali file corresponding to Main_Source_File. -- to Main_ALI_File. Executable is the file name of an executable.
-- Executable is the file name of an executable.
-- Non_Std_Executable is set to True when there is a possibility that -- Non_Std_Executable is set to True when there is a possibility that
-- the linker will not choose the correct executable file name. -- the linker will not choose the correct executable file name.
...@@ -4178,6 +4180,7 @@ package body Make is ...@@ -4178,6 +4180,7 @@ package body Make is
Proj2 : Project_Id; Proj2 : Project_Id;
Depth : Natural; Depth : Natural;
Proj1 : Project_List; Proj1 : Project_List;
begin begin
if not Run_Path_Option then if not Run_Path_Option then
Linker_Switches.Increment_Last; Linker_Switches.Increment_Last;
...@@ -4205,8 +4208,8 @@ package body Make is ...@@ -4205,8 +4208,8 @@ package body Make is
Library_Projs.Increment_Last; Library_Projs.Increment_Last;
Current := Library_Projs.Last; Current := Library_Projs.Last;
-- Any project with a greater depth should be -- Any project with a greater depth should be after this
-- after this project in the list. -- project in the list.
while Current > 1 loop while Current > 1 loop
Proj2 := Library_Projs.Table (Current - 1); Proj2 := Library_Projs.Table (Current - 1);
...@@ -4217,8 +4220,8 @@ package body Make is ...@@ -4217,8 +4220,8 @@ package body Make is
Library_Projs.Table (Current) := Proj1.Project; Library_Projs.Table (Current) := Proj1.Project;
-- If it is not a static library and path option -- If it is not a static library and path option is set, add
-- is set, add it to the Library_Paths table. -- it to the Library_Paths table.
if Proj1.Project.Library_Kind /= Static if Proj1.Project.Library_Kind /= Static
and then Proj1.Project.Extended_By = No_Project and then Proj1.Project.Extended_By = No_Project
...@@ -4280,11 +4283,10 @@ package body Make is ...@@ -4280,11 +4283,10 @@ package body Make is
if Libraries_Present then if Libraries_Present then
-- If Path_Option is not null, create the switch -- If Path_Option is not null, create the switch ("-Wl,-rpath,"
-- ("-Wl,-rpath," or equivalent) with all the non-static -- or equivalent) with all the non-static library dirs plus the
-- library dirs plus the standard GNAT library dir. -- standard GNAT library dir. We do that only if Run_Path_Option
-- We do that only if Run_Path_Option is True -- is True (not disabled by -R switch).
-- (not disabled by -R switch).
if Run_Path_Option and then Path_Option /= null then if Run_Path_Option and then Path_Option /= null then
declare declare
...@@ -4305,8 +4307,7 @@ package body Make is ...@@ -4305,8 +4307,7 @@ package body Make is
Library_Paths.First .. Library_Paths.Last Library_Paths.First .. Library_Paths.Last
loop loop
Linker_Switches.Increment_Last; Linker_Switches.Increment_Last;
Linker_Switches.Table Linker_Switches.Table (Linker_Switches.Last) :=
(Linker_Switches.Last) :=
new String' new String'
(Path_Option.all & (Path_Option.all &
Library_Paths.Table (Index).all); Library_Paths.Table (Index).all);
...@@ -4315,10 +4316,8 @@ package body Make is ...@@ -4315,10 +4316,8 @@ package body Make is
-- One switch for the standard GNAT library dir -- One switch for the standard GNAT library dir
Linker_Switches.Increment_Last; Linker_Switches.Increment_Last;
Linker_Switches.Table Linker_Switches.Table (Linker_Switches.Last) :=
(Linker_Switches.Last) := new String'(Path_Option.all & MLib.Utl.Lib_Directory);
new String'
(Path_Option.all & MLib.Utl.Lib_Directory);
else else
-- We are going to create one switch of the form -- We are going to create one switch of the form
...@@ -4327,12 +4326,11 @@ package body Make is ...@@ -4327,12 +4326,11 @@ package body Make is
for Index in for Index in
Library_Paths.First .. Library_Paths.Last Library_Paths.First .. Library_Paths.Last
loop loop
-- Add the length of the library dir plus one -- Add the length of the library dir plus one for the
-- for the directory separator. -- directory separator.
Length := Length :=
Length + Length + Library_Paths.Table (Index)'Length + 1;
Library_Paths.Table (Index)'Length + 1;
end loop; end loop;
-- Finally, add the length of the standard GNAT -- Finally, add the length of the standard GNAT
...@@ -4340,8 +4338,7 @@ package body Make is ...@@ -4340,8 +4338,7 @@ package body Make is
Length := Length + MLib.Utl.Lib_Directory'Length; Length := Length + MLib.Utl.Lib_Directory'Length;
Option := new String (1 .. Length); Option := new String (1 .. Length);
Option (1 .. Path_Option'Length) := Option (1 .. Path_Option'Length) := Path_Option.all;
Path_Option.all;
Current := Path_Option'Length; Current := Path_Option'Length;
-- Put each library dir followed by a dir -- Put each library dir followed by a dir
...@@ -4352,12 +4349,10 @@ package body Make is ...@@ -4352,12 +4349,10 @@ package body Make is
loop loop
Option Option
(Current + 1 .. (Current + 1 ..
Current + Current + Library_Paths.Table (Index)'Length) :=
Library_Paths.Table (Index)'Length) :=
Library_Paths.Table (Index).all; Library_Paths.Table (Index).all;
Current := Current :=
Current + Current + Library_Paths.Table (Index)'Length + 1;
Library_Paths.Table (Index)'Length + 1;
Option (Current) := Path_Separator; Option (Current) := Path_Separator;
end loop; end loop;
...@@ -4371,8 +4366,7 @@ package body Make is ...@@ -4371,8 +4366,7 @@ package body Make is
-- And add the switch to the linker switches -- And add the switch to the linker switches
Linker_Switches.Increment_Last; Linker_Switches.Increment_Last;
Linker_Switches.Table (Linker_Switches.Last) := Linker_Switches.Table (Linker_Switches.Last) := Option;
Option;
end if; end if;
end; end;
end if; end if;
...@@ -4387,8 +4381,8 @@ package body Make is ...@@ -4387,8 +4381,8 @@ package body Make is
Including_Libraries => False, Including_Libraries => False,
Include_Path => False); Include_Path => False);
-- Check for attributes Linker'Linker_Options in projects -- Check for attributes Linker'Linker_Options in projects other than
-- other than the main project -- the main project
declare declare
Linker_Options : constant String_List := Linker_Options : constant String_List :=
...@@ -4434,16 +4428,15 @@ package body Make is ...@@ -4434,16 +4428,15 @@ package body Make is
Skip := True; Skip := True;
-- Here we capture and duplicate the linker argument. We -- Here we capture and duplicate the linker argument. We
-- need to do the duplication since the arguments will -- need to do the duplication since the arguments will get
-- get normalized. Not doing so will result in calling -- normalized. Not doing so will result in calling normalized
-- normalized two times for the same set of arguments if -- two times for the same set of arguments if gnatmake is
-- gnatmake is passed multiple mains. This can result in -- passed multiple mains. This can result in the wrong argument
-- the wrong argument being passed to the linker. -- being passed to the linker.
else else
Last_Arg := Last_Arg + 1; Last_Arg := Last_Arg + 1;
Args (Last_Arg) := Args (Last_Arg) := new String'(Linker_Switches.Table (J).all);
new String'(Linker_Switches.Table (J).all);
end if; end if;
end loop; end loop;
...@@ -4468,8 +4461,7 @@ package body Make is ...@@ -4468,8 +4461,7 @@ package body Make is
if Success then if Success then
Successful_Links.Increment_Last; Successful_Links.Increment_Last;
Successful_Links.Table (Successful_Links.Last) := Successful_Links.Table (Successful_Links.Last) := Main_ALI_File;
Main_ALI_File;
elsif Osint.Number_Of_Files = 1 elsif Osint.Number_Of_Files = 1
or else not Keep_Going or else not Keep_Going
...@@ -4485,8 +4477,7 @@ package body Make is ...@@ -4485,8 +4477,7 @@ package body Make is
end if; end if;
Failed_Links.Increment_Last; Failed_Links.Increment_Last;
Failed_Links.Table (Failed_Links.Last) := Failed_Links.Table (Failed_Links.Last) := Main_ALI_File;
Main_ALI_File;
end if; end if;
end; end;
end; end;
...@@ -4502,8 +4493,7 @@ package body Make is ...@@ -4502,8 +4493,7 @@ package body Make is
(Stand_Alone_Libraries : Boolean := False; (Stand_Alone_Libraries : Boolean := False;
Main_ALI_File : File_Name_Type) Main_ALI_File : File_Name_Type)
is is
Args : Argument_List Args : Argument_List (Binder_Switches.First .. Binder_Switches.Last + 2);
(Binder_Switches.First .. Binder_Switches.Last + 2);
-- The arguments for the invocation of gnatbind -- The arguments for the invocation of gnatbind
Last_Arg : Natural := Binder_Switches.Last; Last_Arg : Natural := Binder_Switches.Last;
...@@ -4519,10 +4509,10 @@ package body Make is ...@@ -4519,10 +4509,10 @@ package body Make is
-- The path name of the mapping file -- The path name of the mapping file
begin begin
-- Check if there are shared libraries, so that gnatbind is -- Check if there are shared libraries, so that gnatbind is called with
-- called with -shared. Check also if gnatbind is called with -- -shared. Check also if gnatbind is called with -shared, so that
-- -shared, so that gnatlink is called with -shared-libgcc -- gnatlink is called with -shared-libgcc ensuring that the shared
-- ensuring that the shared version of libgcc will be used. -- version of libgcc will be used.
if Main_Project /= No_Project if Main_Project /= No_Project
and then MLib.Tgt.Support_For_Libraries /= Prj.None and then MLib.Tgt.Support_For_Libraries /= Prj.None
...@@ -4536,6 +4526,7 @@ package body Make is ...@@ -4536,6 +4526,7 @@ package body Make is
Bind_Shared := Shared_Switch'Access; Bind_Shared := Shared_Switch'Access;
exit; exit;
end if; end if;
Proj := Proj.Next; Proj := Proj.Next;
end loop; end loop;
end if; end if;
...@@ -4605,8 +4596,7 @@ package body Make is ...@@ -4605,8 +4596,7 @@ package body Make is
-- Delete the temporary mapping file if one was created -- Delete the temporary mapping file if one was created
if Mapping_Path /= No_Path then if Mapping_Path /= No_Path then
Delete_Temporary_File Delete_Temporary_File (Project_Tree.Shared, Mapping_Path);
(Project_Tree.Shared, Mapping_Path);
end if; end if;
-- And reraise the exception -- And reraise the exception
...@@ -4737,8 +4727,8 @@ package body Make is ...@@ -4737,8 +4727,8 @@ package body Make is
Proj1 := Proj1.Next; Proj1 := Proj1.Next;
end loop; end loop;
-- Reset the flags Need_To_Build_Lib for the next main, -- Reset the flags Need_To_Build_Lib for the next main, to avoid
-- to avoid rebuilding libraries uselessly. -- rebuilding libraries uselessly.
Proj1 := Project_Tree.Projects; Proj1 := Project_Tree.Projects;
while Proj1 /= null loop while Proj1 /= null loop
...@@ -4840,7 +4830,7 @@ package body Make is ...@@ -4840,7 +4830,7 @@ package body Make is
and then (Do_Bind_Step and then (Do_Bind_Step
or Unique_Compile_All_Projects or Unique_Compile_All_Projects
or not Compile_Only) or not Compile_Only)
and then (Do_Link_Step or else Is_Last_Main) and then (Do_Link_Step or Is_Last_Main)
then then
Library_Phase Library_Phase
(Stand_Alone_Libraries => Stand_Alone_Libraries, (Stand_Alone_Libraries => Stand_Alone_Libraries,
...@@ -4864,9 +4854,7 @@ package body Make is ...@@ -4864,9 +4854,7 @@ package body Make is
then then
Inform (Msg => "objects up to date."); Inform (Msg => "objects up to date.");
elsif Do_Not_Execute elsif Do_Not_Execute and then First_Compiled_File /= No_File then
and then First_Compiled_File /= No_File
then
Write_Name (First_Compiled_File); Write_Name (First_Compiled_File);
Write_Eol; Write_Eol;
end if; end if;
...@@ -4886,9 +4874,9 @@ package body Make is ...@@ -4886,9 +4874,9 @@ package body Make is
or List_Dependencies or List_Dependencies
or not Do_Bind_Step or not Do_Bind_Step
or not Is_Main_Unit) or not Is_Main_Unit)
and then not No_Main_Subprogram and not No_Main_Subprogram
and then not Build_Bind_And_Link_Full_Project) and not Build_Bind_And_Link_Full_Project)
or else Unique_Compile or Unique_Compile
then then
Stop_Compile := True; Stop_Compile := True;
return; return;
...@@ -4905,17 +4893,13 @@ package body Make is ...@@ -4905,17 +4893,13 @@ package body Make is
Executable_Stamp := File_Stamp (Executable); Executable_Stamp := File_Stamp (Executable);
if not Executable_Obsolete then if not Executable_Obsolete then
Executable_Obsolete := Executable_Obsolete := Youngest_Obj_Stamp > Executable_Stamp;
Youngest_Obj_Stamp > Executable_Stamp;
end if; end if;
if not Executable_Obsolete then if not Executable_Obsolete then
for Index in reverse 1 .. Dependencies.Last loop for Index in reverse 1 .. Dependencies.Last loop
if Is_In_Obsoleted if Is_In_Obsoleted (Dependencies.Table (Index).Depends_On) then
(Dependencies.Table (Index).Depends_On) Enter_Into_Obsoleted (Dependencies.Table (Index).This);
then
Enter_Into_Obsoleted
(Dependencies.Table (Index).This);
end if; end if;
end loop; end loop;
...@@ -4940,9 +4924,7 @@ package body Make is ...@@ -4940,9 +4924,7 @@ package body Make is
-- executable: there may be an externally built library -- executable: there may be an externally built library
-- file that has been modified. -- file that has been modified.
if not Executable_Obsolete if not Executable_Obsolete and then Main_Project /= No_Project then
and then Main_Project /= No_Project
then
declare declare
Proj1 : Project_List; Proj1 : Project_List;
...@@ -4950,8 +4932,7 @@ package body Make is ...@@ -4950,8 +4932,7 @@ package body Make is
Proj1 := Project_Tree.Projects; Proj1 := Project_Tree.Projects;
while Proj1 /= null loop while Proj1 /= null loop
if Proj1.Project.Library if Proj1.Project.Library
and then and then Proj1.Project.Library_TS > Executable_Stamp
Proj1.Project.Library_TS > Executable_Stamp
then then
Executable_Obsolete := True; Executable_Obsolete := True;
Youngest_Obj_Stamp := Proj1.Project.Library_TS; Youngest_Obj_Stamp := Proj1.Project.Library_TS;
...@@ -5027,7 +5008,6 @@ package body Make is ...@@ -5027,7 +5008,6 @@ package body Make is
Default_Switches_Array : Array_Id; Default_Switches_Array : Array_Id;
begin begin
-- If there is a package Builder in the main project file, add -- If there is a package Builder in the main project file, add
-- the switches from it. -- the switches from it.
...@@ -5041,12 +5021,13 @@ package body Make is ...@@ -5041,12 +5021,13 @@ package body Make is
Default_Switches_Array := Default_Switches_Array :=
Project_Tree.Shared.Packages.Table (Builder_Package).Decl.Arrays; Project_Tree.Shared.Packages.Table (Builder_Package).Decl.Arrays;
while Default_Switches_Array /= No_Array and then while Default_Switches_Array /= No_Array
Project_Tree.Shared.Arrays.Table (Default_Switches_Array).Name and then
/= Name_Default_Switches Project_Tree.Shared.Arrays.Table (Default_Switches_Array).Name /=
Name_Default_Switches
loop loop
Default_Switches_Array := Project_Tree.Shared.Arrays.Table Default_Switches_Array :=
(Default_Switches_Array).Next; Project_Tree.Shared.Arrays.Table (Default_Switches_Array).Next;
end loop; end loop;
if Global_Compilation_Array /= No_Array_Element and then if Global_Compilation_Array /= No_Array_Element and then
...@@ -5060,10 +5041,9 @@ package body Make is ...@@ -5060,10 +5041,9 @@ package body Make is
Make_Failed ("*** illegal combination of Builder attributes"); Make_Failed ("*** illegal combination of Builder attributes");
end if; end if;
-- If there is only one main, we attempt to get the gnatmake -- If there is only one main, we attempt to get the gnatmake switches
-- switches for this main (if any). If there are no specific -- for this main (if any). If there are no specific switch for this
-- switch for this particular main, get the general gnatmake -- particular main, get the general gnatmake switches (if any).
-- switches (if any).
if Osint.Number_Of_Files = 1 then if Osint.Number_Of_Files = 1 then
if Verbose_Mode then if Verbose_Mode then
...@@ -5083,28 +5063,25 @@ package body Make is ...@@ -5083,28 +5063,25 @@ package body Make is
Global_Compilation_Array = No_Array_Element); Global_Compilation_Array = No_Array_Element);
else else
-- If there are several mains, we always get the general -- If there are several mains, we always get the general gnatmake
-- gnatmake switches (if any). -- switches (if any).
-- Warn the user, if necessary, so that he is not surprised -- Warn the user, if necessary, so that he is not surprised that
-- that specific switches are not taken into account. -- specific switches are not taken into account.
declare declare
Defaults : constant Variable_Value := Defaults : constant Variable_Value :=
Prj.Util.Value_Of Prj.Util.Value_Of
(Name => Name_Ada, (Name => Name_Ada,
Index => 0, Index => 0,
Attribute_Or_Array_Name => Attribute_Or_Array_Name => Name_Default_Switches,
Name_Default_Switches, In_Package => Builder_Package,
In_Package =>
Builder_Package,
Shared => Project_Tree.Shared); Shared => Project_Tree.Shared);
Switches : constant Array_Element_Id := Switches : constant Array_Element_Id :=
Prj.Util.Value_Of Prj.Util.Value_Of
(Name => Name_Switches, (Name => Name_Switches,
In_Arrays => In_Arrays => Project_Tree.Shared.Packages.Table
Project_Tree.Shared.Packages.Table
(Builder_Package).Decl.Arrays, (Builder_Package).Decl.Arrays,
Shared => Project_Tree.Shared); Shared => Project_Tree.Shared);
...@@ -5112,8 +5089,7 @@ package body Make is ...@@ -5112,8 +5089,7 @@ package body Make is
Prj.Util.Value_Of Prj.Util.Value_Of
(Name => All_Other_Names, (Name => All_Other_Names,
Index => 0, Index => 0,
Attribute_Or_Array_Name Attribute_Or_Array_Name => Name_Switches,
=> Name_Switches,
In_Package => Builder_Package, In_Package => Builder_Package,
Shared => Project_Tree.Shared); Shared => Project_Tree.Shared);
...@@ -5189,16 +5165,13 @@ package body Make is ...@@ -5189,16 +5165,13 @@ package body Make is
if Global_Compilation_Switches /= Nil_Variable_Value if Global_Compilation_Switches /= Nil_Variable_Value
and then not Global_Compilation_Switches.Default and then not Global_Compilation_Switches.Default
then then
-- We have found attribute -- We have found attribute Global_Compilation_Switches
-- Global_Compilation_Switches ("Ada"): put the -- ("Ada"): put the switches in the appropriate table.
-- switches in the appropriate table.
List := Global_Compilation_Switches.Values; List := Global_Compilation_Switches.Values;
while List /= Nil_String loop while List /= Nil_String loop
Elem := Elem :=
Project_Tree.Shared.String_Elements.Table Project_Tree.Shared.String_Elements.Table (List);
(List);
if Elem.Value /= No_Name then if Elem.Value /= No_Name then
Add_Switch Add_Switch
...@@ -5237,8 +5210,7 @@ package body Make is ...@@ -5237,8 +5210,7 @@ package body Make is
begin begin
if not Is_Absolute_Path (Exec_File_Name) then if not Is_Absolute_Path (Exec_File_Name) then
Get_Name_String Get_Name_String (Main_Project.Exec_Directory.Display_Name);
(Main_Project.Exec_Directory.Display_Name);
Add_Str_To_Name_Buffer (Exec_File_Name); Add_Str_To_Name_Buffer (Exec_File_Name);
Saved_Linker_Switches.Table (J + 1) := Saved_Linker_Switches.Table (J + 1) :=
new String'(Name_Buffer (1 .. Name_Len)); new String'(Name_Buffer (1 .. Name_Len));
...@@ -5275,7 +5247,8 @@ package body Make is ...@@ -5275,7 +5247,8 @@ package body Make is
for J in 1 .. Linker_Switches.Last loop for J in 1 .. Linker_Switches.Last loop
Test_If_Relative_Path Test_If_Relative_Path
(Linker_Switches.Table (J), Parent => Dir_Path, (Linker_Switches.Table (J),
Parent => Dir_Path,
Do_Fail => Make_Failed'Access); Do_Fail => Make_Failed'Access);
end loop; end loop;
...@@ -5328,8 +5301,7 @@ package body Make is ...@@ -5328,8 +5301,7 @@ package body Make is
if Proj.Project.Need_To_Build_Lib then if Proj.Project.Need_To_Build_Lib then
-- If there is no object directory, then it will be -- If there is no object directory, then it will be
-- impossible to build the library. So fail -- impossible to build the library, so fail immediately.
-- immediately.
if Proj.Project.Object_Directory = if Proj.Project.Object_Directory =
No_Path_Information No_Path_Information
...@@ -5409,11 +5381,11 @@ package body Make is ...@@ -5409,11 +5381,11 @@ package body Make is
Executable := Executable_Name (Strip_Suffix (Main_Source_File)); Executable := Executable_Name (Strip_Suffix (Main_Source_File));
else else
-- If we are using a project file, we attempt to remove the -- If we are using a project file, we attempt to remove the body
-- body (or spec) termination of the main subprogram. We find -- (or spec) termination of the main subprogram. We find it the
-- it the naming scheme of the project file. This avoids -- naming scheme of the project file. This avoids generating an
-- generating an executable "main.2" for a main subprogram -- executable "main.2" for a main subprogram "main.2.ada", when
-- "main.2.ada", when the body termination is ".2.ada". -- the body termination is ".2.ada".
Executable := Executable :=
Prj.Util.Executable_Of Prj.Util.Executable_Of
...@@ -5462,8 +5434,7 @@ package body Make is ...@@ -5462,8 +5434,7 @@ package body Make is
(Name => Main_Source_File_Name, (Name => Main_Source_File_Name,
Project => Main_Project, Project => Main_Project,
In_Tree => Project_Tree, In_Tree => Project_Tree,
Main_Project_Only => Main_Project_Only => not Unique_Compile);
not Unique_Compile);
The_Packages : constant Package_Id := Main_Project.Decl.Packages; The_Packages : constant Package_Id := Main_Project.Decl.Packages;
...@@ -5528,24 +5499,24 @@ package body Make is ...@@ -5528,24 +5499,24 @@ package body Make is
Resolve_Relative_Names_In_Switches Resolve_Relative_Names_In_Switches
(Current_Work_Dir => Current_Work_Dir); (Current_Work_Dir => Current_Work_Dir);
-- Record the current last switch index for table -- Record current last switch index for tables Binder_Switches
-- Binder_Switches and Linker_Switches, so that these tables -- and Linker_Switches, so that these tables may be reset
-- may be reset before each main, before adding switches from -- before each main, before adding switches from the project
-- the project file and from the command line. -- file and from the command line.
Last_Binder_Switch := Binder_Switches.Last; Last_Binder_Switch := Binder_Switches.Last;
Last_Linker_Switch := Linker_Switches.Last; Last_Linker_Switch := Linker_Switches.Last;
else else
-- Reset the tables Binder_Switches and Linker_Switches -- Reset the tables Binder_Switches and Linker_Switches
Binder_Switches.Set_Last (Last_Binder_Switch); Binder_Switches.Set_Last (Last_Binder_Switch);
Linker_Switches.Set_Last (Last_Linker_Switch); Linker_Switches.Set_Last (Last_Linker_Switch);
end if; end if;
-- We now deal with the binder and linker switches. -- We now deal with the binder and linker switches. If no project
-- If no project file is used, there is nothing to do -- file is used, there is nothing to do because the binder and
-- because the binder and linker switches are the same -- linker switches are the same for all mains.
-- for all mains.
-- Add binder switches from the project file for the first main -- Add binder switches from the project file for the first main
...@@ -5583,10 +5554,10 @@ package body Make is ...@@ -5583,10 +5554,10 @@ package body Make is
Program => Linker); Program => Linker);
end if; end if;
-- As we are using a project file, for relative paths we add -- As we are using a project file, for relative paths we add the
-- the current working directory for any relative path on -- current working directory for any relative path on the command
-- the command line and the project directory, for any -- line and the project directory, for any relative path in the
-- relative path in the project file. -- project file.
declare declare
Dir_Path : constant String := Dir_Path : constant String :=
...@@ -5610,7 +5581,9 @@ package body Make is ...@@ -5610,7 +5581,9 @@ package body Make is
else else
if not Compute_Builder then if not Compute_Builder then
-- Reset the tables Binder_Switches and Linker_Switches -- Reset the tables Binder_Switches and Linker_Switches
Binder_Switches.Set_Last (Last_Binder_Switch); Binder_Switches.Set_Last (Last_Binder_Switch);
Linker_Switches.Set_Last (Last_Linker_Switch); Linker_Switches.Set_Last (Last_Linker_Switch);
end if; end if;
...@@ -5622,11 +5595,10 @@ package body Make is ...@@ -5622,11 +5595,10 @@ package body Make is
Display_Commands (not Quiet_Output); Display_Commands (not Quiet_Output);
end if; end if;
-- We now put in the Binder_Switches and Linker_Switches tables, -- We now put in the Binder_Switches and Linker_Switches tables, the
-- the binder and linker switches of the command line that have -- binder and linker switches of the command line that have been put in
-- been put in the Saved_ tables. If a project file was used, then -- the Saved_ tables. If a project file was used, then the command line
-- the command line switches will follow the project file -- switches will follow the project file switches.
-- switches.
for J in 1 .. Saved_Binder_Switches.Last loop for J in 1 .. Saved_Binder_Switches.Last loop
Add_Switch Add_Switch
...@@ -5727,6 +5699,7 @@ package body Make is ...@@ -5727,6 +5699,7 @@ package body Make is
-- Special case when switch -B was specified -- Special case when switch -B was specified
if Build_Bind_And_Link_Full_Project then if Build_Bind_And_Link_Full_Project then
-- When switch -B is specified, there must be a project file -- When switch -B is specified, there must be a project file
if Main_Project = No_Project then if Main_Project = No_Project then
...@@ -5775,6 +5748,7 @@ package body Make is ...@@ -5775,6 +5748,7 @@ package body Make is
Make_Failed ("cannot specify several mains with a multi-unit index"); Make_Failed ("cannot specify several mains with a multi-unit index");
elsif Main_Project /= No_Project then elsif Main_Project /= No_Project then
-- If the main project file is a library project file, main(s) cannot -- If the main project file is a library project file, main(s) cannot
-- be specified on the command line. -- be specified on the command line.
...@@ -5807,8 +5781,9 @@ package body Make is ...@@ -5807,8 +5781,9 @@ package body Make is
if Value = Prj.Nil_String or else Unique_Compile then if Value = Prj.Nil_String or else Unique_Compile then
if (not Make_Steps) or else Compile_Only if not Make_Steps
or else not Main_Project.Library or Compile_Only
or not Main_Project.Library
then then
-- First make sure that the binder and the linker will -- First make sure that the binder and the linker will
-- not be invoked. -- not be invoked.
...@@ -5893,15 +5868,16 @@ package body Make is ...@@ -5893,15 +5868,16 @@ package body Make is
declare declare
Main_Name : constant String := Main_Name : constant String :=
Get_Name_String Get_Name_String
(Project_Tree.Shared.String_Elements.Table (Project_Tree.Shared.
(Value).Value); String_Elements.
Table (Value).Value);
Proj : constant Project_Id := Proj : constant Project_Id :=
Prj.Env.Project_Of Prj.Env.Project_Of
(Main_Name, Main_Project, Project_Tree); (Main_Name, Main_Project, Project_Tree);
begin
begin
if Proj = Main_Project then if Proj = Main_Project then
At_Least_One_Main := True; At_Least_One_Main := True;
Osint.Add_File Osint.Add_File
(Get_Name_String (Get_Name_String
...@@ -5950,9 +5926,7 @@ package body Make is ...@@ -5950,9 +5926,7 @@ package body Make is
end if; end if;
if Osint.Number_Of_Files = 0 then if Osint.Number_Of_Files = 0 then
if Main_Project /= No_Project if Main_Project /= No_Project and then Main_Project.Library then
and then Main_Project.Library
then
if Do_Bind_Step if Do_Bind_Step
and then not Main_Project.Standalone_Library and then not Main_Project.Standalone_Library
then then
...@@ -6050,19 +6024,18 @@ package body Make is ...@@ -6050,19 +6024,18 @@ package body Make is
if Main_Project /= No_Project then if Main_Project /= No_Project then
if Main_Project.Object_Directory /= No_Path_Information then if Main_Project.Object_Directory /= No_Path_Information then
-- Change current directory to object directory of main project -- Change current directory to object directory of main project
Project_Of_Current_Object_Directory := No_Project; Project_Of_Current_Object_Directory := No_Project;
Change_To_Object_Directory (Main_Project); Change_To_Object_Directory (Main_Project);
end if; end if;
-- Source file lookups should be cached for efficiency. -- Source file lookups should be cached for efficiency. Source files
-- Source files are not supposed to change. -- are not supposed to change.
Osint.Source_File_Data (Cache => True); Osint.Source_File_Data (Cache => True);
Osint.Add_Default_Search_Dirs; Osint.Add_Default_Search_Dirs;
Queue_Library_Project_Sources; Queue_Library_Project_Sources;
end if; end if;
...@@ -6183,8 +6156,10 @@ package body Make is ...@@ -6183,8 +6156,10 @@ package body Make is
declare declare
Data : Project_Compilation_Access; Data : Project_Compilation_Access;
Proj : Project_List := Project_Tree.Projects; Proj : Project_List;
begin begin
Proj := Project_Tree.Projects;
while Proj /= null loop while Proj /= null loop
Data := new Project_Compilation_Data' Data := new Project_Compilation_Data'
(Mapping_File_Names => new Temp_Path_Names (Mapping_File_Names => new Temp_Path_Names
...@@ -6726,6 +6701,7 @@ package body Make is ...@@ -6726,6 +6701,7 @@ package body Make is
-- We add the source directories and the object directories to the -- We add the source directories and the object directories to the
-- search paths. -- search paths.
-- ??? Why do we need these search directories, we already know the -- ??? Why do we need these search directories, we already know the
-- locations from parsing the project, except for the runtime which -- locations from parsing the project, except for the runtime which
-- has its own directories anyway -- has its own directories anyway
...@@ -6817,7 +6793,7 @@ package body Make is ...@@ -6817,7 +6793,7 @@ package body Make is
-- Start of processing for Insert_Project_Sources -- Start of processing for Insert_Project_Sources
begin begin
-- For all the sources in the project files, -- Loop through all the sources in the project files
Unit := Units_Htable.Get_First (Project_Tree.Units_HT); Unit := Units_Htable.Get_First (Project_Tree.Units_HT);
while Unit /= null loop while Unit /= null loop
......
...@@ -1350,11 +1350,14 @@ package body Makeutl is ...@@ -1350,11 +1350,14 @@ package body Makeutl is
Base_Main : String) return Prj.Source_Id Base_Main : String) return Prj.Source_Id
is is
Spec_Source : Prj.Source_Id := No_Source; Spec_Source : Prj.Source_Id := No_Source;
Source : Prj.Source_Id := No_Source; Source : Prj.Source_Id;
Project : Project_Id := Root_Project; Project : Project_Id;
Iter : Source_Iterator; Iter : Source_Iterator;
Suffix : File_Name_Type; Suffix : File_Name_Type;
begin begin
Source := No_Source;
Project := Root_Project;
while Source = No_Source while Source = No_Source
and then Project /= No_Project and then Project /= No_Project
loop loop
...@@ -1431,7 +1434,8 @@ package body Makeutl is ...@@ -1431,7 +1434,8 @@ package body Makeutl is
declare declare
File : Main_Info := Names.Table (J); File : Main_Info := Names.Table (J);
Main_Id : File_Name_Type := File.File; Main_Id : File_Name_Type := File.File;
Main : constant String := Get_Name_String (Main_Id); Main : constant String :=
Get_Name_String (Main_Id);
Base : constant String := Base_Name (Main); Base : constant String := Base_Name (Main);
Source : Prj.Source_Id := No_Source; Source : Prj.Source_Id := No_Source;
Is_Absolute : Boolean := False; Is_Absolute : Boolean := False;
...@@ -1504,15 +1508,19 @@ package body Makeutl is ...@@ -1504,15 +1508,19 @@ package body Makeutl is
end if; end if;
if Source = No_Source then if Source = No_Source then
-- Still not found ? Maybe we have a unit name
-- Still not found? Maybe we have a unit name
declare declare
Unit : constant Unit_Index := Unit : constant Unit_Index :=
Units_Htable.Get Units_Htable.Get
(File.Tree.Units_HT, Name_Id (Main_Id)); (File.Tree.Units_HT,
begin Name_Id (Main_Id));
begin
if Unit /= No_Unit_Index then if Unit /= No_Unit_Index then
Source := Unit.File_Names (Impl); Source := Unit.File_Names (Impl);
if Source = No_Source then if Source = No_Source then
Source := Unit.File_Names (Spec); Source := Unit.File_Names (Spec);
end if; end if;
...@@ -1527,9 +1535,7 @@ package body Makeutl is ...@@ -1527,9 +1535,7 @@ package body Makeutl is
-- to compile all the units from the same source -- to compile all the units from the same source
-- file. -- file.
if Source.Index /= 0 if Source.Index /= 0 and then File.Index = 0 then
and then File.Index = 0
then
Add_Multi_Unit_Sources (File.Tree, Source); Add_Multi_Unit_Sources (File.Tree, Source);
end if; end if;
...@@ -1564,8 +1570,7 @@ package body Makeutl is ...@@ -1564,8 +1570,7 @@ package body Makeutl is
Error_Msg_File_1 := Main_Id; Error_Msg_File_1 := Main_Id;
Error_Msg_Name_1 := Root_Project.Name; Error_Msg_Name_1 := Root_Project.Name;
Prj.Err.Error_Msg Prj.Err.Error_Msg
(Flags, (Flags, "{ is not a source of project %%",
"{ is not a source of project %%",
File.Location, Project); File.Location, Project);
end if; end if;
end if; end if;
...@@ -1832,8 +1837,10 @@ package body Makeutl is ...@@ -1832,8 +1837,10 @@ package body Makeutl is
elsif Sw'Length >= 4 elsif Sw'Length >= 4
and then (Sw (2 .. 3) = "aL" and then (Sw (2 .. 3) = "aL"
or else Sw (2 .. 3) = "aO" or else
or else Sw (2 .. 3) = "aI") Sw (2 .. 3) = "aO"
or else
Sw (2 .. 3) = "aI")
then then
Start := 4; Start := 4;
...@@ -1923,7 +1930,6 @@ package body Makeutl is ...@@ -1923,7 +1930,6 @@ package body Makeutl is
Start := Finish; Start := Finish;
Finish := Finish - 1; Finish := Finish - 1;
while Start >= 1 and then Name_Buffer (Start - 1) in '0' .. '9' loop while Start >= 1 and then Name_Buffer (Start - 1) in '0' .. '9' loop
Start := Start - 1; Start := Start - 1;
end loop; end loop;
...@@ -2644,6 +2650,7 @@ package body Makeutl is ...@@ -2644,6 +2650,7 @@ package body Makeutl is
Iter : Source_Iterator; Iter : Source_Iterator;
Source : Prj.Source_Id; Source : Prj.Source_Id;
begin begin
-- Nothing to do when "-u" was specified and some files were -- Nothing to do when "-u" was specified and some files were
-- specified on the command line -- specified on the command line
......
...@@ -2602,7 +2602,7 @@ package body Sem_Ch10 is ...@@ -2602,7 +2602,7 @@ package body Sem_Ch10 is
Par_Name := Entity (Pref); Par_Name := Entity (Pref);
end if; end if;
-- Guard against missing or misspelled child units. -- Guard against missing or misspelled child units
if Present (Par_Name) then if Present (Par_Name) then
Set_Entity_With_Style_Check (Pref, Par_Name); Set_Entity_With_Style_Check (Pref, Par_Name);
......
...@@ -4355,7 +4355,7 @@ package body Sem_Res is ...@@ -4355,7 +4355,7 @@ package body Sem_Res is
then then
Error_Msg_N Error_Msg_N
("cannot activate task before body seen?", N); ("cannot activate task before body seen?", N);
Error_Msg_N ("\Program_Error will be raised at run time", N); Error_Msg_N ("\Program_Error will be raised at run time?", N);
end if; end if;
end Resolve_Allocator; end Resolve_Allocator;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment