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