1
/* -*- buffer-read-only: t -*- vi: set ro: */
2
/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3
/* Determine alignment of types.
4
Copyright (C) 2003-2004, 2006, 2009-2011 Free Software Foundation, Inc.
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 3, or (at your option)
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software Foundation,
18
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
25
/* Determine the alignment of a structure slot (field) of a given type,
26
at compile time. Note that the result depends on the ABI.
27
Note: The result cannot be used as a value for an 'enum' constant,
28
due to bugs in HP-UX 10.20 cc and AIX 3.2.5 xlc. */
29
#if defined __cplusplus
30
template <class type> struct alignof_helper { char __slot1; type __slot2; };
31
# define alignof_slot(type) offsetof (alignof_helper<type>, __slot2)
33
# define alignof_slot(type) offsetof (struct { char __slot1; type __slot2; }, __slot2)
36
/* Determine the good alignment of an object of the given type at compile time.
37
Note that this is not necessarily the same as alignof_slot(type).
38
For example, with GNU C on x86 platforms: alignof_type(double) = 8, but
39
- when -malign-double is not specified: alignof_slot(double) = 4,
40
- when -malign-double is specified: alignof_slot(double) = 8.
41
Note: The result cannot be used as a value for an 'enum' constant,
42
due to bugs in HP-UX 10.20 cc and AIX 3.2.5 xlc. */
44
# define alignof_type __alignof__
46
# define alignof_type alignof_slot
49
/* alignof is an alias for alignof_slot semantics, since that's what most
51
Note: The result cannot be used as a value for an 'enum' constant,
52
due to bugs in HP-UX 10.20 cc and AIX 3.2.5 xlc. */
53
#define alignof alignof_slot
55
#endif /* _ALIGNOF_H */