diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp
index 3ae95007ef6822d98236655300a41cf8d26153a3..6459b60f33459802152a118563625fc3c83c56e3 100644
--- a/src/libs/cplusplus/pp-engine.cpp
+++ b/src/libs/cplusplus/pp-engine.cpp
@@ -492,6 +492,13 @@ QByteArray Preprocessor::operator()(const QByteArray &filename,
     return preprocessed;
 }
 
+QByteArray Preprocessor::expand(const QByteArray &source)
+{
+    QByteArray result;
+    expand(source, &result);
+    return result;
+}
+
 void Preprocessor::expand(const QByteArray &source, QByteArray *result)
 {
     _expand(source, result);
@@ -610,45 +617,43 @@ void Preprocessor::preprocess(const QByteArray &fileName, const QByteArray &sour
                 }
 
                 Macro *m = env.resolve(spell);
-                if (! m) {
+
+                if (! m)
                     _result->append(spell);
-                } else {
+
+                else {
                     if (! m->isFunctionLike()) {
-                        if (_dot->isNot(T_LPAREN)) {
-                            if (client)
-                                client->startExpandingMacro(identifierToken->offset,
-                                                            *m, spell);
 
-                            m->setHidden(true);
-                            expand(m->definition(), _result);
-                            m->setHidden(false);
+                        if (client)
+                            client->startExpandingMacro(identifierToken->offset,
+                                                        *m, spell);
 
-                            if (client)
-                                client->stopExpandingMacro(_dot->offset, *m);
+                        m->setHidden(true);
+                        const QByteArray tmp = expand(m->definition());
+                        m->setHidden(false);
 
-                            continue;
-                        } else {
-                            QByteArray tmp;
+                        if (client)
+                            client->stopExpandingMacro(_dot->offset, *m);
 
-                            if (client)
-                                client->startExpandingMacro(identifierToken->offset,
-                                                            *m, spell);
-                            m->setHidden(true);
-                            expand(m->definition(), &tmp);
-                            m->setHidden(false);
 
-                            if (client)
-                                client->stopExpandingMacro(_dot->offset, *m);
+                        if (_dot->isNot(T_LPAREN)) {
+                            _result->append(tmp);
+                            continue;
 
+                        } else {
                             m = 0; // reset the active the macro
 
                             pushState(createStateFromSource(tmp));
+
                             if (_dot->is(T_IDENTIFIER)) {
                                 const QByteArray id = tokenSpell(*_dot);
-                                Macro *macro = env.resolve(id);
-                                if (macro && macro->isFunctionLike())
-                                    m = macro;
+
+                                if (Macro *macro = env.resolve(id)) {
+                                    if (macro->isFunctionLike())
+                                        m = macro;
+                                }
                             }
+
                             popState();
 
                             if (! m) {
@@ -669,14 +674,17 @@ void Preprocessor::preprocess(const QByteArray &fileName, const QByteArray &sour
                     while (_dot->isNot(T_EOF_SYMBOL)) {
                         if (_dot->is(T_LPAREN))
                             ++count;
+
                         else if (_dot->is(T_RPAREN)) {
                             if (! --count)
                                 break;
                         }
+
                         ++_dot;
                     }
                     if (_dot->isNot(T_RPAREN)) {
                         // ### warning expected T_RPAREN
+
                     } else {
                         const char *beginOfText = startOfToken(*identifierToken);
                         const char *endOfText = endOfToken(*_dot);
@@ -717,7 +725,7 @@ const char *Preprocessor::endOfToken(const Token &token) const
 QByteArray Preprocessor::tokenSpell(const Token &token) const
 {
     const QByteArray text = QByteArray::fromRawData(_source.constBegin() + token.offset,
-                                                    token.length);
+                                                     token.length);
     return text;
 }
 
diff --git a/src/libs/cplusplus/pp-engine.h b/src/libs/cplusplus/pp-engine.h
index 21e3638954e234f36fb7440f32a6c9d2c47f2f93..ae6b10e00e99d8a7c1cc11744e31f3409de132fa 100644
--- a/src/libs/cplusplus/pp-engine.h
+++ b/src/libs/cplusplus/pp-engine.h
@@ -169,6 +169,7 @@ private:
                     const QByteArray &source,
                     QByteArray *result);
 
+    QByteArray expand(const QByteArray &source);
     void expand(const QByteArray &source, QByteArray *result);
     void expand(const char *first, const char *last, QByteArray *result);