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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc.dg/] [property/] [synthesize-10.m] - Blame information for rev 704

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 @synthesize with bitfield instance variables.  */
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 countA : 2;
15
  int countB : 3;
16
  int countC : 4;
17
}
18
+ (id) initialize;
19
+ (id) alloc;
20
- (id) init;
21
@property (nonatomic) int countA;
22
@property (nonatomic) int countB;
23
@property (nonatomic) int countC;
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
@synthesize countA;
31
@synthesize countB;
32
@synthesize countC;
33
@end
34
 
35
int main (void)
36
{
37
  MyRootClass *object = [[MyRootClass alloc] init];
38
 
39
  object.countA = 1;
40
  object.countB = 3;
41
  object.countC = 4;
42
 
43
  if (object.countA != 1)
44
    abort ();
45
 
46
  if (object.countB != 3)
47
    abort ();
48
 
49
  if (object.countC != 4)
50
    abort ();
51
 
52
  return 0;
53
}

powered by: WebSVN 2.1.0

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