mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-10 06:09:29 +08:00
20000926-1.c: Update expected warnings.
* gcc.dg/20000926-1.c: Update expected warnings. * gcc.dg/array-2.c: Likewise. * gcc.dg/array-4.c: Also validate flexible array members. * gcc.dg/c99-flex-array-1.c: New. From-SVN: r38704
This commit is contained in:
parent
69f6e760a8
commit
00de56c7d0
@ -1,3 +1,10 @@
|
||||
2001-01-04 Richard Henderson <rth@redhat.com>
|
||||
|
||||
* gcc.dg/20000926-1.c: Update expected warnings.
|
||||
* gcc.dg/array-2.c: Likewise.
|
||||
* gcc.dg/array-4.c: Also validate flexible array members.
|
||||
* gcc.dg/c99-flex-array-1.c: New.
|
||||
|
||||
2001-01-04 Joseph S. Myers <jsm28@cam.ac.uk>
|
||||
|
||||
* gcc.c-torture/compile/20001222-1.x: Remove.
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* Copyright (C) 2000 Free Software Foundation.
|
||||
|
||||
by William Cohen <wcohen@redhat.com> */
|
||||
|
||||
/* { dg-do compile } */
|
||||
@ -23,5 +22,5 @@ struct PLAYBOOK playbook =
|
||||
"BookName",
|
||||
{
|
||||
{ 1, "PName0" },
|
||||
}
|
||||
} /* { dg-warning "(deprecated initialization)|(near initialization)" "" } */
|
||||
};
|
||||
|
@ -1,10 +1,13 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "" } */
|
||||
/* { dg-options "-w" } */
|
||||
|
||||
/* Verify that we can't do things to get ourselves in trouble
|
||||
with GCC's zero-length array extension. */
|
||||
with GCC's initialized flexible array member extension. */
|
||||
|
||||
struct f { int w; int x[0]; };
|
||||
struct f { int w; int x[]; };
|
||||
struct g { struct f f; };
|
||||
struct g g1 = { { 0, { } } };
|
||||
struct g g2 = { { 0, { 1 } } }; /* { dg-error "(nested structure)|(near initialization)" "nested" } */
|
||||
struct g g2 = { { 0, { 1 } } }; /* { dg-error "(nested context)|(near initialization)" "nested" } */
|
||||
|
||||
struct h { int x[0]; int y; };
|
||||
struct h h1 = { { 0 }, 1 }; /* { dg-error "(before end)|(near initialization)" "before end" } */
|
||||
|
@ -1,13 +1,19 @@
|
||||
/* { dg-do run } */
|
||||
/* { dg-options "" } */
|
||||
|
||||
/* Verify that GCC's extension to initialize a zero-length array
|
||||
member works properly. */
|
||||
/* Verify that GCC's initialized flexible array member extension
|
||||
works properly. */
|
||||
|
||||
extern void abort(void);
|
||||
extern void exit(int);
|
||||
|
||||
struct f { int w; int x[0]; } f = { 4, { 0, 1, 2, 3 } };
|
||||
struct f { int w; int x[]; };
|
||||
struct g { int w; int x[0]; };
|
||||
|
||||
static struct f f = { 4, { 0, 1, 2, 3 } };
|
||||
static int junk1[] = { -1, -1, -1, -1 };
|
||||
static struct g g = { 4, { 0, 1, 2, 3 } }; /* { dg-warning "(deprecated initialization)|(near initialization)" "" } */
|
||||
static int junk2[] = { -1, -1, -1, -1 };
|
||||
|
||||
int main()
|
||||
{
|
||||
@ -15,5 +21,8 @@ int main()
|
||||
for (i = 0; i < f.w; ++i)
|
||||
if (f.x[i] != i)
|
||||
abort ();
|
||||
for (i = 0; i < g.w; ++i)
|
||||
if (g.x[i] != i)
|
||||
abort ();
|
||||
exit(0);
|
||||
}
|
||||
|
8
gcc/testsuite/gcc.dg/c99-flex-array-1.c
Normal file
8
gcc/testsuite/gcc.dg/c99-flex-array-1.c
Normal file
@ -0,0 +1,8 @@
|
||||
/* Test for invalid uses of flexible array members. */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
|
||||
|
||||
struct s1 { int x[]; }; /* { dg-error "empty struct" "empty" } */
|
||||
struct s2 { int :1; int x[]; }; /* { dg-error "empty struct" "empty" } */
|
||||
struct s3 { int x[]; int y; }; /* { dg-error "not at end" "not at end" } */
|
||||
struct s4 { int x; int y[]; };
|
Loading…
Reference in New Issue
Block a user