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