OSDN Git Service

don't try to run Objective-C API=2 tests for Darwin < 9
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / objc.dg / attributes / proto-attribute-3.m
1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
2 /* { dg-do compile } */
3
4 /* Test deprecate attribute with normal @protocol declarations.  */
5
6
7 #include <stdlib.h>
8 #include <objc/objc.h>
9
10 __attribute__ ((deprecated))
11 @protocol DeprecatedProtocol1
12 - (void) aMethod;
13 @end
14
15 @protocol NonDeprecatedProtocol1
16 - (void) anotherMethod;
17 @end
18
19 @protocol Protocol2 <DeprecatedProtocol1> /* { dg-warning "is deprecated" } */
20 - (void) someOtherMethod;
21 @end
22
23 @protocol Protocol3 <NonDeprecatedProtocol1>
24 - (void) someOtherMethod2;
25 @end
26
27 @protocol Protocol4 <NonDeprecatedProtocol1, DeprecatedProtocol1> /* { dg-warning "is deprecated" } */
28 - (void) someOtherMethod3;
29 @end
30
31
32 @interface Class1 <DeprecatedProtocol1> /* { dg-warning "is deprecated" } */
33 @end
34
35 @interface Class2 <NonDeprecatedProtocol1>
36 @end
37
38 @interface Class3 <NonDeprecatedProtocol1, DeprecatedProtocol1> /* { dg-warning "is deprecated" } */
39 @end
40
41 @interface Class2 (Category1) <DeprecatedProtocol1> /* { dg-warning "is deprecated" } */
42 @end
43
44 void function1 (id <DeprecatedProtocol1> object); /* { dg-warning "is deprecated" } */
45 void function2 (id <NonDeprecatedProtocol1> object);
46
47 @class Class4;
48
49 void function3 (Class4 <DeprecatedProtocol1> *object); /* { dg-warning "is deprecated" } */
50 void function4 (Class4 <NonDeprecatedProtocol1> *object);
51 void function5 (Class4 <NonDeprecatedProtocol1, DeprecatedProtocol1> *object); /* { dg-warning "is deprecated" } */
52
53 int function6 (void)
54 {
55   Protocol *p1 = @protocol (DeprecatedProtocol1); /* { dg-warning "is deprecated" } */
56   Protocol *p2 = @protocol (NonDeprecatedProtocol1);
57
58   return (p1 == p2);
59 }