Debian Codegraph @

gcc/testsuite/objc.dg/property/dynamic-4.m

raw
1 /* Contributed by Nicola Pero <[email protected]>, November 2010. */
2 /* { dg-do compile } */
3
4 #include <objc/objc.h>
5
6 @interface MyRootClass
7 {
8 Class isa;
9 }
10 @end
11
12 @implementation MyRootClass
13 @end
14
15 /* Test @property/@dynamic with protocols. */
16
17 @protocol MyProtocol
18 @property int a;
19 @end
20
21
22 /* This class is declared to conform to the protocol, but because of
23 @dynamic, no warnings are issued even if the getter/setter for the
24 @property are missing. */
25 @interface MyClass1 : MyRootClass <MyProtocol>
26 @end
27
28 @implementation MyClass1
29 @dynamic a;
30 @end
31
32
33 /* This class is declared to conform to the protocol and warnings are
34 issued because the setter for the @property is missing. */
35 @interface MyClass2 : MyRootClass <MyProtocol>
36 @end
37
38 @implementation MyClass2
39 - (int) a
40 {
41 return 0;
42 }
43 @end /* { dg-warning "incomplete implementation" } */
44 /* { dg-warning "method definition for .-setA:. not found" "" { target *-*-* } .-1 } */
45 /* { dg-warning "class .MyClass2. does not fully implement the .MyProtocol. protocol" "" { target *-*-* } .-2 } */