PR target/84336
[official-gcc.git] / gcc / testsuite / objc.dg / attributes / proto-attribute-3.m
blob2be286ecfb70026fb04605ed0a286c4f3aa57791
1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
2 /* { dg-do compile } */
4 /* Test deprecate attribute with normal @protocol declarations.  */
7 #include <stdlib.h>
8 #include <objc/objc.h>
10 __attribute__ ((deprecated))
11 @protocol DeprecatedProtocol1
12 - (void) aMethod;
13 @end
15 @protocol NonDeprecatedProtocol1
16 - (void) anotherMethod;
17 @end
19 @protocol Protocol2 <DeprecatedProtocol1> /* { dg-warning "is deprecated" } */
20 - (void) someOtherMethod;
21 @end
23 @protocol Protocol3 <NonDeprecatedProtocol1>
24 - (void) someOtherMethod2;
25 @end
27 @protocol Protocol4 <NonDeprecatedProtocol1, DeprecatedProtocol1> /* { dg-warning "is deprecated" } */
28 - (void) someOtherMethod3;
29 @end
32 @interface Class1 <DeprecatedProtocol1> /* { dg-warning "is deprecated" } */
33 @end
35 @interface Class2 <NonDeprecatedProtocol1>
36 @end
38 @interface Class3 <NonDeprecatedProtocol1, DeprecatedProtocol1> /* { dg-warning "is deprecated" } */
39 @end
41 @interface Class2 (Category1) <DeprecatedProtocol1> /* { dg-warning "is deprecated" } */
42 @end
44 void function1 (id <DeprecatedProtocol1> object); /* { dg-warning "is deprecated" } */
45 void function2 (id <NonDeprecatedProtocol1> object);
47 @class Class4;
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" } */
53 int function6 (void)
55   Protocol *p1 = @protocol (DeprecatedProtocol1); /* { dg-warning "is deprecated" } */
56   Protocol *p2 = @protocol (NonDeprecatedProtocol1);
58   return (p1 == p2);