From 52ffd86eb62d0320ccf64138e5d7d37ab7a6f7c5 Mon Sep 17 00:00:00 2001 From: Mike Stump Date: Thu, 18 May 2006 18:22:12 +0000 Subject: Fix up vla, vm and [*] sematics. PR c/18740 PR c/7948 PR c/25802 * c-tree.h (struct c_arg_info): Add had_vla_unspec. (c_vla_unspec_p): Add. (c_vla_type_p): Add. * c-decl.c (struct c_scope): Add had_vla_unspec. (build_array_declarator): Add support for [*]. (grokdeclarator): Likewise. (grokparms): Likewise. (get_parm_info): Likewise. * c-objc-common.c (c_vla_unspec_p): Likewise. * c-objc-common.h (LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P): Likewise. * c-parser.c (c_parser_typeof_specifier): Evaluate arguments to typeof when argument is a variably modified type not inside sizeof or alignof. (c_parser_direct_declarator_inner): Propagate errors. (c_parser_sizeof_expression): Add support for [*]. * c-typeck.c (c_vla_type_p): Add. (composite_type): Add support for vla compositing. (comptypes_internal): Add support for vla compatibility. (c_expr_sizeof_expr): Evaluate vla arguments. * tree.c (variably_modified_type_p): Update comment for [*]. testsuite: * gcc.dg/c90-arraydecl-1.c: Update for vla, vm [*] fixups. * gcc.dg/vla-4.c: Add. * gcc.dg/vla-5.c: Add. * gcc.dg/vla-6.c: Add. From-SVN: r113888 --- gcc/testsuite/gcc.dg/c90-arraydecl-1.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'gcc/testsuite/gcc.dg/c90-arraydecl-1.c') diff --git a/gcc/testsuite/gcc.dg/c90-arraydecl-1.c b/gcc/testsuite/gcc.dg/c90-arraydecl-1.c index 47334b9..97dc1ee 100644 --- a/gcc/testsuite/gcc.dg/c90-arraydecl-1.c +++ b/gcc/testsuite/gcc.dg/c90-arraydecl-1.c @@ -9,23 +9,22 @@ that we get just one error and no warnings. */ void foo0 (int a, int b[*]); /* { dg-error "ISO C90" "\[*\] not in C90" } */ -/* { dg-warning "implement" "\[*\] not implemented" { target *-*-* } 11 } */ void foo1 (int, int [*]); /* { dg-error "ISO C90" "\[*\] not in C90" } */ -/* { dg-warning "implement" "\[*\] not implemented" { target *-*-* } 13 } */ +/* { dg-error "allowed" "\'\[*\]\' not allowed in other than a declaration" { target *-*-* } 12 } */ /* Use of static and type qualifiers (not allowed with abstract declarators) is a C99 feature. */ void bar0 (int a[const]); /* { dg-bogus "warning" "warning in place of error" } */ -/* { dg-error "ISO C90" "\[quals\] not in C90" { target *-*-* } 19 } */ +/* { dg-error "ISO C90" "\[quals\] not in C90" { target *-*-* } 18 } */ void bar1 (int a[const 2]); /* { dg-bogus "warning" "warning in place of error" } */ -/* { dg-error "ISO C90" "\[quals expr\] not in C90" { target *-*-* } 21 } */ +/* { dg-error "ISO C90" "\[quals expr\] not in C90" { target *-*-* } 20 } */ void bar2 (int a[static 2]); /* { dg-bogus "warning" "warning in place of error" } */ -/* { dg-error "ISO C90" "\[static expr\] not in C90" { target *-*-* } 23 } */ +/* { dg-error "ISO C90" "\[static expr\] not in C90" { target *-*-* } 22 } */ void bar3 (int a[static const 2]); /* { dg-bogus "warning" "warning in place of error" } */ -/* { dg-error "ISO C90" "\[static quals expr\] not in C90" { target *-*-* } 25 } */ +/* { dg-error "ISO C90" "\[static quals expr\] not in C90" { target *-*-* } 24 } */ void bar4 (int a[const static 2]); /* { dg-bogus "warning" "warning in place of error" } */ -/* { dg-error "ISO C90" "\[quals static expr\] not in C90" { target *-*-* } 27 } */ +/* { dg-error "ISO C90" "\[quals static expr\] not in C90" { target *-*-* } 26 } */ /* Because [*] isn't properly implemented and so warns, we don't test here for [const *] yet. */ -- cgit v1.1