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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [objc.dg/] [bitfield-1.m] - Blame information for rev 316

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

Line No. Rev Author Line
1 309 jeremybenn
/* Check if bitfield ivars are inherited correctly (i.e., without
2
   being "promoted" to ints).  */
3
/* Contributed by Ziemowit Laski <zlaski@apple.com>.  */
4
/* { dg-do run } */
5
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
6
 
7
#include "../objc-obj-c++-shared/Object1.h"
8
#include <objc/objc.h>
9
 
10
extern void abort(void);
11
 
12
#define CHECK_IF(expr) if(!(expr)) abort();
13
 
14
@interface Base: Object
15
{
16
    int full;
17
    int full2: 32;
18
    int _refs: 8;
19
    int field2: 3;
20
    unsigned f3: 8;
21
    short cc;
22
    unsigned g: 16;
23
    int r2: 8;
24
    int r3: 8;
25
    int r4: 2;
26
    int r5: 8;
27
    char c;
28
}
29
- (void)setValues;
30
@end
31
 
32
@interface Derived: Base
33
{
34
    char d;
35
    int _field3: 6;
36
}
37
- (void)checkValues;
38
@end
39
 
40
@implementation Base
41
-(void)setValues {
42
  full = 1;
43
  full2 = 2;
44
  _refs = 3;
45
  field2 = 1;
46
  f3 = 6;
47
  cc = 7;
48
  g = 8;
49
  r2 = 9;
50
  r3 = 10;
51
  r4 = 1;
52
  r5 = 12;
53
  c = 13;
54
}
55
@end
56
 
57
@implementation Derived
58
-(void)checkValues {
59
  CHECK_IF(full == 1);
60
  CHECK_IF(full2 == 2);
61
  CHECK_IF(_refs == 3);
62
  CHECK_IF(field2 == 1);
63
  CHECK_IF(f3 == 6);
64
  CHECK_IF(cc == 7);
65
  CHECK_IF(g == 8);
66
  CHECK_IF(r2 == 9);
67
  CHECK_IF(r3 == 10);
68
  CHECK_IF(r4 == 1);
69
  CHECK_IF(r5 == 12);
70
  CHECK_IF(c == 13);
71
}
72
@end
73
 
74
int main(void) {
75
  Derived *obj = [[Derived alloc] init];
76
 
77
  [obj setValues];
78
  [obj checkValues];
79
 
80
  return 0;
81
}
82
 
83
#include "../objc-obj-c++-shared/Object1-implementation.h"

powered by: WebSVN 2.1.0

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