summaryrefslogtreecommitdiffstats
path: root/test/SemaObjC/method-warn-unused-attribute.m
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaObjC/method-warn-unused-attribute.m')
-rw-r--r--test/SemaObjC/method-warn-unused-attribute.m12
1 files changed, 10 insertions, 2 deletions
diff --git a/test/SemaObjC/method-warn-unused-attribute.m b/test/SemaObjC/method-warn-unused-attribute.m
index d9dcf99..042f442 100644
--- a/test/SemaObjC/method-warn-unused-attribute.m
+++ b/test/SemaObjC/method-warn-unused-attribute.m
@@ -1,8 +1,16 @@
// RUN: %clang_cc1 -fsyntax-only -Wunused-value -verify %s
@interface INTF
-// Currently this is rejected by both GCC and Clang (and Clang was crashing on it).
-- (id) foo __attribute__((warn_unused_result)); // expected-warning{{warning: 'warn_unused_result' attribute only applies to function types}}
+- (id) foo __attribute__((warn_unused_result));
+- (void) garf __attribute__((warn_unused_result)); // expected-warning {{attribute 'warn_unused_result' cannot be applied to Objective-C method without return value}}
+- (int) fee __attribute__((warn_unused_result));
++ (int) c __attribute__((warn_unused_result));
@end
+void foo(INTF *a) {
+ [a garf];
+ [a fee]; // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
+ [INTF c]; // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
+}
+
OpenPOWER on IntegriCloud