forked from qt-creator/qt-creator
preprocessor: do not expand macros when checking defined(...)
Change-Id: I39cfbd7f7adf13ec52527c79c9481d56283087df Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -636,6 +636,7 @@ void Preprocessor::genLine(unsigned lineno, const QByteArray &fileName) const
|
||||
|
||||
void Preprocessor::handleDefined(PPToken *tk)
|
||||
{
|
||||
ScopedBoolSwap s(m_state.m_inPreprocessorDirective, true);
|
||||
unsigned lineno = tk->lineno;
|
||||
lex(tk); // consume "defined" token
|
||||
bool lparenSeen = tk->is(T_LPAREN);
|
||||
@@ -698,8 +699,7 @@ _Lclassify:
|
||||
} while (isValidToken(*tk));
|
||||
goto _Lclassify;
|
||||
} else if (tk->is(T_IDENTIFIER) && !isQtReservedWord(tk->asByteArrayRef())) {
|
||||
static const QByteArray ppDefined("defined");
|
||||
if (m_state.m_inCondition && tk->asByteArrayRef() == ppDefined)
|
||||
if (m_state.m_inCondition && tk->asByteArrayRef() == "defined")
|
||||
handleDefined(tk);
|
||||
else if (handleIdentifier(tk))
|
||||
goto _Lagain;
|
||||
|
||||
Reference in New Issue
Block a user