Tanya Lattner | e6bbc01 | 2010-02-12 00:07:30 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -Wunused-function -verify %s |
Ted Kremenek | e1fcf29 | 2010-04-08 17:54:28 +0000 | [diff] [blame^] | 2 | // RUN: %clang_cc1 -fsyntax-only -verify -Wunused %s |
| 3 | // RUN: %clang_cc1 -fsyntax-only -verify -Wall %s |
Tanya Lattner | e6bbc01 | 2010-02-12 00:07:30 +0000 | [diff] [blame] | 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{{unused}} |
| 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(); |
Tanya Lattner | 12ead49 | 2010-02-17 02:17:21 +0000 | [diff] [blame] | 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) {} |
Tanya Lattner | c777221 | 2010-02-17 04:48:01 +0000 | [diff] [blame] | 29 | |
| 30 | __attribute__((unused)) static void bar(void); |
| 31 | void bar(void) { } |
| 32 | |