diff options
author | Brad King <brad.king@kitware.com> | 2018-10-08 13:14:58 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-11-19 15:23:51 (GMT) |
commit | 8a9edb110354d5468ab42685cfece6a073146f27 (patch) | |
tree | ffe78231c4bdc8ad7e3a277a2b6b4f1822f5de0a /src/depfile_parser.h | |
parent | 4a4f9d40e178a9a9e88f4cd502d2be49bf7938d8 (diff) | |
download | Ninja-8a9edb110354d5468ab42685cfece6a073146f27.zip Ninja-8a9edb110354d5468ab42685cfece6a073146f27.tar.gz Ninja-8a9edb110354d5468ab42685cfece6a073146f27.tar.bz2 |
Restore depfile toleration of multiple output paths on distinct lines
Prior to introduction of depfile parser handling of multiple rules,
ninja silently accepted a depfile of the form:
out: in1 in2 in3
other: otherIn1 otherIn2 otherIn3
and incorrectly treated `other` and `otherIn*` as additional inputs to
`out`. Now we prefer to reject this just as we already do for a depfile
specifying multiple outputs on one line. However, this can break
existing cases where such a depfile was silently tolerated.
Add a `-w depfilemulti={err,warn}` option to control this behavior,
and make it just a warning by default.
Diffstat (limited to 'src/depfile_parser.h')
-rw-r--r-- | src/depfile_parser.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/depfile_parser.h b/src/depfile_parser.h index 1e6ebb5..be20374 100644 --- a/src/depfile_parser.h +++ b/src/depfile_parser.h @@ -21,8 +21,24 @@ using namespace std; #include "string_piece.h" +enum DepfileDistinctTargetLinesAction { + kDepfileDistinctTargetLinesActionWarn, + kDepfileDistinctTargetLinesActionError, +}; + +struct DepfileParserOptions { + DepfileParserOptions() + : depfile_distinct_target_lines_action_( + kDepfileDistinctTargetLinesActionWarn) {} + DepfileDistinctTargetLinesAction + depfile_distinct_target_lines_action_; +}; + /// Parser for the dependency information emitted by gcc's -M flags. struct DepfileParser { + explicit DepfileParser(DepfileParserOptions options = + DepfileParserOptions()); + /// Parse an input file. Input must be NUL-terminated. /// Warning: may mutate the content in-place and parsed StringPieces are /// pointers within it. @@ -30,6 +46,7 @@ struct DepfileParser { StringPiece out_; vector<StringPiece> ins_; + DepfileParserOptions options_; }; #endif // NINJA_DEPFILE_PARSER_H_ |