Commit ca7cc122 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Simplified Preprocessor::preprocess()

parent 7327a8ea
......@@ -741,12 +741,7 @@ void Preprocessor::preprocess(const QByteArray &fileName, const QByteArray &sour
continue;
}
Macro *m = env->resolve(spell);
if (! m)
_result->append(spell);
else {
if (Macro *m = env->resolve(spell)) {
if (! m->isFunctionLike()) {
if (0 == (m = processObjectLikeMacro(identifierToken, spell, m)))
continue;
......@@ -757,21 +752,18 @@ void Preprocessor::preprocess(const QByteArray &fileName, const QByteArray &sour
// `m' is function-like macro.
// collect the actual arguments
if (_dot->isNot(T_LPAREN)) {
// ### warnng expected T_LPAREN
_result->append(m->name());
continue;
}
skipActualArguments();
if (_dot->isNot(T_RPAREN))
_result->append(spell);
if (_dot->is(T_LPAREN)) {
skipActualArguments();
else
expandFunctionLikeMacro(identifierToken, m);
if (_dot->is(T_RPAREN)) {
expandFunctionLikeMacro(identifierToken, m);
continue;
}
}
}
// it's not a function or object-like macro.
_result->append(spell);
}
}
}
......@@ -786,6 +778,7 @@ void Preprocessor::preprocess(const QByteArray &fileName, const QByteArray &sour
void Preprocessor::skipActualArguments()
{
int count = 0;
while (_dot->isNot(T_EOF_SYMBOL)) {
if (_dot->is(T_LPAREN))
++count;
......
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