diff --git a/ChangeLog b/ChangeLog index aaadd8376..73fff9e05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-10-15 Richard Frith-Macdonald + + * Source/ObjectiveC2/NSBlocks.m: + * Source/Additions/GSObjCRuntime.m: + Fixes to build with latest gcc. + 2011-10-15 Gregory Casamento * Documentation/GNUmakefile: diff --git a/Source/Additions/GSObjCRuntime.m b/Source/Additions/GSObjCRuntime.m index 1d8ef96ee..fea8c270a 100644 --- a/Source/Additions/GSObjCRuntime.m +++ b/Source/Additions/GSObjCRuntime.m @@ -136,10 +136,15 @@ GSSelectorFromName(const char *name) return sel_getUid(name); } -// FIXME: Hack - need to provide these function declarations -// for gcc 4.6 libobjc. They're called below, and they're declared -// in objc-api.h, but we're using runtime.h, so objc-api.h can't be imported. -#if defined (__GNU_LIBOBJC__) +#if defined (__GNU_LIBOBJC__) && (__GNU_LIBOBJC__ < 20110608) +/* Don't use sel_registerTypedName() ... it's broken when first introduced + * into gcc (fails to correctly check for multiple registrations with same + * types but different layout info). + * Later versions of the runtime should be OK though. + * Hack - need to provide these function declarations + * for gcc 4.6 libobjc. They're called below, and they're declared + * in objc-api.h, but we're using runtime.h, so objc-api.h can't be imported. + */ SEL sel_get_any_typed_uid(const char *name); SEL sel_get_typed_uid(const char *name, const char*); SEL sel_register_name(const char *name); @@ -151,13 +156,8 @@ GSSelectorFromNameAndTypes(const char *name, const char *types) { #if NeXT_RUNTIME return sel_getUid(name); -/* Don't use sel_registerTypedName() ... it's broken when first introduced - * into gcc (fails to correctly check for multple registrations with same - * types but different layout info). - * -#elif defined (__GNU_LIBOBJC__) +#elif defined (__GNU_LIBOBJC__) && (__GNU_LIBOBJC__ >= 20110608) return sel_registerTypedName(name, types); - */ #elif defined (__GNUSTEP_RUNTIME__) return sel_registerTypedName_np(name, types); #else diff --git a/Source/ObjectiveC2/NSBlocks.m b/Source/ObjectiveC2/NSBlocks.m index 0fbb79404..5bf4998cf 100644 --- a/Source/ObjectiveC2/NSBlocks.m +++ b/Source/ObjectiveC2/NSBlocks.m @@ -1,4 +1,23 @@ + +#import + +#if defined (__GNU_LIBOBJC__) + +#warning Unable to build NSBlocks for this runtime. + +/* FIXME ... these let us link, but blocks will be broken. + */ +void *_NSConcreteStackBlock; +BOOL objc_create_block_classes_as_subclasses_of(Class super) +{ + return NO; +} + +#else + #import +#import "ObjectiveC2/runtime.h" + #import "ObjectiveC2/blocks_runtime.h" #include @@ -60,3 +79,6 @@ BOOL objc_create_block_classes_as_subclasses_of(Class super) NEW_CLASS(&_NSBlock, _NSConcreteGlobalBlock); return YES; } + +#endif /* defined (__GNU_LIBOBJC__) */ +