diff options
author | Nico Weber <thakis@chromium.org> | 2013-07-19 00:51:10 (GMT) |
---|---|---|
committer | Nico Weber <thakis@chromium.org> | 2013-07-19 00:51:10 (GMT) |
commit | a2df2c7d491ca530e16c90d8f9f7012f08c2e0ae (patch) | |
tree | bd1134823e4f8c5aec2027c0a34c1ca403b8d235 /src/manifest_parser.cc | |
parent | 1f357a79984d9cae226ea73269ccabb500be2a31 (diff) | |
download | Ninja-a2df2c7d491ca530e16c90d8f9f7012f08c2e0ae.zip Ninja-a2df2c7d491ca530e16c90d8f9f7012f08c2e0ae.tar.gz Ninja-a2df2c7d491ca530e16c90d8f9f7012f08c2e0ae.tar.bz2 |
Fix diagnostic formatting regression caused by adaa91a33eb2cf23b88.
Ninja regressed to include a location for every file on the include stack for
nested diagnostics, i.e. it would print:
input:1: include.ninja:1: expected path
Fix this so that it prints only the current file location, like it used to:
include.ninja:1: expected path
Also add a test for this.
Diffstat (limited to 'src/manifest_parser.cc')
-rw-r--r-- | src/manifest_parser.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/manifest_parser.cc b/src/manifest_parser.cc index a1bb904..20be7f3 100644 --- a/src/manifest_parser.cc +++ b/src/manifest_parser.cc @@ -29,12 +29,14 @@ ManifestParser::ManifestParser(State* state, FileReader* file_reader) env_ = &state->bindings_; } -bool ManifestParser::Load(const string& filename, string* err) { +bool ManifestParser::Load(const string& filename, string* err, Lexer* parent) { METRIC_RECORD(".ninja parse"); string contents; string read_err; if (!file_reader_->ReadFile(filename, &contents, &read_err)) { *err = "loading '" + filename + "': " + read_err; + if (parent) + parent->Error(string(*err), err); return false; } @@ -358,8 +360,8 @@ bool ManifestParser::ParseFileInclude(bool new_scope, string* err) { subparser.env_ = env_; } - if (!subparser.Load(path, err)) - return lexer_.Error(string(*err), err); + if (!subparser.Load(path, err, &lexer_)) + return false; if (!ExpectToken(Lexer::NEWLINE, err)) return false; |