PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / objc.dg / class-extension-2.m
blob7f55b601fb3b2ced9e5008394b35f7cba266c992
1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010.  */
2 /* { dg-do compile } */
4 /* This test tests class extensions and protocols.  */
6 #include <objc/objc.h>
8 /* First, a simple test where a plain class has a protocol attached to
9    it in a class extension.  */
10 @interface MyObject
12   Class isa;
14 @end
16 @protocol MyProtocol
17 - (void) test;
18 @end
20 @interface MyObject () <MyProtocol>
21 @end
23 @implementation MyObject
24 @end /* { dg-warning "incomplete implementation of class .MyObject." } */
25      /* { dg-warning "method definition for .-test. not found" "" { target *-*-* } .-1 } */
26      /* { dg-warning "class .MyObject. does not fully implement the .MyProtocol. protocol" "" { target *-*-* } .-2 } */
30 /* Second, a more interesting test where protocols are added from the
31    main class and from two different class extensions.  */
32 @interface MyObject2 : MyObject <MyProtocol>
33 @end
35 @protocol MyProtocol2
36 - (void) test2;
37 @end
39 @protocol MyProtocol3
40 - (void) test3;
41 @end
43 @interface MyObject2 () <MyProtocol2>
44 @end
46 @interface MyObject2 () <MyProtocol3>
47 @end
49 @implementation MyObject2
50 @end /* { dg-warning "incomplete implementation of class .MyObject2." } */
51      /* { dg-warning "method definition for .-test. not found" "" { target *-*-* } .-1 } */
52      /* { dg-warning "class .MyObject2. does not fully implement the .MyProtocol. protocol" "" { target *-*-* } .-2 } */
53      /* { dg-warning "method definition for .-test2. not found" "" { target *-*-* } .-3 } */
54      /* { dg-warning "class .MyObject2. does not fully implement the .MyProtocol2. protocol" "" { target *-*-* } .-4 } */
55      /* { dg-warning "method definition for .-test3. not found" "" { target *-*-* } .-5 } */
56      /* { dg-warning "class .MyObject2. does not fully implement the .MyProtocol3. protocol" "" { target *-*-* } .-6 } */