blob: 042f4422f808379b073910731744a03dc3b58817 [file] [log] [blame]
Ted Kremenek48108fd2010-02-21 05:15:32 +00001// RUN: %clang_cc1 -fsyntax-only -Wunused-value -verify %s
2
3@interface INTF
Fariborz Jahanianf0317742010-03-30 18:22:15 +00004- (id) foo __attribute__((warn_unused_result));
5- (void) garf __attribute__((warn_unused_result)); // expected-warning {{attribute 'warn_unused_result' cannot be applied to Objective-C method without return value}}
6- (int) fee __attribute__((warn_unused_result));
7+ (int) c __attribute__((warn_unused_result));
Ted Kremenek48108fd2010-02-21 05:15:32 +00008@end
9
Fariborz Jahanianf0317742010-03-30 18:22:15 +000010void foo(INTF *a) {
11 [a garf];
12 [a fee]; // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
13 [INTF c]; // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
14}
15
Ted Kremenek48108fd2010-02-21 05:15:32 +000016