1 // RUN: %clang_cc1 %s -verify -Wunused -Wunused-parameter -fsyntax-only
3 int printf(const char *, ...);
9 @implementation Greeter
10 + (void) hello { printf("Hello, World!\n"); }
18 @interface NSObject @end
19 @interface NSString : NSObject
24 @"pointless example call for test purposes".length; // expected-warning {{property access result unused - getters should not be used for side effects}}
28 - (int)meth: (int)x: (int)y: (int)z ;
33 (int)y: // expected-warning{{unused}}
34 (int) __attribute__((unused))z { return x; }
37 //===------------------------------------------------------------------------===
38 // The next test shows how clang accepted attribute((unused)) on ObjC
39 // instance variables, which GCC does not.
40 //===------------------------------------------------------------------------===
42 #if __has_feature(attribute_objc_ivar_unused)
43 #define UNUSED_IVAR __attribute__((unused))
45 #error __attribute__((unused)) not supported on ivars
48 @interface TestUnusedIvar {
49 id y __attribute__((unused)); // no-warning
50 id x UNUSED_IVAR; // no-warning