* 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
main
fedor 21 years ago
parent 6c1640e44d
commit 84785bf933

@ -1,3 +1,10 @@
2005-08-12 Adam Fedor <fedor@gnu.org>
* 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 <n.pero@mi.flashnet.it> 2005-03-01 Nicola Pero <n.pero@mi.flashnet.it>
* objc/objc-decls.h: On MinGW, do not use * objc/objc-decls.h: On MinGW, do not use

@ -458,7 +458,7 @@ objc_init_statics (void)
haven't been here before. However, the comparison is to be haven't been here before. However, the comparison is to be
reminded of taking into account class posing and to think about reminded of taking into account class posing and to think about
possible semantics... */ possible semantics... */
else if (class != statics->instances[0]->class_pointer) else
{ {
id *inst; id *inst;
@ -883,6 +883,9 @@ __objc_init_protocols (struct objc_protocol_list *protos)
(int) ((char *) protos->list[i]->class_pointer (int) ((char *) protos->list[i]->class_pointer
- (char *) 0), - (char *) 0),
PROTOCOL_VERSION); PROTOCOL_VERSION);
} else {
/* even if the protocol is initialized, the super protos might not be */
__objc_init_protocols (aProto->protocol_list);
} }
} }

@ -174,22 +174,6 @@ objc_msg_lookup (id receiver, SEL op)
IMP result; IMP result;
if (receiver) 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, result = sarray_get_safe (receiver->class_pointer->dtable,
(sidx)op->sel_id); (sidx)op->sel_id);
if (result == 0) if (result == 0)

Loading…
Cancel
Save