diff options
author | Nico Weber <thakis@chromium.org> | 2013-07-02 22:43:40 (GMT) |
---|---|---|
committer | Nico Weber <thakis@chromium.org> | 2013-07-02 22:43:45 (GMT) |
commit | ea378842971c7a5ba1af0f04f07caa7d8cad9006 (patch) | |
tree | e0989a0f145e8c62c54b3d9d8f731b5977939b2f /src/manifest_parser.cc | |
parent | 1f7fa18dea3a57653811f75072871da08d1cff7b (diff) | |
download | Ninja-ea378842971c7a5ba1af0f04f07caa7d8cad9006.zip Ninja-ea378842971c7a5ba1af0f04f07caa7d8cad9006.tar.gz Ninja-ea378842971c7a5ba1af0f04f07caa7d8cad9006.tar.bz2 |
Improve error message for duplicate rules and unknown pools.
Also add more tests for invalid manifests. According to gcov, these invalid
inputs weren't tested before.
Diffstat (limited to 'src/manifest_parser.cc')
-rw-r--r-- | src/manifest_parser.cc | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/manifest_parser.cc b/src/manifest_parser.cc index d742331..d4f0007 100644 --- a/src/manifest_parser.cc +++ b/src/manifest_parser.cc @@ -146,10 +146,8 @@ bool ManifestParser::ParseRule(string* err) { if (!ExpectToken(Lexer::NEWLINE, err)) return false; - if (state_->LookupRule(name) != NULL) { - *err = "duplicate rule '" + name + "'"; - return false; - } + if (state_->LookupRule(name) != NULL) + return lexer_.Error("duplicate rule '" + name + "'", err); Rule* rule = new Rule(name); // XXX scoped_ptr @@ -307,7 +305,7 @@ bool ManifestParser::ParseEdge(string* err) { if (!pool_name.empty()) { Pool* pool = state_->LookupPool(pool_name); if (pool == NULL) - return lexer_.Error("unknown pool name", err); + return lexer_.Error("unknown pool name '" + pool_name + "'", err); edge->pool_ = pool; } |