summaryrefslogtreecommitdiffstats
path: root/src/tools/moc
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2012-10-12 13:37:21 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-14 20:53:42 +0200
commit21426f281e09b6043e3c1f9b5d3a48644a4965fe (patch)
tree7e4aa0c5dbd3633d596714b2a86573e23b7287dd /src/tools/moc
parent289a8147784f830f214859e00367486587d9a027 (diff)
moc: parse properly the gcc extension for variadic macro
Task-number: QTBUG-27547 Change-Id: I983b96b09c405e5330327092e56164b9921a2d0f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/tools/moc')
-rw-r--r--src/tools/moc/preprocessor.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp
index 40bba33d40..566be9c039 100644
--- a/src/tools/moc/preprocessor.cpp
+++ b/src/tools/moc/preprocessor.cpp
@@ -1201,8 +1201,18 @@ void Preprocessor::parseDefineArguments(Macro *m)
t = next();
if (t == PP_RPAREN)
break;
- if (t != PP_COMMA)
- error("Unexpected character in macro argument list.");
+ if (t == PP_COMMA)
+ continue;
+ if (lexem() == "...") {
+ //GCC extension: #define FOO(x, y...) x(y)
+ // The last argument was already parsed. Just mark the macro as variadic.
+ m->isVariadic = true;
+ while (test(PP_WHITESPACE));
+ if (!test(PP_RPAREN))
+ error("missing ')' in macro argument list");
+ break;
+ }
+ error("Unexpected character in macro argument list.");
}
m->arguments = arguments;
while (test(PP_WHITESPACE));