[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / Sema / warn-unused-function.c
blob3da59e1abe0947d91b343e95c11bd68c659777ae
1 // RUN: %clang_cc1 -fsyntax-only -Wused-but-marked-unused -Wunused-function -Wunneeded-internal-declaration -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -Wunused %s
3 // RUN: %clang_cc1 -fsyntax-only -verify -Wall -Wno-infinite-recursion %s
5 void foo(void) {}
6 static void f2(void) {}
7 static void f1(void) {f2();} // expected-warning{{unused}}
9 static int f0(void) { return 17; } // expected-warning{{not needed and will not be emitted}}
10 int x = sizeof(f0());
12 static void f3(void);
13 extern void f3(void) { } // expected-warning{{unused}}
15 inline static void f4(void);
16 void f4(void) { } // expected-warning{{unused}}
18 static void __attribute__((used)) f5(void) {}
19 static void f6(void);
20 static void __attribute__((used)) f6(void);
21 static void f6(void) {};
23 static void f7(void);
24 void f8(void(*a0)(void));
25 void f9(void) { f8(f7); }
26 static void f7(void) {}
28 __attribute__((unused)) static void bar(void);
29 void bar(void) { }
31 __attribute__((constructor)) static void bar2(void);
32 void bar2(void) { }
34 __attribute__((destructor)) static void bar3(void);
35 void bar3(void) { }
37 static void f10(void); // expected-warning{{unused}}
38 static void f10(void);
40 static void f11(void);
41 static void f11(void) { } // expected-warning{{unused}}
43 static void f12(void) { } // expected-warning{{unused}}
44 static void f12(void);
46 // PR7923
47 static void unused(void) { unused(); } // expected-warning{{not needed and will not be emitted}}
49 // rdar://8728293
50 static void cleanupMalloc(char * const * const allocation) { }
51 void f13(void) {
52 char * const __attribute__((cleanup(cleanupMalloc))) a;
53 (void)a;
56 // rdar://12233989
57 extern void a(void) __attribute__((unused));
58 extern void b(void) __attribute__((unused));
60 void b(void)
63 void a(void)
65 b();