summaryrefslogtreecommitdiff
path: root/src/libs/cplusplus
diff options
context:
space:
mode:
authorRoberto Raggi <qtc-committer@nokia.com>2009-01-19 20:06:39 +0100
committerThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2009-01-20 11:29:54 +0100
commit44ed62c1819fd0c3d539475a702ecdf7fcf1b9d5 (patch)
treea51018c2da5b0193a8a150a87f8997941c1dd733 /src/libs/cplusplus
parente0a4789081efcdb92f95e667435474cc2e53f0be (diff)
downloadqt-creator-44ed62c1819fd0c3d539475a702ecdf7fcf1b9d5.tar.gz
Fixes: Expand the #elif's condition.
Diffstat (limited to 'src/libs/cplusplus')
-rw-r--r--src/libs/cplusplus/pp-engine.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp
index 6ed55492e5..e7d3011a76 100644
--- a/src/libs/cplusplus/pp-engine.cpp
+++ b/src/libs/cplusplus/pp-engine.cpp
@@ -963,7 +963,21 @@ void Preprocessor::processElif(TokenIterator firstToken, TokenIterator lastToken
} else if (iflevel == 0 && !skipping()) {
// std::cerr << "*** WARNING #else without #if" << std::endl;
} else if (!_true_test[iflevel] && !_skipping[iflevel - 1]) {
- const Value result = evalExpression(tk.dot(), lastToken, _source);
+
+ const char *first = startOfToken(*tk);
+ const char *last = startOfToken(*lastToken);
+
+ MacroExpander expandCondition (env);
+ QByteArray condition;
+ condition.reserve(256);
+ expandCondition(first, last, &condition);
+
+ QVector<Token> tokens = tokenize(condition);
+
+ const Value result = evalExpression(tokens.constBegin(),
+ tokens.constEnd() - 1,
+ condition);
+
_true_test[iflevel] = ! result.is_zero ();
_skipping[iflevel] = result.is_zero ();
} else {