summaryrefslogtreecommitdiff
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
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
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/c-lang.c8
-rw-r--r--gcc/c-objc-common.c6
-rw-r--r--gcc/c-objc-common.h2
-rw-r--r--gcc/cp/ChangeLog10
-rw-r--r--gcc/cp/cp-lang.c23
-rw-r--r--gcc/cp/cp-objcp-common.c20
-rw-r--r--gcc/cp/cp-objcp-common.h3
8 files changed, 49 insertions, 31 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f6c687404fe..7f09ec28e75 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+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.
+
2004-11-02 Steven Bosscher <stevenb@suse.de>
* cfgloop.h (struct loop): Update comment.
diff --git a/gcc/c-lang.c b/gcc/c-lang.c
index ca0173e333a..8eb090c4d62 100644
--- a/gcc/c-lang.c
+++ b/gcc/c-lang.c
@@ -44,8 +44,6 @@ enum c_language_kind c_language = clk_c;
#define LANG_HOOKS_NAME "GNU C"
#undef LANG_HOOKS_INIT
#define LANG_HOOKS_INIT c_objc_common_init
-#undef LANG_HOOKS_TYPES_COMPATIBLE_P
-#define LANG_HOOKS_TYPES_COMPATIBLE_P c_types_compatible_p
/* Each front end provides its own lang hook initializer. */
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
@@ -92,10 +90,4 @@ finish_file (void)
{
}
-int
-c_types_compatible_p (tree x, tree y)
-{
- return comptypes (TYPE_MAIN_VARIANT (x), TYPE_MAIN_VARIANT (y));
-}
-
#include "gtype-c.h"
diff --git a/gcc/c-objc-common.c b/gcc/c-objc-common.c
index 278529ec994..d9e8b93e481 100644
--- a/gcc/c-objc-common.c
+++ b/gcc/c-objc-common.c
@@ -296,3 +296,9 @@ c_initialize_diagnostics (diagnostic_context *context)
/* It is safe to free this object because it was previously XNEW()'d. */
XDELETE (base);
}
+
+int
+c_types_compatible_p (tree x, tree y)
+{
+ return comptypes (TYPE_MAIN_VARIANT (x), TYPE_MAIN_VARIANT (y));
+}
diff --git a/gcc/c-objc-common.h b/gcc/c-objc-common.h
index 48b22a19d2b..4c7be6327ab 100644
--- a/gcc/c-objc-common.h
+++ b/gcc/c-objc-common.h
@@ -66,6 +66,8 @@ extern void c_initialize_diagnostics (diagnostic_context *);
#define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL c_warn_unused_global_decl
#undef LANG_HOOKS_PRINT_IDENTIFIER
#define LANG_HOOKS_PRINT_IDENTIFIER c_print_identifier
+#undef LANG_HOOKS_TYPES_COMPATIBLE_P
+#define LANG_HOOKS_TYPES_COMPATIBLE_P c_types_compatible_p
#undef LANG_HOOKS_FUNCTION_ENTER_NESTED
#define LANG_HOOKS_FUNCTION_ENTER_NESTED c_push_function_context
#undef LANG_HOOKS_FUNCTION_LEAVE_NESTED
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 022148e9165..61691e9d98c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,13 @@
+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.
+
2004-11-01 Nathan Sidwell <nathan@codesourcery.com>
PR c++/18064
diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c
index 0e44a084d1e..da5d6fb5cb2 100644
--- a/gcc/cp/cp-lang.c
+++ b/gcc/cp/cp-lang.c
@@ -39,16 +39,12 @@ enum c_language_kind c_language = clk_cxx;
/* Lang hooks common to C++ and ObjC++ are declared in cp/cp-objcp-common.h;
consequently, there should be very few hooks below. */
-static int cxx_types_compatible_p (tree, tree);
-
#undef LANG_HOOKS_NAME
#define LANG_HOOKS_NAME "GNU C++"
#undef LANG_HOOKS_INIT
#define LANG_HOOKS_INIT cxx_init
#undef LANG_HOOKS_DECL_PRINTABLE_NAME
#define LANG_HOOKS_DECL_PRINTABLE_NAME cxx_printable_name
-#undef LANG_HOOKS_TYPES_COMPATIBLE_P
-#define LANG_HOOKS_TYPES_COMPATIBLE_P cxx_types_compatible_p
#undef LANG_HOOKS_FOLD_OBJ_TYPE_REF
#define LANG_HOOKS_FOLD_OBJ_TYPE_REF cp_fold_obj_type_ref
@@ -99,25 +95,6 @@ const char *const tree_code_name[] = {
/* Lang hook routines common to C++ and ObjC++ appear in cp/cp-objcp-common.c;
there should be very few routines below. */
-/* 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. */
-
-static 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;
-}
-
/* The following function does something real, but only in Objective-C++. */
tree
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)
diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h
index b0931509405..7a2a2343b7c 100644
--- a/gcc/cp/cp-objcp-common.h
+++ b/gcc/cp/cp-objcp-common.h
@@ -30,6 +30,7 @@ extern tree cp_expr_size (tree);
extern size_t cp_tree_size (enum tree_code);
extern bool cp_var_mod_type_p (tree, tree);
extern void cxx_initialize_diagnostics (struct diagnostic_context *);
+extern int cxx_types_compatible_p (tree, tree);
/* In cp/cp-lang.c and objcp/objcp-lang.c. */
@@ -86,6 +87,8 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, tsubst_flags_t,
#define LANG_HOOKS_PRINT_TYPE cxx_print_type
#undef LANG_HOOKS_PRINT_IDENTIFIER
#define LANG_HOOKS_PRINT_IDENTIFIER cxx_print_identifier
+#undef LANG_HOOKS_TYPES_COMPATIBLE_P
+#define LANG_HOOKS_TYPES_COMPATIBLE_P cxx_types_compatible_p
#undef LANG_HOOKS_PRINT_ERROR_FUNCTION
#define LANG_HOOKS_PRINT_ERROR_FUNCTION cxx_print_error_function
#undef LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL