aboutsummaryrefslogtreecommitdiff
path: root/gcc/objc
diff options
context:
space:
mode:
authorKresten Krab Thorup <krab@gcc.gnu.org>1994-08-15 15:51:03 +0000
committerKresten Krab Thorup <krab@gcc.gnu.org>1994-08-15 15:51:03 +0000
commit121b312b9074813750141689cf9359576da87d81 (patch)
treeccc6608f862459a0eaa667d2c3dfb0c45ea966b6 /gcc/objc
parent6b2821189ae15b06dd37875e4ed64b6630de2b6a (diff)
downloadgcc-121b312b9074813750141689cf9359576da87d81.zip
gcc-121b312b9074813750141689cf9359576da87d81.tar.gz
gcc-121b312b9074813750141689cf9359576da87d81.tar.bz2
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
Diffstat (limited to 'gcc/objc')
-rw-r--r--gcc/objc/selector.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/gcc/objc/selector.c b/gcc/objc/selector.c
index 284967b..5f7ac213 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)
{