From 9e2747ae90308e03d317829959bfc3c4785c165a Mon Sep 17 00:00:00 2001 From: theraven Date: Thu, 12 Jan 2012 10:10:33 +0000 Subject: [PATCH] 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 --- Headers/Foundation/NSException.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Headers/Foundation/NSException.h b/Headers/Foundation/NSException.h index dd5e09ae4..aff013290 100644 --- a/Headers/Foundation/NSException.h +++ b/Headers/Foundation/NSException.h @@ -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 );