[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / Sema / attr-cleanup.c
blob2c38687622c2bbc3ccaf148b7d9ef577b93e6990
1 // RUN: %clang_cc1 %s -verify -fsyntax-only
3 void c1(int *a);
5 extern int g1 __attribute((cleanup(c1))); // expected-warning {{'cleanup' attribute only applies to local variables}}
6 int g2 __attribute((cleanup(c1))); // expected-warning {{'cleanup' attribute only applies to local variables}}
7 static int g3 __attribute((cleanup(c1))); // expected-warning {{'cleanup' attribute only applies to local variables}}
9 void t1(void)
11 int v1 __attribute((cleanup)); // expected-error {{'cleanup' attribute takes one argument}}
12 int v2 __attribute((cleanup(1, 2))); // expected-error {{'cleanup' attribute takes one argument}}
14 static int v3 __attribute((cleanup(c1))); // expected-warning {{'cleanup' attribute only applies to local variables}}
16 int v4 __attribute((cleanup(h))); // expected-error {{use of undeclared identifier 'h'}}
18 int v5 __attribute((cleanup(c1)));
19 int v6 __attribute((cleanup(v3))); // expected-error {{'cleanup' argument 'v3' is not a function}}
22 struct s {
23 int a, b;
26 void c2(void);
27 void c3(struct s a);
29 void t2(void)
31 int v1 __attribute__((cleanup(c2))); // expected-error {{'cleanup' function 'c2' must take 1 parameter}}
32 int v2 __attribute__((cleanup(c3))); // expected-error {{'cleanup' function 'c3' parameter has type 'struct s' which is incompatible with type 'int *'}}
35 // This is a manufactured testcase, but gcc accepts it...
36 void c4(_Bool a);
37 void t4(void) {
38 __attribute((cleanup(c4))) void* g;
41 void c5(void*) __attribute__((deprecated)); // expected-note{{'c5' has been explicitly marked deprecated here}}
42 void t5(void) {
43 int i __attribute__((cleanup(c5))); // expected-warning {{'c5' is deprecated}}
46 void t6(void) {
47 int i __attribute__((cleanup((void *)0))); // expected-error {{'cleanup' argument is not a function}}
50 void t7(__attribute__((cleanup(c4))) int a) {} // expected-warning {{'cleanup' attribute only applies to local variables}}