1/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010.  */
2/* { dg-do compile } */
3
4/* Test that all protocols appearing in @interface declarations are
5   real (ie, we saw a full @protocol definition with list of methods),
6   and not just forward-references (ie, "@protocol NSObject;").  This
7   test checks protocols implemented by other protocols.  */
8
9#include <objc/objc.h>
10
11@protocol MyProtocol;
12
13@interface MyClass <MyProtocol> /* { dg-warning "definition of protocol .MyProtocol. not found" } */
14@end
15
16
17@protocol MyProtocol2 <MyProtocol>
18- (int)method2;
19@end
20
21@interface MyClass2 <MyProtocol2> /* { dg-warning "definition of protocol .MyProtocol. not found" } */
22- (int)method2;
23@end
24
25
26@protocol MyProtocol3 <MyProtocol2>
27- (int)method3;
28@end
29
30@interface MyClass3 <MyProtocol3>  /* { dg-warning "definition of protocol .MyProtocol. not found" } */
31- (int)method2;
32- (int)method3;
33@end
34
35
36@protocol MyProtocol4 <MyProtocol3, MyProtocol2>
37- (int)method4;
38@end
39
40@interface MyClass4 <MyProtocol4>  /* { dg-warning "definition of protocol .MyProtocol. not found" } */
41- (int)method2;
42- (int)method3;
43- (int)method4;
44@end
45
46
47@protocol MyProtocol5
48- (int)method5;
49@end
50
51@interface MyClass5 <MyProtocol5> /* Ok */
52- (int)method5;
53@end
54
55
56@protocol MyProtocol6 <MyProtocol5>
57- (int)method6;
58@end
59
60@interface MyClass6 <MyProtocol6> /* Ok */
61- (int)method5;
62- (int)method6;
63@end
64
65
66@protocol MyProtocol7 <MyProtocol5, MyProtocol4>
67- (int)method7;
68@end
69
70@interface MyClass7 <MyProtocol7> /* { dg-warning "definition of protocol .MyProtocol. not found" } */
71- (int)method2;
72- (int)method3;
73- (int)method4;
74- (int)method5;
75- (int)method7;
76@end
77
78
79/* Now test that if we finally define MyProtocol, the warnings go away.  */
80@protocol MyProtocol
81- (int)method;
82@end
83
84@protocol MyProtocol8 <MyProtocol5, MyProtocol4>
85- (int)method8;
86@end
87
88@interface MyClass8 <MyProtocol8> /* Ok */
89- (int)method;
90- (int)method2;
91- (int)method3;
92- (int)method4;
93- (int)method5;
94- (int)method8;
95@end
96