summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2013-03-30 23:36:47 (GMT)
committerEvan Martin <martine@danga.com>2013-03-30 23:36:47 (GMT)
commit7ab6dcbdb6447861eefafc47fc3e10f3273cede2 (patch)
treeed5e0cf81b20d03a58a12f6ab8c919514ea40536 /src
parente2e7a18953723e678b5280a4525ab8173fec08c9 (diff)
downloadNinja-7ab6dcbdb6447861eefafc47fc3e10f3273cede2.zip
Ninja-7ab6dcbdb6447861eefafc47fc3e10f3273cede2.tar.gz
Ninja-7ab6dcbdb6447861eefafc47fc3e10f3273cede2.tar.bz2
allow paths with '!' in depfiles
See funny paths in https://github.com/google/libcxx/tree/master/test/iterators/stream.iterators/istreambuf.iterator/
Diffstat (limited to 'src')
-rw-r--r--src/depfile_parser.cc44
-rw-r--r--src/depfile_parser.in.cc2
-rw-r--r--src/depfile_parser_test.cc6
3 files changed, 21 insertions, 31 deletions
diff --git a/src/depfile_parser.cc b/src/depfile_parser.cc
index 6887c91..c8fb92e 100644
--- a/src/depfile_parser.cc
+++ b/src/depfile_parser.cc
@@ -53,10 +53,10 @@ bool DepfileParser::Parse(string* content, string* err) {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 128, 128, 0, 128, 128, 128, 128, 128,
+ 0, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 0, 0, 128, 0, 0,
+ 128, 128, 128, 128, 128, 128, 128, 128,
+ 128, 128, 128, 128, 128, 128, 0, 0,
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128,
@@ -84,38 +84,26 @@ bool DepfileParser::Parse(string* content, string* err) {
};
yych = *in;
- if (yych <= 'Z') {
- if (yych <= '*') {
+ if (yych <= '\\') {
+ if (yych <= '=') {
if (yych <= 0x00) goto yy6;
- if (yych <= '\'') goto yy8;
- if (yych <= ')') goto yy4;
- goto yy8;
+ if (yych <= ' ') goto yy8;
+ goto yy4;
} else {
- if (yych <= '<') {
- if (yych <= ':') goto yy4;
- goto yy8;
- } else {
- if (yych <= '=') goto yy4;
- if (yych <= '?') goto yy8;
- goto yy4;
- }
+ if (yych <= '?') goto yy8;
+ if (yych <= 'Z') goto yy4;
+ if (yych <= '[') goto yy8;
}
} else {
- if (yych <= '_') {
- if (yych == '\\') goto yy2;
- if (yych <= '^') goto yy8;
- goto yy4;
+ if (yych <= '`') {
+ if (yych == '_') goto yy4;
+ goto yy8;
} else {
- if (yych <= 'z') {
- if (yych <= '`') goto yy8;
- goto yy4;
- } else {
- if (yych == '~') goto yy4;
- goto yy8;
- }
+ if (yych <= 'z') goto yy4;
+ if (yych == '~') goto yy4;
+ goto yy8;
}
}
-yy2:
++in;
if ((yych = *in) <= '$') {
if (yych <= '\n') {
diff --git a/src/depfile_parser.in.cc b/src/depfile_parser.in.cc
index 1d4a177..f96cdb3 100644
--- a/src/depfile_parser.in.cc
+++ b/src/depfile_parser.in.cc
@@ -68,7 +68,7 @@ bool DepfileParser::Parse(string* content, string* err) {
*out++ = yych;
continue;
}
- [a-zA-Z0-9+,/_:.~()@=-]+ {
+ [a-zA-Z0-9+,/_:.~()@=-!]+ {
// Got a span of plain text.
int len = (int)(in - start);
// Need to shift it over if we're overwriting backslashes.
diff --git a/src/depfile_parser_test.cc b/src/depfile_parser_test.cc
index 93d42db..552975c 100644
--- a/src/depfile_parser_test.cc
+++ b/src/depfile_parser_test.cc
@@ -104,10 +104,12 @@ TEST_F(DepfileParserTest, Escapes) {
}
TEST_F(DepfileParserTest, SpecialChars) {
+ // See filenames like istreambuf.iterator_op!= in
+ // https://github.com/google/libcxx/tree/master/test/iterators/stream.iterators/istreambuf.iterator/
string err;
EXPECT_TRUE(Parse(
"C:/Program\\ Files\\ (x86)/Microsoft\\ crtdefs.h: \n"
-" en@quot.header~ t+t-x=1",
+" en@quot.header~ t+t-x!=1",
&err));
ASSERT_EQ("", err);
EXPECT_EQ("C:/Program Files (x86)/Microsoft crtdefs.h",
@@ -115,7 +117,7 @@ TEST_F(DepfileParserTest, SpecialChars) {
ASSERT_EQ(2u, parser_.ins_.size());
EXPECT_EQ("en@quot.header~",
parser_.ins_[0].AsString());
- EXPECT_EQ("t+t-x=1",
+ EXPECT_EQ("t+t-x!=1",
parser_.ins_[1].AsString());
}