diff options
author | Martin Sebor <msebor@redhat.com> | 2016-01-26 17:44:38 +0000 |
---|---|---|
committer | Martin Sebor <msebor@gcc.gnu.org> | 2016-01-26 10:44:38 -0700 |
commit | 2a4dfe66dac91a0f60c5864996df61e2a5ad625b (patch) | |
tree | 65861c0d1f4e515379c3501e59423f679942870f /gcc | |
parent | ffc445f48618c0bdd51146e9a59cdc5c293f24ec (diff) | |
download | gcc-2a4dfe66dac91a0f60c5864996df61e2a5ad625b.zip gcc-2a4dfe66dac91a0f60c5864996df61e2a5ad625b.tar.gz gcc-2a4dfe66dac91a0f60c5864996df61e2a5ad625b.tar.bz2 |
PR other/69477 - attribute aligned documentation misleading
gcc/ChangeLog:
2016-01-26 Martin Sebor <msebor@redhat.com>
PR other/69477
* doc/extend.texi (Common Type Attributes): Move text that talks about
attribute packed from attribute aligned to the section discussing
the former attribute for clarity.
From-SVN: r232840
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/doc/extend.texi | 66 |
2 files changed, 40 insertions, 33 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fef8cfe..98716c0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-01-26 Martin Sebor <msebor@redhat.com> + + PR other/69477 + * doc/extend.texi (Common Type Attributes): Move text that talks about + attribute packed from attribute aligned to the section discussing + the former attribute for clarity. + 2016-01-26 Richard Henderson <rth@redhat.com> PR middle-end/60908 diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index c18324d..a1c36f5 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -6307,9 +6307,6 @@ relevant type, and the code that the compiler generates for these pointer arithmetic operations is often more efficient for efficiently-aligned types than for other types. -The @code{aligned} attribute can only increase the alignment; but you -can decrease it by specifying @code{packed} as well. See below. - Note that the effectiveness of @code{aligned} attributes may be limited by inherent limitations in your linker. On many systems, the linker is only able to arrange for variables to be aligned up to a certain maximum @@ -6319,36 +6316,8 @@ up to a maximum of 8-byte alignment, then specifying @code{aligned(16)} in an @code{__attribute__} still only provides you with 8-byte alignment. See your linker documentation for further information. -@opindex fshort-enums -Specifying this attribute for @code{struct} and @code{union} types is -equivalent to specifying the @code{packed} attribute on each of the -structure or union members. Specifying the @option{-fshort-enums} -flag on the line is equivalent to specifying the @code{packed} -attribute on all @code{enum} definitions. - -In the following example @code{struct my_packed_struct}'s members are -packed closely together, but the internal layout of its @code{s} member -is not packed---to do that, @code{struct my_unpacked_struct} needs to -be packed too. - -@smallexample -struct my_unpacked_struct - @{ - char c; - int i; - @}; - -struct __attribute__ ((__packed__)) my_packed_struct - @{ - char c; - int i; - struct my_unpacked_struct s; - @}; -@end smallexample - -You may only specify this attribute on the definition of an @code{enum}, -@code{struct} or @code{union}, not on a @code{typedef} that does not -also define the enumerated type, structure or union. +The @code{aligned} attribute can only increase alignment. Alignment +can be decreased by specifying the @code{packed} attribute. See below. @item bnd_variable_size @cindex @code{bnd_variable_size} type attribute @@ -6476,6 +6445,37 @@ of the structure or union is placed to minimize the memory required. When attached to an @code{enum} definition, it indicates that the smallest integral type should be used. +@opindex fshort-enums +Specifying the @code{packed} attribute for @code{struct} and @code{union} +types is equivalent to specifying the @code{packed} attribute on each +of the structure or union members. Specifying the @option{-fshort-enums} +flag on the command line is equivalent to specifying the @code{packed} +attribute on all @code{enum} definitions. + +In the following example @code{struct my_packed_struct}'s members are +packed closely together, but the internal layout of its @code{s} member +is not packed---to do that, @code{struct my_unpacked_struct} needs to +be packed too. + +@smallexample +struct my_unpacked_struct + @{ + char c; + int i; + @}; + +struct __attribute__ ((__packed__)) my_packed_struct + @{ + char c; + int i; + struct my_unpacked_struct s; + @}; +@end smallexample + +You may only specify the @code{packed} attribute attribute on the definition +of an @code{enum}, @code{struct} or @code{union}, not on a @code{typedef} +that does not also define the enumerated type, structure or union. + @item scalar_storage_order ("@var{endianness}") @cindex @code{scalar_storage_order} type attribute When attached to a @code{union} or a @code{struct}, this attribute sets |