summaryrefslogtreecommitdiffstats
path: root/test/Sema/unused-expr.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Sema/unused-expr.c')
-rw-r--r--test/Sema/unused-expr.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/test/Sema/unused-expr.c b/test/Sema/unused-expr.c
index 522fda4..f5c64e6 100644
--- a/test/Sema/unused-expr.c
+++ b/test/Sema/unused-expr.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -fno-math-errno %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fno-math-errno %s
int foo(int X, int Y);
@@ -87,12 +87,20 @@ 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}}
+ __builtin_fabsf(0); // 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}}
+int t7 __attribute__ ((warn_unused_result)); // expected-warning {{'warn_unused_result' attribute only applies to function types}}
+
+// PR4010
+int (*fn4)(void) __attribute__ ((warn_unused_result));
+void t8() {
+ fn4(); // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
+}
+void t9() __attribute__((warn_unused_result)); // expected-warning {{attribute 'warn_unused_result' cannot be applied to functions without return value}}
OpenPOWER on IntegriCloud