Commit 493cde83 authored by hjk's avatar hjk Committed by hjk
Browse files

preprocessor: do not expand macros when checking defined(...)

Change-Id: I39cfbd7f7adf13ec52527c79c9481d56283087df
Reviewed-by: default avatarhjk <>
parent 0362016f
......@@ -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")
else if (handleIdentifier(tk))
goto _Lagain;
Supports Markdown
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