summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/if-empty-body.c
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-09-16 00:37:05 +0000
committerTed Kremenek <kremenek@apple.com>2010-09-16 00:37:05 +0000
commit8eeec5bd033a8ccc1e662b4e0aa3cdb801fccce7 (patch)
tree2674dbbe954c8864fdbb8ee96ba1fa3a71e1b475 /clang/test/Sema/if-empty-body.c
parent62c454847d8041efd71a233d108508116e98e855 (diff)
downloadbcm5719-llvm-8eeec5bd033a8ccc1e662b4e0aa3cdb801fccce7.tar.gz
bcm5719-llvm-8eeec5bd033a8ccc1e662b4e0aa3cdb801fccce7.zip
Do not warn about empty bodies for 'if' statements if the body is expanded from a macro.
Fixes <rdar://problem/8436021>. llvm-svn: 114049
Diffstat (limited to 'clang/test/Sema/if-empty-body.c')
-rw-r--r--clang/test/Sema/if-empty-body.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/Sema/if-empty-body.c b/clang/test/Sema/if-empty-body.c
index af1e62f6b1b..b28c1cdce96 100644
--- a/clang/test/Sema/if-empty-body.c
+++ b/clang/test/Sema/if-empty-body.c
@@ -14,3 +14,11 @@ void f3() {
return; // no empty body warning.
}
+// Don't warn about an empty body if is expanded from a macro.
+void f4(int i) {
+ #define BODY ;
+ if (i == i) // expected-warning{{self-comparison always evaluates to true}}
+ BODY
+ #undef BODY
+}
+
OpenPOWER on IntegriCloud