diff options
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/extend.texi | 6 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 23 |
2 files changed, 28 insertions, 1 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 264e88a..79a8c2e 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -3824,6 +3824,12 @@ struct foo @}; @end smallexample +@emph{Note:} The 4.1, 4.2 and 4.3 series of GCC ignore the +@code{packed} attribute on bit-fields of type @code{char}. This has +been fixed in GCC 4.4 but the change can lead to differences in the +structure layout. See the documention of +@option{-Wpacked-bitfield-compat} for more information. + @item section ("@var{section-name}") @cindex @code{section} variable attribute Normally, the compiler places the objects it generates in sections like diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index b0e274c..247782a 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -249,7 +249,7 @@ Objective-C and Objective-C++ Dialects}. -Wmissing-format-attribute -Wmissing-include-dirs @gol -Wmissing-noreturn -Wno-mudflap @gol -Wno-multichar -Wnonnull -Wno-overflow @gol --Woverlength-strings -Wpacked -Wpadded @gol +-Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol -Wpointer-arith -Wno-pointer-to-int-cast @gol -Wredundant-decls @gol @@ -3974,6 +3974,27 @@ struct bar @{ @end group @end smallexample +@item -Wpacked-bitfield-compat +@opindex Wpacked-bitfield-compat +@opindex Wno-packed-bitfield-compat +The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute +on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but +the change can lead to differences in the structure layout. GCC +informs you when the offset of such a field has changed in GCC 4.4. +For example there is no longer a 4-bit padding between field @code{a} +and @code{b} in this structure: + +@smallexample +struct foo +@{ + char a:4; + char b:8; +@} __attribute__ ((packed)); +@end smallexample + +This warning is enabled by default. Use +@option{-Wno-packed-bitfield-compat} to disable this warning. + @item -Wpadded @opindex Wpadded @opindex Wno-padded |