From 2e7e118cb893df24d877985406894e67fd3ddde9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 2 Jan 2011 11:19:37 +0100 Subject: [PATCH] Fixed #2392 (Preprocessor: Wrong simplification of __VA_ARGS__) --- lib/preprocessor.cpp | 2 ++ test/testpreprocessor.cpp | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 6def6da55..14e6b80a4 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -1889,6 +1889,8 @@ public: break; if (Token::simpleMatch(tok, ". . . )")) { + if (tok->previous()->str() == ",") + _params.push_back("__VA_ARGS__"); _variadic = true; break; } diff --git a/test/testpreprocessor.cpp b/test/testpreprocessor.cpp index e3207ecf6..d67eb6c87 100644 --- a/test/testpreprocessor.cpp +++ b/test/testpreprocessor.cpp @@ -1750,9 +1750,9 @@ private: void va_args_4() { - const char filedata[] = "#define FRED(name, ...) name (__VA_ARGS__);\n" - "FRED(abc, 123);\n"; - TODO_ASSERT_EQUALS("\nabc(123)\n", OurPreprocessor::expandMacros(filedata)); + const char filedata[] = "#define FRED(name, ...) name (__VA_ARGS__)\n" + "FRED(abc, 123)\n"; + ASSERT_EQUALS("\nabc(123)\n", OurPreprocessor::expandMacros(filedata)); }