Apply patch from bug #16437

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22827 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-04-26 14:15:03 +00:00
parent 501a72f55f
commit 98f6da8323
3 changed files with 22 additions and 1 deletions

View file

@ -1,3 +1,7 @@
2006-04-26 Saso Kiselkov
* Headers/Foundation/NSException.h: Support native exceptions.
2006-04-26 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSCalendarDate.m: Correction to millisecond fix ... for

View file

@ -254,11 +254,22 @@ GS_EXPORT NSUncaughtExceptionHandler *_NSUncaughtExceptionHandler;
resources allocated in the routine, possibly case on the error code
and perform special processing, and default to RERAISE the error to
the next handler. Within the scope of the handler, a local variable
called exception holds information about the exception raised.
called "localException" holds information about the exception raised.
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.
*/
#ifdef _NATIVE_OBJC_EXCEPTIONS
# define NS_DURING @try {
# define NS_HANDLER } @catch (NSException * localException) {
# define NS_ENDHANDLER }
# define NS_VALRETURN(val) return (val)
# define NS_VALUERETURN(object, id) return (object)
# define NS_VOIDRETURN return
#else // _NATIVE_OBJC_EXCEPTIONS
/** Private support routine. Do not call directly. */
GS_EXPORT void _NSAddHandler( NSHandler *handler );
@ -287,6 +298,8 @@ GS_EXPORT void _NSRemoveHandler( NSHandler *handler );
#define NS_VOIDRETURN do { _NSRemoveHandler(&NSLocalHandler); \
return; } while (0)
#endif // _NATIVE_OBJC_EXCEPTIONS
/* ------------------------------------------------------------------------ */
/* Assertion Handling */
/* ------------------------------------------------------------------------ */

View file

@ -141,6 +141,9 @@ _NSFoundationUncaughtExceptionHandler (NSException *exception)
- (void) raise
{
#ifdef _NATIVE_OBJC_EXCEPTIONS
@throw self;
#else
NSThread *thread;
NSHandler *handler;
@ -185,6 +188,7 @@ _NSFoundationUncaughtExceptionHandler (NSException *exception)
thread->_exception_handler = handler->next;
handler->exception = self;
longjmp(handler->jumpState, 1);
#endif
}
- (NSString*) name