This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [objc] Patch for PR18408 (Was: Re: Objective-C bugs and GCC releases)



On 24 Jan 2005, at 17.41, Alexander Malmberg wrote:


objc/ChangeLog:
2005-01-25  Alexander Malmberg  <alexander@malmberg.org>

* objc-act.c (objc_types_compatible_p): New function.

Also #include "langhooks-def.h"; please also update Make-lang.in.


	* objc-act.h (objc_types_compatible_p): Declare.
	* objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Define.

- Alexander Malmberg
Index: gcc/objc/objc-act.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/objc/objc-act.c,v
retrieving revision 1.262
diff -u -r1.262 objc-act.c
--- gcc/objc/objc-act.c	16 Jan 2005 08:13:14 -0000	1.262
+++ gcc/objc/objc-act.c	25 Jan 2005 01:20:07 -0000
@@ -73,6 +73,7 @@
 #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,23 @@
   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
+    {
+      return c_types_compatible_p (type1, type2);

If you could put in #ifdef OBJCPLUS for cxx_types_compatible_p() (or whatever it's called), that would be great.


+    }
+}
+
+
 /* 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
Index: gcc/objc/objc-act.h
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/objc/objc-act.h,v
retrieving revision 1.33
diff -u -r1.33 objc-act.h
--- gcc/objc/objc-act.h	16 Dec 2004 01:10:38 -0000	1.33
+++ gcc/objc/objc-act.h	25 Jan 2005 01:20:07 -0000
@@ -28,6 +28,7 @@
 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. */
Index: gcc/objc/objc-lang.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/objc/objc-lang.c,v
retrieving revision 1.52
diff -u -r1.52 objc-lang.c
--- gcc/objc/objc-lang.c 17 Sep 2004 21:55:02 -0000 1.52
+++ gcc/objc/objc-lang.c 25 Jan 2005 01:20:07 -0000
@@ -45,6 +45,8 @@
#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;


Also, please include the comp-types-7.m test case. If you get a clean bootstrap with no regressions, this patch is fine by me. Thanks.


--Zem



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]