From 9fd767c5fd2774e0fc922e1497326dc6ce3fe4a5 Mon Sep 17 00:00:00 2001 From: nemet Date: Fri, 23 Jan 2009 06:29:54 +0000 Subject: * c-decl.c (finish_struct): Move code to set DECL_PACKED after DECL_BIT_FIELD is alreay known. Also inherit packed for bitfields regardless of their type. * c-common.c (handle_packed_attribute): Don't ignore packed on bitfields. * c.opt (Wpacked-bitfield-compat): New warning option. * stor-layout.c (place_field): Warn if offset of a field changed. * doc/extend.texi (packed): Mention the ABI change. * doc/invoke.texi (-Wpacked-bitfield-compat): Document. (Warning Options): Add it to the list. cp/ * class.c (check_field_decls): Also inherit packed for bitfields regardless of their type. testsuite/ * gcc.dg/bitfld-15.c, gcc.dg/bitfld-16.c, gcc.dg/bitfld-17.c,gcc.dg/bitfld-18.c: New tests. * g++.dg/ext/bitfield2.C, g++.dg/ext/bitfield3.C, g++.dg/ext/bitfield4.C, g++.dg/ext/bitfield5.C: New tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@143584 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gcc/c-common.c') diff --git a/gcc/c-common.c b/gcc/c-common.c index 5eed1dc89e1..81992d4672f 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -5113,7 +5113,9 @@ handle_packed_attribute (tree *node, tree name, tree ARG_UNUSED (args), } else if (TREE_CODE (*node) == FIELD_DECL) { - if (TYPE_ALIGN (TREE_TYPE (*node)) <= BITS_PER_UNIT) + if (TYPE_ALIGN (TREE_TYPE (*node)) <= BITS_PER_UNIT + /* Still pack bitfields. */ + && ! DECL_INITIAL (*node)) warning (OPT_Wattributes, "%qE attribute ignored for field of type %qT", name, TREE_TYPE (*node)); -- cgit v1.2.1