Commit 2d1b5436 by Richard Henderson Committed by Richard Henderson

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
parent 64cdc383
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",
......
/* 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;
}
/* 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment