emergency fixup for broken build

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30907 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2010-07-01 07:17:53 +00:00
parent 6b73dea2f3
commit 6f1e7e3af3
3 changed files with 62 additions and 54 deletions

View file

@ -1,3 +1,10 @@
2010-07-01 Richard Frith-Macdonald <rfm@gnu.org>
* Source/CXXException.m: Fixup to get base to compile again.
I think this API needs improving ... this should be an NSException
subclass or category, and catching it should be transparent to the
developer.
2010-06-29 Richard Frith-Macdonald <rfm@gnu.org> 2010-06-29 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSKeyedUnarchiver.m: Workaround for buggy inttypes.h on older * Source/NSKeyedUnarchiver.m: Workaround for buggy inttypes.h on older

View file

@ -20,23 +20,23 @@ struct _Unwind_Exception;
/** /**
* Constructor called by the runtime. * Constructor called by the runtime.
*/ */
+ (id)exceptionWithForeignException: (struct _Unwind_Exception*)ex; + (id) exceptionWithForeignException: (struct _Unwind_Exception*)ex;
/** /**
* Returns a pointer to the thrown value. When a value is thrown in C++, it is * Returns a pointer to the thrown value. When a value is thrown in C++, it is
* copied into the exception structure. The real type of the pointee is the * copied into the exception structure. The real type of the pointee is the
* type of the object that was thrown. * type of the object that was thrown.
*/ */
- (void*)thrownValue; - (void*) thrownValue;
/** /**
* Returns a pointer to a std::type_info (C++) object defining the type of the * Returns a pointer to a std::type_info (C++) object defining the type of the
* value pointed to by the return from -thrownValue. You may compare this with * value pointed to by the return from -thrownValue. You may compare this with
* the result of the typeinfo() operator in Objective-C++ to determine the type * the result of the typeinfo() operator in Objective-C++ to determine the type
* of the object. * of the object.
*/ */
- (void*)cxx_type_info; - (void*) cxx_type_info;
/** /**
* Rethrows the exception. Sending messages to this object after is has been * Rethrows the exception. Sending messages to this object after is has been
* rethrown has undefined behaviour. * rethrown has undefined behaviour.
*/ */
- (void)rethrow; - (void) rethrow;
@end @end

View file

@ -1,4 +1,5 @@
#if defined(__has_include) && __has_include(<objc/hooks.h>) #if defined(__has_include)
#if __has_include(<objc/hooks.h>)
#import "Foundation/NSObject.h" #import "Foundation/NSObject.h"
#import "Additions/GNUstepBase/CXXException.h" #import "Additions/GNUstepBase/CXXException.h"
#include <objc/runtime.h> #include <objc/runtime.h>
@ -29,11 +30,11 @@ _Unwind_Reason_Code _Unwind_Resume_or_Rethrow(struct _Unwind_Exception *);
struct __cxa_exception struct __cxa_exception
{ {
void* exceptionType; void *exceptionType;
void (*exceptionDestructor) (void *); void (*exceptionDestructor) (void *);
void (*unexpectedHandler) (void *); void (*unexpectedHandler) (void *);
void (*terminateHandler) (void *); void (*terminateHandler) (void *);
void * nextException; void *nextException;
int handlerCount; int handlerCount;
int handlerSwitchValue; int handlerSwitchValue;
@ -41,7 +42,6 @@ struct __cxa_exception
const char * languageSpecificData; const char * languageSpecificData;
void * catchTemp; void * catchTemp;
void * adjustedPtr; void * adjustedPtr;
struct _Unwind_Exception unwindHeader; struct _Unwind_Exception unwindHeader;
}; };
@ -56,35 +56,35 @@ static Class boxClass(int64_t foo)
} }
return Nil; return Nil;
} }
+ (void)load + (void) load
{ {
CXXExceptionClass = self; CXXExceptionClass = self;
_objc_class_for_boxing_foreign_exception = boxClass; _objc_class_for_boxing_foreign_exception = boxClass;
} }
+ (id)exceptionWithForeignException: (struct _Unwind_Exception*)ex + (id) exceptionWithForeignException: (struct _Unwind_Exception*)ex
{ {
CXXException *box = [self new]; CXXException *box = [self new];
box->ex = ex; box->ex = ex;
return [box autorelease]; return [box autorelease];
} }
- (void*)thrownValue - (void*) thrownValue
{ {
return ex+1; return ex + 1;
} }
- (void*)cxx_type_info - (void*) cxx_type_info
{ {
char *ptr = (char*)ex; char *ptr = (char*)ex;
ptr -= __builtin_offsetof(struct __cxa_exception, unwindHeader); ptr -= __builtin_offsetof(struct __cxa_exception, unwindHeader);
return ((struct __cxa_exception*)ptr)->exceptionType; return ((struct __cxa_exception*)ptr)->exceptionType;
} }
- (void)rethrow - (void) rethrow
{ {
struct _Unwind_Exception *re = ex; struct _Unwind_Exception *re = ex;
// We aren't allowed to hold onto the exception if it's been rethrown. // We aren't allowed to hold onto the exception if it's been rethrown.
ex = 0; ex = 0;
_Unwind_Resume_or_Rethrow(re); _Unwind_Resume_or_Rethrow(re);
} }
- (void)dealloc - (void) dealloc
{ {
if (0 != ex && 0 != ex->exception_cleanup) if (0 != ex && 0 != ex->exception_cleanup)
{ {
@ -95,3 +95,4 @@ static Class boxClass(int64_t foo)
@end @end
#endif #endif
#endif