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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [x86_64/] [abi/] [macros.h] - Blame information for rev 691

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 691 jeremybenn
#ifndef MACROS_H
2
 
3
#define check_size(_t, _size) assert(sizeof(_t) == (_size))
4
 
5
#define check_align(_t, _align) assert(__alignof__(_t) == (_align))
6
 
7
#define check_align_lv(_t, _align) assert(__alignof__(_t) == (_align) \
8
                                          && (((unsigned long)&(_t)) & ((_align) - 1) ) == 0)
9
 
10
#define check_basic_struct_size_and_align(_type, _size, _align) { \
11
  struct _str { _type dummy; } _t; \
12
  check_size(_t, _size); \
13
  check_align_lv(_t, _align); \
14
}
15
 
16
#define check_array_size_and_align(_type, _size, _align) { \
17
  _type _a[1]; _type _b[2]; _type _c[16]; \
18
  struct _str { _type _a[1]; } _s; \
19
  check_align_lv(_a[0], _align); \
20
  check_size(_a, _size); \
21
  check_size(_b, (_size*2)); \
22
  check_size(_c, (_size*16)); \
23
  check_size(_s, _size); \
24
  check_align_lv(_s._a[0], _align); \
25
}
26
 
27
#define check_basic_union_size_and_align(_type, _size, _align) { \
28
  union _union { _type dummy; } _u; \
29
  check_size(_u, _size); \
30
  check_align_lv(_u, _align); \
31
}
32
 
33
#define run_signed_tests2(_function, _arg1, _arg2) \
34
  _function(_arg1, _arg2); \
35
  _function(signed _arg1, _arg2); \
36
  _function(unsigned _arg1, _arg2);
37
 
38
#define run_signed_tests3(_function, _arg1, _arg2, _arg3) \
39
  _function(_arg1, _arg2, _arg3); \
40
  _function(signed _arg1, _arg2, _arg3); \
41
  _function(unsigned _arg1, _arg2, _arg3);
42
 
43
/* Check size of a struct and a union of three types.  */
44
 
45
#define check_struct_and_union3(type1, type2, type3, struct_size, align_size) \
46
{ \
47
  struct _str { type1 t1; type2 t2; type3 t3; } _t; \
48
  union _uni { type1 t1; type2 t2; type3 t3; } _u; \
49
  check_size(_t, struct_size); \
50
  check_size(_u, align_size); \
51
}
52
 
53
#endif // MACROS_H

powered by: WebSVN 2.1.0

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