diff options
author | Sandra Loosemore <sandra@codesourcery.com> | 2018-11-15 19:50:41 -0500 |
---|---|---|
committer | Sandra Loosemore <sandra@gcc.gnu.org> | 2018-11-15 19:50:41 -0500 |
commit | 88c8c5a08c715368e4d33e518a0a3ea6d50f42ea (patch) | |
tree | 783a04f23346465b64d2394d7115270a80124e4d | |
parent | e6c6b1793baedc77291ac0b7fb1e438b389a387e (diff) | |
download | gcc-88c8c5a08c715368e4d33e518a0a3ea6d50f42ea.zip gcc-88c8c5a08c715368e4d33e518a0a3ea6d50f42ea.tar.gz gcc-88c8c5a08c715368e4d33e518a0a3ea6d50f42ea.tar.bz2 |
re PR c++/25759 (Documentation not clear, attribute packed on class in C++)
2018-11-15 Sandra Loosemore <sandra@codesourcery.com>
PR c++/25759
gcc/
* doc/extend.texi (Common Type Attributes): Make it explicit
that attribute "packed" can apply to C++ classes.
From-SVN: r266199
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/doc/extend.texi | 22 |
2 files changed, 17 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 04d2166..48e230c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-11-15 Sandra Loosemore <sandra@codesourcery.com> + + PR c++/25759 + * doc/extend.texi (Common Type Attributes): Make it explicit + that attribute "packed" can apply to C++ classes. + 2018-11-15 Martin Sebor <msebor@redhat.com> PR c++/87541 diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index d0146ba..2d00d67 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -7314,17 +7314,16 @@ or @code{__pointer__} for the mode used to represent pointers. @item packed @cindex @code{packed} type attribute -This attribute, attached to @code{struct} or @code{union} type -definition, specifies that each member (other than zero-width bit-fields) -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. +This attribute, attached to @code{struct}, @code{union}, or C++ @code{class} +type definition, specifies that each of its members (other than zero-width +bit-fields) is placed to minimize the memory required. This is equivalent +to specifying the @code{packed} attribute on each of the members. @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} +When attached to an @code{enum} definition, the @code{packed} attribute +indicates that the smallest integral type should be used. +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 @@ -7348,8 +7347,9 @@ struct __attribute__ ((__packed__)) my_packed_struct @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. +of an @code{enum}, @code{struct}, @code{union}, or @code{class}, +not on a @code{typedef} that does not also define the enumerated type, +structure, union, or class. @item scalar_storage_order ("@var{endianness}") @cindex @code{scalar_storage_order} type attribute |