diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-27 17:59:33 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-27 17:59:33 +0000 |
commit | b4df430b603946f5cbb26e59231df8cf2bab711a (patch) | |
tree | 799c8fedd2cb98c51cb9c5f72999b3cc368ee8ca /gcc/cp/decl.c | |
parent | 0f999733f8eb93c315f4a61664066a28bb9252a0 (diff) | |
download | gcc-b4df430b603946f5cbb26e59231df8cf2bab711a.tar.gz |
* call.c (validate_conversion_obstack): Replace
my_friendly_assert with gcc_assert or gcc_unreachable.
(direct_reference_binding, merge_conversion_sequences,
build_user_type_conversion_1, perform_overload_resolution,
build_op_delete_call, enforce_access, call_builtin_trap,
build_over_call, build_special_member_call, build_new_method_call,
initialize_reference): Likewise.
* class.c (build_base_path, build_primary_vtable, alter_access,
check_bases, update_vtable_entry_for_fn, layout_empty_base,
clone_function_decl, adjust_clone_args,
type_requires_array_cookie, include_empty_classes,
finish_struct_1, resolve_address_of_overloaded_function,
instantiate_type, get_vtbl_decl_for_binfo, build_vtt_inits,
dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group,
accumulate_vtbl_inits, build_vtbl_initializer,
build_vbase_offset_vtbl_entries, build_rtti_vtbl_entries): Likewise.
* cvt.c (build_up_reference, convert_to_reference): Likewise.
* decl.c (poplevel, duplicate_decls, make_typename_type,
cxx_init_decl_processing, reshape_init, check_initializer,
make_rtl_for_nonlocal_decl, initialize_local_var, cp_finish_decl,
expand_static_init, grokfndecl, grokvardecl, build_ptrmem_type,
grokdeclarator, copy_fn_p, grok_op_properties, xref_tag,
xref_basetypes, start_preparsed_function, save_function_data,
finish_function, finish_method, maybe_register_incomplete_var,
complete_vars): Likewise.
* decl2.c (grok_array_decl, check_member_template,
check_classfn, finish_static_data_member_decl, coerce_new_type,
coerce_delete_type, import_export_class, decl_needed_p,
determine_visibility, import_export_decl, build_cleanup,
start_static_initialization_or_destructi, do_static_destruction,
prune_vars_needing_no_initialization,
build_offset_ref_call_from_tree): Likewise.
* error.c (dump_decl, dump_expr): Likewise.
* init.c (finish_init_stmts, build_zero_init,
expand_virtual_init, expand_default_init, expand_aggr_init_1,
build_offset_ref, build_new_1, build_delete, build_vbase_delete):
Likewise.
* mangle.c (write_method_parms, write_template_args,
write_expression, write_template_arg): Likewise.
* method.c (make_thunk, finish_thunk, use_thunk): Likewise.
* name-lookup.c (pop_binding, begin_scope, leave_scope,
resume_scope, push_using_decl, validate_nonmember_using_decl,
is_ancestor, poplevel_class, set_inherited_value_binding_p,
push_class_level_binding, do_class_using_decl, push_namespace,
pop_namespace, add_using_namespace, ambiguous_decl,
lookup_namespace_name, lookup_type_current_level,
maybe_process_template_type_declaration): Likewise.
* parser.c (cp_lexer_peek_nth_token,
cp_parser_parse_and_diagnose_invalid_typ,
cp_parser_translation_unit, cp_parser_template_id,
cp_parser_lookup_name, cp_parser_late_parsing_for_member): Likewise.
* pt.c (push_access_scope, finish_member_template_decl,
push_inline_template_parms_recursive, add_outermost_template_args,
get_innermost_template_args, begin_explicit_instantiation,
end_explicit_instantiation, retrieve_specialization,
is_specialization_of, is_specialization_of_friend,
register_specialization, check_explicit_specialization,
comp_template_parms, process_template_parm,
process_partial_specialization, convert_nontype_argument,
coerce_template_template_parms, coerce_template_parms,
mangle_class_name_for_template, lookup_template_function,
lookup_template_class, instantiate_class_template, tsubst_decl,
tsubst_function_type, tsubst, tsubst_qualified_id, tsubst_copy,
instantiate_template, fn_type_unification, type_unification_real,
get_template_base, regenerate_decl_from_template,
template_for_substitution, instantiate_decl,
get_mostly_instantiated_function_type, dependent_scope_ref_p,
value_dependent_expression_p, resolve_typename_type): Likewise.
* repo.c (repo_emit_p): Likewise.
* rtti.c (build_headof, get_tinfo_decl, get_pseudo_ti_init,
create_tinfo_types, emit_tinfo_decl): Likewise.
* search.c (lookup_base_r, lookup_base, lookup_field_1,
dfs_access_in_type, build_baselink, lookup_member,
adjust_result_of_qualified_name_lookup, copied_binfo): Likewise.
* semantics.c (perform_or_defer_access_check,
finish_non_static_data_member, finish_stmt_expr_expr,
finish_stmt_expr, finish_call_expr, finish_pseudo_destructor_expr,
finish_template_template_parm, finish_member_declaration,
emit_associated_thunks): Likewise.
* tree.c (build_target_expr_with_type, force_target_expr,
copy_binfo, get_first_fn, cp_tree_equal): Likewise.
* typeck.c (type_after_usual_arithmetic_conversions, comptypes,
cxx_sizeof_or_alignof_type, perform_integral_promotions,
build_class_member_access_expr, finish_class_member_access_expr,
build_ptrmemfunc_access_expr, build_unary_op,
unary_complex_lvalue, cxx_mark_addressable, build_modify_expr,
build_ptrmemfunc, expand_ptrmemfunc_cst, check_return_expr
* typeck2.c (complete_type_check_abstract,
abstract_virtuals_error, process_init_constructor,
add_exception_specifier): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86669 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 95 |
1 files changed, 43 insertions, 52 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index a5c6309deed..95cf0f5e717 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -438,20 +438,19 @@ poplevel (int keep, int reverse, int functionbody) block = NULL_TREE; - my_friendly_assert (current_binding_level->kind != sk_class, 19990916); + gcc_assert (current_binding_level->kind != sk_class); real_functionbody = (current_binding_level->kind == sk_cleanup ? ((functionbody = 0), tmp) : functionbody); subblocks = functionbody >= 0 ? current_binding_level->blocks : 0; - my_friendly_assert (VEC_length(cp_class_binding, - current_binding_level->class_shadowed) == 0, - 19990414); + gcc_assert (!VEC_length(cp_class_binding, + current_binding_level->class_shadowed)); /* We used to use KEEP == 2 to indicate that the new block should go at the beginning of the list of blocks at this binding level, rather than the end. This hack is no longer used. */ - my_friendly_assert (keep == 0 || keep == 1, 0); + gcc_assert (keep == 0 || keep == 1); if (current_binding_level->keep) keep = 1; @@ -1793,8 +1792,7 @@ duplicate_decls (tree newdecl, tree olddecl) /* If newdecl is not a specialization, then it is not a template-related function at all. And that means that we should have exited above, returning 0. */ - my_friendly_assert (DECL_TEMPLATE_SPECIALIZATION (newdecl), - 0); + gcc_assert (DECL_TEMPLATE_SPECIALIZATION (newdecl)); if (TREE_USED (olddecl)) /* From [temp.expl.spec]: @@ -2607,7 +2605,7 @@ make_typename_type (tree context, tree name, tsubst_flags_t complain) error ("`%D' used without template parameters", name); return error_mark_node; } - my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 20030802); + gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE); if (TREE_CODE (context) == NAMESPACE_DECL) { @@ -2914,7 +2912,7 @@ cxx_init_decl_processing (void) current_function_decl = NULL_TREE; current_binding_level = NULL; /* Enter the global namespace. */ - my_friendly_assert (global_namespace == NULL_TREE, 375); + gcc_assert (global_namespace == NULL_TREE); global_namespace = build_lang_decl (NAMESPACE_DECL, global_scope_name, void_type_node); begin_scope (sk_namespace, global_namespace); @@ -4139,7 +4137,7 @@ reshape_init (tree type, tree *initp) old_init_value = (TREE_CODE (*initp) == TREE_LIST ? TREE_VALUE (*initp) : old_init); - my_friendly_assert (old_init_value, 20030723); + gcc_assert (old_init_value); /* If the initializer is brace-enclosed, pull initializers from the enclosed elements. Advance past the brace-enclosed initializer @@ -4395,11 +4393,11 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup) if (TREE_CODE (decl) == CONST_DECL) { - my_friendly_assert (TREE_CODE (decl) != REFERENCE_TYPE, 148); + gcc_assert (TREE_CODE (decl) != REFERENCE_TYPE); DECL_INITIAL (decl) = init; - my_friendly_assert (init != NULL_TREE, 149); + gcc_assert (init != NULL_TREE); init = NULL_TREE; } else if (!DECL_EXTERNAL (decl) && TREE_CODE (type) == REFERENCE_TYPE) @@ -4536,11 +4534,11 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const char* asmspec) member. */ if (DECL_LANG_SPECIFIC (decl) && DECL_IN_AGGR_P (decl)) { - my_friendly_assert (TREE_STATIC (decl), 19990828); + gcc_assert (TREE_STATIC (decl)); /* An in-class declaration of a static data member should be external; it is only a declaration, and not a definition. */ if (init == NULL_TREE) - my_friendly_assert (DECL_EXTERNAL (decl), 20000723); + gcc_assert (DECL_EXTERNAL (decl)); } /* We don't create any RTL for local variables. */ @@ -4589,10 +4587,9 @@ initialize_local_var (tree decl, tree init) tree type = TREE_TYPE (decl); tree cleanup; - my_friendly_assert (TREE_CODE (decl) == VAR_DECL - || TREE_CODE (decl) == RESULT_DECL, - 20021010); - my_friendly_assert (!TREE_STATIC (decl), 20021010); + gcc_assert (TREE_CODE (decl) == VAR_DECL + || TREE_CODE (decl) == RESULT_DECL); + gcc_assert (!TREE_STATIC (decl)); if (DECL_SIZE (decl) == NULL_TREE) { @@ -4613,7 +4610,7 @@ initialize_local_var (tree decl, tree init) { int saved_stmts_are_full_exprs_p; - my_friendly_assert (building_stmt_tree (), 20000906); + gcc_assert (building_stmt_tree ()); saved_stmts_are_full_exprs_p = stmts_are_full_exprs_p (); current_stmt_tree ()->stmts_are_full_exprs_p = 1; finish_expr_stmt (init); @@ -4671,7 +4668,7 @@ cp_finish_decl (tree decl, tree init, tree asmspec_tree, int flags) return; } - my_friendly_assert (TREE_CODE (decl) != RESULT_DECL, 20030619); + gcc_assert (TREE_CODE (decl) != RESULT_DECL); /* Assume no cleanup is required. */ cleanup = NULL_TREE; @@ -4719,7 +4716,7 @@ cp_finish_decl (tree decl, tree init, tree asmspec_tree, int flags) } /* Parameters are handled by store_parm_decls, not cp_finish_decl. */ - my_friendly_assert (TREE_CODE (decl) != PARM_DECL, 19990828); + gcc_assert (TREE_CODE (decl) != PARM_DECL); /* Take care of TYPE_DECLs up front. */ if (TREE_CODE (decl) == TYPE_DECL) @@ -5142,8 +5139,8 @@ register_dtor_fn (tree decl) static void expand_static_init (tree decl, tree init) { - my_friendly_assert (TREE_CODE (decl) == VAR_DECL, 20021010); - my_friendly_assert (TREE_STATIC (decl), 20021010); + gcc_assert (TREE_CODE (decl) == VAR_DECL); + gcc_assert (TREE_STATIC (decl)); /* Some variables require no initialization. */ if (!init @@ -5573,12 +5570,12 @@ grokfndecl (tree ctype, (see template_id in parse.y). If the current class contains such a name, we'll get a COMPONENT_REF here. Undo that. */ - my_friendly_assert (TREE_TYPE (TREE_OPERAND (fns, 0)) - == current_class_type, 20001120); + gcc_assert (TREE_TYPE (TREE_OPERAND (fns, 0)) + == current_class_type); fns = TREE_OPERAND (fns, 1); } - my_friendly_assert (TREE_CODE (fns) == IDENTIFIER_NODE - || TREE_CODE (fns) == OVERLOAD, 20001120); + gcc_assert (TREE_CODE (fns) == IDENTIFIER_NODE + || TREE_CODE (fns) == OVERLOAD); DECL_TEMPLATE_INFO (decl) = tree_cons (fns, args, NULL_TREE); if (has_default_arg) @@ -5725,8 +5722,7 @@ grokvardecl (tree type, { tree decl; - my_friendly_assert (!name || TREE_CODE (name) == IDENTIFIER_NODE, - 20020808); + gcc_assert (!name || TREE_CODE (name) == IDENTIFIER_NODE); /* Compute the scope in which to place the variable. */ if (!scope) @@ -5920,8 +5916,7 @@ build_ptrmem_type (tree class_type, tree member_type) } else { - my_friendly_assert (TREE_CODE (member_type) != FUNCTION_TYPE, - 20030716); + gcc_assert (TREE_CODE (member_type) != FUNCTION_TYPE); return build_offset_type (class_type, member_type); } } @@ -6416,8 +6411,7 @@ grokdeclarator (const cp_declarator *declarator, dname = TREE_OPERAND (dname, 1); if (TREE_CODE (dname) != IDENTIFIER_NODE) { - my_friendly_assert (is_overloaded_fn (dname), - 19990331); + gcc_assert (is_overloaded_fn (dname)); dname = DECL_NAME (get_first_fn (dname)); } } @@ -6437,7 +6431,7 @@ grokdeclarator (const cp_declarator *declarator, name = IDENTIFIER_POINTER (dname); else { - my_friendly_assert (flags == NO_SPECIAL, 154); + gcc_assert (flags == NO_SPECIAL); flags = TYPENAME_FLAG; ctor_return_type = TREE_TYPE (dname); sfk = sfk_conversion; @@ -8297,7 +8291,7 @@ copy_fn_p (tree d) tree arg_type; int result = 1; - my_friendly_assert (DECL_FUNCTION_MEMBER_P (d), 20011208); + gcc_assert (DECL_FUNCTION_MEMBER_P (d)); if (DECL_TEMPLATE_INFO (d) && is_member_template (DECL_TI_TEMPLATE (d))) /* Instantiations of template member functions are never copy @@ -8488,7 +8482,7 @@ grok_op_properties (tree decl, int friendp, bool complain) abort (); } while (0); - my_friendly_assert (operator_code != LAST_CPLUS_TREE_CODE, 20000526); + gcc_assert (operator_code != LAST_CPLUS_TREE_CODE); SET_OVERLOADED_OPERATOR_CODE (decl, operator_code); if (! friendp) @@ -8892,7 +8886,7 @@ xref_tag (enum tag_types tag_code, tree name, timevar_push (TV_NAME_LOOKUP); - my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 0); + gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE); switch (tag_code) { @@ -9099,8 +9093,8 @@ xref_basetypes (tree ref, tree base_list) /* The binfo slot should be empty, unless this is an (ill-formed) redefinition. */ - my_friendly_assert (!TYPE_BINFO (ref) || TYPE_SIZE (ref), 20040706); - my_friendly_assert (TYPE_MAIN_VARIANT (ref) == ref, 20040712); + gcc_assert (!TYPE_BINFO (ref) || TYPE_SIZE (ref)); + gcc_assert (TYPE_MAIN_VARIANT (ref) == ref); binfo = make_tree_binfo (max_bases); @@ -9603,8 +9597,8 @@ start_preparsed_function (tree decl1, tree attrs, int flags) tree current_function_parms; /* Sanity check. */ - my_friendly_assert (TREE_CODE (TREE_VALUE (void_list_node)) == VOID_TYPE, 160); - my_friendly_assert (TREE_CHAIN (void_list_node) == NULL_TREE, 161); + gcc_assert (TREE_CODE (TREE_VALUE (void_list_node)) == VOID_TYPE); + gcc_assert (TREE_CHAIN (void_list_node) == NULL_TREE); fntype = TREE_TYPE (decl1); if (TREE_CODE (fntype) == METHOD_TYPE) @@ -9789,10 +9783,8 @@ start_preparsed_function (tree decl1, tree attrs, int flags) between `current_class_type' and `current_class_ptr'. */ tree t = DECL_ARGUMENTS (decl1); - my_friendly_assert (t != NULL_TREE && TREE_CODE (t) == PARM_DECL, - 162); - my_friendly_assert (TREE_CODE (TREE_TYPE (t)) == POINTER_TYPE, - 19990811); + gcc_assert (t != NULL_TREE && TREE_CODE (t) == PARM_DECL); + gcc_assert (TREE_CODE (TREE_TYPE (t)) == POINTER_TYPE); cp_function_chain->x_current_class_ref = build_indirect_ref (t, NULL); @@ -10047,8 +10039,7 @@ save_function_data (tree decl) /* Save the language-specific per-function data so that we can get it back when we really expand this function. */ - my_friendly_assert (!DECL_PENDING_INLINE_P (decl), - 19990908); + gcc_assert (!DECL_PENDING_INLINE_P (decl)); /* Make a copy. */ f = GGC_NEW (struct language_function); @@ -10274,7 +10265,7 @@ finish_function (int flags) This caused &foo to be of type ptr-to-const-function which then got a warning when stored in a ptr-to-function variable. */ - my_friendly_assert (building_stmt_tree (), 20000911); + gcc_assert (building_stmt_tree ()); /* For a cloned function, we've already got all the code we need; there's no need to add any extra bits. */ @@ -10339,7 +10330,7 @@ finish_function (int flags) /* Statements should always be full-expressions at the outermost set of curly braces for a function. */ - my_friendly_assert (stmts_are_full_exprs_p (), 19990831); + gcc_assert (stmts_are_full_exprs_p ()); /* Set up the named return value optimization, if we can. Candidate variables are selected in check_return_value. */ @@ -10562,7 +10553,7 @@ finish_method (tree decl) { if (DECL_NAME (link) != NULL_TREE) pop_binding (DECL_NAME (link), link); - my_friendly_assert (TREE_CODE (link) != FUNCTION_DECL, 163); + gcc_assert (TREE_CODE (link) != FUNCTION_DECL); DECL_CONTEXT (link) = NULL_TREE; } @@ -10590,7 +10581,7 @@ finish_method (tree decl) void maybe_register_incomplete_var (tree var) { - my_friendly_assert (TREE_CODE (var) == VAR_DECL, 20020406); + gcc_assert (TREE_CODE (var) == VAR_DECL); /* Keep track of variables with incomplete types. */ if (!processing_template_decl && TREE_TYPE (var) != error_mark_node @@ -10619,7 +10610,7 @@ complete_vars (tree type) { tree *list = &incomplete_vars; - my_friendly_assert (CLASS_TYPE_P (type), 20020406); + gcc_assert (CLASS_TYPE_P (type)); while (*list) { if (same_type_p (type, TREE_PURPOSE (*list))) |