From d788306781ff5ad86ee38c8ba87c536066c7b245 Mon Sep 17 00:00:00 2001
From: Roberto Raggi <roberto.raggi@nokia.com>
Date: Thu, 9 Jul 2009 17:52:31 +0200
Subject: [PATCH] Don't expand object-like macro when preprocessing in
 fast-mode.

---
 src/libs/cplusplus/pp-engine.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp
index 370e3decb40..5be562dcfa2 100644
--- a/src/libs/cplusplus/pp-engine.cpp
+++ b/src/libs/cplusplus/pp-engine.cpp
@@ -818,6 +818,17 @@ void Preprocessor::preprocess(const QString &fileName, const QByteArray &source,
 
                 const QByteArray spell = tokenSpell(*identifierToken);
                 if (! _expandMacros) {
+                    if (! env->isBuiltinMacro(spell)) {
+                        Macro *m = env->resolve(spell);
+                        if (m && ! m->isFunctionLike()) {
+                            QByteArray expandedDefinition;
+                            expandObjectLikeMacro(identifierToken, spell, m, &expandedDefinition);
+                            if (expandedDefinition.trimmed().isEmpty()) {
+                                out(QByteArray(spell.length(), ' '));
+                                continue;
+                            }
+                        }
+                    }
                     out(spell);
                     continue;
                 }
-- 
GitLab