call.c (build_call): Still evaluate the actual argument.

* call.c (build_call): Still evaluate the actual argument.
	* class.c (is_empty_class): Update for -fnew-abi.
	* decl2.c: -fnew-abi implies -fsquangle.
	* method.c (do_build_assign_ref): Don't do anything to copy
	an empty class.
	(do_build_copy_constructor): Likewise.
	* call.c (build_over_call): Likewise.

From-SVN: r19029
This commit is contained in:
Jason Merrill 1998-04-07 03:48:22 +00:00 committed by Jason Merrill
parent cd36edbdfb
commit a59ca93678
5 changed files with 58 additions and 8 deletions

View File

@ -1,3 +1,15 @@
Mon Apr 6 02:25:05 1998 Jason Merrill <jason@yorick.cygnus.com>
* call.c (build_call): Still evaluate the actual argument.
* class.c (is_empty_class): Update for -fnew-abi.
* decl2.c: -fnew-abi implies -fsquangle.
* method.c (do_build_assign_ref): Don't do anything to copy
an empty class.
(do_build_copy_constructor): Likewise.
* call.c (build_over_call): Likewise.
Sat Apr 4 18:43:58 1998 Jason Merrill <jason@yorick.cygnus.com>
* tree.c (avoid_overlap): Return a value.

View File

@ -525,7 +525,8 @@ build_call (function, result_type, parms)
TREE_TYPE (t) = TREE_TYPE (TREE_VALUE (tmp));
RTL_EXPR_RTL (t) = const0_rtx;
RTL_EXPR_SEQUENCE (t) = NULL_RTX;
TREE_VALUE (tmp) = t;
TREE_VALUE (tmp) = build (COMPOUND_EXPR, TREE_TYPE (t),
TREE_VALUE (tmp), t);
}
function = build_nt (CALL_EXPR, function, parms, NULL_TREE);
@ -3351,6 +3352,12 @@ build_over_call (fn, convs, args, flags)
{
tree to = stabilize_reference
(build_indirect_ref (TREE_VALUE (args), 0));
/* Don't copy the padding byte; it might not have been allocated
if to is a base subobject. */
if (is_empty_class (DECL_CLASS_CONTEXT (fn)))
return to;
val = build (INIT_EXPR, DECL_CONTEXT (fn), to, arg);
TREE_SIDE_EFFECTS (val) = 1;
return build_unary_op (ADDR_EXPR, val, 0);
@ -3358,10 +3365,16 @@ build_over_call (fn, convs, args, flags)
}
else if (DECL_NAME (fn) == ansi_opname[MODIFY_EXPR]
&& copy_args_p (fn)
&& TYPE_HAS_TRIVIAL_ASSIGN_REF (DECL_CONTEXT (fn)))
&& TYPE_HAS_TRIVIAL_ASSIGN_REF (DECL_CLASS_CONTEXT (fn)))
{
tree to = stabilize_reference
(build_indirect_ref (TREE_VALUE (converted_args), 0));
/* Don't copy the padding byte; it might not have been allocated
if to is a base subobject. */
if (is_empty_class (DECL_CLASS_CONTEXT (fn)))
return to;
arg = build_indirect_ref (TREE_VALUE (TREE_CHAIN (converted_args)), 0);
val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg);
TREE_SIDE_EFFECTS (val) = 1;

View File

@ -5486,7 +5486,13 @@ is_empty_class (type)
{
tree t;
if (! IS_AGGR_TYPE (type) || TYPE_BINFO_BASETYPES (type))
if (! IS_AGGR_TYPE (type))
return 0;
if (flag_new_abi)
return CLASSTYPE_SIZE (type) == integer_zero_node;
if (TYPE_BINFO_BASETYPES (type))
return 0;
t = TYPE_FIELDS (type);
while (t && TREE_CODE (t) != FIELD_DECL)

View File

@ -401,7 +401,9 @@ int flag_new_for_scope = 1;
int flag_weak = 1;
int flag_new_abi = 1;
/* Nonzero to enable experimental ABI changes. */
int flag_new_abi;
/* Maximum template instantiation depth. Must be at least 17 for ANSI
compliance. */
@ -469,8 +471,7 @@ static struct { char *string; int *variable; int on_value;} lang_f_options[] =
{"check-new", &flag_check_new, 1},
{"repo", &flag_use_repository, 1},
{"for-scope", &flag_new_for_scope, 2},
{"weak", &flag_weak, 1},
{"new-abi", &flag_new_abi, 1}
{"weak", &flag_weak, 1}
};
/* Decode the string P as a language-specific option.
@ -562,6 +563,16 @@ lang_decode_option (p)
error ("-fno-ansi-overloading is no longer supported");
found = 1;
}
else if (!strcmp (p, "new-abi"))
{
flag_new_abi = 1;
flag_do_squangling = 1;
}
else if (!strcmp (p, "no-new-abi"))
{
flag_new_abi = 0;
flag_do_squangling = 0;
}
else if (!strncmp (p, "template-depth-", 15))
{
char *endp = p + 15;

View File

@ -2047,7 +2047,11 @@ do_build_copy_constructor (fndecl)
parm = TREE_CHAIN (parm);
parm = convert_from_reference (parm);
if (TYPE_HAS_TRIVIAL_INIT_REF (current_class_type))
if (TYPE_HAS_TRIVIAL_INIT_REF (current_class_type)
&& is_empty_class (current_class_type))
/* Don't copy the padding byte; it might not have been allocated
if *this is a base subobject. */;
else if (TYPE_HAS_TRIVIAL_INIT_REF (current_class_type))
{
t = build (INIT_EXPR, void_type_node, current_class_ref, parm);
TREE_SIDE_EFFECTS (t) = 1;
@ -2159,7 +2163,11 @@ do_build_assign_ref (fndecl)
parm = convert_from_reference (parm);
if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type))
if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type)
&& is_empty_class (current_class_type))
/* Don't copy the padding byte; it might not have been allocated
if *this is a base subobject. */;
else if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type))
{
tree t = build (MODIFY_EXPR, void_type_node, current_class_ref, parm);
TREE_SIDE_EFFECTS (t) = 1;