diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-06-14 05:30:09 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-06-14 05:30:09 +0000 |
commit | aca14577e8d8624fdcde19eafacac16617b6b02e (patch) | |
tree | 48e491d0a3752df2f9332542b6e3fd795956e7c0 /gcc/cp/class.c | |
parent | 59420fa783ac122c63a0d4bc98c42ef0e62206a5 (diff) | |
download | gcc-aca14577e8d8624fdcde19eafacac16617b6b02e.tar.gz |
* tree.h (TYPE_USER_ALIGN, DECL_USER_ALIGN): Define.
(struct tree_type, struct tree_decl): Add user_align member.
* stor-layout.c (layout_decl): Set DECL_USER_ALIGN.
(place_union_field): If BIGGEST_FIELD_ALIGNMENT is defined
and DECL_USER_ALIGN 0, cap alignment to this value.
(place_field): Likewise.
(finalize_type_size): Set TYPE_USER_ALIGN.
(layout_type): Likewise.
(initialize_sizetypes): Likewise.
* c-common.c (decl_attributes): Set TYPE_USER_ALIGN resp.
DECL_USER_ALIGN to 1.
* c-decl.c (duplicate_decls): Set DECL_USER_ALIGN.
(xfer_tag): Set TYPE_USER_ALIGN.
(finish_struct): Set DECL_USER_ALIGN resp. TYPE_USER_ALIGN.
(finish_enum): Likewise.
* stmt.c (expand_decl): Set DECL_USER_ALIGN.
(expand_anon_union_decl): Likewise.
* tree.c (make_node): Set DECL_USER_ALIGN resp. TYPE_USER_ALIGN.
(build_index_type): Set TYPE_USER_ALIGN.
(build_range_type): Likewise.
(build_common_tree_nodes_2): Likewise.
* tm.texi (BIGGEST_FIELD_ALIGNMENT): Document the changed meaning.
ch/:
* decl.c (init_decl_processing): Set TYPE_USER_ALIGN.
(layout_enum): Set DECL_USER_ALIGN resp. TYPE_USER_ALIGN.
* typeck.c (layout_chill_range_type): Set TYPE_USER_ALIGN.
(apply_chill_field_layout): Set DECL_USER_ALIGN.
(layout_chill_struct_type): Set TYPE_USER_ALIGN.
cp/:
* class.c (build_secondary_vtable): Set DECL_USER_ALIGN.
(check_bitfield_decl, check_field_decl): Likewise.
(build_vtbl_or_vbase_field, build_base_field): Likewise.
(layout_class_type): Set DECL_USER_ALIGN resp. CLASSTYPE_USER_ALIGN.
* decl.c (record_unknown_type): Set TYPE_USER_ALIGN.
(xfer_tag, finish_enum): Likewise.
* decl2.c (finish_builtin_type): Likewise.
* init.c (init_init_processing): Likewise.
* pt.c (instantiate_class_template): Likewise.
* rtti.c (get_tinfo_decl, synthesize_tinfo_fn): Set DECL_USER_ALIGN.
* cp-tree.h (struct lang_type): Add user_align member.
(CLASSTYPE_USER_ALIGN): Define.
f/:
* com.c (ffecom_transform_common_): Set DECL_USER_ALIGN.
(ffecom_transform_equiv_, ffecom_decl_field): Likewise.
(ffecom_init_0): Set DECL_USER_ALIGN resp. TYPE_USER_ALIGN.
(duplicate_decls): Set DECL_USER_ALIGN.
java/:
* typeck.c (build_java_array_type): Set TYPE_USER_ALIGN.
* parse.y (java_complete_class): Set DECL_USER_ALIGN.
* parse.c: Rebuilt.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34541 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r-- | gcc/cp/class.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 4d9d3991e32..5d8390f2b5b 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -984,6 +984,7 @@ build_secondary_vtable (binfo, for_type) new_decl = build_vtable (for_type, name, TREE_TYPE (orig_decl)); DECL_ALIGN (new_decl) = DECL_ALIGN (orig_decl); + DECL_USER_ALIGN (new_decl) = DECL_USER_ALIGN (orig_decl); BINFO_VTABLE (binfo) = pushdecl_top_level (new_decl); #ifdef GATHER_STATISTICS @@ -3225,8 +3226,11 @@ check_bitfield_decl (field) #endif #ifdef PCC_BITFIELD_TYPE_MATTERS if (PCC_BITFIELD_TYPE_MATTERS) - DECL_ALIGN (field) = MAX (DECL_ALIGN (field), - TYPE_ALIGN (type)); + { + DECL_ALIGN (field) = MAX (DECL_ALIGN (field), + TYPE_ALIGN (type)); + DECL_USER_ALIGN (field) |= TYPE_USER_ALIGN (type); + } #endif } } @@ -3236,6 +3240,7 @@ check_bitfield_decl (field) DECL_BIT_FIELD (field) = 0; CLEAR_DECL_C_BIT_FIELD (field); DECL_ALIGN (field) = MAX (DECL_ALIGN (field), TYPE_ALIGN (type)); + DECL_USER_ALIGN (field) |= TYPE_USER_ALIGN (type); } } @@ -3326,6 +3331,8 @@ check_field_decl (field, t, cant_have_const_ctor, (DECL_PACKED (field) ? BITS_PER_UNIT : TYPE_ALIGN (TREE_TYPE (field)))); + if (! DECL_PACKED (field)) + DECL_USER_ALIGN (field) |= TYPE_USER_ALIGN (TREE_TYPE (field)); } /* Check the data members (both static and non-static), class-scoped @@ -3625,6 +3632,7 @@ build_vtbl_or_vbase_field (name, assembler_name, type, class_type, fcontext, DECL_FIELD_CONTEXT (field) = class_type; DECL_FCONTEXT (field) = fcontext; DECL_ALIGN (field) = TYPE_ALIGN (type); + DECL_USER_ALIGN (field) = TYPE_USER_ALIGN (type); /* Return it. */ return field; @@ -3844,6 +3852,7 @@ build_base_field (rli, binfo, empty_p, base_align, v) DECL_SIZE (decl) = CLASSTYPE_SIZE (basetype); DECL_SIZE_UNIT (decl) = CLASSTYPE_SIZE_UNIT (basetype); DECL_ALIGN (decl) = CLASSTYPE_ALIGN (basetype); + DECL_USER_ALIGN (decl) = CLASSTYPE_USER_ALIGN (basetype); if (! flag_new_abi) { @@ -4800,6 +4809,7 @@ layout_class_type (t, empty_p, vfuns_p, TYPE_SIZE (integer_type)); DECL_SIZE (field) = TYPE_SIZE (integer_type); DECL_ALIGN (field) = TYPE_ALIGN (integer_type); + DECL_USER_ALIGN (field) = TYPE_USER_ALIGN (integer_type); } else padding = NULL_TREE; @@ -4821,6 +4831,7 @@ layout_class_type (t, empty_p, vfuns_p, DECL_BIT_FIELD (padding_field) = 1; DECL_SIZE (padding_field) = padding; DECL_ALIGN (padding_field) = 1; + DECL_USER_ALIGN (padding_field) = 0; layout_nonempty_base_or_field (rli, padding_field, NULL_TREE, v); } } @@ -4897,6 +4908,7 @@ layout_class_type (t, empty_p, vfuns_p, } CLASSTYPE_ALIGN (t) = TYPE_ALIGN (t); + CLASSTYPE_USER_ALIGN (t) = TYPE_USER_ALIGN (t); /* Set the TYPE_DECL for this type to contain the right value for DECL_OFFSET, so that we can use it as part |