Allow resolving headers from a PCH even after headers+PCH were moved to another path.
[clang.git] / test / Sema / warn-unused-function.c
blob5bbcf18a623d9d760165f40868b1b8c5ecc6dad2
1 // RUN: %clang_cc1 -fsyntax-only -Wunused-function -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -Wunused %s
3 // RUN: %clang_cc1 -fsyntax-only -verify -Wall %s
5 void foo() {}
6 static void f2() {}
7 static void f1() {f2();} // expected-warning{{unused}}
9 static int f0() { return 17; } // expected-warning{{unused}}
10 int x = sizeof(f0());
12 static void f3();
13 extern void f3() { } // expected-warning{{unused}}
15 // FIXME: This will trigger a warning when it should not.
16 // Update once PR6281 is fixed.
17 //inline static void f4();
18 //void f4() { }
20 static void __attribute__((used)) f5() {}
21 static void f6();
22 static void __attribute__((used)) f6();
23 static void f6() {};
25 static void f7(void);
26 void f8(void(*a0)(void));
27 void f9(void) { f8(f7); }
28 static void f7(void) {}
30 __attribute__((unused)) static void bar(void);
31 void bar(void) { }
33 __attribute__((constructor)) static void bar2(void);
34 void bar2(void) { }
36 __attribute__((destructor)) static void bar3(void);
37 void bar3(void) { }
39 static void f10(void); // expected-warning{{unused}}
40 static void f10(void);
42 static void f11(void);
43 static void f11(void) { } // expected-warning{{unused}}
45 static void f12(void) { } // expected-warning{{unused}}
46 static void f12(void);
48 // PR7923
49 static void unused(void) { unused(); } // expected-warning{{unused}}
51 // rdar://8728293
52 static void cleanupMalloc(char * const * const allocation) { }
53 void f13(void) {
54 char * const __attribute__((cleanup(cleanupMalloc))) a;
55 (void)a;