aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/cc/link-rule.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/build2/cc/link-rule.cxx b/build2/cc/link-rule.cxx
index a9ee0e9..203c290 100644
--- a/build2/cc/link-rule.cxx
+++ b/build2/cc/link-rule.cxx
@@ -2071,6 +2071,8 @@ namespace build2
if (dd.writing () || dd.mtime () > mt)
scratch = update = true;
+ timestamp dd_tt (system_clock::now ());
+ bool dd_rd (dd.reading ());
dd.close ();
// If nothing changed, then we are done.
@@ -2539,6 +2541,24 @@ namespace build2
rm.cancel ();
+ {
+ timestamp tp_tt (system_clock::now ());
+
+ path dd (tp + ".d");
+
+ timestamp dd_mt (file_mtime (dd));
+ timestamp tp_mt (file_mtime (tp));
+
+ if (dd_mt > tp_mt)
+ {
+ fail << "backwards modification times:\n"
+ << dd.string () << " " << dd_mt << " (" << dd_rd << ")\n"
+ << tp.string () << " " << tp_mt << '\n'
+ << dd_tt << '\n'
+ << tp_tt;
+ }
+ }
+
// Should we go to the filesystem and get the new mtime? We know the
// file has been modified, so instead just use the current clock time.
// It has the advantage of having the subseconds precision.