aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2000-02-29 02:34:48 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2000-02-28 21:34:48 -0500
commit9df2c88cf7ee9be1a279bf7e1fc032b77d9bb56f (patch)
tree9d32681a03d3ca309091c1dee14f1053a1621f84 /gcc/c-decl.c
parentc27ba9120aa6d7a4477315f359088ea7e4267bd3 (diff)
downloadgcc-9df2c88cf7ee9be1a279bf7e1fc032b77d9bb56f.zip
gcc-9df2c88cf7ee9be1a279bf7e1fc032b77d9bb56f.tar.gz
gcc-9df2c88cf7ee9be1a279bf7e1fc032b77d9bb56f.tar.bz2
* Eliminate DECL_FIELD_SIZE.
* builtins.c (built_in_class_names, built_in_names): New variables. * c-decl.c (finish_struct): Set specified size in DECL_SIZE. * expr.c (expand_expr, case COMPONENT_REF): Get field size from DECL_SIZE, not DECL_FIELD_SIZE. * print-tree.c (print_node): Remove code that prints extra blank lines in some cases. Properly handle inline and builtin function cases. * stor-layout.c (layout_decl): Get specified size from DEC_SIZE. * tree.h (built_in_class_named, built_in_names): New declarations. (union tree_decl): Rename internal unions to u1 and u2 and change some of their components. Add new field built_in_class. (DECL_ALIGN, DECL_INCOMING_RTL, DECL_SAVED_INSNS, DECL_FRAME_SIZE): Reflect above changes. (DECL_FUNCTION_CODE, DECL_BUILT_IN_CLASS): Likewise. (DECL_SET_FUNCTION_CODE, DECL_FIELD_SIZE): Deleted. * objc/objc-act.c (objc_copy_list): Use DECL_SIZE, not DECL_FIELD_SIZE. (encode_field_decl): Likewise; also remove obsolete test for bitfield. * ch/ch-tree.h (DECL_ACTION_NESTING_LEVEL): Use new tree union name. * ch/decl.c (finish_struct): Don't clear DECL_FIELD_SIZE. * ch/typeck.c (make_chill_struct_type): Likewise. (apply_decl_field_layout): General cleanup. Set DECL_SIZE instead of DECL_FIELD_SIZE. * cp/class.c (build_vtbl_or_vbase_field, check_methods): Don't clear DECL_FIELD_SIZE. (check_bitfield_decl, check_field_decls): Set DECL_SIZE, not DECL_FIELD_SIZE. * cp/rtti.c (expand_class_desc): Likewise. * cp/cp-tree.h (DECL_INIT_PRIORITY): Use underlying union name. (THUNK_VCALL_OFFSET): Likewise. (THUNK_DELTA): Reflect changes in ../tree.h. * java/java-tree.h (LABEL_PC): Relect name changes in ../tree.h. (DECL_BIT_INDEX): Use underlying representation. * java/parse.h (DECL_INHERITED_SOURCE_LINE): Likewise. From-SVN: r32249
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 8308fc7..24c7c24 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -5117,9 +5117,7 @@ finish_struct (t, fieldlist, attributes)
}
/* Install struct as DECL_CONTEXT of each field decl.
- Also process specified field sizes.
- Set DECL_FIELD_SIZE to the specified size, or 0 if none specified.
- The specified size is found in the DECL_INITIAL.
+ Also process specified field sizes,m which is found in the DECL_INITIAL.
Store 0 there, except for ": 0" fields (so we can find them
and delete them, below). */
@@ -5127,7 +5125,6 @@ finish_struct (t, fieldlist, attributes)
{
DECL_CONTEXT (x) = t;
DECL_PACKED (x) |= TYPE_PACKED (t);
- DECL_FIELD_SIZE (x) = 0;
/* If any field is const, the structure type is pseudo-const. */
if (TREE_READONLY (x))
@@ -5166,7 +5163,8 @@ finish_struct (t, fieldlist, attributes)
constant_expression_warning (DECL_INITIAL (x));
else
{
- error_with_decl (x, "bit-field `%s' width not an integer constant");
+ error_with_decl (x,
+ "bit-field `%s' width not an integer constant");
DECL_INITIAL (x) = NULL;
}
}
@@ -5179,6 +5177,7 @@ finish_struct (t, fieldlist, attributes)
error_with_decl (x, "bit-field `%s' has invalid type");
DECL_INITIAL (x) = NULL;
}
+
if (DECL_INITIAL (x) && pedantic
&& TYPE_MAIN_VARIANT (TREE_TYPE (x)) != integer_type_node
&& TYPE_MAIN_VARIANT (TREE_TYPE (x)) != unsigned_type_node
@@ -5191,20 +5190,19 @@ finish_struct (t, fieldlist, attributes)
/* Detect and ignore out of range field width. */
if (DECL_INITIAL (x))
{
- unsigned HOST_WIDE_INT width = TREE_INT_CST_LOW (DECL_INITIAL (x));
-
if (tree_int_cst_sgn (DECL_INITIAL (x)) < 0)
{
DECL_INITIAL (x) = NULL;
error_with_decl (x, "negative width in bit-field `%s'");
}
else if (TREE_INT_CST_HIGH (DECL_INITIAL (x)) != 0
- || width > TYPE_PRECISION (TREE_TYPE (x)))
+ || (TREE_INT_CST_LOW (DECL_INITIAL (x))
+ > TYPE_PRECISION (TREE_TYPE (x))))
{
DECL_INITIAL (x) = NULL;
pedwarn_with_decl (x, "width of `%s' exceeds its type");
}
- else if (width == 0 && DECL_NAME (x) != 0)
+ else if (integer_zerop (DECL_INITIAL (x)) && DECL_NAME (x) != 0)
{
error_with_decl (x, "zero width for bit-field `%s'");
DECL_INITIAL (x) = NULL;
@@ -5223,7 +5221,7 @@ finish_struct (t, fieldlist, attributes)
TREE_UNSIGNED (TREE_TYPE (x)))))
warning_with_decl (x, "`%s' is narrower than values of its type");
- DECL_FIELD_SIZE (x) = width;
+ DECL_SIZE (x) = bitsize_int (width);
DECL_BIT_FIELD (x) = DECL_C_BIT_FIELD (x) = 1;
DECL_INITIAL (x) = NULL;
@@ -5243,7 +5241,8 @@ finish_struct (t, fieldlist, attributes)
else if (TREE_TYPE (x) != error_mark_node)
{
unsigned int min_align = (DECL_PACKED (x) ? BITS_PER_UNIT
- : TYPE_ALIGN (TREE_TYPE (x)));
+ : TYPE_ALIGN (TREE_TYPE (x)));
+
/* Non-bit-fields are aligned for their type, except packed
fields which require only BITS_PER_UNIT alignment. */
DECL_ALIGN (x) = MAX (DECL_ALIGN (x), min_align);