From: Nathan Sidwell Date: Fri, 27 Aug 2004 17:59:33 +0000 (+0000) Subject: call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=50bc768da122bde65bc31bf4054f29603893455a;p=gcc.git call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. * 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. From-SVN: r86669 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b2e109dbc36..a4796a1ec16 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,96 @@ +2004-08-27 Nathan Sidwell + + * 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. + 2004-08-27 Nathan Sidwell * class.c (build_vtbl_initializer): Use ssize_int. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 6ebe9e24e23..07aea66308b 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -497,9 +497,8 @@ void validate_conversion_obstack (void) { if (conversion_obstack_initialized) - my_friendly_assert ((obstack_next_free (&conversion_obstack) - == obstack_base (&conversion_obstack)), - 20040208); + gcc_assert ((obstack_next_free (&conversion_obstack) + == obstack_base (&conversion_obstack))); } #endif /* ENABLE_CHECKING */ @@ -1033,8 +1032,8 @@ direct_reference_binding (tree type, conversion *conv) { tree t; - my_friendly_assert (TREE_CODE (type) == REFERENCE_TYPE, 20030306); - my_friendly_assert (TREE_CODE (conv->type) != REFERENCE_TYPE, 20030306); + gcc_assert (TREE_CODE (type) == REFERENCE_TYPE); + gcc_assert (TREE_CODE (conv->type) != REFERENCE_TYPE); t = TREE_TYPE (type); @@ -2464,7 +2463,7 @@ merge_conversion_sequences (conversion *user_seq, conversion *std_seq) { conversion **t; - my_friendly_assert (user_seq->kind == ck_user, 20030306); + gcc_assert (user_seq->kind == ck_user); /* Find the end of the second conversion sequence. */ t = &(std_seq); @@ -2501,8 +2500,8 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags) /* We represent conversion within a hierarchy using RVALUE_CONV and BASE_CONV, as specified by [over.best.ics]; these become plain constructor calls, as specified in [dcl.init]. */ - my_friendly_assert (!IS_AGGR_TYPE (fromtype) || !IS_AGGR_TYPE (totype) - || !DERIVED_FROM_P (totype, fromtype), 20011226); + gcc_assert (!IS_AGGR_TYPE (fromtype) || !IS_AGGR_TYPE (totype) + || !DERIVED_FROM_P (totype, fromtype)); if (IS_AGGR_TYPE (totype)) ctors = lookup_fnfields (totype, complete_ctor_identifier, 0); @@ -2523,9 +2522,8 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags) args = build_tree_list (NULL_TREE, expr); /* We should never try to call the abstract or base constructor from here. */ - my_friendly_assert (!DECL_HAS_IN_CHARGE_PARM_P (OVL_CURRENT (ctors)) - && !DECL_HAS_VTT_PARM_P (OVL_CURRENT (ctors)), - 20011226); + gcc_assert (!DECL_HAS_IN_CHARGE_PARM_P (OVL_CURRENT (ctors)) + && !DECL_HAS_VTT_PARM_P (OVL_CURRENT (ctors))); args = tree_cons (NULL_TREE, t, args); } for (; ctors; ctors = OVL_NEXT (ctors)) @@ -2718,13 +2716,11 @@ perform_overload_resolution (tree fn, *any_viable_p = true; /* Check FN and ARGS. */ - my_friendly_assert (TREE_CODE (fn) == FUNCTION_DECL - || TREE_CODE (fn) == TEMPLATE_DECL - || TREE_CODE (fn) == OVERLOAD - || TREE_CODE (fn) == TEMPLATE_ID_EXPR, - 20020712); - my_friendly_assert (!args || TREE_CODE (args) == TREE_LIST, - 20020712); + gcc_assert (TREE_CODE (fn) == FUNCTION_DECL + || TREE_CODE (fn) == TEMPLATE_DECL + || TREE_CODE (fn) == OVERLOAD + || TREE_CODE (fn) == TEMPLATE_ID_EXPR); + gcc_assert (!args || TREE_CODE (args) == TREE_LIST); if (TREE_CODE (fn) == TEMPLATE_ID_EXPR) { @@ -3960,7 +3956,7 @@ build_op_delete_call (enum tree_code code, tree addr, tree size, call_expr = placement; /* Extract the function. */ alloc_fn = get_callee_fndecl (call_expr); - my_friendly_assert (alloc_fn != NULL_TREE, 20020327); + gcc_assert (alloc_fn != NULL_TREE); /* Then the second parm type. */ argtypes = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (alloc_fn))); /* Also the second argument. */ @@ -4068,7 +4064,7 @@ build_op_delete_call (enum tree_code code, tree addr, tree size, bool enforce_access (tree basetype_path, tree decl) { - my_friendly_assert (TREE_CODE (basetype_path) == TREE_BINFO, 20030624); + gcc_assert (TREE_CODE (basetype_path) == TREE_BINFO); if (!accessible_p (basetype_path, decl)) { @@ -4356,7 +4352,7 @@ call_builtin_trap (void) { tree fn = implicit_built_in_decls[BUILT_IN_TRAP]; - my_friendly_assert (fn != NULL, 20030927); + gcc_assert (fn != NULL); fn = build_call (fn, NULL_TREE); return fn; } @@ -4682,9 +4678,9 @@ build_over_call (struct z_candidate *cand, int flags) So we can assume that anything passed as 'this' is non-null, and optimize accordingly. */ - my_friendly_assert (TREE_CODE (parmtype) == POINTER_TYPE, 19990811); + gcc_assert (TREE_CODE (parmtype) == POINTER_TYPE); /* Convert to the base in which the function was declared. */ - my_friendly_assert (cand->conversion_path != NULL_TREE, 20020730); + gcc_assert (cand->conversion_path != NULL_TREE); converted_arg = build_base_path (PLUS_EXPR, TREE_VALUE (arg), cand->conversion_path, @@ -4851,7 +4847,7 @@ build_over_call (struct z_candidate *cand, int flags) tree binfo = lookup_base (TREE_TYPE (TREE_TYPE (*p)), DECL_CONTEXT (fn), ba_any, NULL); - my_friendly_assert (binfo && binfo != error_mark_node, 20010730); + gcc_assert (binfo && binfo != error_mark_node); *p = build_base_path (PLUS_EXPR, *p, binfo, 1); if (TREE_SIDE_EFFECTS (*p)) @@ -5012,13 +5008,12 @@ build_special_member_call (tree instance, tree name, tree args, /* The type of the subobject to be constructed or destroyed. */ tree class_type; - my_friendly_assert (name == complete_ctor_identifier - || name == base_ctor_identifier - || name == complete_dtor_identifier - || name == base_dtor_identifier - || name == deleting_dtor_identifier - || name == ansi_assopname (NOP_EXPR), - 20020712); + gcc_assert (name == complete_ctor_identifier + || name == base_ctor_identifier + || name == complete_dtor_identifier + || name == base_dtor_identifier + || name == deleting_dtor_identifier + || name == ansi_assopname (NOP_EXPR)); if (TYPE_P (binfo)) { /* Resolve the name. */ @@ -5028,7 +5023,7 @@ build_special_member_call (tree instance, tree name, tree args, binfo = TYPE_BINFO (binfo); } - my_friendly_assert (binfo != NULL_TREE, 20020712); + gcc_assert (binfo != NULL_TREE); class_type = BINFO_TYPE (binfo); @@ -5043,7 +5038,7 @@ build_special_member_call (tree instance, tree name, tree args, if (name == complete_dtor_identifier || name == base_dtor_identifier || name == deleting_dtor_identifier) - my_friendly_assert (args == NULL_TREE, 20020712); + gcc_assert (args == NULL_TREE); /* Convert to the base class, if necessary. */ if (!same_type_ignoring_top_level_qualifiers_p @@ -5064,7 +5059,7 @@ build_special_member_call (tree instance, tree name, tree args, } } - my_friendly_assert (instance != NULL_TREE, 20020712); + gcc_assert (instance != NULL_TREE); fns = lookup_fnfields (binfo, name, 1); @@ -5088,7 +5083,7 @@ build_special_member_call (tree instance, tree name, tree args, current_in_charge_parm, integer_zero_node), current_vtt_parm, vtt); - my_friendly_assert (BINFO_SUBVTT_INDEX (binfo), 20010110); + gcc_assert (BINFO_SUBVTT_INDEX (binfo)); sub_vtt = build2 (PLUS_EXPR, TREE_TYPE (vtt), vtt, BINFO_SUBVTT_INDEX (binfo)); @@ -5169,7 +5164,7 @@ build_new_method_call (tree instance, tree fns, tree args, tree orig_args; void *p; - my_friendly_assert (instance != NULL_TREE, 20020729); + gcc_assert (instance != NULL_TREE); if (error_operand_p (instance) || error_operand_p (fns) @@ -5220,10 +5215,9 @@ build_new_method_call (tree instance, tree fns, tree args, template_only = 1; } - my_friendly_assert (TREE_CODE (fns) == FUNCTION_DECL - || TREE_CODE (fns) == TEMPLATE_DECL - || TREE_CODE (fns) == OVERLOAD, - 20020712); + gcc_assert (TREE_CODE (fns) == FUNCTION_DECL + || TREE_CODE (fns) == TEMPLATE_DECL + || TREE_CODE (fns) == OVERLOAD); /* XXX this should be handled before we get here. */ if (! IS_AGGR_TYPE (basetype)) @@ -5242,9 +5236,9 @@ build_new_method_call (tree instance, tree fns, tree args, { /* Callers should explicitly indicate whether they want to construct the complete object or just the part without virtual bases. */ - my_friendly_assert (name != ctor_identifier, 20000408); + gcc_assert (name != ctor_identifier); /* Similarly for destructors. */ - my_friendly_assert (name != dtor_identifier, 20000408); + gcc_assert (name != dtor_identifier); } /* It's OK to call destructors on cv-qualified objects. Therefore, @@ -6147,7 +6141,7 @@ the worst conversion for the second:"); } } - my_friendly_assert (!winner, 20010121); + gcc_assert (!winner); return 0; } @@ -6443,7 +6437,7 @@ initialize_reference (tree type, tree expr, tree decl, tree *cleanup) we can extend the lifetime of the return value of the conversion operator. */ - my_friendly_assert (conv->kind == ck_ref_bind, 20030302); + gcc_assert (conv->kind == ck_ref_bind); if (decl) { tree var; diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 8785de75b7d..83977e2c1b9 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -272,11 +272,11 @@ build_base_path (enum tree_code code, if (want_pointer) probe = TYPE_MAIN_VARIANT (TREE_TYPE (probe)); - my_friendly_assert (code == MINUS_EXPR - ? same_type_p (BINFO_TYPE (binfo), probe) - : code == PLUS_EXPR - ? same_type_p (BINFO_TYPE (d_binfo), probe) - : false, 20010723); + gcc_assert (code == MINUS_EXPR + ? same_type_p (BINFO_TYPE (binfo), probe) + : code == PLUS_EXPR + ? same_type_p (BINFO_TYPE (d_binfo), probe) + : false); if (binfo == d_binfo) /* Nothing to do. */ @@ -731,7 +731,7 @@ build_primary_vtable (tree binfo, tree type) } else { - my_friendly_assert (TREE_TYPE (decl) == vtbl_type_node, 20000118); + gcc_assert (TREE_TYPE (decl) == vtbl_type_node); virtuals = NULL_TREE; } @@ -1039,7 +1039,7 @@ alter_access (tree t, tree fdecl, tree access) if (!DECL_LANG_SPECIFIC (fdecl)) retrofit_lang_decl (fdecl); - my_friendly_assert (!DECL_DISCRIMINATOR_P (fdecl), 20030624); + gcc_assert (!DECL_DISCRIMINATOR_P (fdecl)); elem = purpose_member (t, DECL_ACCESS (fdecl)); if (elem) @@ -1191,7 +1191,7 @@ check_bases (tree t, { tree basetype = TREE_TYPE (base_binfo); - my_friendly_assert (COMPLETE_TYPE_P (basetype), 20040714); + gcc_assert (COMPLETE_TYPE_P (basetype)); /* Effective C++ rule 14. We only need to check TYPE_POLYMORPHIC_P here because the case of virtual functions but non-virtual @@ -2081,7 +2081,7 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals, calling FN through BINFO. */ for (b = binfo; ; b = get_primary_binfo (b)) { - my_friendly_assert (b, 20021227); + gcc_assert (b); if (look_for_overrides_here (BINFO_TYPE (b), target_fn)) break; @@ -2114,7 +2114,7 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals, if (DECL_THUNK_P (fn)) { - my_friendly_assert (DECL_RESULT_THUNK_P (fn), 20031211); + gcc_assert (DECL_RESULT_THUNK_P (fn)); fixed_offset = ssize_int (THUNK_FIXED_OFFSET (fn)); virtual_offset = THUNK_VIRTUAL_OFFSET (fn); } @@ -2174,7 +2174,7 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals, fixed_offset, virtual_offset); } else - my_friendly_assert (!DECL_THUNK_P (fn), 20021231); + gcc_assert (!DECL_THUNK_P (fn)); /* Assume that we will produce a thunk that convert all the way to the final overrider, and not to an intermediate virtual base. */ @@ -3561,7 +3561,7 @@ layout_empty_base (tree binfo, tree eoc, splay_tree offsets) bool atend = false; /* This routine should only be used for empty classes. */ - my_friendly_assert (is_empty_class (basetype), 20000321); + gcc_assert (is_empty_class (basetype)); alignment = ssize_int (CLASSTYPE_ALIGN_UNIT (basetype)); if (!integer_zerop (BINFO_OFFSET (binfo))) @@ -3923,7 +3923,7 @@ clone_function_decl (tree fn, int update_method_vec_p) } else { - my_friendly_assert (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn), 20000411); + gcc_assert (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn)); /* For each destructor, we need three variants: an in-charge version, a not-in-charge version, and an in-charge deleting @@ -3990,8 +3990,8 @@ adjust_clone_args (tree decl) decl_parms = TREE_CHAIN (decl_parms), clone_parms = TREE_CHAIN (clone_parms)) { - my_friendly_assert (same_type_p (TREE_TYPE (decl_parms), - TREE_TYPE (clone_parms)), 20010424); + gcc_assert (same_type_p (TREE_TYPE (decl_parms), + TREE_TYPE (clone_parms))); if (TREE_PURPOSE (decl_parms) && !TREE_PURPOSE (clone_parms)) { @@ -4021,7 +4021,7 @@ adjust_clone_args (tree decl) break; } } - my_friendly_assert (!clone_parms, 20010424); + gcc_assert (!clone_parms); } } @@ -4072,7 +4072,7 @@ type_requires_array_cookie (tree type) tree fns; bool has_two_argument_delete_p = false; - my_friendly_assert (CLASS_TYPE_P (type), 20010712); + gcc_assert (CLASS_TYPE_P (type)); /* If there's a non-trivial destructor, we need a cookie. In order to iterate through the array calling the destructor for each @@ -4579,10 +4579,8 @@ include_empty_classes (record_layout_info rli) rli->bitpos = round_down (rli->bitpos, BITS_PER_UNIT); else /* The size should have been rounded to a whole byte. */ - my_friendly_assert (tree_int_cst_equal (rli->bitpos, - round_down (rli->bitpos, - BITS_PER_UNIT)), - 20030903); + gcc_assert (tree_int_cst_equal + (rli->bitpos, round_down (rli->bitpos, BITS_PER_UNIT))); rli->bitpos = size_binop (PLUS_EXPR, rli->bitpos, @@ -5024,21 +5022,18 @@ finish_struct_1 (tree t) { tree primary = CLASSTYPE_PRIMARY_BINFO (t); - my_friendly_assert (same_type_p (DECL_FIELD_CONTEXT (vfield), - BINFO_TYPE (primary)), - 20010726); + gcc_assert (same_type_p (DECL_FIELD_CONTEXT (vfield), + BINFO_TYPE (primary))); /* The vtable better be at the start. */ - my_friendly_assert (integer_zerop (DECL_FIELD_OFFSET (vfield)), - 20010726); - my_friendly_assert (integer_zerop (BINFO_OFFSET (primary)), - 20010726); + gcc_assert (integer_zerop (DECL_FIELD_OFFSET (vfield))); + gcc_assert (integer_zerop (BINFO_OFFSET (primary))); vfield = copy_decl (vfield); DECL_FIELD_CONTEXT (vfield) = t; TYPE_VFIELD (t) = vfield; } else - my_friendly_assert (!vfield || DECL_FIELD_CONTEXT (vfield) == t, 20010726); + gcc_assert (!vfield || DECL_FIELD_CONTEXT (vfield) == t); virtuals = modify_all_vtables (t, nreverse (virtuals)); @@ -5060,11 +5055,9 @@ finish_struct_1 (tree t) tree fn; if (BINFO_VTABLE (TYPE_BINFO (t))) - my_friendly_assert (DECL_VIRTUAL_P (BINFO_VTABLE (TYPE_BINFO (t))), - 20000116); + gcc_assert (DECL_VIRTUAL_P (BINFO_VTABLE (TYPE_BINFO (t)))); if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t)) - my_friendly_assert (BINFO_VIRTUALS (TYPE_BINFO (t)) == NULL_TREE, - 20000116); + gcc_assert (BINFO_VIRTUALS (TYPE_BINFO (t)) == NULL_TREE); /* Add entries for virtual functions introduced by this class. */ BINFO_VIRTUALS (TYPE_BINFO (t)) @@ -5709,11 +5702,10 @@ resolve_address_of_overloaded_function (tree target_type, /* By the time we get here, we should be seeing only real pointer-to-member types, not the internal POINTER_TYPE to METHOD_TYPE representation. */ - my_friendly_assert (!(TREE_CODE (target_type) == POINTER_TYPE - && (TREE_CODE (TREE_TYPE (target_type)) - == METHOD_TYPE)), 0); + gcc_assert (TREE_CODE (target_type) != POINTER_TYPE + || TREE_CODE (TREE_TYPE (target_type)) != METHOD_TYPE); - my_friendly_assert (is_overloaded_fn (overload), 20030910); + gcc_assert (is_overloaded_fn (overload)); /* Check that the TARGET_TYPE is reasonable. */ if (TYPE_PTRFN_P (target_type)) @@ -6037,7 +6029,7 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags) /* This can happen if we are forming a pointer-to-member for a member template. */ - my_friendly_assert (TREE_CODE (rhs) == TEMPLATE_ID_EXPR, 0); + gcc_assert (TREE_CODE (rhs) == TEMPLATE_ID_EXPR); /* Fall through. */ @@ -6061,7 +6053,7 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags) case TREE_LIST: /* Now we should have a baselink. */ - my_friendly_assert (BASELINK_P (rhs), 990412); + gcc_assert (BASELINK_P (rhs)); return instantiate_type (lhstype, BASELINK_FUNCTIONS (rhs), flags); @@ -6403,12 +6395,11 @@ get_vtbl_decl_for_binfo (tree binfo) decl = BINFO_VTABLE (binfo); if (decl && TREE_CODE (decl) == PLUS_EXPR) { - my_friendly_assert (TREE_CODE (TREE_OPERAND (decl, 0)) == ADDR_EXPR, - 2000403); + gcc_assert (TREE_CODE (TREE_OPERAND (decl, 0)) == ADDR_EXPR); decl = TREE_OPERAND (TREE_OPERAND (decl, 0), 0); } if (decl) - my_friendly_assert (TREE_CODE (decl) == VAR_DECL, 20000403); + gcc_assert (TREE_CODE (decl) == VAR_DECL); return decl; } @@ -6853,7 +6844,7 @@ build_vtt_inits (tree binfo, tree t, tree* inits, tree* index) inits = &TREE_CHAIN (*inits); if (top_level_p) { - my_friendly_assert (!BINFO_VPTR_INDEX (binfo), 20010129); + gcc_assert (!BINFO_VPTR_INDEX (binfo)); BINFO_VPTR_INDEX (binfo) = *index; } *index = size_binop (PLUS_EXPR, *index, TYPE_SIZE_UNIT (ptr_type_node)); @@ -6890,7 +6881,7 @@ build_vtt_inits (tree binfo, tree t, tree* inits, tree* index) { *inits = nreverse (secondary_vptrs); inits = &TREE_CHAIN (secondary_vptrs); - my_friendly_assert (*inits == NULL_TREE, 20000517); + gcc_assert (*inits == NULL_TREE); } /* Add the secondary VTTs for virtual bases. */ @@ -6959,7 +6950,7 @@ dfs_build_secondary_vptr_vtt_inits (tree binfo, void *data) index = TREE_TYPE (l); if (top_level_p) { - my_friendly_assert (!BINFO_VPTR_INDEX (binfo), 20010129); + gcc_assert (!BINFO_VPTR_INDEX (binfo)); BINFO_VPTR_INDEX (binfo) = index; } TREE_TYPE (l) = size_binop (PLUS_EXPR, index, @@ -7039,7 +7030,7 @@ build_ctor_vtbl_group (tree binfo, tree t) if (IDENTIFIER_GLOBAL_VALUE (id)) return; - my_friendly_assert (!same_type_p (BINFO_TYPE (binfo), t), 20010124); + gcc_assert (!same_type_p (BINFO_TYPE (binfo), t)); /* Build a version of VTBL (with the wrong type) for use in constructing the addresses of secondary vtables in the construction vtable group. */ @@ -7096,9 +7087,7 @@ accumulate_vtbl_inits (tree binfo, tree base_binfo; int ctor_vtbl_p = !same_type_p (BINFO_TYPE (rtti_binfo), t); - my_friendly_assert (same_type_p (BINFO_TYPE (binfo), - BINFO_TYPE (orig_binfo)), - 20000517); + gcc_assert (same_type_p (BINFO_TYPE (binfo), BINFO_TYPE (orig_binfo))); /* If it doesn't have a vptr, we don't do anything. */ if (!TYPE_CONTAINS_VPTR_P (BINFO_TYPE (binfo))) @@ -7378,8 +7367,8 @@ build_vtbl_initializer (tree binfo, delta = BV_DELTA (v); vcall_index = BV_VCALL_INDEX (v); - my_friendly_assert (TREE_CODE (delta) == INTEGER_CST, 19990727); - my_friendly_assert (TREE_CODE (fn) == FUNCTION_DECL, 19990727); + gcc_assert (TREE_CODE (delta) == INTEGER_CST); + gcc_assert (TREE_CODE (fn) == FUNCTION_DECL); /* You can't call an abstract virtual function; it's abstract. So, we replace these functions with __pure_virtual. */ @@ -7523,12 +7512,8 @@ build_vbase_offset_vtbl_entries (tree binfo, vtbl_init_data* vid) BINFO_VPTR_FIELD (b) = delta; if (binfo != TYPE_BINFO (t)) - { - /* The vbase offset had better be the same. */ - my_friendly_assert (tree_int_cst_equal (delta, - BINFO_VPTR_FIELD (vbase)), - 20030202); - } + /* The vbase offset had better be the same. */ + gcc_assert (tree_int_cst_equal (delta, BINFO_VPTR_FIELD (vbase))); /* The next vbase will come at a more negative offset. */ vid->index = size_binop (MINUS_EXPR, vid->index, @@ -7805,7 +7790,7 @@ build_rtti_vtbl_entries (tree binfo, vtbl_init_data* vid) tree primary_base; primary_base = get_primary_binfo (b); - my_friendly_assert (BINFO_PRIMARY_BASE_OF (primary_base) == b, 20010127); + gcc_assert (BINFO_PRIMARY_BASE_OF (primary_base) == b); b = primary_base; } offset = size_diffop (BINFO_OFFSET (vid->rtti_binfo), BINFO_OFFSET (b)); diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index ede4770cf04..ed18d7c53f7 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -366,7 +366,7 @@ build_up_reference (tree type, tree arg, int flags, tree decl) tree argtype = TREE_TYPE (arg); tree target_type = TREE_TYPE (type); - my_friendly_assert (TREE_CODE (type) == REFERENCE_TYPE, 187); + gcc_assert (TREE_CODE (type) == REFERENCE_TYPE); if ((flags & DIRECT_BIND) && ! real_lvalue_p (arg)) { @@ -470,7 +470,7 @@ convert_to_reference (tree reftype, tree expr, int convtype, intype = TREE_TYPE (expr); - my_friendly_assert (TREE_CODE (intype) != REFERENCE_TYPE, 364); + gcc_assert (TREE_CODE (intype) != REFERENCE_TYPE); intype = TYPE_MAIN_VARIANT (intype); 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))) diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index cb9628ca5d7..5da240f6075 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -338,7 +338,7 @@ grok_array_decl (tree array_expr, tree index_exp) } type = TREE_TYPE (array_expr); - my_friendly_assert (type, 20030626); + gcc_assert (type); type = non_reference (type); /* If they have an `operator[]', use that. */ @@ -473,7 +473,7 @@ check_member_template (tree tmpl) { tree decl; - my_friendly_assert (TREE_CODE (tmpl) == TEMPLATE_DECL, 0); + gcc_assert (TREE_CODE (tmpl) == TEMPLATE_DECL); decl = DECL_TEMPLATE_RESULT (tmpl); if (TREE_CODE (decl) == FUNCTION_DECL @@ -612,11 +612,9 @@ check_classfn (tree ctype, tree function, tree template_parms) either were not passed, or they are the same of DECL_TEMPLATE_PARMS. */ if (TREE_CODE (function) == TEMPLATE_DECL) { - my_friendly_assert (!template_parms - || comp_template_parms - (template_parms, - DECL_TEMPLATE_PARMS (function)), - 20040303); + gcc_assert (!template_parms + || comp_template_parms (template_parms, + DECL_TEMPLATE_PARMS (function))); template_parms = DECL_TEMPLATE_PARMS (function); } @@ -765,7 +763,7 @@ void finish_static_data_member_decl (tree decl, tree init, tree asmspec_tree, int flags) { - my_friendly_assert (TREE_PUBLIC (decl), 0); + gcc_assert (TREE_PUBLIC (decl)); DECL_CONTEXT (decl) = current_class_type; @@ -1238,7 +1236,7 @@ coerce_new_type (tree type) int e = 0; tree args = TYPE_ARG_TYPES (type); - my_friendly_assert (TREE_CODE (type) == FUNCTION_TYPE, 20001107); + gcc_assert (TREE_CODE (type) == FUNCTION_TYPE); if (!same_type_p (TREE_TYPE (type), ptr_type_node)) e = 1, error ("`operator new' must return type `%T'", ptr_type_node); @@ -1272,7 +1270,7 @@ coerce_delete_type (tree type) int e = 0; tree args = TYPE_ARG_TYPES (type); - my_friendly_assert (TREE_CODE (type) == FUNCTION_TYPE, 20001107); + gcc_assert (TREE_CODE (type) == FUNCTION_TYPE); if (!same_type_p (TREE_TYPE (type), void_type_node)) e = 1, error ("`operator delete' must return type `%T'", void_type_node); @@ -1435,7 +1433,7 @@ import_export_class (tree ctype) non-abstract virtual member function has been defined in this translation unit. But, we can't possibly know that until we've seen the entire translation unit. */ - my_friendly_assert (at_eof, 20000226); + gcc_assert (at_eof); if (CLASSTYPE_INTERFACE_KNOWN (ctype)) return; @@ -1520,13 +1518,12 @@ mark_needed (tree decl) bool decl_needed_p (tree decl) { - my_friendly_assert (TREE_CODE (decl) == VAR_DECL - || TREE_CODE (decl) == FUNCTION_DECL, - 20040726); + gcc_assert (TREE_CODE (decl) == VAR_DECL + || TREE_CODE (decl) == FUNCTION_DECL); /* This function should only be called at the end of the translation unit. We cannot be sure of whether or not something will be COMDAT until that point. */ - my_friendly_assert (at_eof, 20040726); + gcc_assert (at_eof); /* All entities with external linkage that are not COMDAT should be emitted; they may be referred to from other object files. */ @@ -1622,7 +1619,7 @@ determine_visibility (tree decl) /* Cloned constructors and destructors get the same visibility as the underlying function. That should be set up in maybe_clone_body. */ - my_friendly_assert (!DECL_CLONED_FUNCTION_P (decl), 20040804); + gcc_assert (!DECL_CLONED_FUNCTION_P (decl)); /* Give the common code a chance to make a determination. */ if (c_determine_visibility (decl)) @@ -1640,8 +1637,8 @@ determine_visibility (tree decl) { /* Virtual tables have DECL_CONTEXT set to their associated class, so they are automatically handled above. */ - my_friendly_assert (!(TREE_CODE (decl) == VAR_DECL - && DECL_VTABLE_OR_VTT_P (decl)), 20040803); + gcc_assert (TREE_CODE (decl) != VAR_DECL + || !DECL_VTABLE_OR_VTT_P (decl)); /* Entities not associated with any class just get the visibility specified by their attributes. */ return; @@ -1705,7 +1702,7 @@ import_export_decl (tree decl) "-frepo" it would be incorrect to make decisions about what entities to emit when building the PCH; those decisions must be delayed until the repository information has been processed. */ - my_friendly_assert (at_eof, 20040727); + gcc_assert (at_eof); /* Object file linkage for explicit instantiations is handled in mark_decl_instantiated. For static variables in functions with vague linkage, maybe_commonize_var is used. @@ -1728,25 +1725,22 @@ import_export_decl (tree decl) definition available in this translation unit. The following assertions check these conditions. */ - my_friendly_assert (TREE_CODE (decl) == FUNCTION_DECL - || TREE_CODE (decl) == VAR_DECL, - 2004725); + gcc_assert (TREE_CODE (decl) == FUNCTION_DECL + || TREE_CODE (decl) == VAR_DECL); /* Any code that creates entities with TREE_PUBLIC cleared should also set DECL_INTERFACE_KNOWN. */ - my_friendly_assert (TREE_PUBLIC (decl), 20040725); + gcc_assert (TREE_PUBLIC (decl)); if (TREE_CODE (decl) == FUNCTION_DECL) - my_friendly_assert (DECL_IMPLICIT_INSTANTIATION (decl) - || DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (decl) - || DECL_DECLARED_INLINE_P (decl), - 20040725); + gcc_assert (DECL_IMPLICIT_INSTANTIATION (decl) + || DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (decl) + || DECL_DECLARED_INLINE_P (decl)); else - my_friendly_assert (DECL_IMPLICIT_INSTANTIATION (decl) - || DECL_VTABLE_OR_VTT_P (decl) - || DECL_TINFO_P (decl), - 20040725); + gcc_assert (DECL_IMPLICIT_INSTANTIATION (decl) + || DECL_VTABLE_OR_VTT_P (decl) + || DECL_TINFO_P (decl)); /* Check that a definition of DECL is available in this translation unit. */ - my_friendly_assert (!DECL_REALLY_EXTERN (decl), 20040725); + gcc_assert (!DECL_REALLY_EXTERN (decl)); /* Assume that DECL will not have COMDAT linkage. */ comdat_p = false; @@ -1923,7 +1917,7 @@ build_cleanup (tree decl) /* This function should only be called for declarations that really require cleanups. */ - my_friendly_assert (!TYPE_HAS_TRIVIAL_DESTRUCTOR (type), 20030106); + gcc_assert (!TYPE_HAS_TRIVIAL_DESTRUCTOR (type)); /* Treat all objects with destructors as used; the destructor may do something substantive. */ @@ -2378,7 +2372,7 @@ start_static_initialization_or_destruction (tree decl, int initp) { /* When using __cxa_atexit, we never try to destroy anything from a static destructor. */ - my_friendly_assert (initp, 20000629); + gcc_assert (initp); guard_cond = get_guard_cond (guard); } /* If we don't have __cxa_atexit, then we will be running @@ -2470,7 +2464,7 @@ do_static_destruction (tree decl) /* If we're using __cxa_atexit, then destructors are registered immediately after objects are initialized. */ - my_friendly_assert (!flag_use_cxa_atexit, 20000121); + gcc_assert (!flag_use_cxa_atexit); /* If we don't need a destructor, there's nothing to do. */ if (TYPE_HAS_TRIVIAL_DESTRUCTOR (TREE_TYPE (decl))) @@ -2511,7 +2505,7 @@ prune_vars_needing_no_initialization (tree *vars) } /* The only things that can be initialized are variables. */ - my_friendly_assert (TREE_CODE (decl) == VAR_DECL, 19990420); + gcc_assert (TREE_CODE (decl) == VAR_DECL); /* If this object is not defined, we don't need to do anything here. */ @@ -3120,9 +3114,8 @@ build_offset_ref_call_from_tree (tree fn, tree args) if (processing_template_decl) { - my_friendly_assert (TREE_CODE (fn) == DOTSTAR_EXPR - || TREE_CODE (fn) == MEMBER_REF, - 20030708); + gcc_assert (TREE_CODE (fn) == DOTSTAR_EXPR + || TREE_CODE (fn) == MEMBER_REF); if (type_dependent_expression_p (fn) || any_type_dependent_arguments_p (args)) return build_min_nt (CALL_EXPR, fn, args, NULL_TREE); diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 7814b683881..dabac033108 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -735,7 +735,7 @@ dump_decl (tree t, int flags) if (DECL_NAME (t) && VTABLE_NAME_P (DECL_NAME (t))) { pp_string (cxx_pp, "vtable for "); - my_friendly_assert (TYPE_P (DECL_CONTEXT (t)), 20010720); + gcc_assert (TYPE_P (DECL_CONTEXT (t))); dump_type (DECL_CONTEXT (t), flags); break; } @@ -1528,7 +1528,7 @@ dump_expr (tree t, int flags) if (TREE_HAS_CONSTRUCTOR (t)) { t = TREE_OPERAND (t, 0); - my_friendly_assert (TREE_CODE (t) == CALL_EXPR, 237); + gcc_assert (TREE_CODE (t) == CALL_EXPR); dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS); pp_cxx_left_paren (cxx_pp); dump_expr_list (TREE_CHAIN (TREE_OPERAND (t, 1)), flags); @@ -1761,7 +1761,7 @@ dump_expr (tree t, int flags) pp_cxx_identifier (cxx_pp, "sizeof"); else { - my_friendly_assert (TREE_CODE (t) == ALIGNOF_EXPR, 0); + gcc_assert (TREE_CODE (t) == ALIGNOF_EXPR); pp_cxx_identifier (cxx_pp, "__alignof__"); } pp_cxx_whitespace (cxx_pp); diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 3263f6e9b75..1f172d2b2f5 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -87,7 +87,7 @@ finish_init_stmts (bool is_global, tree stmt_expr, tree compound_stmt) stmt_expr = finish_stmt_expr (stmt_expr, true); - my_friendly_assert (!building_stmt_tree () == is_global, 20030726); + gcc_assert (!building_stmt_tree () == is_global); return stmt_expr; } @@ -171,8 +171,7 @@ build_zero_init (tree type, tree nelts, bool static_storage_p) -- if T is a reference type, no initialization is performed. */ - my_friendly_assert (nelts == NULL_TREE || TREE_CODE (nelts) == INTEGER_CST, - 20030618); + gcc_assert (nelts == NULL_TREE || TREE_CODE (nelts) == INTEGER_CST); if (type == error_mark_node) ; @@ -226,7 +225,7 @@ build_zero_init (tree type, tree nelts, bool static_storage_p) /* Iterate over the array elements, building initializations. */ inits = NULL_TREE; max_index = nelts ? nelts : array_type_nelts (type); - my_friendly_assert (TREE_CODE (max_index) == INTEGER_CST, 20030618); + gcc_assert (TREE_CODE (max_index) == INTEGER_CST); /* A zero-sized array, which is accepted as an extension, will have an upper bound of -1. */ @@ -787,7 +786,7 @@ expand_virtual_init (tree binfo, tree decl) /* Compute the location of the vtpr. */ vtbl_ptr = build_vfield_ref (build_indirect_ref (decl, NULL), TREE_TYPE (binfo)); - my_friendly_assert (vtbl_ptr != error_mark_node, 20010730); + gcc_assert (vtbl_ptr != error_mark_node); /* Assign the vtable to the vptr. */ vtbl = convert_force (TREE_TYPE (vtbl_ptr), vtbl, 0); @@ -1180,7 +1179,7 @@ expand_default_init (tree binfo, tree true_exp, tree exp, tree init, int flags) else if (BRACE_ENCLOSED_INITIALIZER_P (init)) { /* A brace-enclosed initializer for an aggregate. */ - my_friendly_assert (CP_AGGREGATE_TYPE_P (type), 20021016); + gcc_assert (CP_AGGREGATE_TYPE_P (type)); init = digest_init (type, init, (tree *)NULL); } else @@ -1248,8 +1247,8 @@ expand_aggr_init_1 (tree binfo, tree true_exp, tree exp, tree init, int flags) { tree type = TREE_TYPE (exp); - my_friendly_assert (init != error_mark_node && type != error_mark_node, 211); - my_friendly_assert (building_stmt_tree (), 20021010); + gcc_assert (init != error_mark_node && type != error_mark_node); + gcc_assert (building_stmt_tree ()); /* Use a function returning the desired type to initialize EXP for us. If the function is a constructor, and its first argument is @@ -1351,7 +1350,7 @@ build_offset_ref (tree type, tree name, bool address_p) name = DECL_NAME (OVL_CURRENT (name)); } - my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 0); + gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE); } if (type == NULL_TREE) @@ -1953,7 +1952,7 @@ build_new_1 (tree exp) while (TREE_CODE (alloc_call) == COMPOUND_EXPR) alloc_call = TREE_OPERAND (alloc_call, 1); alloc_fn = get_callee_fndecl (alloc_call); - my_friendly_assert (alloc_fn != NULL_TREE, 20020325); + gcc_assert (alloc_fn != NULL_TREE); /* Now, check to see if this function is actually a placement allocation function. This can happen even when PLACEMENT is NULL @@ -2769,7 +2768,7 @@ build_delete (tree type, tree addr, special_function_kind auto_delete, addr = convert_force (build_pointer_type (type), addr, 0); } - my_friendly_assert (IS_AGGR_TYPE (type), 220); + gcc_assert (IS_AGGR_TYPE (type)); if (TYPE_HAS_TRIVIAL_DESTRUCTOR (type)) { @@ -2785,7 +2784,7 @@ build_delete (tree type, tree addr, special_function_kind auto_delete, tree do_delete = NULL_TREE; tree ifexp; - my_friendly_assert (TYPE_HAS_DESTRUCTOR (type), 20011213); + gcc_assert (TYPE_HAS_DESTRUCTOR (type)); /* For `::delete x', we must not use the deleting destructor since then we would not be sure to get the global `operator @@ -2935,7 +2934,7 @@ build_vbase_delete (tree type, tree decl) VEC (tree) *vbases; tree addr = build_unary_op (ADDR_EXPR, decl, 0); - my_friendly_assert (addr != error_mark_node, 222); + gcc_assert (addr != error_mark_node); result = convert_to_void (integer_zero_node, NULL); for (vbases = CLASSTYPE_VBASECLASSES (type), ix = 0; diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 8405a5de63a..d1a5766f2ab 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -1853,7 +1853,7 @@ write_method_parms (tree parm_types, const int method_p, const tree decl) fixed-length. */ varargs_p = 0; /* A void type better be the last one. */ - my_friendly_assert (TREE_CHAIN (parm_types) == NULL, 20000523); + gcc_assert (TREE_CHAIN (parm_types) == NULL); } else write_type (parm); @@ -1887,7 +1887,7 @@ write_template_args (tree args) write_char ('I'); - my_friendly_assert (length > 0, 20000422); + gcc_assert (length > 0); if (TREE_CODE (TREE_VEC_ELT (args, 0)) == TREE_VEC) { @@ -2095,8 +2095,7 @@ write_expression (tree expr) template_id = TREE_OPERAND (expr, 1); name = TREE_OPERAND (template_id, 0); /* FIXME: What about operators? */ - my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, - 20030707); + gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE); write_source_name (TREE_OPERAND (template_id, 0)); write_template_args (TREE_OPERAND (template_id, 1)); } @@ -2201,8 +2200,7 @@ write_template_arg (tree node) /* Template parameters can be of reference type. To maintain internal consistency, such arguments use a conversion from address of object to reference type. */ - my_friendly_assert (TREE_CODE (TREE_OPERAND (node, 0)) == ADDR_EXPR, - 20031215); + gcc_assert (TREE_CODE (TREE_OPERAND (node, 0)) == ADDR_EXPR); if (abi_version_at_least (2)) node = TREE_OPERAND (TREE_OPERAND (node, 0), 0); else diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 13fe0a492aa..2a7ddb5a50c 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -88,11 +88,10 @@ make_thunk (tree function, bool this_adjusting, HOST_WIDE_INT d; tree thunk; - my_friendly_assert (TREE_CODE (function) == FUNCTION_DECL, 20021025); + gcc_assert (TREE_CODE (function) == FUNCTION_DECL); /* We can have this thunks to covariant thunks, but not vice versa. */ - my_friendly_assert (!DECL_THIS_THUNK_P (function), 20021127); - my_friendly_assert (!DECL_RESULT_THUNK_P (function) || this_adjusting, - 20031123); + gcc_assert (!DECL_THIS_THUNK_P (function)); + gcc_assert (!DECL_RESULT_THUNK_P (function) || this_adjusting); /* Scale the VIRTUAL_OFFSET to be in terms of bytes. */ if (this_adjusting && virtual_offset) @@ -121,12 +120,11 @@ make_thunk (tree function, bool this_adjusting, /* All thunks must be created before FUNCTION is actually emitted; the ABI requires that all thunks be emitted together with the function to which they transfer control. */ - my_friendly_assert (!TREE_ASM_WRITTEN (function), 20021025); + gcc_assert (!TREE_ASM_WRITTEN (function)); /* Likewise, we can only be adding thunks to a function declared in the class currently being laid out. */ - my_friendly_assert (TYPE_SIZE (DECL_CONTEXT (function)) - && TYPE_BEING_DEFINED (DECL_CONTEXT (function)), - 20031211); + gcc_assert (TYPE_SIZE (DECL_CONTEXT (function)) + && TYPE_BEING_DEFINED (DECL_CONTEXT (function))); thunk = build_decl (FUNCTION_DECL, NULL_TREE, TREE_TYPE (function)); DECL_LANG_SPECIFIC (thunk) = DECL_LANG_SPECIFIC (function); @@ -182,7 +180,7 @@ finish_thunk (tree thunk) tree fixed_offset = ssize_int (THUNK_FIXED_OFFSET (thunk)); tree virtual_offset = THUNK_VIRTUAL_OFFSET (thunk); - my_friendly_assert (!DECL_NAME (thunk) && DECL_THUNK_P (thunk), 20021127); + gcc_assert (!DECL_NAME (thunk) && DECL_THUNK_P (thunk)); if (virtual_offset && DECL_RESULT_THUNK_P (thunk)) virtual_offset = BINFO_VPTR_FIELD (virtual_offset); function = THUNK_TARGET (thunk); @@ -202,7 +200,7 @@ finish_thunk (tree thunk) cov_probe; cov_probe = TREE_CHAIN (cov_probe)) if (DECL_NAME (cov_probe) == name) { - my_friendly_assert (!DECL_THUNKS (thunk), 20031023); + gcc_assert (!DECL_THUNKS (thunk)); THUNK_ALIAS (thunk) = (THUNK_ALIAS (cov_probe) ? THUNK_ALIAS (cov_probe) : cov_probe); break; @@ -317,11 +315,11 @@ use_thunk (tree thunk_fndecl, bool emit_p) bool this_adjusting = DECL_THIS_THUNK_P (thunk_fndecl); /* We should have called finish_thunk to give it a name. */ - my_friendly_assert (DECL_NAME (thunk_fndecl), 20021127); + gcc_assert (DECL_NAME (thunk_fndecl)); /* We should never be using an alias, always refer to the aliased thunk. */ - my_friendly_assert (!THUNK_ALIAS (thunk_fndecl), 20031023); + gcc_assert (!THUNK_ALIAS (thunk_fndecl)); if (TREE_ASM_WRITTEN (thunk_fndecl)) return; @@ -355,7 +353,7 @@ use_thunk (tree thunk_fndecl, bool emit_p) if (!this_adjusting) virtual_offset = BINFO_VPTR_FIELD (virtual_offset); virtual_value = tree_low_cst (virtual_offset, /*pos=*/0); - my_friendly_assert (virtual_value, 20021026); + gcc_assert (virtual_value); } else virtual_value = 0; diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 6fec6ebc652..47f8cc262d5 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -451,7 +451,7 @@ pop_binding (tree id, tree decl) binding = IDENTIFIER_BINDING (id); /* The name should be bound. */ - my_friendly_assert (binding != NULL, 0); + gcc_assert (binding != NULL); /* The DECL will be either the ordinary binding or the type binding for this identifier. Remove that binding. */ @@ -1345,7 +1345,7 @@ begin_scope (scope_kind kind, tree entity) default: /* Should not happen. */ - my_friendly_assert (false, 20030922); + gcc_unreachable (); break; } scope->kind = kind; @@ -1368,7 +1368,7 @@ leave_scope (void) /* We cannot leave a scope, if there are none left. */ if (NAMESPACE_LEVEL (global_namespace)) - my_friendly_assert (!global_scope_p (scope), 20030527); + gcc_assert (!global_scope_p (scope)); if (ENABLE_SCOPE_CHECKING) { @@ -1398,9 +1398,8 @@ leave_scope (void) scope->type_decls = NULL; else binding_table_free (scope->type_decls); - my_friendly_assert (!ENABLE_SCOPE_CHECKING - || scope->binding_depth == binding_depth, - 20030529); + gcc_assert (!ENABLE_SCOPE_CHECKING + || scope->binding_depth == binding_depth); free_binding_level = scope; } @@ -1420,9 +1419,9 @@ resume_scope (struct cp_binding_level* b) { /* Resuming binding levels is meant only for namespaces, and those cannot nest into classes. */ - my_friendly_assert(!class_binding_level, 386); + gcc_assert (!class_binding_level); /* Also, resuming a non-directly nested namespace is a no-no. */ - my_friendly_assert(b->level_chain == current_binding_level, 386); + gcc_assert (b->level_chain == current_binding_level); current_binding_level = b; if (ENABLE_SCOPE_CHECKING) { @@ -1929,8 +1928,8 @@ push_using_decl (tree scope, tree name) tree decl; timevar_push (TV_NAME_LOOKUP); - my_friendly_assert (TREE_CODE (scope) == NAMESPACE_DECL, 383); - my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 384); + gcc_assert (TREE_CODE (scope) == NAMESPACE_DECL); + gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE); for (decl = current_binding_level->usings; decl; decl = TREE_CHAIN (decl)) if (DECL_INITIAL (decl) == scope && DECL_NAME (decl) == name) break; @@ -2151,7 +2150,7 @@ validate_nonmember_using_decl (tree decl, tree scope, tree name) if (is_overloaded_fn (decl)) decl = get_first_fn (decl); - my_friendly_assert (DECL_P (decl), 20020908); + gcc_assert (DECL_P (decl)); /* Make a USING_DECL. */ return push_using_decl (scope, name); @@ -2517,12 +2516,11 @@ lookup_tag_reverse (tree type, tree name) bool is_ancestor (tree root, tree child) { - my_friendly_assert ((TREE_CODE (root) == NAMESPACE_DECL - || TREE_CODE (root) == FUNCTION_DECL - || CLASS_TYPE_P (root)), 20030307); - my_friendly_assert ((TREE_CODE (child) == NAMESPACE_DECL - || CLASS_TYPE_P (child)), - 20030307); + gcc_assert ((TREE_CODE (root) == NAMESPACE_DECL + || TREE_CODE (root) == FUNCTION_DECL + || CLASS_TYPE_P (root))); + gcc_assert ((TREE_CODE (child) == NAMESPACE_DECL + || CLASS_TYPE_P (child))); /* The global namespace encloses everything. */ if (root == global_namespace) @@ -2602,7 +2600,7 @@ poplevel_class (void) tree shadowed; timevar_push (TV_NAME_LOOKUP); - my_friendly_assert (level != 0, 354); + gcc_assert (level != 0); /* If we're leaving a toplevel class, cache its binding level. */ if (current_class_depth == 1) @@ -2648,7 +2646,7 @@ set_inherited_value_binding_p (cxx_binding *binding, tree decl, context = CP_DECL_CONTEXT (OVL_CURRENT (decl)); else { - my_friendly_assert (DECL_P (decl), 0); + gcc_assert (DECL_P (decl)); context = context_for_name_lookup (decl); } @@ -2786,7 +2784,7 @@ push_class_level_binding (tree name, tree x) POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, true); /* Check for invalid member names. */ - my_friendly_assert (TYPE_BEING_DEFINED (current_class_type), 20040713); + gcc_assert (TYPE_BEING_DEFINED (current_class_type)); /* We could have been passed a tree list if this is an ambiguous declaration. If so, pull the declaration out because check_template_shadow will not handle a TREE_LIST. */ @@ -2940,7 +2938,7 @@ do_class_using_decl (tree decl) name = DECL_NAME (get_first_fn (fns)); } - my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 980716); + gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE); /* Dependent using decls have a NULL type, non-dependent ones have a void type. */ @@ -3085,8 +3083,7 @@ push_namespace (tree name) /* We should not get here if the global_namespace is not yet constructed nor if NAME designates the global namespace: The global scope is constructed elsewhere. */ - my_friendly_assert (global_namespace != NULL && name != global_scope_name, - 20030531); + gcc_assert (global_namespace != NULL && name != global_scope_name); if (anon) { @@ -3147,7 +3144,7 @@ push_namespace (tree name) void pop_namespace (void) { - my_friendly_assert (current_namespace != global_namespace, 20010801); + gcc_assert (current_namespace != global_namespace); current_namespace = CP_DECL_CONTEXT (current_namespace); /* The binding level is not popped, as it might be re-opened later. */ leave_scope (); @@ -3301,8 +3298,8 @@ add_using_namespace (tree user, tree used, bool indirect) timevar_pop (TV_NAME_LOOKUP); return; } - my_friendly_assert (TREE_CODE (user) == NAMESPACE_DECL, 380); - my_friendly_assert (TREE_CODE (used) == NAMESPACE_DECL, 380); + gcc_assert (TREE_CODE (user) == NAMESPACE_DECL); + gcc_assert (TREE_CODE (used) == NAMESPACE_DECL); /* Check if we already have this. */ t = purpose_member (used, DECL_NAMESPACE_USING (user)); if (t != NULL_TREE) @@ -3523,7 +3520,7 @@ ambiguous_decl (tree name, struct scope_binding *old, cxx_binding *new, int flags) { tree val, type; - my_friendly_assert (old != NULL, 393); + gcc_assert (old != NULL); /* Copy the value. */ val = new->value; if (val) @@ -3646,7 +3643,7 @@ lookup_namespace_name (tree namespace, tree name) struct scope_binding binding = EMPTY_SCOPE_BINDING; timevar_push (TV_NAME_LOOKUP); - my_friendly_assert (TREE_CODE (namespace) == NAMESPACE_DECL, 370); + gcc_assert (TREE_CODE (namespace) == NAMESPACE_DECL); if (TREE_CODE (name) == NAMESPACE_DECL) /* This happens for A::B when B is a namespace. */ @@ -3671,7 +3668,7 @@ lookup_namespace_name (tree namespace, tree name) name = DECL_NAME (name); } - my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 373); + gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE); if (!qualified_lookup_using_namespace (name, namespace, &binding, 0)) POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node); @@ -4181,8 +4178,7 @@ lookup_type_current_level (tree name) tree t = NULL_TREE; timevar_push (TV_NAME_LOOKUP); - my_friendly_assert (current_binding_level->kind != sk_namespace, - 980716); + gcc_assert (current_binding_level->kind != sk_namespace); if (REAL_IDENTIFIER_TYPE_VALUE (name) != NULL_TREE && REAL_IDENTIFIER_TYPE_VALUE (name) != global_type_node) @@ -4668,9 +4664,7 @@ maybe_process_template_type_declaration (tree type, int globalize, { maybe_check_template_type (type); - my_friendly_assert (IS_AGGR_TYPE (type) - || TREE_CODE (type) == ENUMERAL_TYPE, 0); - + gcc_assert (IS_AGGR_TYPE (type) || TREE_CODE (type) == ENUMERAL_TYPE); if (processing_template_decl) { diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 999c528f638..9d5e18b723a 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -714,7 +714,7 @@ cp_lexer_peek_nth_token (cp_lexer* lexer, size_t n) cp_token *token; /* N is 1-based, not zero-based. */ - my_friendly_assert (n > 0, 20000224); + gcc_assert (n > 0); /* Skip ahead from NEXT_TOKEN, reading more tokens as necessary. */ token = lexer->next_token; @@ -2272,7 +2272,7 @@ cp_parser_parse_and_diagnose_invalid_type_name (cp_parser *parser) /* If we got here, this cannot be a valid variable declaration, thus the cp_parser_id_expression must have resolved to a plain identifier node (not a TYPE_DECL or TEMPLATE_ID_EXPR). */ - my_friendly_assert (TREE_CODE (id) == IDENTIFIER_NODE, 20030203); + gcc_assert (TREE_CODE (id) == IDENTIFIER_NODE); /* Emit a diagnostic for the invalid type. */ cp_parser_diagnose_invalid_type_name (parser, parser->scope, id); /* Skip to the end of the declaration; there's no point in @@ -2668,9 +2668,8 @@ cp_parser_translation_unit (cp_parser* parser) } /* Make sure the declarator obstack was fully cleaned up. */ - my_friendly_assert (obstack_next_free (&declarator_obstack) == - declarator_obstack_base, - 20040621); + gcc_assert (obstack_next_free (&declarator_obstack) + == declarator_obstack_base); /* All went well. */ return success; @@ -8529,10 +8528,9 @@ cp_parser_template_id (cp_parser *parser, { /* If it's not a class-template or a template-template, it should be a function-template. */ - my_friendly_assert ((DECL_FUNCTION_TEMPLATE_P (template) - || TREE_CODE (template) == OVERLOAD - || BASELINK_P (template)), - 20010716); + gcc_assert ((DECL_FUNCTION_TEMPLATE_P (template) + || TREE_CODE (template) == OVERLOAD + || BASELINK_P (template))); template_id = lookup_template_function (template, arguments); } @@ -14181,9 +14179,8 @@ cp_parser_lookup_name (cp_parser *parser, tree name, return name; if (BASELINK_P (name)) { - my_friendly_assert ((TREE_CODE (BASELINK_FUNCTIONS (name)) - == TEMPLATE_ID_EXPR), - 20020909); + gcc_assert (TREE_CODE (BASELINK_FUNCTIONS (name)) + == TEMPLATE_ID_EXPR); return name; } @@ -14213,8 +14210,7 @@ cp_parser_lookup_name (cp_parser *parser, tree name, /* By this point, the NAME should be an ordinary identifier. If the id-expression was a qualified name, the qualifying scope is stored in PARSER->SCOPE at this point. */ - my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, - 20000619); + gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE); /* Perform the lookup. */ if (parser->scope) @@ -14326,12 +14322,11 @@ cp_parser_lookup_name (cp_parser *parser, tree name, return error_mark_node; } - my_friendly_assert (DECL_P (decl) - || TREE_CODE (decl) == OVERLOAD - || TREE_CODE (decl) == SCOPE_REF - || TREE_CODE (decl) == UNBOUND_CLASS_TEMPLATE - || BASELINK_P (decl), - 20000619); + gcc_assert (DECL_P (decl) + || TREE_CODE (decl) == OVERLOAD + || TREE_CODE (decl) == SCOPE_REF + || TREE_CODE (decl) == UNBOUND_CLASS_TEMPLATE + || BASELINK_P (decl)); /* If we have resolved the name of a member declaration, check to see if the declaration is accessible. When the name resolves to @@ -15223,7 +15218,7 @@ cp_parser_late_parsing_for_member (cp_parser* parser, tree member_function) /* There should not be any class definitions in progress at this point; the bodies of members are only parsed outside of all class definitions. */ - my_friendly_assert (parser->num_classes_being_defined == 0, 20010816); + gcc_assert (parser->num_classes_being_defined == 0); /* While we're parsing the member functions we might encounter more classes. We want to handle them right away, but we don't want them getting mixed up with functions that are currently in the diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index b93599eaf50..c198118a855 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -176,9 +176,8 @@ static tree tsubst_copy (tree, tree, tsubst_flags_t, tree); static void push_access_scope (tree t) { - my_friendly_assert (TREE_CODE (t) == FUNCTION_DECL - || TREE_CODE (t) == VAR_DECL, - 0); + gcc_assert (TREE_CODE (t) == FUNCTION_DECL + || TREE_CODE (t) == VAR_DECL); if (DECL_CLASS_SCOPE_P (t)) push_nested_class (DECL_CONTEXT (t)); @@ -222,7 +221,7 @@ finish_member_template_decl (tree decl) if (decl == error_mark_node) return error_mark_node; - my_friendly_assert (DECL_P (decl), 20020812); + gcc_assert (DECL_P (decl)); if (TREE_CODE (decl) == TYPE_DECL) { @@ -357,7 +356,7 @@ push_inline_template_parms_recursive (tree parmlist, int levels) for (i = 0; i < TREE_VEC_LENGTH (parms); ++i) { tree parm = TREE_VALUE (TREE_VEC_ELT (parms, i)); - my_friendly_assert (DECL_P (parm), 0); + gcc_assert (DECL_P (parm)); switch (TREE_CODE (parm)) { @@ -542,8 +541,7 @@ add_outermost_template_args (tree args, tree extra_args) /* If there are more levels of EXTRA_ARGS than there are ARGS, something very fishy is going on. */ - my_friendly_assert (TMPL_ARGS_DEPTH (args) >= TMPL_ARGS_DEPTH (extra_args), - 0); + gcc_assert (TMPL_ARGS_DEPTH (args) >= TMPL_ARGS_DEPTH (extra_args)); /* If *all* the new arguments will be the EXTRA_ARGS, just return them. */ @@ -570,7 +568,7 @@ get_innermost_template_args (tree args, int n) int extra_levels; int i; - my_friendly_assert (n >= 0, 20000603); + gcc_assert (n >= 0); /* If N is 1, just return the innermost set of template arguments. */ if (n == 1) @@ -579,7 +577,7 @@ get_innermost_template_args (tree args, int n) /* If we're not removing anything, just return the arguments we were given. */ extra_levels = TMPL_ARGS_DEPTH (args) - n; - my_friendly_assert (extra_levels >= 0, 20000603); + gcc_assert (extra_levels >= 0); if (extra_levels == 0) return args; @@ -696,7 +694,7 @@ note_template_header (int specialization) void begin_explicit_instantiation (void) { - my_friendly_assert (!processing_explicit_instantiation, 20020913); + gcc_assert (!processing_explicit_instantiation); processing_explicit_instantiation = true; } @@ -704,7 +702,7 @@ begin_explicit_instantiation (void) void end_explicit_instantiation (void) { - my_friendly_assert(processing_explicit_instantiation, 20020913); + gcc_assert (processing_explicit_instantiation); processing_explicit_instantiation = false; } @@ -843,13 +841,12 @@ retrieve_specialization (tree tmpl, tree args) { tree s; - my_friendly_assert (TREE_CODE (tmpl) == TEMPLATE_DECL, 0); + gcc_assert (TREE_CODE (tmpl) == TEMPLATE_DECL); /* There should be as many levels of arguments as there are levels of parameters. */ - my_friendly_assert (TMPL_ARGS_DEPTH (args) - == TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (tmpl)), - 0); + gcc_assert (TMPL_ARGS_DEPTH (args) + == TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (tmpl))); for (s = DECL_TEMPLATE_SPECIALIZATIONS (tmpl); s != NULL_TREE; @@ -887,7 +884,7 @@ is_specialization_of (tree decl, tree tmpl) } else { - my_friendly_assert (TREE_CODE (decl) == TYPE_DECL, 0); + gcc_assert (TREE_CODE (decl) == TYPE_DECL); for (t = TREE_TYPE (decl); t != NULL_TREE; @@ -909,7 +906,7 @@ is_specialization_of_friend (tree decl, tree friend) bool need_template = true; int template_depth; - my_friendly_assert (TREE_CODE (decl) == FUNCTION_DECL, 0); + gcc_assert (TREE_CODE (decl) == FUNCTION_DECL); /* For [temp.friend/6] when FRIEND is an ordinary member function of a template class, we want to check if DECL is a specialization @@ -1043,7 +1040,7 @@ register_specialization (tree spec, tree tmpl, tree args) { tree s; - my_friendly_assert (TREE_CODE (tmpl) == TEMPLATE_DECL, 0); + gcc_assert (TREE_CODE (tmpl) == TEMPLATE_DECL); if (TREE_CODE (spec) == FUNCTION_DECL && uses_template_parms (DECL_TI_ARGS (spec))) @@ -1062,9 +1059,8 @@ register_specialization (tree spec, tree tmpl, tree args) /* There should be as many levels of arguments as there are levels of parameters. */ - my_friendly_assert (TMPL_ARGS_DEPTH (args) - == TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (tmpl)), - 0); + gcc_assert (TMPL_ARGS_DEPTH (args) + == TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (tmpl))); for (s = DECL_TEMPLATE_SPECIALIZATIONS (tmpl); s != NULL_TREE; @@ -1790,14 +1786,14 @@ check_explicit_specialization (tree declarator, { tree fns; - my_friendly_assert (TREE_CODE (declarator) == IDENTIFIER_NODE, 0); + gcc_assert (TREE_CODE (declarator) == IDENTIFIER_NODE); if (ctype) fns = dname; else { /* If there is no class context, the explicit instantiation must be at namespace scope. */ - my_friendly_assert (DECL_NAMESPACE_SCOPE_P (decl), 20030625); + gcc_assert (DECL_NAMESPACE_SCOPE_P (decl)); /* Find the namespace binding, using the declaration context. */ @@ -2064,7 +2060,8 @@ maybe_check_template_type (tree type) parameters. These are represented in the same format used for DECL_TEMPLATE_PARMS. */ -int comp_template_parms (tree parms1, tree parms2) +int +comp_template_parms (tree parms1, tree parms2) { tree p1; tree p2; @@ -2080,8 +2077,8 @@ int comp_template_parms (tree parms1, tree parms2) tree t2 = TREE_VALUE (p2); int i; - my_friendly_assert (TREE_CODE (t1) == TREE_VEC, 0); - my_friendly_assert (TREE_CODE (t2) == TREE_VEC, 0); + gcc_assert (TREE_CODE (t1) == TREE_VEC); + gcc_assert (TREE_CODE (t2) == TREE_VEC); if (TREE_VEC_LENGTH (t1) != TREE_VEC_LENGTH (t2)) return 0; @@ -2224,7 +2221,7 @@ process_template_parm (tree list, tree next, bool is_non_type) int idx; parm = next; - my_friendly_assert (TREE_CODE (parm) == TREE_LIST, 259); + gcc_assert (TREE_CODE (parm) == TREE_LIST); defval = TREE_PURPOSE (parm); if (list) @@ -2576,7 +2573,7 @@ process_partial_specialization (tree decl) The type of a template parameter corresponding to a specialized non-type argument shall not be dependent on a parameter of the specialization. */ - my_friendly_assert (nargs == DECL_NTPARMS (maintmpl), 0); + gcc_assert (nargs == DECL_NTPARMS (maintmpl)); tpd2.parms = 0; for (i = 0; i < nargs; ++i) { @@ -3468,8 +3465,7 @@ convert_nontype_argument (tree type, tree expr) expr = build_unary_op (ADDR_EXPR, fn, 0); - my_friendly_assert (same_type_p (type, TREE_TYPE (expr)), - 0); + gcc_assert (same_type_p (type, TREE_TYPE (expr))); return expr; } else @@ -3507,7 +3503,7 @@ convert_nontype_argument (tree type, tree expr) if (TREE_CODE (expr) == NOP_EXPR && TREE_CODE (TREE_OPERAND (expr, 0)) == ADDR_EXPR) STRIP_NOPS (expr); - my_friendly_assert (TREE_CODE (expr) == ADDR_EXPR, 20000604); + gcc_assert (TREE_CODE (expr) == ADDR_EXPR); expr = TREE_OPERAND (expr, 0); expr_type = TREE_TYPE (expr); } @@ -3537,10 +3533,7 @@ convert_nontype_argument (tree type, tree expr) goto bad_argument; } - my_friendly_assert (same_type_p (type_referred_to, - TREE_TYPE (fn)), - 0); - + gcc_assert (same_type_p (type_referred_to, TREE_TYPE (fn))); expr = fn; } else @@ -3566,7 +3559,7 @@ convert_nontype_argument (tree type, tree expr) case RECORD_TYPE: { - my_friendly_assert (TYPE_PTRMEMFUNC_P (type), 20010112); + gcc_assert (TYPE_PTRMEMFUNC_P (type)); /* For a non-type template-parameter of type pointer to member function, no conversions apply. If the template-argument @@ -3638,8 +3631,8 @@ coerce_template_template_parms (tree parm_parms, int nparms, nargs, i; tree parm, arg; - my_friendly_assert (TREE_CODE (parm_parms) == TREE_VEC, 0); - my_friendly_assert (TREE_CODE (arg_parms) == TREE_VEC, 0); + gcc_assert (TREE_CODE (parm_parms) == TREE_VEC); + gcc_assert (TREE_CODE (arg_parms) == TREE_VEC); nparms = TREE_VEC_LENGTH (parm_parms); nargs = TREE_VEC_LENGTH (arg_parms); @@ -3932,7 +3925,7 @@ coerce_template_parms (tree parms, else break; - my_friendly_assert (arg, 20030727); + gcc_assert (arg); if (arg == error_mark_node) error ("template argument %d is invalid", i + 1); else @@ -4015,7 +4008,7 @@ mangle_class_name_for_template (const char* name, tree parms, tree arglist) ccat ('<'); nparms = TREE_VEC_LENGTH (parms); arglist = INNERMOST_TEMPLATE_ARGS (arglist); - my_friendly_assert (nparms == TREE_VEC_LENGTH (arglist), 268); + gcc_assert (nparms == TREE_VEC_LENGTH (arglist)); for (i = 0; i < nparms; i++) { tree parm = TREE_VALUE (TREE_VEC_ELT (parms, i)); @@ -4040,11 +4033,11 @@ mangle_class_name_for_template (const char* name, tree parms, tree arglist) { /* The template may be defined in a namespace, or may be a member template. */ - my_friendly_assert (TREE_CODE (context) == NAMESPACE_DECL - || CLASS_TYPE_P (context), - 980422); - cat(decl_as_string (DECL_CONTEXT (arg), TFF_PLAIN_IDENTIFIER)); - cat("::"); + gcc_assert (TREE_CODE (context) == NAMESPACE_DECL + || CLASS_TYPE_P (context)); + cat (decl_as_string (DECL_CONTEXT (arg), + TFF_PLAIN_IDENTIFIER)); + cat ("::"); } cat (IDENTIFIER_POINTER (DECL_NAME (arg))); } @@ -4054,7 +4047,7 @@ mangle_class_name_for_template (const char* name, tree parms, tree arglist) continue; } else - my_friendly_assert (TREE_CODE (parm) == PARM_DECL, 269); + gcc_assert (TREE_CODE (parm) == PARM_DECL); /* No need to check arglist against parmlist here; we did that in coerce_template_parms, called from lookup_template_class. */ @@ -4151,7 +4144,7 @@ lookup_template_function (tree fns, tree arglist) if (fns == error_mark_node || arglist == error_mark_node) return error_mark_node; - my_friendly_assert (!arglist || TREE_CODE (arglist) == TREE_VEC, 20030726); + gcc_assert (!arglist || TREE_CODE (arglist) == TREE_VEC); if (fns == NULL_TREE || TREE_CODE (fns) == FUNCTION_DECL) { @@ -4159,11 +4152,10 @@ lookup_template_function (tree fns, tree arglist) return error_mark_node; } - my_friendly_assert (TREE_CODE (fns) == TEMPLATE_DECL - || TREE_CODE (fns) == OVERLOAD - || BASELINK_P (fns) - || TREE_CODE (fns) == IDENTIFIER_NODE, - 20020730); + gcc_assert (TREE_CODE (fns) == TEMPLATE_DECL + || TREE_CODE (fns) == OVERLOAD + || BASELINK_P (fns) + || TREE_CODE (fns) == IDENTIFIER_NODE); if (BASELINK_P (fns)) { @@ -4376,7 +4368,7 @@ lookup_template_class (tree d1, } /* Now we should have enough arguments. */ - my_friendly_assert (parm_depth == arg_depth, 0); + gcc_assert (parm_depth == arg_depth); /* From here on, we're only interested in the most general template. */ @@ -5368,7 +5360,7 @@ instantiate_class_template (tree type) /* Figure out which template is being instantiated. */ template = most_general_template (CLASSTYPE_TI_TEMPLATE (type)); - my_friendly_assert (TREE_CODE (template) == TEMPLATE_DECL, 279); + gcc_assert (TREE_CODE (template) == TEMPLATE_DECL); /* Figure out which arguments are being used to do the instantiation. */ @@ -6078,7 +6070,7 @@ tsubst_decl (tree t, tree args, tree type, tsubst_flags_t complain) /* tsubst_template_args doesn't copy the vector if nothing changed. But, *something* should have changed. */ - my_friendly_assert (full_args != tmpl_args, 0); + gcc_assert (full_args != tmpl_args); spec = retrieve_specialization (t, full_args); if (spec != NULL_TREE) @@ -6094,7 +6086,7 @@ tsubst_decl (tree t, tree args, tree type, tsubst_flags_t complain) like the old one, but points to this new template, rather than the old one. */ r = copy_decl (t); - my_friendly_assert (DECL_LANG_SPECIFIC (r) != 0, 0); + gcc_assert (DECL_LANG_SPECIFIC (r) != 0); TREE_CHAIN (r) = NULL_TREE; if (is_template_template_parm) @@ -6166,7 +6158,7 @@ tsubst_decl (tree t, tree args, tree type, tsubst_flags_t complain) int parms_depth; /* Nobody should be tsubst'ing into non-template functions. */ - my_friendly_assert (DECL_TEMPLATE_INFO (t) != NULL_TREE, 0); + gcc_assert (DECL_TEMPLATE_INFO (t) != NULL_TREE); if (TREE_CODE (DECL_TI_TEMPLATE (t)) == TEMPLATE_DECL) { @@ -6625,7 +6617,7 @@ tsubst_function_type (tree t, tree fntype; /* The TYPE_CONTEXT is not used for function/method types. */ - my_friendly_assert (TYPE_CONTEXT (t) == NULL_TREE, 0); + gcc_assert (TYPE_CONTEXT (t) == NULL_TREE); /* Substitute the return type. */ return_type = tsubst (TREE_TYPE (t), args, complain, in_decl); @@ -6735,7 +6727,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) else type = TREE_TYPE (t); - my_friendly_assert (type != unknown_type_node, 20030716); + gcc_assert (type != unknown_type_node); if (type && TREE_CODE (t) != FUNCTION_DECL && TREE_CODE (t) != TYPENAME_TYPE @@ -6851,7 +6843,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) { if (TREE_CODE (t) == TEMPLATE_TYPE_PARM) { - my_friendly_assert (TYPE_P (arg), 0); + gcc_assert (TYPE_P (arg)); return cp_build_qualified_type_real (arg, cp_type_quals (arg) | cp_type_quals (t), complain | tf_ignore_bad_quals); @@ -6987,7 +6979,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) case TREE_VEC: /* A vector of template arguments. */ - my_friendly_assert (!type, 20040628); + gcc_assert (!type); return tsubst_template_args (t, args, complain, in_decl); case POINTER_TYPE: @@ -7075,7 +7067,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) return error_mark_node; } - my_friendly_assert (TREE_CODE (type) != METHOD_TYPE, 20011231); + gcc_assert (TREE_CODE (type) != METHOD_TYPE); if (TREE_CODE (type) == FUNCTION_TYPE) { /* This is really a method type. The cv qualifiers of the @@ -7364,7 +7356,7 @@ tsubst_qualified_id (tree qualified_id, tree args, bool is_template; tree template_args; - my_friendly_assert (TREE_CODE (qualified_id) == SCOPE_REF, 20030706); + gcc_assert (TREE_CODE (qualified_id) == SCOPE_REF); /* Figure out what name to look up. */ name = TREE_OPERAND (qualified_id, 1); @@ -7467,7 +7459,7 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) { case PARM_DECL: r = retrieve_local_specialization (t); - my_friendly_assert (r != NULL, 20020903); + gcc_assert (r != NULL); mark_used (r); return r; @@ -8719,7 +8711,7 @@ instantiate_template (tree tmpl, tree targ_ptr, tsubst_flags_t complain) if (tmpl == error_mark_node) return error_mark_node; - my_friendly_assert (TREE_CODE (tmpl) == TEMPLATE_DECL, 283); + gcc_assert (TREE_CODE (tmpl) == TEMPLATE_DECL); /* If this function is a clone, handle it specially. */ if (DECL_CLONED_FUNCTION_P (tmpl)) @@ -8851,7 +8843,7 @@ fn_type_unification (tree fn, tree fntype; int result; - my_friendly_assert (TREE_CODE (fn) == TEMPLATE_DECL, 0); + gcc_assert (TREE_CODE (fn) == TEMPLATE_DECL); fntype = TREE_TYPE (fn); if (explicit_targs) @@ -9073,11 +9065,10 @@ type_unification_real (tree tparms, tree parms, args; int len; - my_friendly_assert (TREE_CODE (tparms) == TREE_VEC, 289); - my_friendly_assert (xparms == NULL_TREE - || TREE_CODE (xparms) == TREE_LIST, 290); - my_friendly_assert (!xargs || TREE_CODE (xargs) == TREE_LIST, 291); - my_friendly_assert (ntparms > 0, 292); + gcc_assert (TREE_CODE (tparms) == TREE_VEC); + gcc_assert (xparms == NULL_TREE || TREE_CODE (xparms) == TREE_LIST); + gcc_assert (!xargs || TREE_CODE (xargs) == TREE_LIST); + gcc_assert (ntparms > 0); switch (strict) { @@ -9156,7 +9147,7 @@ type_unification_real (tree tparms, if (!TYPE_P (arg)) { - my_friendly_assert (TREE_TYPE (arg) != NULL_TREE, 293); + gcc_assert (TREE_TYPE (arg) != NULL_TREE); if (type_unknown_p (arg)) { /* [temp.deduct.type] A template-argument can be deduced from @@ -9563,7 +9554,7 @@ get_template_base (tree tparms, tree targs, tree parm, tree arg) tree rval; tree arg_binfo; - my_friendly_assert (IS_AGGR_TYPE_CODE (TREE_CODE (arg)), 92); + gcc_assert (IS_AGGR_TYPE_CODE (TREE_CODE (arg))); arg_binfo = TYPE_BINFO (complete_type (arg)); if (!arg_binfo) @@ -10899,7 +10890,7 @@ regenerate_decl_from_template (tree decl, tree tmpl) /* If the DECL was not unregistered then something peculiar is happening: we created a specialization but did not call register_specialization for it. */ - my_friendly_assert (unregistered, 0); + gcc_assert (unregistered); /* Make sure that we can see identifiers, and compute access correctly. */ @@ -10994,9 +10985,8 @@ template_for_substitution (tree decl) cannot restructure the loop to just keep going until we find a template with a definition, since that might go too far if a specialization was declared, but not defined. */ - my_friendly_assert (!(TREE_CODE (decl) == VAR_DECL - && !DECL_IN_AGGR_P (DECL_TEMPLATE_RESULT (tmpl))), - 0); + gcc_assert (TREE_CODE (decl) != VAR_DECL + || DECL_IN_AGGR_P (DECL_TEMPLATE_RESULT (tmpl))); /* Fetch the more general template. */ tmpl = DECL_TI_TEMPLATE (tmpl); @@ -11031,8 +11021,8 @@ instantiate_decl (tree d, int defer_ok, int undefined_ok) /* This function should only be used to instantiate templates for functions and static member variables. */ - my_friendly_assert (TREE_CODE (d) == FUNCTION_DECL - || TREE_CODE (d) == VAR_DECL, 0); + gcc_assert (TREE_CODE (d) == FUNCTION_DECL + || TREE_CODE (d) == VAR_DECL); /* Variables are never deferred; if instantiation is required, they are instantiated right away. That allows for better code in the @@ -11140,10 +11130,9 @@ instantiate_decl (tree d, int defer_ok, int undefined_ok) /* We should have set up DECL_INITIAL in instantiate_class_template for in-class definitions of static data members. */ - my_friendly_assert (!(TREE_CODE (d) == VAR_DECL - && DECL_INITIALIZED_IN_CLASS_P (d) - && DECL_INITIAL (d) == NULL_TREE), - 20040726); + gcc_assert (!(TREE_CODE (d) == VAR_DECL + && DECL_INITIALIZED_IN_CLASS_P (d) + && DECL_INITIAL (d) == NULL_TREE)); /* Do not instantiate templates that we know will be defined elsewhere. */ @@ -11265,7 +11254,7 @@ instantiate_decl (tree d, int defer_ok, int undefined_ok) tmpl_parm = TREE_CHAIN (tmpl_parm); spec_parm = TREE_CHAIN (spec_parm); } - my_friendly_assert (!spec_parm, 20020813); + gcc_assert (!spec_parm); /* Substitute into the body of the function. */ tsubst_expr (DECL_SAVED_TREE (code_pattern), args, @@ -11504,7 +11493,7 @@ get_mostly_instantiated_function_type (tree decl) /* There should be as many levels of arguments as there are levels of parameters. */ - my_friendly_assert (parm_depth == TMPL_ARGS_DEPTH (targs), 0); + gcc_assert (parm_depth == TMPL_ARGS_DEPTH (targs)); fn_type = TREE_TYPE (tmpl); @@ -11736,7 +11725,7 @@ dependent_scope_ref_p (tree expression, bool criterion (tree)) tree scope; tree name; - my_friendly_assert (TREE_CODE (expression) == SCOPE_REF, 20030714); + gcc_assert (TREE_CODE (expression) == SCOPE_REF); if (!TYPE_P (TREE_OPERAND (expression, 0))) return true; @@ -11807,8 +11796,7 @@ value_dependent_expression_p (tree expression) /* If there are no operands, it must be an expression such as "int()". This should not happen for aggregate types because it would form non-constant expressions. */ - my_friendly_assert (INTEGRAL_OR_ENUMERATION_TYPE_P (type), - 20040318); + gcc_assert (INTEGRAL_OR_ENUMERATION_TYPE_P (type)); return false; } @@ -12101,8 +12089,7 @@ resolve_typename_type (tree type, bool only_current_p) int quals; bool pop_p; - my_friendly_assert (TREE_CODE (type) == TYPENAME_TYPE, - 20010702); + gcc_assert (TREE_CODE (type) == TYPENAME_TYPE); scope = TYPE_CONTEXT (type); name = TYPE_IDENTIFIER (type); diff --git a/gcc/cp/repo.c b/gcc/cp/repo.c index 8d2774015e1..8688771b71c 100644 --- a/gcc/cp/repo.c +++ b/gcc/cp/repo.c @@ -264,11 +264,10 @@ finish_repo (void) int repo_emit_p (tree decl) { - my_friendly_assert (TREE_PUBLIC (decl), 20040725); - my_friendly_assert (TREE_CODE (decl) == FUNCTION_DECL - || TREE_CODE (decl) == VAR_DECL, - 20040725); - my_friendly_assert (!DECL_REALLY_EXTERN (decl), 20040725); + gcc_assert (TREE_PUBLIC (decl)); + gcc_assert (TREE_CODE (decl) == FUNCTION_DECL + || TREE_CODE (decl) == VAR_DECL); + gcc_assert (!DECL_REALLY_EXTERN (decl)); /* When not using the repository, emit everything. */ if (!flag_use_repository) diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 1bc3952b3d7..4219d301260 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -140,7 +140,7 @@ build_headof (tree exp) tree offset; tree index; - my_friendly_assert (TREE_CODE (type) == POINTER_TYPE, 20000112); + gcc_assert (TREE_CODE (type) == POINTER_TYPE); type = TREE_TYPE (type); if (!TYPE_POLYMORPHIC_P (type)) @@ -364,7 +364,7 @@ get_tinfo_decl (tree type) pushdecl_top_level_and_finish (d, NULL_TREE); /* Add decl to the global array of tinfo decls. */ - my_friendly_assert (unemitted_tinfo_decls != 0, 20030312); + gcc_assert (unemitted_tinfo_decls != 0); VARRAY_PUSH_TREE (unemitted_tinfo_decls, d); } @@ -1026,7 +1026,7 @@ typeinfo_in_lib_p (tree type) static tree get_pseudo_ti_init (tree type, tree var_desc) { - my_friendly_assert (at_eof, 20021120); + gcc_assert (at_eof); switch (TREE_CODE (type)) { case OFFSET_TYPE: @@ -1274,7 +1274,7 @@ get_pseudo_ti_desc (tree type) static void create_tinfo_types (void) { - my_friendly_assert (!ti_desc_type_node, 20020609); + gcc_assert (!ti_desc_type_node); push_nested_namespace (abi_node); @@ -1436,7 +1436,7 @@ emit_tinfo_decl (tree decl) int in_library = typeinfo_in_lib_p (type); tree var_desc, var_init; - my_friendly_assert (DECL_TINFO_P (decl), 20030307); + gcc_assert (DECL_TINFO_P (decl)); if (in_library) { diff --git a/gcc/cp/search.c b/gcc/cp/search.c index c0342ad75de..2c5ec6b6808 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -148,7 +148,7 @@ lookup_base_r (tree binfo, tree base, base_access access, bk = bk_proper_base; /* Fall through. */ case bk_proper_base: - my_friendly_assert (found == bk_not_base, 20010723); + gcc_assert (found == bk_not_base); found = bk; break; @@ -217,7 +217,7 @@ lookup_base (tree t, tree base, base_access access, base_kind *kind_ptr) *kind_ptr = bk_not_base; return error_mark_node; } - my_friendly_assert (TYPE_P (base), 20011127); + gcc_assert (TYPE_P (base)); if (!TYPE_P (t)) { @@ -436,7 +436,7 @@ lookup_field_1 (tree type, tree name, bool want_type) #ifdef GATHER_STATISTICS n_fields_searched++; #endif /* GATHER_STATISTICS */ - my_friendly_assert (DECL_P (field), 0); + gcc_assert (DECL_P (field)); if (DECL_NAME (field) == NULL_TREE && ANON_AGGR_TYPE_P (TREE_TYPE (field))) { @@ -618,7 +618,7 @@ dfs_access_in_type (tree binfo, void *data) else if (decl_access == access_private_node) access = ak_private; else - my_friendly_assert (false, 20030217); + gcc_unreachable (); } } @@ -1182,13 +1182,12 @@ build_baselink (tree binfo, tree access_binfo, tree functions, tree optype) { tree baselink; - my_friendly_assert (TREE_CODE (functions) == FUNCTION_DECL - || TREE_CODE (functions) == TEMPLATE_DECL - || TREE_CODE (functions) == TEMPLATE_ID_EXPR - || TREE_CODE (functions) == OVERLOAD, - 20020730); - my_friendly_assert (!optype || TYPE_P (optype), 20020730); - my_friendly_assert (TREE_TYPE (functions), 20020805); + gcc_assert (TREE_CODE (functions) == FUNCTION_DECL + || TREE_CODE (functions) == TEMPLATE_DECL + || TREE_CODE (functions) == TEMPLATE_ID_EXPR + || TREE_CODE (functions) == OVERLOAD); + gcc_assert (!optype || TYPE_P (optype)); + gcc_assert (TREE_TYPE (functions)); baselink = make_node (BASELINK); TREE_TYPE (baselink) = TREE_TYPE (functions); @@ -1228,7 +1227,7 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type) const char *errstr = 0; - my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 20030624); + gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE); if (TREE_CODE (xbasetype) == TREE_BINFO) { @@ -1237,7 +1236,7 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type) } else { - my_friendly_assert (IS_AGGR_TYPE_CODE (TREE_CODE (xbasetype)), 20030624); + gcc_assert (IS_AGGR_TYPE_CODE (TREE_CODE (xbasetype))); type = xbasetype; xbasetype = NULL_TREE; } @@ -1491,7 +1490,7 @@ adjust_result_of_qualified_name_lookup (tree decl, { tree base; - my_friendly_assert (CLASS_TYPE_P (context_class), 20020808); + gcc_assert (CLASS_TYPE_P (context_class)); /* Look for the QUALIFYING_SCOPE as a base of the CONTEXT_CLASS. Because we do not yet know which function will be chosen by @@ -2505,11 +2504,11 @@ copied_binfo (tree binfo, tree here) } else { - my_friendly_assert (BINFO_TYPE (here) == BINFO_TYPE (binfo), 20030202); + gcc_assert (BINFO_TYPE (here) == BINFO_TYPE (binfo)); result = here; } - my_friendly_assert (result, 20030202); + gcc_assert (result); return result; } diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index b221cd20b1c..a6aea7be3c5 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -307,7 +307,7 @@ perform_or_defer_access_check (tree binfo, tree decl) if (deferred_access_no_check) return; - my_friendly_assert (TREE_CODE (binfo) == TREE_BINFO, 20030623); + gcc_assert (TREE_CODE (binfo) == TREE_BINFO); ptr = VEC_last (deferred_access, deferred_access_stack); @@ -1249,7 +1249,7 @@ finish_parenthesized_expr (tree expr) tree finish_non_static_data_member (tree decl, tree object, tree qualifying_scope) { - my_friendly_assert (TREE_CODE (decl) == FIELD_DECL, 20020909); + gcc_assert (TREE_CODE (decl) == FIELD_DECL); if (!object) { @@ -1497,7 +1497,7 @@ finish_stmt_expr_expr (tree expr, tree stmt_expr) build_tree_list (NULL_TREE, expr), type, LOOKUP_NORMAL); expr = build_cplus_new (type, expr); - my_friendly_assert (TREE_CODE (expr) == TARGET_EXPR, 20030729); + gcc_assert (TREE_CODE (expr) == TARGET_EXPR); } } @@ -1582,7 +1582,7 @@ finish_stmt_expr (tree stmt_expr, bool has_no_scope) the statement expression itself as the target's init expr. Finally, return the target expression. */ tree init, target_expr = EXPR_STMT_EXPR (result_stmt); - my_friendly_assert (TREE_CODE (target_expr) == TARGET_EXPR, 20030729); + gcc_assert (TREE_CODE (target_expr) == TARGET_EXPR); /* The initializer will be void if the initialization is done by AGGR_INIT_EXPR; propagate that out to the statement-expression as @@ -1682,8 +1682,7 @@ finish_call_expr (tree fn, tree args, bool disallow_virtual, bool koenig_p) return error_mark_node; /* ARGS should be a list of arguments. */ - my_friendly_assert (!args || TREE_CODE (args) == TREE_LIST, - 20020712); + gcc_assert (!args || TREE_CODE (args) == TREE_LIST); orig_fn = fn; orig_args = args; @@ -1858,7 +1857,7 @@ finish_pseudo_destructor_expr (tree object, tree scope, tree destructor) if (destructor == error_mark_node) return error_mark_node; - my_friendly_assert (TYPE_P (destructor), 20010905); + gcc_assert (TYPE_P (destructor)); if (!processing_template_decl) { @@ -1998,7 +1997,7 @@ finish_template_template_parm (tree aggr, tree identifier) DECL_ARTIFICIAL (decl) = 1; end_template_decl (); - my_friendly_assert (DECL_TEMPLATE_PARMS (tmpl), 20010110); + gcc_assert (DECL_TEMPLATE_PARMS (tmpl)); return finish_template_type_parm (aggr, tmpl); } @@ -2128,7 +2127,7 @@ finish_member_declaration (tree decl) return; /* We should see only one DECL at a time. */ - my_friendly_assert (TREE_CHAIN (decl) == NULL_TREE, 0); + gcc_assert (TREE_CHAIN (decl) == NULL_TREE); /* Set up access control for DECL. */ TREE_PRIVATE (decl) @@ -2856,7 +2855,7 @@ emit_associated_thunks (tree fn) } } else - my_friendly_assert (!DECL_THUNKS (thunk), 20031023); + gcc_assert (!DECL_THUNKS (thunk)); } } } diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 017693b4da2..4bdadad690d 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -319,7 +319,7 @@ build_target_expr_with_type (tree init, tree type) { tree slot; - my_friendly_assert (!VOID_TYPE_P (type), 20040130); + gcc_assert (!VOID_TYPE_P (type)); if (TREE_CODE (init) == TARGET_EXPR) return init; @@ -347,7 +347,7 @@ force_target_expr (tree type, tree init) { tree slot; - my_friendly_assert (!VOID_TYPE_P (type), 20040130); + gcc_assert (!VOID_TYPE_P (type)); slot = build_local_temp (type); return build_target_expr (slot, init); @@ -606,8 +606,8 @@ copy_binfo (tree binfo, tree type, tree t, tree *igo_prev, int virt) int ix; tree base_binfo; - my_friendly_assert (!BINFO_DEPENDENT_BASE_P (binfo), 20040712); - my_friendly_assert (type == BINFO_TYPE (binfo), 20040714); + gcc_assert (!BINFO_DEPENDENT_BASE_P (binfo)); + gcc_assert (type == BINFO_TYPE (binfo)); BINFO_OFFSET (new_binfo) = BINFO_OFFSET (binfo); BINFO_VIRTUALS (new_binfo) = BINFO_VIRTUALS (binfo); @@ -620,7 +620,7 @@ copy_binfo (tree binfo, tree type, tree t, tree *igo_prev, int virt) { tree new_base_binfo; - my_friendly_assert (!BINFO_DEPENDENT_BASE_P (base_binfo), 20040713); + gcc_assert (!BINFO_DEPENDENT_BASE_P (base_binfo)); new_base_binfo = copy_binfo (base_binfo, BINFO_TYPE (base_binfo), t, igo_prev, BINFO_VIRTUAL_P (base_binfo)); @@ -840,7 +840,7 @@ really_overloaded_fn (tree x) tree get_first_fn (tree from) { - my_friendly_assert (is_overloaded_fn (from), 9); + gcc_assert (is_overloaded_fn (from)); /* A baselink is also considered an overloaded function. */ if (BASELINK_P (from)) from = BASELINK_FUNCTIONS (from); @@ -1584,7 +1584,7 @@ cp_tree_equal (tree t1, tree t2) return same_type_p (t1, t2); } - my_friendly_assert (0, 20030617); + gcc_unreachable (); return false; } diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 01b969edb97..b204860d13b 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -262,14 +262,12 @@ type_after_usual_arithmetic_conversions (tree t1, tree t2) tree attributes; /* FIXME: Attributes. */ - my_friendly_assert (ARITHMETIC_TYPE_P (t1) - || TREE_CODE (t1) == COMPLEX_TYPE - || TREE_CODE (t1) == ENUMERAL_TYPE, - 19990725); - my_friendly_assert (ARITHMETIC_TYPE_P (t2) - || TREE_CODE (t2) == COMPLEX_TYPE - || TREE_CODE (t2) == ENUMERAL_TYPE, - 19990725); + gcc_assert (ARITHMETIC_TYPE_P (t1) + || TREE_CODE (t1) == COMPLEX_TYPE + || TREE_CODE (t1) == ENUMERAL_TYPE); + gcc_assert (ARITHMETIC_TYPE_P (t2) + || TREE_CODE (t2) == COMPLEX_TYPE + || TREE_CODE (t2) == ENUMERAL_TYPE); /* In what follows, we slightly generalize the rules given in [expr] so as to deal with `long long' and `complex'. First, merge the @@ -928,7 +926,7 @@ comptypes (tree t1, tree t2, int strict) if (t1 == error_mark_node || t2 == error_mark_node) return false; - my_friendly_assert (TYPE_P (t1) && TYPE_P (t2), 20030623); + gcc_assert (TYPE_P (t1) && TYPE_P (t2)); /* TYPENAME_TYPEs should be resolved if the qualifying scope is the current instantiation. */ @@ -1218,7 +1216,7 @@ cxx_sizeof_or_alignof_type (tree type, enum tree_code op, bool complain) tree value; const char *op_name; - my_friendly_assert (op == SIZEOF_EXPR || op == ALIGNOF_EXPR, 20020720); + gcc_assert (op == SIZEOF_EXPR || op == ALIGNOF_EXPR); if (type == error_mark_node) return error_mark_node; @@ -1441,7 +1439,7 @@ perform_integral_promotions (tree expr) tree promoted_type; type = TREE_TYPE (expr); - my_friendly_assert (INTEGRAL_OR_ENUMERATION_TYPE_P (type), 20030703); + gcc_assert (INTEGRAL_OR_ENUMERATION_TYPE_P (type)); promoted_type = type_promotes_to (type); if (type != promoted_type) expr = cp_convert (promoted_type, expr); @@ -1595,8 +1593,7 @@ build_class_member_access_expr (tree object, tree member, if (TREE_CODE (member) == PSEUDO_DTOR_EXPR) return member; - my_friendly_assert (DECL_P (member) || BASELINK_P (member), - 20020801); + gcc_assert (DECL_P (member) || BASELINK_P (member)); /* [expr.ref] @@ -1698,8 +1695,7 @@ build_class_member_access_expr (tree object, tree member, /*nonnull=*/1); /* If we found the base successfully then we should be able to convert to it successfully. */ - my_friendly_assert (object != error_mark_node, - 20020801); + gcc_assert (object != error_mark_node); } /* Complain about other invalid uses of offsetof, even though they will @@ -1909,9 +1905,7 @@ finish_class_member_access_expr (tree object, tree name) if (BASELINK_P (name)) { /* A member function that has already been looked up. */ - my_friendly_assert ((TREE_CODE (BASELINK_FUNCTIONS (name)) - == TEMPLATE_ID_EXPR), - 20020805); + gcc_assert (TREE_CODE (BASELINK_FUNCTIONS (name)) == TEMPLATE_ID_EXPR); member = name; } else @@ -1940,12 +1934,10 @@ finish_class_member_access_expr (tree object, tree name) or a BIT_NOT_EXPR. */ scope = TREE_OPERAND (name, 0); name = TREE_OPERAND (name, 1); - my_friendly_assert ((CLASS_TYPE_P (scope) - || TREE_CODE (scope) == NAMESPACE_DECL), - 20020804); - my_friendly_assert ((TREE_CODE (name) == IDENTIFIER_NODE - || TREE_CODE (name) == BIT_NOT_EXPR), - 20020804); + gcc_assert (CLASS_TYPE_P (scope) + || TREE_CODE (scope) == NAMESPACE_DECL); + gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE + || TREE_CODE (name) == BIT_NOT_EXPR); /* If SCOPE is a namespace, then the qualified name does not name a member of OBJECT_TYPE. */ @@ -2032,7 +2024,7 @@ build_ptrmemfunc_access_expr (tree ptrmem, tree member_name) routine directly because it expects the object to be of class type. */ ptrmem_type = TREE_TYPE (ptrmem); - my_friendly_assert (TYPE_PTRMEMFUNC_P (ptrmem_type), 20020804); + gcc_assert (TYPE_PTRMEMFUNC_P (ptrmem_type)); member = lookup_member (ptrmem_type, member_name, /*protect=*/0, /*want_type=*/false); member_type = cp_build_qualified_type (TREE_TYPE (member), @@ -4091,9 +4083,8 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert) /* We can only get here with a single static member function. */ - my_friendly_assert (TREE_CODE (fn) == FUNCTION_DECL - && DECL_STATIC_FUNCTION_P (fn), - 20030906); + gcc_assert (TREE_CODE (fn) == FUNCTION_DECL + && DECL_STATIC_FUNCTION_P (fn)); mark_used (fn); addr = build_address (fn); if (TREE_SIDE_EFFECTS (TREE_OPERAND (arg, 0))) @@ -4208,7 +4199,7 @@ unary_complex_lvalue (enum tree_code code, tree arg) { tree t; - my_friendly_assert (TREE_CODE (arg) != SCOPE_REF, 313); + gcc_assert (TREE_CODE (arg) != SCOPE_REF); if (TREE_CODE (arg) != OFFSET_REF) return 0; @@ -4312,10 +4303,10 @@ cxx_mark_addressable (tree exp) case VAR_DECL: /* Caller should not be trying to mark initialized constant fields addressable. */ - my_friendly_assert (DECL_LANG_SPECIFIC (x) == 0 - || DECL_IN_AGGR_P (x) == 0 - || TREE_STATIC (x) - || DECL_EXTERNAL (x), 314); + gcc_assert (DECL_LANG_SPECIFIC (x) == 0 + || DECL_IN_AGGR_P (x) == 0 + || TREE_STATIC (x) + || DECL_EXTERNAL (x)); /* Fall through. */ case CONST_DECL: @@ -5138,8 +5129,7 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs) value with the RHS producing the value we should actually store into the LHS. */ - my_friendly_assert (!PROMOTES_TO_AGGR_TYPE (lhstype, REFERENCE_TYPE), - 978652); + gcc_assert (!PROMOTES_TO_AGGR_TYPE (lhstype, REFERENCE_TYPE)); lhs = stabilize_reference (lhs); newrhs = cp_build_binary_op (modifycode, lhs, rhs); if (newrhs == error_mark_node) @@ -5152,9 +5142,8 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs) /* Now it looks like a plain assignment. */ modifycode = NOP_EXPR; } - my_friendly_assert (TREE_CODE (lhstype) != REFERENCE_TYPE, 20011220); - my_friendly_assert (TREE_CODE (TREE_TYPE (newrhs)) != REFERENCE_TYPE, - 20011220); + gcc_assert (TREE_CODE (lhstype) != REFERENCE_TYPE); + gcc_assert (TREE_CODE (TREE_TYPE (newrhs)) != REFERENCE_TYPE); } /* The left-hand side must be an lvalue. */ @@ -5467,10 +5456,8 @@ build_ptrmemfunc (tree type, tree pfn, int force) } /* Just adjust the DELTA field. */ - my_friendly_assert - (same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (delta), - ptrdiff_type_node), - 20030727); + gcc_assert (same_type_ignoring_top_level_qualifiers_p + (TREE_TYPE (delta), ptrdiff_type_node)); if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_delta) n = cp_build_binary_op (LSHIFT_EXPR, n, integer_one_node); delta = cp_build_binary_op (PLUS_EXPR, delta, n); @@ -5490,7 +5477,7 @@ build_ptrmemfunc (tree type, tree pfn, int force) return instantiate_type (type, pfn, tf_error | tf_warning); fn = TREE_OPERAND (pfn, 0); - my_friendly_assert (TREE_CODE (fn) == FUNCTION_DECL, 0); + gcc_assert (TREE_CODE (fn) == FUNCTION_DECL); return make_ptrmem_cst (to_type, fn); } @@ -5508,7 +5495,7 @@ expand_ptrmemfunc_cst (tree cst, tree *delta, tree *pfn) tree fn = PTRMEM_CST_MEMBER (cst); tree ptr_class, fn_class; - my_friendly_assert (TREE_CODE (fn) == FUNCTION_DECL, 0); + gcc_assert (TREE_CODE (fn) == FUNCTION_DECL); /* The class that the function belongs to. */ fn_class = DECL_CONTEXT (fn); @@ -5916,7 +5903,7 @@ check_return_expr (tree retval) return value, the named return value is used. */ result = DECL_RESULT (current_function_decl); valtype = TREE_TYPE (result); - my_friendly_assert (valtype != NULL_TREE, 19990924); + gcc_assert (valtype != NULL_TREE); fn_returns_value_p = !VOID_TYPE_P (valtype); if (!retval && DECL_NAME (result) && fn_returns_value_p) retval = result; diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index f44474db6ff..19a11919b82 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -179,7 +179,7 @@ complete_type_check_abstract (tree type) struct pending_abstract_type *pat; location_t cur_loc = input_location; - my_friendly_assert (COMPLETE_TYPE_P (type), 20040620_3); + gcc_assert (COMPLETE_TYPE_P (type)); if (!abstract_pending_vars) return; @@ -190,7 +190,7 @@ complete_type_check_abstract (tree type) if (!slot) return; pat = (struct pending_abstract_type*)*slot; - my_friendly_assert (pat, 20040620_2); + gcc_assert (pat); /* If the type is not abstract, do not do anything. */ if (CLASSTYPE_PURE_VIRTUALS (type)) @@ -210,7 +210,7 @@ complete_type_check_abstract (tree type) element: it will issue a diagostic if the type is abstract. */ while (pat) { - my_friendly_assert (type == pat->type, 20040620_4); + gcc_assert (type == pat->type); /* Tweak input_location so that the diagnostic appears at the correct location. Notice that this is only needed if the decl is an @@ -252,9 +252,8 @@ abstract_virtuals_error (tree decl, tree type) void **slot; struct pending_abstract_type *pat; - my_friendly_assert (!decl || (DECL_P (decl) - || TREE_CODE (decl) == IDENTIFIER_NODE), - 20040620_1); + gcc_assert (!decl || DECL_P (decl) + || TREE_CODE (decl) == IDENTIFIER_NODE); if (!abstract_pending_vars) abstract_pending_vars = htab_create_ggc (31, &pat_calc_hash, @@ -888,12 +887,9 @@ process_init_constructor (tree type, tree init, tree* elts) TREE_VALUE (tail), &tail1); if (next1 == error_mark_node) return next1; - my_friendly_assert - (same_type_ignoring_top_level_qualifiers_p - (TREE_TYPE (type), TREE_TYPE (next1)), - 981123); - my_friendly_assert (tail1 == 0 - || TREE_CODE (tail1) == TREE_LIST, 319); + gcc_assert (same_type_ignoring_top_level_qualifiers_p + (TREE_TYPE (type), TREE_TYPE (next1))); + gcc_assert (!tail1 || TREE_CODE (tail1) == TREE_LIST); if (tail == tail1 && len < 0) { error ("non-empty initializer for array of empty elements"); @@ -992,8 +988,7 @@ process_init_constructor (tree type, tree init, tree* elts) next1 = digest_init (TREE_TYPE (field), TREE_VALUE (tail), &tail1); - my_friendly_assert (tail1 == 0 - || TREE_CODE (tail1) == TREE_LIST, 320); + gcc_assert (!tail1 || TREE_CODE (tail1) == TREE_LIST); tail = tail1; } else @@ -1463,7 +1458,7 @@ add_exception_specifier (tree list, tree spec, int complain) if (spec == error_mark_node) return list; - my_friendly_assert (spec && (!list || TREE_VALUE (list)), 19990317); + gcc_assert (spec && (!list || TREE_VALUE (list))); /* [except.spec] 1, type in an exception specifier shall not be incomplete, or pointer or ref to incomplete other than pointer