OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [obj-c++.dg/] [property/] [at-property-17.mm] - Blame information for rev 703

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 703 jeremybenn
/* Contributed by Nicola Pero , November 2010.  */
2
/* { dg-do compile } */
3
 
4
#include 
5
 
6
/* Test that if you have a property declared in a class, with
7
   getters/setters in the superclass, there are no warnings.  */
8
 
9
@interface MyRootClass
10
{
11
  Class isa;
12
  int myCount;
13
  int myCount2;
14
  int myCount3;
15
}
16
- (int)count;
17
- (void)setCount: (int)number;
18
- (int)count2;
19
- (void)setCount2: (int)number;
20
- (int)count3;
21
@end
22
 
23
@implementation MyRootClass
24
- (int) count
25
{
26
  return myCount;
27
}
28
- (void) setCount: (int)number
29
{
30
  myCount = number;
31
}
32
- (int) count2
33
{
34
  return myCount2;
35
}
36
- (void) setCount2: (int)number
37
{
38
  myCount2 = number;
39
}
40
- (int) count3
41
{
42
  return myCount3;
43
}
44
@end
45
 
46
 
47
 
48
/* Try with a subclass.  */
49
@interface MyClass : MyRootClass
50
@property int count;
51
@end
52
 
53
@implementation MyClass
54
@end /* No warnings.  */
55
 
56
 
57
 
58
/* Try with a category.  */
59
@interface MyRootClass (count)
60
@property int count;
61
@end
62
 
63
@implementation MyRootClass (count)
64
@end /* No warnings.  */
65
 
66
 
67
 
68
/* Try with a category of a subclass.  */
69
@interface MyClass2 : MyClass
70
@end
71
 
72
@implementation MyClass2
73
@end
74
 
75
@interface MyClass2 (count2)
76
@property int count2;
77
@end
78
 
79
@implementation MyClass2 (count2)
80
@end /* No warnings.  */
81
 
82
 
83
 
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
88
 
89
@implementation MyClass3
90
@end
91
 
92
@interface MyClass3 (count3)
93
@property int count3;
94
@end
95
 
96
@implementation MyClass3 (count3)
97
@end /* { dg-warning "incomplete implementation" } */
98
/* { dg-warning "method definition for .-setCount3:. not found" "" { target *-*-* } 97 } */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.