summaryrefslogtreecommitdiffstats
path: root/src/depfile_parser.cc
Commit message (Collapse)AuthorAgeFilesLines
* Add 'using namespace std;' to all cc files to prepare for removing it from ↵Michael Jones2020-09-301-0/+2
| | | | header files
* bugfix: Process escaped colon in GCC depfiles. (#1774)zero91782020-05-201-24/+63
| | | | | | | | | | | | | | | | | | | | | * Added ability to parse escaped colons in GCC Dep files enabling ninja to parse dep files of GCC 10 on Windows * Added generated depfile_parser.cc * Addressed formatting * Added extra tests with real world examples of paths produced by both GCC 10 and Clang and GCC pre 10. Adjusted one test so it doesn't fail * Adjusted regular expression to not match \: if the character following the : is either EOF or whitespace * Fixed typo in regex (should be 0x20 for space not 0xa) * Changed regular expression form using lookahead to instead matching a separate expression. This was needed as re2c pre version 1.17 is broken when using lookaheads. Also added tests for \: followed by whitespace * Addressed formatting * Forgot a missing std:: * Fixed formatting for spaces after , as well as respecting column width
* depfile_parser_test: test buggy -MP behaviorBen Boeckel2019-11-201-1/+11
| | | | | This ensures the current behavior of rejecting this case due to `x` being reused as an input.
* depfile_parser: remove restriction on multiple outputsBen Boeckel2019-11-201-31/+12
|
* Follow GCC/Clang behavior wrt depfilesPeter Wu2019-06-081-29/+98
| | | | | | | | | | | | | | | | | | The option is called "depfile = gcc" and should support depfiles created by GCC. GCC does not escape backslashes and GNU Make does not try to unescape it, so neither should Ninja try to "unescape" it. Only space (' ') and hash sign ('#') are specially treated by GCC/Clang. Note that while tabs are also treated specially by GCC, Clang does not, so do not special case it (why would someone use tabs in a filename?). Support for 2N trailing backslashes in a filename is a bit questionable, but is added to be as consistent as possible with GCC/Clang. See also https://github.com/llvm-mirror/clang/blob/44c160f916a1b080098b17b466b026aa07475ec2/lib/Frontend/DependencyFile.cpp#L316 https://github.com/gcc-mirror/gcc/blob/22a8377023d59cc01ab0a84a1df56d0e1336efa3/libcpp/mkdeps.c#L47 Fixes https://github.com/ninja-build/ninja/issues/1262
* Restore depfile toleration of multiple output paths on distinct linesBrad King2018-11-191-2/+28
| | | | | | | | | | | | | | | | 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.
* Fix depfile parser handling of multiple rulesBrad King2018-11-191-30/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we handle Makefile rules of the form: out: in1 in2 in3 and the form: out: in1 \ in2 \ in3 Teach the depfile parser to handle the additional form: out: in1 out: in2 out: in3 This is also valid Makefile syntax and is the depfile format generated by the Intel Compiler for Windows. Note that the `gcc -MP` option adds empty phony rules to the generated Makefile fragment: out: in1 in2 in3 in1: in2: in3: Previously we tolerated these because they were treated as inputs, which was accidentally correct. Instead we must now tolerate these by ignoring targets for which no dependencies are specified.
* Re-arrange depfile parser token processing logicBrad King2018-11-191-11/+10
| | | | | Re-arrange the existing logic to support later addition of post-token code even for empty tokens.
* Re-generate depfile parser with re2cc 1.0.1Brad King2018-11-191-3/+2
|
* Fix parsing some special chars in depfilesMaciej Pawlowski2018-11-071-2/+2
| | | | | | This allows paths with "[", "]" and "%" to appear in depfiles. Previously, only "[" would be handled properly. Fixes #1227.
* Regenerate depfile_parser.cc and lexer.cc with newer re2cMaciej Pawlowski2018-11-071-85/+45
|
* Merge pull request #763 from drbo/masterNico Weber2015-11-121-27/+31
|\ | | | | Allow paths with international characters in depfiles
| * Added test of international character supportDemetri Obenour2014-05-081-27/+31
| |
* | Reject depfiles that don't contain a : after the target name.Nico Weber2015-03-121-0/+4
|/ | | | This is a prerequisite for fixing #417.
* Allow paths with '{' '}' in depfilesMaxim Kalaev2014-05-071-3/+4
|
* Accept \r\n line endings in depfiles.Nico Weber2014-05-011-6/+7
| | | | Fixes #752.
* Fix additional range in character class.Nico Weber2013-12-131-29/+42
| | | | | | | | The range was added in 7ab6dcbdb6447861eefafc47fc3e10f3273cede2, but that change only tried to add ! to the character class. Fix by moving '-' to the end of the class. Fixes #694.
* Dollar signs in depfiles are escaped as "$$", not "\$".Nico Weber2013-04-021-30/+47
| | | | | | | See http://llvm.org/PR15642. I checked that gcc does produce depfiles containing "$$" for files with "$" signs in their name (and as of r178540, so does clang). I also checked that .d files that escape dollar signs with "\$" are not read correctly by make.
* allow paths with '!' in depfilesEvan Martin2013-03-301-28/+16
| | | | | See funny paths in https://github.com/google/libcxx/tree/master/test/iterators/stream.iterators/istreambuf.iterator/
* windows: fix size_t<->int conversions in ninja.exeEvan Martin2012-08-101-2/+2
|
* Revert "Make StringPiece data members private."Nico Weber2012-07-281-1/+1
| | | | | | This reverts commit 904c9610fe66c4f4bd63a07d6f057c8603d24394. The commit caused issue #380, this revert fixes it. The revert also makes the test from the previous commit pass.
* Merge pull request #352 from tfarina/string-piece-privateEvan Martin2012-07-271-1/+1
|\ | | | | Make StringPiece data members private.
| * Make StringPiece data members private.Thiago Farina2012-06-301-1/+1
| | | | | | | | Signed-off-by: Thiago Farina <tfarina@chromium.org>
* | dep file parsing: allow '@' and '=' in pathsMaxim Kalaev2012-07-191-14/+22
|/
* allow '(' and ')' in depfile pathsEvan Martin2012-06-121-6/+10
| | | | Fixes issue #327.
* Depfile parser accept tilde.Nicolas Despres2012-03-141-9/+7
|
* Issue #241 - handle depfiles generated by older versions of GCCOleksandr Usov2012-03-121-4/+12
| | | | | | | | | | Older versions of GCC would produce broken depfiles when -MT or -MQ is used gcc43 -MT foo.o -MMD -MF foo.o.d -o foo.o -c foo.c will result in the following depfile foo.o foo.o: <dependencies> Parse multiple outputs unifying duplicates and correctly report errors if they are different.
* minor re2c cleanupsEvan Martin2011-12-291-2/+3
|
* handle nuls more carefully in re2c rulesEvan Martin2011-12-291-22/+29
| | | | | | | | | | - '.' in re2c matches anything except \n, which means it matches \000. Be more careful about which characters we match. - The fallback rule [^] reads ahead another character, which means it can read past the trailing \000. Add a separate rule to match it specifically. This was found by Valgrind.
* de-escape backslashes in depfiles while parsingEvan Martin2011-12-281-80/+113
|
* switch DepfileParser to take a string* to make memory clearerEvan Martin2011-12-271-4/+4
| | | | Add some comments as well.
* fix depfile regex to not match empty stringsEvan Martin2011-12-271-12/+11
| | | | From a patch from Allan Odgaard <github@simplit.com>.
* handle backslashes and isolated colons in depfile parserEvan Martin2011-12-191-33/+27
| | | | | | | | The logic was wrong if the input looked like foo : bar baz with a space before the colon. Test from Frances <frances.buontempo@gmail.com>.
* remove makefile parsing code, use depfile code insteadEvan Martin2011-12-071-10/+22
|
* use re2c to parse depfilesEvan Martin2011-12-071-0/+150