From 84785bf933b66336a6f0c2668ef3045c823324d2 Mon Sep 17 00:00:00 2001 From: fedor Date: Fri, 12 Aug 2005 20:13:43 +0000 Subject: [PATCH] * init.c (objc_init_statics): Initialize all statics. (__objc_init_protocols): Init all protocols. * sendmsg.c (objc_msg_lookup): Remove old protocol hack. (Patch #4206 from Jeremy Bettis). git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/libobjc/trunk@21635 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog.GNUstep | 7 +++++++ init.c | 7 +++++-- sendmsg.c | 16 ---------------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/ChangeLog.GNUstep b/ChangeLog.GNUstep index 94f136d..b80f6bf 100644 --- a/ChangeLog.GNUstep +++ b/ChangeLog.GNUstep @@ -1,3 +1,10 @@ +2005-08-12 Adam Fedor + + * init.c (objc_init_statics): Initialize all statics. + (__objc_init_protocols): Init all protocols. + * sendmsg.c (objc_msg_lookup): Remove old protocol hack. + (Patch #4206 from Jeremy Bettis). + 2005-03-01 Nicola Pero * objc/objc-decls.h: On MinGW, do not use diff --git a/init.c b/init.c index 231820e..847666b 100644 --- a/init.c +++ b/init.c @@ -458,8 +458,8 @@ objc_init_statics (void) haven't been here before. However, the comparison is to be reminded of taking into account class posing and to think about possible semantics... */ - else if (class != statics->instances[0]->class_pointer) - { + else + { id *inst; for (inst = &statics->instances[0]; *inst; inst++) @@ -883,6 +883,9 @@ __objc_init_protocols (struct objc_protocol_list *protos) (int) ((char *) protos->list[i]->class_pointer - (char *) 0), PROTOCOL_VERSION); + } else { + /* even if the protocol is initialized, the super protos might not be */ + __objc_init_protocols (aProto->protocol_list); } } diff --git a/sendmsg.c b/sendmsg.c index 402a8ab..ea22356 100644 --- a/sendmsg.c +++ b/sendmsg.c @@ -174,22 +174,6 @@ objc_msg_lookup (id receiver, SEL op) IMP result; if (receiver) { -#if __GNUC__ < 3 || (__GNUC__ == 3&& __GNUC_MINOR__ < 3) -#define PROTOCOL_VERSION 2 // needs to match what is in init.c - // This is a dirty hack for GCC < 3.3 - // Protocols that are referenced in a module, but not implemented by a - // class declared in that same module never get initialized, so if - // we see the magic number PROTOCOL_VERSION, then the object must be - // a Protocol. It may be just corrupted memory, but in that case - // we are going to crash anyway, so no harm done. - if (receiver->class_pointer == (void*)PROTOCOL_VERSION) { - static Class proto_class = 0; - if (!proto_class) - proto_class = objc_lookup_class ("Protocol"); - if (proto_class) - receiver->class_pointer = proto_class; - } -#endif result = sarray_get_safe (receiver->class_pointer->dtable, (sidx)op->sel_id); if (result == 0)