summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/anon-struct-1.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-15 19:07:01 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-15 19:07:01 +0000
commitafb3d3c49fad6249e0b85722105326e9031d9475 (patch)
tree58437182e5b92c32014bc05c7c720abea38f88b9 /gcc/testsuite/gcc.dg/anon-struct-1.c
parenta107223431e030ac4b0e41c1f956ae43a63a5aa5 (diff)
downloadgcc-afb3d3c49fad6249e0b85722105326e9031d9475.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159439 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/anon-struct-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/anon-struct-1.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/testsuite/gcc.dg/anon-struct-1.c b/gcc/testsuite/gcc.dg/anon-struct-1.c
index 587d59d7220..c599fa5669b 100644
--- a/gcc/testsuite/gcc.dg/anon-struct-1.c
+++ b/gcc/testsuite/gcc.dg/anon-struct-1.c
@@ -1,4 +1,4 @@
-/* { dg-options "-std=iso9899:1990" } */
+/* { dg-options "-std=iso9899:1990 -pedantic" } */
/* In strict ISO C mode, we don't recognize the anonymous struct/union
extension or any Microsoft extensions. */
@@ -21,10 +21,10 @@ char testD[sizeof(struct D) == sizeof(struct A) ? 1 : -1];
/* GNU extension. */
struct E {
- struct { char z; }; /* { dg-warning "does not declare anything" } */
+ struct { char z; }; /* { dg-warning "unnamed structs" } */
char e;
};
-char testE[sizeof(struct E) == sizeof(struct A) ? 1 : -1];
+
/* MS extension. */
typedef struct A typedef_A;
@@ -49,8 +49,8 @@ char testH[sizeof(struct H) == 2 * sizeof(struct A) ? 1 : -1];
/* Make sure __extension__ gets turned back off. */
struct I {
- struct { char z; }; /* { dg-warning "does not declare anything" } */
+ struct { char z; }; /* { dg-warning "unnamed structs" } */
char i;
};
-char testI[sizeof(struct I) == sizeof(struct A) ? 1 : -1];
+char testI[sizeof(struct I) == sizeof(struct E) ? 1 : -1];