diff options
| author | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-08-19 23:27:12 +0200 |
|---|---|---|
| committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-08-19 23:27:12 +0200 |
| commit | 26fbe7f1e68bb0c96da32491efcf3696fe6c299b (patch) | |
| tree | c4d95289187a64e9c7517bf73d8208026c3d2fb3 /gl/alignof.h | |
| parent | 5f79e3e9f62ca5487d9881973149136ba1d19d3e (diff) | |
| download | monitoring-plugins-26fbe7f1e68bb0c96da32491efcf3696fe6c299b.tar.gz | |
Sync with the latest Gnulib code (6f2d632)
Diffstat (limited to 'gl/alignof.h')
| -rw-r--r-- | gl/alignof.h | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/gl/alignof.h b/gl/alignof.h deleted file mode 100644 index 240468c6..00000000 --- a/gl/alignof.h +++ /dev/null | |||
| @@ -1,53 +0,0 @@ | |||
| 1 | /* Determine alignment of types. | ||
| 2 | Copyright (C) 2003-2004, 2006, 2009-2010 Free Software Foundation, Inc. | ||
| 3 | |||
| 4 | This program is free software; you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation; either version 3, or (at your option) | ||
| 7 | any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program; if not, write to the Free Software Foundation, | ||
| 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | ||
| 17 | |||
| 18 | #ifndef _ALIGNOF_H | ||
| 19 | #define _ALIGNOF_H | ||
| 20 | |||
| 21 | #include <stddef.h> | ||
| 22 | |||
| 23 | /* Determine the alignment of a structure slot (field) of a given type, | ||
| 24 | at compile time. Note that the result depends on the ABI. | ||
| 25 | Note: The result cannot be used as a value for an 'enum' constant, | ||
| 26 | due to bugs in HP-UX 10.20 cc and AIX 3.2.5 xlc. */ | ||
| 27 | #if defined __cplusplus | ||
| 28 | template <class type> struct alignof_helper { char __slot1; type __slot2; }; | ||
| 29 | # define alignof_slot(type) offsetof (alignof_helper<type>, __slot2) | ||
| 30 | #else | ||
| 31 | # define alignof_slot(type) offsetof (struct { char __slot1; type __slot2; }, __slot2) | ||
| 32 | #endif | ||
| 33 | |||
| 34 | /* Determine the good alignment of a object of the given type at compile time. | ||
| 35 | Note that this is not necessarily the same as alignof_slot(type). | ||
| 36 | For example, with GNU C on x86 platforms: alignof_type(double) = 8, but | ||
| 37 | - when -malign-double is not specified: alignof_slot(double) = 4, | ||
| 38 | - when -malign-double is specified: alignof_slot(double) = 8. | ||
| 39 | Note: The result cannot be used as a value for an 'enum' constant, | ||
| 40 | due to bugs in HP-UX 10.20 cc and AIX 3.2.5 xlc. */ | ||
| 41 | #if defined __GNUC__ | ||
| 42 | # define alignof_type __alignof__ | ||
| 43 | #else | ||
| 44 | # define alignof_type alignof_slot | ||
| 45 | #endif | ||
| 46 | |||
| 47 | /* alignof is an alias for alignof_slot semantics, since that's what most | ||
| 48 | callers need. | ||
| 49 | Note: The result cannot be used as a value for an 'enum' constant, | ||
| 50 | due to bugs in HP-UX 10.20 cc and AIX 3.2.5 xlc. */ | ||
| 51 | #define alignof alignof_slot | ||
| 52 | |||
| 53 | #endif /* _ALIGNOF_H */ | ||
