2010-02-21 13:15:32 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -Wunused-value -verify %s
|
|
|
|
|
|
|
|
@interface INTF
|
2010-03-31 02:22:15 +08:00
|
|
|
- (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));
|
2010-02-21 13:15:32 +08:00
|
|
|
@end
|
|
|
|
|
2010-03-31 02:22:15 +08:00
|
|
|
void foo(INTF *a) {
|
|
|
|
[a garf];
|
2016-03-08 06:44:55 +08:00
|
|
|
[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}}
|
2010-03-31 02:22:15 +08:00
|
|
|
}
|
|
|
|
|
2010-02-21 13:15:32 +08:00
|
|
|
|