summaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-30 15:28:48 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-30 15:28:48 +0000
commit092b1d6f29c36a1496c539d276bc9d0e1ce66082 (patch)
tree4ca6b4e112f696c8ceed5ba25d4dd59e1b129aba /gcc/cp/call.c
parentd6e1a335bca7a6d63ada7dedc95671be86e1a1fe (diff)
downloadgcc-092b1d6f29c36a1496c539d276bc9d0e1ce66082.tar.gz
* call.c (check_dtor_name): Replace abort with gcc_assert or
gcc_unreachable. (build_call, add_builtin_candidate, build_new_op, convert_like_real, build_over_call, in_charge_arg_for_name, source_type, joust): Likewise. * class.c (build_simple_base_path, get_vcall_index, finish_struct_1, instantiate_type, get_enclosing_class, add_vcall_offset_vtbl_entries_1, cp_fold_obj_type_ref): Likewise. * cp-gimplify.c (cp_genericize): Likewise. * cp-lang.c (cp_expr_size, cp_tree_size): Likewise. * cvt.c (cp_convert_to_pointer, ocp_convert): Likewise. * decl.c (poplevel, make_unbound_class_template, reshape_init, check_special_function_return_type, grokdeclarator, grok_op_properties, tag_name, xref_tag, start_preparsed_function, finish_function): Likewise. * decl2.c (grokfield, maybe_emit_vtables):Likewise. * error.c (dump_global_iord, dump_decl, dump_template_decl, language_to_string): Likewise. * except.c (choose_personality_routine): Likewise. * friend.c (do_friend): Likewise. * g++spec.c (lang_specific_driver): Likewise. * init.c (build_zero_init, expand_default_init, build_new_1, build_vec_delete_1, build_vec_init, build_dtor_call): Likewise. * lex.c (retrofit_lang_decl, cp_type_qual_from_rid): Likewise. * mangle.c (add_substitution, write_unscoped_name, write_template_prefix, write_identifier, write_special_name_destructor, write_type, write_builtin_type, write_expression, write_template_param, write_java_integer_type_codes): Likewise. * method.c (implicitly_declare_fn): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86778 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c80
1 files changed, 41 insertions, 39 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 07aea66308b..4e5b3d590c1 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -234,17 +234,18 @@ check_dtor_name (tree basetype, tree name)
else
name = get_type_value (name);
}
- /* In the case of:
-
- template <class T> struct S { ~S(); };
- int i;
- i.~S();
-
- NAME will be a class template. */
- else if (DECL_CLASS_TEMPLATE_P (name))
- return false;
else
- abort ();
+ {
+ /* In the case of:
+
+ template <class T> struct S { ~S(); };
+ int i;
+ i.~S();
+
+ NAME will be a class template. */
+ gcc_assert (DECL_CLASS_TEMPLATE_P (name));
+ return false;
+ }
if (name && TYPE_MAIN_VARIANT (basetype) == TYPE_MAIN_VARIANT (name))
return true;
@@ -328,11 +329,10 @@ build_call (tree function, tree parms)
/* We invoke build_call directly for several library functions.
These may have been declared normally if we're building libgcc,
so we can't just check DECL_ARTIFICIAL. */
- if (DECL_ARTIFICIAL (decl)
- || !strncmp (IDENTIFIER_POINTER (DECL_NAME (decl)), "__", 2))
- mark_used (decl);
- else
- abort ();
+ gcc_assert (DECL_ARTIFICIAL (decl)
+ || !strncmp (IDENTIFIER_POINTER (DECL_NAME (decl)),
+ "__", 2));
+ mark_used (decl);
}
/* Don't pass empty class objects by value. This is useful
@@ -1915,7 +1915,7 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
return;
default:
- abort ();
+ gcc_unreachable ();
}
type1 = build_reference_type (type1);
break;
@@ -1952,7 +1952,7 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
break;
default:
- abort ();
+ gcc_unreachable ();
}
/* If we're dealing with two pointer types or two enumeral types,
@@ -3600,7 +3600,7 @@ build_new_op (enum tree_code code, int flags, tree arg1, tree arg2, tree arg3,
case VEC_DELETE_EXPR:
case DELETE_EXPR:
/* Use build_op_new_call and build_op_delete_call instead. */
- abort ();
+ gcc_unreachable ();
case CALL_EXPR:
return build_object_call (arg1, arg2);
@@ -3836,7 +3836,7 @@ build_new_op (enum tree_code code, int flags, tree arg1, tree arg2, tree arg3,
if (result || result_valid_p)
return result;
-builtin:
+ builtin:
switch (code)
{
case MODIFY_EXPR:
@@ -3895,9 +3895,9 @@ builtin:
return NULL_TREE;
default:
- abort ();
- return NULL_TREE;
+ gcc_unreachable ();
}
+ return NULL_TREE;
}
/* Build a call to operator delete. This has to be handled very specially,
@@ -4180,11 +4180,10 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
0);
args = build_tree_list (NULL_TREE, expr);
- if (DECL_HAS_IN_CHARGE_PARM_P (convfn)
- || DECL_HAS_VTT_PARM_P (convfn))
- /* We should never try to call the abstract or base constructor
- from here. */
- abort ();
+ /* We should never try to call the abstract or base constructor
+ from here. */
+ gcc_assert (!DECL_HAS_IN_CHARGE_PARM_P (convfn)
+ && !DECL_HAS_VTT_PARM_P (convfn));
args = tree_cons (NULL_TREE, t, args);
}
else
@@ -4649,9 +4648,9 @@ build_over_call (struct z_candidate *cand, int flags)
converted_args = tree_cons (NULL_TREE, TREE_VALUE (arg), converted_args);
arg = TREE_CHAIN (arg);
parm = TREE_CHAIN (parm);
- if (DECL_HAS_IN_CHARGE_PARM_P (fn))
- /* We should never try to call the abstract constructor. */
- abort ();
+ /* We should never try to call the abstract constructor. */
+ gcc_assert (!DECL_HAS_IN_CHARGE_PARM_P (fn));
+
if (DECL_HAS_VTT_PARM_P (fn))
{
converted_args = tree_cons
@@ -4967,12 +4966,14 @@ build_java_interface_fn_ref (tree fn, tree instance)
}
/* Returns the value to use for the in-charge parameter when making a
- call to a function with the indicated NAME. */
+ call to a function with the indicated NAME.
+
+ FIXME:Can't we find a neater way to do this mapping? */
tree
in_charge_arg_for_name (tree name)
{
- if (name == base_ctor_identifier
+ if (name == base_ctor_identifier
|| name == base_dtor_identifier)
return integer_zero_node;
else if (name == complete_ctor_identifier)
@@ -4984,7 +4985,7 @@ in_charge_arg_for_name (tree name)
/* This function should only be called with one of the names listed
above. */
- abort ();
+ gcc_unreachable ();
return NULL_TREE;
}
@@ -5838,7 +5839,7 @@ source_type (conversion *t)
|| t->kind == ck_identity)
return t->type;
}
- abort ();
+ gcc_unreachable ();
}
/* Note a warning about preferring WINNER to LOSER. We do this by storing
@@ -5899,17 +5900,18 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn)
len = cand1->num_convs;
if (len != cand2->num_convs)
{
- if (DECL_STATIC_FUNCTION_P (cand1->fn)
- && ! DECL_STATIC_FUNCTION_P (cand2->fn))
+ int static_1 = DECL_STATIC_FUNCTION_P (cand1->fn);
+ int static_2 = DECL_STATIC_FUNCTION_P (cand2->fn);
+
+ gcc_assert (static_1 != static_2);
+
+ if (static_1)
off2 = 1;
- else if (! DECL_STATIC_FUNCTION_P (cand1->fn)
- && DECL_STATIC_FUNCTION_P (cand2->fn))
+ else
{
off1 = 1;
--len;
}
- else
- abort ();
}
for (i = 0; i < len; ++i)