diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-10-13 04:53:48 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-10-13 04:53:48 +0000 |
| commit | 1a6babf1f41c3c8d6a0dab98e02b7caaf9024da6 (patch) | |
| tree | 7767d9db3b1ddf4f4685937d21c0295e7f019f75 /clang/test | |
| parent | f315471e24305ee3c63960edca252ac91da5ee4a (diff) | |
| download | bcm5719-llvm-1a6babf1f41c3c8d6a0dab98e02b7caaf9024da6.tar.gz bcm5719-llvm-1a6babf1f41c3c8d6a0dab98e02b7caaf9024da6.zip | |
make the diagnostic in the 'unused result' warning more precise
about the reason, rdar://7186119.
llvm-svn: 83940
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/Sema/attr-warn_unused_result.c | 6 | ||||
| -rw-r--r-- | clang/test/Sema/unused-expr.c | 8 |
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}} +} |

