diff options
author | Evan Martin <martine@danga.com> | 2011-09-08 01:33:10 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2011-09-08 01:33:10 (GMT) |
commit | 4a6d00e978409620079bf89161ecc5aad024fe03 (patch) | |
tree | d83a7c22bf289bdb1eb76417f4ceff5b9a6cea3f /src/build.cc | |
parent | 32855955c62287165434f468401343bbffa37253 (diff) | |
download | Ninja-4a6d00e978409620079bf89161ecc5aad024fe03.zip Ninja-4a6d00e978409620079bf89161ecc5aad024fe03.tar.gz Ninja-4a6d00e978409620079bf89161ecc5aad024fe03.tar.bz2 |
fix redundant manifest rebuild
Don't rebuild the manifest when it's already up to date.
The underlying problem was that Builder::Build has a confusing API;
split the API so it's more clear for callers what the return values
mean.
Diffstat (limited to 'src/build.cc')
-rw-r--r-- | src/build.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/build.cc b/src/build.cc index 3b7d5b8..e0118ef 100644 --- a/src/build.cc +++ b/src/build.cc @@ -387,7 +387,7 @@ bool Builder::AddTarget(Node* node, string* err) { return false; } if (!node->dirty_) - return false; // Intentionally no error. + return true; // Nothing to do. if (!plan_.AddTarget(node, err)) return false; @@ -395,11 +395,12 @@ bool Builder::AddTarget(Node* node, string* err) { return true; } +bool Builder::AlreadyUpToDate() const { + return !plan_.more_to_do(); +} + bool Builder::Build(string* err) { - if (!plan_.more_to_do()) { - *err = "no work to do"; - return true; - } + assert(!AlreadyUpToDate()); status_->PlanHasTotalEdges(plan_.command_edge_count()); int pending_commands = 0; |