Fixed #3426 ((error) Invalid number of character ({) when these macros are defined:)
This commit is contained in:
parent
95123854ba
commit
322f46c761
|
@ -1838,7 +1838,7 @@ std::string Preprocessor::handleIncludes(const std::string &code, const std::str
|
|||
suppressCurrentCodePath = false;
|
||||
indentmatch = indent;
|
||||
}
|
||||
} else if (line == "#endif") {
|
||||
} else if (line.compare(0, 6, "#endif") == 0) {
|
||||
if (indent > 0)
|
||||
--indent;
|
||||
if (indentmatch > indent || indent == 0) {
|
||||
|
|
|
@ -2159,8 +2159,7 @@ private:
|
|||
}
|
||||
|
||||
void endifsemicolon() {
|
||||
const char filedata[] = "void f()\n"
|
||||
"{\n"
|
||||
const char filedata[] = "void f() {\n"
|
||||
"#ifdef A\n"
|
||||
"#endif;\n"
|
||||
"}\n";
|
||||
|
@ -2174,11 +2173,9 @@ private:
|
|||
|
||||
// Compare results..
|
||||
ASSERT_EQUALS(2, static_cast<unsigned int>(actual.size()));
|
||||
ASSERT_EQUALS("void f()\n"
|
||||
"{\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"}\n", actual[""]);
|
||||
const std::string expected("void f() {\n\n\n}\n");
|
||||
ASSERT_EQUALS(expected, actual[""]);
|
||||
ASSERT_EQUALS(expected, actual["A"]);
|
||||
}
|
||||
|
||||
void handle_error() {
|
||||
|
@ -2960,6 +2957,16 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
// #endif
|
||||
{
|
||||
// see also endifsemicolon
|
||||
const std::string code("{\n#ifdef X\n#endif;\n}");
|
||||
defs.clear();
|
||||
defs["Z"] = "";
|
||||
const std::string actual(preprocessor.handleIncludes(code,filePath,includePaths,defs));
|
||||
ASSERT_EQUALS("{\n\n\n}\n", actual);
|
||||
}
|
||||
|
||||
// #undef
|
||||
{
|
||||
const std::string code("#ifndef X\n"
|
||||
|
|
Loading…
Reference in New Issue