Tweak the exception mismatch handling so that if base is using native

exceptions and the user doesn't specify an exception mode then we just don't
define the NS_ macros, so code that uses @try etc. compiles without requiring
every cc line to specify a long -D flag just to be allowed to #import
Foundation.h.




git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34501 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
David Chisnall 2012-01-12 10:10:33 +00:00
parent ff7ce0ea8e
commit 874875cc71

View file

@ -35,12 +35,10 @@
#if defined(_NATIVE_OBJC_EXCEPTIONS)
#define USER_NATIVE_OBJC_EXCEPTIONS 1
#elif __has_feature(objc_exceptions)
#define USER_NATIVE_OBJC_EXCEPTIONS 1
#else
#define USER_NATIVE_OBJC_EXCEPTIONS 0
#endif
#if BASE_NATIVE_OBJC_EXCEPTIONS != USER_NATIVE_OBJC_EXCEPTIONS
#if !BASE_NATIVE_OBJC_EXCEPTIONS && USER_NATIVE_OBJC_EXCEPTIONS
#error The current setting for native-objc-exceptions does not match that of gnustep-base ... please correct this.
#endif
@ -330,7 +328,7 @@ NSSetUncaughtExceptionHandler(NSUncaughtExceptionHandler *handler);
It is illegal to exit the first block of code by any other means than
NS_VALRETURN, NS_VOIDRETURN, or just falling out the bottom.
*/
#if defined(_NATIVE_OBJC_EXCEPTIONS)
#if USER_NATIVE_OBJC_EXCEPTIONS
# define NS_DURING @try {
# define NS_HANDLER } @catch (NSException * localException) {
@ -340,7 +338,7 @@ NSSetUncaughtExceptionHandler(NSUncaughtExceptionHandler *handler);
# define NS_VALUERETURN(object, id) return (object)
# define NS_VOIDRETURN return
#else // _NATIVE_OBJC_EXCEPTIONS
#elif !USER_NATIVE_OBJC_EXCEPTIONS && !BASE_NATIVE_OBJC_EXCEPTIONS
/** Private support routine. Do not call directly. */
GS_EXPORT void _NSAddHandler( NSHandler *handler );