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 %s 4 5 void foo() {} 6 static void f2() {} 7 static void f1() {f2();} // expected-warning{{unused}} 8 9 static int f0() { return 17; } // expected-warning{{not needed and will not be emitted}} 10 int x = sizeof(f0()); 11 12 static void f3(); 13 extern void f3() { } // expected-warning{{unused}} 14 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() { } 19 20 static void __attribute__((used)) f5() {} 21 static void f6(); 22 static void __attribute__((used)) f6(); 23 static void f6() {}; 24 25 static void f7(void); 26 void f8(void(*a0)(void)); 27 void f9(void) { f8(f7); } 28 static void f7(void) {} 29 30 __attribute__((unused)) static void bar(void); 31 void bar(void) { } 32 33 __attribute__((constructor)) static void bar2(void); 34 void bar2(void) { } 35 36 __attribute__((destructor)) static void bar3(void); 37 void bar3(void) { } 38 39 static void f10(void); // expected-warning{{unused}} 40 static void f10(void); 41 42 static void f11(void); 43 static void f11(void) { } // expected-warning{{unused}} 44 45 static void f12(void) { } // expected-warning{{unused}} 46 static void f12(void); 47 48 // PR7923 49 static void unused(void) { unused(); } // expected-warning{{not needed and will not be emitted}} 50 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; 56 } 57 58 // rdar://12233989 59 extern void a(void) __attribute__((unused)); 60 extern void b(void) __attribute__((unused)); 61 62 void b(void) 63 { 64 } 65 void a(void) 66 { 67 b(); 68 } 69