1998-08-27 Jason Merrill <jason@yorick.cygnus.com>
+ * 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,
/* 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;
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);
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);
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;
}
}
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. */
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));
/* 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. */
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.
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))
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))
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 ();
/* 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" },
{ "-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", "" },
{ "-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", "" },
{ "-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", "" },
{
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 ();
/* 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.
/* Don't change signatures. */
if (! IS_SIGNATURE (t))
{
- extern tree pending_vtables;
int needs_writing;
tree name = TYPE_IDENTIFIER (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
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)
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.
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;
char *called_thing = 0;
int i = 0;
- if (! flag_elide_constructors)
- return_loc = 0;
-
/* Argument passing is always copy-initialization. */
flags |= LOOKUP_ONLYCONVERTING;
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
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