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
This commit is contained in:
Richard Frith-MacDonald 2007-07-31 12:10:26 +00:00
parent b2948fffd9
commit e7e54eb954
7 changed files with 25 additions and 12 deletions

View file

@ -1,3 +1,15 @@
2007-07-31 Richard Frith-Macdonald <rfm@gnu.org>
* 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 <rfm@gnu.org> 2007-07-22 Richard Frith-Macdonald <rfm@gnu.org>
* Tools/AGSOutput.m: escape angle brackets in types of function * Tools/AGSOutput.m: escape angle brackets in types of function

View file

@ -112,19 +112,19 @@
#ifndef MAX #ifndef MAX
#define MAX(a,b) \ #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; }) _MAX_a > _MAX_b ? _MAX_a : _MAX_b; })
#endif #endif
#ifndef MIN #ifndef MIN
#define MIN(a,b) \ #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; }) _MIN_a < _MIN_b ? _MIN_a : _MIN_b; })
#endif #endif
#ifndef ABS #ifndef ABS
#define ABS(a) \ #define ABS(a) \
({typeof(a) _ABS_a = (a); \ ({__typeof__(a) _ABS_a = (a); \
_ABS_a < 0 ? -_ABS_a : _ABS_a; }) _ABS_a < 0 ? -_ABS_a : _ABS_a; })
#endif #endif

View file

@ -70,7 +70,8 @@ typedef struct autorelease_thread_vars
/* Initialize an autorelease_thread_vars structure for a new thread. /* Initialize an autorelease_thread_vars structure for a new thread.
This function is called in NSThread each time an NSThread is created. This function is called in NSThread each time an NSThread is created.
TV should be of type `struct autorelease_thread_vars *' */ 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)))

View file

@ -304,7 +304,7 @@ GS_EXPORT void _NSRemoveHandler( NSHandler *handler );
#define NS_ENDHANDLER }}} #define NS_ENDHANDLER }}}
#define NS_VALRETURN(val) do { typeof(val) temp = (val); \ #define NS_VALRETURN(val) do { __typeof__(val) temp = (val); \
_NSRemoveHandler(&NSLocalHandler); \ _NSRemoveHandler(&NSLocalHandler); \
return(temp); } while (0) return(temp); } while (0)

View file

@ -38,14 +38,14 @@ extern "C" {
#ifndef MAX #ifndef MAX
#define MAX(a,b) \ #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; }) _MAX_a > _MAX_b ? _MAX_a : _MAX_b; })
#define GS_DEFINED_MAX #define GS_DEFINED_MAX
#endif #endif
#ifndef MIN #ifndef MIN
#define MIN(a,b) \ #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; }) _MIN_a < _MIN_b ? _MIN_a : _MIN_b; })
#define GS_DEFINED_MIN #define GS_DEFINED_MIN
#endif #endif

View file

@ -41,14 +41,14 @@ extern "C" {
#ifndef MAX #ifndef MAX
#define MAX(a,b) \ #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; }) _MAX_a > _MAX_b ? _MAX_a : _MAX_b; })
#define GS_DEFINED_MAX #define GS_DEFINED_MAX
#endif #endif
#ifndef MIN #ifndef MIN
#define MIN(a,b) \ #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; }) _MIN_a < _MIN_b ? _MIN_a : _MIN_b; })
#define GS_DEFINED_MIN #define GS_DEFINED_MIN
#endif #endif

View file

@ -119,19 +119,19 @@ extern const char o_NeXT_cc_version[];
#ifndef MAX #ifndef MAX
#define MAX(a,b) \ #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; }) _MAX_a > _MAX_b ? _MAX_a : _MAX_b; })
#endif #endif
#ifndef MIN #ifndef MIN
#define MIN(a,b) \ #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; }) _MIN_a < _MIN_b ? _MIN_a : _MIN_b; })
#endif #endif
#ifndef ABS #ifndef ABS
#define ABS(a) \ #define ABS(a) \
({typeof(a) _ABS_a = (a); \ ({__typeof__(a) _ABS_a = (a); \
_ABS_a < 0 ? -_ABS_a : _ABS_a; }) _ABS_a < 0 ? -_ABS_a : _ABS_a; })
#endif #endif