aboutsummaryrefslogtreecommitdiff
path: root/contrib/gcc/stor-layout.c
diff options
context:
space:
mode:
authorAlexander Kabaev <kan@FreeBSD.org>2002-09-01 20:38:57 +0000
committerAlexander Kabaev <kan@FreeBSD.org>2002-09-01 20:38:57 +0000
commitbb3c979bf518abbe971bd277250c68a3ec567b59 (patch)
treec6857d31c36dbd89a881b0229bf38b062797d413 /contrib/gcc/stor-layout.c
parent00db7afddd93b9febd88ed0a8567dc3201852b70 (diff)
downloadsrc-bb3c979bf518abbe971bd277250c68a3ec567b59.tar.gz
src-bb3c979bf518abbe971bd277250c68a3ec567b59.zip
Gcc 3.2.1-prerelease from the FSF anoncvs repo gcc-3_2-branch on 1-Sep-2002 00:00:01 EDT.
Notes
Notes: svn path=/vendor/gcc/dist/; revision=102780
Diffstat (limited to 'contrib/gcc/stor-layout.c')
-rw-r--r--contrib/gcc/stor-layout.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/contrib/gcc/stor-layout.c b/contrib/gcc/stor-layout.c
index 2db46754838b..c330fb615103 100644
--- a/contrib/gcc/stor-layout.c
+++ b/contrib/gcc/stor-layout.c
@@ -669,7 +669,8 @@ place_union_field (rli, field)
#endif
#ifdef ADJUST_FIELD_ALIGN
- desired_align = ADJUST_FIELD_ALIGN (field, desired_align);
+ if (! DECL_USER_ALIGN (field))
+ desired_align = ADJUST_FIELD_ALIGN (field, desired_align);
#endif
TYPE_USER_ALIGN (rli->t) |= DECL_USER_ALIGN (field);
@@ -683,10 +684,15 @@ place_union_field (rli, field)
entire union to have `int' alignment. */
if (PCC_BITFIELD_TYPE_MATTERS && DECL_BIT_FIELD_TYPE (field))
{
- rli->record_align = MAX (rli->record_align,
- TYPE_ALIGN (TREE_TYPE (field)));
- rli->unpadded_align = MAX (rli->unpadded_align,
- TYPE_ALIGN (TREE_TYPE (field)));
+ unsigned int type_align = TYPE_ALIGN (TREE_TYPE (field));
+
+#ifdef ADJUST_FIELD_ALIGN
+ if (! TYPE_USER_ALIGN (TREE_TYPE (field)))
+ type_align = ADJUST_FIELD_ALIGN (field, type_align);
+#endif
+ rli->record_align = MAX (rli->record_align, type_align);
+ rli->unpadded_align = MAX (rli->unpadded_align, type_align);
+ TYPE_USER_ALIGN (rli->t) |= TYPE_USER_ALIGN (TREE_TYPE (field));
}
#endif
@@ -783,7 +789,8 @@ place_field (rli, field)
#endif
#ifdef ADJUST_FIELD_ALIGN
- desired_align = ADJUST_FIELD_ALIGN (field, desired_align);
+ if (! user_align)
+ desired_align = ADJUST_FIELD_ALIGN (field, desired_align);
#endif
/* Record must have at least as much alignment as any field.
@@ -827,6 +834,11 @@ place_field (rli, field)
{
unsigned int type_align = TYPE_ALIGN (type);
+#ifdef ADJUST_FIELD_ALIGN
+ if (! TYPE_USER_ALIGN (type))
+ type_align = ADJUST_FIELD_ALIGN (field, type_align);
+#endif
+
if (maximum_field_alignment != 0)
type_align = MIN (type_align, maximum_field_alignment);
else if (DECL_PACKED (field))
@@ -836,6 +848,7 @@ place_field (rli, field)
rli->unpadded_align = MAX (rli->unpadded_align, DECL_ALIGN (field));
if (warn_packed)
rli->unpacked_align = MAX (rli->unpacked_align, TYPE_ALIGN (type));
+ user_align |= TYPE_USER_ALIGN (type);
}
}
else
@@ -915,6 +928,11 @@ place_field (rli, field)
HOST_WIDE_INT offset = tree_low_cst (rli->offset, 0);
HOST_WIDE_INT bit_offset = tree_low_cst (rli->bitpos, 0);
+#ifdef ADJUST_FIELD_ALIGN
+ if (! TYPE_USER_ALIGN (type))
+ type_align = ADJUST_FIELD_ALIGN (field, type_align);
+#endif
+
/* A bit field may not span more units of alignment of its type
than its type itself. Advance to next boundary if necessary. */
if ((((offset * BITS_PER_UNIT + bit_offset + field_size +
@@ -923,6 +941,8 @@ place_field (rli, field)
- (offset * BITS_PER_UNIT + bit_offset) / type_align)
> tree_low_cst (TYPE_SIZE (type), 1) / type_align)
rli->bitpos = round_up (rli->bitpos, type_align);
+
+ user_align |= TYPE_USER_ALIGN (type);
}
#endif
@@ -944,6 +964,11 @@ place_field (rli, field)
HOST_WIDE_INT offset = tree_low_cst (rli->offset, 0);
HOST_WIDE_INT bit_offset = tree_low_cst (rli->bitpos, 0);
+#ifdef ADJUST_FIELD_ALIGN
+ if (! TYPE_USER_ALIGN (type))
+ type_align = ADJUST_FIELD_ALIGN (field, type_align);
+#endif
+
if (maximum_field_alignment != 0)
type_align = MIN (type_align, maximum_field_alignment);
/* ??? This test is opposite the test in the containing if
@@ -959,6 +984,8 @@ place_field (rli, field)
!= ((offset * BITS_PER_UNIT + bit_offset + field_size - 1)
/ type_align))
rli->bitpos = round_up (rli->bitpos, type_align);
+
+ user_align |= TYPE_USER_ALIGN (type);
}
#endif