aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2015-05-13 05:41:20 +0200
committerTristan Gingold <tgingold@free.fr>2015-05-13 05:41:20 +0200
commit961d55b955d0a1526ebb7a5ddca8acee50b8ab1a (patch)
tree2a3da4499451a97b884c8adee694189a4dfc1433
parent5c685c2456a2320adc6f132e7bd8704170ea7665 (diff)
downloadghdl-961d55b955d0a1526ebb7a5ddca8acee50b8ab1a.tar.gz
ghdl-961d55b955d0a1526ebb7a5ddca8acee50b8ab1a.tar.bz2
ghdl-961d55b955d0a1526ebb7a5ddca8acee50b8ab1a.zip
Remove Get_File_Time_Stamp for a filename.
Preliminary work for ticket 48.
-rw-r--r--src/files_map.adb17
-rw-r--r--src/files_map.ads3
-rw-r--r--src/ghdldrv/ghdldrv.adb34
3 files changed, 12 insertions, 42 deletions
diff --git a/src/files_map.adb b/src/files_map.adb
index 94ce9cb3a..ece6e125c 100644
--- a/src/files_map.adb
+++ b/src/files_map.adb
@@ -15,6 +15,7 @@
-- along with GHDL; see the file COPYING. If not, write to the Free
-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-- 02111-1307, USA.
+with System;
with Interfaces.C;
with Ada.Characters.Latin_1;
with Ada.Text_IO; use Ada.Text_IO;
@@ -462,22 +463,6 @@ package body Files_Map is
return Res;
end Os_Time_To_Time_Stamp_Id;
- function Get_File_Time_Stamp (Filename : System.Address)
- return Time_Stamp_Id
- is
- use GNAT.OS_Lib;
- Fd : File_Descriptor;
- Res : Time_Stamp_Id;
- begin
- Fd := Open_Read (Filename, Binary);
- if Fd = Invalid_FD then
- return Null_Time_Stamp;
- end if;
- Res := Os_Time_To_Time_Stamp_Id (File_Time_Stamp (Fd));
- Close (Fd);
- return Res;
- end Get_File_Time_Stamp;
-
function Get_File_Time_Stamp (FD : GNAT.OS_Lib.File_Descriptor)
return Time_Stamp_Id
is
diff --git a/src/files_map.ads b/src/files_map.ads
index 8ad5a040c..c48aebd28 100644
--- a/src/files_map.ads
+++ b/src/files_map.ads
@@ -16,7 +16,6 @@
-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-- 02111-1307, USA.
with Types; use Types;
-with System;
package Files_Map is
@@ -67,8 +66,6 @@ package Files_Map is
-- Return the date of the file (last modification date) as a string.
function Get_File_Time_Stamp (File : Source_File_Entry)
return Time_Stamp_Id;
- function Get_File_Time_Stamp (Filename : System.Address)
- return Time_Stamp_Id;
-- Return the current date of the system.
function Get_Os_Time_Stamp return Time_Stamp_Id;
diff --git a/src/ghdldrv/ghdldrv.adb b/src/ghdldrv/ghdldrv.adb
index f7860b903..492e47dc0 100644
--- a/src/ghdldrv/ghdldrv.adb
+++ b/src/ghdldrv/ghdldrv.adb
@@ -1261,7 +1261,7 @@ package body Ghdldrv is
end if;
end Decode_Option;
- Last_Stamp : Time_Stamp_Id;
+ Last_Stamp : OS_Time;
Last_Stamp_File : Iir;
function Missing_Object_File (Design_File : Iir_Design_File) return Boolean
@@ -1269,14 +1269,13 @@ package body Ghdldrv is
use Files_Map;
Name : constant Name_Id := Get_Design_File_Filename (Design_File);
- Obj_Pathname : constant String :=
- Get_Object_Filename (Design_File) & Nul;
- Stamp : Time_Stamp_Id;
+ Obj_Pathname : constant String := Get_Object_Filename (Design_File);
+ Stamp : OS_Time;
begin
- Stamp := Get_File_Time_Stamp (Obj_Pathname'Address);
+ Stamp := File_Time_Stamp (Obj_Pathname);
-- If the object file does not exist, recompile the file.
- if Stamp = Null_Time_Stamp then
+ if Stamp = Invalid_Time then
if Flag_Verbose then
Put_Line ("no object file for " & Image (Name));
end if;
@@ -1284,9 +1283,7 @@ package body Ghdldrv is
end if;
-- Keep the time stamp of the most recently analyzed unit.
- if Last_Stamp = Null_Time_Stamp
- or else Is_Gt (Stamp, Last_Stamp)
- then
+ if Last_Stamp = Invalid_Time or else Stamp > Last_Stamp then
Last_Stamp := Stamp;
Last_Stamp_File := Design_File;
end if;
@@ -1312,7 +1309,7 @@ package body Ghdldrv is
Need_Elaboration : Boolean;
- Stamp : Time_Stamp_Id;
+ Stamp : OS_Time;
File_Id : Name_Id;
Nil_Args : Argument_List (2 .. 1);
@@ -1369,7 +1366,7 @@ package body Ghdldrv is
end if;
Has_Compiled := False;
- Last_Stamp := Null_Time_Stamp;
+ Last_Stamp := Invalid_Time;
for I in Natural loop
File := Get_Nth_Element (Files_List, I);
@@ -1445,28 +1442,19 @@ package body Ghdldrv is
end if;
Need_Elaboration := True;
else
- declare
- Exec_File : String := Output_File.all & Nul;
- begin
- Stamp := Files_Map.Get_File_Time_Stamp (Exec_File'Address);
- end;
+ Stamp := File_Time_Stamp (Output_File.all);
- if Stamp = Null_Time_Stamp then
+ if Stamp = Invalid_Time then
if Flag_Verbose then
Put_Line ("link due to no binary file");
end if;
Need_Elaboration := True;
else
- if Files_Map.Is_Gt (Last_Stamp, Stamp) then
+ if Last_Stamp > Stamp then
-- if a file is more recent than the executable.
if Flag_Verbose then
Put ("link due to outdated binary file: ");
Put (Image (Get_Design_File_Filename (Last_Stamp_File)));
- Put (" (");
- Put (Files_Map.Get_Time_Stamp_String (Last_Stamp));
- Put (" > ");
- Put (Files_Map.Get_Time_Stamp_String (Stamp));
- Put (")");
New_Line;
end if;
Need_Elaboration := True;