Message ID | 2aff3854-915c-47ba-b672-15a5c639c87e@gmail.com |
---|---|
State | New |
Headers | show |
Series | [doc] attribute packed does not apply to variables | expand |
On 10/11/18 9:03 PM, Martin Sebor wrote: > The manual says that: > > The packed attribute specifies that a variable or structure > field should have the smallest possible alignment--one byte > for a variable, and one bit for a field... > > The variable part doesn't actually reflect reality: GCC and all > other compilers I tested ignore the attribute with a warning on > non-member objects, and only honor it on members. > > The part that reads "and one bit for a field" is also incorrect: > it most likely meant to say bit-field. > > The attached change fixes both of these issues. > > Martin > > gcc-doc-attr-packed.diff > > gcc/ChangeLog: > > * doc/extend.texi (attribute packed): Correct typos. OK. jeff
On 10/11/18, Martin Sebor <msebor@gmail.com> wrote: > The manual says that: > > The packed attribute specifies that a variable or structure > field should have the smallest possible alignment--one byte > for a variable, and one bit for a field... > > The variable part doesn't actually reflect reality: GCC and all > other compilers I tested ignore the attribute with a warning on > non-member objects, and only honor it on members. > > The part that reads "and one bit for a field" is also incorrect: > it most likely meant to say bit-field. > > The attached change fixes both of these issues. > > Martin > The word "one" is duplicated in there: "one one" should be just "one"
On 10/11/2018 10:43 PM, Eric Gallager wrote: > On 10/11/18, Martin Sebor <msebor@gmail.com> wrote: >> The manual says that: >> >> The packed attribute specifies that a variable or structure >> field should have the smallest possible alignment--one byte >> for a variable, and one bit for a field... >> >> The variable part doesn't actually reflect reality: GCC and all >> other compilers I tested ignore the attribute with a warning on >> non-member objects, and only honor it on members. >> >> The part that reads "and one bit for a field" is also incorrect: >> it most likely meant to say bit-field. >> >> The attached change fixes both of these issues. >> >> Martin >> > > The word "one" is duplicated in there: "one one" should be just "one" Yes, thanks. I spotted it last night just before committing and removed it. Martin
gcc/ChangeLog: * doc/extend.texi (attribute packed): Correct typos. Index: gcc/doc/extend.texi =================================================================== --- gcc/doc/extend.texi (revision 265073) +++ gcc/doc/extend.texi (working copy) @@ -6220,13 +6220,13 @@ int f (struct Data *pd, const char *s) @item packed @cindex @code{packed} variable attribute -The @code{packed} attribute specifies that a variable or structure field -should have the smallest possible alignment---one byte for a variable, -and one bit for a field, unless you specify a larger value with the -@code{aligned} attribute. +The @code{packed} attribute specifies that a structure member should have +the smallest possible alignment---one one bit for a bit-field and one byte +otherwise, unless a larger value is specified with the @code{aligned} +attribute. The attribute does not apply to non-member objects. -Here is a structure in which the field @code{x} is packed, so that it -immediately follows @code{a}: +For example in the structure below, the member array @code{x} is packed +so that it immediately follows @code{a} with no intervening padding: @smallexample struct foo