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 | 9079cd31061b00f30c7ced7874c45e15f8dd044e (patch) | |
tree | 48b7db5e2bdd240d924b0d5cd4a83812ce59539b /test/Sema/unused-expr.c | |
parent | bc8d42c6f1565c0b2f93ad524edebfd7a4e6cac6 (diff) |
merge two tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83941 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/unused-expr.c')
-rw-r--r-- | test/Sema/unused-expr.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Sema/unused-expr.c b/test/Sema/unused-expr.c index f8e7c91474..84fe8ba9d6 100644 --- a/test/Sema/unused-expr.c +++ b/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}} + |