summaryrefslogtreecommitdiffstats
path: root/src/depfile_parser_test.cc
Commit message (Collapse)AuthorAgeFilesLines
* Follow GCC/Clang behavior wrt depfilesPeter Wu2019-06-081-3/+24
| | | | | | | | | | | | | | | | | | 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-3/+10
| | | | | | | | | | | | | | | | 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-0/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix depfile parser test case line continuationBrad King2018-11-191-4/+4
| | | | | | | Escape newlines for line continuation in the SpecialChars test case. Otherwise the test does not cover valid Makefile syntax. The missing line continuation was tolerated by our parser but is never (not) produced by a real compiler.
* Fix parsing some special chars in depfilesMaciej Pawlowski2018-11-071-2/+5
| | | | | | This allows paths with "[", "]" and "%" to appear in depfiles. Previously, only "[" would be handled properly. Fixes #1227.
* Merge pull request #763 from drbo/masterNico Weber2015-11-121-2/+5
|\ | | | | Allow paths with international characters in depfiles
| * Added test of international character supportDemetri Obenour2014-05-081-2/+5
| |
* | Correct order of ASSERT_EQ argumentsMike Seplowitz2015-07-301-2/+2
| | | | | | | | The correct order is ASSERT_EQ(expected, actual).
* | Reject depfiles that don't contain a : after the target name.Nico Weber2015-03-121-1/+1
| | | | | | | | This is a prerequisite for fixing #417.
* | Use a small, standalone testing framework instead of googletest.Nico Weber2014-09-181-1/+1
|/ | | | | | | | | | | | | | | | | | | | | Ninja currently uses googletest for testing. That makes building ninja_test somewhat annoying since it requires that one passes --with-gtest PATH to configure. It turns out just implementing the bits of googletest that ninja uses needs about the same amount of code than making the --with-gtest flag in configure.py work and making googletest print test results in a way we want (!) In addition to making configuration simpler, this also makes compiling tests much faster: On my system, touching src/build_test.cc (the slowest file to build in ninja) and rebuilding ninja_tests is twice as fast than without this patch. Building all is noticeably faster too: 5.6s with this patch, 9.1s without this patch (38% faster). The most noticeable things missing: EXPECT_* and ASSERT_* don't support streaming notes to them with operator<<, and for failing tests the lhs and rhs are not printed. That's so that this header does not have to include sstream, which slows down building ninja_test almost 20%. If this turns out to be annoying, we can maybe add it.
* Allow paths with '{' '}' in depfilesMaxim Kalaev2014-05-071-2/+5
|
* Accept \r\n line endings in depfiles.Nico Weber2014-05-011-0/+12
| | | | Fixes #752.
* Dollar signs in depfiles are escaped as "$$", not "\$".Nico Weber2013-04-021-1/+1
| | | | | | | 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-2/+4
| | | | | See funny paths in https://github.com/google/libcxx/tree/master/test/iterators/stream.iterators/istreambuf.iterator/
* drop DepfileParserTest.Tilde, as it's covered by .SpecialCharsEvan Martin2012-08-241-13/+0
| | | | | The SpecialChars test covers a bunch of different special characters, including tilde.
* dep file parsing: allow '@' and '=' in pathsMaxim Kalaev2012-07-191-2/+7
|
* allow '(' and ')' in depfile pathsEvan Martin2012-06-121-0/+11
| | | | Fixes issue #327.
* fix a typo in a test nameEvan Martin2012-06-121-1/+1
|
* Merge pull request #256 from iwadon/fix-sign-compareEvan Martin2012-04-051-1/+1
|\ | | | | fix warning: "comparison between signed and unsigned integer expressions"
| * fix warning: "comparison between signed and unsigned integer expressions"Hiroyuki Iwatsuki2012-03-161-1/+1
| |
* | Depfile parser accept tilde.Nicolas Despres2012-03-141-0/+13
|/
* Issue #241 - handle depfiles generated by older versions of GCCOleksandr Usov2012-03-121-0/+17
| | | | | | | | | | 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.
* de-escape backslashes in depfiles while parsingEvan Martin2011-12-281-3/+20
|
* add (failing) test involving spaces in depfilesEvan Martin2011-12-271-0/+13
|
* switch DepfileParser to take a string* to make memory clearerEvan Martin2011-12-271-18/+26
| | | | Add some comments as well.
* handle backslashes and isolated colons in depfile parserEvan Martin2011-12-191-0/+16
| | | | | | | | 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>.
* split out depfile parser tests into new fileEvan Martin2011-12-191-0/+50