1 // RUN: %clang_cc1 %s -fsyntax-only -verify
4 int X __attribute__((deprecated));
6 + (void)F __attribute__((deprecated));
7 - (void)f __attribute__((deprecated));
11 + (void)F __attribute__((deprecated))
12 { // expected-warning {{method attribute can only be specified on method declarations}}
13 [self F]; // no warning, since the caller is also deprecated.
18 X++; // expected-warning{{'X' is deprecated}}
19 self->X++; // expected-warning{{'X' is deprecated}}
20 [self f]; // expected-warning{{'f' is deprecated}}
25 [self f]; // no warning, the caller is deprecated in its interface.
35 [super F]; // expected-warning{{'F' is deprecated}}
40 [super f]; // // expected-warning{{'f' is deprecated}}
45 - (void)p __attribute__((deprecated));
50 [A F]; // expected-warning{{'F' is deprecated}}
51 [a f]; // expected-warning{{'f' is deprecated}}
61 [a f]; // expected-warning{{'f' is deprecated}}
62 [a p]; // expected-warning{{'p' is deprecated}}
74 @property (assign, setter = MySetter:) int FooBar __attribute__ ((deprecated));
75 - (void) MySetter : (int) value;
80 f.FooBar = 1; // expected-warning {{warning: 'FooBar' is deprecated}}
81 return f.FooBar; // expected-warning {{warning: 'FooBar' is deprecated}}
85 __attribute ((deprecated))
86 @interface DEPRECATED {
89 - (int) instancemethod;
93 @interface DEPRECATED (Category) // expected-warning {{warning: 'DEPRECATED' is deprecated}}
96 @interface NS : DEPRECATED // expected-warning {{warning: 'DEPRECATED' is deprecated}}
101 @property int test2 __attribute__((deprecated));
104 void test(Test2 *foo) {
106 x = foo.test2; // expected-warning {{'test2' is deprecated}}
107 x = [foo test2]; // expected-warning {{'test2' is deprecated}}
108 foo.test2 = x; // expected-warning {{'test2' is deprecated}}
109 [foo setTest2: x]; // expected-warning {{'setTest2:' is deprecated}}