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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [obj-c++.dg/] [bitfield-2.mm] - Blame information for rev 816

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

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