[PATCH] extend attribute((packed)) warnings
Jan Beulich
JBeulich@novell.com
Fri Jan 6 12:30:00 GMT 2006
On targets with default structure packing, with -fpack-struct, or
inside
#pragma pack blocks warnings on pointless uses of the packed attribute
were
not always warned about.
Bootstrapped and tested on x86_64-unknown-linux-gnu and
i686-pc-linux-gnu,
and built and tested for i686-novell-netware built on
i686-pc-linux-gnu.
2006-01-06 Jan Beulich <jbeulich@novell.com>
* c-common.c (handle_packed_attribute): Also warn when #pragma
pack
is in effect.
---
/home/jbeulich/src/gcc/trunk/2006-01-04/gcc/c-common.c 2006-01-04
18:25:56.000000000 +0100
+++ 2006-01-04/gcc/c-common.c 2006-01-05 08:04:46.377079736 +0100
@@ -4051,7 +4051,10 @@ handle_packed_attribute (tree *node, tre
}
else if (TREE_CODE (*node) == FIELD_DECL)
{
- if (TYPE_ALIGN (TREE_TYPE (*node)) <= BITS_PER_UNIT)
+ if (maximum_field_alignment != 0
+ && maximum_field_alignment <= BITS_PER_UNIT)
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
+ else if (TYPE_ALIGN (TREE_TYPE (*node)) <= BITS_PER_UNIT)
warning (OPT_Wattributes,
"%qE attribute ignored for field of type %qT",
name, TREE_TYPE (*node));
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gcc-trunk-warn-packed-attribute.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20060106/e572c0af/attachment.ksh>
More information about the Gcc-patches
mailing list