d: Fix gdc -O2 -mavx generates misaligned vmovdqa instruction [PR114171]
[official-gcc.git] / gcc / testsuite / objc.dg / fobjc-std-1.m
blob729f65c5ea611f8ace3d4d72e3db56a42cc48f8e
1 /* Test warnings when using -fobjc-std=objc1.  */
2 /* { dg-do compile } */
3 /* { dg-options "-fobjc-std=objc1" } */
4 /* { dg-additional-options "-Wno-objc-root-class" } */
6 #include <objc/objc.h>
8 @interface MyRootClass
10   Class isa;
11 @package /* { dg-error "not available in Objective.C 1.0" } */
12   int a;
13   int b;
15 + (id) alloc __attribute__ ((deprecated)); /* { dg-error "not available in Objective.C 1.0" } */
16 + (id) name;
17 - (id) init;
18 - (id) testMe: (id) __attribute__((unused)) argument; /* { dg-error "not available in Objective.C 1.0" } */
19 @property (nonatomic) int a; /* { dg-error "not available in Objective.C 1.0" } */
20 @property (nonatomic) int b; /* { dg-error "not available in Objective.C 1.0" } */
21 @end
23 @implementation MyRootClass
24 + (id) alloc { return self; }
25 + (id) name { return self; }
26 - (id) init  { return self; }
27 - (id) testMe: (id) __attribute__((unused)) argument { return self; } /* { dg-error "not available in Objective.C 1.0" } */
28 @synthesize a; /* { dg-error "not available in Objective.C 1.0" } */
29 @dynamic b; /* { dg-error "not available in Objective.C 1.0" } */
30 @end
32 __attribute__ ((deprecated))
33 @interface MyRootClass2 /* { dg-error "class attributes are not available in Objective.C 1.0" } */
34 {  
35   Class isa;
37 @end
39 __attribute__ ((deprecated))
40 @protocol MyProtocol
41 - (id) test; /* { dg-error "protocol attributes are not available in Objective.C 1.0" } */
42 @required /* { dg-error "not available in Objective.C 1.0" } */
43 - (id) variable __attribute__ ((deprecated)); /* { dg-error "not available in Objective.C 1.0" } */
44 @optional /* { dg-error "not available in Objective.C 1.0" } */
45 @end
47 @interface MyRootClass (NSFastEnumeration)
48 - (unsigned long)countByEnumeratingWithState: (struct __objcFastEnumerationState *)state
49                                      objects:(id *)stackbuf 
50                                        count:(unsigned int)len;
51 @end
53 @class NSArray;
55 int array_length (NSArray *array)
57   int i = 0;
59   for (id object in array) /* { dg-error "not available in Objective.C 1.0" } */
60     i++;
61       
62   return i;
65 id test (void)
67   return MyRootClass.name; /* { dg-error "not available in Objective.C 1.0" } */
70 @interface MyRootClass3
72   Class isa;
74 @end
76 @interface MyRootClass3 ()
77 @end /* { dg-error "not available in Objective.C 1.0" } */