* gcc.dg/ucnid-[23456].c: XFAIL on AIX.
[official-gcc.git] / gcc / testsuite / gcc.dg / old-style-then-proto-1.c
blobabe02d06378d045efff7a337ae45e89a069ff769
1 /* Test for old-style definition followed by prototype declaration.
2 Mismatched qualifiers used to be wrongly forbidden. */
3 /* Origin: Joseph Myers <joseph@codesourcery.com> */
4 /* { dg-do compile } */
5 /* { dg-options "" } */
7 void f1() {}
8 void f1(void); /* { dg-warning "warning: prototype for 'f1' follows non-prototype definition" } */
10 void f2() {} /* { dg-error "error: previous definition of 'f2' was here" } */
11 void f2(int); /* { dg-error "error: prototype for 'f2' declares more arguments than previous old-style definition" } */
13 void f3(a) int a; {} /* { dg-error "error: previous definition of 'f3' was here" } */
14 void f3(void); /* { dg-error "error: prototype for 'f3' declares fewer arguments than previous old-style definition" } */
16 void f4(a) int a; {}
17 void f4(int); /* { dg-warning "warning: prototype for 'f4' follows non-prototype definition" } */
19 void f5(a) int a; {} /* { dg-error "error: previous definition of 'f5' was here" } */
20 void f5(int, int); /* { dg-error "error: prototype for 'f5' declares more arguments than previous old-style definition" } */
22 void f6(a) int a; {} /* { dg-error "error: previous definition of 'f6' was here" } */
23 void f6(int, ...); /* { dg-error "error: conflicting types for 'f6'" } */
25 void f7(a, b) int a, b; {} /* { dg-error "error: previous definition of 'f7' was here" } */
26 void f7(int); /* { dg-error "error: prototype for 'f7' declares fewer arguments than previous old-style definition" } */
28 void f8(a, b) int a, b; {} /* { dg-error "error: previous definition of 'f8' was here" } */
29 void f8(int, ...); /* { dg-error "error: conflicting types for 'f8'" } */
31 void f9(a, b) int a, b; {}
32 void f9(int, int); /* { dg-warning "warning: prototype for 'f9' follows non-prototype definition" } */
34 void f10(a, b) int a, b; {} /* { dg-error "error: previous definition of 'f10' was here" } */
35 void f10(int, long); /* { dg-error "error: prototype for 'f10' declares argument 2 with incompatible type" } */
37 void f11(a, b) int a, b; {} /* { dg-error "error: previous definition of 'f11' was here" } */
38 void f11(long, int); /* { dg-error "error: prototype for 'f11' declares argument 1 with incompatible type" } */
40 void f12(a, b) const int a; volatile int b; {}
41 void f12(volatile int, const int); /* { dg-warning "warning: prototype for 'f12' follows non-prototype definition" } */
43 void f13(a) const int a[2][2]; {} /* { dg-error "error: previous definition of 'f13' was here" } */
44 void f13(volatile int [2][2]); /* { dg-error "error: prototype for 'f13' declares argument 1 with incompatible type" } */