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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc.dg/] [property/] [at-property-8.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>, October 2010.  */
2
/* { dg-do run } */
3
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
4
 
5
/* Test the property syntax with non-synthesized setter/getter
6
   and with a non-standard name for the setter.  */
7
 
8
#include <stdlib.h>
9
#include <objc/objc.h>
10
#include <objc/runtime.h>
11
 
12
@interface MyRootClass
13
{
14
  Class isa;
15
  int a;
16
}
17
@property (setter = writeA:, nonatomic) int a;
18
+ (id) initialize;
19
+ (id) alloc;
20
- (id) init;
21
@end
22
 
23
@implementation MyRootClass
24
+ (id) initialize { return self; }
25
+ (id) alloc { return class_createInstance (self, 0); }
26
- (id) init { return self; }
27
 
28
- (int) a
29
{
30
  return a;
31
}
32
- (void) writeA: (int)value
33
{
34
  a = value;
35
}
36
@end
37
 
38
int main (void)
39
{
40
  MyRootClass *object = [[MyRootClass alloc] init];
41
 
42
  object.a = 14;
43
 
44
  if (object.a != 14)
45
    abort ();
46
 
47
  object.a = 23;
48
 
49
  if (object.a != 23)
50
    abort ();
51
 
52
  object.a = 78;
53
 
54
  if (object.a != 78)
55
    abort ();
56
 
57
  return 0;
58
}

powered by: WebSVN 2.1.0

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