freebsd-dev/test/SemaObjC/unused.m

45 lines
698 B
Mathematica
Raw Normal View History

2009-10-14 18:03:49 +00:00
// RUN: clang-cc %s -verify -Wunused -fsyntax-only
2009-11-18 14:59:57 +00:00
int printf(const char *, ...);
2009-06-02 17:58:47 +00:00
@interface Greeter
+ (void) hello;
@end
@implementation Greeter
+ (void) hello {
2009-11-18 14:59:57 +00:00
printf("Hello, World!\n");
2009-06-02 17:58:47 +00:00
}
@end
2009-10-14 18:03:49 +00:00
int test1(void) {
[Greeter hello];
return 0;
}
@interface NSObject @end
@interface NSString : NSObject
- (int)length;
@end
void test2() {
@"pointless example call for test purposes".length; // expected-warning {{property access result unused - getters should not have side effects}}
2009-06-02 17:58:47 +00:00
}
2009-10-14 18:03:49 +00:00
@interface foo
- (int)meth: (int)x: (int)y: (int)z ;
@end
@implementation foo
- (int) meth: (int)x:
(int)y: // expected-warning{{unused}}
(int) __attribute__((unused))z { return x; }
@end