aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-07-26 13:46:19 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-07-26 13:46:19 +0200
commit2880831f78dba2fca9ec72dd63d4fd7cfb9ac445 (patch)
tree086369414335f0c5630f23f43ea897497b21d99c
parentbf497c1f7716e6d904245409bfe65cb8970fe4ae (diff)
Fix bug in precise change detection logic
-rw-r--r--build2/cc/compile.cxx14
1 files 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);