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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc.dg/] [property/] [dotsyntax-1.m] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 704 jeremybenn
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, 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' without a declarated property.  */
6
 
7
#include <stdlib.h>
8
#include <objc/objc.h>
9
#include <objc/runtime.h>
10
 
11
@interface MyRootClass
12
{
13
  Class isa;
14
  int a;
15
  id b;
16
}
17
+ (id) initialize;
18
+ (id) alloc;
19
- (id) init;
20
- (int) count;
21
- (void) setCount: (int)value;
22
- (id) next;
23
- (void) setNext: (id)value;
24
@end
25
 
26
@implementation MyRootClass
27
+ (id) initialize { return self; }
28
+ (id) alloc { return class_createInstance (self, 0); }
29
- (id) init { return self; }
30
- (int) count
31
{
32
  return a;
33
}
34
- (void) setCount: (int)value
35
{
36
  a = value;
37
}
38
- (id) next
39
{
40
  return b;
41
}
42
- (void) setNext: (id)value
43
{
44
  b = value;
45
}
46
@end
47
 
48
int main (void)
49
{
50
  MyRootClass *object = [[MyRootClass alloc] init];
51
 
52
  object.count = 40;
53
  if (object.count != 40)
54
    abort ();
55
 
56
  object.next = object;
57
  if (object.next != object)
58
    abort ();
59
 
60
  return 0;
61
}
62
 
63
 

powered by: WebSVN 2.1.0

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