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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 704 jeremybenn
/* Check if bitfield ivars are correctly @encode'd when
2
   the NeXT runtime is used.  */
3
/* Contributed by Ziemowit Laski <zlaski@apple.com>.  */
4
/* { dg-options "-fsigned-char" } */
5
/* { dg-do run { target *-*-darwin* } } */
6
/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
7
 
8
typedef struct objc_object { struct objc_class *class_pointer; } *id;
9
 
10
extern void abort(void);
11
extern int strcmp(const char *, const char *);
12
 
13
#define CHECK_IF(expr) if(!(expr)) abort();
14
 
15
@interface Base
16
{
17
    struct objc_class *isa;
18
    int full;
19
    int full2: 32;
20
    int _refs: 8;
21
    int field2: 3;
22
    unsigned f3: 8;
23
    short cc;
24
    unsigned g: 16;
25
    int r2: 8;
26
    int r3: 8;
27
    int r4: 2;
28
    int r5: 8;
29
    char c;
30
}
31
@end
32
 
33
@interface Derived: Base
34
{
35
    char d;
36
    int _field3: 6;
37
}
38
@end
39
 
40
@implementation Base
41
@end
42
 
43
@implementation Derived
44
@end
45
 
46
int main(void) {
47
  const char *s1r = "{Base=#ib32b8b3b8sb16b8b8b2b8c}";
48
  const char *s1 = @encode(Base);
49
  const char *s2r = "{Derived=#ib32b8b3b8sb16b8b8b2b8ccb6}";
50
  const char *s2 = @encode(Derived);
51
 
52
  CHECK_IF(!strcmp(s1r, s1));
53
  CHECK_IF(!strcmp(s2r, s2));
54
 
55
  return 0;
56
}

powered by: WebSVN 2.1.0

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