From 9ea5264eddf136da94bb42e85fdd14b34112aa51 Mon Sep 17 00:00:00 2001
From: Erik Verbruggen <erik.verbruggen@nokia.com>
Date: Fri, 22 Jan 2010 09:33:34 +0100
Subject: [PATCH] When running on MacOS, undefine __BLOCKS__ in the
 preprocessor flags of the C++ parser.

We don't support blocks yet, and this way we get rid of quite some
parsing errors (resulting in undefined or wrongly defined types, messing
up the semantic passes).

Reviewed-by: Roberto Raggi
---
 src/plugins/projectexplorer/toolchain.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/plugins/projectexplorer/toolchain.cpp b/src/plugins/projectexplorer/toolchain.cpp
index 429006cc9b9..0bd82b9f169 100644
--- a/src/plugins/projectexplorer/toolchain.cpp
+++ b/src/plugins/projectexplorer/toolchain.cpp
@@ -174,6 +174,14 @@ QByteArray GccToolChain::predefinedMacros()
         cpp.closeWriteChannel();
         cpp.waitForFinished();
         m_predefinedMacros = cpp.readAllStandardOutput();
+
+#ifdef Q_OS_MAC
+        int idx = m_predefinedMacros.indexOf("#define __BLOCKS__ 1");
+        if (idx != -1) {
+            idx = m_predefinedMacros.indexOf("1", idx);
+            m_predefinedMacros[idx] = '0';
+        }
+#endif // Q_OS_MAC
     }
     return m_predefinedMacros;
 }
-- 
GitLab