From 5f9dcd5364993f32e6841ffdfefce1cc87017b22 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 22 Nov 2018 12:24:38 +0200 Subject: Make backwards modification time check permanent, add another experiment --- build2/cc/compile-rule.cxx | 8 ++++++-- build2/cc/link-rule.cxx | 25 ++----------------------- 2 files changed, 8 insertions(+), 25 deletions(-) (limited to 'build2/cc') diff --git a/build2/cc/compile-rule.cxx b/build2/cc/compile-rule.cxx index e361e9d..9326193 100644 --- a/build2/cc/compile-rule.cxx +++ b/build2/cc/compile-rule.cxx @@ -4249,7 +4249,8 @@ namespace build2 return *pr.first; } - // Make sure depdb is no older than any of our prerequisites. + // Make sure depdb is no older than any of our prerequisites (see md.mt + // logic description above for details). // touch (md.dd, false, verb_never); @@ -4668,11 +4669,14 @@ namespace build2 rm.cancel (); } + timestamp now (system_clock::now ()); + depdb::verify (timestamp_unknown, md.dd, tp, now); + // 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. // - t.mtime (system_clock::now ()); + t.mtime (now); return target_state::changed; } diff --git a/build2/cc/link-rule.cxx b/build2/cc/link-rule.cxx index 2581d6f..47c058d 100644 --- a/build2/cc/link-rule.cxx +++ b/build2/cc/link-rule.cxx @@ -2071,12 +2071,7 @@ namespace build2 if (dd.writing () || dd.mtime > mt) scratch = update = true; -#define BUILD2_MTIME_CHECK -#ifdef BUILD2_MTIME_CHECK - timestamp dd_tt (system_clock::now ()); -#endif - - timestamp dd_cl (dd.close ()); + dd.close (); // If nothing changed, then we are done. // @@ -2559,23 +2554,7 @@ namespace build2 } rm.cancel (); - -#ifdef BUILD2_MTIME_CHECK - { - timestamp tp_mt (file_mtime (tp)); - timestamp dd_mt (file_mtime (dd.path)); - timestamp tp_tt (system_clock::now ()); - - if (dd_mt > tp_mt) - fail << "backwards modification times:\n" - << dd_tt << " window start\n" - << dd_cl << " write mtime\n" - << dd.mtime << " close mtime\n" - << dd_mt << " " << dd.path.string () << '\n' - << tp_mt << " " << tp.string () << '\n' - << tp_tt << " window end"; - } -#endif + dd.verify (tp); // 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. -- cgit v1.1