diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2024-10-31 15:27:12 (GMT) |
---|---|---|
committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2024-10-31 15:27:12 (GMT) |
commit | 5be04ec2ceb1df77afbca4fcbf9e92a712612d6f (patch) | |
tree | 2b2e1c71dffae827c8e45cd4cccc375093d03486 /gl/stdalign.in.h | |
parent | 6d1d1dac32841d5ca6ee51bb09b30a6c604b17e2 (diff) | |
download | monitoring-plugins-5be04ec2ceb1df77afbca4fcbf9e92a712612d6f.tar.gz |
Sync with the latest Gnulib code (d4ec02b3cc)refs/pull/2037/head
Diffstat (limited to 'gl/stdalign.in.h')
-rw-r--r-- | gl/stdalign.in.h | 137 |
1 files changed, 0 insertions, 137 deletions
diff --git a/gl/stdalign.in.h b/gl/stdalign.in.h deleted file mode 100644 index 7f9dbb4..0000000 --- a/gl/stdalign.in.h +++ /dev/null | |||
@@ -1,137 +0,0 @@ | |||
1 | /* A substitute for ISO C11 <stdalign.h>. | ||
2 | |||
3 | Copyright 2011-2023 Free Software Foundation, Inc. | ||
4 | |||
5 | This file is free software: you can redistribute it and/or modify | ||
6 | it under the terms of the GNU Lesser General Public License as | ||
7 | published by the Free Software Foundation; either version 2.1 of the | ||
8 | License, or (at your option) any later version. | ||
9 | |||
10 | This file is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public License | ||
16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
17 | |||
18 | /* Written by Paul Eggert and Bruno Haible. */ | ||
19 | |||
20 | #ifndef _GL_STDALIGN_H | ||
21 | #define _GL_STDALIGN_H | ||
22 | |||
23 | /* ISO C11 <stdalign.h> for platforms that lack it. | ||
24 | |||
25 | References: | ||
26 | ISO C11 (latest free draft | ||
27 | <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf>) | ||
28 | sections 6.5.3.4, 6.7.5, 7.15. | ||
29 | C++11 (latest free draft | ||
30 | <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf>) | ||
31 | section 18.10. */ | ||
32 | |||
33 | /* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment | ||
34 | requirement of a structure member (i.e., slot or field) that is of | ||
35 | type TYPE, as an integer constant expression. | ||
36 | |||
37 | This differs from GCC's and clang's __alignof__ operator, which can | ||
38 | yield a better-performing alignment for an object of that type. For | ||
39 | example, on x86 with GCC and on Linux/x86 with clang, | ||
40 | __alignof__ (double) and __alignof__ (long long) are 8, whereas | ||
41 | alignof (double) and alignof (long long) are 4 unless the option | ||
42 | '-malign-double' is used. | ||
43 | |||
44 | The result cannot be used as a value for an 'enum' constant, if you | ||
45 | want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */ | ||
46 | |||
47 | /* FreeBSD 9.1 <sys/cdefs.h>, included by <stddef.h> and lots of other | ||
48 | standard headers, defines conflicting implementations of _Alignas | ||
49 | and _Alignof that are no better than ours; override them. */ | ||
50 | #undef _Alignas | ||
51 | #undef _Alignof | ||
52 | |||
53 | /* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 | ||
54 | <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. | ||
55 | clang versions < 8.0.0 have the same bug. */ | ||
56 | #if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ | ||
57 | || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ | ||
58 | && !defined __clang__) \ | ||
59 | || (defined __clang__ && __clang_major__ < 8)) | ||
60 | # ifdef __cplusplus | ||
61 | # if (201103 <= __cplusplus || defined _MSC_VER) | ||
62 | # define _Alignof(type) alignof (type) | ||
63 | # else | ||
64 | template <class __t> struct __alignof_helper { char __a; __t __b; }; | ||
65 | # define _Alignof(type) offsetof (__alignof_helper<type>, __b) | ||
66 | # define _GL_STDALIGN_NEEDS_STDDEF 1 | ||
67 | # endif | ||
68 | # else | ||
69 | # if (defined __GNUC__ && 4 <= __GNUC__) || defined __clang__ | ||
70 | # define _Alignof(type) __builtin_offsetof (struct { char __a; type __b; }, __b) | ||
71 | # else | ||
72 | # define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) | ||
73 | # define _GL_STDALIGN_NEEDS_STDDEF 1 | ||
74 | # endif | ||
75 | # endif | ||
76 | #endif | ||
77 | #if ! (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER)) | ||
78 | # define alignof _Alignof | ||
79 | #endif | ||
80 | #define __alignof_is_defined 1 | ||
81 | |||
82 | /* alignas (A), also known as _Alignas (A), aligns a variable or type | ||
83 | to the alignment A, where A is an integer constant expression. For | ||
84 | example: | ||
85 | |||
86 | int alignas (8) foo; | ||
87 | struct s { int a; int alignas (8) bar; }; | ||
88 | |||
89 | aligns the address of FOO and the offset of BAR to be multiples of 8. | ||
90 | |||
91 | A should be a power of two that is at least the type's alignment | ||
92 | and at most the implementation's alignment limit. This limit is | ||
93 | 2**28 on typical GNUish hosts, and 2**13 on MSVC. To be portable | ||
94 | to MSVC through at least version 10.0, A should be an integer | ||
95 | constant, as MSVC does not support expressions such as 1 << 3. | ||
96 | To be portable to Sun C 5.11, do not align auto variables to | ||
97 | anything stricter than their default alignment. | ||
98 | |||
99 | The following C11 requirements are not supported here: | ||
100 | |||
101 | - If A is zero, alignas has no effect. | ||
102 | - alignas can be used multiple times; the strictest one wins. | ||
103 | - alignas (TYPE) is equivalent to alignas (alignof (TYPE)). | ||
104 | |||
105 | */ | ||
106 | |||
107 | #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 | ||
108 | # if defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER) | ||
109 | # define _Alignas(a) alignas (a) | ||
110 | # elif (!defined __attribute__ \ | ||
111 | && ((defined __APPLE__ && defined __MACH__ \ | ||
112 | ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ | ||
113 | : __GNUC__ && !defined __ibmxl__) \ | ||
114 | || (4 <= __clang_major__) \ | ||
115 | || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \ | ||
116 | || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__)) | ||
117 | # define _Alignas(a) __attribute__ ((__aligned__ (a))) | ||
118 | # elif 1300 <= _MSC_VER | ||
119 | # define _Alignas(a) __declspec (align (a)) | ||
120 | # endif | ||
121 | #endif | ||
122 | #if ((defined _Alignas \ | ||
123 | && !(defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))) \ | ||
124 | || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) | ||
125 | # define alignas _Alignas | ||
126 | #endif | ||
127 | #if (defined alignas \ | ||
128 | || (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))) | ||
129 | # define __alignas_is_defined 1 | ||
130 | #endif | ||
131 | |||
132 | /* Include <stddef.h> if needed for offsetof. */ | ||
133 | #if _GL_STDALIGN_NEEDS_STDDEF | ||
134 | # include <stddef.h> | ||
135 | #endif | ||
136 | |||
137 | #endif /* _GL_STDALIGN_H */ | ||