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;
|
suppressCurrentCodePath = false;
|
||||||
indentmatch = indent;
|
indentmatch = indent;
|
||||||
}
|
}
|
||||||
} else if (line == "#endif") {
|
} else if (line.compare(0, 6, "#endif") == 0) {
|
||||||
if (indent > 0)
|
if (indent > 0)
|
||||||
--indent;
|
--indent;
|
||||||
if (indentmatch > indent || indent == 0) {
|
if (indentmatch > indent || indent == 0) {
|
||||||
|
|
|
@ -2159,8 +2159,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void endifsemicolon() {
|
void endifsemicolon() {
|
||||||
const char filedata[] = "void f()\n"
|
const char filedata[] = "void f() {\n"
|
||||||
"{\n"
|
|
||||||
"#ifdef A\n"
|
"#ifdef A\n"
|
||||||
"#endif;\n"
|
"#endif;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
@ -2174,11 +2173,9 @@ private:
|
||||||
|
|
||||||
// Compare results..
|
// Compare results..
|
||||||
ASSERT_EQUALS(2, static_cast<unsigned int>(actual.size()));
|
ASSERT_EQUALS(2, static_cast<unsigned int>(actual.size()));
|
||||||
ASSERT_EQUALS("void f()\n"
|
const std::string expected("void f() {\n\n\n}\n");
|
||||||
"{\n"
|
ASSERT_EQUALS(expected, actual[""]);
|
||||||
"\n"
|
ASSERT_EQUALS(expected, actual["A"]);
|
||||||
"\n"
|
|
||||||
"}\n", actual[""]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_error() {
|
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
|
// #undef
|
||||||
{
|
{
|
||||||
const std::string code("#ifndef X\n"
|
const std::string code("#ifndef X\n"
|
||||||
|
|
Loading…
Reference in New Issue