diff options
Diffstat (limited to 'gl/stddef.in.h')
-rw-r--r-- | gl/stddef.in.h | 78 |
1 files changed, 72 insertions, 6 deletions
diff --git a/gl/stddef.in.h b/gl/stddef.in.h index 6eadcc3..fa8998d 100644 --- a/gl/stddef.in.h +++ b/gl/stddef.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues. | 1 | /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues. |
2 | 2 | ||
3 | Copyright (C) 2009-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2009-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 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 | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -18,7 +18,7 @@ | |||
18 | /* Written by Eric Blake. */ | 18 | /* Written by Eric Blake. */ |
19 | 19 | ||
20 | /* | 20 | /* |
21 | * POSIX 2008 <stddef.h> for platforms that have issues. | 21 | * POSIX 2008 and ISO C 23 <stddef.h> for platforms that have issues. |
22 | * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stddef.h.html> | 22 | * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stddef.h.html> |
23 | */ | 23 | */ |
24 | 24 | ||
@@ -37,9 +37,9 @@ | |||
37 | remember if special invocation has ever been used to obtain wint_t, | 37 | remember if special invocation has ever been used to obtain wint_t, |
38 | in which case we need to clean up NULL yet again. */ | 38 | in which case we need to clean up NULL yet again. */ |
39 | 39 | ||
40 | # if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T) | 40 | # if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _@GUARD_PREFIX@_STDDEF_WINT_T) |
41 | # ifdef __need_wint_t | 41 | # ifdef __need_wint_t |
42 | # define _GL_STDDEF_WINT_T | 42 | # define _@GUARD_PREFIX@_STDDEF_WINT_T |
43 | # endif | 43 | # endif |
44 | # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ | 44 | # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ |
45 | /* On TinyCC, make sure that the macros that indicate the special invocation | 45 | /* On TinyCC, make sure that the macros that indicate the special invocation |
@@ -58,7 +58,7 @@ | |||
58 | 58 | ||
59 | /* On AIX 7.2, with xlc in 64-bit mode, <stddef.h> defines max_align_t to a | 59 | /* On AIX 7.2, with xlc in 64-bit mode, <stddef.h> defines max_align_t to a |
60 | type with alignment 4, but 'long' has alignment 8. */ | 60 | type with alignment 4, but 'long' has alignment 8. */ |
61 | # if defined _AIX && defined __LP64__ | 61 | # if defined _AIX && defined __LP64__ && !@HAVE_MAX_ALIGN_T@ |
62 | # if !GNULIB_defined_max_align_t | 62 | # if !GNULIB_defined_max_align_t |
63 | # ifdef _MAX_ALIGN_T | 63 | # ifdef _MAX_ALIGN_T |
64 | /* /usr/include/stddef.h has already defined max_align_t. Override it. */ | 64 | /* /usr/include/stddef.h has already defined max_align_t. Override it. */ |
@@ -69,6 +69,7 @@ typedef long rpl_max_align_t; | |||
69 | typedef long max_align_t; | 69 | typedef long max_align_t; |
70 | # define _MAX_ALIGN_T | 70 | # define _MAX_ALIGN_T |
71 | # endif | 71 | # endif |
72 | # define __CLANG_MAX_ALIGN_T_DEFINED | ||
72 | # define GNULIB_defined_max_align_t 1 | 73 | # define GNULIB_defined_max_align_t 1 |
73 | # endif | 74 | # endif |
74 | # endif | 75 | # endif |
@@ -79,7 +80,7 @@ typedef long max_align_t; | |||
79 | 80 | ||
80 | /* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */ | 81 | /* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */ |
81 | # if (@REPLACE_NULL@ \ | 82 | # if (@REPLACE_NULL@ \ |
82 | && (!defined _@GUARD_PREFIX@_STDDEF_H || defined _GL_STDDEF_WINT_T)) | 83 | && (!defined _@GUARD_PREFIX@_STDDEF_H || defined _@GUARD_PREFIX@_STDDEF_WINT_T)) |
83 | # undef NULL | 84 | # undef NULL |
84 | # ifdef __cplusplus | 85 | # ifdef __cplusplus |
85 | /* ISO C++ says that the macro NULL must expand to an integer constant | 86 | /* ISO C++ says that the macro NULL must expand to an integer constant |
@@ -100,6 +101,33 @@ typedef long max_align_t; | |||
100 | # ifndef _@GUARD_PREFIX@_STDDEF_H | 101 | # ifndef _@GUARD_PREFIX@_STDDEF_H |
101 | # define _@GUARD_PREFIX@_STDDEF_H | 102 | # define _@GUARD_PREFIX@_STDDEF_H |
102 | 103 | ||
104 | /* This file uses _Noreturn, _GL_ATTRIBUTE_NOTHROW. */ | ||
105 | #if !_GL_CONFIG_H_INCLUDED | ||
106 | #error "Please include config.h first." | ||
107 | #endif | ||
108 | |||
109 | /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. | ||
110 | */ | ||
111 | #ifndef _GL_ATTRIBUTE_NOTHROW | ||
112 | # if defined __cplusplus | ||
113 | # if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 | ||
114 | # if __cplusplus >= 201103L | ||
115 | # define _GL_ATTRIBUTE_NOTHROW noexcept (true) | ||
116 | # else | ||
117 | # define _GL_ATTRIBUTE_NOTHROW throw () | ||
118 | # endif | ||
119 | # else | ||
120 | # define _GL_ATTRIBUTE_NOTHROW | ||
121 | # endif | ||
122 | # else | ||
123 | # if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__ | ||
124 | # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) | ||
125 | # else | ||
126 | # define _GL_ATTRIBUTE_NOTHROW | ||
127 | # endif | ||
128 | # endif | ||
129 | #endif | ||
130 | |||
103 | /* Some platforms lack wchar_t. */ | 131 | /* Some platforms lack wchar_t. */ |
104 | #if !@HAVE_WCHAR_T@ | 132 | #if !@HAVE_WCHAR_T@ |
105 | # define wchar_t int | 133 | # define wchar_t int |
@@ -137,11 +165,49 @@ typedef union | |||
137 | long int __i _GL_STDDEF_ALIGNAS (long int); | 165 | long int __i _GL_STDDEF_ALIGNAS (long int); |
138 | } rpl_max_align_t; | 166 | } rpl_max_align_t; |
139 | # define max_align_t rpl_max_align_t | 167 | # define max_align_t rpl_max_align_t |
168 | # define __CLANG_MAX_ALIGN_T_DEFINED | ||
140 | # define GNULIB_defined_max_align_t 1 | 169 | # define GNULIB_defined_max_align_t 1 |
141 | # endif | 170 | # endif |
142 | # endif | 171 | # endif |
143 | #endif | 172 | #endif |
144 | 173 | ||
174 | /* ISO C 23 ยง 7.21.1 The unreachable macro */ | ||
175 | #ifndef unreachable | ||
176 | |||
177 | /* Code borrowed from verify.h. */ | ||
178 | # ifndef _GL_HAS_BUILTIN_UNREACHABLE | ||
179 | # if defined __clang_major__ && __clang_major__ < 5 | ||
180 | # define _GL_HAS_BUILTIN_UNREACHABLE 0 | ||
181 | # elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__) | ||
182 | # define _GL_HAS_BUILTIN_UNREACHABLE 1 | ||
183 | # elif defined __has_builtin | ||
184 | # define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable) | ||
185 | # else | ||
186 | # define _GL_HAS_BUILTIN_UNREACHABLE 0 | ||
187 | # endif | ||
188 | # endif | ||
189 | |||
190 | # if _GL_HAS_BUILTIN_UNREACHABLE | ||
191 | # define unreachable() __builtin_unreachable () | ||
192 | # elif 1200 <= _MSC_VER | ||
193 | # define unreachable() __assume (0) | ||
194 | # else | ||
195 | /* Declare abort(), without including <stdlib.h>. */ | ||
196 | extern | ||
197 | # if defined __cplusplus | ||
198 | "C" | ||
199 | # endif | ||
200 | _Noreturn | ||
201 | void abort (void) | ||
202 | # if defined __cplusplus && (__GLIBC__ >= 2) | ||
203 | _GL_ATTRIBUTE_NOTHROW | ||
204 | # endif | ||
205 | ; | ||
206 | # define unreachable() abort () | ||
207 | # endif | ||
208 | |||
209 | #endif | ||
210 | |||
145 | # endif /* _@GUARD_PREFIX@_STDDEF_H */ | 211 | # endif /* _@GUARD_PREFIX@_STDDEF_H */ |
146 | # endif /* _@GUARD_PREFIX@_STDDEF_H */ | 212 | # endif /* _@GUARD_PREFIX@_STDDEF_H */ |
147 | #endif /* __need_XXX */ | 213 | #endif /* __need_XXX */ |