Commit 315fb5db by Nathan Sidwell Committed by Nathan Sidwell

name-lookup.c (pop_binding, [...]): Replace abort with gcc_assert or gcc_unreachable.

	* name-lookup.c (pop_binding, pushdecl,
	set_identifier_type_value_with_scope, push_overloaded_decl,
	arg_assoc_type): Replace abort with gcc_assert or gcc_unreachable.
	* parser.c (cp_parser_diagnose_invalid_type_name,
	cp_parser_postfix_expression, cp_parser_unary_expression,
	cp_parser_check_declarator_template_para): Likewise.
	* pt.c (push_inline_template_parms_recursive,
	check_explicit_specialization, convert_nontype_argument,
	coerce_template_template_parms, uses_template_parms,
	instantiate_class_template, tsubst_decl, tsubst, tsubst_copy,
	tsubst_expr, instantiate_template,
	maybe_adjust_types_for_deduction, type_unification_real,
	resolve_overloaded_unification, template_decl_level,
	type_dependent_expression_p): Likewise.
	* search.c (lookup_base_r): Likewise.
	* semantics.c (finish_stmt_expr, simplify_aggr_init_expr): Likewise.
	* tree.c (lvalue_p_1, count_functions, cxx_printable_name,
	verify_stmt_tree_r, get_type_decl, stabilize_call): Likewise.
	* typeck.c (common_type, get_member_function_from_ptrfunc,
	build_binary_op, build_unary_op, expand_ptrmemfunc_cst): Likewise.
	* typeck2.c (cxx_incomplete_type_diagnostic,
	split_nonconstant_init_1, store_init_value,
	process_init_constructor): Likewise.

From-SVN: r86782
parent e0448193
2004-08-30 Nathan Sidwell <nathan@codesourcery.com> 2004-08-30 Nathan Sidwell <nathan@codesourcery.com>
* name-lookup.c (pop_binding, pushdecl,
set_identifier_type_value_with_scope, push_overloaded_decl,
arg_assoc_type): Replace abort with gcc_assert or gcc_unreachable.
* parser.c (cp_parser_diagnose_invalid_type_name,
cp_parser_postfix_expression, cp_parser_unary_expression,
cp_parser_check_declarator_template_para): Likewise.
* pt.c (push_inline_template_parms_recursive,
check_explicit_specialization, convert_nontype_argument,
coerce_template_template_parms, uses_template_parms,
instantiate_class_template, tsubst_decl, tsubst, tsubst_copy,
tsubst_expr, instantiate_template,
maybe_adjust_types_for_deduction, type_unification_real,
resolve_overloaded_unification, template_decl_level,
type_dependent_expression_p): Likewise.
* search.c (lookup_base_r): Likewise.
* semantics.c (finish_stmt_expr, simplify_aggr_init_expr): Likewise.
* tree.c (lvalue_p_1, count_functions, cxx_printable_name,
verify_stmt_tree_r, get_type_decl, stabilize_call): Likewise.
* typeck.c (common_type, get_member_function_from_ptrfunc,
build_binary_op, build_unary_op, expand_ptrmemfunc_cst): Likewise.
* typeck2.c (cxx_incomplete_type_diagnostic,
split_nonconstant_init_1, store_init_value,
process_init_constructor): Likewise.
2004-08-30 Nathan Sidwell <nathan@codesourcery.com>
* call.c (check_dtor_name): Replace abort with gcc_assert or * call.c (check_dtor_name): Replace abort with gcc_assert or
gcc_unreachable. gcc_unreachable.
(build_call, add_builtin_candidate, build_new_op, (build_call, add_builtin_candidate, build_new_op,
......
...@@ -457,10 +457,11 @@ pop_binding (tree id, tree decl) ...@@ -457,10 +457,11 @@ pop_binding (tree id, tree decl)
binding for this identifier. Remove that binding. */ binding for this identifier. Remove that binding. */
if (binding->value == decl) if (binding->value == decl)
binding->value = NULL_TREE; binding->value = NULL_TREE;
else if (binding->type == decl)
binding->type = NULL_TREE;
else else
abort (); {
gcc_assert (binding->type == decl);
binding->type = NULL_TREE;
}
if (!binding->value && !binding->type) if (!binding->value && !binding->type)
{ {
...@@ -745,10 +746,7 @@ pushdecl (tree x) ...@@ -745,10 +746,7 @@ pushdecl (tree x)
} }
else if (TREE_CODE (t) == PARM_DECL) else if (TREE_CODE (t) == PARM_DECL)
{ {
if (DECL_CONTEXT (t) == NULL_TREE) gcc_assert (DECL_CONTEXT (t));
/* This is probably caused by too many errors, but calling
abort will say that if errors have occurred. */
abort ();
/* Check for duplicate params. */ /* Check for duplicate params. */
if (duplicate_decls (x, t)) if (duplicate_decls (x, t))
...@@ -1759,15 +1757,12 @@ set_identifier_type_value_with_scope (tree id, tree decl, cxx_scope *b) ...@@ -1759,15 +1757,12 @@ set_identifier_type_value_with_scope (tree id, tree decl, cxx_scope *b)
{ {
cxx_binding *binding = cxx_binding *binding =
binding_for_name (NAMESPACE_LEVEL (current_namespace), id); binding_for_name (NAMESPACE_LEVEL (current_namespace), id);
if (decl) gcc_assert (decl);
{ if (binding->value)
if (binding->value) supplement_binding (binding, decl);
supplement_binding (binding, decl);
else
binding->value = decl;
}
else else
abort (); binding->value = decl;
/* Store marker instead of real type. */ /* Store marker instead of real type. */
type = global_type_node; type = global_type_node;
} }
...@@ -2098,7 +2093,7 @@ push_overloaded_decl (tree decl, int flags) ...@@ -2098,7 +2093,7 @@ push_overloaded_decl (tree decl, int flags)
} }
/* We should always find a previous binding in this case. */ /* We should always find a previous binding in this case. */
abort (); gcc_unreachable ();
} }
/* Install the new binding. */ /* Install the new binding. */
...@@ -4476,11 +4471,10 @@ arg_assoc_type (struct arg_lookup *k, tree type) ...@@ -4476,11 +4471,10 @@ arg_assoc_type (struct arg_lookup *k, tree type)
case TYPENAME_TYPE: case TYPENAME_TYPE:
return false; return false;
case LANG_TYPE: case LANG_TYPE:
if (type == unknown_type_node) gcc_assert (type == unknown_type_node);
return false; return false;
/* else fall through */
default: default:
abort (); gcc_unreachable ();
} }
return false; return false;
} }
......
...@@ -2230,7 +2230,7 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree scope, tree id) ...@@ -2230,7 +2230,7 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree scope, tree id)
error ("`%E' in class `%T' does not name a type", error ("`%E' in class `%T' does not name a type",
id, parser->scope); id, parser->scope);
else else
abort(); gcc_unreachable ();
} }
} }
...@@ -3806,7 +3806,7 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p) ...@@ -3806,7 +3806,7 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p)
= build_const_cast (type, expression); = build_const_cast (type, expression);
break; break;
default: default:
abort (); gcc_unreachable ();
} }
} }
break; break;
...@@ -4177,7 +4177,7 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p) ...@@ -4177,7 +4177,7 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p)
} }
/* We should never get here. */ /* We should never get here. */
abort (); gcc_unreachable ();
return error_mark_node; return error_mark_node;
} }
...@@ -4741,7 +4741,7 @@ cp_parser_unary_expression (cp_parser *parser, bool address_p) ...@@ -4741,7 +4741,7 @@ cp_parser_unary_expression (cp_parser *parser, bool address_p)
break; break;
default: default:
abort (); gcc_unreachable ();
} }
if (non_constant_p if (non_constant_p
...@@ -14460,9 +14460,9 @@ cp_parser_check_declarator_template_parameters (cp_parser* parser, ...@@ -14460,9 +14460,9 @@ cp_parser_check_declarator_template_parameters (cp_parser* parser,
return true; return true;
default: default:
abort (); gcc_unreachable ();
return false;
} }
return false;
} }
/* NUM_TEMPLATES were used in the current declaration. If that is /* NUM_TEMPLATES were used in the current declaration. If that is
......
...@@ -384,7 +384,7 @@ push_inline_template_parms_recursive (tree parmlist, int levels) ...@@ -384,7 +384,7 @@ push_inline_template_parms_recursive (tree parmlist, int levels)
break; break;
default: default:
abort (); gcc_unreachable ();
} }
} }
} }
...@@ -1759,7 +1759,7 @@ check_explicit_specialization (tree declarator, ...@@ -1759,7 +1759,7 @@ check_explicit_specialization (tree declarator,
break; break;
default: default:
abort (); gcc_unreachable ();
} }
if (specialization || member_specialization) if (specialization || member_specialization)
...@@ -3597,8 +3597,7 @@ convert_nontype_argument (tree type, tree expr) ...@@ -3597,8 +3597,7 @@ convert_nontype_argument (tree type, tree expr)
default: default:
/* All non-type parameters must have one of these types. */ /* All non-type parameters must have one of these types. */
abort (); gcc_unreachable ();
break;
} }
return error_mark_node; return error_mark_node;
...@@ -3690,7 +3689,7 @@ coerce_template_template_parms (tree parm_parms, ...@@ -3690,7 +3689,7 @@ coerce_template_template_parms (tree parm_parms,
break; break;
default: default:
abort (); gcc_unreachable ();
} }
} }
return 1; return 1;
...@@ -4890,10 +4889,12 @@ uses_template_parms (tree t) ...@@ -4890,10 +4889,12 @@ uses_template_parms (tree t)
|| TREE_CODE_CLASS (TREE_CODE (t)) == 'c') || TREE_CODE_CLASS (TREE_CODE (t)) == 'c')
dependent_p = (type_dependent_expression_p (t) dependent_p = (type_dependent_expression_p (t)
|| value_dependent_expression_p (t)); || value_dependent_expression_p (t));
else if (t == error_mark_node) else
dependent_p = false; {
else gcc_assert (t == error_mark_node);
abort (); dependent_p = false;
}
processing_template_decl = saved_processing_template_decl; processing_template_decl = saved_processing_template_decl;
return dependent_p; return dependent_p;
...@@ -5470,16 +5471,13 @@ instantiate_class_template (tree type) ...@@ -5470,16 +5471,13 @@ instantiate_class_template (tree type)
pbinfo = TYPE_BINFO (pattern); pbinfo = TYPE_BINFO (pattern);
#ifdef ENABLE_CHECKING /* We should never instantiate a nested class before its enclosing
if (DECL_CLASS_SCOPE_P (TYPE_MAIN_DECL (pattern)) class; we need to look up the nested class by name before we can
&& ! COMPLETE_TYPE_P (TYPE_CONTEXT (type)) instantiate it, and that lookup should instantiate the enclosing
&& ! TYPE_BEING_DEFINED (TYPE_CONTEXT (type))) class. */
/* We should never instantiate a nested class before its enclosing gcc_assert (!DECL_CLASS_SCOPE_P (TYPE_MAIN_DECL (pattern))
class; we need to look up the nested class by name before we can || COMPLETE_TYPE_P (TYPE_CONTEXT (type))
instantiate it, and that lookup should instantiate the enclosing || TYPE_BEING_DEFINED (TYPE_CONTEXT (type)));
class. */
abort ();
#endif
base_list = NULL_TREE; base_list = NULL_TREE;
if (BINFO_N_BASE_BINFOS (pbinfo)) if (BINFO_N_BASE_BINFOS (pbinfo))
...@@ -6535,7 +6533,7 @@ tsubst_decl (tree t, tree args, tree type, tsubst_flags_t complain) ...@@ -6535,7 +6533,7 @@ tsubst_decl (tree t, tree args, tree type, tsubst_flags_t complain)
break; break;
default: default:
abort (); gcc_unreachable ();
} }
/* Restore the file and line information. */ /* Restore the file and line information. */
...@@ -6813,9 +6811,11 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) ...@@ -6813,9 +6811,11 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
int idx; int idx;
int level; int level;
int levels; int levels;
tree arg = NULL_TREE;
r = NULL_TREE; r = NULL_TREE;
gcc_assert (TREE_VEC_LENGTH (args) > 0);
if (TREE_CODE (t) == TEMPLATE_TYPE_PARM if (TREE_CODE (t) == TEMPLATE_TYPE_PARM
|| TREE_CODE (t) == TEMPLATE_TEMPLATE_PARM || TREE_CODE (t) == TEMPLATE_TEMPLATE_PARM
|| TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM) || TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM)
...@@ -6829,57 +6829,50 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) ...@@ -6829,57 +6829,50 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
level = TEMPLATE_PARM_LEVEL (t); level = TEMPLATE_PARM_LEVEL (t);
} }
if (TREE_VEC_LENGTH (args) > 0) levels = TMPL_ARGS_DEPTH (args);
{ if (level <= levels)
tree arg = NULL_TREE; arg = TMPL_ARG (args, level, idx);
levels = TMPL_ARGS_DEPTH (args); if (arg == error_mark_node)
if (level <= levels) return error_mark_node;
arg = TMPL_ARG (args, level, idx); else if (arg != NULL_TREE)
{
if (arg == error_mark_node) if (TREE_CODE (t) == TEMPLATE_TYPE_PARM)
return error_mark_node;
else if (arg != NULL_TREE)
{ {
if (TREE_CODE (t) == TEMPLATE_TYPE_PARM) gcc_assert (TYPE_P (arg));
{ return cp_build_qualified_type_real
gcc_assert (TYPE_P (arg)); (arg, cp_type_quals (arg) | cp_type_quals (t),
return cp_build_qualified_type_real complain | tf_ignore_bad_quals);
(arg, cp_type_quals (arg) | cp_type_quals (t), }
complain | tf_ignore_bad_quals); else if (TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM)
} {
else if (TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM) /* We are processing a type constructed from a
{ template template parameter. */
/* We are processing a type constructed from tree argvec = tsubst (TYPE_TI_ARGS (t),
a template template parameter. */ args, complain, in_decl);
tree argvec = tsubst (TYPE_TI_ARGS (t), if (argvec == error_mark_node)
args, complain, in_decl); return error_mark_node;
if (argvec == error_mark_node)
return error_mark_node;
/* We can get a TEMPLATE_TEMPLATE_PARM here when /* We can get a TEMPLATE_TEMPLATE_PARM here when we
we are resolving nested-types in the signature of are resolving nested-types in the signature of a
a member function templates. member function templates. Otherwise ARG is a
Otherwise ARG is a TEMPLATE_DECL and is the real TEMPLATE_DECL and is the real template to be
template to be instantiated. */ instantiated. */
if (TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM) if (TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM)
arg = TYPE_NAME (arg); arg = TYPE_NAME (arg);
r = lookup_template_class (arg, r = lookup_template_class (arg,
argvec, in_decl, argvec, in_decl,
DECL_CONTEXT (arg), DECL_CONTEXT (arg),
/*entering_scope=*/0, /*entering_scope=*/0,
complain); complain);
return cp_build_qualified_type_real return cp_build_qualified_type_real
(r, TYPE_QUALS (t), complain); (r, TYPE_QUALS (t), complain);
}
else
/* TEMPLATE_TEMPLATE_PARM or TEMPLATE_PARM_INDEX. */
return arg;
} }
else
/* TEMPLATE_TEMPLATE_PARM or TEMPLATE_PARM_INDEX. */
return arg;
} }
else
abort ();
if (level == 1) if (level == 1)
/* This can happen during the attempted tsubst'ing in /* This can happen during the attempted tsubst'ing in
...@@ -6932,7 +6925,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) ...@@ -6932,7 +6925,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
break; break;
default: default:
abort (); gcc_unreachable ();
} }
return r; return r;
...@@ -6975,7 +6968,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) ...@@ -6975,7 +6968,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
case TREE_BINFO: case TREE_BINFO:
/* We should never be tsubsting a binfo. */ /* We should never be tsubsting a binfo. */
abort (); gcc_unreachable ();
case TREE_VEC: case TREE_VEC:
/* A vector of template arguments. */ /* A vector of template arguments. */
...@@ -7251,7 +7244,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) ...@@ -7251,7 +7244,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
case INDIRECT_REF: case INDIRECT_REF:
case ADDR_EXPR: case ADDR_EXPR:
case CALL_EXPR: case CALL_EXPR:
abort (); gcc_unreachable ();
case ARRAY_REF: case ARRAY_REF:
{ {
...@@ -7501,7 +7494,7 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) ...@@ -7501,7 +7494,7 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
/* We didn't find the name. That should never happen; if /* We didn't find the name. That should never happen; if
name-lookup found it during preliminary parsing, we name-lookup found it during preliminary parsing, we
should find it again here during instantiation. */ should find it again here during instantiation. */
abort (); gcc_unreachable ();
} }
return t; return t;
...@@ -7786,7 +7779,7 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) ...@@ -7786,7 +7779,7 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
/* We shouldn't have built any of these during initial template /* We shouldn't have built any of these during initial template
generation. Instead, they should be built during instantiation generation. Instead, they should be built during instantiation
in response to the saved STMT_IS_FULL_EXPR_P setting. */ in response to the saved STMT_IS_FULL_EXPR_P setting. */
abort (); gcc_unreachable ();
default: default:
return t; return t;
...@@ -8098,10 +8091,10 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl) ...@@ -8098,10 +8091,10 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
return fold_offsetof (t); return fold_offsetof (t);
default: default:
if (!STATEMENT_CODE_P (TREE_CODE (t))) gcc_assert (!STATEMENT_CODE_P (TREE_CODE (t)));
return tsubst_copy_and_build (t, args, complain, in_decl,
/*function_p=*/false); return tsubst_copy_and_build (t, args, complain, in_decl,
abort (); /*function_p=*/false);
} }
return NULL_TREE; return NULL_TREE;
...@@ -8734,7 +8727,7 @@ instantiate_template (tree tmpl, tree targ_ptr, tsubst_flags_t complain) ...@@ -8734,7 +8727,7 @@ instantiate_template (tree tmpl, tree targ_ptr, tsubst_flags_t complain)
if (DECL_NAME (clone) == DECL_NAME (tmpl)) if (DECL_NAME (clone) == DECL_NAME (tmpl))
return clone; return clone;
/* We should always have found the clone by now. */ /* We should always have found the clone by now. */
abort (); gcc_unreachable ();
return NULL_TREE; return NULL_TREE;
} }
...@@ -8996,7 +8989,7 @@ maybe_adjust_types_for_deduction (unification_kind_t strict, ...@@ -8996,7 +8989,7 @@ maybe_adjust_types_for_deduction (unification_kind_t strict,
} }
break; break;
default: default:
abort (); gcc_unreachable ();
} }
if (TREE_CODE (*parm) != REFERENCE_TYPE) if (TREE_CODE (*parm) != REFERENCE_TYPE)
...@@ -9095,7 +9088,7 @@ type_unification_real (tree tparms, ...@@ -9095,7 +9088,7 @@ type_unification_real (tree tparms,
break; break;
default: default:
abort (); gcc_unreachable ();
} }
if (xlen == 0) if (xlen == 0)
...@@ -9283,16 +9276,16 @@ resolve_overloaded_unification (tree tparms, ...@@ -9283,16 +9276,16 @@ resolve_overloaded_unification (tree tparms,
} }
} }
} }
else if (TREE_CODE (arg) == OVERLOAD else
|| TREE_CODE (arg) == FUNCTION_DECL)
{ {
gcc_assert (TREE_CODE (arg) == OVERLOAD
|| TREE_CODE (arg) == FUNCTION_DECL);
for (; arg; arg = OVL_NEXT (arg)) for (; arg; arg = OVL_NEXT (arg))
good += try_one_overload (tparms, targs, tempargs, parm, good += try_one_overload (tparms, targs, tempargs, parm,
TREE_TYPE (OVL_CURRENT (arg)), TREE_TYPE (OVL_CURRENT (arg)),
strict, sub_strict, addr_p); strict, sub_strict, addr_p);
} }
else
abort ();
/* [temp.deduct.type] A template-argument can be deduced from a pointer /* [temp.deduct.type] A template-argument can be deduced from a pointer
to function or pointer to member function argument if the set of to function or pointer to member function argument if the set of
...@@ -9593,9 +9586,9 @@ template_decl_level (tree decl) ...@@ -9593,9 +9586,9 @@ template_decl_level (tree decl)
return TEMPLATE_PARM_LEVEL (DECL_INITIAL (decl)); return TEMPLATE_PARM_LEVEL (DECL_INITIAL (decl));
default: default:
abort (); gcc_unreachable ();
return 0;
} }
return 0;
} }
/* Decide whether ARG can be unified with PARM, considering only the /* Decide whether ARG can be unified with PARM, considering only the
...@@ -11959,6 +11952,7 @@ type_dependent_expression_p (tree expression) ...@@ -11959,6 +11952,7 @@ type_dependent_expression_p (tree expression)
if (TREE_CODE (expression) == BASELINK) if (TREE_CODE (expression) == BASELINK)
expression = BASELINK_FUNCTIONS (expression); expression = BASELINK_FUNCTIONS (expression);
if (TREE_CODE (expression) == TEMPLATE_ID_EXPR) if (TREE_CODE (expression) == TEMPLATE_ID_EXPR)
{ {
if (any_dependent_template_arguments_p if (any_dependent_template_arguments_p
...@@ -11966,17 +11960,15 @@ type_dependent_expression_p (tree expression) ...@@ -11966,17 +11960,15 @@ type_dependent_expression_p (tree expression)
return true; return true;
expression = TREE_OPERAND (expression, 0); expression = TREE_OPERAND (expression, 0);
} }
if (TREE_CODE (expression) == OVERLOAD) gcc_assert (TREE_CODE (expression) == OVERLOAD);
while (expression)
{ {
while (expression) if (type_dependent_expression_p (OVL_CURRENT (expression)))
{ return true;
if (type_dependent_expression_p (OVL_CURRENT (expression))) expression = OVL_NEXT (expression);
return true;
expression = OVL_NEXT (expression);
}
return false;
} }
abort (); return false;
} }
return (dependent_type_p (TREE_TYPE (expression))); return (dependent_type_p (TREE_TYPE (expression)));
......
...@@ -161,7 +161,7 @@ lookup_base_r (tree binfo, tree base, base_access access, ...@@ -161,7 +161,7 @@ lookup_base_r (tree binfo, tree base, base_access access,
break; break;
default: default:
abort (); gcc_unreachable ();
} }
} }
return found; return found;
......
...@@ -1563,7 +1563,7 @@ finish_stmt_expr (tree stmt_expr, bool has_no_scope) ...@@ -1563,7 +1563,7 @@ finish_stmt_expr (tree stmt_expr, bool has_no_scope)
result_stmt_p = &TREE_OPERAND (t, 0); result_stmt_p = &TREE_OPERAND (t, 0);
break; break;
default: default:
abort (); gcc_unreachable ();
} }
} }
type = TREE_TYPE (EXPR_STMT_EXPR (result_stmt)); type = TREE_TYPE (EXPR_STMT_EXPR (result_stmt));
...@@ -1601,10 +1601,8 @@ finish_stmt_expr (tree stmt_expr, bool has_no_scope) ...@@ -1601,10 +1601,8 @@ finish_stmt_expr (tree stmt_expr, bool has_no_scope)
returning a value directly, give it the appropriate type. */ returning a value directly, give it the appropriate type. */
if (VOID_TYPE_P (TREE_TYPE (result))) if (VOID_TYPE_P (TREE_TYPE (result)))
TREE_TYPE (result) = type; TREE_TYPE (result) = type;
else if (same_type_p (TREE_TYPE (result), type))
;
else else
abort (); gcc_assert (same_type_p (TREE_TYPE (result), type));
} }
else if (TREE_CODE (result) == STATEMENT_LIST) else if (TREE_CODE (result) == STATEMENT_LIST)
/* We need to wrap a STATEMENT_LIST in a BIND_EXPR so it can have a /* We need to wrap a STATEMENT_LIST in a BIND_EXPR so it can have a
...@@ -2771,12 +2769,11 @@ simplify_aggr_init_expr (tree *tp) ...@@ -2771,12 +2769,11 @@ simplify_aggr_init_expr (tree *tp)
else if (1) else if (1)
style = pcc; style = pcc;
#endif #endif
else if (TREE_ADDRESSABLE (type))
style = arg;
else else
/* We shouldn't build an AGGR_INIT_EXPR if we don't need any special {
handling. See build_cplus_new. */ gcc_assert (TREE_ADDRESSABLE (type));
abort (); style = arg;
}
if (style == ctor || style == arg) if (style == ctor || style == arg)
{ {
...@@ -2793,11 +2790,9 @@ simplify_aggr_init_expr (tree *tp) ...@@ -2793,11 +2790,9 @@ simplify_aggr_init_expr (tree *tp)
{ {
/* The return type might have different cv-quals from the slot. */ /* The return type might have different cv-quals from the slot. */
tree fntype = TREE_TYPE (TREE_TYPE (fn)); tree fntype = TREE_TYPE (TREE_TYPE (fn));
#ifdef ENABLE_CHECKING
if (TREE_CODE (fntype) != FUNCTION_TYPE gcc_assert (TREE_CODE (fntype) == FUNCTION_TYPE
&& TREE_CODE (fntype) != METHOD_TYPE) || TREE_CODE (fntype) == METHOD_TYPE);
abort ();
#endif
addr = convert (build_pointer_type (TREE_TYPE (fntype)), addr); addr = convert (build_pointer_type (TREE_TYPE (fntype)), addr);
} }
......
...@@ -126,7 +126,7 @@ lvalue_p_1 (tree ref, ...@@ -126,7 +126,7 @@ lvalue_p_1 (tree ref,
/* A currently unresolved scope ref. */ /* A currently unresolved scope ref. */
case SCOPE_REF: case SCOPE_REF:
abort (); gcc_unreachable ();
case MAX_EXPR: case MAX_EXPR:
case MIN_EXPR: case MIN_EXPR:
op1_lvalue_kind = lvalue_p_1 (TREE_OPERAND (ref, 0), op1_lvalue_kind = lvalue_p_1 (TREE_OPERAND (ref, 0),
...@@ -796,17 +796,14 @@ int ...@@ -796,17 +796,14 @@ int
count_functions (tree t) count_functions (tree t)
{ {
int i; int i;
if (TREE_CODE (t) == FUNCTION_DECL) if (TREE_CODE (t) == FUNCTION_DECL)
return 1; return 1;
else if (TREE_CODE (t) == OVERLOAD) gcc_assert (TREE_CODE (t) == OVERLOAD);
{
for (i = 0; t; t = OVL_CHAIN (t)) for (i = 0; t; t = OVL_CHAIN (t))
i++; i++;
return i; return i;
}
abort ();
return 0;
} }
int int
...@@ -915,8 +912,7 @@ cxx_printable_name (tree decl, int v) ...@@ -915,8 +912,7 @@ cxx_printable_name (tree decl, int v)
ring_counter += 1; ring_counter += 1;
if (ring_counter == PRINT_RING_SIZE) if (ring_counter == PRINT_RING_SIZE)
ring_counter = 0; ring_counter = 0;
if (decl_ring[ring_counter] == current_function_decl) gcc_assert (decl_ring[ring_counter] != current_function_decl);
abort ();
} }
if (print_ring[ring_counter]) if (print_ring[ring_counter])
...@@ -1016,8 +1012,7 @@ verify_stmt_tree_r (tree* tp, ...@@ -1016,8 +1012,7 @@ verify_stmt_tree_r (tree* tp,
/* If this statement is already present in the hash table, then /* If this statement is already present in the hash table, then
there is a circularity in the statement tree. */ there is a circularity in the statement tree. */
if (htab_find (*statements, t)) gcc_assert (!htab_find (*statements, t));
abort ();
slot = htab_find_slot (*statements, t, INSERT); slot = htab_find_slot (*statements, t, INSERT);
*slot = t; *slot = t;
...@@ -1371,13 +1366,8 @@ get_type_decl (tree t) ...@@ -1371,13 +1366,8 @@ get_type_decl (tree t)
return t; return t;
if (TYPE_P (t)) if (TYPE_P (t))
return TYPE_STUB_DECL (t); return TYPE_STUB_DECL (t);
if (t == error_mark_node) gcc_assert (t == error_mark_node);
return t; return t;
abort ();
/* Stop compiler from complaining control reaches end of non-void function. */
return 0;
} }
/* Returns the namespace that contains DECL, whether directly or /* Returns the namespace that contains DECL, whether directly or
...@@ -2279,9 +2269,8 @@ stabilize_call (tree call, tree *initp) ...@@ -2279,9 +2269,8 @@ stabilize_call (tree call, tree *initp)
if (call == error_mark_node) if (call == error_mark_node)
return; return;
if (TREE_CODE (call) != CALL_EXPR gcc_assert (TREE_CODE (call) == CALL_EXPR
&& TREE_CODE (call) != AGGR_INIT_EXPR) || TREE_CODE (call) == AGGR_INIT_EXPR);
abort ();
for (t = TREE_OPERAND (call, 1); t; t = TREE_CHAIN (t)) for (t = TREE_OPERAND (call, 1); t; t = TREE_CHAIN (t))
if (TREE_SIDE_EFFECTS (TREE_VALUE (t))) if (TREE_SIDE_EFFECTS (TREE_VALUE (t)))
......
...@@ -753,7 +753,7 @@ common_type (tree t1, tree t2) ...@@ -753,7 +753,7 @@ common_type (tree t1, tree t2)
return composite_pointer_type (t1, t2, error_mark_node, error_mark_node, return composite_pointer_type (t1, t2, error_mark_node, error_mark_node,
"conversion"); "conversion");
else else
abort (); gcc_unreachable ();
} }
/* Compare two exception specifier types for exactness or subsetness, if /* Compare two exception specifier types for exactness or subsetness, if
...@@ -2353,7 +2353,7 @@ get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function) ...@@ -2353,7 +2353,7 @@ get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function)
break; break;
default: default:
abort (); gcc_unreachable ();
} }
/* Convert down to the right base before using the instance. First /* Convert down to the right base before using the instance. First
...@@ -3081,11 +3081,16 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, ...@@ -3081,11 +3081,16 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
return e; return e;
return cp_build_binary_op (EQ_EXPR, e, integer_zero_node); return cp_build_binary_op (EQ_EXPR, e, integer_zero_node);
} }
else if ((TYPE_PTRMEMFUNC_P (type0) else
&& same_type_p (TYPE_PTRMEMFUNC_FN_TYPE (type0), type1)) {
|| (TYPE_PTRMEMFUNC_P (type1) gcc_assert (!TYPE_PTRMEMFUNC_P (type0)
&& same_type_p (TYPE_PTRMEMFUNC_FN_TYPE (type1), type0))) || !same_type_p (TYPE_PTRMEMFUNC_FN_TYPE (type0),
abort (); type1));
gcc_assert (!TYPE_PTRMEMFUNC_P (type1)
|| !same_type_p (TYPE_PTRMEMFUNC_FN_TYPE (type1),
type0));
}
break; break;
case MAX_EXPR: case MAX_EXPR:
...@@ -3975,14 +3980,8 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert) ...@@ -3975,14 +3980,8 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert)
address of a function is a no-op, so just return the address of a function is a no-op, so just return the
argument. */ argument. */
if (TREE_CODE (arg) == IDENTIFIER_NODE gcc_assert (TREE_CODE (arg) != IDENTIFIER_NODE
&& IDENTIFIER_OPNAME_P (arg)) || !IDENTIFIER_OPNAME_P (arg));
{
abort ();
/* We don't know the type yet, so just work around the problem.
We know that this will resolve to an lvalue. */
return build1 (ADDR_EXPR, unknown_type_node, arg);
}
if (TREE_CODE (arg) == COMPONENT_REF && type_unknown_p (arg) if (TREE_CODE (arg) == COMPONENT_REF && type_unknown_p (arg)
&& !really_overloaded_fn (TREE_OPERAND (arg, 1))) && !really_overloaded_fn (TREE_OPERAND (arg, 1)))
...@@ -5540,7 +5539,7 @@ expand_ptrmemfunc_cst (tree cst, tree *delta, tree *pfn) ...@@ -5540,7 +5539,7 @@ expand_ptrmemfunc_cst (tree cst, tree *delta, tree *pfn)
break; break;
default: default:
abort (); gcc_unreachable ();
} }
*pfn = fold (build1 (NOP_EXPR, TYPE_PTRMEMFUNC_FN_TYPE (type), *pfn = fold (build1 (NOP_EXPR, TYPE_PTRMEMFUNC_FN_TYPE (type),
......
...@@ -373,7 +373,7 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type) ...@@ -373,7 +373,7 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type)
(*p_msg_at) ("`%D' has incomplete type", value); (*p_msg_at) ("`%D' has incomplete type", value);
decl = 1; decl = 1;
} }
retry: retry:
/* We must print an error message. Be clever about what it says. */ /* We must print an error message. Be clever about what it says. */
switch (TREE_CODE (type)) switch (TREE_CODE (type))
...@@ -423,7 +423,7 @@ retry: ...@@ -423,7 +423,7 @@ retry:
break; break;
default: default:
abort (); gcc_unreachable ();
} }
} }
...@@ -509,7 +509,7 @@ split_nonconstant_init_1 (tree dest, tree init) ...@@ -509,7 +509,7 @@ split_nonconstant_init_1 (tree dest, tree init)
break; break;
default: default:
abort (); gcc_unreachable ();
} }
} }
...@@ -568,9 +568,8 @@ store_init_value (tree decl, tree init) ...@@ -568,9 +568,8 @@ store_init_value (tree decl, tree init)
if (IS_AGGR_TYPE (type)) if (IS_AGGR_TYPE (type))
{ {
if (! TYPE_HAS_TRIVIAL_INIT_REF (type) gcc_assert (TYPE_HAS_TRIVIAL_INIT_REF (type)
&& TREE_CODE (init) != CONSTRUCTOR) || TREE_CODE (init) == CONSTRUCTOR);
abort ();
if (TREE_CODE (init) == TREE_LIST) if (TREE_CODE (init) == TREE_LIST)
{ {
...@@ -1107,8 +1106,7 @@ process_init_constructor (tree type, tree init, tree* elts) ...@@ -1107,8 +1106,7 @@ process_init_constructor (tree type, tree init, tree* elts)
next1 = digest_init (TREE_TYPE (field), next1 = digest_init (TREE_TYPE (field),
TREE_VALUE (tail), &tail1); TREE_VALUE (tail), &tail1);
if (tail1 != 0 && TREE_CODE (tail1) != TREE_LIST) gcc_assert (!tail1 || TREE_CODE (tail1) == TREE_LIST);
abort ();
tail = tail1; tail = tail1;
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment