From 2880831f78dba2fca9ec72dd63d4fd7cfb9ac445 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 26 Jul 2017 13:46:19 +0200 Subject: Fix bug in precise change detection logic --- build2/cc/compile.cxx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx index c5ab236..b65cee7 100644 --- a/build2/cc/compile.cxx +++ b/build2/cc/compile.cxx @@ -755,6 +755,8 @@ namespace build2 // timestamp mt; bool u (dd.writing () || dd.mtime () > (mt = file_mtime (tp))); + if (u) + mt = timestamp_nonexistent; // Treat as if it doesn't exist. // Update prerequisite targets (normally just the source file). // @@ -827,11 +829,15 @@ namespace build2 } else if (f) // Don't clear if it was forced. { - // Clear the update flag and set the touch flag. See also - // the md.mt logic below. + // Clear the update flag and set the touch flag. Unless there + // is no object file, of course. See also the md.mt logic + // below. // - u = false; - md.touch = true; + if (mt != timestamp_nonexistent) + { + u = false; + md.touch = true; + } } tu = move (p.first); -- cgit v1.1