From: Pierre-Marie de Rodat <derodat@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Dmitriy Anisimkov <anisimko@adacore.com>
Subject: [Ada] Force even timestamp in Windows ALI files
Date: Tue, 17 Sep 2019 08:07:00 -0000 [thread overview]
Message-ID: <20190917080633.GA37584@adacore.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 655 bytes --]
Old versions forced even file timestamp in Windows in
GNAT.OS_Lib.GM_Split implementation. We removed this time distortion in
GNAT.OS_Lib.GM_Split a few commits. But gprbuild became unnecessary
recompiling the sources in 50% cases, when the source has odd file
timestamp. This commit is restoring the compatibility between new
gprbuild and old GNAT compilers.
Tested on x86_64-pc-linux-gnu, committed on trunk
2019-09-17 Dmitriy Anisimkov <anisimko@adacore.com>
gcc/ada/
* make_util.ads (On_Windows): Move...
* osint.ads (On_Windows): There.
* osint.adb (OS_Time_To_GNAT_Time): If odd incremented on
Windows before conversion to Time_Stamp_Type.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 2373 bytes --]
--- gcc/ada/make_util.ads
+++ gcc/ada/make_util.ads
@@ -50,7 +50,7 @@ package Make_Util is
-- Name of the configuration file used by gprbuild and generated by
-- gprconfig by default.
- On_Windows : constant Boolean := Directory_Separator = '\';
+ On_Windows : Boolean renames Osint.On_Windows;
-- True when on Windows
Source_Info_Option : constant String := "--source-info=";
--- gcc/ada/osint.adb
+++ gcc/ada/osint.adb
@@ -88,6 +88,10 @@ package body Osint is
function OS_Time_To_GNAT_Time (T : OS_Time) return Time_Stamp_Type;
-- Convert OS format time to GNAT format time stamp. If T is Invalid_Time,
-- then returns Empty_Time_Stamp.
+ -- Round to even seconds on Windows before conversion.
+ -- Windows ALI files had timestamps rounded to even seconds historically.
+ -- The rounding was originally done in GM_Split. Now that GM_Split no
+ -- longer does it, we are rounding it here only for ALI files.
function Executable_Prefix return String_Ptr;
-- Returns the name of the root directory where the executable is stored.
@@ -2179,6 +2183,7 @@ package body Osint is
function OS_Time_To_GNAT_Time (T : OS_Time) return Time_Stamp_Type is
GNAT_Time : Time_Stamp_Type;
+ TI : Long_Integer := To_C (T);
Y : Year_Type;
Mo : Month_Type;
D : Day_Type;
@@ -2191,7 +2196,17 @@ package body Osint is
return Empty_Time_Stamp;
end if;
- GM_Split (T, Y, Mo, D, H, Mn, S);
+ if On_Windows and then TI mod 2 > 0 then
+ -- Windows ALI files had timestamps rounded to even seconds
+ -- historically. The rounding was originally done in GM_Split.
+ -- Now that GM_Split no longer does it, we are rounding it here
+ -- only for ALI files.
+
+ TI := TI + 1;
+ end if;
+
+ GM_Split (To_Ada (TI), Y, Mo, D, H, Mn, S);
+
Make_Time_Stamp
(Year => Nat (Y),
Month => Nat (Mo),
--- gcc/ada/osint.ads
+++ gcc/ada/osint.ads
@@ -56,6 +56,9 @@ package Osint is
-- File descriptor for current library info, list, tree, C, H, or binder
-- output. Only one of these is open at a time, so we need only one FD.
+ On_Windows : constant Boolean := Directory_Separator = '\';
+ -- True when on Windows
+
procedure Initialize;
-- Initialize internal tables
reply other threads:[~2019-09-17 8:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190917080633.GA37584@adacore.com \
--to=derodat@adacore.com \
--cc=anisimko@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).