summaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2017-09-29 17:45:32 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2017-09-29 17:45:32 +0000
commit52f26f82114c4bc4376627d341f61d855ec6ea0f (patch)
tree7fde43d4b5e2b75bed04151a1e9b955665eb7325 /gcc/cp/class.c
parentd5952b7ce44d11ff09399845fbbf27996733dfba (diff)
downloadgcc-52f26f82114c4bc4376627d341f61d855ec6ea0f.tar.gz
c-family/
* c-attribs.c (handle_packed_attribute): Test DECL_C_BIT_FIELD rather than DECL_INITIAL. (common_handle_aligned_attribute): Likewise. c/ * c-decl.c (grokfield): Use SET_DECL_C_BIT_FIELD here if width is non-NULL. (finish_struct): Test DECL_C_BIT_FIELD instead of DECL_INITIAL, don't SET_DECL_C_BIT_FIELD here. cp/ * class.c (check_bitfield_decl): Retrieve and clear width from DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL. (check_field_decls): Test DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL. (remove_zero_width_bit_fields): Adjust comment. * decl2.c (grokbitfield): Stash width into DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL. * pt.c (tsubst_decl): For DECL_C_BIT_FIELD, tsubst_expr DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL for width. objc/ * objc-act.c (check_ivars, gen_declaration): For OBJCPLUS look at DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253301 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r--gcc/cp/class.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 97e29c0604e..687ddaa5c8f 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -3231,12 +3231,12 @@ check_bitfield_decl (tree field)
tree w;
/* Extract the declared width of the bitfield, which has been
- temporarily stashed in DECL_INITIAL. */
- w = DECL_INITIAL (field);
+ temporarily stashed in DECL_BIT_FIELD_REPRESENTATIVE by grokbitfield. */
+ w = DECL_BIT_FIELD_REPRESENTATIVE (field);
gcc_assert (w != NULL_TREE);
/* Remove the bit-field width indicator so that the rest of the
- compiler does not treat that value as an initializer. */
- DECL_INITIAL (field) = NULL_TREE;
+ compiler does not treat that value as a qualifier. */
+ DECL_BIT_FIELD_REPRESENTATIVE (field) = NULL_TREE;
/* Detect invalid bit-field type. */
if (!INTEGRAL_OR_ENUMERATION_TYPE_P (type))
@@ -3571,7 +3571,8 @@ check_field_decls (tree t, tree *access_decls,
DECL_PACKED (x) = 1;
}
- if (DECL_C_BIT_FIELD (x) && integer_zerop (DECL_INITIAL (x)))
+ if (DECL_C_BIT_FIELD (x)
+ && integer_zerop (DECL_BIT_FIELD_REPRESENTATIVE (x)))
/* We don't treat zero-width bitfields as making a class
non-empty. */
;
@@ -5268,9 +5269,9 @@ remove_zero_width_bit_fields (tree t)
{
if (TREE_CODE (*fieldsp) == FIELD_DECL
&& DECL_C_BIT_FIELD (*fieldsp)
- /* We should not be confused by the fact that grokbitfield
+ /* We should not be confused by the fact that grokbitfield
temporarily sets the width of the bit field into
- DECL_INITIAL (*fieldsp).
+ DECL_BIT_FIELD_REPRESENTATIVE (*fieldsp).
check_bitfield_decl eventually sets DECL_SIZE (*fieldsp)
to that width. */
&& (DECL_SIZE (*fieldsp) == NULL_TREE