Debian Codegraph @

gcc/testsuite/objc.dg/proto-hier-2.m

raw
1 /* Test protocol warning. */
2 /* Contributed by Devang Patel <[email protected]>. */
3 /* { dg-do compile } */
4 /* { dg-additional-options "-Wno-objc-root-class" } */
5
6 typedef struct objc_object { struct objc_class *class_pointer; } *id;
7
8 @protocol Bar
9 @end
10
11 id <Bar> Foo_Bar () { }
12
13 typedef struct
14 {
15 int i;
16 } MyStruct;
17
18 @interface Foo
19 {
20 id _mainData;
21 MyStruct *_anotherData;
22 }
23
24 -(id) mainDataSource;
25 -(id) anotherDataSource;
26 -(id) my_method: (int) i;
27 @end
28
29 @implementation Foo
30 -(id) anotherDataSource
31 {
32 return (id)_anotherData;
33 }
34
35 -(id) mainDataSource
36 {
37 return _mainData;
38 }
39
40 -(id) my_method: (int) i
41 {
42 id one = [self anotherDataSource];
43
44 i = i - 1;
45 // Do not issue warning about my_method not found in protocol
46 return [(one ? [self mainDataSource] : one) my_method:i];
47 }
48
49 @end
50