summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2011-11-10 14:56:55 +0100
committerQt by Nokia <qt-info@nokia.com>2011-11-11 02:45:05 +0100
commit96611a677fc0feeb374c191e248842167f39770d (patch)
tree1611e16ad658117e0e3e53c470f69eca9a4b57a2 /src
parentc888e20f22ebd295ac8aa31eb21e19c8377e4805 (diff)
Fix parsing of #if defined expression
We only need to match the closing parentheses if there was an opening one This has caused mis-parsing of tst_qbytearray.cpp Change-Id: I9d52916e3ed8549c5ddd968092451fef7389a952 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/tools/moc/preprocessor.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp
index 2c7888b42d..ecf6d7d4de 100644
--- a/src/tools/moc/preprocessor.cpp
+++ b/src/tools/moc/preprocessor.cpp
@@ -538,12 +538,13 @@ void Preprocessor::substituteUntilNewline(Symbols &substituted, MacroSafeSet saf
continue;
}
} else if (token == PP_DEFINED) {
- test(PP_LPAREN);
+ bool braces = test(PP_LPAREN);
next(PP_IDENTIFIER);
Symbol definedOrNotDefined = symbol();
definedOrNotDefined.token = macros.contains(definedOrNotDefined)? PP_MOC_TRUE : PP_MOC_FALSE;
substituted += definedOrNotDefined;
- test(PP_RPAREN);
+ if (braces)
+ test(PP_RPAREN);
continue;
} else if (token == PP_NEWLINE) {
substituted += symbol();