summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2013-07-22 13:01:59 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-22 07:11:33 +0200
commitc20b3587038c8834e439057c791684c5f636cd07 (patch)
tree6a048d155c1ac5f017a4020b79e6f39927c12da8 /src
parent95e880bd9dd0244983acebb1d7c3bce620e93c26 (diff)
moc: Issue a warning instead of an error when macro argument mismatch
moc's C++ is not 100% accurate, so better process the invalid macro with a warning rather than an error. Such errors occurred in the QSKIP macro with variadic arguments since that macro is defined conditionally. It is also causing problem in boost header (cf task QTBUG-29331) Task-number: QTBUG-29331 Change-Id: Ice6a01b675286540d6470c8e36920b7efd39b540 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/tools/moc/preprocessor.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp
index 8f4b84a9c8..06758e67bd 100644
--- a/src/tools/moc/preprocessor.cpp
+++ b/src/tools/moc/preprocessor.cpp
@@ -645,7 +645,7 @@ Symbols Preprocessor::macroExpandIdentifier(Preprocessor *that, SymbolStack &sym
// 0 argument macros are a bit special. They are ok if the
// argument is pure whitespace or empty
(macro.arguments.size() != 0 || arguments.size() != 1 || !arguments.at(0).isEmpty()))
- that->error("Macro argument mismatch.");
+ that->warning("Macro argument mismatch.");
// now replace the macro arguments with the expanded arguments
enum Mode {
@@ -662,7 +662,7 @@ Symbols Preprocessor::macroExpandIdentifier(Preprocessor *that, SymbolStack &sym
}
int index = macro.arguments.indexOf(s);
if (mode == Normal) {
- if (index >= 0) {
+ if (index >= 0 && index < arguments.size()) {
// each argument undoergoes macro expansion if it's not used as part of a # or ##
if (i == macro.symbols.size() - 1 || macro.symbols.at(i + 1).token != PP_HASHHASH) {
Symbols arg = arguments.at(index);