aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>1999-08-04 09:07:51 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>1999-08-04 09:07:51 +0000
commit4cc1d462013c5fcaa82b0ad82b4232bc1249b31c (patch)
treeeed4f20cf661ebad7e1110d70a77ace73ecd7837 /gcc/cp/decl.c
parentbc3c01c50781c5306a57c974c84e767479e59f73 (diff)
downloadgcc-4cc1d462013c5fcaa82b0ad82b4232bc1249b31c.zip
gcc-4cc1d462013c5fcaa82b0ad82b4232bc1249b31c.tar.gz
gcc-4cc1d462013c5fcaa82b0ad82b4232bc1249b31c.tar.bz2
cp-tree.h (empty_except_spec): New global var.
* cp-tree.h (empty_except_spec): New global var. (compexcepttypes): Remove prototype. (comp_except_specs): Prototype new global function. (add_exception_specifier): Prototype new global function. * decl.c (empty_except_spec): Define new global var. (duplicate_decls): Use comp_except_specs, reword error message. (init_decl_processing): Initialize empty_except_spec. Adjust build_exception_variant calls. * parse.y (exception_specification_opt): Use empty_except_spec. (ansi_raise_identifier): Call check_for_new_type. (ansi_raise_identifiers): Use add_exception_specifier. * pt.c (tsubst): Use add_exception_specifier to build exception specifier. * search.c (check_final_overrider): New static function, broken out of get_matching_virtual. Check throw specifiers, reword diagnostics. (get_matching_virtual): Use check_final_overrider. * tree.c (build_exception_variant): Use comp_except_specs. * typeck.c (compexcepttypes): Remove. (comp_except_types): New static function, helper for comp_except_specs. Compare two types as exception specifiers. (comp_except_specs): New global function, compare two exception specifiers. (comptypes): Adjust for comp_except_specs. * typeck2.c (add_exception_specifier): New global function. * class.c (check_for_override): Reword error message. From-SVN: r28494
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 498384b..6702f2c 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -336,6 +336,9 @@ tree pfn_identifier, index_identifier, delta_identifier, delta2_identifier;
tree pfn_or_delta2_identifier, tag_identifier;
tree vt_off_identifier;
+/* Exception specifier used for throw(). */
+tree empty_except_spec;
+
struct named_label_list
{
struct binding_level *binding_level;
@@ -3478,11 +3481,12 @@ duplicate_decls (newdecl, olddecl)
if ((pedantic || ! DECL_IN_SYSTEM_HEADER (olddecl))
&& DECL_SOURCE_LINE (olddecl) != 0
&& flag_exceptions
- && ! compexcepttypes (TREE_TYPE (newdecl), TREE_TYPE (olddecl)))
+ && !comp_except_specs (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (newdecl)),
+ TYPE_RAISES_EXCEPTIONS (TREE_TYPE (olddecl)), 1))
{
- cp_pedwarn ("declaration of `%D' throws different exceptions",
+ cp_error ("declaration of `%F' throws different exceptions",
newdecl);
- cp_pedwarn_at ("previous declaration here", olddecl);
+ cp_error_at ("to previous declaration `%F'", olddecl);
}
}
TREE_TYPE (newdecl) = TREE_TYPE (olddecl) = newtype;
@@ -6361,6 +6365,7 @@ init_decl_processing ()
const_string_type_node
= build_pointer_type (build_qualified_type (char_type_node,
TYPE_QUAL_CONST));
+ empty_except_spec = build_tree_list (NULL_TREE, NULL_TREE);
#if 0
record_builtin_type (RID_MAX, NULL_PTR, string_type_node);
#endif
@@ -6400,8 +6405,7 @@ init_decl_processing ()
c_common_nodes_and_builtins (1, flag_no_builtin, flag_no_nonansi_builtin);
void_ftype_ptr
- = build_exception_variant (void_ftype_ptr,
- tree_cons (NULL_TREE, NULL_TREE, NULL_TREE));
+ = build_exception_variant (void_ftype_ptr, empty_except_spec);
/* C++ extensions */
@@ -6547,9 +6551,8 @@ init_decl_processing ()
if (flag_honor_std)
pop_namespace ();
newtype = build_exception_variant
- (ptr_ftype_sizetype, build_tree_list (NULL_TREE, bad_alloc_type_node));
- deltype = build_exception_variant
- (void_ftype_ptr, build_tree_list (NULL_TREE, NULL_TREE));
+ (ptr_ftype_sizetype, add_exception_specifier (NULL_TREE, bad_alloc_type_node, -1));
+ deltype = build_exception_variant (void_ftype_ptr, empty_except_spec);
auto_function (ansi_opname[(int) NEW_EXPR], newtype, NOT_BUILT_IN);
auto_function (ansi_opname[(int) VEC_NEW_EXPR], newtype, NOT_BUILT_IN);
global_delete_fndecl