testsuite: skip attr-retain-?.c on AIX
[official-gcc.git] / gcc / testsuite / objc.dg / proto-hier-2.m
blob6b3f803d5cba56947e2289a472a5fd44acd72792
1 /* Test protocol warning.  */
2 /* Contributed by Devang Patel <dpatel@apple.com>.  */
3 /* { dg-do compile } */
4 /* { dg-additional-options "-Wno-objc-root-class" } */
6 typedef struct objc_object { struct objc_class *class_pointer; } *id;
8 @protocol Bar
9 @end
11 id <Bar> Foo_Bar () { }
13 typedef struct
15         int i;
16 } MyStruct;
18 @interface Foo
20   id _mainData;
21   MyStruct *_anotherData;
24 -(id) mainDataSource;
25 -(id) anotherDataSource;
26 -(id) my_method: (int) i;
27 @end
29 @implementation Foo
30 -(id) anotherDataSource
32         return (id)_anotherData;
35 -(id) mainDataSource
37         return _mainData;
40 -(id) my_method: (int) i
42   id one = [self anotherDataSource];
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];
49 @end