* config/xtensa/xtensa.c (function_arg): Generalize logic so that it
[official-gcc.git] / gcc / testsuite / gcc.dg / c99-arraydecl-1.c
blob24ddd6571cd6761cf6829db6c295546eef98d1fe
1 /* Test for C99 forms of array declarator. */
2 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
3 /* { dg-do compile } */
4 /* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
6 /* Because GCC doesn't yet implement it, we don't yet test for [*] here. */
8 /* Test each of: [quals], [quals expr], [static expr], [static quals expr],
9 [quals static expr]. Not yet: [quals *]. */
11 void f00 (int a[const]);
12 void f01 (int [const]); /* { dg-bogus "warning" "warning in place of error" } */
13 /* { dg-error "abstract" "\[quals\] in abstract declarator" { target *-*-* } 12 } */
14 void
15 f02 (int a[const])
17 int **b = &a; /* { dg-bogus "warning" "warning in place of error" } */
18 /* { dg-error "discards" "discards quals" { target *-*-* } 17 } */
19 int *const *c = &a;
21 void
22 f03 (a)
23 int a[const];
25 int **b = &a; /* { dg-bogus "warning" "warning in place of error" } */
26 /* { dg-error "discards" "discards quals" { target *-*-* } 25 } */
27 int *const *c = &a;
30 void f10 (int a[const 2]);
31 void f11 (int [const 2]); /* { dg-bogus "warning" "warning in place of error" } */
32 /* { dg-error "abstract" "\[quals expr\] in abstract declarator" { target *-*-* } 31 } */
33 void
34 f12 (int a[const 2])
36 int **b = &a; /* { dg-bogus "warning" "warning in place of error" } */
37 /* { dg-error "discards" "discards quals" { target *-*-* } 36 } */
38 int *const *c = &a;
40 void
41 f13 (a)
42 int a[const 2];
44 int **b = &a; /* { dg-bogus "warning" "warning in place of error" } */
45 /* { dg-error "discards" "discards quals" { target *-*-* } 44 } */
46 int *const *c = &a;
49 void f20 (int a[static 2]);
50 void f21 (int [static 2]); /* { dg-bogus "warning" "warning in place of error" } */
51 /* { dg-error "abstract" "\[static expr\] in abstract declarator" { target *-*-* } 50 } */
52 void
53 f22 (int a[static 2])
55 int **b = &a;
56 int *const *c = &a;
58 void
59 f23 (a)
60 int a[static 2];
62 int **b = &a;
63 int *const *c = &a;
66 void f30 (int a[static const 2]);
67 void f31 (int [static const 2]); /* { dg-bogus "warning" "warning in place of error" } */
68 /* { dg-error "abstract" "\[static quals expr\] in abstract declarator" { target *-*-* } 67 } */
69 void
70 f32 (int a[static const 2])
72 int **b = &a; /* { dg-bogus "warning" "warning in place of error" } */
73 /* { dg-error "discards" "discards quals" { target *-*-* } 72 } */
74 int *const *c = &a;
76 void
77 f33 (a)
78 int a[static const 2];
80 int **b = &a; /* { dg-bogus "warning" "warning in place of error" } */
81 /* { dg-error "discards" "discards quals" { target *-*-* } 80 } */
82 int *const *c = &a;
85 void f40 (int a[const static 2]);
86 void f41 (int [const static 2]); /* { dg-bogus "warning" "warning in place of error" } */
87 /* { dg-error "abstract" "\[quals static expr\] in abstract declarator" { target *-*-* } 86 } */
88 void
89 f42 (int a[const static 2])
91 int **b = &a; /* { dg-bogus "warning" "warning in place of error" } */
92 /* { dg-error "discards" "discards quals" { target *-*-* } 91 } */
93 int *const *c = &a;
95 void
96 f43 (a)
97 int a[const static 2];
99 int **b = &a; /* { dg-bogus "warning" "warning in place of error" } */
100 /* { dg-error "discards" "discards quals" { target *-*-* } 99 } */
101 int *const *c = &a;
104 /* Test rejection of static and type qualifiers in non-parameter contexts. */
105 int x[const 2]; /* { dg-bogus "warning" "warning in place of error" } */
106 /* { dg-error "non-parameter" "quals in non-parm array" { target *-*-* } 105 } */
107 int y[static 2]; /* { dg-bogus "warning" "warning in place of error" } */
108 /* { dg-error "non-parameter" "static in non-parm array" { target *-*-* } 107 } */
109 void g (int a[static 2][3]);
110 void h (int a[2][static 3]); /* { dg-bogus "warning" "warning in place of error" } */
111 /* { dg-error "non-parameter" "static in non-final parm array" { target *-*-* } 110 } */