diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 63b25d5ce1f..6dad4f9e014 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2001-02-17 Mark Mitchell + + * invoke.texi (-fsquangle): Remove documentation. + (-fname-mangling-version): Likewise. + 2001-02-18 Lars Brinkhoff * optabs.c (expand_abs): Remove reference to diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b94cd78b4ad..99052916576 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -34,6 +34,26 @@ 2001-02-17 Mark Mitchell + * cp-tree.h (new_abi_rtti_p): Remove. + (name_mangling_version): Likewise. + (flag_do_squangling): Likewise. + * class.c (build_rtti_vtbl_entries): Remove old ABI support. + * decl.c (grokfndecl): Likewise. + * decl2.c (name_mangling_version): Remove. + (flag_do_squangling): Likewise. + (lang_f_options): Remove `squangle'. + (unsupported_options): Add `squangle'. + (cxx_decode_option): Issue a warning about uses of + -fname-mangling-version. + (finish_file): Remove old ABI support. + * pt.c (check_explicit_specialization): Likewise. + (tsubst_decl): Likewise. + * rtti.c (init_rtti_processing): Likewise. + (build_headof): Likewise. + (get_tinfo_decl_dynamic): Likewise. + (tinfo_from_decl): Likewise. + (build_dynamic_cast_1): Likewise. + (synthesize_tinfo_var): Likewise. * init.c (build_new): Allow enumeration types for the array-bounds in a direct-new-declarator. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 7c2102101b3..b1b4180fd67 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -7766,35 +7766,16 @@ build_rtti_vtbl_entries (binfo, rtti_binfo, vid) } offset = size_diffop (BINFO_OFFSET (rtti_binfo), BINFO_OFFSET (b)); - /* The second entry is, in the case of the new ABI, the address of - the typeinfo object, or, in the case of the old ABI, a function - which returns a typeinfo object. */ - if (new_abi_rtti_p ()) - { - if (flag_rtti) - decl = build_unary_op (ADDR_EXPR, get_tinfo_decl (t), 0); - else - decl = integer_zero_node; - - /* Convert the declaration to a type that can be stored in the - vtable. */ - init = build1 (NOP_EXPR, vfunc_ptr_type_node, decl); - TREE_CONSTANT (init) = 1; - } + /* The second entry is the address of the typeinfo object. */ + if (flag_rtti) + decl = build_unary_op (ADDR_EXPR, get_tinfo_decl (t), 0); else - { - if (flag_rtti) - decl = get_tinfo_decl (t); - else - decl = abort_fndecl; - - /* Convert the declaration to a type that can be stored in the - vtable. */ - init = build1 (ADDR_EXPR, vfunc_ptr_type_node, decl); - TREE_CONSTANT (init) = 1; - init = build_vtable_entry (offset, NULL_TREE, init, - /*generate_with_vtable_p=*/0); - } + decl = integer_zero_node; + + /* Convert the declaration to a type that can be stored in the + vtable. */ + init = build1 (NOP_EXPR, vfunc_ptr_type_node, decl); + TREE_CONSTANT (init) = 1; *vid->last_init = build_tree_list (NULL_TREE, init); vid->last_init = &TREE_CHAIN (*vid->last_init); diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index f7ed02c9990..f1e6df51a49 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -261,11 +261,6 @@ extern int flag_huge_objects; class). */ #define all_overridden_vfuns_in_vtables_p() (1) -/* Nonzero if we use access type_info objects directly, and use the - cross-vendor layout for them. Zero if we use an accessor function - to get the type_info object address. */ -#define new_abi_rtti_p() (1) - /* Nonzero if primary and secondary vtables are combined into a single vtable. */ #define merge_primary_and_secondary_vtables_p() (1) @@ -1121,15 +1116,6 @@ extern int flag_ansi; extern int flag_default_inline; -/* The name-mangling scheme to use. Versions of gcc before 2.8 use - version 0. */ -extern int name_mangling_version; - -/* Nonzero if squashed mangling is to be performed. - This uses the B and K codes to reference previously seen class types - and class qualifiers. */ -extern int flag_do_squangling; - /* Nonzero means generate separate instantiation control files and juggle them at link time. */ extern int flag_use_repository; diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 3b38d68c987..af5ac8a4e69 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8862,7 +8862,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals, /* Plain overloading: will not be grok'd by grokclassfn. */ if (! ctype && ! processing_template_decl && (! DECL_EXTERN_C_P (decl) || DECL_OVERLOADED_OPERATOR_P (decl)) - && (! DECL_USE_TEMPLATE (decl) || name_mangling_version < 1)) + && ! DECL_USE_TEMPLATE (decl)) set_mangled_name_for_decl (decl); if (funcdef_flag) diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 37e6d4ad692..51b734fb125 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -430,17 +430,6 @@ int flag_inline_trees = 0; int max_tinst_depth = 50; -/* The name-mangling scheme to use. Must be 1 or greater to support - template functions with identical types, but different template - arguments. */ -int name_mangling_version = 2; - -/* Nonzero if squashed mangling is to be performed. - This uses the B and K codes to reference previously seen class types - and class qualifiers. */ - -int flag_do_squangling; - /* Nonzero means output .vtable_{entry,inherit} for use in doing vtable gc. */ int flag_vtable_gc; @@ -507,7 +496,6 @@ lang_f_options[] = {"permissive", &flag_permissive, 1}, {"repo", &flag_use_repository, 1}, {"rtti", &flag_rtti, 1}, - {"squangle", &flag_do_squangling, 1}, {"stats", &flag_detailed_statistics, 1}, {"use-cxa-atexit", &flag_use_cxa_atexit, 1}, {"vtable-gc", &flag_vtable_gc, 1}, @@ -525,8 +513,9 @@ static const char * const unsupported_options[] = { "enum-int-equiv", "guiding-decls", "nonnull-objects", - "this-is-variable", + "squangle", "strict-prototype", + "this-is-variable", }; /* Compare two option strings, pointed two by P1 and P2, for use with @@ -617,8 +606,10 @@ cxx_decode_option (argc, argv) = read_integral_parameter (option_value, p - 2, max_tinst_depth); else if ((option_value = skip_leading_substring (p, "name-mangling-version-"))) - name_mangling_version - = read_integral_parameter (option_value, p - 2, name_mangling_version); + { + warning ("-fname-mangling-version is no longer supported"); + return 1; + } else if ((option_value = skip_leading_substring (p, "dump-translation-unit="))) { @@ -3581,8 +3572,7 @@ finish_file () timevar_push (TV_VARCONST); - if (new_abi_rtti_p ()) - emit_support_tinfos (); + emit_support_tinfos (); do { @@ -3602,8 +3592,7 @@ finish_file () /* Write out needed type info variables. Writing out one variable might cause others to be needed. */ - if (new_abi_rtti_p () - && walk_globals (tinfo_decl_p, emit_tinfo_decl, /*data=*/0)) + if (walk_globals (tinfo_decl_p, emit_tinfo_decl, /*data=*/0)) reconsider = 1; /* The list of objects with static storage duration is built up diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index ab420b55379..630adc94820 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1693,8 +1693,7 @@ check_explicit_specialization (declarator, decl, template_count, flags) treatment. We do this here so that the ordinary, non-template, name-mangling algorithm will not be used later. */ - if ((is_member_template (tmpl) || ctype == NULL_TREE) - && name_mangling_version >= 1) + if (is_member_template (tmpl) || ctype == NULL_TREE) set_mangled_name_for_template_decl (decl); if (is_friend && !have_def) @@ -5879,8 +5878,7 @@ tsubst_decl (t, args, type) /* TMPL will be NULL if this is a specialization of a member function of a template class. */ - if (name_mangling_version < 1 - || tmpl == NULL_TREE + if (tmpl == NULL_TREE || (member && !is_member_template (tmpl) && !DECL_TEMPLATE_INFO (tmpl))) set_mangled_name_for_decl (r); diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index b1acc5eb85f..315f23d42c0 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -79,24 +79,11 @@ init_rtti_processing () (class_type_node, get_identifier ("type_info"), 1); if (flag_honor_std) pop_namespace (); - if (!new_abi_rtti_p ()) - { - tinfo_decl_id = get_identifier ("__tf"); - tinfo_decl_type = build_function_type - (build_reference_type - (build_qualified_type - (type_info_type_node, TYPE_QUAL_CONST)), - void_list_node); - tinfo_var_id = get_identifier ("__ti"); - } - else - { - /* FIXME: These identifier prefixes are not set in stone yet. */ - tinfo_decl_id = get_identifier ("__ti"); - tinfo_var_id = get_identifier ("__tn"); - tinfo_decl_type = build_qualified_type - (type_info_type_node, TYPE_QUAL_CONST); - } + /* FIXME: These identifier prefixes are not set in stone yet. */ + tinfo_decl_id = get_identifier ("__ti"); + tinfo_var_id = get_identifier ("__tn"); + tinfo_decl_type = + build_qualified_type (type_info_type_node, TYPE_QUAL_CONST); } /* Given a pointer to an object with at least one virtual table @@ -150,11 +137,7 @@ build_headof (exp) /* Under the new ABI, the offset-to-top field is at index -2 from the vptr. */ - if (new_abi_rtti_p ()) - index = build_int_2 (-2, -1); - /* But under the old ABI, it is at offset zero. */ - else - index = integer_zero_node; + index = build_int_2 (-2, -1); aref = build_vtbl_ref (build_indirect_ref (exp, NULL_PTR), index); @@ -253,14 +236,8 @@ get_tinfo_decl_dynamic (exp) exp = build_indirect_ref (exp, NULL_PTR); } - /* The RTTI information is always in the vtable, but it's at - different indices depending on the ABI. */ - if (new_abi_rtti_p ()) - index = integer_minus_one_node; - else if (flag_vtable_thunks) - index = integer_one_node; - else - index = integer_zero_node; + /* The RTTI information is at index -1. */ + index = integer_minus_one_node; t = build_vfn_ref ((tree *) 0, exp, index); TREE_TYPE (t) = build_pointer_type (tinfo_decl_type); return t; @@ -397,9 +374,7 @@ tinfo_from_decl (expr) { tree t; - if (!new_abi_rtti_p ()) - t = build_call (expr, NULL_TREE); - else if (TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE) + if (TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE) t = build_indirect_ref (expr, NULL); else t = expr; @@ -717,67 +692,34 @@ build_dynamic_cast_1 (type, expr) if (tc == REFERENCE_TYPE) expr1 = build_unary_op (ADDR_EXPR, expr1, 0); - if (!new_abi_rtti_p ()) - { - tree expr2 = build_headof (expr1); - tree td1 = expr; - - if (tc == POINTER_TYPE) - td1 = build_indirect_ref (td1, NULL_PTR); - td1 = get_tinfo_decl_dynamic (td1); - - elems = tree_cons - (NULL_TREE, td1, tree_cons - (NULL_TREE, td2, tree_cons - (NULL_TREE, boff, tree_cons - (NULL_TREE, expr2, tree_cons - (NULL_TREE, td3, tree_cons - (NULL_TREE, expr1, NULL_TREE)))))); - } - else - elems = tree_cons - (NULL_TREE, expr1, tree_cons - (NULL_TREE, td3, tree_cons - (NULL_TREE, td2, tree_cons - (NULL_TREE, boff, NULL_TREE)))); + elems = tree_cons + (NULL_TREE, expr1, tree_cons + (NULL_TREE, td3, tree_cons + (NULL_TREE, td2, tree_cons + (NULL_TREE, boff, NULL_TREE)))); dcast_fn = dynamic_cast_node; if (!dcast_fn) { tree tmp; tree tinfo_ptr; - tree ns = new_abi_rtti_p () ? abi_node : global_namespace; + tree ns = abi_node; const char *name; push_nested_namespace (ns); - if (!new_abi_rtti_p ()) - { - tinfo_ptr = build_pointer_type (tinfo_decl_type); - name = "__dynamic_cast_2"; - tmp = tree_cons - (NULL_TREE, tinfo_ptr, tree_cons - (NULL_TREE, tinfo_ptr, tree_cons - (NULL_TREE, integer_type_node, tree_cons - (NULL_TREE, ptr_type_node, tree_cons - (NULL_TREE, tinfo_ptr, tree_cons - (NULL_TREE, ptr_type_node, void_list_node)))))); - } - else - { - tinfo_ptr = xref_tag (class_type_node, - get_identifier ("__class_type_info"), - 1); - - tinfo_ptr = build_pointer_type - (build_qualified_type - (tinfo_ptr, TYPE_QUAL_CONST)); - name = "__dynamic_cast"; - tmp = tree_cons - (NULL_TREE, const_ptr_type_node, tree_cons - (NULL_TREE, tinfo_ptr, tree_cons - (NULL_TREE, tinfo_ptr, tree_cons - (NULL_TREE, ptrdiff_type_node, void_list_node)))); - } + tinfo_ptr = xref_tag (class_type_node, + get_identifier ("__class_type_info"), + 1); + + tinfo_ptr = build_pointer_type + (build_qualified_type + (tinfo_ptr, TYPE_QUAL_CONST)); + name = "__dynamic_cast"; + tmp = tree_cons + (NULL_TREE, const_ptr_type_node, tree_cons + (NULL_TREE, tinfo_ptr, tree_cons + (NULL_TREE, tinfo_ptr, tree_cons + (NULL_TREE, ptrdiff_type_node, void_list_node)))); tmp = build_function_type (ptr_type_node, tmp); dcast_fn = build_library_fn_ptr (name, tmp); pop_nested_namespace (ns); @@ -1134,8 +1076,6 @@ synthesize_tinfo_var (target_type, real_name) tree var_type = NULL_TREE; int non_public = 0; - my_friendly_assert (new_abi_rtti_p (), 20000118); - switch (TREE_CODE (target_type)) { case POINTER_TYPE: diff --git a/gcc/invoke.texi b/gcc/invoke.texi index be11494129e..9804d0de123 100644 --- a/gcc/invoke.texi +++ b/gcc/invoke.texi @@ -173,9 +173,9 @@ in the following sections. -fhuge-objects -fno-implicit-templates @gol -fno-implicit-inline-templates @gol -fno-implement-inlines -fms-extensions @gol --fname-mangling-version-@var{n} -fno-operator-names @gol +-fno-operator-names @gol -fno-optional-diags -fpermissive @gol --frepo -fno-rtti -fsquangle -ftemplate-depth-@var{n} @gol +-frepo -fno-rtti -ftemplate-depth-@var{n} @gol -fuse-cxa-atexit -fvtable-thunks -nostdinc++ @gol -fno-default-inline -Wctor-dtor-privacy @gol -Wnon-virtual-dtor -Wreorder @gol @@ -1318,20 +1318,6 @@ errors if these functions are not inlined everywhere they are called. Disable pedantic warnings about constructs used in MFC, such as implicit int and getting a pointer to member function via non-standard syntax. -@item -fname-mangling-version-@var{n} -Control the way in which names are mangled. Version 0 is compatible -with versions of g++ before 2.8. Version 1 is the default. Version 1 -will allow correct mangling of function templates. For example, -version 0 mangling does not mangle foo and foo -given this declaration: - -@example -template void foo(T t); -@end example - -Like all options that change the ABI, all C++ code, @emph{including -libgcc} must be built with the same setting of this option. - @item -fno-operator-names Do not treat the operator name keywords @code{and}, @code{bitand}, @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as @@ -1361,18 +1347,6 @@ of the language, you can save some space by using this flag. Note that exception handling uses the same information, but it will generate it as needed. -@item -fsquangle -@itemx -fno-squangle -@samp{-fsquangle} will enable a compressed form of name mangling for -identifiers. In particular, it helps to shorten very long names by recognizing -types and class names which occur more than once, replacing them with special -short ID codes. This option also requires any C++ libraries being used to -be compiled with this option as well. The compiler has this disabled (the -equivalent of @samp{-fno-squangle}) by default. - -Like all options that change the ABI, all C++ code, @emph{including -libgcc.a} must be built with the same setting of this option. - @item -ftemplate-depth-@var{n} Set the maximum instantiation depth for template classes to @var{n}. A limit on the template instantiation depth is needed to detect diff --git a/gcc/testsuite/g++.old-deja/g++.other/mangle1.C b/gcc/testsuite/g++.old-deja/g++.other/mangle1.C index 21e7b32d9a0..b4f7245297d 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/mangle1.C +++ b/gcc/testsuite/g++.old-deja/g++.other/mangle1.C @@ -1,5 +1,4 @@ // Test for proper mangling by setting up name clashes. -// Special g++ Options: -fno-squangle #if (!defined (__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100) #define NAME(OLD, NEW) OLD diff --git a/gcc/testsuite/g++.old-deja/g++.other/static8.C b/gcc/testsuite/g++.old-deja/g++.other/static8.C index 5672d728be8..4cd89ca6ac4 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/static8.C +++ b/gcc/testsuite/g++.old-deja/g++.other/static8.C @@ -1,5 +1,4 @@ // Build don't link: -// Special g++ Options: -fno-squangle // Origin: Mark Mitchell #if (!defined (__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100)