Fixed #2392 (Preprocessor: Wrong simplification of __VA_ARGS__)

This commit is contained in:
Daniel Marjamäki 2011-01-02 11:19:37 +01:00
parent 571704f118
commit 2e7e118cb8
2 changed files with 5 additions and 3 deletions

View File

@ -1889,6 +1889,8 @@ public:
break; break;
if (Token::simpleMatch(tok, ". . . )")) if (Token::simpleMatch(tok, ". . . )"))
{ {
if (tok->previous()->str() == ",")
_params.push_back("__VA_ARGS__");
_variadic = true; _variadic = true;
break; break;
} }

View File

@ -1750,9 +1750,9 @@ private:
void va_args_4() void va_args_4()
{ {
const char filedata[] = "#define FRED(name, ...) name (__VA_ARGS__);\n" const char filedata[] = "#define FRED(name, ...) name (__VA_ARGS__)\n"
"FRED(abc, 123);\n"; "FRED(abc, 123)\n";
TODO_ASSERT_EQUALS("\nabc(123)\n", OurPreprocessor::expandMacros(filedata)); ASSERT_EQUALS("\nabc(123)\n", OurPreprocessor::expandMacros(filedata));
} }