From 070d06c163a72cf1584ab5677ce652d930b90c66 Mon Sep 17 00:00:00 2001
From: Erik Verbruggen <erik.verbruggen@nokia.com>
Date: Mon, 15 Feb 2010 16:23:32 +0100
Subject: [PATCH] Changed BLOCKS undef on MacOS to work with system header
 files.

---
 src/plugins/projectexplorer/toolchain.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/plugins/projectexplorer/toolchain.cpp b/src/plugins/projectexplorer/toolchain.cpp
index d6966754fbd..edafb72de6b 100644
--- a/src/plugins/projectexplorer/toolchain.cpp
+++ b/src/plugins/projectexplorer/toolchain.cpp
@@ -177,10 +177,11 @@ QByteArray GccToolChain::predefinedMacros()
 
 #ifdef Q_OS_MAC
         // Turn off flag indicating Apple's blocks support
-        int idx = m_predefinedMacros.indexOf("#define __BLOCKS__ 1");
+        const QByteArray blocksDefine("#define __BLOCKS__ 1");
+        const QByteArray blocksUndefine("#undef __BLOCKS__");
+        int idx = m_predefinedMacros.indexOf(blocksDefine);
         if (idx != -1) {
-            idx = m_predefinedMacros.indexOf('1', idx);
-            m_predefinedMacros[idx] = '0';
+            m_predefinedMacros.replace(idx, blocksDefine.length(), blocksUndefine);
         }
 
         // Define __strong and __weak (used for Apple's GC extension of C) to be empty
-- 
GitLab