summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2013-02-17 23:02:31 (GMT)
committerEvan Martin <martine@danga.com>2013-04-05 17:10:29 (GMT)
commit372a7a8850a6451dec4f4d2c556878064f2662fb (patch)
treebbf5d693c6f15422167aecfce3df3cc973ee7f36
parent75381bcf071ed45af79c3515eb37f406065f9b58 (diff)
downloadNinja-372a7a8850a6451dec4f4d2c556878064f2662fb.zip
Ninja-372a7a8850a6451dec4f4d2c556878064f2662fb.tar.gz
Ninja-372a7a8850a6451dec4f4d2c556878064f2662fb.tar.bz2
refactor some of the output mtime-handling code
Reduces duplicated explain output.
-rw-r--r--src/graph.cc25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/graph.cc b/src/graph.cc
index b000c48..0f99698 100644
--- a/src/graph.cc
+++ b/src/graph.cc
@@ -161,24 +161,25 @@ bool DependencyScan::RecomputeOutputDirty(Edge* edge,
// Dirty if the output is older than the input.
if (most_recent_input && output->mtime() < most_recent_input->mtime()) {
+ TimeStamp output_mtime = output->mtime();
+
// If this is a restat rule, we may have cleaned the output with a restat
// rule in a previous run and stored the most recent input mtime in the
// build log. Use that mtime instead, so that the file will only be
// considered dirty if an input was modified since the previous run.
- TimeStamp most_recent_stamp = most_recent_input->mtime();
+ bool used_restat = false;
if (edge->GetBindingBool("restat") && build_log() &&
(entry = build_log()->LookupByOutput(output->path()))) {
- if (entry->restat_mtime < most_recent_stamp) {
- EXPLAIN("restat of output %s older than most recent input %s "
- "(%d vs %d)",
- output->path().c_str(), most_recent_input->path().c_str(),
- entry->restat_mtime, most_recent_stamp);
- return true;
- }
- } else {
- EXPLAIN("output %s older than most recent input %s (%d vs %d)",
- output->path().c_str(), most_recent_input->path().c_str(),
- output->mtime(), most_recent_stamp);
+ output_mtime = entry->restat_mtime;
+ used_restat = true;
+ }
+
+ if (output_mtime < most_recent_input->mtime()) {
+ EXPLAIN("%soutput %s older than most recent input %s "
+ "(%d vs %d)",
+ used_restat ? "restat of " : "", output->path().c_str(),
+ most_recent_input->path().c_str(),
+ output_mtime, most_recent_input->mtime());
return true;
}
}