aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-09-29 19:45:32 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2017-09-29 19:45:32 +0200
commit7d386d45085cbe472089a8df4a2f033d9d5999a5 (patch)
tree7fde43d4b5e2b75bed04151a1e9b955665eb7325 /gcc/c-family
parent9129a561984472bfc7a076742ac7e3ee9117c197 (diff)
downloadgcc-7d386d45085cbe472089a8df4a2f033d9d5999a5.zip
gcc-7d386d45085cbe472089a8df4a2f033d9d5999a5.tar.gz
gcc-7d386d45085cbe472089a8df4a2f033d9d5999a5.tar.bz2
c-attribs.c (handle_packed_attribute): Test DECL_C_BIT_FIELD rather than DECL_INITIAL.
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. From-SVN: r253301
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog6
-rw-r--r--gcc/c-family/c-attribs.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 32f8727..6a9137f 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,9 @@
+2017-09-29 Jakub Jelinek <jakub@redhat.com>
+
+ * c-attribs.c (handle_packed_attribute): Test DECL_C_BIT_FIELD
+ rather than DECL_INITIAL.
+ (common_handle_aligned_attribute): Likewise.
+
2017-09-20 Alexandre Oliva <aoliva@redhat.com>
* c.opt (gen-decls): Add RejectNegative.
diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c
index 0337537..1821d3e 100644
--- a/gcc/c-family/c-attribs.c
+++ b/gcc/c-family/c-attribs.c
@@ -426,7 +426,7 @@ handle_packed_attribute (tree *node, tree name, tree ARG_UNUSED (args),
{
if (TYPE_ALIGN (TREE_TYPE (*node)) <= BITS_PER_UNIT
/* Still pack bitfields. */
- && ! DECL_INITIAL (*node))
+ && ! DECL_C_BIT_FIELD (*node))
warning (OPT_Wattributes,
"%qE attribute ignored for field of type %qT",
name, TREE_TYPE (*node));
@@ -1773,7 +1773,7 @@ common_handle_aligned_attribute (tree *node, tree args, int flags,
{
if (warn_if_not_aligned_p)
{
- if (TREE_CODE (decl) == FIELD_DECL && !DECL_INITIAL (decl))
+ if (TREE_CODE (decl) == FIELD_DECL && !DECL_C_BIT_FIELD (decl))
{
SET_DECL_WARN_IF_NOT_ALIGN (decl, (1U << i) * BITS_PER_UNIT);
warn_if_not_aligned_p = false;