aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/pragma-unused.c
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-08-03 23:24:57 +0000
committerTed Kremenek <kremenek@apple.com>2009-08-03 23:24:57 +0000
commit7a02a3733cdd2ca672902d869fda4ef2e3f05052 (patch)
tree818f89d2f2c93249173392518c282bf95e36d034 /test/Sema/pragma-unused.c
parent48775d5bf05120adb2a953bbcd626405bf666b22 (diff)
Per advice that Doug Gregor gave me several months ago, clean up the
implementation of '#pragma unused' by not constructing intermediate DeclRefExprs, but instead do the name lookup directly. The implementation is greatly simplified. Along the way, degrade '#pragma unused(undeclaredvariable)' to a warning instead of being a hard error. This implements: <rdar://problem/6761874> [sema] allow #pragma unused to reference undefined variable (with warning) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78019 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/pragma-unused.c')
-rw-r--r--test/Sema/pragma-unused.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/Sema/pragma-unused.c b/test/Sema/pragma-unused.c
index fe8bf8608b..8b94989626 100644
--- a/test/Sema/pragma-unused.c
+++ b/test/Sema/pragma-unused.c
@@ -16,7 +16,7 @@ void f2(void) {
}
void f3(void) {
- #pragma unused(x) // expected-error{{use of undeclared identifier 'x'}}
+ #pragma unused(x) // expected-warning{{undeclared variable 'x' used as an argument for '#pragma unused'}}
}
void f4(void) {
@@ -26,7 +26,7 @@ void f4(void) {
int k;
void f5(void) {
- #pragma unused(k) // expected-warning{{only local variables can be arguments to '#pragma unused' - ignored}}
+ #pragma unused(k) // expected-warning{{only local variables can be arguments to '#pragma unused'}}
}
void f6(void) {
@@ -36,3 +36,8 @@ void f6(void) {
}
}
+void f7() {
+ int y;
+ #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'}}
+}
+