+2007-09-24 Jakub Jelinek <jakub@redhat.com>
+
+ 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.
+
2007-09-24 Pranav Bhandarkar <pranav.bhandarkar@celunite.com>
Ramana Radhakrishnan <ramana@hercules.pun.celunite.com>
+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
#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
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);
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. */
#define LANG_HOOKS_TYPE_MAX_SIZE lhd_return_null_const_tree
#define LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES \
lhd_omp_firstprivatize_type_sizes
+#define LANG_HOOKS_TYPE_HASH_EQ NULL
#define LANG_HOOKS_HASH_TYPES true
#define LANG_HOOKS_FOR_TYPES_INITIALIZER { \
LANG_HOOKS_INCOMPLETE_TYPE_ERROR, \
LANG_HOOKS_TYPE_MAX_SIZE, \
LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES, \
+ LANG_HOOKS_TYPE_HASH_EQ, \
LANG_HOOKS_HASH_TYPES \
}
firstprivate variables. */
void (*omp_firstprivatize_type_sizes) (struct gimplify_omp_ctx *, tree);
+ /* Return TRUE if TYPE1 and TYPE2 are identical for type hashing purposes.
+ Called only after doing all language independent checks.
+ At present, this function is only called when both TYPE1 and TYPE2 are
+ FUNCTION_TYPEs. */
+ bool (*type_hash_eq) (const_tree, const_tree);
+
/* Nonzero if types that are identical are to be hashed so that only
one copy is kept. If a language requires unique types for each
user-specified type, such as Ada, this should be set to TRUE. */
+2007-09-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/33506
+ * g++.dg/ext/attrib29.C: New test.
+
2007-09-23 Ollie Wild <aaw@google.com>
* gcc.dg/fold-bitand-1.c: New test.
--- /dev/null
+// PR c++/33506
+// { dg-do compile }
+
+extern int f1 (char *) __attribute__ ((warn_unused_result));
+extern int f2 (char *) throw () __attribute__ ((warn_unused_result));
+extern int f2 (char *) throw ();
+
+extern int f3 (char *) __attribute__ ((nonnull (1)));
+extern int f4 (char *) throw () __attribute__ ((nonnull (1)));
+extern int f4 (char *) throw ();
TYPE_FIELDS (b->type))));
case FUNCTION_TYPE:
- return (TYPE_ARG_TYPES (a->type) == TYPE_ARG_TYPES (b->type)
- || (TYPE_ARG_TYPES (a->type)
- && TREE_CODE (TYPE_ARG_TYPES (a->type)) == TREE_LIST
- && TYPE_ARG_TYPES (b->type)
- && TREE_CODE (TYPE_ARG_TYPES (b->type)) == TREE_LIST
- && type_list_equal (TYPE_ARG_TYPES (a->type),
- TYPE_ARG_TYPES (b->type))));
+ if (TYPE_ARG_TYPES (a->type) == TYPE_ARG_TYPES (b->type)
+ || (TYPE_ARG_TYPES (a->type)
+ && TREE_CODE (TYPE_ARG_TYPES (a->type)) == TREE_LIST
+ && TYPE_ARG_TYPES (b->type)
+ && TREE_CODE (TYPE_ARG_TYPES (b->type)) == TREE_LIST
+ && type_list_equal (TYPE_ARG_TYPES (a->type),
+ TYPE_ARG_TYPES (b->type))))
+ break;
+ return 0;
default:
return 0;
}
+
+ if (lang_hooks.types.type_hash_eq != NULL)
+ return lang_hooks.types.type_hash_eq (a->type, b->type);
+
+ return 1;
}
/* Return the cached hash value. */