1 /* { dg-do compile } */
2 /* { dg-options "-Wall" } */
3 /* Validate expected warnings and errors. */
5 #define U __attribute__((unused))
6 #define C(x) __attribute__((cleanup(x)))
8 static int f1(void *x U) { return 0; }
9 static void f2() { } /* { dg-message "note: declared here" } */
10 static void f3(void) { } /* { dg-message "note: declared here" } */
11 static void f4(void *x U) { }
12 static void f5(int *x U) { }
13 static void f6(double *x U) { }
14 static void f7(const int *x U) { }
15 static void f8(const int *x U, int y U) { } /* { dg-message "note: declared here" } */
16 static void f9(int x U) { }
21 int o2 C(f2); /* { dg-error "too many arguments" } */
22 int o3 C(f3); /* { dg-error "too many arguments" } */
25 int o6 C(f6); /* { dg-error "cannot convert" } */
27 int o8 C(f8); /* { dg-error "too few arguments" } */
28 int o9 C(f9); /* { dg-error "conversion" } */
29 int o10 U C(undef); /* { dg-error "not a function" } */
30 int o11 U C(o1); /* { dg-error "not a function" } */
31 int o12 U C("f1"); /* { dg-error "not an identifier" } */
32 static int o13 U C(f1); /* { dg-warning "attribute ignored" } */
35 int o14 C(f1); /* { dg-warning "attribute ignored" } */
36 void t15(int o U C(f1)) {} /* { dg-warning "attribute ignored" } */