[cfe-commits] r83941 - in /cfe/trunk/test/Sema: attr-warn_unused_result.c unused-expr.c
Chris Lattner
sabre at nondot.org
Mon Oct 12 21:56:50 PDT 2009
Author: lattner
Date: Mon Oct 12 23:56:49 2009
New Revision: 83941
URL: http://llvm.org/viewvc/llvm-project?rev=83941&view=rev
Log:
merge two tests.
Removed:
cfe/trunk/test/Sema/attr-warn_unused_result.c
Modified:
cfe/trunk/test/Sema/unused-expr.c
Removed: cfe/trunk/test/Sema/attr-warn_unused_result.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-warn_unused_result.c?rev=83940&view=auto
==============================================================================
--- cfe/trunk/test/Sema/attr-warn_unused_result.c (original)
+++ cfe/trunk/test/Sema/attr-warn_unused_result.c (removed)
@@ -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}}
-
Modified: cfe/trunk/test/Sema/unused-expr.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/unused-expr.c?rev=83941&r1=83940&r2=83941&view=diff
==============================================================================
--- cfe/trunk/test/Sema/unused-expr.c (original)
+++ cfe/trunk/test/Sema/unused-expr.c Mon Oct 12 23:56:49 2009
@@ -78,3 +78,21 @@
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}}
+
More information about the cfe-commits
mailing list