aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1998-04-02 17:05:40 +0000
committerJason Merrill <jason@gcc.gnu.org>1998-04-02 12:05:40 -0500
commit0b41abe6683830ae22978f43f085a59094f5b062 (patch)
treef67814ae050184ae320900c9fcd616df3f0aede9 /gcc/cp
parentc098677bed45c310170a0bc8b6056b78c6cc6b9b (diff)
downloadgcc-0b41abe6683830ae22978f43f085a59094f5b062.zip
gcc-0b41abe6683830ae22978f43f085a59094f5b062.tar.gz
gcc-0b41abe6683830ae22978f43f085a59094f5b062.tar.bz2
cp-tree.h: Lose CLASSTYPE_VBASE_SIZE, some unused stuff.
* cp-tree.h: Lose CLASSTYPE_VBASE_SIZE, some unused stuff. * decl.c, decl2.c, pt.c, ptree.c, lex.c: Likewise. * class.c (duplicate_tag_error): Likewise. (finish_struct_1): Set CLASSTYPE_SIZE, CLASSTYPE_MODE, CLASSTYPE_ALIGN. * tree.c (layout_vbasetypes): Update from layout_record, remove var_size support, use CLASSTYPE_SIZE instead of CLASSTYPE_VBASE_SIZE. (layout_basetypes): Likewise. From-SVN: r18965
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog10
-rw-r--r--gcc/cp/class.c26
-rw-r--r--gcc/cp/cp-tree.h90
-rw-r--r--gcc/cp/decl.c37
-rw-r--r--gcc/cp/decl2.c4
-rw-r--r--gcc/cp/lex.c1
-rw-r--r--gcc/cp/pt.c1
-rw-r--r--gcc/cp/ptree.c6
-rw-r--r--gcc/cp/tree.c110
9 files changed, 90 insertions, 195 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 53c12ae..3de389d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,13 @@
+Thu Apr 2 14:25:13 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cp-tree.h: Lose CLASSTYPE_VBASE_SIZE, some unused stuff.
+ * decl.c, decl2.c, pt.c, ptree.c, lex.c: Likewise.
+ * class.c (duplicate_tag_error): Likewise.
+ (finish_struct_1): Set CLASSTYPE_SIZE, CLASSTYPE_MODE, CLASSTYPE_ALIGN.
+ * tree.c (layout_vbasetypes): Update from layout_record, remove
+ var_size support, use CLASSTYPE_SIZE instead of CLASSTYPE_VBASE_SIZE.
+ (layout_basetypes): Likewise.
+
Wed Apr 1 18:22:25 1998 Jeffrey A Law (law@cygnus.com)
* class.c, Make sure system.h is included just after config.h.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 6f0fcba..3559c04 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -1846,12 +1846,7 @@ finish_struct_bits (t, max_has_virtual)
{
basetype = BINFO_TYPE (TREE_VEC_ELT (binfos, i));
- if (TYPE_HAS_CONVERSION (basetype))
- {
- TYPE_HAS_CONVERSION (t) = 1;
- TYPE_HAS_INT_CONVERSION (t) |= TYPE_HAS_INT_CONVERSION (basetype);
- TYPE_HAS_REAL_CONVERSION (t) |= TYPE_HAS_REAL_CONVERSION (basetype);
- }
+ TYPE_HAS_CONVERSION (t) |= TYPE_HAS_CONVERSION (basetype);
if (CLASSTYPE_MAX_DEPTH (basetype) >= CLASSTYPE_MAX_DEPTH (t))
CLASSTYPE_MAX_DEPTH (t) = CLASSTYPE_MAX_DEPTH (basetype) + 1;
}
@@ -2005,18 +2000,7 @@ finish_struct_methods (t, fn_fields, nonprivate_method)
}
}
else if (IDENTIFIER_TYPENAME_P (fn_name))
- {
- tree return_type = TREE_TYPE (TREE_TYPE (fn_fields));
-
- if (typecode_p (return_type, INTEGER_TYPE)
- || typecode_p (return_type, BOOLEAN_TYPE)
- || typecode_p (return_type, ENUMERAL_TYPE))
- TYPE_HAS_INT_CONVERSION (t) = 1;
- else if (typecode_p (return_type, REAL_TYPE))
- TYPE_HAS_REAL_CONVERSION (t) = 1;
-
- grow_method (fn_fields, &method_vec);
- }
+ grow_method (fn_fields, &method_vec);
}
fn_fields = save_fn_fields;
@@ -2159,7 +2143,6 @@ duplicate_tag_error (t)
CLASSTYPE_BINFO_AS_LIST (t) = binfo_as_list;
CLASSTYPE_INTERFACE_ONLY (t) = interface_only;
SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, interface_unknown);
- CLASSTYPE_VBASE_SIZE (t) = integer_zero_node;
TYPE_REDEFINED (t) = 1;
}
TYPE_SIZE (t) = NULL_TREE;
@@ -3931,6 +3914,11 @@ finish_struct_1 (t, warn_anon)
layout_type (t);
+ /* Remember the size, mode and alignment of the class before adding
+ the virtual bases. */
+ CLASSTYPE_SIZE (t) = TYPE_SIZE (t);
+ CLASSTYPE_ALIGN (t) = TYPE_ALIGN (t);
+
finish_struct_anon (t);
if (n_baseclasses || empty)
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 2aa090d..25749d3 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -420,63 +420,56 @@ struct lang_type
struct
{
unsigned has_type_conversion : 1;
- unsigned has_int_conversion : 1;
- unsigned has_float_conversion : 1;
unsigned has_init_ref : 1;
- unsigned gets_init_aggr : 1;
unsigned has_assignment : 1;
unsigned has_default_ctor : 1;
unsigned uses_multiple_inheritance : 1;
-
- unsigned has_nonpublic_ctor : 2;
- unsigned has_nonpublic_assign_ref : 2;
unsigned const_needs_init : 1;
unsigned ref_needs_init : 1;
unsigned has_const_assign_ref : 1;
- unsigned vtable_needs_writing : 1;
+ unsigned has_nonpublic_ctor : 2;
+ unsigned has_nonpublic_assign_ref : 2;
+ unsigned vtable_needs_writing : 1;
unsigned has_assign_ref : 1;
unsigned gets_new : 2;
+
unsigned gets_delete : 2;
unsigned has_call_overloaded : 1;
unsigned has_array_ref_overloaded : 1;
unsigned has_arrow_overloaded : 1;
-
unsigned local_typedecls : 1;
unsigned interface_only : 1;
unsigned interface_unknown : 1;
+
unsigned needs_virtual_reinit : 1;
unsigned vec_delete_takes_size : 1;
unsigned declared_class : 1;
unsigned being_defined : 1;
unsigned redefined : 1;
-
- unsigned no_globalize : 1;
unsigned marked : 1;
unsigned marked2 : 1;
unsigned marked3 : 1;
+
unsigned marked4 : 1;
unsigned marked5 : 1;
unsigned marked6 : 1;
unsigned debug_requested : 1;
-
unsigned use_template : 2;
- unsigned has_method_call_overloaded : 1;
- unsigned private_attr : 1;
unsigned got_semicolon : 1;
unsigned ptrmemfunc_flag : 1;
+
unsigned is_signature : 1;
unsigned is_signature_pointer : 1;
-
unsigned is_signature_reference : 1;
unsigned has_opaque_typedecls : 1;
unsigned sigtable_has_been_generated : 1;
unsigned was_anonymous : 1;
unsigned has_real_assignment : 1;
unsigned has_real_assign_ref : 1;
+
unsigned has_const_init_ref : 1;
unsigned has_complex_init_ref : 1;
-
unsigned has_complex_assign_ref : 1;
unsigned has_abstract_assign_ref : 1;
unsigned non_aggregate : 1;
@@ -484,39 +477,30 @@ struct lang_type
/* The MIPS compiler gets it wrong if this struct also
does not fill out to a multiple of 4 bytes. Add a
member `dummy' with new bits if you go over the edge. */
- unsigned dummy : 21;
-
- unsigned n_vancestors : 16;
+ unsigned dummy : 11;
} type_flags;
+#ifdef MI_MATRIX
int cid;
+#endif
int n_ancestors;
+ int n_vancestors;
int vsize;
int max_depth;
int vfield_parent;
- union tree_node *vbinfo[2];
union tree_node *baselink_vec;
union tree_node *vfields;
union tree_node *vbases;
- union tree_node *vbase_size;
union tree_node *tags;
char *memoized_table_entry;
union tree_node *search_slot;
-#ifdef ONLY_INT_FIELDS
- unsigned int mode : 8;
-#else
- enum machine_mode mode : 8;
-#endif
-
- unsigned char size_unit;
unsigned char align;
- unsigned char sep_unit;
+ /* Room for another three unsigned chars. */
- union tree_node *sep;
union tree_node *size;
union tree_node *base_init_list;
@@ -526,7 +510,9 @@ struct lang_type
union tree_node *binfo_as_list;
union tree_node *friend_classes;
+#ifdef MI_MATRIX
char *mi_matrix;
+#endif
union tree_node *rtti;
@@ -580,21 +566,10 @@ struct lang_type
/* Nonzero for TREE_LIST or _TYPE node means that this node is class-local. */
#define TREE_NONLOCAL_FLAG(NODE) (TREE_LANG_FLAG_0 (NODE))
-/* Nonzero for a _CLASSTYPE node which we know to be private. */
-#define TYPE_PRIVATE_P(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.private_attr)
-
/* Nonzero means that this _CLASSTYPE node defines ways of converting
itself to other types. */
#define TYPE_HAS_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_type_conversion)
-/* Nonzero means that this _CLASSTYPE node can convert itself to an
- INTEGER_TYPE. */
-#define TYPE_HAS_INT_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_int_conversion)
-
-/* Nonzero means that this _CLASSTYPE node can convert itself to an
- REAL_TYPE. */
-#define TYPE_HAS_REAL_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_float_conversion)
-
/* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */
#define TYPE_HAS_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_assign_ref)
#define TYPE_HAS_CONST_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_const_assign_ref)
@@ -603,11 +578,6 @@ struct lang_type
#define TYPE_HAS_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_init_ref)
#define TYPE_HAS_CONST_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_const_init_ref)
-/* Nonzero means that this _CLASSTYPE node has an X(X ...) constructor.
- Note that there must be other arguments, or this constructor is flagged
- as being erroneous. */
-#define TYPE_GETS_INIT_AGGR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_init_aggr)
-
/* Nonzero means that this type is being defined. I.e., the left brace
starting the definition of this type has been seen. */
#define TYPE_BEING_DEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.being_defined)
@@ -742,7 +712,7 @@ struct lang_type
large a multiple-inheritance matrix we need to build to find
derivation information. */
#define CLASSTYPE_N_SUPERCLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->n_ancestors)
-#define CLASSTYPE_N_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.n_vancestors)
+#define CLASSTYPE_N_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->n_vancestors)
/* Record how deep the inheritance is for this class so `void*' conversions
are less favorable than a conversion to the most base type. */
@@ -757,20 +727,17 @@ struct lang_type
it can mean almost anything. */
#define CLASSTYPE_MTABLE_ENTRY(NODE) (TYPE_LANG_SPECIFIC(NODE)->memoized_table_entry)
-/* This is the total size of the baseclasses defined for this type.
- Needed because it is desirable to layout such information
- before beginning to process the class itself, and we
- don't want to compute it second time when actually laying
- out the type for real. */
+/* These are the size, mode and alignment of the type without its
+ virtual base classes, for when we use this type as a base itself.
+
+ CLASSTYPE_SIZE is also used during finish_struct_1 to remember the total
+ size of the baseclasses defined for the type. We do this because it is
+ desirable to layout such information before beginning to process the
+ class itself, and we don't want to compute it second time when actually
+ laying out the type for real. */
#define CLASSTYPE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->size)
-#define CLASSTYPE_SIZE_UNIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->size_unit)
-#define CLASSTYPE_MODE(NODE) (TYPE_LANG_SPECIFIC(NODE)->mode)
#define CLASSTYPE_ALIGN(NODE) (TYPE_LANG_SPECIFIC(NODE)->align)
-/* This is the space needed for virtual base classes. NULL if
- there are no virtual basetypes. */
-#define CLASSTYPE_VBASE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->vbase_size)
-
/* A cons list of structure elements which either have constructors
to be called, or virtual function table pointers which
need initializing. Depending on what is being initialized,
@@ -827,14 +794,14 @@ struct lang_type
/* A list of class types with which this type is a friend. */
#define CLASSTYPE_FRIEND_CLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->friend_classes)
+#ifdef MI_MATRIX
/* Keep an inheritance lattice around so we can quickly tell whether
a type is derived from another or not. */
#define CLASSTYPE_MI_MATRIX(NODE) (TYPE_LANG_SPECIFIC(NODE)->mi_matrix)
+#endif
/* Say whether this node was declared as a "class" or a "struct". */
#define CLASSTYPE_DECLARED_CLASS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.declared_class)
-/* whether this can be globalized. */
-#define CLASSTYPE_NO_GLOBALIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.no_globalize)
/* Nonzero if this class has const members which have no specified initialization. */
#define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.const_needs_init)
@@ -858,18 +825,17 @@ struct lang_type
/* Additional macros for inheritance information. */
-#define CLASSTYPE_VBINFO(NODE,VIA_PUBLIC) \
- (TYPE_LANG_SPECIFIC (NODE)->vbinfo[VIA_PUBLIC])
-
/* When following an binfo-specific chain, this is the cumulative
via-public flag. */
#define BINFO_VIA_PUBLIC(NODE) TREE_LANG_FLAG_5 (NODE)
+#ifdef MI_MATRIX
/* When building a matrix to determine by a single lookup
whether one class is derived from another or not,
this field is the index of the class in the table. */
#define CLASSTYPE_CID(NODE) (TYPE_LANG_SPECIFIC(NODE)->cid)
#define BINFO_CID(NODE) CLASSTYPE_CID(BINFO_TYPE(NODE))
+#endif
/* Nonzero means marked by DFS or BFS search, including searches
by `get_binfo' and `get_base_distance'. */
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 6d0e574..3a75da7 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -10372,32 +10372,23 @@ grok_ctor_properties (ctype, decl)
}
if (TREE_CODE (parmtype) == REFERENCE_TYPE
- && TYPE_MAIN_VARIANT (TREE_TYPE (parmtype)) == ctype)
- {
- if (TREE_CHAIN (parmtypes) == NULL_TREE
+ && TYPE_MAIN_VARIANT (TREE_TYPE (parmtype)) == ctype
+ && (TREE_CHAIN (parmtypes) == NULL_TREE
|| TREE_CHAIN (parmtypes) == void_list_node
- || TREE_PURPOSE (TREE_CHAIN (parmtypes)))
- {
- TYPE_HAS_INIT_REF (ctype) = 1;
- if (TYPE_READONLY (TREE_TYPE (parmtype)))
- TYPE_HAS_CONST_INIT_REF (ctype) = 1;
- }
- else
- TYPE_GETS_INIT_AGGR (ctype) = 1;
+ || TREE_PURPOSE (TREE_CHAIN (parmtypes))))
+ {
+ TYPE_HAS_INIT_REF (ctype) = 1;
+ if (TYPE_READONLY (TREE_TYPE (parmtype)))
+ TYPE_HAS_CONST_INIT_REF (ctype) = 1;
}
- else if (TYPE_MAIN_VARIANT (parmtype) == ctype)
+ else if (TYPE_MAIN_VARIANT (parmtype) == ctype
+ && TREE_CHAIN (parmtypes) != NULL_TREE
+ && TREE_CHAIN (parmtypes) == void_list_node)
{
- if (TREE_CHAIN (parmtypes) != NULL_TREE
- && TREE_CHAIN (parmtypes) == void_list_node)
- {
- cp_error ("invalid constructor; you probably meant `%T (const %T&)'",
- ctype, ctype);
- SET_IDENTIFIER_ERROR_LOCUS (DECL_NAME (decl), ctype);
-
- return 0;
- }
- else
- TYPE_GETS_INIT_AGGR (ctype) = 1;
+ cp_error ("invalid constructor; you probably meant `%T (const %T&)'",
+ ctype, ctype);
+ SET_IDENTIFIER_ERROR_LOCUS (DECL_NAME (decl), ctype);
+ return 0;
}
else if (TREE_CODE (parmtype) == VOID_TYPE
|| TREE_PURPOSE (parmtypes) != NULL_TREE)
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 7e3994b..8340f09 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -853,8 +853,6 @@ grok_x_components (specs, components)
tcode = signature_type_node;
t = xref_tag (tcode, TYPE_IDENTIFIER (t), NULL_TREE, 0);
- if (TYPE_CONTEXT (t))
- CLASSTYPE_NO_GLOBALIZE (t) = 1;
return NULL_TREE;
break;
@@ -866,8 +864,6 @@ grok_x_components (specs, components)
tcode = enum_type_node;
t = xref_tag (tcode, TYPE_IDENTIFIER (t), NULL_TREE, 0);
- if (TREE_CODE (t) == UNION_TYPE && TYPE_CONTEXT (t))
- CLASSTYPE_NO_GLOBALIZE (t) = 1;
if (TREE_CODE (t) == UNION_TYPE
&& ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
{
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 04021ae..9d724a5 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -4442,7 +4442,6 @@ make_lang_type (code)
CLASSTYPE_AS_LIST (t) = build_expr_list (NULL_TREE, t);
SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, interface_unknown);
CLASSTYPE_INTERFACE_ONLY (t) = interface_only;
- CLASSTYPE_VBASE_SIZE (t) = integer_zero_node;
TYPE_BINFO (t) = make_binfo (integer_zero_node, t, NULL_TREE, NULL_TREE,
NULL_TREE);
CLASSTYPE_BINFO_AS_LIST (t) = build_tree_list (NULL_TREE, TYPE_BINFO (t));
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 640d8e7..1c632f7 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -3432,7 +3432,6 @@ instantiate_class_template (type)
TYPE_HAS_ABSTRACT_ASSIGN_REF (type) = TYPE_HAS_ABSTRACT_ASSIGN_REF (pattern);
TYPE_HAS_INIT_REF (type) = TYPE_HAS_INIT_REF (pattern);
TYPE_HAS_CONST_INIT_REF (type) = TYPE_HAS_CONST_INIT_REF (pattern);
- TYPE_GETS_INIT_AGGR (type) = TYPE_GETS_INIT_AGGR (pattern);
TYPE_HAS_DEFAULT_CONSTRUCTOR (type) = TYPE_HAS_DEFAULT_CONSTRUCTOR (pattern);
TYPE_HAS_CONVERSION (type) = TYPE_HAS_CONVERSION (pattern);
TYPE_USES_COMPLEX_INHERITANCE (type)
diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c
index dc91cda..fffcddd 100644
--- a/gcc/cp/ptree.c
+++ b/gcc/cp/ptree.c
@@ -95,10 +95,6 @@ print_lang_type (file, node, indent)
fputs (" X()", file);
if (TYPE_HAS_CONVERSION (node))
fputs (" has-type-conversion", file);
- if (TYPE_HAS_INT_CONVERSION (node))
- fputs (" has-int-conversion", file);
- if (TYPE_HAS_REAL_CONVERSION (node))
- fputs (" has-float-conversion", file);
if (TYPE_HAS_INIT_REF (node))
{
if (TYPE_HAS_CONST_INIT_REF (node))
@@ -118,8 +114,6 @@ print_lang_type (file, node, indent)
fputs (" has=", file);
if (TYPE_HAS_ASSIGN_REF (node))
fputs (" this=(X&)", file);
- if (TYPE_GETS_INIT_AGGR (node))
- fputs (" gets X(X, ...)", file);
if (TYPE_OVERLOADS_CALL_EXPR (node))
fputs (" op()", file);
if (TYPE_OVERLOADS_ARRAY_REF (node))
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index edd3d03..2f6dbe6 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -639,28 +639,23 @@ layout_vbasetypes (rec, max)
The TREE_VALUE slot holds the virtual baseclass type. */
tree vbase_types = get_vbase_types (rec);
-#ifdef STRUCTURE_SIZE_BOUNDARY
- unsigned int record_align = MAX (STRUCTURE_SIZE_BOUNDARY, TYPE_ALIGN (rec));
-#else
unsigned int record_align = MAX (BITS_PER_UNIT, TYPE_ALIGN (rec));
-#endif
unsigned int desired_align;
- /* Record size so far is CONST_SIZE + VAR_SIZE bits,
- where CONST_SIZE is an integer
- and VAR_SIZE is a tree expression.
- If VAR_SIZE is null, the size is just CONST_SIZE.
- Naturally we try to avoid using VAR_SIZE. */
+ /* Record size so far is CONST_SIZE bits, where CONST_SIZE is an integer. */
register unsigned int const_size = 0;
- register tree var_size = 0;
unsigned int nonvirtual_const_size;
+#ifdef STRUCTURE_SIZE_BOUNDARY
+ /* Packed structures don't need to have minimum size. */
+ if (! TYPE_PACKED (rec))
+ record_align = MAX (record_align, STRUCTURE_SIZE_BOUNDARY);
+#endif
+
CLASSTYPE_VBASECLASSES (rec) = vbase_types;
- if (TREE_CODE (TYPE_SIZE (rec)) == INTEGER_CST)
- const_size = TREE_INT_CST_LOW (TYPE_SIZE (rec));
- else
- var_size = TYPE_SIZE (rec);
+ my_friendly_assert (TREE_CODE (TYPE_SIZE (rec)) == INTEGER_CST, 19970302);
+ const_size = TREE_INT_CST_LOW (TYPE_SIZE (rec));
nonvirtual_const_size = const_size;
@@ -686,18 +681,10 @@ layout_vbasetypes (rec, max)
max = CLASSTYPE_VSIZE (basetype);
BINFO_OFFSET (vbase_types) = offset;
- if (TREE_CODE (TYPE_SIZE (basetype)) == INTEGER_CST)
- {
- /* Every virtual baseclass takes a least a UNIT, so that we can
- take it's address and get something different for each base. */
- const_size += MAX (BITS_PER_UNIT,
- TREE_INT_CST_LOW (TYPE_SIZE (basetype))
- - TREE_INT_CST_LOW (CLASSTYPE_VBASE_SIZE (basetype)));
- }
- else if (var_size == 0)
- var_size = TYPE_SIZE (basetype);
- else
- var_size = size_binop (PLUS_EXPR, var_size, TYPE_SIZE (basetype));
+ /* Every virtual baseclass takes a least a UNIT, so that we can
+ take it's address and get something different for each base. */
+ const_size += MAX (BITS_PER_UNIT,
+ TREE_INT_CST_LOW (CLASSTYPE_SIZE (basetype)));
vbase_types = TREE_CHAIN (vbase_types);
}
@@ -715,11 +702,7 @@ layout_vbasetypes (rec, max)
here, as that is for this class, without any virtual base classes. */
TYPE_ALIGN (rec) = record_align;
if (const_size != nonvirtual_const_size)
- {
- CLASSTYPE_VBASE_SIZE (rec)
- = size_int (const_size - nonvirtual_const_size);
- TYPE_SIZE (rec) = size_int (const_size);
- }
+ TYPE_SIZE (rec) = size_int (const_size);
/* Now propagate offset information throughout the lattice
under the vbase type. */
@@ -769,7 +752,7 @@ layout_vbasetypes (rec, max)
TYPE_BINFO (REC) should be NULL_TREE on entry, and this routine
creates a list of base_binfos in TYPE_BINFO (REC) from BINFOS.
- Returns list of virtual base classes in a FIELD_DECL chain. */
+ Returns list of virtual base class pointers in a FIELD_DECL chain. */
tree
layout_basetypes (rec, binfos)
@@ -778,57 +761,33 @@ layout_basetypes (rec, binfos)
/* Chain to hold all the new FIELD_DECLs which point at virtual
base classes. */
tree vbase_decls = NULL_TREE;
-
-#ifdef STRUCTURE_SIZE_BOUNDARY
- unsigned record_align = MAX (STRUCTURE_SIZE_BOUNDARY, TYPE_ALIGN (rec));
-#else
unsigned record_align = MAX (BITS_PER_UNIT, TYPE_ALIGN (rec));
-#endif
-
- /* Record size so far is CONST_SIZE + VAR_SIZE bits, where CONST_SIZE is
- an integer and VAR_SIZE is a tree expression. If VAR_SIZE is null,
- the size is just CONST_SIZE. Naturally we try to avoid using
- VAR_SIZE. And so far, we've been successful. */
-#if 0
- register tree var_size = 0;
-#endif
+ /* Record size so far is CONST_SIZE bits, where CONST_SIZE is an integer. */
register unsigned const_size = 0;
int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
+#ifdef STRUCTURE_SIZE_BOUNDARY
+ /* Packed structures don't need to have minimum size. */
+ if (! TYPE_PACKED (rec))
+ record_align = MAX (record_align, STRUCTURE_SIZE_BOUNDARY);
+#endif
+
/* Handle basetypes almost like fields, but record their
offsets differently. */
for (i = 0; i < n_baseclasses; i++)
{
- int inc, int_vbase_size;
+ int inc;
unsigned int desired_align;
register tree base_binfo = TREE_VEC_ELT (binfos, i);
register tree basetype = BINFO_TYPE (base_binfo);
tree decl, offset;
if (TYPE_SIZE (basetype) == 0)
- {
-#if 0
- /* This error is now reported in xref_tag, thus giving better
- location information. */
- error_with_aggr_type (base_binfo,
- "base class `%s' has incomplete type");
-
- TREE_VIA_PUBLIC (base_binfo) = 1;
- TREE_VIA_PROTECTED (base_binfo) = 0;
- TREE_VIA_VIRTUAL (base_binfo) = 0;
-
- /* Should handle this better so that
-
- class A;
- class B: private A { virtual void F(); };
-
- does not dump core when compiled. */
- my_friendly_abort (121);
-#endif
- continue;
- }
+ /* This error is now reported in xref_tag, thus giving better
+ location information. */
+ continue;
/* All basetypes are recorded in the association list of the
derived type. */
@@ -906,20 +865,13 @@ layout_basetypes (rec, binfos)
/* Add only the amount of storage not present in
the virtual baseclasses. */
+ inc = MAX (record_align, TREE_INT_CST_LOW (CLASSTYPE_SIZE (basetype)));
- int_vbase_size = TREE_INT_CST_LOW (CLASSTYPE_VBASE_SIZE (basetype));
- if (TREE_INT_CST_LOW (TYPE_SIZE (basetype)) > int_vbase_size)
- {
- inc = MAX (record_align,
- (TREE_INT_CST_LOW (TYPE_SIZE (basetype))
- - int_vbase_size));
-
- /* Record must have at least as much alignment as any field. */
- desired_align = TYPE_ALIGN (basetype);
- record_align = MAX (record_align, desired_align);
+ /* Record must have at least as much alignment as any field. */
+ desired_align = TYPE_ALIGN (basetype);
+ record_align = MAX (record_align, desired_align);
- const_size += inc;
- }
+ const_size += inc;
}
if (const_size)