c-common.c (decl_attributes): Set DECL_SIZE_UNIT.

* c-common.c (decl_attributes): Set DECL_SIZE_UNIT.
	* c-decl.c (duplicate_decls, finish_enum): Likewise.
	(finish_decl): Remove -Wlarger-than code from here.
	* flags.h (id_clash_len): Now int.
	(larger_than_size): Now HOST_WIDE_INT.
	* fold-const.c (size_int_wide): No more HIGH parm; NUMBER is signed.
	Clean up checking to see if in table.
	(make_bit_field_ref): Remove extra parm to bitsize_int.
	* ggc-common.c (ggc_mark_tree_children): Mark DECL_SIZE_UNIT.
	* print-tree.c (print_node): Print DECL_SIZE_UNIT and TYPE_SIZE_UNIT.
	* stmt.c (expand_decl): Use DECL_SIZE_UNIT for stack checking size
	and for computing size of decl.
	* stor-layout.c (layout_decl): Set DECL_SIZE_UNIT.
	Move -Wlarger-than code to here.
	(layout_record): Remove extra arg to bitsize_int.
	Set TYPE_BINFO_SIZE_UNIT.
	(layout_union): Remove extra arg to bitsize_int.
	Use proper type for size of QUAL_UNION.
	(layout_type): Remove extra arg to bitsize_int.
	* toplev.c (id_clash_len): Now int.
	(larger_than_size): Now HOST_WIDE_INT.
	(decode_W_option): Clean up id-clash and larger-than- cases.
	* tree.c (get_identifier, maybe_get_identifier): Remove unneeded casts.
	(expr_align, case FUNCTION_DECL): DECL_ALIGN is not defined.
	* tree.h (BINFO_SIZE_UNIT, TYPE_BINFO_SIZE_UNIT, DECL_SIZE_UNIT): New.
	(struct tree_decl): New field size_unit.
	(size_int_wide): No HIGH operand; NUMBER is now signed.
	(size_int_2): Deleted.
	(size_int, bitsize_int): Don't use it and rework args.
	* varasm.c (assemble_variable, output_constructor): Use DECL_SIZE_UNIT.
	* ch/decl.c (layout_enum): Set DECL_SIZE_UNIT.
	* ch/satisfy.c (safe_satisfy_decl): Likewise.
	* cp/class.c (build_primary_vtable, layout_vtable_decl): Likewise.
	(avoid_overlap, build_base_field): Likewise.
	(build_base_field, build_base_fields, is_empty_class):
	Test DECL_SIZE with integer_zero.
	(layout_class_type): Set CLASSTYPE_SIZE_UNIT.
	* cp/cp-tree.h (struct lang_type): New field size_unit.
	(CLASSTYPE_SIZE_UNIT): New macro.
	* cp/decl.c (init_decl_processing): Set DECL_SIZE_UNIT.
	(cp_finish_decl): Delete -Wlarger-than processing.
	* cp/optimize.c (remap_decl): Walk DECL_SIZE_UNIT.
	* cp/pt.c (tsubst_decl): Set DECL_SIZE_UNIT.
	* cp/tree.c (make_binfo): binfo vector is one entry longer.
	(walk_tree): Walk DECL_SIZE_UNIT.
	* f/com.c (ffecom_sym_transform): Use DECL_SIZE_UNIT.
	(ffecom_transform_common_, ffecom_transform_equiv_): Likewise.
	(duplicate_decls): Likewise.
	(ffecom_tree_canonize_ptr_): Delete extra arg to bitsize_int.
	(finish_decl): Delete -Wlarger-than processing.
	* java/class.c (build_class_ref, push_super_field): Set DECL_SIZE_UNIT.
	* java/constants.c (build_constants_constructor): Likewise.

From-SVN: r32070
This commit is contained in:
Richard Kenner 2000-02-19 22:49:14 -05:00
parent 7d52ae23dc
commit 4559fd9eee
2 changed files with 21 additions and 27 deletions

View File

@ -1,5 +1,6 @@
/* Expands front end tree to back end RTL for GNU C-Compiler
Copyright (C) 1987, 88, 89, 92-99, 2000 Free Software Foundation, Inc.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU CC.
@ -3768,11 +3769,11 @@ expand_decl (decl)
/ BITS_PER_UNIT));
}
else if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST
else if (TREE_CODE (DECL_SIZE_UNIT (decl)) == INTEGER_CST
&& ! (flag_stack_check && ! STACK_CHECK_BUILTIN
&& (TREE_INT_CST_HIGH (DECL_SIZE (decl)) != 0
|| (TREE_INT_CST_LOW (DECL_SIZE (decl))
> STACK_CHECK_MAX_VAR_SIZE * BITS_PER_UNIT))))
&& (TREE_INT_CST_HIGH (DECL_SIZE_UNIT (decl)) != 0
|| (TREE_INT_CST_LOW (DECL_SIZE_UNIT (decl))
> STACK_CHECK_MAX_VAR_SIZE))))
{
/* Variable of fixed size that goes on the stack. */
rtx oldaddr = 0;
@ -3842,10 +3843,7 @@ expand_decl (decl)
const0_rtx, VOIDmode, 0);
/* Compute the variable's size, in bytes. */
size = expand_expr (size_binop (CEIL_DIV_EXPR,
DECL_SIZE (decl),
size_int (BITS_PER_UNIT)),
NULL_RTX, VOIDmode, 0);
size = expand_expr (DECL_SIZE_UNIT (decl), NULL_RTX, VOIDmode, 0);
free_temp_slots ();
/* Allocate space on the stack for the variable. Note that

View File

@ -1,5 +1,6 @@
/* Top level of GNU C compiler
Copyright (C) 1987, 88, 89, 92-98, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000 Free Software Foundation, Inc.
This file is part of GNU CC.
@ -1224,14 +1225,14 @@ int warn_cast_align;
characters. The value N is in `id_clash_len'. */
int warn_id_clash;
unsigned id_clash_len;
int id_clash_len;
/* Nonzero means warn about any objects definitions whose size is larger
than N bytes. Also want about function definitions whose returned
values are larger than N bytes. The value N is in `larger_than_size'. */
int warn_larger_than;
unsigned larger_than_size;
HOST_WIDE_INT larger_than_size;
/* Nonzero means warn if inline function is too large. */
@ -4094,8 +4095,8 @@ decode_f_option (arg)
else if (!strncmp (arg, "align-loops=", 12))
align_loops = read_integral_parameter (arg + 12, arg - 2, align_loops);
else if (!strncmp (arg, "align-functions=", 16))
align_functions =
read_integral_parameter (arg + 16, arg - 2, align_functions);
align_functions
= read_integral_parameter (arg + 16, arg - 2, align_functions);
else if (!strncmp (arg, "align-jumps=", 12))
align_jumps = read_integral_parameter (arg + 12, arg - 2, align_jumps);
else if (!strncmp (arg, "align-labels=", 13))
@ -4132,6 +4133,7 @@ decode_f_option (arg)
/* Parse a -W... comand line switch. ARG is the value after the -W.
It is safe to access 'ARG - 2' to generate the full switch name.
Return the number of strings consumed. */
static int
decode_W_option (arg)
const char * arg;
@ -4158,23 +4160,17 @@ decode_W_option (arg)
if (!strncmp (arg, "id-clash-", 9))
{
const int id_clash_val = read_integral_parameter (arg + 9, arg - 2, -1);
id_clash_len = read_integral_parameter (arg + 9, arg - 2, -1);
if (id_clash_val != -1)
{
id_clash_len = id_clash_val;
warn_id_clash = 1;
}
if (id_clash_len != -1)
warn_id_clash = 1;
}
else if (!strncmp (arg, "larger-than-", 12))
{
const int larger_than_val =
read_integral_parameter (arg + 12, arg - 2, -1);
if (larger_than_val != -1)
{
larger_than_size = larger_than_val;
warn_larger_than = 1;
}
larger_than_size = read_integral_parameter (arg + 12, arg - 2, -1);
if (larger_than_size != -1)
warn_larger_than = 1;
}
else
return 0;