diff options
author | Joseph Myers <joseph@codesourcery.com> | 2010-05-15 20:07:01 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2010-05-15 20:07:01 +0100 |
commit | 4bdd0a60b27aa25d23cc19e4ab23163edf1a363b (patch) | |
tree | 58437182e5b92c32014bc05c7c720abea38f88b9 /gcc/doc | |
parent | d025732d199d5fda6718e4e52661ae027421a5b4 (diff) | |
download | gcc-4bdd0a60b27aa25d23cc19e4ab23163edf1a363b.zip gcc-4bdd0a60b27aa25d23cc19e4ab23163edf1a363b.tar.gz gcc-4bdd0a60b27aa25d23cc19e4ab23163edf1a363b.tar.bz2 |
c-decl.c (grokfield): Allow typedefs for anonymous structs and unions by default if...
* c-decl.c (grokfield): Allow typedefs for anonymous structs and
unions by default if those structs and unions have no tags. Do
not condition anonymous struct and unions handling on flag_iso.
Allow anonymous structs and unions for C1X.
(finish_struct): Do not diagnose lack of named fields when
anonymous structs and unions present for C1X. Accept flexible
array members in structure with anonymous structs or unions but no
directly named fields.
* doc/extend.texi (Unnamed Fields): Update.
testsuite:
* gcc.dg/c1x-anon-struct-1.c, gcc.dg/c1x-anon-struct-2.c,
gcc.dg/c90-anon-struct-1.c, gcc.dg/c99-anon-struct-1.c: New tests.
* gcc.dg/20080820.c, gcc.dg/anon-struct-1.c: Update expected
diagnostics and type sizes.
From-SVN: r159439
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/extend.texi | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 7a495eb..d141b14 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -12727,7 +12727,8 @@ versions earlier than 4.4. @cindex struct @cindex union -For compatibility with other compilers, GCC allows you to define +As permitted by ISO C1X and for compatibility with other compilers, +GCC allows you to define a structure or union that contains, as fields, structures and unions without names. For example: @@ -12765,11 +12766,12 @@ The compiler gives errors for such constructs. @opindex fms-extensions Unless @option{-fms-extensions} is used, the unnamed field must be a structure or union definition without a tag (for example, @samp{struct -@{ int a; @};}). If @option{-fms-extensions} is used, the field may +@{ int a; @};}), or a @code{typedef} name for such a structure or +union. If @option{-fms-extensions} is used, the field may also be a definition with a tag such as @samp{struct foo @{ int a; @};}, a reference to a previously defined structure or union such as @samp{struct foo;}, or a reference to a @code{typedef} name for a -previously defined structure or union type. +previously defined structure or union type with a tag. @node Thread-Local @section Thread-Local Storage |