diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c23c4c85916..c048dabe10b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,19 @@ 1998-08-27 Jason Merrill + * lex.c (handle_cp_pragma): Remove #pragma vtable. + * lang-options.h: Remove +e options. + * decl2.c (lang_decode_option): Likewise. + (import_export_vtable): Don't check write_virtuals. + (finish_vtable_vardecl, finish_file): Likewise. + * search.c (dfs_debug_mark): Likewise. + * semantics.c (begin_class_definition): Likewise. + * class.c (build_vtable, finish_vtbls, finish_struct_1): Likewise. + + * call.c (build_over_call): Check flag_elide_constructors. + * decl2.c: flag_elide_constructors defaults to 1. + * typeck.c (convert_arguments): Remove return_loc parm. + (build_function_call_real): Adjust. + * search.c: Tear out all mi_matrix and memoize code. (lookup_field, lookup_fnfields): Use scratch_tree_cons. * lang-options.h: Remove documentation for -fhandle-exceptions, diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 5564fa3a535..bb0b71a4097 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -3409,8 +3409,11 @@ build_over_call (cand, args, flags) /* Avoid actually calling copy constructors and copy assignment operators, if possible. */ - if (DECL_CONSTRUCTOR_P (fn) - && TREE_VEC_LENGTH (convs) == 1 + + if (! flag_elide_constructors) + /* Do things the hard way. */; + else if (DECL_CONSTRUCTOR_P (fn) + && TREE_VEC_LENGTH (convs) == 1 && copy_args_p (fn)) { tree targ; diff --git a/gcc/cp/class.c b/gcc/cp/class.c index c8273e5757f..da6c20ec9a2 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -678,9 +678,7 @@ build_vtable (binfo, type) DECL_ALIGN (decl) = MAX (TYPE_ALIGN (double_type_node), DECL_ALIGN (decl)); - /* Why is this conditional? (mrs) */ - if (binfo && write_virtuals >= 0) - DECL_VIRTUAL_P (decl) = 1; + DECL_VIRTUAL_P (decl) = 1; DECL_CONTEXT (decl) = type; binfo = TYPE_BINFO (type); @@ -2134,8 +2132,7 @@ finish_vtbls (binfo, do_self, t) decl = BINFO_VTABLE (binfo); context = DECL_CONTEXT (decl); DECL_CONTEXT (decl) = 0; - if (write_virtuals >= 0 - && DECL_INITIAL (decl) != BINFO_VIRTUALS (binfo)) + if (DECL_INITIAL (decl) != BINFO_VIRTUALS (binfo)) DECL_INITIAL (decl) = build_nt (CONSTRUCTOR, NULL_TREE, BINFO_VIRTUALS (binfo)); cp_finish_decl (decl, DECL_INITIAL (decl), NULL_TREE, 0, 0); @@ -3963,8 +3960,7 @@ finish_struct_1 (t, warn_anon) else if (has_virtual) { TYPE_BINFO_VIRTUALS (t) = pending_virtuals; - if (write_virtuals >= 0) - DECL_VIRTUAL_P (TYPE_BINFO_VTABLE (t)) = 1; + DECL_VIRTUAL_P (TYPE_BINFO_VTABLE (t)) = 1; } } @@ -4130,14 +4126,9 @@ finish_struct_1 (t, warn_anon) references between translation units. */ if (CLASSTYPE_METHOD_VEC (t)) { - extern tree pending_vtables; - /* Don't output full info about any type which does not have its implementation defined here. */ - if (TYPE_VIRTUAL_P (t) && write_virtuals == 2) - TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) - = (value_member (TYPE_IDENTIFIER (t), pending_vtables) == 0); - else if (CLASSTYPE_INTERFACE_ONLY (t)) + if (CLASSTYPE_INTERFACE_ONLY (t)) TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1; #if 0 /* XXX do something about this. */ diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index ac7fead7831..5ce5dd97998 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -3072,7 +3072,7 @@ extern tree get_member_function_from_ptrfunc PROTO((tree *, tree)); extern tree build_function_call_real PROTO((tree, tree, int, int)); extern tree build_function_call PROTO((tree, tree)); extern tree build_function_call_maybe PROTO((tree, tree)); -extern tree convert_arguments PROTO((tree, tree, tree, tree, int)); +extern tree convert_arguments PROTO((tree, tree, tree, int)); extern tree build_x_binary_op PROTO((enum tree_code, tree, tree)); extern tree build_binary_op PROTO((enum tree_code, tree, tree, int)); extern tree build_binary_op_nodefault PROTO((enum tree_code, tree, tree, enum tree_code)); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 6a1540bb911..ebd942dbde9 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -345,21 +345,14 @@ int flag_this_is_variable; /* 3 means write out only virtuals function tables `defined' in this implementation file. - 2 means write out only specific virtual function tables - and give them (C) public access. - 1 means write out virtual function tables and give them - (C) public access. 0 means write out virtual function tables and give them - (C) static access (default). - -1 means declare virtual function tables extern. */ + (C) static access (default). */ int write_virtuals; -/* Nonzero means we should attempt to elide constructors when possible. - FIXME: This flag is obsolete, and should be torn out along with the - old overloading code. */ +/* Nonzero means we should attempt to elide constructors when possible. */ -int flag_elide_constructors; +int flag_elide_constructors = 1; /* Nonzero means recognize and handle signature language constructs. */ @@ -542,22 +535,6 @@ lang_decode_option (argc, argv) if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional")) /* ignore */; - /* The +e options are for cfront compatibility. They come in as - `-+eN', to kludge around gcc.c's argument handling. */ - else if (p[0] == '-' && p[1] == '+' && p[2] == 'e') - { - int old_write_virtuals = write_virtuals; - if (p[3] == '1') - write_virtuals = 1; - else if (p[3] == '0') - write_virtuals = -1; - else if (p[3] == '2') - write_virtuals = 2; - else error ("invalid +e option"); - if (old_write_virtuals != 0 - && write_virtuals != old_write_virtuals) - error ("conflicting +e options given"); - } else if (p[0] == '-' && p[1] == 'f') { /* Some kind of -f option. @@ -2575,12 +2552,10 @@ import_export_vtable (decl, type, final) if (DECL_INTERFACE_KNOWN (decl)) return; - /* +e0 or +e1 */ - if (write_virtuals < 0 || write_virtuals == 1 || TYPE_FOR_JAVA (type)) + if (TYPE_FOR_JAVA (type)) { TREE_PUBLIC (decl) = 1; - if (write_virtuals < 0 || TYPE_FOR_JAVA (type)) - DECL_EXTERNAL (decl) = 1; + DECL_EXTERNAL (decl) = 1; DECL_INTERFACE_KNOWN (decl) = 1; } else if (CLASSTYPE_INTERFACE_KNOWN (type)) @@ -2702,8 +2677,7 @@ static int finish_vtable_vardecl (prev, vars) tree prev, vars; { - if (write_virtuals >= 0 - && ! DECL_EXTERNAL (vars) + if (! DECL_EXTERNAL (vars) && ((TREE_PUBLIC (vars) && ! DECL_WEAK (vars) && ! DECL_ONE_ONLY (vars)) || CLASSTYPE_EXPLICIT_INSTANTIATION (DECL_CONTEXT (vars)) || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (vars)) @@ -3599,19 +3573,6 @@ finish_file () walk_vtables ((void (*) PROTO((tree, tree))) 0, prune_vtable_vardecl); - if (write_virtuals == 2) - { - /* Now complain about an virtual function tables promised - but not delivered. */ - while (pending_vtables) - { - if (TREE_PURPOSE (pending_vtables) == NULL_TREE) - error ("virtual function table for `%s' not defined", - IDENTIFIER_POINTER (TREE_VALUE (pending_vtables))); - pending_vtables = TREE_CHAIN (pending_vtables); - } - } - finish_repo (); this_time = get_run_time (); diff --git a/gcc/cp/lang-options.h b/gcc/cp/lang-options.h index d8f85bd1f20..25f642f1307 100644 --- a/gcc/cp/lang-options.h +++ b/gcc/cp/lang-options.h @@ -23,9 +23,6 @@ DEFINE_LANG_NAME ("C++") /* This is the contribution to the `lang_options' array in gcc.c for g++. */ - { "-+e0", "" }, /* gcc.c tacks the `-' on the front. */ - { "-+e1", "" }, - { "-+e2", "" }, { "-faccess-control", "" }, { "-fno-access-control", "Do not obey access control semantics" }, { "-fall-virtual", "Make all member functions virtual" }, @@ -41,7 +38,7 @@ DEFINE_LANG_NAME ("C++") { "-fconst-strings", "" }, { "-fno-const-strings", "Make string literals `char[]' instead of `const char[]'" }, { "-fdefault-inline", "" }, - { "-fno-default-inline", "Do not inline mmeber functions be default"}, + { "-fno-default-inline", "Do not inline member functions by default"}, { "-frtti", "" }, { "-fno-rtti", "Do not generate run time type descriptor information" }, { "-felide-constructors", "" }, @@ -60,13 +57,13 @@ DEFINE_LANG_NAME ("C++") { "-fno-handle-exceptions", "" }, { "-fhandle-signatures", "Handle signature language constructs" }, { "-fno-handle-signatures", "" }, - { "-fhonor-std", "Do not ignore the namespace standard" }, + { "-fhonor-std", "Treat the namespace `std' as a normal namespace" }, { "-fno-honor-std", "" }, { "-fhuge-objects", "Enable support for huge objects" }, { "-fno-huge-objects", "" }, { "-fimplement-inlines", "" }, { "-fno-implement-inlines", "Export functions even if they can be inlined" }, - { "-fimplicit-templates", "Emit implicit instatiations if needed" }, + { "-fimplicit-templates", "Emit implicit template instatiations when used" }, { "-fno-implicit-templates", "" }, { "-finit-priority", "Handle the init_priority attribute" }, { "-fno-init-priority", "" }, @@ -74,7 +71,7 @@ DEFINE_LANG_NAME ("C++") { "-fno-labels-ok", "" }, { "-fmemoize-lookups", "" }, { "-fno-memoize-lookups", "" }, - { "-fname-mangling-version-", "Set the version of name mangling to use" }, + { "-fname-mangling-version-", "" }, { "-fnew-abi", "Enable experimental ABI changes" }, { "-fno-new-abi", "" }, { "-fnonnull-objects", "" }, diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 9d8f2d2ad06..acb172822ca 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -4712,33 +4712,7 @@ handle_cp_pragma (pname) { register int token; - if (! strcmp (pname, "vtable")) - { - extern tree pending_vtables; - - /* More follows: it must be a string constant (class name). */ - token = real_yylex (); - if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST) - { - error ("invalid #pragma vtable"); - return -1; - } - - if (write_virtuals != 2) - { - warning ("use `+e2' option to enable #pragma vtable"); - return -1; - } - pending_vtables - = perm_tree_cons (NULL_TREE, - get_identifier (TREE_STRING_POINTER (yylval.ttype)), - pending_vtables); - token = real_yylex (); - if (token != END_OF_LINE) - warning ("trailing characters ignored"); - return 1; - } - else if (! strcmp (pname, "unit")) + if (! strcmp (pname, "unit")) { /* More follows: it must be a string constant (unit name). */ token = real_yylex (); diff --git a/gcc/cp/search.c b/gcc/cp/search.c index ed378c0e9cd..fe028c28e9c 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -2241,8 +2241,7 @@ dfs_debug_mark (binfo) /* If interface info is known, either we've already emitted the debug info or we don't need to. */ - if (CLASSTYPE_INTERFACE_KNOWN (t) - || (write_virtuals == 2 && TYPE_VIRTUAL_P (t))) + if (CLASSTYPE_INTERFACE_KNOWN (t)) return; /* If debug info is requested from this context for this type, supply it. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 0daab086806..24428261c55 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1246,7 +1246,6 @@ begin_class_definition (t) /* Don't change signatures. */ if (! IS_SIGNATURE (t)) { - extern tree pending_vtables; int needs_writing; tree name = TYPE_IDENTIFIER (t); @@ -1258,24 +1257,13 @@ begin_class_definition (t) } /* Record how to set the access of this class's - virtual functions. If write_virtuals == 2 or 3, then + virtual functions. If write_virtuals == 3, then inline virtuals are ``extern inline''. */ - switch (write_virtuals) - { - case 0: - case 1: - needs_writing = 1; - break; - case 2: - needs_writing = !! value_member (name, pending_vtables); - break; - case 3: - needs_writing = ! CLASSTYPE_INTERFACE_ONLY (t) - && CLASSTYPE_INTERFACE_KNOWN (t); - break; - default: - needs_writing = 0; - } + if (write_virtuals == 3) + needs_writing = ! CLASSTYPE_INTERFACE_ONLY (t) + && CLASSTYPE_INTERFACE_KNOWN (t); + else + needs_writing = 1; CLASSTYPE_VTABLE_NEEDS_WRITING (t) = needs_writing; } #if 0 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index fff5b383e9e..d589b5b531a 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2916,10 +2916,10 @@ build_function_call_real (function, params, require_complete, flags) function prototype, or apply default promotions. */ if (flags & LOOKUP_COMPLAIN) - coerced_params = convert_arguments (NULL_TREE, TYPE_ARG_TYPES (fntype), + coerced_params = convert_arguments (TYPE_ARG_TYPES (fntype), params, fndecl, LOOKUP_NORMAL); else - coerced_params = convert_arguments (NULL_TREE, TYPE_ARG_TYPES (fntype), + coerced_params = convert_arguments (TYPE_ARG_TYPES (fntype), params, fndecl, 0); if (coerced_params == error_mark_node) @@ -2985,12 +2985,6 @@ build_function_call (function, params) If parmdecls is exhausted, or when an element has NULL as its type, perform the default conversions. - RETURN_LOC is the location of the return value, if known, NULL_TREE - otherwise. This is useful in the case where we can avoid creating - a temporary variable in the case where we can initialize the return - value directly. If we are not eliding constructors, then we set this - to NULL_TREE to avoid this avoidance. - NAME is an IDENTIFIER_NODE or 0. It is used only for error messages. This is also where warnings about wrong number of args are generated. @@ -3004,8 +2998,8 @@ build_function_call (function, params) default arguments, if such were specified. Do so here. */ tree -convert_arguments (return_loc, typelist, values, fndecl, flags) - tree return_loc, typelist, values, fndecl; +convert_arguments (typelist, values, fndecl, flags) + tree typelist, values, fndecl; int flags; { register tree typetail, valtail; @@ -3013,9 +3007,6 @@ convert_arguments (return_loc, typelist, values, fndecl, flags) char *called_thing = 0; int i = 0; - if (! flag_elide_constructors) - return_loc = 0; - /* Argument passing is always copy-initialization. */ flags |= LOOKUP_ONLYCONVERTING; @@ -3120,7 +3111,7 @@ convert_arguments (return_loc, typelist, values, fndecl, flags) else { parmval = convert_for_initialization - (return_loc, type, val, flags, + (NULL_TREE, type, val, flags, "argument passing", fndecl, i); #ifdef PROMOTE_PROTOTYPES if ((TREE_CODE (type) == INTEGER_TYPE @@ -7094,8 +7085,8 @@ convert_for_assignment (type, rhs, errtype, fndecl, parmnum) return error_mark_node; } -/* Convert RHS to be of type TYPE. If EXP is non-zero, - it is the target of the initialization. +/* Convert RHS to be of type TYPE. + If EXP is non-zero, it is the target of the initialization. ERRTYPE is a string to use in error messages. Two major differences between the behavior of