xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/method-warn-unused-attribute.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1  -fsyntax-only -Wunused-value -verify %s
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambuc@interface INTF
4*f4a2713aSLionel Sambuc- (id) foo __attribute__((warn_unused_result));
5*f4a2713aSLionel Sambuc- (void) garf __attribute__((warn_unused_result)); // expected-warning {{attribute 'warn_unused_result' cannot be applied to Objective-C method without return value}}
6*f4a2713aSLionel Sambuc- (int) fee __attribute__((warn_unused_result));
7*f4a2713aSLionel Sambuc+ (int) c __attribute__((warn_unused_result));
8*f4a2713aSLionel Sambuc@end
9*f4a2713aSLionel Sambuc
10*f4a2713aSLionel Sambucvoid foo(INTF *a) {
11*f4a2713aSLionel Sambuc  [a garf];
12*f4a2713aSLionel Sambuc  [a fee]; // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
13*f4a2713aSLionel Sambuc  [INTF c]; // expected-warning {{ignoring return value of function declared with warn_unused_result attribute}}
14*f4a2713aSLionel Sambuc}
15*f4a2713aSLionel Sambuc
16*f4a2713aSLionel Sambuc
17