diff options
author | DJ Delorie <dj@redhat.com> | 2001-09-20 20:27:59 -0400 |
---|---|---|
committer | DJ Delorie <dj@gcc.gnu.org> | 2001-09-20 20:27:59 -0400 |
commit | e7b6a0ee34197334228ed9185ebaf84d5b975110 (patch) | |
tree | 367fe25e25603ec8574df8960ea2e634f886da63 /gcc/testsuite | |
parent | f5aee6316d591598ac8574b47b79fa35e10bca2c (diff) | |
download | gcc-e7b6a0ee34197334228ed9185ebaf84d5b975110.zip gcc-e7b6a0ee34197334228ed9185ebaf84d5b975110.tar.gz gcc-e7b6a0ee34197334228ed9185ebaf84d5b975110.tar.bz2 |
c-typeck.c (really_start_incremental_init): Discriminate between zero-length arrays and flexible arrays.
* c-typeck.c (really_start_incremental_init): Discriminate
between zero-length arrays and flexible arrays.
(push_init_level): Detect zero-length arrays and handle them
like fixed-sized arrays.
* expr.c (store_constructor): Handle zero-length arrays and
flexible arrays correctly.
* doc/extend.texi: Update zero-length array notes.
* gcc.dg/20000926-1.c: Update expected warning messages.
* gcc.dg/array-2.c: Likewise, and test for warnings too.
* gcc.dg/array-4.c: Likewise, and don't verify the zero-length
array.
From-SVN: r45714
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/20000926-1.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/array-2.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/array-4.c | 5 |
4 files changed, 12 insertions, 8 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7f28c4c..16d4816 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2001-09-20 DJ Delorie <dj@redhat.com> + + * gcc.dg/20000926-1.c: Update expected warning messages. + * gcc.dg/array-2.c: Likewise, and test for warnings too. + * gcc.dg/array-4.c: Likewise, and don't verify the zero-length + array. + 2001-09-18 Richard Sandiford <rsandifo@redhat.com> * g++.dg/eh/registers1.C: New test case. diff --git a/gcc/testsuite/gcc.dg/20000926-1.c b/gcc/testsuite/gcc.dg/20000926-1.c index 223714d..2f5ca10 100644 --- a/gcc/testsuite/gcc.dg/20000926-1.c +++ b/gcc/testsuite/gcc.dg/20000926-1.c @@ -22,6 +22,6 @@ struct PLAYBOOK playbook = { "BookName", { - { 1, "PName0" }, - } /* { dg-warning "(deprecated initialization)|(near initialization)" "" } */ + { 1, "PName0" }, /* { dg-warning "(excess elements)|(near initialization)" "" } */ + } }; diff --git a/gcc/testsuite/gcc.dg/array-2.c b/gcc/testsuite/gcc.dg/array-2.c index dbf1733..06c753f 100644 --- a/gcc/testsuite/gcc.dg/array-2.c +++ b/gcc/testsuite/gcc.dg/array-2.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-w" } */ +/* { dg-options "" } */ /* Verify that we can't do things to get ourselves in trouble with GCC's initialized flexible array member extension. */ @@ -10,4 +10,4 @@ struct g g1 = { { 0, { } } }; 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" } */ +struct h h1 = { { 0 }, 1 }; /* { dg-error "(excess elements)|(near initialization)" "before end" } */ diff --git a/gcc/testsuite/gcc.dg/array-4.c b/gcc/testsuite/gcc.dg/array-4.c index 52ad921..b3e4f6c 100644 --- a/gcc/testsuite/gcc.dg/array-4.c +++ b/gcc/testsuite/gcc.dg/array-4.c @@ -12,7 +12,7 @@ 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 struct g g = { 4, { 0, 1, 2, 3 } }; /* { dg-warning "(excess elements)|(near initialization)" "" } */ static int junk2[] = { -1, -1, -1, -1 }; int main() @@ -21,8 +21,5 @@ 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); } |