1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */
2 /* { dg-do compile } */
3 /* { dg-options "-Wno-protocol" } */
4 // { dg-additional-options "-Wno-objc-root-class" }
8 /* Test the -Wno-protocol flag. With this, at a class is accepted
9 (with no warnings) as conforming to a protocol even if some
10 protocol methods are implemented in the superclass. */
20 /* The superclass implements the method required by the protocol. */
21 @interface MyRootClass
28 @implementation MyRootClass
35 /* The subclass inherits the method (does not implement it directly)
36 but that still makes it conform to the protocol. No warnings. */
37 @interface MySubClass : MyRootClass <MyProtocol>
40 @implementation MySubClass
41 @end /* No warnings here. */
44 /* The subclass instead does not inherit the method method2 (and does
45 not implement it directly) so it does not conform to the
46 protocol MyProtocol2. */
47 @interface MySubClass2 : MyRootClass <MyProtocol2>
50 @implementation MySubClass2
51 @end /* Warnings here, below. */
52 /* { dg-warning "incomplete implementation of class .MySubClass2." "" { target *-*-* } .-1 } */
53 /* { dg-warning "method definition for .\\-method2. not found" "" { target *-*-* } .-2 } */
54 /* { dg-warning "class .MySubClass2. does not fully implement the .MyProtocol2. protocol" "" { target *-*-* } .-3 } */