From 51d3096c8bafa838cc5872a72aaed40f6717957d Mon Sep 17 00:00:00 2001 From: rfm Date: Thu, 20 Oct 2011 09:52:01 +0000 Subject: [PATCH] another attempted workaround for __block issue git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34036 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 4 ++++ Source/common.h | 23 ++++++++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 62c5be215..4a16fe06b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-10-20 Richard Frith-Macdonald + + * Source/common.h: Attempt to workaroiund clang __blockproblem + 2011-10-20 Richard Frith-Macdonald * Source/NSPathUtilities.m: diff --git a/Source/common.h b/Source/common.h index 86a68c65c..dfbebfcbf 100644 --- a/Source/common.h +++ b/Source/common.h @@ -48,16 +48,21 @@ #import "GNUstepBase/NSBundle+GNUstepBase.h" /* We need to wrap unistd.h because it is used throughout the code and some - * versions include __block as a variable name, and clang now defines that - * as a reserved word :-( + * versions include __block as a variable name, and clang also defines that + * and depends on the definition later ... so we resort to the fragile hack + * of redefining according to the observed definition. */ #ifdef HAVE_UNISTD_H -#ifdef __block -/* Turn off Clang built-in __block */ -#undef __block -#endif -#define __block __gs_unistd_block -#include -#undef __block +# ifdef __block +# undef __block +# define __block __gs_unistd_block +# include +# undef __block +# define __block __attribute__((__blocks__(byref))) +# endif +#else +# define __block __gs_unistd_block +# include +# undef __block #endif