summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/unused-expr.c
diff options
context:
space:
mode:
authorMatt Beaumont-Gay <matthewbg@google.com>2013-02-26 19:34:08 +0000
committerMatt Beaumont-Gay <matthewbg@google.com>2013-02-26 19:34:08 +0000
commit1c417da558e97f9b77706ed45f90f9c04e6cc085 (patch)
tree4183c4f051cba05c590276b2b8be5047aaf867c2 /clang/test/Sema/unused-expr.c
parentc0550990c50625c9b084c4aa3c2ba8c0960e61eb (diff)
downloadbcm5719-llvm-1c417da558e97f9b77706ed45f90f9c04e6cc085.tar.gz
bcm5719-llvm-1c417da558e97f9b77706ed45f90f9c04e6cc085.zip
Warn on dropping the return value from a warn_unused_result function, even in
macros. llvm-svn: 176114
Diffstat (limited to 'clang/test/Sema/unused-expr.c')
-rw-r--r--clang/test/Sema/unused-expr.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/test/Sema/unused-expr.c b/clang/test/Sema/unused-expr.c
index 0786ede6763..ea08631ebae 100644
--- a/clang/test/Sema/unused-expr.c
+++ b/clang/test/Sema/unused-expr.c
@@ -132,6 +132,8 @@ int fn5() __attribute__ ((__const));
#define M3(a) (t3(a), fn2())
#define M4(a, b) (foo((a), (b)) ? 0 : t3(a), 1)
#define M5(a, b) (foo((a), (b)), 1)
+#define M6() fn1()
+#define M7() fn2()
void t11(int i, int j) {
M1(i, j); // no warning
NOP((long)foo(i, j)); // expected-warning {{expression result unused}}
@@ -143,6 +145,8 @@ void t11(int i, int j) {
NOP((foo(i, j) ? 0 : t3(i), 1)); // expected-warning {{expression result unused}}
M5(i, j); // no warning
NOP((foo(i, j), 1)); // expected-warning {{expression result unused}}
+ M6(); // expected-warning {{ignoring return value}}
+ M7(); // no warning
}
#undef NOP
#undef M1
@@ -150,3 +154,5 @@ void t11(int i, int j) {
#undef M3
#undef M4
#undef M5
+#undef M6
+#undef M7
OpenPOWER on IntegriCloud