summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Sema/attr-warn_unused_result.c6
-rw-r--r--clang/test/Sema/unused-expr.c8
2 files changed, 9 insertions, 5 deletions
diff --git a/clang/test/Sema/attr-warn_unused_result.c b/clang/test/Sema/attr-warn_unused_result.c
index b4ef1bbeaf0..08e95f4f61d 100644
--- a/clang/test/Sema/attr-warn_unused_result.c
+++ b/clang/test/Sema/attr-warn_unused_result.c
@@ -9,9 +9,9 @@ int foo() {
if (fn1() < 0 || fn2(2,1) < 0 || fn3(2) < 0) // no warnings
return -1;
- fn1(); // expected-warning {{expression result unused}}
- fn2(92, 21); // expected-warning {{expression result unused}}
- fn3(42); // expected-warning {{expression result unused}}
+ fn1(); // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
+ fn2(92, 21); // expected-warning {{ignoring return value of function declared with pure attribute}}
+ fn3(42); // expected-warning {{ignoring return value of function declared with const attribute}}
return 0;
}
diff --git a/clang/test/Sema/unused-expr.c b/clang/test/Sema/unused-expr.c
index 8b5d1561262..f8e7c91474a 100644
--- a/clang/test/Sema/unused-expr.c
+++ b/clang/test/Sema/unused-expr.c
@@ -25,7 +25,7 @@ void bar(volatile int *VP, int *P, int A,
__real__ VC;
// We know this can't change errno because of -fno-math-errno.
- sqrt(A); // expected-warning {{expression result unused}}
+ sqrt(A); // expected-warning {{ignoring return value of function declared with const attribute}}
}
extern void t1();
@@ -73,4 +73,8 @@ void t4(int a) {
for (;;b == 1) {} // expected-warning{{expression result unused}}
}
-
+// rdar://7186119
+int t5f(void) __attribute__((warn_unused_result));
+void t5() {
+ t5f(); // expected-warning {{ignoring return value of function declared with warn_unused_result}}
+}
OpenPOWER on IntegriCloud