Commit 44ed62c1 authored by Roberto Raggi's avatar Roberto Raggi Committed by Thorbjørn Lindeijer
Browse files

Fixes: Expand the #elif's condition.

parent e0a47890
......@@ -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 {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment