aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/cplusplus/pp-engine.cpp
diff options
context:
space:
mode:
authorFrancois Ferrand <[email protected]>2013-04-25 17:13:39 +0200
committerNikolai Kosjar <[email protected]>2013-04-29 10:09:43 +0200
commit4d18710f464c4a2d1171ec02c1aa3d6298d39cf6 (patch)
treede2b355c8ed0dda5aa819447bdcd51534cba71c6 /src/libs/cplusplus/pp-engine.cpp
parentfeeff29f2272fe922b7f7c8498208e342c33b54b (diff)
C++: fix handling of empty va_args macro arguments.
Preprocessor did not correctly handle when variadic macro arguments were not provided at all, if there were other arguments: macro was not expanded in case only the non variadic arguments were given. #define MACRO(...) used to work fine for 0 or more arguments. #define MACRO(ARG0, ...) used to work only for 2 or more arguments, now fixed. Change-Id: I64e9199ceccae05618a49931c2adad8e4f9471ba Reviewed-by: Nikolai Kosjar <[email protected]>
Diffstat (limited to 'src/libs/cplusplus/pp-engine.cpp')
-rw-r--r--src/libs/cplusplus/pp-engine.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp
index 980f59c0a26..0aa11f0fee7 100644
--- a/src/libs/cplusplus/pp-engine.cpp
+++ b/src/libs/cplusplus/pp-engine.cpp
@@ -945,6 +945,8 @@ bool Preprocessor::handleIdentifier(PPToken *tk)
bool hasMatchingArgs = false;
if (hasArgs) {
const int expectedArgCount = macro->formals().size();
+ if (macro->isVariadic() && allArgTks.size() == expectedArgCount - 1)
+ allArgTks.push_back(QVector<PPToken>());
const int actualArgCount = allArgTks.size();
if (expectedArgCount == actualArgCount
|| (macro->isVariadic() && actualArgCount > expectedArgCount - 1)