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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [objc.dg/] [bitfield-2.m] - Blame information for rev 825

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

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

powered by: WebSVN 2.1.0

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