111
|
1 /* Test warnings when using -fobjc-std=objc1. */
|
|
2 /* { dg-do compile } */
|
|
3 /* { dg-options "-fobjc-std=objc1" } */
|
|
4
|
|
5 #include <objc/objc.h>
|
|
6
|
|
7 @interface MyRootClass
|
|
8 {
|
|
9 Class isa;
|
|
10 @package /* { dg-error "not available in Objective.C 1.0" } */
|
|
11 int a;
|
|
12 int b;
|
|
13 }
|
|
14 + (id) alloc __attribute__ ((deprecated)); /* { dg-error "not available in Objective.C 1.0" } */
|
|
15 + (id) name;
|
|
16 - (id) init;
|
|
17 - (id) testMe: (id) __attribute__((unused)) argument; /* { dg-error "not available in Objective.C 1.0" } */
|
|
18 @property (nonatomic) int a; /* { dg-error "not available in Objective.C 1.0" } */
|
|
19 @property (nonatomic) int b; /* { dg-error "not available in Objective.C 1.0" } */
|
|
20 @end
|
|
21
|
|
22 @implementation MyRootClass
|
|
23 + (id) alloc { return self; }
|
|
24 + (id) name { return self; }
|
|
25 - (id) init { return self; }
|
|
26 - (id) testMe: (id) __attribute__((unused)) argument { return self; } /* { dg-error "not available in Objective.C 1.0" } */
|
|
27 @synthesize a; /* { dg-error "not available in Objective.C 1.0" } */
|
|
28 @dynamic b; /* { dg-error "not available in Objective.C 1.0" } */
|
|
29 @end
|
|
30
|
|
31 __attribute__ ((deprecated))
|
|
32 @interface MyRootClass2
|
|
33 { /* { dg-error "class attributes are not available in Objective.C 1.0" } */
|
|
34 Class isa;
|
|
35 }
|
|
36 @end
|
|
37
|
|
38 __attribute__ ((deprecated))
|
|
39 @protocol MyProtocol
|
|
40 - (id) test; /* { dg-error "protocol attributes are not available in Objective.C 1.0" } */
|
|
41 @required /* { dg-error "not available in Objective.C 1.0" } */
|
|
42 - (id) variable __attribute__ ((deprecated)); /* { dg-error "not available in Objective.C 1.0" } */
|
|
43 @optional /* { dg-error "not available in Objective.C 1.0" } */
|
|
44 @end
|
|
45
|
|
46 @interface MyRootClass (NSFastEnumeration)
|
|
47 - (unsigned long)countByEnumeratingWithState: (struct __objcFastEnumerationState *)state
|
|
48 objects:(id *)stackbuf
|
|
49 count:(unsigned int)len;
|
|
50 @end
|
|
51
|
|
52 @class NSArray;
|
|
53
|
|
54 int array_length (NSArray *array)
|
|
55 {
|
|
56 int i = 0;
|
|
57
|
|
58 for (id object in array) /* { dg-error "not available in Objective.C 1.0" } */
|
|
59 i++;
|
|
60
|
|
61 return i;
|
|
62 }
|
|
63
|
|
64 id test (void)
|
|
65 {
|
|
66 return MyRootClass.name; /* { dg-error "not available in Objective.C 1.0" } */
|
|
67 }
|
|
68
|
|
69 @interface MyRootClass3
|
|
70 {
|
|
71 Class isa;
|
|
72 }
|
|
73 @end
|
|
74
|
|
75 @interface MyRootClass3 ()
|
|
76 @end /* { dg-error "not available in Objective.C 1.0" } */
|