[PATCH] RISC-V: Fix unrecognizable pattern in riscv_expand_conditional_move()
[official-gcc.git] / gcc / testsuite / objc.dg / proto-hier-1.m
blob648a4d45cc3949b7bc398e00f901329995ac7bb6
1 /* Test for handling of protocol hierarchies.  */
2 /* Author: Ziemowit Laski <zlaski@apple.com>.  */
3 /* { dg-do compile } */
4 /* { dg-additional-options "-Wno-objc-root-class" } */
6 /* One-line substitute for objc/objc.h */
7 typedef struct objc_object { struct objc_class *class_pointer; } *id;
9 @protocol NSObj 
10 - (void)someMethod;
11 @end
13 @protocol NSCopying 
14 - (void)someOtherMethod;
15 @end
17 @interface NSObject <NSObj>
18 - (void)someMethod; 
19 @end
21 @implementation NSObject
22 - (void)someMethod {}
23 @end
25 @protocol Booing <NSObj>
26 - (void)boo;
27 @end
29 @interface Boo: NSObject <Booing>  // protocol has only one parent
30 @end
32 @implementation Boo
33 - (void)boo {}
34 @end
36 @protocol Fooing <NSCopying, NSObj>  // Fooing has two parent protocols
37 - (void)foo;
38 @end
40 @interface Foo: NSObject <Fooing>
41 @end
43 @implementation Foo
44 - (void)foo {}
45 - (void)someOtherMethod {}
46 @end
48 int foo(void) {
49   id<Booing, Fooing> stupidVar;
50   [stupidVar boo];
51   [stupidVar foo];
52   [stupidVar anotherMsg]; /* { dg-warning ".\\-anotherMsg. not found in protocol" } */
53        /* { dg-warning "no .\\-anotherMsg. method found" "" { target *-*-* } .-1 } */
54   return 0;
57 /* { dg-warning "messages without a matching method signature will be assumed to return .id. and accept .\.\.\.. as arguments" "" { target *-*-* } 0 } */