Updated for GCC 4.6

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31771 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
nicola 2010-12-24 17:19:40 +00:00
parent fb481f5fc8
commit 9db061f0a6
4 changed files with 33 additions and 13 deletions

View file

@ -1,3 +1,13 @@
2010-12-24 Nicola Pero <nicola.pero@meta-innovation.com>
* Source/NSObject.m ([+conformsToProtocol:]): Use the new code
only if __GNU_LIBOBJC__ is defined.
* Source/Additions/GSObjCRuntime.m (GSTypesFromSelector): Updated
usage of Modern typed selector API with __GNU_LIBOBJC__.
* Source/GSFFIInvocation.m (gs_find_best_typed_sel): Same.
(gs_objc_msg_forward2): Same.
(GSFFIInvocationCallback): Same.
2010-12-24 Nicola Pero <nicola.pero@meta-innovation.com> 2010-12-24 Nicola Pero <nicola.pero@meta-innovation.com>
* Source/NSObject.m ([+conformsToProtocol:]): Fixed to iterate * Source/NSObject.m ([+conformsToProtocol:]): Fixed to iterate

View file

@ -166,7 +166,7 @@ GSTypesFromSelector(SEL sel)
if (sel == 0) if (sel == 0)
return 0; return 0;
#ifdef __GNU_LIBOBJC__ #ifdef __GNU_LIBOBJC__
return sel_getType(sel); return sel_getTypeEncoding(sel);
#else #else
return sel_getType_np(sel); return sel_getType_np(sel);
#endif #endif

View file

@ -101,7 +101,7 @@ static INLINE SEL
gs_find_best_typed_sel (SEL sel) gs_find_best_typed_sel (SEL sel)
{ {
#ifdef __GNU_LIBOBJC__ #ifdef __GNU_LIBOBJC__
if (!sel_getType(sel)) if (!sel_getTypeEncoding(sel))
#else #else
if (!sel_getType_np(sel)) if (!sel_getType_np(sel))
#endif #endif
@ -110,13 +110,15 @@ gs_find_best_typed_sel (SEL sel)
if (name) if (name)
{ {
SEL tmp_sel = sel_get_any_typed_uid(name);
#ifdef __GNU_LIBOBJC__ #ifdef __GNU_LIBOBJC__
if (sel_getType(tmp_sel)) SEL tmp_sel = sel_getTypedSelector(name);
#else if (tmp_sel)
if (sel_getType_np(tmp_sel))
#endif
return tmp_sel; return tmp_sel;
#else
SEL tmp_sel = sel_get_any_typed_uid(name);
if (sel_getType_np(tmp_sel))
return tmp_sel;
#endif
} }
} }
return sel; return sel;
@ -163,7 +165,7 @@ static IMP gs_objc_msg_forward2 (id receiver, SEL sel)
*/ */
sel = gs_find_best_typed_sel(sel); sel = gs_find_best_typed_sel(sel);
#ifdef __GNU_LIBOBJC__ #ifdef __GNU_LIBOBJC__
sel_type = sel_getType(sel); sel_type = sel_getTypeEncoding(sel);
#else #else
sel_type = sel_getType_np(sel); sel_type = sel_getType_np(sel);
#endif #endif
@ -556,9 +558,9 @@ GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user)
sig = nil; sig = nil;
#ifdef __GNU_LIBOBJC__ #ifdef __GNU_LIBOBJC__
if (gs_protocol_selector(sel_getType(selector)) == YES) if (gs_protocol_selector(sel_getTypeEncoding(selector)) == YES)
{ {
sig = [NSMethodSignature signatureWithObjCTypes: sel_getType(selector)]; sig = [NSMethodSignature signatureWithObjCTypes: sel_getTypeEncoding(selector)];
} }
#else #else
if (gs_protocol_selector(sel_getType_np(selector)) == YES) if (gs_protocol_selector(sel_getType_np(selector)) == YES)
@ -579,7 +581,7 @@ GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user)
{ {
const char *receiverTypes = [sig methodType]; const char *receiverTypes = [sig methodType];
#ifdef __GNU_LIBOBJC__ #ifdef __GNU_LIBOBJC__
const char *runtimeTypes = sel_getType(selector); const char *runtimeTypes = sel_getTypeEncoding(selector);
#else #else
const char *runtimeTypes = sel_getType_np(selector); const char *runtimeTypes = sel_getType_np(selector);
#endif #endif
@ -615,10 +617,10 @@ GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user)
selector = gs_find_best_typed_sel (selector); selector = gs_find_best_typed_sel (selector);
#ifdef __GNU_LIBOBJC__ #ifdef __GNU_LIBOBJC__
if (sel_getType(selector) != 0) if (sel_getTypeEncoding(selector) != 0)
{ {
sig = [NSMethodSignature signatureWithObjCTypes: sig = [NSMethodSignature signatureWithObjCTypes:
sel_getType(selector)]; sel_getTypeEncoding(selector)];
} }
#else #else
if (sel_getType_np(selector) != 0) if (sel_getType_np(selector) != 0)

View file

@ -1298,6 +1298,7 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak));
*/ */
+ (BOOL) conformsToProtocol: (Protocol*)aProtocol + (BOOL) conformsToProtocol: (Protocol*)aProtocol
{ {
#ifdef __GNU_LIBOBJC__
Class c; Class c;
/* Iterate over the current class and all the superclasses. */ /* Iterate over the current class and all the superclasses. */
@ -1310,6 +1311,13 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak));
} }
return NO; return NO;
#else
/* libobjc2 and ObjectiveC2/ have an implementation of
class_conformsToProtocol() which automatically looks up the
protocol in superclasses (unlike the Apple and GNU Objective-C
runtime ones). */
return class_conformsToProtocol(self, aProtocol);
#endif
} }
/** /**