Debian Codegraph @

gcc/testsuite/objc.dg/property/at-property-deprecated-1.m

raw
1 /* Contributed by Nicola Pero <[email protected]>, October 2010. */
2 /* { dg-do compile } */
3
4 /* Test that properties can be deprecated. */
5
6 #include <stdlib.h>
7 #include <objc/objc.h>
8 #include <objc/runtime.h>
9
10 @interface MyRootClass
11 {
12 Class isa;
13 int a;
14 }
15 @property int a __attribute__((deprecated));
16 + (id) initialize;
17 + (id) alloc;
18 - (id) init;
19 @end
20
21 @implementation MyRootClass
22 + (id) initialize { return self; }
23 + (id) alloc { return class_createInstance (self, 0); }
24 - (id) init { return self; }
25 @synthesize a;
26 @end
27
28 int main (void)
29 {
30 MyRootClass *object = [[MyRootClass alloc] init];
31
32 object.a = 40; /* { dg-warning "is deprecated" } */
33 if (object.a != 40) /* { dg-warning "is deprecated" } */
34 abort ();
35
36 return 0;
37 }