annotate gcc/testsuite/objc.dg/fobjc-std-1.m @ 158:494b0b89df80 default tip

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