Commit b11cb5fd by Emmanuel Briot Committed by Arnaud Charlet

make.adb, [...] (Library_File_Stamp): Removed, since unused.

2009-10-30  Emmanuel Briot  <briot@adacore.com>

	* make.adb, osint.adb, osint.ads (Library_File_Stamp): Removed, since
	unused.
	(Read_Library_Info_From_Full): New subprogram.

From-SVN: r153746
parent 1a163c46
2009-10-30 Emmanuel Briot <briot@adacore.com>
* make.adb, osint.adb, osint.ads (Library_File_Stamp): Removed, since
unused.
(Read_Library_Info_From_Full): New subprogram.
2009-10-30 Robert Dewar <dewar@adacore.com> 2009-10-30 Robert Dewar <dewar@adacore.com>
* a-tideio.adb: Minor reformatting * a-tideio.adb: Minor reformatting
......
...@@ -740,6 +740,7 @@ package body Make is ...@@ -740,6 +740,7 @@ package body Make is
Is_Main_Source : Boolean; Is_Main_Source : Boolean;
The_Args : Argument_List; The_Args : Argument_List;
Lib_File : File_Name_Type; Lib_File : File_Name_Type;
Full_Lib_File : File_Name_Type;
Read_Only : Boolean; Read_Only : Boolean;
ALI : out ALI_Id; ALI : out ALI_Id;
O_File : out File_Name_Type; O_File : out File_Name_Type;
...@@ -750,6 +751,8 @@ package body Make is ...@@ -750,6 +751,8 @@ package body Make is
-- ALI is the ALI_Id corresponding to Lib_File. If Lib_File in not -- ALI is the ALI_Id corresponding to Lib_File. If Lib_File in not
-- up-to-date, then the corresponding source file needs to be recompiled. -- up-to-date, then the corresponding source file needs to be recompiled.
-- In this case ALI = No_ALI_Id. -- In this case ALI = No_ALI_Id.
-- Full_Lib_File must be the result of calling Osint.Full_Lib_File_Name on
-- Lib_File. Precomputing it saves system calls.
procedure Check_Linker_Options procedure Check_Linker_Options
(E_Stamp : Time_Stamp_Type; (E_Stamp : Time_Stamp_Type;
...@@ -1414,6 +1417,7 @@ package body Make is ...@@ -1414,6 +1417,7 @@ package body Make is
Is_Main_Source : Boolean; Is_Main_Source : Boolean;
The_Args : Argument_List; The_Args : Argument_List;
Lib_File : File_Name_Type; Lib_File : File_Name_Type;
Full_Lib_File : File_Name_Type;
Read_Only : Boolean; Read_Only : Boolean;
ALI : out ALI_Id; ALI : out ALI_Id;
O_File : out File_Name_Type; O_File : out File_Name_Type;
...@@ -1523,9 +1527,6 @@ package body Make is ...@@ -1523,9 +1527,6 @@ package body Make is
-- Data declarations for Check -- -- Data declarations for Check --
--------------------------------- ---------------------------------
Full_Lib_File : File_Name_Type;
-- Full name of current library file
Full_Obj_File : File_Name_Type; Full_Obj_File : File_Name_Type;
-- Full name of the object file corresponding to Lib_File -- Full name of the object file corresponding to Lib_File
...@@ -1576,15 +1577,14 @@ package body Make is ...@@ -1576,15 +1577,14 @@ package body Make is
Check_Object_Consistency; Check_Object_Consistency;
begin begin
Check_Object_Consistency := False; Check_Object_Consistency := False;
Text := Read_Library_Info (Lib_File); Text := Read_Library_Info_From_Full (Full_Lib_File);
Check_Object_Consistency := Saved_Check_Object_Consistency; Check_Object_Consistency := Saved_Check_Object_Consistency;
end; end;
else else
Text := Read_Library_Info (Lib_File); Text := Read_Library_Info_From_Full (Full_Lib_File);
end if; end if;
Full_Lib_File := Full_Library_Info_Name;
Full_Obj_File := Full_Object_File_Name; Full_Obj_File := Full_Object_File_Name;
Lib_Stamp := Current_Library_File_Stamp; Lib_Stamp := Current_Library_File_Stamp;
Obj_Stamp := Current_Object_File_Stamp; Obj_Stamp := Current_Object_File_Stamp;
...@@ -3144,6 +3144,8 @@ package body Make is ...@@ -3144,6 +3144,8 @@ package body Make is
if not Empty_Q and then Outstanding_Compiles < Max_Process then if not Empty_Q and then Outstanding_Compiles < Max_Process then
declare declare
In_Lib_Dir : Boolean;
Source_Index : Int; Source_Index : Int;
-- Index of the current unit in the current source file -- Index of the current unit in the current source file
...@@ -3152,6 +3154,12 @@ package body Make is ...@@ -3152,6 +3154,12 @@ package body Make is
Full_Source_File := Osint.Full_Source_Name (Source_File); Full_Source_File := Osint.Full_Source_Name (Source_File);
Lib_File := Osint.Lib_File_Name Lib_File := Osint.Lib_File_Name
(Source_File, Source_Index); (Source_File, Source_Index);
-- Compute the location of Lib_File (involves system calls)
-- ??? Can we compute at the same time if the file is
-- writable, which would save a system call on some systems
-- (when calling Is_Readonly_Library below)
Full_Lib_File := Osint.Full_Lib_File_Name (Lib_File); Full_Lib_File := Osint.Full_Lib_File_Name (Lib_File);
-- If this source has already been compiled, the executable is -- If this source has already been compiled, the executable is
...@@ -3161,11 +3169,22 @@ package body Make is ...@@ -3161,11 +3169,22 @@ package body Make is
Executable_Obsolete := True; Executable_Obsolete := True;
end if; end if;
In_Lib_Dir := Full_Lib_File /= No_File
and then In_Ada_Lib_Dir (Full_Lib_File);
-- Since the following requires a system call, we precompute it
-- when needed
if not In_Lib_Dir then
Read_Only :=
Full_Lib_File /= No_File
and then not Check_Readonly_Files
and then Is_Readonly_Library (Full_Lib_File);
end if;
-- If the library file is an Ada library skip it -- If the library file is an Ada library skip it
if Full_Lib_File /= No_File if In_Lib_Dir then
and then In_Ada_Lib_Dir (Full_Lib_File)
then
Verbose_Msg Verbose_Msg
(Lib_File, (Lib_File,
"is in an Ada library", "is in an Ada library",
...@@ -3178,9 +3197,7 @@ package body Make is ...@@ -3178,9 +3197,7 @@ package body Make is
-- in the object directory of a project being extended -- in the object directory of a project being extended
-- should not be skipped). -- should not be skipped).
elsif Full_Lib_File /= No_File elsif Read_Only
and then not Check_Readonly_Files
and then Is_Readonly_Library (Full_Lib_File)
and then Is_In_Object_Directory (Source_File, Full_Lib_File) and then Is_In_Object_Directory (Source_File, Full_Lib_File)
then then
Verbose_Msg Verbose_Msg
...@@ -3232,13 +3249,16 @@ package body Make is ...@@ -3232,13 +3249,16 @@ package body Make is
Need_To_Compile := Force_Compilations; Need_To_Compile := Force_Compilations;
if not Force_Compilations then if not Force_Compilations then
Read_Only := Check (Source_File => Source_File,
Full_Lib_File /= No_File Source_Index => Source_Index,
and then not Check_Readonly_Files Is_Main_Source => Source_File = Main_Source,
and then Is_Readonly_Library (Full_Lib_File); The_Args => Args,
Check (Source_File, Source_Index, Lib_File => Lib_File,
Source_File = Main_Source, Args, Lib_File, Full_Lib_File => Full_Lib_File,
Read_Only, ALI, Obj_File, Obj_Stamp); Read_Only => Read_Only,
ALI => ALI,
O_File => Obj_File,
O_Stamp => Obj_Stamp);
Need_To_Compile := (ALI = No_ALI_Id); Need_To_Compile := (ALI = No_ALI_Id);
end if; end if;
...@@ -3285,13 +3305,13 @@ package body Make is ...@@ -3285,13 +3305,13 @@ package body Make is
end if; end if;
if In_Place_Mode then if In_Place_Mode then
-- If the library file was not found, then save -- If the library file was not found, then save
-- the library file near the source file. -- the library file near the source file.
if Full_Lib_File = No_File then if Full_Lib_File = No_File then
Lib_File := Osint.Lib_File_Name Lib_File := Osint.Lib_File_Name
(Full_Source_File, Source_Index); (Full_Source_File, Source_Index);
Full_Lib_File := Lib_File;
-- If the library file was found, then save the -- If the library file was found, then save the
-- library file in the same place. -- library file in the same place.
...@@ -3299,7 +3319,6 @@ package body Make is ...@@ -3299,7 +3319,6 @@ package body Make is
else else
Lib_File := Full_Lib_File; Lib_File := Full_Lib_File;
end if; end if;
end if; end if;
-- Start the compilation and record it. We can do -- Start the compilation and record it. We can do
...@@ -3362,7 +3381,29 @@ package body Make is ...@@ -3362,7 +3381,29 @@ package body Make is
Check_Object_Consistency Check_Object_Consistency
and Compilation_OK and Compilation_OK
and (Output_Is_Object or Do_Bind_Step); and (Output_Is_Object or Do_Bind_Step);
Text := Read_Library_Info (Lib_File);
if Full_Lib_File = No_File then
-- Compute the expected location of the ALI file. This
-- can be from several places:
-- -i => in place mode. In such a case, Full_Lib_File
-- has already been set above
-- -D => if specified
-- or defaults in current dir
-- We could simply use a call similar to
-- Osint.Full_Lib_File_Name (Lib_File)
-- but that involves system calls and is thus slower
if Object_Directory_Path /= null then
Name_Len := 0;
Add_Str_To_Name_Buffer (Object_Directory_Path.all);
Add_Str_To_Name_Buffer (Get_Name_String (Lib_File));
Full_Lib_File := Name_Find;
else
Full_Lib_File := Lib_File;
end if;
end if;
Text := Read_Library_Info_From_Full (Full_Lib_File);
-- Restore Check_Object_Consistency to its initial value -- Restore Check_Object_Consistency to its initial value
......
...@@ -1529,15 +1529,6 @@ package body Osint is ...@@ -1529,15 +1529,6 @@ package body Osint is
return Name_Find; return Name_Find;
end Lib_File_Name; end Lib_File_Name;
------------------------
-- Library_File_Stamp --
------------------------
function Library_File_Stamp (N : File_Name_Type) return Time_Stamp_Type is
begin
return File_Stamp (Find_File (N, Library));
end Library_File_Stamp;
----------------- -----------------
-- Locate_File -- -- Locate_File --
----------------- -----------------
...@@ -2119,7 +2110,20 @@ package body Osint is ...@@ -2119,7 +2110,20 @@ package body Osint is
function Read_Library_Info function Read_Library_Info
(Lib_File : File_Name_Type; (Lib_File : File_Name_Type;
Fatal_Err : Boolean := False) return Text_Buffer_Ptr Fatal_Err : Boolean := False) return Text_Buffer_Ptr is
begin
return Read_Library_Info_From_Full
(Full_Lib_File => Find_File (Lib_File, Library),
Fatal_Err => Fatal_Err);
end Read_Library_Info;
---------------------------------
-- Read_Library_Info_From_Full --
---------------------------------
function Read_Library_Info_From_Full
(Full_Lib_File : File_Name_Type;
Fatal_Err : Boolean := False) return Text_Buffer_Ptr
is is
Lib_FD : File_Descriptor; Lib_FD : File_Descriptor;
-- The file descriptor for the current library file. A negative value -- The file descriptor for the current library file. A negative value
...@@ -2133,7 +2137,7 @@ package body Osint is ...@@ -2133,7 +2137,7 @@ package body Osint is
-- For the calls to Close -- For the calls to Close
begin begin
Current_Full_Lib_Name := Find_File (Lib_File, Library); Current_Full_Lib_Name := Full_Lib_File;
Current_Full_Obj_Name := Object_File_Name (Current_Full_Lib_Name); Current_Full_Obj_Name := Object_File_Name (Current_Full_Lib_Name);
if Current_Full_Lib_Name = No_File then if Current_Full_Lib_Name = No_File then
...@@ -2239,7 +2243,7 @@ package body Osint is ...@@ -2239,7 +2243,7 @@ package body Osint is
return Text; return Text;
end Read_Library_Info; end Read_Library_Info_From_Full;
---------------------- ----------------------
-- Read_Source_File -- -- Read_Source_File --
......
...@@ -486,6 +486,13 @@ package Osint is ...@@ -486,6 +486,13 @@ package Osint is
-- behaves as if it did not find Lib_File (namely if Fatal_Err is -- behaves as if it did not find Lib_File (namely if Fatal_Err is
-- False, null is returned). -- False, null is returned).
function Read_Library_Info_From_Full
(Full_Lib_File : File_Name_Type;
Fatal_Err : Boolean := False) return Text_Buffer_Ptr;
-- Same as Read_Library_Info, except Full_Lib_File must contains the full
-- path to the library file (instead of having Read_Library_Info recompute
-- it)
function Full_Library_Info_Name return File_Name_Type; function Full_Library_Info_Name return File_Name_Type;
function Full_Object_File_Name return File_Name_Type; function Full_Object_File_Name return File_Name_Type;
-- Returns the full name of the library/object file most recently read -- Returns the full name of the library/object file most recently read
...@@ -502,8 +509,7 @@ package Osint is ...@@ -502,8 +509,7 @@ package Osint is
-- Opt.Check_Object_Consistency is set to False. -- Opt.Check_Object_Consistency is set to False.
function Full_Lib_File_Name (N : File_Name_Type) return File_Name_Type; function Full_Lib_File_Name (N : File_Name_Type) return File_Name_Type;
function Library_File_Stamp (N : File_Name_Type) return Time_Stamp_Type; -- Returns the full name of library file N. N should not include
-- Returns the full name/time stamp of library file N. N should not include
-- path information. Note that if the file cannot be located No_File is -- path information. Note that if the file cannot be located No_File is
-- returned for the first routine and an all blank time stamp is returned -- returned for the first routine and an all blank time stamp is returned
-- for the second (this is not an error situation). The full name includes -- for the second (this is not an error situation). The full name includes
......
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