[Heikki Kultala] This patch contains the ABI changes for the TCE target.
[clang.git] / test / Sema / pragma-unused.c
blobaafac0de206d20a7664e5c715cb65472f0799c0a
1 // RUN: %clang_cc1 -fsyntax-only -Wunused-parameter -Wused-but-marked-unused -Wunused -verify %s
3 void f1(void) {
4 int x, y, z;
5 #pragma unused(x)
6 #pragma unused(y, z)
8 int w; // expected-warning {{unused}}
9 #pragma unused w // expected-warning{{missing '(' after '#pragma unused' - ignoring}}
12 void f2(void) {
13 int x, y; // expected-warning {{unused}} expected-warning {{unused}}
14 #pragma unused(x,) // expected-warning{{expected '#pragma unused' argument to be a variable name}}
15 #pragma unused() // expected-warning{{expected '#pragma unused' argument to be a variable name}}
18 void f3(void) {
19 #pragma unused(x) // expected-warning{{undeclared variable 'x' used as an argument for '#pragma unused'}}
22 void f4(void) {
23 int w; // expected-warning {{unused}}
24 #pragma unused((w)) // expected-warning{{expected '#pragma unused' argument to be a variable name}}
27 void f6(void) {
28 int z; // no-warning
30 #pragma unused(z) // no-warning
34 void f7() {
35 int y;
36 #pragma unused(undeclared, undefined, y) // expected-warning{{undeclared variable 'undeclared' used as an argument for '#pragma unused'}} expected-warning{{undeclared variable 'undefined' used as an argument for '#pragma unused'}}
39 int f8(int x) { // expected-warning{{unused parameter 'x'}}
40 return 0;
43 int f9(int x) {
44 return x;
47 int f10(int x) {
48 #pragma unused(x)
49 return 0;
52 int f11(int x) {
53 #pragma unused(x)
54 return x; // expected-warning{{'x' was marked unused but was used}}
57 int f12(int x) {
58 int y = x;
59 #pragma unused(x) // expected-warning{{'x' was marked unused but was used}}
60 return y;
63 // rdar://8793832
64 static int glob_var = 0;
65 #pragma unused(glob_var)