diff options
author | Nico Weber <thakis@chromium.org> | 2013-04-09 04:08:19 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2013-04-09 04:08:19 (GMT) |
commit | ba1642091f67f3e71da1fe2768dd54146beb9c63 (patch) | |
tree | ff7e93d27bf76069735ce195fa52a446efa99d6c /src/build.cc | |
parent | 0397155218f3d311200ec4e25786028f14c53c6a (diff) | |
download | Ninja-ba1642091f67f3e71da1fe2768dd54146beb9c63.zip Ninja-ba1642091f67f3e71da1fe2768dd54146beb9c63.tar.gz Ninja-ba1642091f67f3e71da1fe2768dd54146beb9c63.tar.bz2 |
Make deps=gcc without depfile an error.
When I first played with depslog, I accidentally removed the depfile attribute
on my cc edges, which had the effect of ninja silently ignoring all depfiles.
Instead, let ninja complain about edges that have deps set to gcc and depfile
set to nothing.
This is done at edge build time, instead of at mainfest load time, because
adding this check to ParseEdge() regressed empty build time for target 'chrome'
by 30ms. The check is only useful for generator authors, regular users should
never see this.
Diffstat (limited to 'src/build.cc')
-rw-r--r-- | src/build.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/build.cc b/src/build.cc index 2d3d9b4..5e874df 100644 --- a/src/build.cc +++ b/src/build.cc @@ -873,7 +873,7 @@ void Builder::FinishCommand(CommandRunner::Result* result) { } if (!deps_type.empty()) { - assert(edge->outputs_.size() == 1); + assert(edge->outputs_.size() == 1 && "should have been rejected by parser"); Node* out = edge->outputs_[0]; TimeStamp mtime = disk_interface_->Stat(out->path()); // XXX we could reuse the restat logic to avoid a second stat, @@ -899,8 +899,10 @@ bool Builder::ExtractDeps(CommandRunner::Result* result, #endif if (deps_type == "gcc") { string depfile = result->edge->GetBinding("depfile"); - if (depfile.empty()) - return true; // No dependencies to load. + if (depfile.empty()) { + *err = string("edge with deps=gcc but no depfile makes no sense\n"); + return false; + } string content = disk_interface_->ReadFile(depfile, err); if (!err->empty()) @@ -922,7 +924,7 @@ bool Builder::ExtractDeps(CommandRunner::Result* result, } if (disk_interface_->RemoveFile(depfile) < 0) { - *err = string("deleting depfile: ") + strerror(errno); + *err = string("deleting depfile: ") + strerror(errno) + string("\n"); return false; } } else { |