1/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010. */ 2/* { dg-do compile } */ 3 4/* This test tests class extensions and protocols. */ 5 6#include <objc/objc.h> 7 8/* First, a simple test where a plain class has a protocol attached to 9 it in a class extension. */ 10@interface MyObject 11{ 12 Class isa; 13} 14@end 15 16@protocol MyProtocol 17- (void) test; 18@end 19 20@interface MyObject () <MyProtocol> 21@end 22 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 } */ 27 28 29 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 34 35@protocol MyProtocol2 36- (void) test2; 37@end 38 39@protocol MyProtocol3 40- (void) test3; 41@end 42 43@interface MyObject2 () <MyProtocol2> 44@end 45 46@interface MyObject2 () <MyProtocol3> 47@end 48 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 } */ 57