blob: d5e676b1160332ea6d34b704d71e0d8e0f6d0ed5 [file] [log] [blame]
Tanya Lattnere6bbc012010-02-12 00:07:30 +00001// RUN: %clang_cc1 -fsyntax-only -Wunused-function -verify %s
Ted Kremeneke1fcf292010-04-08 17:54:28 +00002// RUN: %clang_cc1 -fsyntax-only -verify -Wunused %s
3// RUN: %clang_cc1 -fsyntax-only -verify -Wall %s
Tanya Lattnere6bbc012010-02-12 00:07:30 +00004
5void foo() {}
6static void f2() {}
7static void f1() {f2();} // expected-warning{{unused}}
8
9static int f0() { return 17; } // expected-warning{{unused}}
10int x = sizeof(f0());
11
12static void f3();
13extern 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 Lattner12ead492010-02-17 02:17:21 +000018//void f4() { }
19
20static void __attribute__((used)) f5() {}
21static void f6();
22static void __attribute__((used)) f6();
23static void f6() {};
24
25static void f7(void);
26void f8(void(*a0)(void));
27void f9(void) { f8(f7); }
28static void f7(void) {}
Tanya Lattnerc7772212010-02-17 04:48:01 +000029
30__attribute__((unused)) static void bar(void);
31void bar(void) { }
32
Chris Lattner1a4221c2010-04-09 17:25:05 +000033__attribute__((constructor)) static void bar2(void);
34void bar2(void) { }
35
36__attribute__((destructor)) static void bar3(void);
37void bar3(void) { }