From 121b312b9074813750141689cf9359576da87d81 Mon Sep 17 00:00:00 2001 From: Kresten Krab Thorup Date: Mon, 15 Aug 1994 15:51:03 +0000 Subject: [PATCH] encoding.c (objc_sizeof_type): Should assign from ROUND, not increment. * objc/encoding.c (objc_sizeof_type): Should assign from ROUND, not increment. Remove ; after while to fix infinite loop. Add support for floats and doubles. (objc_alignof_type): Add support for floats and doubles. * objc/selector.c (): Use __objc_selector_names, not __objc_selector_array. (sel_types_match): New function. (sel_get_typed_uid): Modified to use sel_types_match, so that we can get typed selectors in an architecture-independent way. Fixed strcmp that should have been !strcmp. From-SVN: r7928 --- gcc/objc/selector.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/gcc/objc/selector.c b/gcc/objc/selector.c index 284967b2640..5f7ac213dfb 100644 --- a/gcc/objc/selector.c +++ b/gcc/objc/selector.c @@ -26,6 +26,7 @@ You should have received a copy of the GNU General Public License along with #include "runtime.h" #include "objc/sarray.h" +#include "encoding.h" /* Initial selector hash table size. Value doesnt matter much */ #define SELECTOR_HASH_SIZE 128 @@ -87,6 +88,34 @@ register_selectors_from_list (MethodList_t method_list) } } + +/* Returns YES iff t1 and t2 have same method types, but we ignore + the argframe layout */ +BOOL +sel_types_match (const char* t1, const char* t2) +{ + if (!t1 || !t2) + return NO; + while (*t1 && *t2) + { + if (*t1 == '+') t1++; + if (*t2 == '+') t2++; + while (isdigit(*t1)) t1++; + while (isdigit(*t2)) t2++; + /* xxx Remove these next two lines when qualifiers are put in + all selectors, not just Protocol selectors. */ + t1 = objc_skip_type_qualifiers(t1); + t2 = objc_skip_type_qualifiers(t2); + if (!*t1 && !*t2) + return YES; + if (*t1 != *t2) + return NO; + t1++; + t2++; + } + return NO; +} + /* return selector representing name */ SEL sel_get_typed_uid (const char *name, const char *types) @@ -109,7 +138,7 @@ sel_get_typed_uid (const char *name, const char *types) return s; } } - else if (! strcmp (s->sel_types, types)) + else if (sel_types_match (s->sel_types, types)) { return s; } @@ -150,7 +179,7 @@ sel_get_name (SEL selector) { if ((soffset_decode((sidx)selector->sel_id) > 0) && (soffset_decode((sidx)selector->sel_id) <= __objc_selector_max_index)) - return sarray_get (__objc_selector_array, (sidx) selector->sel_id); + return sarray_get (__objc_selector_names, (sidx) selector->sel_id); else return 0; } @@ -205,7 +234,7 @@ __sel_register_typed_name (const char *name, const char *types, return s; } } - else if (strcmp (s->sel_types, types)) + else if (!strcmp (s->sel_types, types)) { if (orig) { -- 2.30.2