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:
parent
64cdc38350
commit
2d1b5436c8
@ -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,
|
||||
|
@ -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",
|
||||
|
12
gcc/testsuite/gcc.dg/c90-vla-1.c
Normal file
12
gcc/testsuite/gcc.dg/c90-vla-1.c
Normal 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;
|
||||
}
|
12
gcc/testsuite/gcc.dg/c99-vla-1.c
Normal file
12
gcc/testsuite/gcc.dg/c99-vla-1.c
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user