summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-01-27 18:16:48 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-01-27 18:16:48 +0000
commitff115a2f351dedf16dfc147cf79b274e54b87be6 (patch)
tree7c70957c710dbedd4e8f4ff237f8a09549db7730 /clang/test
parentffd6dc432ef7177d764c6d23ec32bbbf45e96d89 (diff)
downloadbcm5719-llvm-ff115a2f351dedf16dfc147cf79b274e54b87be6.tar.gz
bcm5719-llvm-ff115a2f351dedf16dfc147cf79b274e54b87be6.zip
Allow #pragma unused to be used on global variables like gcc. Fixes rdar://8793832.
llvm-svn: 124383
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Sema/pragma-unused.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/clang/test/Sema/pragma-unused.c b/clang/test/Sema/pragma-unused.c
index 5f379458a21..aafac0de206 100644
--- a/clang/test/Sema/pragma-unused.c
+++ b/clang/test/Sema/pragma-unused.c
@@ -1,16 +1,16 @@
-// RUN: %clang_cc1 -fsyntax-only -Wunused-parameter -Wused-but-marked-unused -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wunused-parameter -Wused-but-marked-unused -Wunused -verify %s
void f1(void) {
int x, y, z;
#pragma unused(x)
#pragma unused(y, z)
- int w; // FIXME: We should emit a warning that 'w' is unused.
+ int w; // expected-warning {{unused}}
#pragma unused w // expected-warning{{missing '(' after '#pragma unused' - ignoring}}
}
void f2(void) {
- int x, y;
+ int x, y; // expected-warning {{unused}} expected-warning {{unused}}
#pragma unused(x,) // expected-warning{{expected '#pragma unused' argument to be a variable name}}
#pragma unused() // expected-warning{{expected '#pragma unused' argument to be a variable name}}
}
@@ -20,15 +20,10 @@ void f3(void) {
}
void f4(void) {
- int w; // FIXME: We should emit a warning that 'w' is unused.
+ int w; // expected-warning {{unused}}
#pragma unused((w)) // expected-warning{{expected '#pragma unused' argument to be a variable name}}
}
-int k;
-void f5(void) {
- #pragma unused(k) // expected-warning{{only local variables can be arguments to '#pragma unused'}}
-}
-
void f6(void) {
int z; // no-warning
{
@@ -64,3 +59,7 @@ int f12(int x) {
#pragma unused(x) // expected-warning{{'x' was marked unused but was used}}
return y;
}
+
+// rdar://8793832
+static int glob_var = 0;
+#pragma unused(glob_var)
OpenPOWER on IntegriCloud