aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-09-24 17:16:23 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2007-09-24 17:16:23 +0200
commit2dff8956e37c835db601f922cadc5b1229a0a6bd (patch)
treef797391d227e5aa4b01ffffd275aa29817b4403c /gcc/cp
parentc946ce8bb9716d31286140dad73e0d3b9e48c36b (diff)
downloadgcc-2dff8956e37c835db601f922cadc5b1229a0a6bd.zip
gcc-2dff8956e37c835db601f922cadc5b1229a0a6bd.tar.gz
gcc-2dff8956e37c835db601f922cadc5b1229a0a6bd.tar.bz2
re PR c++/33506 (TYPE_RAISES_EXCEPTIONS dumped with attributes)
PR c++/33506 * langhooks.h (struct lang_hooks_for_types): Add type_hash_eq field. * langhooks-def.h (LANG_HOOKS_TYPE_HASH_EQ): Define. (LANG_HOOKS_FOR_TYPES_INITIALIZER): Add LANG_HOOKS_TYPE_HASH_EQ. * tree.c (type_hash_eq): For FUNCTION_TYPE use lang_hooks.type.type_hash_eq in addition to generic tests. * cp-tree.h (cxx_type_hash_eq): New prototype. * cp-objcp-common.h (LANG_HOOKS_TYPE_HASH_EQ): Redefine. * tree.c (cxx_type_hash_eq): New function. * g++.dg/ext/attrib29.C: New test. From-SVN: r128718
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/cp-objcp-common.h2
-rw-r--r--gcc/cp/cp-tree.h1
-rw-r--r--gcc/cp/tree.c14
4 files changed, 24 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f8a6875..5e9b187 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2007-09-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/33506
+ * cp-tree.h (cxx_type_hash_eq): New prototype.
+ * cp-objcp-common.h (LANG_HOOKS_TYPE_HASH_EQ): Redefine.
+ * tree.c (cxx_type_hash_eq): New function.
+
2007-09-24 Douglas Gregor <doug.gregor@gmail.com>
PR c++/33185
diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h
index dd23613..7f8138c 100644
--- a/gcc/cp/cp-objcp-common.h
+++ b/gcc/cp/cp-objcp-common.h
@@ -88,6 +88,8 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, tsubst_flags_t,
#define LANG_HOOKS_COMDAT_GROUP cxx_comdat_group
#undef LANG_HOOKS_BUILTIN_FUNCTION
#define LANG_HOOKS_BUILTIN_FUNCTION cxx_builtin_function
+#undef LANG_HOOKS_TYPE_HASH_EQ
+#define LANG_HOOKS_TYPE_HASH_EQ cxx_type_hash_eq
#undef LANG_HOOKS_FUNCTION_INIT
#define LANG_HOOKS_FUNCTION_INIT cxx_push_function_context
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index fbe1bcc..83f4d42 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -4752,6 +4752,7 @@ extern tree rvalue (tree);
extern tree convert_bitfield_to_declared_type (tree);
extern tree cp_save_expr (tree);
extern bool cast_valid_in_integral_constant_expression_p (tree);
+extern bool cxx_type_hash_eq (const_tree, const_tree);
/* in typeck.c */
extern int string_conv_p (const_tree, const_tree, int);
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 78ba4282..77aac70 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2261,6 +2261,20 @@ cp_build_type_attribute_variant (tree type, tree attributes)
return new_type;
}
+/* Return TRUE if TYPE1 and TYPE2 are identical for type hashing purposes.
+ Called only after doing all language independent checks. Only
+ to check TYPE_RAISES_EXCEPTIONS for FUNCTION_TYPE, the rest is already
+ compared in type_hash_eq. */
+
+bool
+cxx_type_hash_eq (const_tree typea, const_tree typeb)
+{
+ gcc_assert (TREE_CODE (typea) == FUNCTION_TYPE);
+
+ return comp_except_specs (TYPE_RAISES_EXCEPTIONS (typea),
+ TYPE_RAISES_EXCEPTIONS (typeb), 1);
+}
+
/* Apply FUNC to all language-specific sub-trees of TP in a pre-order
traversal. Called from walk_tree. */