preprocessor: do not loop endlessly on incomplete expressions

An missing closing parantheses after "defined(..." caused an endless loop.

Change-Id: I19b17cebc1a56880216c3bfb67c9d296f80cc064
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
hjk
2012-05-29 14:33:56 +02:00
committed by hjk
parent 9ac204bdfb
commit 6d04f3ce25
2 changed files with 26 additions and 6 deletions

View File

@@ -654,12 +654,12 @@ void Preprocessor::handleDefined(PPToken *tk)
break;
} while (isValidToken(*tk));
if (lparenSeen) {
while (tk->isNot(T_RPAREN))
lex(tk);
} else {
pushToken(tk);
}
if (lparenSeen && tk->is(T_RPAREN))
lex(tk);
pushToken(tk);
QByteArray result(1, '0');
if (m_env->resolve(idToken.asByteArrayRef()))
result[0] = '1';