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; }
10 static void f3(void) { }
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
) { }
16 static void f9(int x U
) { }
22 int o3
C(f3
); /* { dg-error "too many arguments" } */
25 int o6
C(f6
); /* { dg-warning "incompatible pointer type" } */
27 int o8
C(f8
); /* { dg-error "too few arguments" } */
28 int o9
C(f9
); /* { dg-warning "from pointer without a cast" } */
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" } */