]> granicus.if.org Git - clang/commitdiff
merge two tests.
authorChris Lattner <sabre@nondot.org>
Tue, 13 Oct 2009 04:56:49 +0000 (04:56 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 13 Oct 2009 04:56:49 +0000 (04:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83941 91177308-0d34-0410-b5e6-96231b3b80d8

test/Sema/attr-warn_unused_result.c [deleted file]
test/Sema/unused-expr.c

diff --git a/test/Sema/attr-warn_unused_result.c b/test/Sema/attr-warn_unused_result.c
deleted file mode 100644 (file)
index 08e95f4..0000000
+++ /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}}
-
index f8e7c91474a593cb9264a96de9f17e3067a53dd2..84fe8ba9d63d7a569b8c7fb3abfef05764d802ee 100644 (file)
@@ -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}}
+