From e7e54eb954bf0a369bf455f3052a538c767639b6 Mon Sep 17 00:00:00 2001 From: Richard Frith-MacDonald Date: Tue, 31 Jul 2007 12:10:26 +0000 Subject: [PATCH] Fixup for usage with flag to turn off typeof() git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/stable@25364 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 12 ++++++++++++ Headers/Additions/GNUstepBase/preface.h.in | 6 +++--- Headers/Foundation/NSAutoreleasePool.h | 3 ++- Headers/Foundation/NSException.h | 2 +- Headers/Foundation/NSGeometry.h | 4 ++-- Headers/Foundation/NSRange.h | 4 ++-- macosx/GNUstepBase/preface.h | 6 +++--- 7 files changed, 25 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 540bdcd9d..3d4557ba2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2007-07-31 Richard Frith-Macdonald + + * Headers/Foundation/NSRange.h: + * Headers/Foundation/NSException.h: + * Headers/Foundation/NSGeometry.h: + * Headers/Foundation/NSAutoreleasePool.h: + * Headers/Additions/GNUstepBase/preface.h.in: + * macosx/GNUstepBase/preface.h: + Use __typeof__ rather than typeof so that if the header is included + in user code which is compiled with a flag to disalow typeof, the + code will still work. + 2007-07-22 Richard Frith-Macdonald * Tools/AGSOutput.m: escape angle brackets in types of function diff --git a/Headers/Additions/GNUstepBase/preface.h.in b/Headers/Additions/GNUstepBase/preface.h.in index 72bcbc9fc..14767ce7f 100644 --- a/Headers/Additions/GNUstepBase/preface.h.in +++ b/Headers/Additions/GNUstepBase/preface.h.in @@ -112,19 +112,19 @@ #ifndef MAX #define MAX(a,b) \ - ({typeof(a) _MAX_a = (a); typeof(b) _MAX_b = (b); \ + ({__typeof__(a) _MAX_a = (a); __typeof__(b) _MAX_b = (b); \ _MAX_a > _MAX_b ? _MAX_a : _MAX_b; }) #endif #ifndef MIN #define MIN(a,b) \ - ({typeof(a) _MIN_a = (a); typeof(b) _MIN_b = (b); \ + ({__typeof__(a) _MIN_a = (a); __typeof__(b) _MIN_b = (b); \ _MIN_a < _MIN_b ? _MIN_a : _MIN_b; }) #endif #ifndef ABS #define ABS(a) \ - ({typeof(a) _ABS_a = (a); \ + ({__typeof__(a) _ABS_a = (a); \ _ABS_a < 0 ? -_ABS_a : _ABS_a; }) #endif diff --git a/Headers/Foundation/NSAutoreleasePool.h b/Headers/Foundation/NSAutoreleasePool.h index c7705743d..04e7e98c6 100644 --- a/Headers/Foundation/NSAutoreleasePool.h +++ b/Headers/Foundation/NSAutoreleasePool.h @@ -70,7 +70,8 @@ typedef struct autorelease_thread_vars /* Initialize an autorelease_thread_vars structure for a new thread. This function is called in NSThread each time an NSThread is created. TV should be of type `struct autorelease_thread_vars *' */ -#define init_autorelease_thread_vars(TV) memset (TV, 0, sizeof (typeof (*TV))) +#define init_autorelease_thread_vars(TV) \ +memset (TV, 0, sizeof (__typeof__ (*TV))) diff --git a/Headers/Foundation/NSException.h b/Headers/Foundation/NSException.h index f9e126477..3051846ef 100644 --- a/Headers/Foundation/NSException.h +++ b/Headers/Foundation/NSException.h @@ -304,7 +304,7 @@ GS_EXPORT void _NSRemoveHandler( NSHandler *handler ); #define NS_ENDHANDLER }}} -#define NS_VALRETURN(val) do { typeof(val) temp = (val); \ +#define NS_VALRETURN(val) do { __typeof__(val) temp = (val); \ _NSRemoveHandler(&NSLocalHandler); \ return(temp); } while (0) diff --git a/Headers/Foundation/NSGeometry.h b/Headers/Foundation/NSGeometry.h index 1ae99c602..87cf88862 100644 --- a/Headers/Foundation/NSGeometry.h +++ b/Headers/Foundation/NSGeometry.h @@ -38,14 +38,14 @@ extern "C" { #ifndef MAX #define MAX(a,b) \ - ({typeof(a) _MAX_a = (a); typeof(b) _MAX_b = (b); \ + ({__typeof__(a) _MAX_a = (a); __typeof__(b) _MAX_b = (b); \ _MAX_a > _MAX_b ? _MAX_a : _MAX_b; }) #define GS_DEFINED_MAX #endif #ifndef MIN #define MIN(a,b) \ - ({typeof(a) _MIN_a = (a); typeof(b) _MIN_b = (b); \ + ({__typeof__(a) _MIN_a = (a); __typeof__(b) _MIN_b = (b); \ _MIN_a < _MIN_b ? _MIN_a : _MIN_b; }) #define GS_DEFINED_MIN #endif diff --git a/Headers/Foundation/NSRange.h b/Headers/Foundation/NSRange.h index cc14cd0b0..0a8a766a8 100644 --- a/Headers/Foundation/NSRange.h +++ b/Headers/Foundation/NSRange.h @@ -41,14 +41,14 @@ extern "C" { #ifndef MAX #define MAX(a,b) \ - ({typeof(a) _MAX_a = (a); typeof(b) _MAX_b = (b); \ + ({__typeof__(a) _MAX_a = (a); __typeof__(b) _MAX_b = (b); \ _MAX_a > _MAX_b ? _MAX_a : _MAX_b; }) #define GS_DEFINED_MAX #endif #ifndef MIN #define MIN(a,b) \ - ({typeof(a) _MIN_a = (a); typeof(b) _MIN_b = (b); \ + ({__typeof__(a) _MIN_a = (a); __typeof__(b) _MIN_b = (b); \ _MIN_a < _MIN_b ? _MIN_a : _MIN_b; }) #define GS_DEFINED_MIN #endif diff --git a/macosx/GNUstepBase/preface.h b/macosx/GNUstepBase/preface.h index 1e3c797c5..92a422c11 100644 --- a/macosx/GNUstepBase/preface.h +++ b/macosx/GNUstepBase/preface.h @@ -119,19 +119,19 @@ extern const char o_NeXT_cc_version[]; #ifndef MAX #define MAX(a,b) \ - ({typeof(a) _MAX_a = (a); typeof(b) _MAX_b = (b); \ + ({__typeof__(a) _MAX_a = (a); __typeof__(b) _MAX_b = (b); \ _MAX_a > _MAX_b ? _MAX_a : _MAX_b; }) #endif #ifndef MIN #define MIN(a,b) \ - ({typeof(a) _MIN_a = (a); typeof(b) _MIN_b = (b); \ + ({__typeof__(a) _MIN_a = (a); __typeof__(b) _MIN_b = (b); \ _MIN_a < _MIN_b ? _MIN_a : _MIN_b; }) #endif #ifndef ABS #define ABS(a) \ - ({typeof(a) _ABS_a = (a); \ + ({__typeof__(a) _ABS_a = (a); \ _ABS_a < 0 ? -_ABS_a : _ABS_a; }) #endif