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