c-decl.c (grokdeclarator): Don't pedwarn variable sized arrays for c99.

* c-decl.c (grokdeclarator): Don't pedwarn variable sized arrays
        for c99.

	* gcc.dg/c90-vla-1.c, gcc.dg/c99-vla-1.c: New.

From-SVN: r52738
This commit is contained in:
Richard Henderson 2002-04-24 15:26:10 -07:00 committed by Richard Henderson
parent 64cdc38350
commit 2d1b5436c8
4 changed files with 31 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2002-04-24 Richard Henderson <rth@redhat.com>
PR c/3467
* c-decl.c (grokdeclarator): Don't pedwarn variable sized arrays
for c99.
Wed Apr 24 21:51:54 2002 J"orn Rennecke <joern.rennecke@superh.com>
* sh.c (sh_va_arg): If argument was passed by reference,

View File

@ -4381,7 +4381,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
even if it is (eg) a const variable with known value. */
size_varies = 1;
if (pedantic)
if (!flag_isoc99 && pedantic)
{
if (TREE_CONSTANT (size))
pedwarn ("ISO C89 forbids array `%s' whose size can't be evaluated",

View File

@ -0,0 +1,12 @@
/* Origin: PR 3467 */
/* { dg-do compile } */
/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
void
tdef (int n)
{
typedef int A[n]; /* { dg-error "forbids variable-size array" } */
A a;
A *p;
p = &a;
}

View File

@ -0,0 +1,12 @@
/* Origin: PR 3467 */
/* { dg-do compile } */
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
void
tdef (int n)
{
typedef int A[n]; /* { dg-bogus "forbids variable-size array" } */
A a;
A *p;
p = &a;
}