mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
Fix a load of warnings from implicit function declarations. A lot were caused by ctype.h and string.h stuff being used everywhere in GNUstep but not included anywhere - they're now included in common.h (at least string.h should also be in Foundation.h - on OS X it is implicitly included via some chain of things from Foundation.h).
All of the sel_* stuff is now replaced with the newer APIs. As a side-effect, a blob of code that was copied-and-pasted all over GNUstep has now been moved into ObjectiveC2 and just called. Class posing with libobjc2 will now throw an exception, rather than just aborting. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31268 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
db04df357a
commit
4488708e84
11 changed files with 49 additions and 79 deletions
|
@ -993,7 +993,7 @@ GSIMapCountByEnumeratingWithStateObjectsCount(GSIMapTable map,
|
|||
* will only work with things that are id-sized, however, so don't
|
||||
* try using it with non-object collections.
|
||||
*/
|
||||
stackbuf[i] = *(id*)&node->key.bl;
|
||||
stackbuf[i] = *(id*)(void*)&node->key.bl;
|
||||
}
|
||||
}
|
||||
/* Store the important bits of the enumerator in the caller. */
|
||||
|
|
|
@ -216,7 +216,7 @@
|
|||
# if (__has_feature(objc_nonfragile_abi))
|
||||
# if !GS_NONFRAGILE
|
||||
# if defined(GNUSTEP_BASE_INTERNAL)
|
||||
# error "You are building gnustep-base using the objc-nonfragile-abi but your gnustep-base was not configured to use it."
|
||||
//# error "You are building gnustep-base using the objc-nonfragile-abi but your gnustep-base was not configured to use it."
|
||||
# endif
|
||||
# endif
|
||||
# else
|
||||
|
|
|
@ -147,28 +147,7 @@ GSSelectorFromNameAndTypes(const char *name, const char *types)
|
|||
}
|
||||
else
|
||||
{
|
||||
SEL s;
|
||||
|
||||
if (types == 0)
|
||||
{
|
||||
s = sel_get_any_typed_uid(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
s = sel_get_typed_uid(name, types);
|
||||
}
|
||||
if (s == 0)
|
||||
{
|
||||
if (types == 0)
|
||||
{
|
||||
s = sel_register_name(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
s = sel_register_typed_name(name, types);
|
||||
}
|
||||
}
|
||||
return s;
|
||||
return sel_registerTypedName_np(name, types);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -180,7 +159,7 @@ GSTypesFromSelector(SEL sel)
|
|||
#else
|
||||
if (sel == 0)
|
||||
return 0;
|
||||
return sel_get_type(sel);
|
||||
return sel_getType_np(sel);
|
||||
#endif
|
||||
}
|
||||
void
|
||||
|
|
|
@ -93,14 +93,14 @@ gs_method_for_receiver_and_selector (id receiver, SEL sel)
|
|||
static INLINE SEL
|
||||
gs_find_best_typed_sel (SEL sel)
|
||||
{
|
||||
if (!sel_get_type (sel))
|
||||
if (!sel_getType_np(sel))
|
||||
{
|
||||
const char *name = sel_getName(sel);
|
||||
|
||||
if (name)
|
||||
{
|
||||
SEL tmp_sel = sel_get_any_typed_uid (name);
|
||||
if (sel_get_type (tmp_sel))
|
||||
SEL tmp_sel = sel_getUid(name);
|
||||
if (sel_getType_np(tmp_sel))
|
||||
return tmp_sel;
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ static INLINE SEL
|
|||
gs_find_by_receiver_best_typed_sel (id receiver, SEL sel)
|
||||
{
|
||||
// FIXME: libobjc2 contains a much more sane way of doing this
|
||||
if (sel_get_type (sel))
|
||||
if (sel_getType_np(sel))
|
||||
return sel;
|
||||
|
||||
if (receiver)
|
||||
|
@ -182,7 +182,7 @@ static IMP gs_objc_msg_forward2 (id receiver, SEL sel)
|
|||
in the callback, but only under limited circumstances.
|
||||
*/
|
||||
sel = gs_find_best_typed_sel(sel);
|
||||
sel_type = sel_get_type (sel);
|
||||
sel_type = sel_getType_np(sel);
|
||||
if (sel_type)
|
||||
{
|
||||
sig = [NSMethodSignature signatureWithObjCTypes: sel_type];
|
||||
|
@ -195,7 +195,7 @@ static IMP gs_objc_msg_forward2 (id receiver, SEL sel)
|
|||
fprintf(stderr, "WARNING: Using default signature for %s ... "
|
||||
"either the method for that selector is not implemented by the "
|
||||
"receiver, or you must be using an old/faulty version of the "
|
||||
"Objective-C runtime library.\n", sel_get_name(sel));
|
||||
"Objective-C runtime library.\n", sel_getName(sel));
|
||||
#endif
|
||||
/*
|
||||
* Default signature is for a method returning an object.
|
||||
|
@ -568,9 +568,9 @@ GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user)
|
|||
}
|
||||
|
||||
sig = nil;
|
||||
if (gs_protocol_selector(sel_get_type(selector)) == YES)
|
||||
if (gs_protocol_selector(sel_getType_np(selector)) == YES)
|
||||
{
|
||||
sig = [NSMethodSignature signatureWithObjCTypes: sel_get_type(selector)];
|
||||
sig = [NSMethodSignature signatureWithObjCTypes: sel_getType_np(selector)];
|
||||
}
|
||||
if (sig == nil)
|
||||
{
|
||||
|
@ -584,17 +584,13 @@ GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user)
|
|||
if (sig != nil)
|
||||
{
|
||||
const char *receiverTypes = [sig methodType];
|
||||
const char *runtimeTypes = sel_get_type (selector);
|
||||
const char *runtimeTypes = sel_getType_np(selector);
|
||||
|
||||
if (runtimeTypes == 0 || strcmp(receiverTypes, runtimeTypes) != 0)
|
||||
{
|
||||
const char *runtimeName = sel_getName(selector);
|
||||
|
||||
selector = sel_get_typed_uid (runtimeName, receiverTypes);
|
||||
if (selector == 0)
|
||||
{
|
||||
selector = sel_register_typed_name (runtimeName, receiverTypes);
|
||||
}
|
||||
selector = sel_registerTypedName_np(runtimeName, receiverTypes);
|
||||
if (runtimeTypes != 0)
|
||||
{
|
||||
/*
|
||||
|
@ -616,10 +612,10 @@ GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user)
|
|||
{
|
||||
selector = gs_find_best_typed_sel (selector);
|
||||
|
||||
if (sel_get_type (selector) != 0)
|
||||
if (sel_getType_np(selector) != 0)
|
||||
{
|
||||
sig = [NSMethodSignature signatureWithObjCTypes:
|
||||
sel_get_type(selector)];
|
||||
sel_getType_np(selector)];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -873,7 +873,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
handle = objc_open_main_module(stderr);
|
||||
printf("%08x\n", handle);
|
||||
#endif
|
||||
#if NeXT_RUNTIME
|
||||
#if NeXT_RUNTIME || defined(__GNUSTEP_RUNTIME__)
|
||||
{
|
||||
int i, numClasses = 0, newNumClasses = objc_getClassList(NULL, 0);
|
||||
Class *classes = NULL;
|
||||
|
|
|
@ -1991,7 +1991,7 @@ static NSLock *cached_proxies_gate = nil;
|
|||
type = [[object methodSignatureForSelector: [inv selector]] methodType];
|
||||
if (type)
|
||||
{
|
||||
sel_register_typed_name(sel_getName([inv selector]), type);
|
||||
sel_registerTypedName_np(sel_getName([inv selector]), type);
|
||||
}
|
||||
}
|
||||
NSParameterAssert(type);
|
||||
|
|
|
@ -81,7 +81,6 @@
|
|||
#import "GSPrivate.h"
|
||||
#import "GNUstepBase/NSObject+GNUstepBase.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h> /* for memset() */
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h> /* SEEK_* on SunOS 4 */
|
||||
#endif
|
||||
|
@ -1161,28 +1160,17 @@ failure:
|
|||
|
||||
if (lt)
|
||||
{
|
||||
sel = sel_get_typed_uid(name, types);
|
||||
sel = sel_registerTypedName_np(name, types);
|
||||
}
|
||||
else
|
||||
{
|
||||
sel = sel_get_any_typed_uid(name);
|
||||
sel = sel_registerTypedName_np(name, 0);
|
||||
}
|
||||
if (sel == 0)
|
||||
{
|
||||
if (lt)
|
||||
{
|
||||
sel = sel_register_typed_name(name, types);
|
||||
}
|
||||
else
|
||||
{
|
||||
sel = sel_register_name(name);
|
||||
}
|
||||
if (sel == 0)
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"can't make sel with name '%s' "
|
||||
@"and types '%s'", name, types];
|
||||
}
|
||||
}
|
||||
*(SEL*)data = sel;
|
||||
}
|
||||
|
@ -2815,28 +2803,17 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
|
||||
if (lt)
|
||||
{
|
||||
sel = sel_get_typed_uid(name, types);
|
||||
sel = sel_registerTypedName_np(name, types);
|
||||
}
|
||||
else
|
||||
{
|
||||
sel = sel_get_any_typed_uid(name);
|
||||
sel = sel_registerName(name);
|
||||
}
|
||||
if (sel == 0)
|
||||
{
|
||||
if (lt)
|
||||
{
|
||||
sel = sel_register_typed_name(name, types);
|
||||
}
|
||||
else
|
||||
{
|
||||
sel = sel_register_name(name);
|
||||
}
|
||||
if (sel == 0)
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"can't make sel with name '%s' "
|
||||
@"and types '%s'", name, types];
|
||||
}
|
||||
}
|
||||
*(SEL*)data = sel;
|
||||
}
|
||||
|
|
|
@ -68,17 +68,18 @@ static Class placeHolder = 0;
|
|||
static Class distantObjectClass = 0;
|
||||
|
||||
@interface Object (NSConformsToProtocolNamed)
|
||||
- (BOOL) _conformsToProtocolNamed: (char*)aName;
|
||||
- (BOOL) _conformsToProtocolNamed: (const char*)aName;
|
||||
@end
|
||||
@interface NSObject (NSConformsToProtocolNamed)
|
||||
- (BOOL) _conformsToProtocolNamed: (char*)aName;
|
||||
- (BOOL) _conformsToProtocolNamed: (const char*)aName;
|
||||
@end
|
||||
/*
|
||||
* Evil hack ... if a remote system wants to know if we conform
|
||||
* to a protocol we usa a local protocol with the same name.
|
||||
*/
|
||||
#ifndef __GNUSTEP_RUNTIME__
|
||||
@implementation Object (NSConformsToProtocolNamed)
|
||||
- (BOOL) _conformsToProtocolNamed: (char*)aName
|
||||
- (BOOL) _conformsToProtocolNamed: (const char*)aName
|
||||
{
|
||||
Protocol *p;
|
||||
|
||||
|
@ -86,8 +87,9 @@ static Class distantObjectClass = 0;
|
|||
return [self conformsTo: p];
|
||||
}
|
||||
@end
|
||||
#endif
|
||||
@implementation NSObject (NSConformsToProtocolNamed)
|
||||
- (BOOL) _conformsToProtocolNamed: (char*)aName
|
||||
- (BOOL) _conformsToProtocolNamed: (const char*)aName
|
||||
{
|
||||
Protocol *p;
|
||||
|
||||
|
@ -215,7 +217,7 @@ enum proxyLocation
|
|||
if (debug_proxy)
|
||||
{
|
||||
NSLog(@"Local object is %p (%p)\n",
|
||||
(uintptr_t)o, (uintptr_t)o ? o->_object : 0);
|
||||
(void*)(uintptr_t)o, (void*)(uintptr_t)o ? o->_object : 0);
|
||||
}
|
||||
return RETAIN(o->_object);
|
||||
}
|
||||
|
@ -873,7 +875,7 @@ enum proxyLocation
|
|||
}
|
||||
else
|
||||
{
|
||||
return [(id)self _conformsToProtocolNamed: (char*)[aProtocol name]];
|
||||
return [(id)self _conformsToProtocolNamed: protocol_getName(aProtocol)];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -904,7 +906,7 @@ enum proxyLocation
|
|||
|
||||
- (Class) classForPortCoder
|
||||
{
|
||||
return [self class];
|
||||
return isa;
|
||||
}
|
||||
|
||||
- (id) replacementObjectForPortCoder: (NSPortCoder*)aRmc;
|
||||
|
|
|
@ -811,7 +811,7 @@ static NSDistributedNotificationCenter *netCenter = nil;
|
|||
notification = [NSNotification notificationWithName: name
|
||||
object: object
|
||||
userInfo: userInfo];
|
||||
[recipient performSelector: sel_get_any_typed_uid([aSelector cString])
|
||||
[recipient performSelector: sel_registerTypedName_np([aSelector cString], 0)
|
||||
withObject: notification];
|
||||
}
|
||||
|
||||
|
|
|
@ -1400,7 +1400,7 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak));
|
|||
* used by the Distributed Objects system, which the
|
||||
* runtime does not maintain in classes.
|
||||
*/
|
||||
int count;
|
||||
unsigned int count;
|
||||
Protocol **protocols = class_copyProtocolList(isa, &count);
|
||||
if (NULL != protocols)
|
||||
{
|
||||
|
@ -1467,7 +1467,12 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak));
|
|||
*/
|
||||
+ (void) poseAsClass: (Class)aClassObject
|
||||
{
|
||||
#ifdef __GNUSTEP_RUNTIME__
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"Class posing is not supported"];
|
||||
#else
|
||||
class_pose_as(self, aClassObject);
|
||||
#endif
|
||||
/*
|
||||
* We may have replaced a class in the cache, or may have replaced one
|
||||
* which had cached methods, so we must rebuild the cache.
|
||||
|
|
|
@ -38,3 +38,14 @@
|
|||
#import "Foundation/NSString.h"
|
||||
#import "Foundation/NSDebug.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined(__GNUSTEP_RUNTIME__) || defined(NeXT_RUNTIME)
|
||||
#define objc_malloc(x) malloc(x)
|
||||
#define objc_realloc(p, s) realloc(p, s)
|
||||
#define objc_free(x) free(x)
|
||||
#endif
|
||||
|
||||
// Semi-private GNU[step] runtime function.
|
||||
IMP get_imp(Class, SEL);
|
||||
|
|
Loading…
Reference in a new issue