Replace absolute linenrs in objc.dg,obj-c++.dg
[official-gcc.git] / gcc / testsuite / objc.dg / property / at-property-25.m
blobf5f4988d478f6771200c79e70c5b054dc181f3cc
1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
2 /* { dg-do compile } */
4 /* Test warnings and non-warnings with @optional @properties.  */
6 #include <stdlib.h>
7 #include <objc/objc.h>
8 #include <objc/runtime.h>
10 @interface MyRootClass
12   Class isa;
14 + (id) initialize;
15 + (id) alloc;
16 - (id) init;
17 @end
19 @implementation MyRootClass
20 + (id) initialize { return self; }
21 + (id) alloc { return class_createInstance (self, 0); }
22 - (id) init { return self; }
23 @end
25 @protocol count
26 @optional
27 @property int count1;
28 @property (readonly) int count2;
29 @end
32 /* A class that implements all the properties.  */
33 @interface MySubClass1 : MyRootClass <count>
35   int count1;
36   int count2;
38 @end
40 @implementation MySubClass1
41 @synthesize count1;
42 @synthesize count2;
43 @end
46 /* A class that implements nothing; no warnings as the properties are
47    all optional.  */
48 @interface MySubClass2 : MyRootClass <count>
49 @end
51 @implementation MySubClass2
52 @end
55 @protocol count2
56 @required
57 @property int count1;
58 @property (readonly) int count2;
59 @end
61 /* A class that implements all the properties.  */
62 @interface MySubClass3 : MyRootClass <count2>
64   int count1;
65   int count2;
67 @end
69 @implementation MySubClass3
70 @synthesize count1;
71 @synthesize count2;
72 @end
75 /* A class that implements nothing; warnings as the properties are
76    all required.  */
77 @interface MySubClass4 : MyRootClass <count2>
78 @end
80 @implementation MySubClass4
81 @end
82 /* { dg-warning "incomplete implementation of class" "" { target *-*-* } .-1 } */
83 /* { dg-warning "method definition for ..setCount1:. not found" "" { target *-*-* } .-2 } */
84 /* { dg-warning "method definition for ..count1. not found" "" { target *-*-* } .-3 } */
85 /* { dg-warning "method definition for ..count2. not found" "" { target *-*-* } .-4 } */
86 /* { dg-warning "class .MySubClass4. does not fully implement the .count2. protocol" "" { target *-*-* } .-5 } */