summaryrefslogtreecommitdiffstats
path: root/gcc/objc
diff options
context:
space:
mode:
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2005-01-25 03:13:10 +0000
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2005-01-25 03:13:10 +0000
commitd7c168e822a31b25f4f34d63d0fbdb5e96845edd (patch)
tree38df44a09f1d032b7868951f4c41192154178ce9 /gcc/objc
parent8061fd406c80d6b0e410a4fc7183b8e40d1b34c3 (diff)
downloadppe42-gcc-d7c168e822a31b25f4f34d63d0fbdb5e96845edd.tar.gz
ppe42-gcc-d7c168e822a31b25f4f34d63d0fbdb5e96845edd.zip
2005-01-25 Alexander Malmberg <alexander@malmberg.org>
PR objc/18408 * objc-act.c (objc_types_compatible_p): New function. * objc-act.h (objc_types_compatible_p): Declare. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Define. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94199 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/objc')
-rw-r--r--gcc/objc/ChangeLog7
-rw-r--r--gcc/objc/objc-act.c22
-rw-r--r--gcc/objc/objc-act.h1
-rw-r--r--gcc/objc/objc-lang.c2
4 files changed, 32 insertions, 0 deletions
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index 42e91fa6d5a..bdd79fe3b8f 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,3 +1,10 @@
+2005-01-25 Alexander Malmberg <alexander@malmberg.org>
+
+ PR objc/18408
+ * objc-act.c (objc_types_compatible_p): New function.
+ * objc-act.h (objc_types_compatible_p): Declare.
+ * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Define.
+
2005-01-16 Ziemowit Laski <zlaski@apple.com>
* objc-act.c (objc_push_parm): Call c_type_promotes_to()
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 65af654cb5d..fff747bf29d 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -73,6 +73,7 @@ Boston, MA 02111-1307, USA. */
#include "tree-iterator.h"
#include "libfuncs.h"
#include "hashtab.h"
+#include "langhooks-def.h"
#define OBJC_VOID_AT_END void_list_node
@@ -836,6 +837,27 @@ objc_is_class_id (tree type)
return OBJC_TYPE_NAME (type) == objc_class_id;
}
+
+int
+objc_types_compatible_p (tree type1, tree type2)
+{
+
+ if (objc_is_object_ptr (type1) || objc_is_object_ptr (type2)
+ || objc_is_class_name (type1) || objc_is_class_name (type2))
+ {
+ return lhd_types_compatible_p (type1, type2);
+ }
+ else
+ {
+#ifdef OBJCPLUS
+ return cxx_types_compatible_p (type1, type2);
+#else
+ return c_types_compatible_p (type1, type2);
+#endif
+ }
+}
+
+
/* Return 1 if LHS and RHS are compatible types for assignment or
various other operations. Return 0 if they are incompatible, and
return -1 if we choose to not decide (because the types are really
diff --git a/gcc/objc/objc-act.h b/gcc/objc/objc-act.h
index e52e0f003fb..403c31b16a9 100644
--- a/gcc/objc/objc-act.h
+++ b/gcc/objc/objc-act.h
@@ -28,6 +28,7 @@ bool objc_init (void);
const char *objc_printable_name (tree, int);
void objc_finish_file (void);
tree objc_fold_obj_type_ref (tree, tree);
+int objc_types_compatible_p (tree, tree);
/* NB: The remaining public functions are prototyped in c-common.h, for the
benefit of stub-objc.c and objc-act.c. */
diff --git a/gcc/objc/objc-lang.c b/gcc/objc/objc-lang.c
index 2d8319d2417..e83ffda4b36 100644
--- a/gcc/objc/objc-lang.c
+++ b/gcc/objc/objc-lang.c
@@ -45,6 +45,8 @@ enum c_language_kind c_language = clk_objc;
#define LANG_HOOKS_INIT objc_init
#undef LANG_HOOKS_DECL_PRINTABLE_NAME
#define LANG_HOOKS_DECL_PRINTABLE_NAME objc_printable_name
+#undef LANG_HOOKS_TYPES_COMPATIBLE_P
+#define LANG_HOOKS_TYPES_COMPATIBLE_P objc_types_compatible_p
/* Each front end provides its own lang hook initializer. */
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
OpenPOWER on IntegriCloud