summaryrefslogtreecommitdiff
path: root/gcc/cp/cp-objcp-common.c
diff options
context:
space:
mode:
authorzlaski <zlaski@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-02 20:29:21 +0000
committerzlaski <zlaski@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-02 20:29:21 +0000
commit3dac5c5e8b764c8efd0695fb852b1707eecd6e7d (patch)
tree5a4b016e43899a5b48fc6e95881c03a32063597f /gcc/cp/cp-objcp-common.c
parent09e20a5f9cf0f11fb4c4f54b052d6c14b75a7f30 (diff)
downloadgcc-3dac5c5e8b764c8efd0695fb852b1707eecd6e7d.tar.gz
[gcc/ChangeLog]
2004-11-02 Ziemowit Laski <zlaski@apple.com> * c-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. (c_types_compatible_p): Move function definition... * c-objc-common.c (c_types_compatible_p): ...here. * c-objc-common.h (LANG_HOOKS_TYPES_COMPATIBLE_P): Moved here from c-lang.c. [gcc/cp/ChangeLog] 2004-11-02 Ziemowit Laski <zlaski@apple.com> * cp-lang.c (cxx_types_compatible_p): Remove prototype and definition. (LANG_HOOKS_TYPES_COMPATIBLE_P): Move to cp-objcp-common.h. * cp-objcp-common.c (cxx_types_compatible_p): Moved definition here from cp-lang.c. * cp-objcp-common.h (cxx_types_compatible_p): Moved prototype here from cp-lang.c. (LANG_HOOKS_TYPES_COMPATIBLE_P): Moved here from cp-lang.c. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89997 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/cp-objcp-common.c')
-rw-r--r--gcc/cp/cp-objcp-common.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c
index b8b8bad6a86..a58549b7326 100644
--- a/gcc/cp/cp-objcp-common.c
+++ b/gcc/cp/cp-objcp-common.c
@@ -148,6 +148,26 @@ cxx_initialize_diagnostics (diagnostic_context *context)
free (base);
}
+/* This compares two types for equivalence ("compatible" in C-based languages).
+ This routine should only return 1 if it is sure. It should not be used
+ in contexts where erroneously returning 0 causes problems. */
+
+int
+cxx_types_compatible_p (tree x, tree y)
+{
+ if (same_type_ignoring_top_level_qualifiers_p (x, y))
+ return 1;
+
+ /* Once we get to the middle-end, references and pointers are
+ interchangeable. FIXME should we try to replace all references with
+ pointers? */
+ if (POINTER_TYPE_P (x) && POINTER_TYPE_P (y)
+ && same_type_p (TREE_TYPE (x), TREE_TYPE (y)))
+ return 1;
+
+ return 0;
+}
+
/* Stubs to keep c-opts.c happy. */
void
push_file_scope (void)