diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2010-03-30 18:22:15 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-03-30 18:22:15 +0000 |
| commit | 5cab26d058d3181ebdf1dbb9411c33229d1842cf (patch) | |
| tree | 72a34fa0d667e02205c85291f616e4915d9ce89c /clang/test | |
| parent | 9897043928aebe05b3e56e7860eda862db767727 (diff) | |
| download | bcm5719-llvm-5cab26d058d3181ebdf1dbb9411c33229d1842cf.tar.gz bcm5719-llvm-5cab26d058d3181ebdf1dbb9411c33229d1842cf.zip | |
Add Support for 'warn_unused_result" attribute on
objective-c methods. (radar 7418262).
llvm-svn: 99903
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/SemaObjC/method-warn-unused-attribute.m | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/test/SemaObjC/method-warn-unused-attribute.m b/clang/test/SemaObjC/method-warn-unused-attribute.m index d9dcf996ecb..042f4422f80 100644 --- a/clang/test/SemaObjC/method-warn-unused-attribute.m +++ b/clang/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}} +} + |

