From cd6b440a18552770ce36f32a02b9f15c736007f0 Mon Sep 17 00:00:00 2001
From: Leandro Melo <leandro.melo@nokia.com>
Date: Tue, 11 Sep 2012 14:18:24 +0200
Subject: [PATCH] C++: Fine tune behavior of "expand macros" flag

Even if "expand funcion-like macros" is unset we still
perform the expansion in the case it's already doing
so - when it originally started from an object-like macro.

Task-number: QTCREATORBUG-7712
Change-Id: Ie2a24de227f757d195146477d48246472082d28a
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: hjk <qthjk@ovi.com>
---
 src/libs/cplusplus/pp-engine.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp
index e14a7e93b8a..3f94652ee66 100644
--- a/src/libs/cplusplus/pp-engine.cpp
+++ b/src/libs/cplusplus/pp-engine.cpp
@@ -810,8 +810,11 @@ bool Preprocessor::handleIdentifier(PPToken *tk)
     PPToken oldMarkerTk;
 
     if (macro->isFunctionLike()) {
-        if (!expandFunctionlikeMacros())
+        if (!expandFunctionlikeMacros()
+                // Still expand if this originally started with an object-like macro.
+                && m_state.m_expansionStatus != Expanding) {
             return false;
+        }
 
         // Collect individual tokens that form the macro arguments.
         QVector<QVector<PPToken> > allArgTks;
-- 
GitLab