Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / objc.dg / property / at-property-17.m
blobefb62d6f70d98198d3c3c88321c9697875d36956
1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
2 /* { dg-do compile } */
4 #include <objc/objc.h>
6 /* Test that if you have a property declared in a class, with
7    getters/setters in the superclass, there are no warnings.  */
9 @interface MyRootClass
11   Class isa;
12   int myCount;
13   int myCount2;
14   int myCount3;
16 - (int)count;
17 - (void)setCount: (int)number;
18 - (int)count2;
19 - (void)setCount2: (int)number;
20 - (int)count3;
21 @end
23 @implementation MyRootClass
24 - (int) count
26   return myCount;
28 - (void) setCount: (int)number
30   myCount = number;
32 - (int) count2
34   return myCount2;
36 - (void) setCount2: (int)number
38   myCount2 = number;
40 - (int) count3
42   return myCount3;
44 @end
48 /* Try with a subclass.  */
49 @interface MyClass : MyRootClass
50 @property int count;
51 @end
53 @implementation MyClass
54 @end /* No warnings.  */
58 /* Try with a category.  */
59 @interface MyRootClass (count)
60 @property int count;
61 @end
63 @implementation MyRootClass (count)
64 @end /* No warnings.  */
68 /* Try with a category of a subclass.  */
69 @interface MyClass2 : MyClass
70 @end
72 @implementation MyClass2
73 @end
75 @interface MyClass2 (count2)
76 @property int count2;
77 @end
79 @implementation MyClass2 (count2)
80 @end /* No warnings.  */
84 /* Now, try with a category of a subclass, but with a missing setter,
85    which should generate a warning.  */
86 @interface MyClass3 : MyClass
87 @end
89 @implementation MyClass3
90 @end
92 @interface MyClass3 (count3)
93 @property int count3;
94 @end
96 @implementation MyClass3 (count3)
97 @end /* { dg-warning "incomplete implementation" } */
98 /* { dg-warning "method definition for .-setCount3:. not found" "" { target *-*-* } 97 } */