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
This commit is contained in:
parent
1a163c4605
commit
b11cb5fd9e
@ -1,3 +1,9 @@
|
||||
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>
|
||||
|
||||
* a-tideio.adb: Minor reformatting
|
||||
|
@ -740,6 +740,7 @@ package body Make is
|
||||
Is_Main_Source : Boolean;
|
||||
The_Args : Argument_List;
|
||||
Lib_File : File_Name_Type;
|
||||
Full_Lib_File : File_Name_Type;
|
||||
Read_Only : Boolean;
|
||||
ALI : out ALI_Id;
|
||||
O_File : out File_Name_Type;
|
||||
@ -750,6 +751,8 @@ package body Make is
|
||||
-- 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.
|
||||
-- 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
|
||||
(E_Stamp : Time_Stamp_Type;
|
||||
@ -1414,6 +1417,7 @@ package body Make is
|
||||
Is_Main_Source : Boolean;
|
||||
The_Args : Argument_List;
|
||||
Lib_File : File_Name_Type;
|
||||
Full_Lib_File : File_Name_Type;
|
||||
Read_Only : Boolean;
|
||||
ALI : out ALI_Id;
|
||||
O_File : out File_Name_Type;
|
||||
@ -1523,9 +1527,6 @@ package body Make is
|
||||
-- Data declarations for Check --
|
||||
---------------------------------
|
||||
|
||||
Full_Lib_File : File_Name_Type;
|
||||
-- Full name of current library file
|
||||
|
||||
Full_Obj_File : File_Name_Type;
|
||||
-- Full name of the object file corresponding to Lib_File
|
||||
|
||||
@ -1576,15 +1577,14 @@ package body Make is
|
||||
Check_Object_Consistency;
|
||||
begin
|
||||
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;
|
||||
end;
|
||||
|
||||
else
|
||||
Text := Read_Library_Info (Lib_File);
|
||||
Text := Read_Library_Info_From_Full (Full_Lib_File);
|
||||
end if;
|
||||
|
||||
Full_Lib_File := Full_Library_Info_Name;
|
||||
Full_Obj_File := Full_Object_File_Name;
|
||||
Lib_Stamp := Current_Library_File_Stamp;
|
||||
Obj_Stamp := Current_Object_File_Stamp;
|
||||
@ -3144,6 +3144,8 @@ package body Make is
|
||||
|
||||
if not Empty_Q and then Outstanding_Compiles < Max_Process then
|
||||
declare
|
||||
In_Lib_Dir : Boolean;
|
||||
|
||||
Source_Index : Int;
|
||||
-- Index of the current unit in the current source file
|
||||
|
||||
@ -3152,6 +3154,12 @@ package body Make is
|
||||
Full_Source_File := Osint.Full_Source_Name (Source_File);
|
||||
Lib_File := Osint.Lib_File_Name
|
||||
(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);
|
||||
|
||||
-- If this source has already been compiled, the executable is
|
||||
@ -3161,11 +3169,22 @@ package body Make is
|
||||
Executable_Obsolete := True;
|
||||
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 Full_Lib_File /= No_File
|
||||
and then In_Ada_Lib_Dir (Full_Lib_File)
|
||||
then
|
||||
if In_Lib_Dir then
|
||||
Verbose_Msg
|
||||
(Lib_File,
|
||||
"is in an Ada library",
|
||||
@ -3178,9 +3197,7 @@ package body Make is
|
||||
-- in the object directory of a project being extended
|
||||
-- should not be skipped).
|
||||
|
||||
elsif Full_Lib_File /= No_File
|
||||
and then not Check_Readonly_Files
|
||||
and then Is_Readonly_Library (Full_Lib_File)
|
||||
elsif Read_Only
|
||||
and then Is_In_Object_Directory (Source_File, Full_Lib_File)
|
||||
then
|
||||
Verbose_Msg
|
||||
@ -3232,13 +3249,16 @@ package body Make is
|
||||
Need_To_Compile := Force_Compilations;
|
||||
|
||||
if not Force_Compilations then
|
||||
Read_Only :=
|
||||
Full_Lib_File /= No_File
|
||||
and then not Check_Readonly_Files
|
||||
and then Is_Readonly_Library (Full_Lib_File);
|
||||
Check (Source_File, Source_Index,
|
||||
Source_File = Main_Source, Args, Lib_File,
|
||||
Read_Only, ALI, Obj_File, Obj_Stamp);
|
||||
Check (Source_File => Source_File,
|
||||
Source_Index => Source_Index,
|
||||
Is_Main_Source => Source_File = Main_Source,
|
||||
The_Args => Args,
|
||||
Lib_File => Lib_File,
|
||||
Full_Lib_File => Full_Lib_File,
|
||||
Read_Only => Read_Only,
|
||||
ALI => ALI,
|
||||
O_File => Obj_File,
|
||||
O_Stamp => Obj_Stamp);
|
||||
Need_To_Compile := (ALI = No_ALI_Id);
|
||||
end if;
|
||||
|
||||
@ -3285,13 +3305,13 @@ package body Make is
|
||||
end if;
|
||||
|
||||
if In_Place_Mode then
|
||||
|
||||
-- If the library file was not found, then save
|
||||
-- the library file near the source file.
|
||||
|
||||
if Full_Lib_File = No_File then
|
||||
Lib_File := Osint.Lib_File_Name
|
||||
(Full_Source_File, Source_Index);
|
||||
Full_Lib_File := Lib_File;
|
||||
|
||||
-- If the library file was found, then save the
|
||||
-- library file in the same place.
|
||||
@ -3299,7 +3319,6 @@ package body Make is
|
||||
else
|
||||
Lib_File := Full_Lib_File;
|
||||
end if;
|
||||
|
||||
end if;
|
||||
|
||||
-- Start the compilation and record it. We can do
|
||||
@ -3362,7 +3381,29 @@ package body Make is
|
||||
Check_Object_Consistency
|
||||
and Compilation_OK
|
||||
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
|
||||
|
||||
|
@ -1529,15 +1529,6 @@ package body Osint is
|
||||
return Name_Find;
|
||||
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 --
|
||||
-----------------
|
||||
@ -2119,7 +2110,20 @@ package body Osint is
|
||||
|
||||
function Read_Library_Info
|
||||
(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
|
||||
Lib_FD : File_Descriptor;
|
||||
-- The file descriptor for the current library file. A negative value
|
||||
@ -2133,7 +2137,7 @@ package body Osint is
|
||||
-- For the calls to Close
|
||||
|
||||
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);
|
||||
|
||||
if Current_Full_Lib_Name = No_File then
|
||||
@ -2239,7 +2243,7 @@ package body Osint is
|
||||
|
||||
return Text;
|
||||
|
||||
end Read_Library_Info;
|
||||
end Read_Library_Info_From_Full;
|
||||
|
||||
----------------------
|
||||
-- Read_Source_File --
|
||||
|
@ -486,6 +486,13 @@ package Osint is
|
||||
-- behaves as if it did not find Lib_File (namely if Fatal_Err is
|
||||
-- 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_Object_File_Name return File_Name_Type;
|
||||
-- Returns the full name of the library/object file most recently read
|
||||
@ -502,8 +509,7 @@ package Osint is
|
||||
-- Opt.Check_Object_Consistency is set to False.
|
||||
|
||||
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/time stamp of library file N. N should not include
|
||||
-- Returns the full name of library file N. N should not include
|
||||
-- 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
|
||||
-- for the second (this is not an error situation). The full name includes
|
||||
|
Loading…
Reference in New Issue
Block a user