diff options
author | Nico Weber <nicolasweber@gmx.de> | 2018-11-21 18:31:22 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-21 18:31:22 (GMT) |
commit | 0a2e2cae7038ce519b0524c07d7135c3e520c9cd (patch) | |
tree | ffe78231c4bdc8ad7e3a277a2b6b4f1822f5de0a /src/ninja.cc | |
parent | 5a78423193c48cae4800eb1ec44b62d14ae03920 (diff) | |
parent | 8a9edb110354d5468ab42685cfece6a073146f27 (diff) | |
download | Ninja-0a2e2cae7038ce519b0524c07d7135c3e520c9cd.zip Ninja-0a2e2cae7038ce519b0524c07d7135c3e520c9cd.tar.gz Ninja-0a2e2cae7038ce519b0524c07d7135c3e520c9cd.tar.bz2 |
Merge pull request #1039 from bradking/improve-depfile-parser
Fix depfile parser handling of multiple rules
Diffstat (limited to 'src/ninja.cc')
-rw-r--r-- | src/ninja.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/ninja.cc b/src/ninja.cc index a3d73ad..b608426 100644 --- a/src/ninja.cc +++ b/src/ninja.cc @@ -73,6 +73,10 @@ struct Options { /// Whether phony cycles should warn or print an error. bool phony_cycle_should_err; + + /// Whether a depfile with multiple targets on separate lines should + /// warn or print an error. + bool depfile_distinct_target_lines_should_err; }; /// The Ninja main() loads up a series of data structures; various tools need @@ -912,7 +916,9 @@ bool WarningEnable(const string& name, Options* options) { if (name == "list") { printf("warning flags:\n" " dupbuild={err,warn} multiple build lines for one target\n" -" phonycycle={err,warn} phony build statement references itself\n"); +" phonycycle={err,warn} phony build statement references itself\n" +" depfilemulti={err,warn} depfile has multiple output paths on separate lines\n" + ); return false; } else if (name == "dupbuild=err") { options->dupe_edges_should_err = true; @@ -926,6 +932,12 @@ bool WarningEnable(const string& name, Options* options) { } else if (name == "phonycycle=warn") { options->phony_cycle_should_err = false; return true; + } else if (name == "depfilemulti=err") { + options->depfile_distinct_target_lines_should_err = true; + return true; + } else if (name == "depfilemulti=warn") { + options->depfile_distinct_target_lines_should_err = false; + return true; } else { const char* suggestion = SpellcheckString(name.c_str(), "dupbuild=err", "dupbuild=warn", @@ -1200,6 +1212,11 @@ NORETURN void real_main(int argc, char** argv) { if (exit_code >= 0) exit(exit_code); + if (options.depfile_distinct_target_lines_should_err) { + config.depfile_parser_options.depfile_distinct_target_lines_action_ = + kDepfileDistinctTargetLinesActionError; + } + if (options.working_dir) { // The formatting of this string, complete with funny quotes, is // so Emacs can properly identify that the cwd has changed for |