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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [obj-c++.dg/] [property/] [dotsyntax-5.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 run } */
3
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
4
 
5
/* Test the 'dot syntax' with self, both in instance and class methods.  */
6
 
7
#include 
8
#include 
9
#include 
10
 
11
static int c;
12
 
13
@interface MyRootClass
14
{
15
  Class isa;
16
  int a;
17
}
18
+ (id) initialize;
19
+ (id) alloc;
20
- (id) init;
21
- (int) count;
22
- (void) setCount: (int)count;
23
+ (int) classCount;
24
+ (void) setClassCount: (int)count;
25
@end
26
 
27
@implementation MyRootClass
28
+ (id) initialize { return self; }
29
+ (id) alloc { return class_createInstance (self, 0); }
30
- (id) init { return self; }
31
- (int) count
32
{
33
  return a;
34
}
35
- (void) setCount: (int)count
36
{
37
  a = count;
38
}
39
+ (int) classCount
40
{
41
  return c;
42
}
43
+ (void) setClassCount: (int)count
44
{
45
  c = count;
46
}
47
- (int) testMe
48
{
49
  self.count = 400;
50
  if (self.count != 400)
51
    abort ();
52
 
53
  return self.count;
54
}
55
+ (int) testMe
56
{
57
  self.classCount = 4000;
58
  if (self.classCount != 4000)
59
    abort ();
60
 
61
  return self.classCount;
62
}
63
@end
64
 
65
int main (void)
66
{
67
  MyRootClass *object = [[MyRootClass alloc] init];
68
 
69
  if ([object testMe] != 400)
70
    abort ();
71
 
72
  if ([MyRootClass testMe] != 4000)
73
    abort ();
74
 
75
  return 0;
76
}
77
 
78
 

powered by: WebSVN 2.1.0

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