Made Object less magic. For now, because there are some weird people who want to use Objective-C without Foundation, Object is still included. If you compile without defining GNUSTEP (which GNUstep Make does automatically) then you get the old behaviour. If you build with GNUSTEP defined:

+load will not be sent until both NSObject and NSConstantString have been seen.
NSObject will be set as the superclass for all metaclasses, not Object.

This is in line with Cocoa and should make it a bit easier for people porting code who have categories on NSObject and are confused that they don't work as expected.  

Object and NXConstantString are now deprecated.  They're staying here because I use them for producing reduced test cases for the runtime and compiler, but they shouldn't be used.  I will probably remove them from the default build soon.
main
theraven 16 years ago
parent 0698e968ee
commit dfa14d5d34

@ -94,6 +94,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "objc/objc-api.h"
#include "lock.h"
#include "magic_objects.h"
#include <stdlib.h>
@ -230,13 +231,15 @@ void
__objc_resolve_class_links (void)
{
void *es = NULL;
Class object_class = objc_get_class ("Object");
Class object_class = objc_get_class (ROOT_OBJECT_CLASS_NAME);
fprintf(stderr, "Using root class: %s\n", ROOT_OBJECT_CLASS_NAME);
Class class1;
assert (object_class);
LOCK(__objc_runtime_mutex);
/* Assign subclass links. */
while ((class1 = class_table_next (&es)))
{

@ -28,6 +28,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "objc/runtime-legacy.h"
#include "objc/encoding.h"
#include "lock.h"
#include "magic_objects.h"
/* The version number of this runtime. This must match the number
defined in gcc (objc-act.c). */
@ -837,8 +838,8 @@ objc_send_load (void)
/* Special check to allow creating and sending messages to constant
strings in +load methods. If these classes are not yet known,
even if all the other classes are known, delay sending of +load. */
if (! objc_lookup_class ("NXConstantString") ||
! objc_lookup_class ("Object"))
if (! objc_lookup_class (CONSTANT_STRING_CLASS) ||
! objc_lookup_class (ROOT_OBJECT_CLASS_NAME))
return;
/* Iterate over all modules in the __objc_module_list and call on

@ -0,0 +1,7 @@
#ifdef GNUSTEP
static const char *ROOT_OBJECT_CLASS_NAME = "NSObject";
static const char *CONSTANT_STRING_CLASS = "NSConstantString";
#else
static const char *ROOT_OBJECT_CLASS_NAME = "Object";
static const char *CONSTANT_STRING_CLASS = "NXConstantString";
#endif
Loading…
Cancel
Save