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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [obj-c++.dg/] [bitfield-4.mm] - Blame information for rev 762

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

Line No. Rev Author Line
1 703 jeremybenn
/* Check if the @defs() construct preserves the correct
2
   layout of bitfields.  */
3
/* Contributed by Ziemowit Laski .  */
4
/* { dg-do run } */
5
/* { dg-options "-Wpadded" } */
6
 
7
#include "../objc-obj-c++-shared/TestsuiteObject.m"
8
 
9
#include 
10
#include 
11
 
12
#define CHECK_IF(expr) if(!(expr)) abort()
13
 
14
enum Enum { one, two, three, four };
15
 
16
@interface Base: TestsuiteObject {
17
  unsigned a: 2;
18
  int b: 3;
19
  enum Enum c: 4;
20
  unsigned d: 5;
21
} /* { dg-warning "padding struct size to alignment boundary" } */
22
@end
23
 
24
@interface Derived: Base {
25
  signed e: 5;
26
  int f: 4;
27
  enum Enum g: 3;
28
}
29
@end
30
 
31
/* Note that the semicolon after @defs(...) is optional.  */
32
 
33
typedef struct { @defs(Base) } Base_t;  /* { dg-warning "padding struct size to alignment boundary" } */
34
typedef struct { @defs(Derived); } Derived_t;
35
 
36
int main(void)
37
{
38
  CHECK_IF(sizeof(Base_t) == sizeof(Base));
39
  CHECK_IF(sizeof(Derived_t) == sizeof(Derived));
40
 
41
#ifdef __NEXT_RUNTIME__
42
  CHECK_IF(!strcmp(@encode(Base), "{Base=#b2b3b4b5}"));
43
  CHECK_IF(!strcmp(@encode(Derived), "{Derived=#b2b3b4b5b5b4b3}"));
44
 
45
  CHECK_IF(!strcmp(@encode(Base_t), "{?=#b2b3b4b5}"));
46
  CHECK_IF(!strcmp(@encode(Derived_t), "{?=#b2b3b4b5b5b4b3}"));
47
#endif /* __NEXT_RUNTIME__ */
48
 
49
  return 0;
50
}
51
 
52
/* { dg-prune-output "In file included from" }  Ignore this message.  */
53
/* { dg-bogus "padding struct to align" "PR23610" { target *-*-* } 0 } */
54
 
55
/* { dg-bogus "padding struct size" "PR23610" { xfail lp64 } 28 } */
56
/* { dg-bogus "padding struct size" "PR23610" { xfail lp64 } 34 } */

powered by: WebSVN 2.1.0

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