diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-10-13 04:56:49 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-10-13 04:56:49 +0000 |
| commit | af066d818cd72b7940cacf4fd14ce24b60a72bfc (patch) | |
| tree | 7d139be6d015fbf4b5e221e243ff7696dde8e7a2 /clang | |
| parent | 1a6babf1f41c3c8d6a0dab98e02b7caaf9024da6 (diff) | |
| download | bcm5719-llvm-af066d818cd72b7940cacf4fd14ce24b60a72bfc.tar.gz bcm5719-llvm-af066d818cd72b7940cacf4fd14ce24b60a72bfc.zip | |
merge two tests.
llvm-svn: 83941
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/test/Sema/attr-warn_unused_result.c | 19 | ||||
| -rw-r--r-- | clang/test/Sema/unused-expr.c | 18 |
2 files changed, 18 insertions, 19 deletions
diff --git a/clang/test/Sema/attr-warn_unused_result.c b/clang/test/Sema/attr-warn_unused_result.c deleted file mode 100644 index 08e95f4f61d..00000000000 --- a/clang/test/Sema/attr-warn_unused_result.c +++ /dev/null @@ -1,19 +0,0 @@ -// RUN: clang-cc %s -fsyntax-only -verify -// rdar://6587766 - -int fn1() __attribute__ ((warn_unused_result)); -int fn2() __attribute__ ((pure)); -int fn3() __attribute__ ((const)); - -int foo() { - if (fn1() < 0 || fn2(2,1) < 0 || fn3(2) < 0) // no warnings - return -1; - - 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; -} - -int bar __attribute__ ((warn_unused_result)); // expected-warning {{warning: 'warn_unused_result' attribute only applies to function types}} - diff --git a/clang/test/Sema/unused-expr.c b/clang/test/Sema/unused-expr.c index f8e7c91474a..84fe8ba9d63 100644 --- a/clang/test/Sema/unused-expr.c +++ b/clang/test/Sema/unused-expr.c @@ -78,3 +78,21 @@ int t5f(void) __attribute__((warn_unused_result)); void t5() { t5f(); // expected-warning {{ignoring return value of function declared with warn_unused_result}} } + + +int fn1() __attribute__ ((warn_unused_result)); +int fn2() __attribute__ ((pure)); +int fn3() __attribute__ ((const)); + +int t6() { + if (fn1() < 0 || fn2(2,1) < 0 || fn3(2) < 0) // no warnings + return -1; + + 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; +} + +int t7 __attribute__ ((warn_unused_result)); // expected-warning {{warning: 'warn_unused_result' attribute only applies to function types}} + |

