diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-02-10 09:37:30 (GMT) |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-02-10 09:37:30 (GMT) |
commit | d2fcf49ad4afc15f37d082d7bc96a808369ec2d4 (patch) | |
tree | 34e3ded696b490bb58cf6dcf990535237bcb9746 | |
parent | 5a50b260ee94df89f2e328affa93983bb0caff57 (diff) | |
download | monitoring-plugins-d2fcf49ad4afc15f37d082d7bc96a808369ec2d4.tar.gz |
Remove some autogenerated filesrefs/pull/1832/head
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | gl/inttypes.h | 1509 | ||||
-rw-r--r-- | gl/limits.h | 132 | ||||
-rw-r--r-- | gl/malloc/dynarray-skeleton.gl.h | 529 | ||||
-rw-r--r-- | gl/malloc/dynarray.gl.h | 173 | ||||
-rw-r--r-- | gl/stdckdint.h | 36 |
6 files changed, 5 insertions, 2379 deletions
@@ -90,6 +90,11 @@ NP-VERSION-FILE | |||
90 | /gl/unistd.h | 90 | /gl/unistd.h |
91 | /gl/wchar.h | 91 | /gl/wchar.h |
92 | /gl/wctype.h | 92 | /gl/wctype.h |
93 | /gl/inttypes.h | ||
94 | /gl/limits.h | ||
95 | /gl/malloc/dynarray-skeleton.gl.h | ||
96 | /gl/malloc/dynarray.gl.h | ||
97 | /gl/stdckdint. | ||
93 | 98 | ||
94 | # /lib/ | 99 | # /lib/ |
95 | /lib/.deps | 100 | /lib/.deps |
diff --git a/gl/inttypes.h b/gl/inttypes.h deleted file mode 100644 index 697e00e..0000000 --- a/gl/inttypes.h +++ /dev/null | |||
@@ -1,1509 +0,0 @@ | |||
1 | /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ | ||
2 | /* Copyright (C) 2006-2023 Free Software Foundation, Inc. | ||
3 | Written by Paul Eggert, Bruno Haible, Derek Price. | ||
4 | This file is part of gnulib. | ||
5 | |||
6 | This file is free software: you can redistribute it and/or modify | ||
7 | it under the terms of the GNU Lesser General Public License as | ||
8 | published by the Free Software Foundation; either version 2.1 of the | ||
9 | License, or (at your option) any later version. | ||
10 | |||
11 | This file 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 Lesser General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU Lesser General Public License | ||
17 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
18 | |||
19 | /* | ||
20 | * ISO C 99 <inttypes.h> for platforms that lack it. | ||
21 | * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/inttypes.h.html> | ||
22 | */ | ||
23 | |||
24 | #if __GNUC__ >= 3 | ||
25 | #pragma GCC system_header | ||
26 | #endif | ||
27 | |||
28 | |||
29 | /* Include the original <inttypes.h> if it exists, and if this file | ||
30 | has not been included yet or if this file includes gnulib stdint.h | ||
31 | which in turn includes this file. | ||
32 | The include_next requires a split double-inclusion guard. */ | ||
33 | #if ! defined INTTYPES_H || defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H | ||
34 | # if 1 | ||
35 | |||
36 | /* Some pre-C++11 <stdint.h> implementations need this. */ | ||
37 | # if defined __cplusplus && ! defined __STDC_FORMAT_MACROS | ||
38 | # define __STDC_FORMAT_MACROS 1 | ||
39 | # endif | ||
40 | |||
41 | # include_next <inttypes.h> | ||
42 | |||
43 | # define _GL_FINISHED_INCLUDING_SYSTEM_INTTYPES_H | ||
44 | # endif | ||
45 | #endif | ||
46 | |||
47 | #if ! defined INTTYPES_H && ! defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H | ||
48 | #define INTTYPES_H | ||
49 | |||
50 | /* Include <stdint.h> or the gnulib replacement. | ||
51 | But avoid namespace pollution on glibc systems. */ | ||
52 | #ifndef __GLIBC__ | ||
53 | # include <stdint.h> | ||
54 | #endif | ||
55 | /* Get CHAR_BIT, INT_MAX, LONG_MAX, etc. */ | ||
56 | #include <limits.h> | ||
57 | /* On mingw, __USE_MINGW_ANSI_STDIO only works if <stdio.h> is also included */ | ||
58 | #if defined _WIN32 && ! defined __CYGWIN__ | ||
59 | # include <stdio.h> | ||
60 | #endif | ||
61 | |||
62 | #if !(INT_MAX == 0x7fffffff && INT_MIN + INT_MAX == -1) | ||
63 | # error "This file assumes that 'int' is 32-bit two's complement. Please report your platform and compiler to <bug-gnulib@gnu.org>." | ||
64 | #endif | ||
65 | |||
66 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | ||
67 | /* C++ compatible function declaration macros. | ||
68 | Copyright (C) 2010-2023 Free Software Foundation, Inc. | ||
69 | |||
70 | This program is free software: you can redistribute it and/or modify it | ||
71 | under the terms of the GNU Lesser General Public License as published | ||
72 | by the Free Software Foundation; either version 2 of the License, or | ||
73 | (at your option) any later version. | ||
74 | |||
75 | This program is distributed in the hope that it will be useful, | ||
76 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
77 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
78 | Lesser General Public License for more details. | ||
79 | |||
80 | You should have received a copy of the GNU Lesser General Public License | ||
81 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
82 | |||
83 | #ifndef _GL_CXXDEFS_H | ||
84 | #define _GL_CXXDEFS_H | ||
85 | |||
86 | /* Begin/end the GNULIB_NAMESPACE namespace. */ | ||
87 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
88 | # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { | ||
89 | # define _GL_END_NAMESPACE } | ||
90 | #else | ||
91 | # define _GL_BEGIN_NAMESPACE | ||
92 | # define _GL_END_NAMESPACE | ||
93 | #endif | ||
94 | |||
95 | /* The three most frequent use cases of these macros are: | ||
96 | |||
97 | * For providing a substitute for a function that is missing on some | ||
98 | platforms, but is declared and works fine on the platforms on which | ||
99 | it exists: | ||
100 | |||
101 | #if @GNULIB_FOO@ | ||
102 | # if !@HAVE_FOO@ | ||
103 | _GL_FUNCDECL_SYS (foo, ...); | ||
104 | # endif | ||
105 | _GL_CXXALIAS_SYS (foo, ...); | ||
106 | _GL_CXXALIASWARN (foo); | ||
107 | #elif defined GNULIB_POSIXCHECK | ||
108 | ... | ||
109 | #endif | ||
110 | |||
111 | * For providing a replacement for a function that exists on all platforms, | ||
112 | but is broken/insufficient and needs to be replaced on some platforms: | ||
113 | |||
114 | #if @GNULIB_FOO@ | ||
115 | # if @REPLACE_FOO@ | ||
116 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
117 | # undef foo | ||
118 | # define foo rpl_foo | ||
119 | # endif | ||
120 | _GL_FUNCDECL_RPL (foo, ...); | ||
121 | _GL_CXXALIAS_RPL (foo, ...); | ||
122 | # else | ||
123 | _GL_CXXALIAS_SYS (foo, ...); | ||
124 | # endif | ||
125 | _GL_CXXALIASWARN (foo); | ||
126 | #elif defined GNULIB_POSIXCHECK | ||
127 | ... | ||
128 | #endif | ||
129 | |||
130 | * For providing a replacement for a function that exists on some platforms | ||
131 | but is broken/insufficient and needs to be replaced on some of them and | ||
132 | is additionally either missing or undeclared on some other platforms: | ||
133 | |||
134 | #if @GNULIB_FOO@ | ||
135 | # if @REPLACE_FOO@ | ||
136 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
137 | # undef foo | ||
138 | # define foo rpl_foo | ||
139 | # endif | ||
140 | _GL_FUNCDECL_RPL (foo, ...); | ||
141 | _GL_CXXALIAS_RPL (foo, ...); | ||
142 | # else | ||
143 | # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ | ||
144 | _GL_FUNCDECL_SYS (foo, ...); | ||
145 | # endif | ||
146 | _GL_CXXALIAS_SYS (foo, ...); | ||
147 | # endif | ||
148 | _GL_CXXALIASWARN (foo); | ||
149 | #elif defined GNULIB_POSIXCHECK | ||
150 | ... | ||
151 | #endif | ||
152 | */ | ||
153 | |||
154 | /* _GL_EXTERN_C declaration; | ||
155 | performs the declaration with C linkage. */ | ||
156 | #if defined __cplusplus | ||
157 | # define _GL_EXTERN_C extern "C" | ||
158 | #else | ||
159 | # define _GL_EXTERN_C extern | ||
160 | #endif | ||
161 | |||
162 | /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); | ||
163 | declares a replacement function, named rpl_func, with the given prototype, | ||
164 | consisting of return type, parameters, and attributes. | ||
165 | Example: | ||
166 | _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) | ||
167 | _GL_ARG_NONNULL ((1))); | ||
168 | */ | ||
169 | #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ | ||
170 | _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) | ||
171 | #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ | ||
172 | _GL_EXTERN_C rettype rpl_func parameters_and_attributes | ||
173 | |||
174 | /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); | ||
175 | declares the system function, named func, with the given prototype, | ||
176 | consisting of return type, parameters, and attributes. | ||
177 | Example: | ||
178 | _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) | ||
179 | _GL_ARG_NONNULL ((1))); | ||
180 | */ | ||
181 | #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ | ||
182 | _GL_EXTERN_C rettype func parameters_and_attributes | ||
183 | |||
184 | /* _GL_CXXALIAS_RPL (func, rettype, parameters); | ||
185 | declares a C++ alias called GNULIB_NAMESPACE::func | ||
186 | that redirects to rpl_func, if GNULIB_NAMESPACE is defined. | ||
187 | Example: | ||
188 | _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); | ||
189 | |||
190 | Wrapping rpl_func in an object with an inline conversion operator | ||
191 | avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is | ||
192 | actually used in the program. */ | ||
193 | #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ | ||
194 | _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) | ||
195 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
196 | # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ | ||
197 | namespace GNULIB_NAMESPACE \ | ||
198 | { \ | ||
199 | static const struct _gl_ ## func ## _wrapper \ | ||
200 | { \ | ||
201 | typedef rettype (*type) parameters; \ | ||
202 | \ | ||
203 | inline operator type () const \ | ||
204 | { \ | ||
205 | return ::rpl_func; \ | ||
206 | } \ | ||
207 | } func = {}; \ | ||
208 | } \ | ||
209 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
210 | #else | ||
211 | # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ | ||
212 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
213 | #endif | ||
214 | |||
215 | /* _GL_CXXALIAS_MDA (func, rettype, parameters); | ||
216 | is to be used when func is a Microsoft deprecated alias, on native Windows. | ||
217 | It declares a C++ alias called GNULIB_NAMESPACE::func | ||
218 | that redirects to _func, if GNULIB_NAMESPACE is defined. | ||
219 | Example: | ||
220 | _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); | ||
221 | */ | ||
222 | #define _GL_CXXALIAS_MDA(func,rettype,parameters) \ | ||
223 | _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters) | ||
224 | |||
225 | /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); | ||
226 | is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); | ||
227 | except that the C function rpl_func may have a slightly different | ||
228 | declaration. A cast is used to silence the "invalid conversion" error | ||
229 | that would otherwise occur. */ | ||
230 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
231 | # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ | ||
232 | namespace GNULIB_NAMESPACE \ | ||
233 | { \ | ||
234 | static const struct _gl_ ## func ## _wrapper \ | ||
235 | { \ | ||
236 | typedef rettype (*type) parameters; \ | ||
237 | \ | ||
238 | inline operator type () const \ | ||
239 | { \ | ||
240 | return reinterpret_cast<type>(::rpl_func); \ | ||
241 | } \ | ||
242 | } func = {}; \ | ||
243 | } \ | ||
244 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
245 | #else | ||
246 | # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ | ||
247 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
248 | #endif | ||
249 | |||
250 | /* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters); | ||
251 | is like _GL_CXXALIAS_MDA (func, rettype, parameters); | ||
252 | except that the C function func may have a slightly different declaration. | ||
253 | A cast is used to silence the "invalid conversion" error that would | ||
254 | otherwise occur. */ | ||
255 | #define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \ | ||
256 | _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters) | ||
257 | |||
258 | /* _GL_CXXALIAS_SYS (func, rettype, parameters); | ||
259 | declares a C++ alias called GNULIB_NAMESPACE::func | ||
260 | that redirects to the system provided function func, if GNULIB_NAMESPACE | ||
261 | is defined. | ||
262 | Example: | ||
263 | _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); | ||
264 | |||
265 | Wrapping func in an object with an inline conversion operator | ||
266 | avoids a reference to func unless GNULIB_NAMESPACE::func is | ||
267 | actually used in the program. */ | ||
268 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
269 | # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ | ||
270 | namespace GNULIB_NAMESPACE \ | ||
271 | { \ | ||
272 | static const struct _gl_ ## func ## _wrapper \ | ||
273 | { \ | ||
274 | typedef rettype (*type) parameters; \ | ||
275 | \ | ||
276 | inline operator type () const \ | ||
277 | { \ | ||
278 | return ::func; \ | ||
279 | } \ | ||
280 | } func = {}; \ | ||
281 | } \ | ||
282 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
283 | #else | ||
284 | # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ | ||
285 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
286 | #endif | ||
287 | |||
288 | /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); | ||
289 | is like _GL_CXXALIAS_SYS (func, rettype, parameters); | ||
290 | except that the C function func may have a slightly different declaration. | ||
291 | A cast is used to silence the "invalid conversion" error that would | ||
292 | otherwise occur. */ | ||
293 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
294 | # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ | ||
295 | namespace GNULIB_NAMESPACE \ | ||
296 | { \ | ||
297 | static const struct _gl_ ## func ## _wrapper \ | ||
298 | { \ | ||
299 | typedef rettype (*type) parameters; \ | ||
300 | \ | ||
301 | inline operator type () const \ | ||
302 | { \ | ||
303 | return reinterpret_cast<type>(::func); \ | ||
304 | } \ | ||
305 | } func = {}; \ | ||
306 | } \ | ||
307 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
308 | #else | ||
309 | # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ | ||
310 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
311 | #endif | ||
312 | |||
313 | /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); | ||
314 | is like _GL_CXXALIAS_SYS (func, rettype, parameters); | ||
315 | except that the C function is picked among a set of overloaded functions, | ||
316 | namely the one with rettype2 and parameters2. Two consecutive casts | ||
317 | are used to silence the "cannot find a match" and "invalid conversion" | ||
318 | errors that would otherwise occur. */ | ||
319 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
320 | /* The outer cast must be a reinterpret_cast. | ||
321 | The inner cast: When the function is defined as a set of overloaded | ||
322 | functions, it works as a static_cast<>, choosing the designated variant. | ||
323 | When the function is defined as a single variant, it works as a | ||
324 | reinterpret_cast<>. The parenthesized cast syntax works both ways. */ | ||
325 | # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ | ||
326 | namespace GNULIB_NAMESPACE \ | ||
327 | { \ | ||
328 | static const struct _gl_ ## func ## _wrapper \ | ||
329 | { \ | ||
330 | typedef rettype (*type) parameters; \ | ||
331 | \ | ||
332 | inline operator type () const \ | ||
333 | { \ | ||
334 | return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ | ||
335 | } \ | ||
336 | } func = {}; \ | ||
337 | } \ | ||
338 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
339 | #else | ||
340 | # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ | ||
341 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
342 | #endif | ||
343 | |||
344 | /* _GL_CXXALIASWARN (func); | ||
345 | causes a warning to be emitted when ::func is used but not when | ||
346 | GNULIB_NAMESPACE::func is used. func must be defined without overloaded | ||
347 | variants. */ | ||
348 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
349 | # define _GL_CXXALIASWARN(func) \ | ||
350 | _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) | ||
351 | # define _GL_CXXALIASWARN_1(func,namespace) \ | ||
352 | _GL_CXXALIASWARN_2 (func, namespace) | ||
353 | /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, | ||
354 | we enable the warning only when not optimizing. */ | ||
355 | # if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) | ||
356 | # define _GL_CXXALIASWARN_2(func,namespace) \ | ||
357 | _GL_WARN_ON_USE (func, \ | ||
358 | "The symbol ::" #func " refers to the system function. " \ | ||
359 | "Use " #namespace "::" #func " instead.") | ||
360 | # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING | ||
361 | # define _GL_CXXALIASWARN_2(func,namespace) \ | ||
362 | extern __typeof__ (func) func | ||
363 | # else | ||
364 | # define _GL_CXXALIASWARN_2(func,namespace) \ | ||
365 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
366 | # endif | ||
367 | #else | ||
368 | # define _GL_CXXALIASWARN(func) \ | ||
369 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
370 | #endif | ||
371 | |||
372 | /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); | ||
373 | causes a warning to be emitted when the given overloaded variant of ::func | ||
374 | is used but not when GNULIB_NAMESPACE::func is used. */ | ||
375 | #if defined __cplusplus && defined GNULIB_NAMESPACE | ||
376 | # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ | ||
377 | _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ | ||
378 | GNULIB_NAMESPACE) | ||
379 | # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ | ||
380 | _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) | ||
381 | /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, | ||
382 | we enable the warning only when not optimizing. */ | ||
383 | # if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) | ||
384 | # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ | ||
385 | _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \ | ||
386 | "The symbol ::" #func " refers to the system function. " \ | ||
387 | "Use " #namespace "::" #func " instead.") | ||
388 | # else | ||
389 | # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ | ||
390 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
391 | # endif | ||
392 | #else | ||
393 | # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ | ||
394 | _GL_EXTERN_C int _gl_cxxalias_dummy | ||
395 | #endif | ||
396 | |||
397 | #endif /* _GL_CXXDEFS_H */ | ||
398 | |||
399 | /* The definition of _GL_ARG_NONNULL is copied here. */ | ||
400 | /* A C macro for declaring that specific arguments must not be NULL. | ||
401 | Copyright (C) 2009-2023 Free Software Foundation, Inc. | ||
402 | |||
403 | This program is free software: you can redistribute it and/or modify it | ||
404 | under the terms of the GNU Lesser General Public License as published | ||
405 | by the Free Software Foundation; either version 2 of the License, or | ||
406 | (at your option) any later version. | ||
407 | |||
408 | This program is distributed in the hope that it will be useful, | ||
409 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
410 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
411 | Lesser General Public License for more details. | ||
412 | |||
413 | You should have received a copy of the GNU Lesser General Public License | ||
414 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
415 | |||
416 | /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools | ||
417 | that the values passed as arguments n, ..., m must be non-NULL pointers. | ||
418 | n = 1 stands for the first argument, n = 2 for the second argument etc. */ | ||
419 | #ifndef _GL_ARG_NONNULL | ||
420 | # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__ | ||
421 | # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) | ||
422 | # else | ||
423 | # define _GL_ARG_NONNULL(params) | ||
424 | # endif | ||
425 | #endif | ||
426 | |||
427 | /* The definition of _GL_WARN_ON_USE is copied here. */ | ||
428 | /* A C macro for emitting warnings if a function is used. | ||
429 | Copyright (C) 2010-2023 Free Software Foundation, Inc. | ||
430 | |||
431 | This program is free software: you can redistribute it and/or modify it | ||
432 | under the terms of the GNU Lesser General Public License as published | ||
433 | by the Free Software Foundation; either version 2 of the License, or | ||
434 | (at your option) any later version. | ||
435 | |||
436 | This program is distributed in the hope that it will be useful, | ||
437 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
438 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
439 | Lesser General Public License for more details. | ||
440 | |||
441 | You should have received a copy of the GNU Lesser General Public License | ||
442 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
443 | |||
444 | /* _GL_WARN_ON_USE (function, "literal string") issues a declaration | ||
445 | for FUNCTION which will then trigger a compiler warning containing | ||
446 | the text of "literal string" anywhere that function is called, if | ||
447 | supported by the compiler. If the compiler does not support this | ||
448 | feature, the macro expands to an unused extern declaration. | ||
449 | |||
450 | _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the | ||
451 | attribute used in _GL_WARN_ON_USE. If the compiler does not support | ||
452 | this feature, it expands to empty. | ||
453 | |||
454 | These macros are useful for marking a function as a potential | ||
455 | portability trap, with the intent that "literal string" include | ||
456 | instructions on the replacement function that should be used | ||
457 | instead. | ||
458 | _GL_WARN_ON_USE is for functions with 'extern' linkage. | ||
459 | _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' | ||
460 | linkage. | ||
461 | |||
462 | However, one of the reasons that a function is a portability trap is | ||
463 | if it has the wrong signature. Declaring FUNCTION with a different | ||
464 | signature in C is a compilation error, so this macro must use the | ||
465 | same type as any existing declaration so that programs that avoid | ||
466 | the problematic FUNCTION do not fail to compile merely because they | ||
467 | included a header that poisoned the function. But this implies that | ||
468 | _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already | ||
469 | have a declaration. Use of this macro implies that there must not | ||
470 | be any other macro hiding the declaration of FUNCTION; but | ||
471 | undefining FUNCTION first is part of the poisoning process anyway | ||
472 | (although for symbols that are provided only via a macro, the result | ||
473 | is a compilation error rather than a warning containing | ||
474 | "literal string"). Also note that in C++, it is only safe to use if | ||
475 | FUNCTION has no overloads. | ||
476 | |||
477 | For an example, it is possible to poison 'getline' by: | ||
478 | - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], | ||
479 | [getline]) in configure.ac, which potentially defines | ||
480 | HAVE_RAW_DECL_GETLINE | ||
481 | - adding this code to a header that wraps the system <stdio.h>: | ||
482 | #undef getline | ||
483 | #if HAVE_RAW_DECL_GETLINE | ||
484 | _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" | ||
485 | "not universally present; use the gnulib module getline"); | ||
486 | #endif | ||
487 | |||
488 | It is not possible to directly poison global variables. But it is | ||
489 | possible to write a wrapper accessor function, and poison that | ||
490 | (less common usage, like &environ, will cause a compilation error | ||
491 | rather than issue the nice warning, but the end result of informing | ||
492 | the developer about their portability problem is still achieved): | ||
493 | #if HAVE_RAW_DECL_ENVIRON | ||
494 | static char *** | ||
495 | rpl_environ (void) { return &environ; } | ||
496 | _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); | ||
497 | # undef environ | ||
498 | # define environ (*rpl_environ ()) | ||
499 | #endif | ||
500 | or better (avoiding contradictory use of 'static' and 'extern'): | ||
501 | #if HAVE_RAW_DECL_ENVIRON | ||
502 | static char *** | ||
503 | _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") | ||
504 | rpl_environ (void) { return &environ; } | ||
505 | # undef environ | ||
506 | # define environ (*rpl_environ ()) | ||
507 | #endif | ||
508 | */ | ||
509 | #ifndef _GL_WARN_ON_USE | ||
510 | |||
511 | # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) | ||
512 | /* A compiler attribute is available in gcc versions 4.3.0 and later. */ | ||
513 | # define _GL_WARN_ON_USE(function, message) \ | ||
514 | _GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message))) | ||
515 | # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ | ||
516 | __attribute__ ((__warning__ (message))) | ||
517 | # elif __clang_major__ >= 4 | ||
518 | /* Another compiler attribute is available in clang. */ | ||
519 | # define _GL_WARN_ON_USE(function, message) \ | ||
520 | _GL_WARN_EXTERN_C __typeof__ (function) function \ | ||
521 | __attribute__ ((__diagnose_if__ (1, message, "warning"))) | ||
522 | # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ | ||
523 | __attribute__ ((__diagnose_if__ (1, message, "warning"))) | ||
524 | # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING | ||
525 | /* Verify the existence of the function. */ | ||
526 | # define _GL_WARN_ON_USE(function, message) \ | ||
527 | _GL_WARN_EXTERN_C __typeof__ (function) function | ||
528 | # define _GL_WARN_ON_USE_ATTRIBUTE(message) | ||
529 | # else /* Unsupported. */ | ||
530 | # define _GL_WARN_ON_USE(function, message) \ | ||
531 | _GL_WARN_EXTERN_C int _gl_warn_on_use | ||
532 | # define _GL_WARN_ON_USE_ATTRIBUTE(message) | ||
533 | # endif | ||
534 | #endif | ||
535 | |||
536 | /* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message") | ||
537 | is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the | ||
538 | function is declared with the given prototype, consisting of return type, | ||
539 | parameters, and attributes. | ||
540 | This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does | ||
541 | not work in this case. */ | ||
542 | #ifndef _GL_WARN_ON_USE_CXX | ||
543 | # if !defined __cplusplus | ||
544 | # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ | ||
545 | _GL_WARN_ON_USE (function, msg) | ||
546 | # else | ||
547 | # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) | ||
548 | /* A compiler attribute is available in gcc versions 4.3.0 and later. */ | ||
549 | # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ | ||
550 | extern rettype_gcc function parameters_and_attributes \ | ||
551 | __attribute__ ((__warning__ (msg))) | ||
552 | # elif __clang_major__ >= 4 | ||
553 | /* Another compiler attribute is available in clang. */ | ||
554 | # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ | ||
555 | extern rettype_clang function parameters_and_attributes \ | ||
556 | __attribute__ ((__diagnose_if__ (1, msg, "warning"))) | ||
557 | # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING | ||
558 | /* Verify the existence of the function. */ | ||
559 | # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ | ||
560 | extern rettype_gcc function parameters_and_attributes | ||
561 | # else /* Unsupported. */ | ||
562 | # define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ | ||
563 | _GL_WARN_EXTERN_C int _gl_warn_on_use | ||
564 | # endif | ||
565 | # endif | ||
566 | #endif | ||
567 | |||
568 | /* _GL_WARN_EXTERN_C declaration; | ||
569 | performs the declaration with C linkage. */ | ||
570 | #ifndef _GL_WARN_EXTERN_C | ||
571 | # if defined __cplusplus | ||
572 | # define _GL_WARN_EXTERN_C extern "C" | ||
573 | # else | ||
574 | # define _GL_WARN_EXTERN_C extern | ||
575 | # endif | ||
576 | #endif | ||
577 | |||
578 | /* 7.8.1 Macros for format specifiers */ | ||
579 | |||
580 | #if defined _TNS_R_TARGET | ||
581 | /* Tandem NonStop R series and compatible platforms released before | ||
582 | July 2005 support %Ld but not %lld. */ | ||
583 | # define _LONG_LONG_FORMAT_PREFIX "L" | ||
584 | #else | ||
585 | # define _LONG_LONG_FORMAT_PREFIX "ll" | ||
586 | #endif | ||
587 | |||
588 | #if !defined PRId8 | ||
589 | # ifdef INT8_MAX | ||
590 | # define PRId8 "d" | ||
591 | # endif | ||
592 | #endif | ||
593 | #if !defined PRIi8 | ||
594 | # ifdef INT8_MAX | ||
595 | # define PRIi8 "i" | ||
596 | # endif | ||
597 | #endif | ||
598 | #if !defined PRIo8 | ||
599 | # ifdef UINT8_MAX | ||
600 | # define PRIo8 "o" | ||
601 | # endif | ||
602 | #endif | ||
603 | #if !defined PRIu8 | ||
604 | # ifdef UINT8_MAX | ||
605 | # define PRIu8 "u" | ||
606 | # endif | ||
607 | #endif | ||
608 | #if !defined PRIx8 | ||
609 | # ifdef UINT8_MAX | ||
610 | # define PRIx8 "x" | ||
611 | # endif | ||
612 | #endif | ||
613 | #if !defined PRIX8 | ||
614 | # ifdef UINT8_MAX | ||
615 | # define PRIX8 "X" | ||
616 | # endif | ||
617 | #endif | ||
618 | #if !defined PRId16 | ||
619 | # ifdef INT16_MAX | ||
620 | # define PRId16 "d" | ||
621 | # endif | ||
622 | #endif | ||
623 | #if !defined PRIi16 | ||
624 | # ifdef INT16_MAX | ||
625 | # define PRIi16 "i" | ||
626 | # endif | ||
627 | #endif | ||
628 | #if !defined PRIo16 | ||
629 | # ifdef UINT16_MAX | ||
630 | # define PRIo16 "o" | ||
631 | # endif | ||
632 | #endif | ||
633 | #if !defined PRIu16 | ||
634 | # ifdef UINT16_MAX | ||
635 | # define PRIu16 "u" | ||
636 | # endif | ||
637 | #endif | ||
638 | #if !defined PRIx16 | ||
639 | # ifdef UINT16_MAX | ||
640 | # define PRIx16 "x" | ||
641 | # endif | ||
642 | #endif | ||
643 | #if !defined PRIX16 | ||
644 | # ifdef UINT16_MAX | ||
645 | # define PRIX16 "X" | ||
646 | # endif | ||
647 | #endif | ||
648 | #if !defined PRId32 | ||
649 | # ifdef INT32_MAX | ||
650 | # define PRId32 "d" | ||
651 | # endif | ||
652 | #endif | ||
653 | #if !defined PRIi32 | ||
654 | # ifdef INT32_MAX | ||
655 | # define PRIi32 "i" | ||
656 | # endif | ||
657 | #endif | ||
658 | #if !defined PRIo32 | ||
659 | # ifdef UINT32_MAX | ||
660 | # define PRIo32 "o" | ||
661 | # endif | ||
662 | #endif | ||
663 | #if !defined PRIu32 | ||
664 | # ifdef UINT32_MAX | ||
665 | # define PRIu32 "u" | ||
666 | # endif | ||
667 | #endif | ||
668 | #if !defined PRIx32 | ||
669 | # ifdef UINT32_MAX | ||
670 | # define PRIx32 "x" | ||
671 | # endif | ||
672 | #endif | ||
673 | #if !defined PRIX32 | ||
674 | # ifdef UINT32_MAX | ||
675 | # define PRIX32 "X" | ||
676 | # endif | ||
677 | #endif | ||
678 | #ifdef INT64_MAX | ||
679 | # if (0 ? defined _LP64 : defined _LP64) | ||
680 | # define _PRI64_PREFIX "l" | ||
681 | # elif defined _MSC_VER || defined __MINGW32__ | ||
682 | # define _PRI64_PREFIX "I64" | ||
683 | # elif LONG_MAX >> 30 == 1 | ||
684 | # define _PRI64_PREFIX _LONG_LONG_FORMAT_PREFIX | ||
685 | # endif | ||
686 | # if !defined PRId64 | ||
687 | # define PRId64 _PRI64_PREFIX "d" | ||
688 | # endif | ||
689 | # if !defined PRIi64 | ||
690 | # define PRIi64 _PRI64_PREFIX "i" | ||
691 | # endif | ||
692 | #endif | ||
693 | #ifdef UINT64_MAX | ||
694 | # if (0 ? defined _LP64 : defined _LP64) | ||
695 | # define _PRIu64_PREFIX "l" | ||
696 | # elif defined _MSC_VER || defined __MINGW32__ | ||
697 | # define _PRIu64_PREFIX "I64" | ||
698 | # elif ULONG_MAX >> 31 == 1 | ||
699 | # define _PRIu64_PREFIX _LONG_LONG_FORMAT_PREFIX | ||
700 | # endif | ||
701 | # if !defined PRIo64 | ||
702 | # define PRIo64 _PRIu64_PREFIX "o" | ||
703 | # endif | ||
704 | # if !defined PRIu64 | ||
705 | # define PRIu64 _PRIu64_PREFIX "u" | ||
706 | # endif | ||
707 | # if !defined PRIx64 | ||
708 | # define PRIx64 _PRIu64_PREFIX "x" | ||
709 | # endif | ||
710 | # if !defined PRIX64 | ||
711 | # define PRIX64 _PRIu64_PREFIX "X" | ||
712 | # endif | ||
713 | #endif | ||
714 | |||
715 | #if !defined PRIdLEAST8 | ||
716 | # define PRIdLEAST8 "d" | ||
717 | #endif | ||
718 | #if !defined PRIiLEAST8 | ||
719 | # define PRIiLEAST8 "i" | ||
720 | #endif | ||
721 | #if !defined PRIoLEAST8 | ||
722 | # define PRIoLEAST8 "o" | ||
723 | #endif | ||
724 | #if !defined PRIuLEAST8 | ||
725 | # define PRIuLEAST8 "u" | ||
726 | #endif | ||
727 | #if !defined PRIxLEAST8 | ||
728 | # define PRIxLEAST8 "x" | ||
729 | #endif | ||
730 | #if !defined PRIXLEAST8 | ||
731 | # define PRIXLEAST8 "X" | ||
732 | #endif | ||
733 | #if !defined PRIdLEAST16 | ||
734 | # define PRIdLEAST16 "d" | ||
735 | #endif | ||
736 | #if !defined PRIiLEAST16 | ||
737 | # define PRIiLEAST16 "i" | ||
738 | #endif | ||
739 | #if !defined PRIoLEAST16 | ||
740 | # define PRIoLEAST16 "o" | ||
741 | #endif | ||
742 | #if !defined PRIuLEAST16 | ||
743 | # define PRIuLEAST16 "u" | ||
744 | #endif | ||
745 | #if !defined PRIxLEAST16 | ||
746 | # define PRIxLEAST16 "x" | ||
747 | #endif | ||
748 | #if !defined PRIXLEAST16 | ||
749 | # define PRIXLEAST16 "X" | ||
750 | #endif | ||
751 | #if !defined PRIdLEAST32 | ||
752 | # define PRIdLEAST32 "d" | ||
753 | #endif | ||
754 | #if !defined PRIiLEAST32 | ||
755 | # define PRIiLEAST32 "i" | ||
756 | #endif | ||
757 | #if !defined PRIoLEAST32 | ||
758 | # define PRIoLEAST32 "o" | ||
759 | #endif | ||
760 | #if !defined PRIuLEAST32 | ||
761 | # define PRIuLEAST32 "u" | ||
762 | #endif | ||
763 | #if !defined PRIxLEAST32 | ||
764 | # define PRIxLEAST32 "x" | ||
765 | #endif | ||
766 | #if !defined PRIXLEAST32 | ||
767 | # define PRIXLEAST32 "X" | ||
768 | #endif | ||
769 | #ifdef INT64_MAX | ||
770 | # if !defined PRIdLEAST64 | ||
771 | # define PRIdLEAST64 PRId64 | ||
772 | # endif | ||
773 | # if !defined PRIiLEAST64 | ||
774 | # define PRIiLEAST64 PRIi64 | ||
775 | # endif | ||
776 | #endif | ||
777 | #ifdef UINT64_MAX | ||
778 | # if !defined PRIoLEAST64 | ||
779 | # define PRIoLEAST64 PRIo64 | ||
780 | # endif | ||
781 | # if !defined PRIuLEAST64 | ||
782 | # define PRIuLEAST64 PRIu64 | ||
783 | # endif | ||
784 | # if !defined PRIxLEAST64 | ||
785 | # define PRIxLEAST64 PRIx64 | ||
786 | # endif | ||
787 | # if !defined PRIXLEAST64 | ||
788 | # define PRIXLEAST64 PRIX64 | ||
789 | # endif | ||
790 | #endif | ||
791 | |||
792 | #if !defined PRIdFAST8 | ||
793 | # if INT_FAST8_MAX > INT32_MAX | ||
794 | # define PRIdFAST8 PRId64 | ||
795 | # else | ||
796 | # define PRIdFAST8 "d" | ||
797 | # endif | ||
798 | #endif | ||
799 | #if !defined PRIiFAST8 | ||
800 | # if INT_FAST8_MAX > INT32_MAX | ||
801 | # define PRIiFAST8 PRIi64 | ||
802 | # else | ||
803 | # define PRIiFAST8 "i" | ||
804 | # endif | ||
805 | #endif | ||
806 | #if !defined PRIoFAST8 | ||
807 | # if UINT_FAST8_MAX > UINT32_MAX | ||
808 | # define PRIoFAST8 PRIo64 | ||
809 | # else | ||
810 | # define PRIoFAST8 "o" | ||
811 | # endif | ||
812 | #endif | ||
813 | #if !defined PRIuFAST8 | ||
814 | # if UINT_FAST8_MAX > UINT32_MAX | ||
815 | # define PRIuFAST8 PRIu64 | ||
816 | # else | ||
817 | # define PRIuFAST8 "u" | ||
818 | # endif | ||
819 | #endif | ||
820 | #if !defined PRIxFAST8 | ||
821 | # if UINT_FAST8_MAX > UINT32_MAX | ||
822 | # define PRIxFAST8 PRIx64 | ||
823 | # else | ||
824 | # define PRIxFAST8 "x" | ||
825 | # endif | ||
826 | #endif | ||
827 | #if !defined PRIXFAST8 | ||
828 | # if UINT_FAST8_MAX > UINT32_MAX | ||
829 | # define PRIXFAST8 PRIX64 | ||
830 | # else | ||
831 | # define PRIXFAST8 "X" | ||
832 | # endif | ||
833 | #endif | ||
834 | #if !defined PRIdFAST16 | ||
835 | # if INT_FAST16_MAX > INT32_MAX | ||
836 | # define PRIdFAST16 PRId64 | ||
837 | # else | ||
838 | # define PRIdFAST16 "d" | ||
839 | # endif | ||
840 | #endif | ||
841 | #if !defined PRIiFAST16 | ||
842 | # if INT_FAST16_MAX > INT32_MAX | ||
843 | # define PRIiFAST16 PRIi64 | ||
844 | # else | ||
845 | # define PRIiFAST16 "i" | ||
846 | # endif | ||
847 | #endif | ||
848 | #if !defined PRIoFAST16 | ||
849 | # if UINT_FAST16_MAX > UINT32_MAX | ||
850 | # define PRIoFAST16 PRIo64 | ||
851 | # else | ||
852 | # define PRIoFAST16 "o" | ||
853 | # endif | ||
854 | #endif | ||
855 | #if !defined PRIuFAST16 | ||
856 | # if UINT_FAST16_MAX > UINT32_MAX | ||
857 | # define PRIuFAST16 PRIu64 | ||
858 | # else | ||
859 | # define PRIuFAST16 "u" | ||
860 | # endif | ||
861 | #endif | ||
862 | #if !defined PRIxFAST16 | ||
863 | # if UINT_FAST16_MAX > UINT32_MAX | ||
864 | # define PRIxFAST16 PRIx64 | ||
865 | # else | ||
866 | # define PRIxFAST16 "x" | ||
867 | # endif | ||
868 | #endif | ||
869 | #if !defined PRIXFAST16 | ||
870 | # if UINT_FAST16_MAX > UINT32_MAX | ||
871 | # define PRIXFAST16 PRIX64 | ||
872 | # else | ||
873 | # define PRIXFAST16 "X" | ||
874 | # endif | ||
875 | #endif | ||
876 | #if !defined PRIdFAST32 | ||
877 | # if INT_FAST32_MAX > INT32_MAX | ||
878 | # define PRIdFAST32 PRId64 | ||
879 | # else | ||
880 | # define PRIdFAST32 "d" | ||
881 | # endif | ||
882 | #endif | ||
883 | #if !defined PRIiFAST32 | ||
884 | # if INT_FAST32_MAX > INT32_MAX | ||
885 | # define PRIiFAST32 PRIi64 | ||
886 | # else | ||
887 | # define PRIiFAST32 "i" | ||
888 | # endif | ||
889 | #endif | ||
890 | #if !defined PRIoFAST32 | ||
891 | # if UINT_FAST32_MAX > UINT32_MAX | ||
892 | # define PRIoFAST32 PRIo64 | ||
893 | # else | ||
894 | # define PRIoFAST32 "o" | ||
895 | # endif | ||
896 | #endif | ||
897 | #if !defined PRIuFAST32 | ||
898 | # if UINT_FAST32_MAX > UINT32_MAX | ||
899 | # define PRIuFAST32 PRIu64 | ||
900 | # else | ||
901 | # define PRIuFAST32 "u" | ||
902 | # endif | ||
903 | #endif | ||
904 | #if !defined PRIxFAST32 | ||
905 | # if UINT_FAST32_MAX > UINT32_MAX | ||
906 | # define PRIxFAST32 PRIx64 | ||
907 | # else | ||
908 | # define PRIxFAST32 "x" | ||
909 | # endif | ||
910 | #endif | ||
911 | #if !defined PRIXFAST32 | ||
912 | # if UINT_FAST32_MAX > UINT32_MAX | ||
913 | # define PRIXFAST32 PRIX64 | ||
914 | # else | ||
915 | # define PRIXFAST32 "X" | ||
916 | # endif | ||
917 | #endif | ||
918 | #ifdef INT64_MAX | ||
919 | # if !defined PRIdFAST64 | ||
920 | # define PRIdFAST64 PRId64 | ||
921 | # endif | ||
922 | # if !defined PRIiFAST64 | ||
923 | # define PRIiFAST64 PRIi64 | ||
924 | # endif | ||
925 | #endif | ||
926 | #ifdef UINT64_MAX | ||
927 | # if !defined PRIoFAST64 | ||
928 | # define PRIoFAST64 PRIo64 | ||
929 | # endif | ||
930 | # if !defined PRIuFAST64 | ||
931 | # define PRIuFAST64 PRIu64 | ||
932 | # endif | ||
933 | # if !defined PRIxFAST64 | ||
934 | # define PRIxFAST64 PRIx64 | ||
935 | # endif | ||
936 | # if !defined PRIXFAST64 | ||
937 | # define PRIXFAST64 PRIX64 | ||
938 | # endif | ||
939 | #endif | ||
940 | |||
941 | #if !defined PRIdMAX | ||
942 | # if 1 | ||
943 | # define PRIdMAX PRId64 | ||
944 | # else | ||
945 | # define PRIdMAX "ld" | ||
946 | # endif | ||
947 | #endif | ||
948 | #if !defined PRIiMAX | ||
949 | # if 1 | ||
950 | # define PRIiMAX PRIi64 | ||
951 | # else | ||
952 | # define PRIiMAX "li" | ||
953 | # endif | ||
954 | #endif | ||
955 | #if !defined PRIoMAX | ||
956 | # if 1 | ||
957 | # define PRIoMAX PRIo64 | ||
958 | # else | ||
959 | # define PRIoMAX "lo" | ||
960 | # endif | ||
961 | #endif | ||
962 | #if !defined PRIuMAX | ||
963 | # if 1 | ||
964 | # define PRIuMAX PRIu64 | ||
965 | # else | ||
966 | # define PRIuMAX "lu" | ||
967 | # endif | ||
968 | #endif | ||
969 | #if !defined PRIxMAX | ||
970 | # if 1 | ||
971 | # define PRIxMAX PRIx64 | ||
972 | # else | ||
973 | # define PRIxMAX "lx" | ||
974 | # endif | ||
975 | #endif | ||
976 | #if !defined PRIXMAX | ||
977 | # if 1 | ||
978 | # define PRIXMAX PRIX64 | ||
979 | # else | ||
980 | # define PRIXMAX "lX" | ||
981 | # endif | ||
982 | #endif | ||
983 | |||
984 | #if !defined PRIdPTR | ||
985 | # ifdef INTPTR_MAX | ||
986 | # define PRIdPTR __PRIPTR_PREFIX "d" | ||
987 | # endif | ||
988 | #endif | ||
989 | #if !defined PRIiPTR | ||
990 | # ifdef INTPTR_MAX | ||
991 | # define PRIiPTR __PRIPTR_PREFIX "i" | ||
992 | # endif | ||
993 | #endif | ||
994 | #if !defined PRIoPTR | ||
995 | # ifdef UINTPTR_MAX | ||
996 | # define PRIoPTR __PRIPTR_PREFIX "o" | ||
997 | # endif | ||
998 | #endif | ||
999 | #if !defined PRIuPTR | ||
1000 | # ifdef UINTPTR_MAX | ||
1001 | # define PRIuPTR __PRIPTR_PREFIX "u" | ||
1002 | # endif | ||
1003 | #endif | ||
1004 | #if !defined PRIxPTR | ||
1005 | # ifdef UINTPTR_MAX | ||
1006 | # define PRIxPTR __PRIPTR_PREFIX "x" | ||
1007 | # endif | ||
1008 | #endif | ||
1009 | #if !defined PRIXPTR | ||
1010 | # ifdef UINTPTR_MAX | ||
1011 | # define PRIXPTR __PRIPTR_PREFIX "X" | ||
1012 | # endif | ||
1013 | #endif | ||
1014 | |||
1015 | #if !defined SCNd8 | ||
1016 | # ifdef INT8_MAX | ||
1017 | # define SCNd8 "hhd" | ||
1018 | # endif | ||
1019 | #endif | ||
1020 | #if !defined SCNi8 | ||
1021 | # ifdef INT8_MAX | ||
1022 | # define SCNi8 "hhi" | ||
1023 | # endif | ||
1024 | #endif | ||
1025 | #if !defined SCNo8 | ||
1026 | # ifdef UINT8_MAX | ||
1027 | # define SCNo8 "hho" | ||
1028 | # endif | ||
1029 | #endif | ||
1030 | #if !defined SCNu8 | ||
1031 | # ifdef UINT8_MAX | ||
1032 | # define SCNu8 "hhu" | ||
1033 | # endif | ||
1034 | #endif | ||
1035 | #if !defined SCNx8 | ||
1036 | # ifdef UINT8_MAX | ||
1037 | # define SCNx8 "hhx" | ||
1038 | # endif | ||
1039 | #endif | ||
1040 | #if !defined SCNd16 | ||
1041 | # ifdef INT16_MAX | ||
1042 | # define SCNd16 "hd" | ||
1043 | # endif | ||
1044 | #endif | ||
1045 | #if !defined SCNi16 | ||
1046 | # ifdef INT16_MAX | ||
1047 | # define SCNi16 "hi" | ||
1048 | # endif | ||
1049 | #endif | ||
1050 | #if !defined SCNo16 | ||
1051 | # ifdef UINT16_MAX | ||
1052 | # define SCNo16 "ho" | ||
1053 | # endif | ||
1054 | #endif | ||
1055 | #if !defined SCNu16 | ||
1056 | # ifdef UINT16_MAX | ||
1057 | # define SCNu16 "hu" | ||
1058 | # endif | ||
1059 | #endif | ||
1060 | #if !defined SCNx16 | ||
1061 | # ifdef UINT16_MAX | ||
1062 | # define SCNx16 "hx" | ||
1063 | # endif | ||
1064 | #endif | ||
1065 | #if !defined SCNd32 | ||
1066 | # ifdef INT32_MAX | ||
1067 | # define SCNd32 "d" | ||
1068 | # endif | ||
1069 | #endif | ||
1070 | #if !defined SCNi32 | ||
1071 | # ifdef INT32_MAX | ||
1072 | # define SCNi32 "i" | ||
1073 | # endif | ||
1074 | #endif | ||
1075 | #if !defined SCNo32 | ||
1076 | # ifdef UINT32_MAX | ||
1077 | # define SCNo32 "o" | ||
1078 | # endif | ||
1079 | #endif | ||
1080 | #if !defined SCNu32 | ||
1081 | # ifdef UINT32_MAX | ||
1082 | # define SCNu32 "u" | ||
1083 | # endif | ||
1084 | #endif | ||
1085 | #if !defined SCNx32 | ||
1086 | # ifdef UINT32_MAX | ||
1087 | # define SCNx32 "x" | ||
1088 | # endif | ||
1089 | #endif | ||
1090 | #ifdef INT64_MAX | ||
1091 | # if (0 ? defined _LP64 : defined _LP64) | ||
1092 | # define _SCN64_PREFIX "l" | ||
1093 | # elif defined _MSC_VER || defined __MINGW32__ | ||
1094 | # define _SCN64_PREFIX "I64" | ||
1095 | # elif LONG_MAX >> 30 == 1 | ||
1096 | # define _SCN64_PREFIX _LONG_LONG_FORMAT_PREFIX | ||
1097 | # endif | ||
1098 | # if !defined SCNd64 | ||
1099 | # define SCNd64 _SCN64_PREFIX "d" | ||
1100 | # endif | ||
1101 | # if !defined SCNi64 | ||
1102 | # define SCNi64 _SCN64_PREFIX "i" | ||
1103 | # endif | ||
1104 | #endif | ||
1105 | #ifdef UINT64_MAX | ||
1106 | # if (0 ? defined _LP64 : defined _LP64) | ||
1107 | # define _SCNu64_PREFIX "l" | ||
1108 | # elif defined _MSC_VER || defined __MINGW32__ | ||
1109 | # define _SCNu64_PREFIX "I64" | ||
1110 | # elif ULONG_MAX >> 31 == 1 | ||
1111 | # define _SCNu64_PREFIX _LONG_LONG_FORMAT_PREFIX | ||
1112 | # endif | ||
1113 | # if !defined SCNo64 | ||
1114 | # define SCNo64 _SCNu64_PREFIX "o" | ||
1115 | # endif | ||
1116 | # if !defined SCNu64 | ||
1117 | # define SCNu64 _SCNu64_PREFIX "u" | ||
1118 | # endif | ||
1119 | # if !defined SCNx64 | ||
1120 | # define SCNx64 _SCNu64_PREFIX "x" | ||
1121 | # endif | ||
1122 | #endif | ||
1123 | |||
1124 | #if !defined SCNdLEAST8 | ||
1125 | # define SCNdLEAST8 "hhd" | ||
1126 | #endif | ||
1127 | #if !defined SCNiLEAST8 | ||
1128 | # define SCNiLEAST8 "hhi" | ||
1129 | #endif | ||
1130 | #if !defined SCNoLEAST8 | ||
1131 | # define SCNoLEAST8 "hho" | ||
1132 | #endif | ||
1133 | #if !defined SCNuLEAST8 | ||
1134 | # define SCNuLEAST8 "hhu" | ||
1135 | #endif | ||
1136 | #if !defined SCNxLEAST8 | ||
1137 | # define SCNxLEAST8 "hhx" | ||
1138 | #endif | ||
1139 | #if !defined SCNdLEAST16 | ||
1140 | # define SCNdLEAST16 "hd" | ||
1141 | #endif | ||
1142 | #if !defined SCNiLEAST16 | ||
1143 | # define SCNiLEAST16 "hi" | ||
1144 | #endif | ||
1145 | #if !defined SCNoLEAST16 | ||
1146 | # define SCNoLEAST16 "ho" | ||
1147 | #endif | ||
1148 | #if !defined SCNuLEAST16 | ||
1149 | # define SCNuLEAST16 "hu" | ||
1150 | #endif | ||
1151 | #if !defined SCNxLEAST16 | ||
1152 | # define SCNxLEAST16 "hx" | ||
1153 | #endif | ||
1154 | #if !defined SCNdLEAST32 | ||
1155 | # define SCNdLEAST32 "d" | ||
1156 | #endif | ||
1157 | #if !defined SCNiLEAST32 | ||
1158 | # define SCNiLEAST32 "i" | ||
1159 | #endif | ||
1160 | #if !defined SCNoLEAST32 | ||
1161 | # define SCNoLEAST32 "o" | ||
1162 | #endif | ||
1163 | #if !defined SCNuLEAST32 | ||
1164 | # define SCNuLEAST32 "u" | ||
1165 | #endif | ||
1166 | #if !defined SCNxLEAST32 | ||
1167 | # define SCNxLEAST32 "x" | ||
1168 | #endif | ||
1169 | #ifdef INT64_MAX | ||
1170 | # if !defined SCNdLEAST64 | ||
1171 | # define SCNdLEAST64 SCNd64 | ||
1172 | # endif | ||
1173 | # if !defined SCNiLEAST64 | ||
1174 | # define SCNiLEAST64 SCNi64 | ||
1175 | # endif | ||
1176 | #endif | ||
1177 | #ifdef UINT64_MAX | ||
1178 | # if !defined SCNoLEAST64 | ||
1179 | # define SCNoLEAST64 SCNo64 | ||
1180 | # endif | ||
1181 | # if !defined SCNuLEAST64 | ||
1182 | # define SCNuLEAST64 SCNu64 | ||
1183 | # endif | ||
1184 | # if !defined SCNxLEAST64 | ||
1185 | # define SCNxLEAST64 SCNx64 | ||
1186 | # endif | ||
1187 | #endif | ||
1188 | |||
1189 | #if !defined SCNdFAST8 | ||
1190 | # if INT_FAST8_MAX > INT32_MAX | ||
1191 | # define SCNdFAST8 SCNd64 | ||
1192 | # elif INT_FAST8_MAX == 0x7fff | ||
1193 | # define SCNdFAST8 "hd" | ||
1194 | # elif INT_FAST8_MAX == 0x7f | ||
1195 | # define SCNdFAST8 "hhd" | ||
1196 | # else | ||
1197 | # define SCNdFAST8 "d" | ||
1198 | # endif | ||
1199 | #endif | ||
1200 | #if !defined SCNiFAST8 | ||
1201 | # if INT_FAST8_MAX > INT32_MAX | ||
1202 | # define SCNiFAST8 SCNi64 | ||
1203 | # elif INT_FAST8_MAX == 0x7fff | ||
1204 | # define SCNiFAST8 "hi" | ||
1205 | # elif INT_FAST8_MAX == 0x7f | ||
1206 | # define SCNiFAST8 "hhi" | ||
1207 | # else | ||
1208 | # define SCNiFAST8 "i" | ||
1209 | # endif | ||
1210 | #endif | ||
1211 | #if !defined SCNoFAST8 | ||
1212 | # if UINT_FAST8_MAX > UINT32_MAX | ||
1213 | # define SCNoFAST8 SCNo64 | ||
1214 | # elif UINT_FAST8_MAX == 0xffff | ||
1215 | # define SCNoFAST8 "ho" | ||
1216 | # elif UINT_FAST8_MAX == 0xff | ||
1217 | # define SCNoFAST8 "hho" | ||
1218 | # else | ||
1219 | # define SCNoFAST8 "o" | ||
1220 | # endif | ||
1221 | #endif | ||
1222 | #if !defined SCNuFAST8 | ||
1223 | # if UINT_FAST8_MAX > UINT32_MAX | ||
1224 | # define SCNuFAST8 SCNu64 | ||
1225 | # elif UINT_FAST8_MAX == 0xffff | ||
1226 | # define SCNuFAST8 "hu" | ||
1227 | # elif UINT_FAST8_MAX == 0xff | ||
1228 | # define SCNuFAST8 "hhu" | ||
1229 | # else | ||
1230 | # define SCNuFAST8 "u" | ||
1231 | # endif | ||
1232 | #endif | ||
1233 | #if !defined SCNxFAST8 | ||
1234 | # if UINT_FAST8_MAX > UINT32_MAX | ||
1235 | # define SCNxFAST8 SCNx64 | ||
1236 | # elif UINT_FAST8_MAX == 0xffff | ||
1237 | # define SCNxFAST8 "hx" | ||
1238 | # elif UINT_FAST8_MAX == 0xff | ||
1239 | # define SCNxFAST8 "hhx" | ||
1240 | # else | ||
1241 | # define SCNxFAST8 "x" | ||
1242 | # endif | ||
1243 | #endif | ||
1244 | #if !defined SCNdFAST16 | ||
1245 | # if INT_FAST16_MAX > INT32_MAX | ||
1246 | # define SCNdFAST16 SCNd64 | ||
1247 | # elif INT_FAST16_MAX == 0x7fff | ||
1248 | # define SCNdFAST16 "hd" | ||
1249 | # else | ||
1250 | # define SCNdFAST16 "d" | ||
1251 | # endif | ||
1252 | #endif | ||
1253 | #if !defined SCNiFAST16 | ||
1254 | # if INT_FAST16_MAX > INT32_MAX | ||
1255 | # define SCNiFAST16 SCNi64 | ||
1256 | # elif INT_FAST16_MAX == 0x7fff | ||
1257 | # define SCNiFAST16 "hi" | ||
1258 | # else | ||
1259 | # define SCNiFAST16 "i" | ||
1260 | # endif | ||
1261 | #endif | ||
1262 | #if !defined SCNoFAST16 | ||
1263 | # if UINT_FAST16_MAX > UINT32_MAX | ||
1264 | # define SCNoFAST16 SCNo64 | ||
1265 | # elif UINT_FAST16_MAX == 0xffff | ||
1266 | # define SCNoFAST16 "ho" | ||
1267 | # else | ||
1268 | # define SCNoFAST16 "o" | ||
1269 | # endif | ||
1270 | #endif | ||
1271 | #if !defined SCNuFAST16 | ||
1272 | # if UINT_FAST16_MAX > UINT32_MAX | ||
1273 | # define SCNuFAST16 SCNu64 | ||
1274 | # elif UINT_FAST16_MAX == 0xffff | ||
1275 | # define SCNuFAST16 "hu" | ||
1276 | # else | ||
1277 | # define SCNuFAST16 "u" | ||
1278 | # endif | ||
1279 | #endif | ||
1280 | #if !defined SCNxFAST16 | ||
1281 | # if UINT_FAST16_MAX > UINT32_MAX | ||
1282 | # define SCNxFAST16 SCNx64 | ||
1283 | # elif UINT_FAST16_MAX == 0xffff | ||
1284 | # define SCNxFAST16 "hx" | ||
1285 | # else | ||
1286 | # define SCNxFAST16 "x" | ||
1287 | # endif | ||
1288 | #endif | ||
1289 | #if !defined SCNdFAST32 | ||
1290 | # if INT_FAST32_MAX > INT32_MAX | ||
1291 | # define SCNdFAST32 SCNd64 | ||
1292 | # else | ||
1293 | # define SCNdFAST32 "d" | ||
1294 | # endif | ||
1295 | #endif | ||
1296 | #if !defined SCNiFAST32 | ||
1297 | # if INT_FAST32_MAX > INT32_MAX | ||
1298 | # define SCNiFAST32 SCNi64 | ||
1299 | # else | ||
1300 | # define SCNiFAST32 "i" | ||
1301 | # endif | ||
1302 | #endif | ||
1303 | #if !defined SCNoFAST32 | ||
1304 | # if UINT_FAST32_MAX > UINT32_MAX | ||
1305 | # define SCNoFAST32 SCNo64 | ||
1306 | # else | ||
1307 | # define SCNoFAST32 "o" | ||
1308 | # endif | ||
1309 | #endif | ||
1310 | #if !defined SCNuFAST32 | ||
1311 | # if UINT_FAST32_MAX > UINT32_MAX | ||
1312 | # define SCNuFAST32 SCNu64 | ||
1313 | # else | ||
1314 | # define SCNuFAST32 "u" | ||
1315 | # endif | ||
1316 | #endif | ||
1317 | #if !defined SCNxFAST32 | ||
1318 | # if UINT_FAST32_MAX > UINT32_MAX | ||
1319 | # define SCNxFAST32 SCNx64 | ||
1320 | # else | ||
1321 | # define SCNxFAST32 "x" | ||
1322 | # endif | ||
1323 | #endif | ||
1324 | #ifdef INT64_MAX | ||
1325 | # if !defined SCNdFAST64 | ||
1326 | # define SCNdFAST64 SCNd64 | ||
1327 | # endif | ||
1328 | # if !defined SCNiFAST64 | ||
1329 | # define SCNiFAST64 SCNi64 | ||
1330 | # endif | ||
1331 | #endif | ||
1332 | #ifdef UINT64_MAX | ||
1333 | # if !defined SCNoFAST64 | ||
1334 | # define SCNoFAST64 SCNo64 | ||
1335 | # endif | ||
1336 | # if !defined SCNuFAST64 | ||
1337 | # define SCNuFAST64 SCNu64 | ||
1338 | # endif | ||
1339 | # if !defined SCNxFAST64 | ||
1340 | # define SCNxFAST64 SCNx64 | ||
1341 | # endif | ||
1342 | #endif | ||
1343 | |||
1344 | #if !defined SCNdMAX | ||
1345 | # if 1 | ||
1346 | # define SCNdMAX SCNd64 | ||
1347 | # else | ||
1348 | # define SCNdMAX "ld" | ||
1349 | # endif | ||
1350 | #endif | ||
1351 | #if !defined SCNiMAX | ||
1352 | # if 1 | ||
1353 | # define SCNiMAX SCNi64 | ||
1354 | # else | ||
1355 | # define SCNiMAX "li" | ||
1356 | # endif | ||
1357 | #endif | ||
1358 | #if !defined SCNoMAX | ||
1359 | # if 1 | ||
1360 | # define SCNoMAX SCNo64 | ||
1361 | # else | ||
1362 | # define SCNoMAX "lo" | ||
1363 | # endif | ||
1364 | #endif | ||
1365 | #if !defined SCNuMAX | ||
1366 | # if 1 | ||
1367 | # define SCNuMAX SCNu64 | ||
1368 | # else | ||
1369 | # define SCNuMAX "lu" | ||
1370 | # endif | ||
1371 | #endif | ||
1372 | #if !defined SCNxMAX | ||
1373 | # if 1 | ||
1374 | # define SCNxMAX SCNx64 | ||
1375 | # else | ||
1376 | # define SCNxMAX "lx" | ||
1377 | # endif | ||
1378 | #endif | ||
1379 | |||
1380 | #if !defined SCNdPTR | ||
1381 | # ifdef INTPTR_MAX | ||
1382 | # define SCNdPTR __PRIPTR_PREFIX "d" | ||
1383 | # endif | ||
1384 | #endif | ||
1385 | #if !defined SCNiPTR | ||
1386 | # ifdef INTPTR_MAX | ||
1387 | # define SCNiPTR __PRIPTR_PREFIX "i" | ||
1388 | # endif | ||
1389 | #endif | ||
1390 | #if !defined SCNoPTR | ||
1391 | # ifdef UINTPTR_MAX | ||
1392 | # define SCNoPTR __PRIPTR_PREFIX "o" | ||
1393 | # endif | ||
1394 | #endif | ||
1395 | #if !defined SCNuPTR | ||
1396 | # ifdef UINTPTR_MAX | ||
1397 | # define SCNuPTR __PRIPTR_PREFIX "u" | ||
1398 | # endif | ||
1399 | #endif | ||
1400 | #if !defined SCNxPTR | ||
1401 | # ifdef UINTPTR_MAX | ||
1402 | # define SCNxPTR __PRIPTR_PREFIX "x" | ||
1403 | # endif | ||
1404 | #endif | ||
1405 | |||
1406 | /* 7.8.2 Functions for greatest-width integer types */ | ||
1407 | |||
1408 | #ifdef __cplusplus | ||
1409 | extern "C" { | ||
1410 | #endif | ||
1411 | |||
1412 | #if 0 | ||
1413 | # if !1 | ||
1414 | extern intmax_t imaxabs (intmax_t); | ||
1415 | # endif | ||
1416 | #elif defined GNULIB_POSIXCHECK | ||
1417 | # undef imaxabs | ||
1418 | # if HAVE_RAW_DECL_IMAXABS | ||
1419 | _GL_WARN_ON_USE (imaxabs, "imaxabs is unportable - " | ||
1420 | "use gnulib module imaxabs for portability"); | ||
1421 | # endif | ||
1422 | #endif | ||
1423 | |||
1424 | #if 0 | ||
1425 | # if !1 | ||
1426 | # if !GNULIB_defined_imaxdiv_t | ||
1427 | typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t; | ||
1428 | # define GNULIB_defined_imaxdiv_t 1 | ||
1429 | # endif | ||
1430 | # endif | ||
1431 | # if !1 | ||
1432 | extern imaxdiv_t imaxdiv (intmax_t, intmax_t); | ||
1433 | # endif | ||
1434 | #elif defined GNULIB_POSIXCHECK | ||
1435 | # undef imaxdiv | ||
1436 | # if HAVE_RAW_DECL_IMAXDIV | ||
1437 | _GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - " | ||
1438 | "use gnulib module imaxdiv for portability"); | ||
1439 | # endif | ||
1440 | #endif | ||
1441 | |||
1442 | #if 0 | ||
1443 | # if 0 | ||
1444 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1445 | # undef strtoimax | ||
1446 | # define strtoimax rpl_strtoimax | ||
1447 | # endif | ||
1448 | _GL_FUNCDECL_RPL (strtoimax, intmax_t, | ||
1449 | (const char *restrict, char **restrict, int) | ||
1450 | _GL_ARG_NONNULL ((1))); | ||
1451 | _GL_CXXALIAS_RPL (strtoimax, intmax_t, | ||
1452 | (const char *restrict, char **restrict, int)); | ||
1453 | # else | ||
1454 | # if !1 | ||
1455 | # undef strtoimax | ||
1456 | _GL_FUNCDECL_SYS (strtoimax, intmax_t, | ||
1457 | (const char *restrict, char **restrict, int) | ||
1458 | _GL_ARG_NONNULL ((1))); | ||
1459 | # endif | ||
1460 | _GL_CXXALIAS_SYS (strtoimax, intmax_t, | ||
1461 | (const char *restrict, char **restrict, int)); | ||
1462 | # endif | ||
1463 | _GL_CXXALIASWARN (strtoimax); | ||
1464 | #elif defined GNULIB_POSIXCHECK | ||
1465 | # undef strtoimax | ||
1466 | # if HAVE_RAW_DECL_STRTOIMAX | ||
1467 | _GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - " | ||
1468 | "use gnulib module strtoimax for portability"); | ||
1469 | # endif | ||
1470 | #endif | ||
1471 | |||
1472 | #if 0 | ||
1473 | # if 0 | ||
1474 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | ||
1475 | # undef strtoumax | ||
1476 | # define strtoumax rpl_strtoumax | ||
1477 | # endif | ||
1478 | _GL_FUNCDECL_RPL (strtoumax, uintmax_t, | ||
1479 | (const char *restrict, char **restrict, int) | ||
1480 | _GL_ARG_NONNULL ((1))); | ||
1481 | _GL_CXXALIAS_RPL (strtoumax, uintmax_t, | ||
1482 | (const char *restrict, char **restrict, int)); | ||
1483 | # else | ||
1484 | # if !1 | ||
1485 | # undef strtoumax | ||
1486 | _GL_FUNCDECL_SYS (strtoumax, uintmax_t, | ||
1487 | (const char *restrict, char **restrict, int) | ||
1488 | _GL_ARG_NONNULL ((1))); | ||
1489 | # endif | ||
1490 | _GL_CXXALIAS_SYS (strtoumax, uintmax_t, | ||
1491 | (const char *restrict, char **restrict, int)); | ||
1492 | # endif | ||
1493 | _GL_CXXALIASWARN (strtoumax); | ||
1494 | #elif defined GNULIB_POSIXCHECK | ||
1495 | # undef strtoumax | ||
1496 | # if HAVE_RAW_DECL_STRTOUMAX | ||
1497 | _GL_WARN_ON_USE (strtoumax, "strtoumax is unportable - " | ||
1498 | "use gnulib module strtoumax for portability"); | ||
1499 | # endif | ||
1500 | #endif | ||
1501 | |||
1502 | /* Don't bother defining or declaring wcstoimax and wcstoumax, since | ||
1503 | wide-character functions like this are hardly ever useful. */ | ||
1504 | |||
1505 | #ifdef __cplusplus | ||
1506 | } | ||
1507 | #endif | ||
1508 | |||
1509 | #endif /* !defined INTTYPES_H && !defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H */ | ||
diff --git a/gl/limits.h b/gl/limits.h deleted file mode 100644 index 1da08b8..0000000 --- a/gl/limits.h +++ /dev/null | |||
@@ -1,132 +0,0 @@ | |||
1 | /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ | ||
2 | /* A GNU-like <limits.h>. | ||
3 | |||
4 | Copyright 2016-2023 Free Software Foundation, Inc. | ||
5 | |||
6 | This file is free software: you can redistribute it and/or modify | ||
7 | it under the terms of the GNU Lesser General Public License as | ||
8 | published by the Free Software Foundation; either version 2.1 of the | ||
9 | License, or (at your option) any later version. | ||
10 | |||
11 | This file 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 Lesser General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU Lesser General Public License | ||
17 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
18 | |||
19 | #if __GNUC__ >= 3 | ||
20 | #pragma GCC system_header | ||
21 | #endif | ||
22 | |||
23 | |||
24 | #if defined _GL_ALREADY_INCLUDING_LIMITS_H | ||
25 | /* Special invocation convention: | ||
26 | On Haiku/x86_64, we have a sequence of nested includes | ||
27 | <limits.h> -> <syslimits.h> -> <limits.h>. | ||
28 | In this situation, LONG_MAX and INT_MAX are not yet defined, | ||
29 | therefore we should not attempt to define LONG_BIT. */ | ||
30 | |||
31 | #include_next <limits.h> | ||
32 | |||
33 | #else | ||
34 | /* Normal invocation convention. */ | ||
35 | |||
36 | #ifndef _GL_LIMITS_H | ||
37 | |||
38 | # define _GL_ALREADY_INCLUDING_LIMITS_H | ||
39 | |||
40 | /* The include_next requires a split double-inclusion guard. */ | ||
41 | # include_next <limits.h> | ||
42 | |||
43 | # undef _GL_ALREADY_INCLUDING_LIMITS_H | ||
44 | |||
45 | #ifndef _GL_LIMITS_H | ||
46 | #define _GL_LIMITS_H | ||
47 | |||
48 | #ifndef LLONG_MIN | ||
49 | # if defined LONG_LONG_MIN /* HP-UX 11.31 */ | ||
50 | # define LLONG_MIN LONG_LONG_MIN | ||
51 | # elif defined LONGLONG_MIN /* IRIX 6.5 */ | ||
52 | # define LLONG_MIN LONGLONG_MIN | ||
53 | # elif defined __GNUC__ | ||
54 | # define LLONG_MIN (- __LONG_LONG_MAX__ - 1LL) | ||
55 | # endif | ||
56 | #endif | ||
57 | #ifndef LLONG_MAX | ||
58 | # if defined LONG_LONG_MAX /* HP-UX 11.31 */ | ||
59 | # define LLONG_MAX LONG_LONG_MAX | ||
60 | # elif defined LONGLONG_MAX /* IRIX 6.5 */ | ||
61 | # define LLONG_MAX LONGLONG_MAX | ||
62 | # elif defined __GNUC__ | ||
63 | # define LLONG_MAX __LONG_LONG_MAX__ | ||
64 | # endif | ||
65 | #endif | ||
66 | #ifndef ULLONG_MAX | ||
67 | # if defined ULONG_LONG_MAX /* HP-UX 11.31 */ | ||
68 | # define ULLONG_MAX ULONG_LONG_MAX | ||
69 | # elif defined ULONGLONG_MAX /* IRIX 6.5 */ | ||
70 | # define ULLONG_MAX ULONGLONG_MAX | ||
71 | # elif defined __GNUC__ | ||
72 | # define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1ULL) | ||
73 | # endif | ||
74 | #endif | ||
75 | |||
76 | /* The number of usable bits in an unsigned or signed integer type | ||
77 | with minimum value MIN and maximum value MAX, as an int expression | ||
78 | suitable in #if. Cover all known practical hosts. This | ||
79 | implementation exploits the fact that MAX is 1 less than a power of | ||
80 | 2, and merely counts the number of 1 bits in MAX; "COBn" means | ||
81 | "count the number of 1 bits in the low-order n bits"). */ | ||
82 | #define _GL_INTEGER_WIDTH(min, max) (((min) < 0) + _GL_COB128 (max)) | ||
83 | #define _GL_COB128(n) (_GL_COB64 ((n) >> 31 >> 31 >> 2) + _GL_COB64 (n)) | ||
84 | #define _GL_COB64(n) (_GL_COB32 ((n) >> 31 >> 1) + _GL_COB32 (n)) | ||
85 | #define _GL_COB32(n) (_GL_COB16 ((n) >> 16) + _GL_COB16 (n)) | ||
86 | #define _GL_COB16(n) (_GL_COB8 ((n) >> 8) + _GL_COB8 (n)) | ||
87 | #define _GL_COB8(n) (_GL_COB4 ((n) >> 4) + _GL_COB4 (n)) | ||
88 | #define _GL_COB4(n) (!!((n) & 8) + !!((n) & 4) + !!((n) & 2) + !!((n) & 1)) | ||
89 | |||
90 | #ifndef WORD_BIT | ||
91 | /* Assume 'int' is 32 bits wide. */ | ||
92 | # define WORD_BIT 32 | ||
93 | #endif | ||
94 | #ifndef LONG_BIT | ||
95 | /* Assume 'long' is 32 or 64 bits wide. */ | ||
96 | # if LONG_MAX == INT_MAX | ||
97 | # define LONG_BIT 32 | ||
98 | # else | ||
99 | # define LONG_BIT 64 | ||
100 | # endif | ||
101 | #endif | ||
102 | |||
103 | /* Macros specified by C23 and by ISO/IEC TS 18661-1:2014. */ | ||
104 | |||
105 | #if (! defined ULLONG_WIDTH \ | ||
106 | && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__ \ | ||
107 | || (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__))) | ||
108 | # define CHAR_WIDTH _GL_INTEGER_WIDTH (CHAR_MIN, CHAR_MAX) | ||
109 | # define SCHAR_WIDTH _GL_INTEGER_WIDTH (SCHAR_MIN, SCHAR_MAX) | ||
110 | # define UCHAR_WIDTH _GL_INTEGER_WIDTH (0, UCHAR_MAX) | ||
111 | # define SHRT_WIDTH _GL_INTEGER_WIDTH (SHRT_MIN, SHRT_MAX) | ||
112 | # define USHRT_WIDTH _GL_INTEGER_WIDTH (0, USHRT_MAX) | ||
113 | # define INT_WIDTH _GL_INTEGER_WIDTH (INT_MIN, INT_MAX) | ||
114 | # define UINT_WIDTH _GL_INTEGER_WIDTH (0, UINT_MAX) | ||
115 | # define LONG_WIDTH _GL_INTEGER_WIDTH (LONG_MIN, LONG_MAX) | ||
116 | # define ULONG_WIDTH _GL_INTEGER_WIDTH (0, ULONG_MAX) | ||
117 | # define LLONG_WIDTH _GL_INTEGER_WIDTH (LLONG_MIN, LLONG_MAX) | ||
118 | # define ULLONG_WIDTH _GL_INTEGER_WIDTH (0, ULLONG_MAX) | ||
119 | #endif | ||
120 | |||
121 | /* Macros specified by C23. */ | ||
122 | |||
123 | #if (! defined BOOL_WIDTH \ | ||
124 | && (defined _GNU_SOURCE \ | ||
125 | || (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__))) | ||
126 | # define BOOL_MAX 1 | ||
127 | # define BOOL_WIDTH 1 | ||
128 | #endif | ||
129 | |||
130 | #endif /* _GL_LIMITS_H */ | ||
131 | #endif /* _GL_LIMITS_H */ | ||
132 | #endif | ||
diff --git a/gl/malloc/dynarray-skeleton.gl.h b/gl/malloc/dynarray-skeleton.gl.h deleted file mode 100644 index af95414..0000000 --- a/gl/malloc/dynarray-skeleton.gl.h +++ /dev/null | |||
@@ -1,529 +0,0 @@ | |||
1 | /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ | ||
2 | /* Type-safe arrays which grow dynamically. | ||
3 | Copyright (C) 2017-2023 Free Software Foundation, Inc. | ||
4 | This file is part of the GNU C Library. | ||
5 | |||
6 | The GNU C Library is free software; you can redistribute it and/or | ||
7 | modify it under the terms of the GNU Lesser General Public | ||
8 | License as published by the Free Software Foundation; either | ||
9 | version 2.1 of the License, or (at your option) any later version. | ||
10 | |||
11 | The GNU C Library 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 GNU | ||
14 | Lesser General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU Lesser General Public | ||
17 | License along with the GNU C Library; if not, see | ||
18 | <https://www.gnu.org/licenses/>. */ | ||
19 | |||
20 | /* Pre-processor macros which act as parameters: | ||
21 | |||
22 | DYNARRAY_STRUCT | ||
23 | The struct tag of dynamic array to be defined. | ||
24 | DYNARRAY_ELEMENT | ||
25 | The type name of the element type. Elements are copied | ||
26 | as if by memcpy, and can change address as the dynamic | ||
27 | array grows. | ||
28 | DYNARRAY_PREFIX | ||
29 | The prefix of the functions which are defined. | ||
30 | |||
31 | The following parameters are optional: | ||
32 | |||
33 | DYNARRAY_ELEMENT_FREE | ||
34 | DYNARRAY_ELEMENT_FREE (E) is evaluated to deallocate the | ||
35 | contents of elements. E is of type DYNARRAY_ELEMENT *. | ||
36 | DYNARRAY_ELEMENT_INIT | ||
37 | DYNARRAY_ELEMENT_INIT (E) is evaluated to initialize a new | ||
38 | element. E is of type DYNARRAY_ELEMENT *. | ||
39 | If DYNARRAY_ELEMENT_FREE but not DYNARRAY_ELEMENT_INIT is | ||
40 | defined, new elements are automatically zero-initialized. | ||
41 | Otherwise, new elements have undefined contents. | ||
42 | DYNARRAY_INITIAL_SIZE | ||
43 | The size of the statically allocated array (default: | ||
44 | at least 2, more elements if they fit into 128 bytes). | ||
45 | Must be a preprocessor constant. If DYNARRAY_INITIAL_SIZE is 0, | ||
46 | there is no statically allocated array at, and all non-empty | ||
47 | arrays are heap-allocated. | ||
48 | DYNARRAY_FINAL_TYPE | ||
49 | The name of the type which holds the final array. If not | ||
50 | defined, is PREFIX##finalize not provided. DYNARRAY_FINAL_TYPE | ||
51 | must be a struct type, with members of type DYNARRAY_ELEMENT and | ||
52 | size_t at the start (in this order). | ||
53 | |||
54 | These macros are undefined after this header file has been | ||
55 | included. | ||
56 | |||
57 | The following types are provided (their members are private to the | ||
58 | dynarray implementation): | ||
59 | |||
60 | struct DYNARRAY_STRUCT | ||
61 | |||
62 | The following functions are provided: | ||
63 | |||
64 | void DYNARRAY_PREFIX##init (struct DYNARRAY_STRUCT *); | ||
65 | void DYNARRAY_PREFIX##free (struct DYNARRAY_STRUCT *); | ||
66 | bool DYNARRAY_PREFIX##has_failed (const struct DYNARRAY_STRUCT *); | ||
67 | void DYNARRAY_PREFIX##mark_failed (struct DYNARRAY_STRUCT *); | ||
68 | size_t DYNARRAY_PREFIX##size (const struct DYNARRAY_STRUCT *); | ||
69 | DYNARRAY_ELEMENT *DYNARRAY_PREFIX##begin (const struct DYNARRAY_STRUCT *); | ||
70 | DYNARRAY_ELEMENT *DYNARRAY_PREFIX##end (const struct DYNARRAY_STRUCT *); | ||
71 | DYNARRAY_ELEMENT *DYNARRAY_PREFIX##at (struct DYNARRAY_STRUCT *, size_t); | ||
72 | void DYNARRAY_PREFIX##add (struct DYNARRAY_STRUCT *, DYNARRAY_ELEMENT); | ||
73 | DYNARRAY_ELEMENT *DYNARRAY_PREFIX##emplace (struct DYNARRAY_STRUCT *); | ||
74 | bool DYNARRAY_PREFIX##resize (struct DYNARRAY_STRUCT *, size_t); | ||
75 | void DYNARRAY_PREFIX##remove_last (struct DYNARRAY_STRUCT *); | ||
76 | void DYNARRAY_PREFIX##clear (struct DYNARRAY_STRUCT *); | ||
77 | |||
78 | The following functions are provided are provided if the | ||
79 | prerequisites are met: | ||
80 | |||
81 | bool DYNARRAY_PREFIX##finalize (struct DYNARRAY_STRUCT *, | ||
82 | DYNARRAY_FINAL_TYPE *); | ||
83 | (if DYNARRAY_FINAL_TYPE is defined) | ||
84 | DYNARRAY_ELEMENT *DYNARRAY_PREFIX##finalize (struct DYNARRAY_STRUCT *, | ||
85 | size_t *); | ||
86 | (if DYNARRAY_FINAL_TYPE is not defined) | ||
87 | */ | ||
88 | |||
89 | #include <malloc/dynarray.gl.h> | ||
90 | |||
91 | #include <errno.h> | ||
92 | #include <stdlib.h> | ||
93 | #include <string.h> | ||
94 | |||
95 | #ifndef DYNARRAY_STRUCT | ||
96 | # error "DYNARRAY_STRUCT must be defined" | ||
97 | #endif | ||
98 | |||
99 | #ifndef DYNARRAY_ELEMENT | ||
100 | # error "DYNARRAY_ELEMENT must be defined" | ||
101 | #endif | ||
102 | |||
103 | #ifndef DYNARRAY_PREFIX | ||
104 | # error "DYNARRAY_PREFIX must be defined" | ||
105 | #endif | ||
106 | |||
107 | #ifdef DYNARRAY_INITIAL_SIZE | ||
108 | # if DYNARRAY_INITIAL_SIZE < 0 | ||
109 | # error "DYNARRAY_INITIAL_SIZE must be non-negative" | ||
110 | # endif | ||
111 | # if DYNARRAY_INITIAL_SIZE > 0 | ||
112 | # define DYNARRAY_HAVE_SCRATCH 1 | ||
113 | # else | ||
114 | # define DYNARRAY_HAVE_SCRATCH 0 | ||
115 | # endif | ||
116 | #else | ||
117 | /* Provide a reasonable default which limits the size of | ||
118 | DYNARRAY_STRUCT. */ | ||
119 | # define DYNARRAY_INITIAL_SIZE \ | ||
120 | (sizeof (DYNARRAY_ELEMENT) > 64 ? 2 : 128 / sizeof (DYNARRAY_ELEMENT)) | ||
121 | # define DYNARRAY_HAVE_SCRATCH 1 | ||
122 | #endif | ||
123 | |||
124 | /* Public type definitions. */ | ||
125 | |||
126 | /* All fields of this struct are private to the implementation. */ | ||
127 | struct DYNARRAY_STRUCT | ||
128 | { | ||
129 | union | ||
130 | { | ||
131 | struct dynarray_header dynarray_abstract; | ||
132 | struct | ||
133 | { | ||
134 | /* These fields must match struct dynarray_header. */ | ||
135 | size_t used; | ||
136 | size_t allocated; | ||
137 | DYNARRAY_ELEMENT *array; | ||
138 | } dynarray_header; | ||
139 | } u; | ||
140 | |||
141 | #if DYNARRAY_HAVE_SCRATCH | ||
142 | /* Initial inline allocation. */ | ||
143 | DYNARRAY_ELEMENT scratch[DYNARRAY_INITIAL_SIZE]; | ||
144 | #endif | ||
145 | }; | ||
146 | |||
147 | /* Internal use only: Helper macros. */ | ||
148 | |||
149 | /* Ensure macro-expansion of DYNARRAY_PREFIX. */ | ||
150 | #define DYNARRAY_CONCAT0(prefix, name) prefix##name | ||
151 | #define DYNARRAY_CONCAT1(prefix, name) DYNARRAY_CONCAT0(prefix, name) | ||
152 | #define DYNARRAY_NAME(name) DYNARRAY_CONCAT1(DYNARRAY_PREFIX, name) | ||
153 | |||
154 | /* Use DYNARRAY_FREE instead of DYNARRAY_NAME (free), | ||
155 | so that Gnulib does not change 'free' to 'rpl_free'. */ | ||
156 | #define DYNARRAY_FREE DYNARRAY_CONCAT1 (DYNARRAY_NAME (f), ree) | ||
157 | |||
158 | /* Address of the scratch buffer if any. */ | ||
159 | #if DYNARRAY_HAVE_SCRATCH | ||
160 | # define DYNARRAY_SCRATCH(list) (list)->scratch | ||
161 | #else | ||
162 | # define DYNARRAY_SCRATCH(list) NULL | ||
163 | #endif | ||
164 | |||
165 | /* Internal use only: Helper functions. */ | ||
166 | |||
167 | /* Internal function. Call DYNARRAY_ELEMENT_FREE with the array | ||
168 | elements. Name mangling needed due to the DYNARRAY_ELEMENT_FREE | ||
169 | macro expansion. */ | ||
170 | static inline void | ||
171 | DYNARRAY_NAME (free__elements__) (DYNARRAY_ELEMENT *__dynarray_array, | ||
172 | size_t __dynarray_used) | ||
173 | { | ||
174 | #ifdef DYNARRAY_ELEMENT_FREE | ||
175 | for (size_t __dynarray_i = 0; __dynarray_i < __dynarray_used; ++__dynarray_i) | ||
176 | DYNARRAY_ELEMENT_FREE (&__dynarray_array[__dynarray_i]); | ||
177 | #endif /* DYNARRAY_ELEMENT_FREE */ | ||
178 | } | ||
179 | |||
180 | /* Internal function. Free the non-scratch array allocation. */ | ||
181 | static inline void | ||
182 | DYNARRAY_NAME (free__array__) (struct DYNARRAY_STRUCT *list) | ||
183 | { | ||
184 | #if DYNARRAY_HAVE_SCRATCH | ||
185 | if (list->u.dynarray_header.array != list->scratch) | ||
186 | free (list->u.dynarray_header.array); | ||
187 | #else | ||
188 | free (list->u.dynarray_header.array); | ||
189 | #endif | ||
190 | } | ||
191 | |||
192 | /* Public functions. */ | ||
193 | |||
194 | /* Initialize a dynamic array object. This must be called before any | ||
195 | use of the object. */ | ||
196 | _GL_ATTRIBUTE_NONNULL ((1)) | ||
197 | static void | ||
198 | DYNARRAY_NAME (init) (struct DYNARRAY_STRUCT *list) | ||
199 | { | ||
200 | list->u.dynarray_header.used = 0; | ||
201 | list->u.dynarray_header.allocated = DYNARRAY_INITIAL_SIZE; | ||
202 | list->u.dynarray_header.array = DYNARRAY_SCRATCH (list); | ||
203 | } | ||
204 | |||
205 | /* Deallocate the dynamic array and its elements. */ | ||
206 | _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_NONNULL ((1)) | ||
207 | static void | ||
208 | DYNARRAY_FREE (struct DYNARRAY_STRUCT *list) | ||
209 | { | ||
210 | DYNARRAY_NAME (free__elements__) | ||
211 | (list->u.dynarray_header.array, list->u.dynarray_header.used); | ||
212 | DYNARRAY_NAME (free__array__) (list); | ||
213 | DYNARRAY_NAME (init) (list); | ||
214 | } | ||
215 | |||
216 | /* Return true if the dynamic array is in an error state. */ | ||
217 | _GL_ATTRIBUTE_NONNULL ((1)) | ||
218 | static inline bool | ||
219 | DYNARRAY_NAME (has_failed) (const struct DYNARRAY_STRUCT *list) | ||
220 | { | ||
221 | return list->u.dynarray_header.allocated == __dynarray_error_marker (); | ||
222 | } | ||
223 | |||
224 | /* Mark the dynamic array as failed. All elements are deallocated as | ||
225 | a side effect. */ | ||
226 | _GL_ATTRIBUTE_NONNULL ((1)) | ||
227 | static void | ||
228 | DYNARRAY_NAME (mark_failed) (struct DYNARRAY_STRUCT *list) | ||
229 | { | ||
230 | DYNARRAY_NAME (free__elements__) | ||
231 | (list->u.dynarray_header.array, list->u.dynarray_header.used); | ||
232 | DYNARRAY_NAME (free__array__) (list); | ||
233 | list->u.dynarray_header.array = DYNARRAY_SCRATCH (list); | ||
234 | list->u.dynarray_header.used = 0; | ||
235 | list->u.dynarray_header.allocated = __dynarray_error_marker (); | ||
236 | } | ||
237 | |||
238 | /* Return the number of elements which have been added to the dynamic | ||
239 | array. */ | ||
240 | _GL_ATTRIBUTE_NONNULL ((1)) | ||
241 | static inline size_t | ||
242 | DYNARRAY_NAME (size) (const struct DYNARRAY_STRUCT *list) | ||
243 | { | ||
244 | return list->u.dynarray_header.used; | ||
245 | } | ||
246 | |||
247 | /* Return a pointer to the array element at INDEX. Terminate the | ||
248 | process if INDEX is out of bounds. */ | ||
249 | _GL_ATTRIBUTE_NONNULL ((1)) | ||
250 | static inline DYNARRAY_ELEMENT * | ||
251 | DYNARRAY_NAME (at) (struct DYNARRAY_STRUCT *list, size_t index) | ||
252 | { | ||
253 | if (_GL_UNLIKELY (index >= DYNARRAY_NAME (size) (list))) | ||
254 | __libc_dynarray_at_failure (DYNARRAY_NAME (size) (list), index); | ||
255 | return list->u.dynarray_header.array + index; | ||
256 | } | ||
257 | |||
258 | /* Return a pointer to the first array element, if any. For a | ||
259 | zero-length array, the pointer can be NULL even though the dynamic | ||
260 | array has not entered the failure state. */ | ||
261 | _GL_ATTRIBUTE_NONNULL ((1)) | ||
262 | static inline DYNARRAY_ELEMENT * | ||
263 | DYNARRAY_NAME (begin) (struct DYNARRAY_STRUCT *list) | ||
264 | { | ||
265 | return list->u.dynarray_header.array; | ||
266 | } | ||
267 | |||
268 | /* Return a pointer one element past the last array element. For a | ||
269 | zero-length array, the pointer can be NULL even though the dynamic | ||
270 | array has not entered the failure state. */ | ||
271 | _GL_ATTRIBUTE_NONNULL ((1)) | ||
272 | static inline DYNARRAY_ELEMENT * | ||
273 | DYNARRAY_NAME (end) (struct DYNARRAY_STRUCT *list) | ||
274 | { | ||
275 | return list->u.dynarray_header.array + list->u.dynarray_header.used; | ||
276 | } | ||
277 | |||
278 | /* Internal function. Slow path for the add function below. */ | ||
279 | static void | ||
280 | DYNARRAY_NAME (add__) (struct DYNARRAY_STRUCT *list, DYNARRAY_ELEMENT item) | ||
281 | { | ||
282 | if (_GL_UNLIKELY | ||
283 | (!__libc_dynarray_emplace_enlarge (&list->u.dynarray_abstract, | ||
284 | DYNARRAY_SCRATCH (list), | ||
285 | sizeof (DYNARRAY_ELEMENT)))) | ||
286 | { | ||
287 | DYNARRAY_NAME (mark_failed) (list); | ||
288 | return; | ||
289 | } | ||
290 | |||
291 | /* Copy the new element and increase the array length. */ | ||
292 | list->u.dynarray_header.array[list->u.dynarray_header.used++] = item; | ||
293 | } | ||
294 | |||
295 | /* Add ITEM at the end of the array, enlarging it by one element. | ||
296 | Mark *LIST as failed if the dynamic array allocation size cannot be | ||
297 | increased. */ | ||
298 | _GL_ATTRIBUTE_NONNULL ((1)) | ||
299 | static inline void | ||
300 | DYNARRAY_NAME (add) (struct DYNARRAY_STRUCT *list, DYNARRAY_ELEMENT item) | ||
301 | { | ||
302 | /* Do nothing in case of previous error. */ | ||
303 | if (DYNARRAY_NAME (has_failed) (list)) | ||
304 | return; | ||
305 | |||
306 | /* Enlarge the array if necessary. */ | ||
307 | if (_GL_UNLIKELY (list->u.dynarray_header.used | ||
308 | == list->u.dynarray_header.allocated)) | ||
309 | { | ||
310 | DYNARRAY_NAME (add__) (list, item); | ||
311 | return; | ||
312 | } | ||
313 | |||
314 | /* Copy the new element and increase the array length. */ | ||
315 | list->u.dynarray_header.array[list->u.dynarray_header.used++] = item; | ||
316 | } | ||
317 | |||
318 | /* Internal function. Building block for the emplace functions below. | ||
319 | Assumes space for one more element in *LIST. */ | ||
320 | static inline DYNARRAY_ELEMENT * | ||
321 | DYNARRAY_NAME (emplace__tail__) (struct DYNARRAY_STRUCT *list) | ||
322 | { | ||
323 | DYNARRAY_ELEMENT *result | ||
324 | = &list->u.dynarray_header.array[list->u.dynarray_header.used]; | ||
325 | ++list->u.dynarray_header.used; | ||
326 | #if defined (DYNARRAY_ELEMENT_INIT) | ||
327 | DYNARRAY_ELEMENT_INIT (result); | ||
328 | #elif defined (DYNARRAY_ELEMENT_FREE) | ||
329 | memset (result, 0, sizeof (*result)); | ||
330 | #endif | ||
331 | return result; | ||
332 | } | ||
333 | |||
334 | /* Internal function. Slow path for the emplace function below. */ | ||
335 | static DYNARRAY_ELEMENT * | ||
336 | DYNARRAY_NAME (emplace__) (struct DYNARRAY_STRUCT *list) | ||
337 | { | ||
338 | if (_GL_UNLIKELY | ||
339 | (!__libc_dynarray_emplace_enlarge (&list->u.dynarray_abstract, | ||
340 | DYNARRAY_SCRATCH (list), | ||
341 | sizeof (DYNARRAY_ELEMENT)))) | ||
342 | { | ||
343 | DYNARRAY_NAME (mark_failed) (list); | ||
344 | return NULL; | ||
345 | } | ||
346 | return DYNARRAY_NAME (emplace__tail__) (list); | ||
347 | } | ||
348 | |||
349 | /* Allocate a place for a new element in *LIST and return a pointer to | ||
350 | it. The pointer can be NULL if the dynamic array cannot be | ||
351 | enlarged due to a memory allocation failure. */ | ||
352 | _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_NODISCARD | ||
353 | _GL_ATTRIBUTE_NONNULL ((1)) | ||
354 | static | ||
355 | /* Avoid inlining with the larger initialization code. */ | ||
356 | #if !(defined (DYNARRAY_ELEMENT_INIT) || defined (DYNARRAY_ELEMENT_FREE)) | ||
357 | inline | ||
358 | #endif | ||
359 | DYNARRAY_ELEMENT * | ||
360 | DYNARRAY_NAME (emplace) (struct DYNARRAY_STRUCT *list) | ||
361 | { | ||
362 | /* Do nothing in case of previous error. */ | ||
363 | if (DYNARRAY_NAME (has_failed) (list)) | ||
364 | return NULL; | ||
365 | |||
366 | /* Enlarge the array if necessary. */ | ||
367 | if (_GL_UNLIKELY (list->u.dynarray_header.used | ||
368 | == list->u.dynarray_header.allocated)) | ||
369 | return (DYNARRAY_NAME (emplace__) (list)); | ||
370 | return DYNARRAY_NAME (emplace__tail__) (list); | ||
371 | } | ||
372 | |||
373 | /* Change the size of *LIST to SIZE. If SIZE is larger than the | ||
374 | existing size, new elements are added (which can be initialized). | ||
375 | Otherwise, the list is truncated, and elements are freed. Return | ||
376 | false on memory allocation failure (and mark *LIST as failed). */ | ||
377 | _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_NONNULL ((1)) | ||
378 | static bool | ||
379 | DYNARRAY_NAME (resize) (struct DYNARRAY_STRUCT *list, size_t size) | ||
380 | { | ||
381 | if (size > list->u.dynarray_header.used) | ||
382 | { | ||
383 | bool ok; | ||
384 | #if defined (DYNARRAY_ELEMENT_INIT) | ||
385 | /* The new elements have to be initialized. */ | ||
386 | size_t old_size = list->u.dynarray_header.used; | ||
387 | ok = __libc_dynarray_resize (&list->u.dynarray_abstract, | ||
388 | size, DYNARRAY_SCRATCH (list), | ||
389 | sizeof (DYNARRAY_ELEMENT)); | ||
390 | if (ok) | ||
391 | for (size_t i = old_size; i < size; ++i) | ||
392 | { | ||
393 | DYNARRAY_ELEMENT_INIT (&list->u.dynarray_header.array[i]); | ||
394 | } | ||
395 | #elif defined (DYNARRAY_ELEMENT_FREE) | ||
396 | /* Zero initialization is needed so that the elements can be | ||
397 | safely freed. */ | ||
398 | ok = __libc_dynarray_resize_clear | ||
399 | (&list->u.dynarray_abstract, size, | ||
400 | DYNARRAY_SCRATCH (list), sizeof (DYNARRAY_ELEMENT)); | ||
401 | #else | ||
402 | ok = __libc_dynarray_resize (&list->u.dynarray_abstract, | ||
403 | size, DYNARRAY_SCRATCH (list), | ||
404 | sizeof (DYNARRAY_ELEMENT)); | ||
405 | #endif | ||
406 | if (_GL_UNLIKELY (!ok)) | ||
407 | DYNARRAY_NAME (mark_failed) (list); | ||
408 | return ok; | ||
409 | } | ||
410 | else | ||
411 | { | ||
412 | /* The list has shrunk in size. Free the removed elements. */ | ||
413 | DYNARRAY_NAME (free__elements__) | ||
414 | (list->u.dynarray_header.array + size, | ||
415 | list->u.dynarray_header.used - size); | ||
416 | list->u.dynarray_header.used = size; | ||
417 | return true; | ||
418 | } | ||
419 | } | ||
420 | |||
421 | /* Remove the last element of LIST if it is present. */ | ||
422 | _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_NONNULL ((1)) | ||
423 | static void | ||
424 | DYNARRAY_NAME (remove_last) (struct DYNARRAY_STRUCT *list) | ||
425 | { | ||
426 | /* used > 0 implies that the array is the non-failed state. */ | ||
427 | if (list->u.dynarray_header.used > 0) | ||
428 | { | ||
429 | size_t new_length = list->u.dynarray_header.used - 1; | ||
430 | #ifdef DYNARRAY_ELEMENT_FREE | ||
431 | DYNARRAY_ELEMENT_FREE (&list->u.dynarray_header.array[new_length]); | ||
432 | #endif | ||
433 | list->u.dynarray_header.used = new_length; | ||
434 | } | ||
435 | } | ||
436 | |||
437 | /* Remove all elements from the list. The elements are freed, but the | ||
438 | list itself is not. */ | ||
439 | _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_NONNULL ((1)) | ||
440 | static void | ||
441 | DYNARRAY_NAME (clear) (struct DYNARRAY_STRUCT *list) | ||
442 | { | ||
443 | /* free__elements__ does nothing if the list is in the failed | ||
444 | state. */ | ||
445 | DYNARRAY_NAME (free__elements__) | ||
446 | (list->u.dynarray_header.array, list->u.dynarray_header.used); | ||
447 | list->u.dynarray_header.used = 0; | ||
448 | } | ||
449 | |||
450 | #ifdef DYNARRAY_FINAL_TYPE | ||
451 | /* Transfer the dynamic array to a permanent location at *RESULT. | ||
452 | Returns true on success on false on allocation failure. In either | ||
453 | case, *LIST is re-initialized and can be reused. A NULL pointer is | ||
454 | stored in *RESULT if LIST refers to an empty list. On success, the | ||
455 | pointer in *RESULT is heap-allocated and must be deallocated using | ||
456 | free. */ | ||
457 | _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_NODISCARD | ||
458 | _GL_ATTRIBUTE_NONNULL ((1, 2)) | ||
459 | static bool | ||
460 | DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list, | ||
461 | DYNARRAY_FINAL_TYPE *result) | ||
462 | { | ||
463 | struct dynarray_finalize_result res; | ||
464 | if (__libc_dynarray_finalize (&list->u.dynarray_abstract, | ||
465 | DYNARRAY_SCRATCH (list), | ||
466 | sizeof (DYNARRAY_ELEMENT), &res)) | ||
467 | { | ||
468 | /* On success, the result owns all the data. */ | ||
469 | DYNARRAY_NAME (init) (list); | ||
470 | *result = (DYNARRAY_FINAL_TYPE) { res.array, res.length }; | ||
471 | return true; | ||
472 | } | ||
473 | else | ||
474 | { | ||
475 | /* On error, we need to free all data. */ | ||
476 | DYNARRAY_FREE (list); | ||
477 | errno = ENOMEM; | ||
478 | return false; | ||
479 | } | ||
480 | } | ||
481 | #else /* !DYNARRAY_FINAL_TYPE */ | ||
482 | /* Transfer the dynamic array to a heap-allocated array and return a | ||
483 | pointer to it. The pointer is NULL if memory allocation fails, or | ||
484 | if the array is empty, so this function should be used only for | ||
485 | arrays which are known not be empty (usually because they always | ||
486 | have a sentinel at the end). If LENGTHP is not NULL, the array | ||
487 | length is written to *LENGTHP. *LIST is re-initialized and can be | ||
488 | reused. */ | ||
489 | _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_NODISCARD | ||
490 | _GL_ATTRIBUTE_NONNULL ((1)) | ||
491 | static DYNARRAY_ELEMENT * | ||
492 | DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list, size_t *lengthp) | ||
493 | { | ||
494 | struct dynarray_finalize_result res; | ||
495 | if (__libc_dynarray_finalize (&list->u.dynarray_abstract, | ||
496 | DYNARRAY_SCRATCH (list), | ||
497 | sizeof (DYNARRAY_ELEMENT), &res)) | ||
498 | { | ||
499 | /* On success, the result owns all the data. */ | ||
500 | DYNARRAY_NAME (init) (list); | ||
501 | if (lengthp != NULL) | ||
502 | *lengthp = res.length; | ||
503 | return res.array; | ||
504 | } | ||
505 | else | ||
506 | { | ||
507 | /* On error, we need to free all data. */ | ||
508 | DYNARRAY_FREE (list); | ||
509 | errno = ENOMEM; | ||
510 | return NULL; | ||
511 | } | ||
512 | } | ||
513 | #endif /* !DYNARRAY_FINAL_TYPE */ | ||
514 | |||
515 | /* Undo macro definitions. */ | ||
516 | |||
517 | #undef DYNARRAY_CONCAT0 | ||
518 | #undef DYNARRAY_CONCAT1 | ||
519 | #undef DYNARRAY_NAME | ||
520 | #undef DYNARRAY_SCRATCH | ||
521 | #undef DYNARRAY_HAVE_SCRATCH | ||
522 | |||
523 | #undef DYNARRAY_STRUCT | ||
524 | #undef DYNARRAY_ELEMENT | ||
525 | #undef DYNARRAY_PREFIX | ||
526 | #undef DYNARRAY_ELEMENT_FREE | ||
527 | #undef DYNARRAY_ELEMENT_INIT | ||
528 | #undef DYNARRAY_INITIAL_SIZE | ||
529 | #undef DYNARRAY_FINAL_TYPE | ||
diff --git a/gl/malloc/dynarray.gl.h b/gl/malloc/dynarray.gl.h deleted file mode 100644 index 34987e7..0000000 --- a/gl/malloc/dynarray.gl.h +++ /dev/null | |||
@@ -1,173 +0,0 @@ | |||
1 | /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ | ||
2 | /* Type-safe arrays which grow dynamically. Shared definitions. | ||
3 | Copyright (C) 2017-2023 Free Software Foundation, Inc. | ||
4 | This file is part of the GNU C Library. | ||
5 | |||
6 | The GNU C Library is free software; you can redistribute it and/or | ||
7 | modify it under the terms of the GNU Lesser General Public | ||
8 | License as published by the Free Software Foundation; either | ||
9 | version 2.1 of the License, or (at your option) any later version. | ||
10 | |||
11 | The GNU C Library 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 GNU | ||
14 | Lesser General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU Lesser General Public | ||
17 | License along with the GNU C Library; if not, see | ||
18 | <https://www.gnu.org/licenses/>. */ | ||
19 | |||
20 | /* To use the dynarray facility, you need to include | ||
21 | <malloc/dynarray-skeleton.c> and define the parameter macros | ||
22 | documented in that file. | ||
23 | |||
24 | A minimal example which provides a growing list of integers can be | ||
25 | defined like this: | ||
26 | |||
27 | struct int_array | ||
28 | { | ||
29 | // Pointer to result array followed by its length, | ||
30 | // as required by DYNARRAY_FINAL_TYPE. | ||
31 | int *array; | ||
32 | size_t length; | ||
33 | }; | ||
34 | |||
35 | #define DYNARRAY_STRUCT dynarray_int | ||
36 | #define DYNARRAY_ELEMENT int | ||
37 | #define DYNARRAY_PREFIX dynarray_int_ | ||
38 | #define DYNARRAY_FINAL_TYPE struct int_array | ||
39 | #include <malloc/dynarray-skeleton.c> | ||
40 | |||
41 | To create a three-element array with elements 1, 2, 3, use this | ||
42 | code: | ||
43 | |||
44 | struct dynarray_int dyn; | ||
45 | dynarray_int_init (&dyn); | ||
46 | for (int i = 1; i <= 3; ++i) | ||
47 | { | ||
48 | int *place = dynarray_int_emplace (&dyn); | ||
49 | assert (place != NULL); | ||
50 | *place = i; | ||
51 | } | ||
52 | struct int_array result; | ||
53 | bool ok = dynarray_int_finalize (&dyn, &result); | ||
54 | assert (ok); | ||
55 | assert (result.length == 3); | ||
56 | assert (result.array[0] == 1); | ||
57 | assert (result.array[1] == 2); | ||
58 | assert (result.array[2] == 3); | ||
59 | free (result.array); | ||
60 | |||
61 | If the elements contain resources which must be freed, define | ||
62 | DYNARRAY_ELEMENT_FREE appropriately, like this: | ||
63 | |||
64 | struct str_array | ||
65 | { | ||
66 | char **array; | ||
67 | size_t length; | ||
68 | }; | ||
69 | |||
70 | #define DYNARRAY_STRUCT dynarray_str | ||
71 | #define DYNARRAY_ELEMENT char * | ||
72 | #define DYNARRAY_ELEMENT_FREE(ptr) free (*ptr) | ||
73 | #define DYNARRAY_PREFIX dynarray_str_ | ||
74 | #define DYNARRAY_FINAL_TYPE struct str_array | ||
75 | #include <malloc/dynarray-skeleton.c> | ||
76 | |||
77 | Compared to scratch buffers, dynamic arrays have the following | ||
78 | features: | ||
79 | |||
80 | - They have an element type, and are not just an untyped buffer of | ||
81 | bytes. | ||
82 | |||
83 | - When growing, previously stored elements are preserved. (It is | ||
84 | expected that scratch_buffer_grow_preserve and | ||
85 | scratch_buffer_set_array_size eventually go away because all | ||
86 | current users are moved to dynamic arrays.) | ||
87 | |||
88 | - Scratch buffers have a more aggressive growth policy because | ||
89 | growing them typically means a retry of an operation (across an | ||
90 | NSS service module boundary), which is expensive. | ||
91 | |||
92 | - For the same reason, scratch buffers have a much larger initial | ||
93 | stack allocation. */ | ||
94 | |||
95 | #ifndef _DYNARRAY_H | ||
96 | #define _DYNARRAY_H | ||
97 | |||
98 | #include <stddef.h> | ||
99 | #include <string.h> | ||
100 | |||
101 | struct dynarray_header | ||
102 | { | ||
103 | size_t used; | ||
104 | size_t allocated; | ||
105 | void *array; | ||
106 | }; | ||
107 | |||
108 | /* Marker used in the allocated member to indicate that an error was | ||
109 | encountered. */ | ||
110 | static inline size_t | ||
111 | __dynarray_error_marker (void) | ||
112 | { | ||
113 | return -1; | ||
114 | } | ||
115 | |||
116 | /* Internal function. See the has_failed function in | ||
117 | dynarray-skeleton.c. */ | ||
118 | static inline bool | ||
119 | __dynarray_error (struct dynarray_header *list) | ||
120 | { | ||
121 | return list->allocated == __dynarray_error_marker (); | ||
122 | } | ||
123 | |||
124 | /* Internal function. Enlarge the dynamically allocated area of the | ||
125 | array to make room for one more element. SCRATCH is a pointer to | ||
126 | the scratch area (which is not heap-allocated and must not be | ||
127 | freed). ELEMENT_SIZE is the size, in bytes, of one element. | ||
128 | Return false on failure, true on success. */ | ||
129 | bool __libc_dynarray_emplace_enlarge (struct dynarray_header *, | ||
130 | void *scratch, size_t element_size); | ||
131 | |||
132 | /* Internal function. Enlarge the dynamically allocated area of the | ||
133 | array to make room for at least SIZE elements (which must be larger | ||
134 | than the existing used part of the dynamic array). SCRATCH is a | ||
135 | pointer to the scratch area (which is not heap-allocated and must | ||
136 | not be freed). ELEMENT_SIZE is the size, in bytes, of one element. | ||
137 | Return false on failure, true on success. */ | ||
138 | bool __libc_dynarray_resize (struct dynarray_header *, size_t size, | ||
139 | void *scratch, size_t element_size); | ||
140 | |||
141 | /* Internal function. Like __libc_dynarray_resize, but clear the new | ||
142 | part of the dynamic array. */ | ||
143 | bool __libc_dynarray_resize_clear (struct dynarray_header *, size_t size, | ||
144 | void *scratch, size_t element_size); | ||
145 | |||
146 | /* Internal type. */ | ||
147 | struct dynarray_finalize_result | ||
148 | { | ||
149 | void *array; | ||
150 | size_t length; | ||
151 | }; | ||
152 | |||
153 | /* Internal function. Copy the dynamically-allocated area to an | ||
154 | explicitly-sized heap allocation. SCRATCH is a pointer to the | ||
155 | embedded scratch space. ELEMENT_SIZE is the size, in bytes, of the | ||
156 | element type. On success, true is returned, and pointer and length | ||
157 | are written to *RESULT. On failure, false is returned. The caller | ||
158 | has to take care of some of the memory management; this function is | ||
159 | expected to be called from dynarray-skeleton.c. */ | ||
160 | bool __libc_dynarray_finalize (struct dynarray_header *list, void *scratch, | ||
161 | size_t element_size, | ||
162 | struct dynarray_finalize_result *result); | ||
163 | |||
164 | |||
165 | /* Internal function. Terminate the process after an index error. | ||
166 | SIZE is the number of elements of the dynamic array. INDEX is the | ||
167 | lookup index which triggered the failure. */ | ||
168 | _Noreturn void __libc_dynarray_at_failure (size_t size, size_t index); | ||
169 | |||
170 | #ifndef _ISOMAC | ||
171 | #endif | ||
172 | |||
173 | #endif /* _DYNARRAY_H */ | ||
diff --git a/gl/stdckdint.h b/gl/stdckdint.h deleted file mode 100644 index edcda29..0000000 --- a/gl/stdckdint.h +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ | ||
2 | /* stdckdint.h -- checked integer arithmetic | ||
3 | |||
4 | Copyright 2022-2023 Free Software Foundation, Inc. | ||
5 | |||
6 | This program is free software: you can redistribute it and/or modify it | ||
7 | under the terms of the GNU Lesser General Public License as published | ||
8 | by the Free Software Foundation; either version 2.1 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
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 Lesser General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU Lesser General Public License | ||
17 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ | ||
18 | |||
19 | #ifndef _GL_STDCKDINT_H | ||
20 | #define _GL_STDCKDINT_H | ||
21 | |||
22 | #include "intprops-internal.h" | ||
23 | |||
24 | /* Store into *R the low-order bits of A + B, A - B, A * B, respectively. | ||
25 | Return 1 if the result overflows, 0 otherwise. | ||
26 | A, B, and *R can have any integer type other than char, bool, a | ||
27 | bit-precise integer type, or an enumeration type. | ||
28 | |||
29 | These are like the standard macros introduced in C23, except that | ||
30 | arguments should not have side effects. */ | ||
31 | |||
32 | #define ckd_add(r, a, b) ((bool) _GL_INT_ADD_WRAPV (a, b, r)) | ||
33 | #define ckd_sub(r, a, b) ((bool) _GL_INT_SUBTRACT_WRAPV (a, b, r)) | ||
34 | #define ckd_mul(r, a, b) ((bool) _GL_INT_MULTIPLY_WRAPV (a, b, r)) | ||
35 | |||
36 | #endif /* _GL_STDCKDINT_H */ | ||