Debian Codegraph @

lib/config.h.in

raw
1 /* config.h.in. Generated from configure.ac by autoheader. */
2
3 #if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
4 # pragma GCC diagnostic push
5 # pragma GCC diagnostic ignored "-Wtrailing-whitespace"
6 #endif
7
8
9 /* Witness that <config.h> has been included. */
10 #define _GL_CONFIG_H_INCLUDED 1
11
12
13 /* Define to the number of bits in type 'ptrdiff_t'. */
14 #undef BITSIZEOF_PTRDIFF_T
15
16 /* Define to the number of bits in type 'sig_atomic_t'. */
17 #undef BITSIZEOF_SIG_ATOMIC_T
18
19 /* Define to the number of bits in type 'size_t'. */
20 #undef BITSIZEOF_SIZE_T
21
22 /* Define to the number of bits in type 'wchar_t'. */
23 #undef BITSIZEOF_WCHAR_T
24
25 /* Define to the number of bits in type 'wint_t'. */
26 #undef BITSIZEOF_WINT_T
27
28 /* Define to 1 if using 'alloca.c'. */
29 #undef C_ALLOCA
30
31 /* Define to 1 if // is a file system root distinct from /. */
32 #undef DOUBLE_SLASH_IS_DISTINCT_ROOT
33
34 /* Define this to 1 if F_DUPFD behavior does not match POSIX */
35 #undef FCNTL_DUPFD_BUGGY
36
37 /* Define to 1 if fopen() fails to recognize a trailing slash. */
38 #undef FOPEN_TRAILING_SLASH_BUG
39
40 /* Define to 1 if the system's ftello function has the Solaris bug. */
41 #undef FTELLO_BROKEN_AFTER_SWITCHING_FROM_READ_TO_WRITE
42
43 /* Define to 1 if the system's ftello function has the macOS bug. */
44 #undef FTELLO_BROKEN_AFTER_UNGETC
45
46 /* Define to 1 if fflush is known to work on stdin as per POSIX.1-2008 or
47 later, 0 if fflush is known to not work, -1 if unknown. */
48 #undef FUNC_FFLUSH_STDIN
49
50 /* Define to 1 if ungetc is broken when used on arbitrary bytes. */
51 #undef FUNC_UNGETC_BROKEN
52
53 /* Define to a C preprocessor expression that evaluates to 1 or 0, depending
54 whether the gnulib module close shall be considered present. */
55 #undef GNULIB_CLOSE
56
57 /* Define to a C preprocessor expression that evaluates to 1 or 0, depending
58 whether the gnulib module fopen-gnu shall be considered present. */
59 #undef GNULIB_FOPEN_GNU
60
61 /* Define to a C preprocessor expression that evaluates to 1 or 0, depending
62 whether the gnulib module fscanf shall be considered present. */
63 #undef GNULIB_FSCANF
64
65 /* Define to a C preprocessor expression that evaluates to 1 or 0, depending
66 whether the gnulib module fstat shall be considered present. */
67 #undef GNULIB_FSTAT
68
69 /* Define to the directory where to find the localizations of the translation
70 domain 'gnulib', as a C string. */
71 #undef GNULIB_LOCALEDIR
72
73 /* Define to a C preprocessor expression that evaluates to 1 or 0, depending
74 whether the gnulib module msvc-nothrow shall be considered present. */
75 #undef GNULIB_MSVC_NOTHROW
76
77 /* Define to 1 if printf and friends should be labeled with attribute
78 "__gnu_printf__" instead of "__printf__" */
79 #undef GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU
80
81 /* Define to a C preprocessor expression that evaluates to 1 or 0, depending
82 whether the gnulib module scanf shall be considered present. */
83 #undef GNULIB_SCANF
84
85 /* Define to a C preprocessor expression that evaluates to 1 or 0, depending
86 whether the gnulib module stat shall be considered present. */
87 #undef GNULIB_STAT
88
89 /* Define to a C preprocessor expression that evaluates to 1 or 0, depending
90 whether the gnulib module strerror shall be considered present. */
91 #undef GNULIB_STRERROR
92
93 /* Define to 1 when the gnulib module cloexec should be tested. */
94 #undef GNULIB_TEST_CLOEXEC
95
96 /* Define to 1 when the gnulib module close should be tested. */
97 #undef GNULIB_TEST_CLOSE
98
99 /* Define to 1 when the gnulib module dup2 should be tested. */
100 #undef GNULIB_TEST_DUP2
101
102 /* Define to 1 when the gnulib module fcntl should be tested. */
103 #undef GNULIB_TEST_FCNTL
104
105 /* Define to 1 when the gnulib module fgetc should be tested. */
106 #undef GNULIB_TEST_FGETC
107
108 /* Define to 1 when the gnulib module fgets should be tested. */
109 #undef GNULIB_TEST_FGETS
110
111 /* Define to 1 when the gnulib module fopen should be tested. */
112 #undef GNULIB_TEST_FOPEN
113
114 /* Define to 1 when the gnulib module fopen-gnu should be tested. */
115 #undef GNULIB_TEST_FOPEN_GNU
116
117 /* Define to 1 when the gnulib module fprintf should be tested. */
118 #undef GNULIB_TEST_FPRINTF
119
120 /* Define to 1 when the gnulib module fputc should be tested. */
121 #undef GNULIB_TEST_FPUTC
122
123 /* Define to 1 when the gnulib module fputs should be tested. */
124 #undef GNULIB_TEST_FPUTS
125
126 /* Define to 1 when the gnulib module fread should be tested. */
127 #undef GNULIB_TEST_FREAD
128
129 /* Define to 1 when the gnulib module free-posix should be tested. */
130 #undef GNULIB_TEST_FREE_POSIX
131
132 /* Define to 1 when the gnulib module fscanf should be tested. */
133 #undef GNULIB_TEST_FSCANF
134
135 /* Define to 1 when the gnulib module fstat should be tested. */
136 #undef GNULIB_TEST_FSTAT
137
138 /* Define to 1 when the gnulib module ftell should be tested. */
139 #undef GNULIB_TEST_FTELL
140
141 /* Define to 1 when the gnulib module ftello should be tested. */
142 #undef GNULIB_TEST_FTELLO
143
144 /* Define to 1 when the gnulib module fwrite should be tested. */
145 #undef GNULIB_TEST_FWRITE
146
147 /* Define to 1 when the gnulib module getc should be tested. */
148 #undef GNULIB_TEST_GETC
149
150 /* Define to 1 when the gnulib module getchar should be tested. */
151 #undef GNULIB_TEST_GETCHAR
152
153 /* Define to 1 when the gnulib module getdtablesize should be tested. */
154 #undef GNULIB_TEST_GETDTABLESIZE
155
156 /* Define to 1 when the gnulib module getopt-posix should be tested. */
157 #undef GNULIB_TEST_GETOPT_POSIX
158
159 /* Define to 1 when the gnulib module getprogname should be tested. */
160 #undef GNULIB_TEST_GETPROGNAME
161
162 /* Define to 1 when the gnulib module lseek should be tested. */
163 #undef GNULIB_TEST_LSEEK
164
165 /* Define to 1 when the gnulib module malloc-posix should be tested. */
166 #undef GNULIB_TEST_MALLOC_POSIX
167
168 /* Define to 1 when the gnulib module memset_explicit should be tested. */
169 #undef GNULIB_TEST_MEMSET_EXPLICIT
170
171 /* Define to 1 when the gnulib module open should be tested. */
172 #undef GNULIB_TEST_OPEN
173
174 /* Define to 1 when the gnulib module printf should be tested. */
175 #undef GNULIB_TEST_PRINTF
176
177 /* Define to 1 when the gnulib module putc should be tested. */
178 #undef GNULIB_TEST_PUTC
179
180 /* Define to 1 when the gnulib module putchar should be tested. */
181 #undef GNULIB_TEST_PUTCHAR
182
183 /* Define to 1 when the gnulib module puts should be tested. */
184 #undef GNULIB_TEST_PUTS
185
186 /* Define to 1 when the gnulib module realloc-posix should be tested. */
187 #undef GNULIB_TEST_REALLOC_POSIX
188
189 /* Define to 1 when the gnulib module scanf should be tested. */
190 #undef GNULIB_TEST_SCANF
191
192 /* Define to 1 when the gnulib module stat should be tested. */
193 #undef GNULIB_TEST_STAT
194
195 /* Define to 1 when the gnulib module strerror should be tested. */
196 #undef GNULIB_TEST_STRERROR
197
198 /* Define to 1 when the gnulib module vfprintf should be tested. */
199 #undef GNULIB_TEST_VFPRINTF
200
201 /* Define to 1 when the gnulib module vprintf should be tested. */
202 #undef GNULIB_TEST_VPRINTF
203
204 /* Define to a C preprocessor expression that evaluates to 1 or 0, depending
205 whether the gnulib module xalloc-die shall be considered present. */
206 #undef GNULIB_XALLOC_DIE
207
208 /* Define to 1 if you have 'alloca' after including <alloca.h>, a header that
209 may be supplied by this distribution. */
210 #undef HAVE_ALLOCA
211
212 /* Define to 1 if <alloca.h> works. */
213 #undef HAVE_ALLOCA_H
214
215 /* Define to 1 if you have the <crtdefs.h> header file. */
216 #undef HAVE_CRTDEFS_H
217
218 /* Define to 1 if bool, true and false work as per C2023. */
219 #undef HAVE_C_BOOL
220
221 /* Define to 1 if the static_assert keyword works. */
222 #undef HAVE_C_STATIC_ASSERT
223
224 /* Define to 1 if C supports variable-length arrays. */
225 #undef HAVE_C_VARARRAYS
226
227 /* Define to 1 if you have the declaration of 'ecvt', and to 0 if you don't.
228 */
229 #undef HAVE_DECL_ECVT
230
231 /* Define to 1 if you have the declaration of 'execvpe', and to 0 if you
232 don't. */
233 #undef HAVE_DECL_EXECVPE
234
235 /* Define to 1 if you have the declaration of 'fcloseall', and to 0 if you
236 don't. */
237 #undef HAVE_DECL_FCLOSEALL
238
239 /* Define to 1 if you have the declaration of 'fcvt', and to 0 if you don't.
240 */
241 #undef HAVE_DECL_FCVT
242
243 /* Define to 1 if you have the declaration of 'ftello', and to 0 if you don't.
244 */
245 #undef HAVE_DECL_FTELLO
246
247 /* Define to 1 if you have the declaration of 'gcvt', and to 0 if you don't.
248 */
249 #undef HAVE_DECL_GCVT
250
251 /* Define to 1 if you have the declaration of 'getdtablesize', and to 0 if you
252 don't. */
253 #undef HAVE_DECL_GETDTABLESIZE
254
255 /* Define to 1 if you have the declaration of 'getw', and to 0 if you don't.
256 */
257 #undef HAVE_DECL_GETW
258
259 /* Define to 1 if you have the declaration of 'program_invocation_name', and
260 to 0 if you don't. */
261 #undef HAVE_DECL_PROGRAM_INVOCATION_NAME
262
263 /* Define to 1 if you have the declaration of 'program_invocation_short_name',
264 and to 0 if you don't. */
265 #undef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
266
267 /* Define to 1 if you have the declaration of 'putw', and to 0 if you don't.
268 */
269 #undef HAVE_DECL_PUTW
270
271 /* Define to 1 if you have the declaration of 'strerror_r', and to 0 if you
272 don't. */
273 #undef HAVE_DECL_STRERROR_R
274
275 /* Define to 1 if you have the declaration of 'wcsdup', and to 0 if you don't.
276 */
277 #undef HAVE_DECL_WCSDUP
278
279 /* Define to 1 if you have the declaration of '__argv', and to 0 if you don't.
280 */
281 #undef HAVE_DECL___ARGV
282
283 /* Define to 1 if you have the `error' function. */
284 #undef HAVE_ERROR
285
286 /* Define to 1 if you have the <error.h> header file. */
287 #undef HAVE_ERROR_H
288
289 /* Define to 1 if you have the 'explicit_memset' function. */
290 #undef HAVE_EXPLICIT_MEMSET
291
292 /* Define to 1 if you have the 'fcntl' function. */
293 #undef HAVE_FCNTL
294
295 /* Define to 1 if you have the <features.h> header file. */
296 #undef HAVE_FEATURES_H
297
298 /* Define if the 'free' function is guaranteed to preserve errno. */
299 #undef HAVE_FREE_POSIX
300
301 /* Define to 1 if the system has the ftello function. */
302 #undef HAVE_FTELLO
303
304 /* Define to 1 if you have the 'getdtablesize' function. */
305 #undef HAVE_GETDTABLESIZE
306
307 /* Define to 1 if you have the 'getexecname' function. */
308 #undef HAVE_GETEXECNAME
309
310 /* Define to 1 if you have the <getopt.h> header file. */
311 #undef HAVE_GETOPT_H
312
313 /* Define to 1 if you have the 'getopt_long_only' function. */
314 #undef HAVE_GETOPT_LONG_ONLY
315
316 /* Define to 1 if you have the `getprogname' function. */
317 #undef HAVE_GETPROGNAME
318
319 /* Define to 1 if you have the <inttypes.h> header file. */
320 #undef HAVE_INTTYPES_H
321
322 /* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
323 #undef HAVE_LANGINFO_CODESET
324
325 /* Define to 1 if you have the <limits.h> header file. */
326 #undef HAVE_LIMITS_H
327
328 /* Define to 1 if the system has the type 'long long int'. */
329 #undef HAVE_LONG_LONG_INT
330
331 /* Define to 1 if you have the 'lstat' function. */
332 #undef HAVE_LSTAT
333
334 /* Define to 1 if malloc (0) returns nonnull. */
335 #undef HAVE_MALLOC_0_NONNULL
336
337 /* Define if malloc, realloc, and calloc set errno on allocation failure. */
338 #undef HAVE_MALLOC_POSIX
339
340 /* Define to 1 if malloc-like functions do not allocate objects larger than
341 PTRDIFF_MAX bytes. */
342 #undef HAVE_MALLOC_PTRDIFF
343
344 /* Define to 1 if you have the `memset_explicit' function. */
345 #undef HAVE_MEMSET_EXPLICIT
346
347 /* Define to 1 if you have the 'memset_s' function. */
348 #undef HAVE_MEMSET_S
349
350 /* Define to 1 if memset_s support zero-length operations. */
351 #undef HAVE_MEMSET_S_SUPPORTS_ZERO
352
353 /* Define to 1 if you have the <minix/config.h> header file. */
354 #undef HAVE_MINIX_CONFIG_H
355
356 /* Define to 1 on MSVC platforms that have the "invalid parameter handler"
357 concept. */
358 #undef HAVE_MSVC_INVALID_PARAMETER_HANDLER
359
360 /* Define to 1 if realloc (..., 0) returns nonnull. */
361 #undef HAVE_REALLOC_0_NONNULL
362
363 /* Define to 1 if you have the <sdkddkver.h> header file. */
364 #undef HAVE_SDKDDKVER_H
365
366 /* Define to 1 if you have the 'setdtablesize' function. */
367 #undef HAVE_SETDTABLESIZE
368
369 /* Define to 1 if 'sig_atomic_t' is a signed integer type. */
370 #undef HAVE_SIGNED_SIG_ATOMIC_T
371
372 /* Define to 1 if 'wchar_t' is a signed integer type. */
373 #undef HAVE_SIGNED_WCHAR_T
374
375 /* Define to 1 if 'wint_t' is a signed integer type. */
376 #undef HAVE_SIGNED_WINT_T
377
378 /* Define to 1 if you have the <stdbool.h> header file. */
379 #undef HAVE_STDBOOL_H
380
381 /* Define to 1 if you have the <stdckdint.h> header file. */
382 #undef HAVE_STDCKDINT_H
383
384 /* Define to 1 if you have the <stdint.h> header file. */
385 #undef HAVE_STDINT_H
386
387 /* Define to 1 if you have the <stdio.h> header file. */
388 #undef HAVE_STDIO_H
389
390 /* Define to 1 if you have the <stdlib.h> header file. */
391 #undef HAVE_STDLIB_H
392
393 /* Define if you have 'strerror_r'. */
394 #undef HAVE_STRERROR_R
395
396 /* Define to 1 if you have the <strings.h> header file. */
397 #undef HAVE_STRINGS_H
398
399 /* Define to 1 if you have the <string.h> header file. */
400 #undef HAVE_STRING_H
401
402 /* Define to 1 if 'st_atimensec' is a member of 'struct stat'. */
403 #undef HAVE_STRUCT_STAT_ST_ATIMENSEC
404
405 /* Define to 1 if 'st_atimespec.tv_nsec' is a member of 'struct stat'. */
406 #undef HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC
407
408 /* Define to 1 if 'st_atim.st__tim.tv_nsec' is a member of 'struct stat'. */
409 #undef HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC
410
411 /* Define to 1 if 'st_atim.tv_nsec' is a member of 'struct stat'. */
412 #undef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
413
414 /* Define to 1 if 'st_birthtimensec' is a member of 'struct stat'. */
415 #undef HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC
416
417 /* Define to 1 if 'st_birthtimespec.tv_nsec' is a member of 'struct stat'. */
418 #undef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
419
420 /* Define to 1 if 'st_birthtim.tv_nsec' is a member of 'struct stat'. */
421 #undef HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC
422
423 /* Define to 1 if you have the 'symlink' function. */
424 #undef HAVE_SYMLINK
425
426 /* Define to 1 if you have the <sys/bitypes.h> header file. */
427 #undef HAVE_SYS_BITYPES_H
428
429 /* Define to 1 if you have the <sys/inttypes.h> header file. */
430 #undef HAVE_SYS_INTTYPES_H
431
432 /* Define to 1 if you have the <sys/param.h> header file. */
433 #undef HAVE_SYS_PARAM_H
434
435 /* Define to 1 if you have the <sys/socket.h> header file. */
436 #undef HAVE_SYS_SOCKET_H
437
438 /* Define to 1 if you have the <sys/stat.h> header file. */
439 #undef HAVE_SYS_STAT_H
440
441 /* Define to 1 if you have the <sys/time.h> header file. */
442 #undef HAVE_SYS_TIME_H
443
444 /* Define to 1 if you have the <sys/types.h> header file. */
445 #undef HAVE_SYS_TYPES_H
446
447 /* Define to 1 if you have the <unistd.h> header file. */
448 #undef HAVE_UNISTD_H
449
450 /* Define to 1 if the system has the type 'unsigned long long int'. */
451 #undef HAVE_UNSIGNED_LONG_LONG_INT
452
453 /* Define if you have a global __progname variable */
454 #undef HAVE_VAR___PROGNAME
455
456 /* Define to 1 if you have the <wchar.h> header file. */
457 #undef HAVE_WCHAR_H
458
459 /* Define to 1 if <locale.h> defines the _locale_t type. */
460 #undef HAVE_WINDOWS_LOCALE_T
461
462 /* Define to 1 if you have the <winsock2.h> header file. */
463 #undef HAVE_WINSOCK2_H
464
465 /* Define if you have the 'wint_t' type. */
466 #undef HAVE_WINT_T
467
468 /* Define to 1 if O_NOATIME works. */
469 #undef HAVE_WORKING_O_NOATIME
470
471 /* Define to 1 if O_NOFOLLOW works. */
472 #undef HAVE_WORKING_O_NOFOLLOW
473
474 /* Define to 1 if you have the <xlocale.h> header file. */
475 #undef HAVE_XLOCALE_H
476
477 /* Define to 1 if you have the '_ftelli64' function. */
478 #undef HAVE__FTELLI64
479
480 /* Define to 1 if you have the '_set_invalid_parameter_handler' function. */
481 #undef HAVE__SET_INVALID_PARAMETER_HANDLER
482
483 /* Define to 1 if ctype.h defines __header_inline. */
484 #undef HAVE___HEADER_INLINE
485
486 /* Please see the Gnulib manual for how to use these macros.
487
488 Suppress extern inline with HP-UX cc, as it appears to be broken; see
489 <https://lists.gnu.org/r/bug-texinfo/2013-02/msg00030.html>.
490
491 Suppress extern inline with Sun C in standards-conformance mode, as it
492 mishandles inline functions that call each other. E.g., for 'inline void f
493 (void) { } inline void g (void) { f (); }', c99 incorrectly complains
494 'reference to static identifier "f" in extern inline function'.
495 This bug was observed with Oracle Developer Studio 12.6
496 (Sun C 5.15 SunOS_sparc 2017/05/30).
497
498 Suppress extern inline (with or without __attribute__ ((__gnu_inline__)))
499 on configurations that mistakenly use 'static inline' to implement
500 functions or macros in standard C headers like <ctype.h>. For example,
501 if isdigit is mistakenly implemented via a static inline function,
502 a program containing an extern inline function that calls isdigit
503 may not work since the C standard prohibits extern inline functions
504 from calling static functions (ISO C 99 section 6.7.4.(3).
505 This bug is known to occur on:
506
507 OS X 10.8 and earlier; see:
508 https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html
509
510 DragonFly; see
511 http://muscles.dragonflybsd.org/bulk/clang-master-potential/20141111_102002/logs/ah-tty-0.3.12.log
512
513 FreeBSD; see:
514 https://lists.gnu.org/r/bug-gnulib/2014-07/msg00104.html
515
516 OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and
517 for clang but remains for g++; see <https://trac.macports.org/ticket/41033>.
518 Assume DragonFly and FreeBSD will be similar.
519
520 GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
521 inline semantics, unless -fgnu89-inline is used. It defines a macro
522 __GNUC_STDC_INLINE__ to indicate this situation or a macro
523 __GNUC_GNU_INLINE__ to indicate the opposite situation.
524 GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline
525 semantics but warns, unless -fgnu89-inline is used:
526 warning: C99 inline functions are not supported; using GNU89
527 warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute
528 It defines a macro __GNUC_GNU_INLINE__ to indicate this situation.
529 */
530 #if (((defined __APPLE__ && defined __MACH__) \
531 || defined __DragonFly__ || defined __FreeBSD__) \
532 && (defined HAVE___HEADER_INLINE \
533 ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \
534 && ! defined __clang__) \
535 : ((! defined _DONT_USE_CTYPE_INLINE_ \
536 && (defined __GNUC__ || defined __cplusplus)) \
537 || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
538 && defined __GNUC__ && ! defined __cplusplus))))
539 # define _GL_EXTERN_INLINE_STDHEADER_BUG
540 #endif
541 #if ((__GNUC__ \
542 ? (defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
543 && !defined __PCC__) \
544 : (199901L <= __STDC_VERSION__ \
545 && !defined __HP_cc \
546 && !defined __PGI \
547 && !(defined __SUNPRO_C && __STDC__))) \
548 && !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
549 # define _GL_INLINE inline
550 # define _GL_EXTERN_INLINE extern inline
551 # define _GL_EXTERN_INLINE_IN_USE
552 #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \
553 && !defined __PCC__ \
554 && !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
555 # if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__
556 /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */
557 # define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
558 # else
559 # define _GL_INLINE extern inline
560 # endif
561 # define _GL_EXTERN_INLINE extern
562 # define _GL_EXTERN_INLINE_IN_USE
563 #else
564 # define _GL_INLINE _GL_UNUSED static
565 # define _GL_EXTERN_INLINE _GL_UNUSED static
566 #endif
567
568 /* In GCC 4.6 (inclusive) to 5.1 (exclusive),
569 suppress bogus "no previous prototype for 'FOO'"
570 and "no previous declaration for 'FOO'" diagnostics,
571 when FOO is an inline function in the header; see
572 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113> and
573 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877>. */
574 #if __GNUC__ == 4 && 6 <= __GNUC_MINOR__
575 # if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
576 # define _GL_INLINE_HEADER_CONST_PRAGMA
577 # else
578 # define _GL_INLINE_HEADER_CONST_PRAGMA \
579 _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
580 # endif
581 # define _GL_INLINE_HEADER_BEGIN \
582 _Pragma ("GCC diagnostic push") \
583 _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
584 _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \
585 _GL_INLINE_HEADER_CONST_PRAGMA
586 # define _GL_INLINE_HEADER_END \
587 _Pragma ("GCC diagnostic pop")
588 #else
589 # define _GL_INLINE_HEADER_BEGIN
590 # define _GL_INLINE_HEADER_END
591 #endif
592
593 /* Define to 1 if lseek does not detect pipes. */
594 #undef LSEEK_PIPE_BROKEN
595
596 /* Use GNU style printf and scanf. */
597 #ifndef __USE_MINGW_ANSI_STDIO
598 # undef __USE_MINGW_ANSI_STDIO
599 #endif
600
601
602 /* Define to 1 on musl libc. */
603 #undef MUSL_LIBC
604
605 /* Define to 1 if realloc should abort upon undefined behaviour. */
606 #undef NEED_SANITIZED_REALLOC
607
608 /* Define to 1 if open() fails to recognize a trailing slash. */
609 #undef OPEN_TRAILING_SLASH_BUG
610
611 /* Name of package */
612 #undef PACKAGE
613
614 /* Define to the address where bug reports for this package should be sent. */
615 #undef PACKAGE_BUGREPORT
616
617 /* Define to the full name of this package. */
618 #undef PACKAGE_NAME
619
620 /* Define to the full name and version of this package. */
621 #undef PACKAGE_STRING
622
623 /* Define to the one symbol short name of this package. */
624 #undef PACKAGE_TARNAME
625
626 /* Define to the home page for this package. */
627 #undef PACKAGE_URL
628
629 /* Define to the version of this package. */
630 #undef PACKAGE_VERSION
631
632 /* Define to the type that is the result of default argument promotions of
633 type mode_t. */
634 #undef PROMOTED_MODE_T
635
636 /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
637 'ptrdiff_t'. */
638 #undef PTRDIFF_T_SUFFIX
639
640 /* Define to 1 if stat needs help when passed a file name with a trailing
641 slash */
642 #undef REPLACE_FUNC_STAT_FILE
643
644 /* Define to 1 if strerror(0) does not return a message implying success. */
645 #undef REPLACE_STRERROR_0
646
647 /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
648 'sig_atomic_t'. */
649 #undef SIG_ATOMIC_T_SUFFIX
650
651 /* Define as the maximum value of type 'size_t', if the system doesn't define
652 it. */
653 #ifndef SIZE_MAX
654 # undef SIZE_MAX
655 #endif
656
657 /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
658 'size_t'. */
659 #undef SIZE_T_SUFFIX
660
661 /* If using the C implementation of alloca, define if you know the
662 direction of stack growth for your system; otherwise it will be
663 automatically deduced at runtime.
664 STACK_DIRECTION > 0 => grows toward higher addresses
665 STACK_DIRECTION < 0 => grows toward lower addresses
666 STACK_DIRECTION = 0 => direction of growth unknown */
667 #undef STACK_DIRECTION
668
669 /* Define to 1 if the 'S_IS*' macros in <sys/stat.h> do not work properly. */
670 #undef STAT_MACROS_BROKEN
671
672 /* Define to 1 if all of the C89 standard headers exist (not just the ones
673 required in a freestanding environment). This macro is provided for
674 backward compatibility; new code need not use it. */
675 #undef STDC_HEADERS
676
677 /* Define to 1 if strerror_r returns char *. */
678 #undef STRERROR_R_CHAR_P
679
680 /* Define to 1 if the type of the st_atim member of a struct stat is struct
681 timespec. */
682 #undef TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC
683
684 /* Define to enable the declarations of ISO C 23 Annex K types and functions. */
685 #if !(defined __STDC_WANT_LIB_EXT1__ && __STDC_WANT_LIB_EXT1__)
686 #undef/**/__STDC_WANT_LIB_EXT1__
687 #define __STDC_WANT_LIB_EXT1__ 1
688 #endif
689
690
691 /* Enable extensions on AIX, Interix, z/OS. */
692 #ifndef _ALL_SOURCE
693 # undef _ALL_SOURCE
694 #endif
695 /* Enable general extensions on macOS. */
696 #ifndef _DARWIN_C_SOURCE
697 # undef _DARWIN_C_SOURCE
698 #endif
699 /* Enable general extensions on Solaris. */
700 #ifndef __EXTENSIONS__
701 # undef __EXTENSIONS__
702 #endif
703 /* Enable GNU extensions on systems that have them. */
704 #ifndef _GNU_SOURCE
705 # undef _GNU_SOURCE
706 #endif
707 /* Enable X/Open compliant socket functions that do not require linking
708 with -lxnet on HP-UX 11.11. */
709 #ifndef _HPUX_ALT_XOPEN_SOCKET_API
710 # undef _HPUX_ALT_XOPEN_SOCKET_API
711 #endif
712 /* Identify the host operating system as Minix.
713 This macro does not affect the system headers' behavior.
714 A future release of Autoconf may stop defining this macro. */
715 #ifndef _MINIX
716 # undef _MINIX
717 #endif
718 /* Enable general extensions on NetBSD.
719 Enable NetBSD compatibility extensions on Minix. */
720 #ifndef _NETBSD_SOURCE
721 # undef _NETBSD_SOURCE
722 #endif
723 /* Enable OpenBSD compatibility extensions on NetBSD.
724 Oddly enough, this does nothing on OpenBSD. */
725 #ifndef _OPENBSD_SOURCE
726 # undef _OPENBSD_SOURCE
727 #endif
728 /* Define to 1 if needed for POSIX-compatible behavior. */
729 #ifndef _POSIX_SOURCE
730 # undef _POSIX_SOURCE
731 #endif
732 /* Define to 2 if needed for POSIX-compatible behavior. */
733 #ifndef _POSIX_1_SOURCE
734 # undef _POSIX_1_SOURCE
735 #endif
736 /* Enable POSIX-compatible threading on Solaris. */
737 #ifndef _POSIX_PTHREAD_SEMANTICS
738 # undef _POSIX_PTHREAD_SEMANTICS
739 #endif
740 /* Enable extensions specified by ISO/IEC TS 18661-5:2014. */
741 #ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
742 # undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
743 #endif
744 /* Enable extensions specified by ISO/IEC TS 18661-1:2014. */
745 #ifndef __STDC_WANT_IEC_60559_BFP_EXT__
746 # undef __STDC_WANT_IEC_60559_BFP_EXT__
747 #endif
748 /* Enable extensions specified by ISO/IEC TS 18661-2:2015. */
749 #ifndef __STDC_WANT_IEC_60559_DFP_EXT__
750 # undef __STDC_WANT_IEC_60559_DFP_EXT__
751 #endif
752 /* Enable extensions specified by C23 Annex F. */
753 #ifndef __STDC_WANT_IEC_60559_EXT__
754 # undef __STDC_WANT_IEC_60559_EXT__
755 #endif
756 /* Enable extensions specified by ISO/IEC TS 18661-4:2015. */
757 #ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
758 # undef __STDC_WANT_IEC_60559_FUNCS_EXT__
759 #endif
760 /* Enable extensions specified by C23 Annex H and ISO/IEC TS 18661-3:2015. */
761 #ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
762 # undef __STDC_WANT_IEC_60559_TYPES_EXT__
763 #endif
764 /* Enable extensions specified by ISO/IEC TR 24731-2:2010. */
765 #ifndef __STDC_WANT_LIB_EXT2__
766 # undef __STDC_WANT_LIB_EXT2__
767 #endif
768 /* Enable extensions specified by ISO/IEC 24747:2009. */
769 #ifndef __STDC_WANT_MATH_SPEC_FUNCS__
770 # undef __STDC_WANT_MATH_SPEC_FUNCS__
771 #endif
772 /* Enable extensions on HP NonStop. */
773 #ifndef _TANDEM_SOURCE
774 # undef _TANDEM_SOURCE
775 #endif
776 /* Enable X/Open extensions. Define to 500 only if necessary
777 to make mbstate_t available. */
778 #ifndef _XOPEN_SOURCE
779 # undef _XOPEN_SOURCE
780 #endif
781
782
783 /* Version number of package */
784 #undef VERSION
785
786 /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
787 'wchar_t'. */
788 #undef WCHAR_T_SUFFIX
789
790 /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
791 'wint_t'. */
792 #undef WINT_T_SUFFIX
793
794 /* Number of bits in a file offset, on hosts where this is settable. */
795 #undef _FILE_OFFSET_BITS
796
797 /* True if the compiler says it groks GNU C version MAJOR.MINOR.
798 Except that
799 - clang groks GNU C 4.2, even on Windows, where it does not define
800 __GNUC__.
801 - The OpenMandriva-modified clang compiler pretends that it groks
802 GNU C version 13.1, but it doesn't: It does not support
803 __attribute__ ((__malloc__ (f, i))), nor does it support
804 __attribute__ ((__warning__ (message))) on a function redeclaration.
805 - Users can make clang lie as well, through the -fgnuc-version option. */
806 #if defined __GNUC__ && defined __GNUC_MINOR__ && !defined __clang__
807 # define _GL_GNUC_PREREQ(major, minor) \
808 ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__))
809 #elif defined __clang__
810 /* clang really only groks GNU C 4.2. */
811 # define _GL_GNUC_PREREQ(major, minor) \
812 ((major) < 4 + ((minor) <= 2))
813 #else
814 # define _GL_GNUC_PREREQ(major, minor) 0
815 #endif
816
817
818 /* Define to enable the declarations of ISO C 11 types and functions. */
819 #undef _ISOC11_SOURCE
820
821 /* Define to 1 on platforms where this makes off_t a 64-bit type. */
822 #undef _LARGE_FILES
823
824 /* Define to 1 on Solaris. */
825 #undef _LCONV_C99
826
827 /* Define so that AIX headers are more compatible with GNU/Linux. */
828 #undef _LINUX_SOURCE_COMPAT
829
830 /* The _Noreturn keyword of C11. */
831 #ifndef _Noreturn
832 # if (defined __cplusplus \
833 && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
834 || (defined _MSC_VER && 1900 <= _MSC_VER)) \
835 && 0)
836 /* [[noreturn]] is not practically usable, because with it the syntax
837 extern _Noreturn void func (...);
838 would not be valid; such a declaration would only be valid with 'extern'
839 and '_Noreturn' swapped, or without the 'extern' keyword. However, some
840 AIX system header files and several gnulib header files use precisely
841 this syntax with 'extern'. */
842 # define _Noreturn [[noreturn]]
843 # elif (defined __clang__ && __clang_major__ < 16 \
844 && defined _GL_WORK_AROUND_LLVM_BUG_59792)
845 /* Compile with -D_GL_WORK_AROUND_LLVM_BUG_59792 to work around
846 that rare LLVM bug, though you may get many false-alarm warnings. */
847 # define _Noreturn
848 # elif ((!defined __cplusplus || defined __clang__) \
849 && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
850 || (!defined __STRICT_ANSI__ \
851 && (_GL_GNUC_PREREQ (4, 7) \
852 || (defined __apple_build_version__ \
853 ? 6000000 <= __apple_build_version__ \
854 : 3 < __clang_major__ + (5 <= __clang_minor__))))))
855 /* _Noreturn works as-is. */
856 # elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C
857 # define _Noreturn __attribute__ ((__noreturn__))
858 # elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
859 # define _Noreturn __declspec (noreturn)
860 # else
861 # define _Noreturn
862 # endif
863 #endif
864
865
866 /* Number of bits in time_t, on hosts where this is settable. */
867 #undef _TIME_BITS
868
869 /* For standard stat data types on VMS. */
870 #undef _USE_STD_STAT
871
872 /* Define to rpl_ if the getopt replacement functions and variables should be
873 used. */
874 #undef __GETOPT_PREFIX
875
876 /* Define to 1 on platforms where this makes time_t a 64-bit type. */
877 #undef __MINGW_USE_VC2005_COMPAT
878
879 /* Define to 1 if the system <stdint.h> predates C++11. */
880 #undef __STDC_CONSTANT_MACROS
881
882 /* Define to 1 if the system <stdint.h> predates C++11. */
883 #undef __STDC_LIMIT_MACROS
884
885 /* Define to 1 if C does not support variable-length arrays, and if the
886 compiler does not already define this. */
887 #undef __STDC_NO_VLA__
888
889 /* The _GL_ASYNC_SAFE marker should be attached to functions that are
890 signal handlers (for signals other than SIGABRT, SIGPIPE) or can be
891 invoked from such signal handlers. Such functions have some restrictions:
892 * All functions that it calls should be marked _GL_ASYNC_SAFE as well,
893 or should be listed as async-signal-safe in POSIX
894 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04>
895 section 2.4.3. Note that malloc(), sprintf(), and fwrite(), in
896 particular, are NOT async-signal-safe.
897 * All memory locations (variables and struct fields) that these functions
898 access must be marked 'volatile'. This holds for both read and write
899 accesses. Otherwise the compiler might optimize away stores to and
900 reads from such locations that occur in the program, depending on its
901 data flow analysis. For example, when the program contains a loop
902 that is intended to inspect a variable set from within a signal handler
903 while (!signal_occurred)
904 ;
905 the compiler is allowed to transform this into an endless loop if the
906 variable 'signal_occurred' is not declared 'volatile'.
907 Additionally, recall that:
908 * A signal handler should not modify errno (except if it is a handler
909 for a fatal signal and ends by raising the same signal again, thus
910 provoking the termination of the process). If it invokes a function
911 that may clobber errno, it needs to save and restore the value of
912 errno. */
913 #define _GL_ASYNC_SAFE
914
915
916 /* Attributes. */
917 /* Define _GL_HAS_ATTRIBUTE only once, because on FreeBSD, with gcc < 5, if
918 <config.h> gets included once again after <sys/cdefs.h>, __has_attribute(x)
919 expands to 0 always, and redefining _GL_HAS_ATTRIBUTE would turn off all
920 attributes. */
921 #ifndef _GL_HAS_ATTRIBUTE
922 # if (defined __has_attribute \
923 && (!defined __clang_minor__ \
924 || (defined __apple_build_version__ \
925 ? 7000000 <= __apple_build_version__ \
926 : 5 <= __clang_major__)))
927 # define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__)
928 # else
929 # define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr
930 # define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3)
931 # define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2)
932 # define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3)
933 # define _GL_ATTR_cold _GL_GNUC_PREREQ (4, 3)
934 # define _GL_ATTR_const _GL_GNUC_PREREQ (2, 95)
935 # define _GL_ATTR_deprecated _GL_GNUC_PREREQ (3, 1)
936 # define _GL_ATTR_diagnose_if 0
937 # define _GL_ATTR_error _GL_GNUC_PREREQ (4, 3)
938 # define _GL_ATTR_externally_visible _GL_GNUC_PREREQ (4, 1)
939 # define _GL_ATTR_fallthrough _GL_GNUC_PREREQ (7, 0)
940 # define _GL_ATTR_format _GL_GNUC_PREREQ (2, 7)
941 # define _GL_ATTR_leaf _GL_GNUC_PREREQ (4, 6)
942 # define _GL_ATTR_malloc _GL_GNUC_PREREQ (3, 0)
943 # ifdef _ICC
944 # define _GL_ATTR_may_alias 0
945 # else
946 # define _GL_ATTR_may_alias _GL_GNUC_PREREQ (3, 3)
947 # endif
948 # define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1)
949 # define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3)
950 # define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0)
951 # define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3)
952 # define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7)
953 # define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96)
954 # define _GL_ATTR_reproducible 0 /* not yet supported, as of GCC 14 */
955 # define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9)
956 # define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0)
957 # define _GL_ATTR_unsequenced 0 /* not yet supported, as of GCC 14 */
958 # define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7)
959 # define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4)
960 # endif
961 #endif
962
963 /* Use __has_c_attribute if available. However, do not use with
964 pre-C23 GCC, which can issue false positives if -Wpedantic. */
965 #if (defined __has_c_attribute \
966 && ! (_GL_GNUC_PREREQ (4, 6) \
967 && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) <= 201710))
968 # define _GL_HAVE___HAS_C_ATTRIBUTE 1
969 #else
970 # define _GL_HAVE___HAS_C_ATTRIBUTE 0
971 #endif
972
973 /* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...))
974 syntax, in function declarations. There are two problems here.
975 (Last tested with gcc/g++ 14 and clang/clang++ 18.)
976
977 1) We want that the _GL_ATTRIBUTE_* can be cumulated on the same declaration
978 in any order.
979 =========================== foo.c = foo.cc ===========================
980 __attribute__ ((__deprecated__)) [[__nodiscard__]] int bar1 (int);
981 [[__nodiscard__]] __attribute__ ((__deprecated__)) int bar2 (int);
982 ======================================================================
983 This gives a syntax error
984 - in C mode with gcc
985 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108796>, and
986 - in C++ mode with clang++ version < 16, and
987 - in C++ mode, inside extern "C" {}, still in newer clang++ versions
988 <https://github.com/llvm/llvm-project/issues/101990>.
989 */
990 /* Define if, in a function declaration, the attributes in bracket syntax
991 [[...]] must come before the attributes in __attribute__((...)) syntax.
992 If this is defined, it is best to avoid the bracket syntax, so that the
993 various _GL_ATTRIBUTE_* can be cumulated on the same declaration in any
994 order. */
995 #ifdef __cplusplus
996 # if defined __clang__
997 # define _GL_BRACKET_BEFORE_ATTRIBUTE 1
998 # endif
999 #else
1000 # if defined __GNUC__ && !defined __clang__
1001 # define _GL_BRACKET_BEFORE_ATTRIBUTE 1
1002 # endif
1003 #endif
1004 /*
1005 2) We want that the _GL_ATTRIBUTE_* can be placed in a declaration
1006 - without 'extern', in C as well as in C++,
1007 - with 'extern', in C,
1008 - with 'extern "C"', in C++
1009 in the same position. That is, we don't want to be forced to use a
1010 macro which arranges for the attribute to come before 'extern' in
1011 one case and after 'extern' in the other case, because such a macro
1012 would make the source code of .h files pretty ugly.
1013 =========================== foo.c = foo.cc ===========================
1014 #ifdef __cplusplus
1015 # define CC "C"
1016 #else
1017 # define CC
1018 #endif
1019
1020 #define ND [[__nodiscard__]]
1021 #define WUR __attribute__((__warn_unused_result__))
1022
1023 #ifdef __cplusplus
1024 extern "C" {
1025 #endif
1026 // gcc clang g++ clang++
1027
1028 ND int foo (int);
1029 int ND foo (int); // warn error warn error
1030 int foo ND (int);
1031 int foo (int) ND; // warn error warn error
1032
1033 WUR int foo (int);
1034 int WUR foo (int);
1035 int fo1 WUR (int); // error error error error
1036 int foo (int) WUR;
1037
1038 #ifdef __cplusplus
1039 }
1040 #endif
1041
1042 // gcc clang g++ clang++
1043
1044 ND extern CC int foo (int); // error error
1045 extern CC ND int foo (int); // error error
1046 extern CC int ND foo (int); // warn error warn error
1047 extern CC int foo ND (int);
1048 extern CC int foo (int) ND; // warn error warn error
1049
1050 WUR extern CC int foo (int); // warn
1051 extern CC WUR int foo (int);
1052 extern CC int WUR foo (int);
1053 extern CC int foo WUR (int); // error error error error
1054 extern CC int foo (int) WUR;
1055
1056 ND EXTERN_C_FUNC int foo (int); // error error
1057 EXTERN_C_FUNC ND int foo (int);
1058 EXTERN_C_FUNC int ND foo (int); // warn error warn error
1059 EXTERN_C_FUNC int foo ND (int);
1060 EXTERN_C_FUNC int foo (int) ND; // warn error warn error
1061
1062 WUR EXTERN_C_FUNC int foo (int); // warn
1063 EXTERN_C_FUNC WUR int foo (int);
1064 EXTERN_C_FUNC int WUR foo (int);
1065 EXTERN_C_FUNC int fo2 WUR (int); // error error error error
1066 EXTERN_C_FUNC int foo (int) WUR;
1067 ======================================================================
1068 So, if we insist on using the 'extern' keyword ('extern CC' idiom):
1069 * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]]
1070 in both C and C++, there is one available position:
1071 - between the function name and the parameter list.
1072 * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax
1073 in both C and C++, there are several available positions:
1074 - before the return type,
1075 - between return type and function name,
1076 - at the end of the declaration.
1077 * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] in C and to
1078 __attribute__((...)) syntax in C++, there is no available position:
1079 it would need to come before 'extern' in C but after 'extern "C"'
1080 in C++.
1081 * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax in C and
1082 to bracket syntax [[...]] in C++, there is one available position:
1083 - before the return type.
1084 Whereas, if we use the 'EXTERN_C_FUNC' idiom, which conditionally
1085 omits the 'extern' keyword:
1086 * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]]
1087 in both C and C++, there are two available positions:
1088 - before the return type,
1089 - between the function name and the parameter list.
1090 * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax
1091 in both C and C++, there are several available positions:
1092 - before the return type,
1093 - between return type and function name,
1094 - at the end of the declaration.
1095 * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] in C and to
1096 __attribute__((...)) syntax in C++, there is one available position:
1097 - before the return type.
1098 * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax in C and
1099 to bracket syntax [[...]] in C++, there is one available position:
1100 - before the return type.
1101 The best choice is therefore to use the 'EXTERN_C_FUNC' idiom and
1102 put the attributes before the return type. This works regardless
1103 to what the _GL_ATTRIBUTE_* macros expand.
1104 */
1105
1106 /* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...))
1107 syntax, in static/inline function definitions.
1108
1109 There are similar constraints as for function declarations. However, here,
1110 we cannot omit the storage-class specifier. Therefore, the following rule
1111 applies:
1112 * The macros
1113 _GL_ATTRIBUTE_CONST
1114 _GL_ATTRIBUTE_DEPRECATED
1115 _GL_ATTRIBUTE_MAYBE_UNUSED
1116 _GL_ATTRIBUTE_NODISCARD
1117 _GL_ATTRIBUTE_PURE
1118 _GL_ATTRIBUTE_REPRODUCIBLE
1119 _GL_ATTRIBUTE_UNSEQUENCED
1120 which may expand to bracket syntax [[...]], must come first, before the
1121 storage-class specifier.
1122 * Other _GL_ATTRIBUTE_* macros, that expand to __attribute__((...)) syntax,
1123 are better placed between the storage-class specifier and the return
1124 type.
1125 */
1126
1127 /* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...))
1128 syntax, in variable declarations.
1129
1130 At which position can they be placed?
1131 (Last tested with gcc/g++ 14 and clang/clang++ 18.)
1132
1133 =========================== foo.c = foo.cc ===========================
1134 #ifdef __cplusplus
1135 # define CC "C"
1136 #else
1137 # define CC
1138 #endif
1139
1140 #define BD [[__deprecated__]]
1141 #define AD __attribute__ ((__deprecated__))
1142
1143 // gcc clang g++ clang++
1144
1145 BD extern CC int var; // error error
1146 extern CC BD int var; // error error
1147 extern CC int BD var; // warn error warn error
1148 extern CC int var BD;
1149
1150 AD extern CC int var; // warn
1151 extern CC AD int var;
1152 extern CC int AD var;
1153 extern CC int var AD;
1154
1155 BD extern CC int z[]; // error error
1156 extern CC BD int z[]; // error error
1157 extern CC int BD z[]; // warn error warn error
1158 extern CC int z1 BD [];
1159 extern CC int z[] BD; // warn error error
1160
1161 AD extern CC int z[]; // warn
1162 extern CC AD int z[];
1163 extern CC int AD z[];
1164 extern CC int z2 AD []; // error error error error
1165 extern CC int z[] AD;
1166 ======================================================================
1167
1168 * For non-array variables, the only good position is after the variable name,
1169 that is, at the end of the declaration.
1170 * For array variables, you will need to distinguish C and C++:
1171 - In C, before the 'extern' keyword.
1172 - In C++, between the 'extern "C"' and the variable's type.
1173 */
1174
1175 /* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function
1176 is the size of the returned memory block.
1177 _GL_ATTRIBUTE_ALLOC_SIZE ((M, N)) declares that the Mth argument multiplied
1178 by the Nth argument of the function is the size of the returned memory block.
1179 */
1180 /* Applies to: functions, pointer to functions, function types. */
1181 #ifndef _GL_ATTRIBUTE_ALLOC_SIZE
1182 # if _GL_HAS_ATTRIBUTE (alloc_size)
1183 # define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args))
1184 # else
1185 # define _GL_ATTRIBUTE_ALLOC_SIZE(args)
1186 # endif
1187 #endif
1188
1189 /* _GL_ATTRIBUTE_ALWAYS_INLINE tells that the compiler should always inline the
1190 function and report an error if it cannot do so. */
1191 /* Applies to: functions. */
1192 #ifndef _GL_ATTRIBUTE_ALWAYS_INLINE
1193 # if _GL_HAS_ATTRIBUTE (always_inline)
1194 # define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__))
1195 # else
1196 # define _GL_ATTRIBUTE_ALWAYS_INLINE
1197 # endif
1198 #endif
1199
1200 /* _GL_ATTRIBUTE_ARTIFICIAL declares that the function is not important to show
1201 in stack traces when debugging. The compiler should omit the function from
1202 stack traces. */
1203 /* Applies to: functions. */
1204 #ifndef _GL_ATTRIBUTE_ARTIFICIAL
1205 # if _GL_HAS_ATTRIBUTE (artificial)
1206 # define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__))
1207 # else
1208 # define _GL_ATTRIBUTE_ARTIFICIAL
1209 # endif
1210 #endif
1211
1212 /* _GL_ATTRIBUTE_COLD declares that the function is rarely executed. */
1213 /* Applies to: functions. */
1214 /* Avoid __attribute__ ((cold)) on MinGW; see thread starting at
1215 <https://lists.gnu.org/r/emacs-devel/2019-04/msg01152.html>.
1216 Also, Oracle Studio 12.6 requires 'cold' not '__cold__'. */
1217 #ifndef _GL_ATTRIBUTE_COLD
1218 # if _GL_HAS_ATTRIBUTE (cold) && !defined __MINGW32__
1219 # ifndef __SUNPRO_C
1220 # define _GL_ATTRIBUTE_COLD __attribute__ ((__cold__))
1221 # else
1222 # define _GL_ATTRIBUTE_COLD __attribute__ ((cold))
1223 # endif
1224 # else
1225 # define _GL_ATTRIBUTE_COLD
1226 # endif
1227 #endif
1228
1229 /* _GL_ATTRIBUTE_CONST declares:
1230 It is OK for a compiler to move calls to the function and to omit
1231 calls to the function if another call has the same arguments or the
1232 result is not used.
1233 This attribute is safe for a function that neither depends on
1234 nor affects state, and always returns exactly once -
1235 e.g., does not raise an exception, call longjmp, or loop forever.
1236 (This attribute is stricter than _GL_ATTRIBUTE_PURE because the
1237 function cannot observe state. It is stricter than
1238 _GL_ATTRIBUTE_UNSEQUENCED because the function must return exactly
1239 once and cannot depend on state addressed by its arguments.) */
1240 /* Applies to: functions. */
1241 #ifndef _GL_ATTRIBUTE_CONST
1242 # if _GL_HAS_ATTRIBUTE (const)
1243 # define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
1244 # else
1245 # define _GL_ATTRIBUTE_CONST _GL_ATTRIBUTE_UNSEQUENCED
1246 # endif
1247 #endif
1248
1249 /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
1250 that can be freed by passing them as the Ith argument to the
1251 function F.
1252 _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
1253 can be freed via 'free'; it can be used only after declaring 'free'. */
1254 /* Applies to: functions. Cannot be used on inline functions. */
1255 #ifndef _GL_ATTRIBUTE_DEALLOC
1256 # if _GL_GNUC_PREREQ (11, 0)
1257 # define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
1258 # else
1259 # define _GL_ATTRIBUTE_DEALLOC(f, i)
1260 # endif
1261 #endif
1262 /* If gnulib's <string.h> or <wchar.h> has already defined this macro, continue
1263 to use this earlier definition, since <stdlib.h> may not have been included
1264 yet. */
1265 #ifndef _GL_ATTRIBUTE_DEALLOC_FREE
1266 # if defined __cplusplus && defined __GNUC__ && !defined __clang__
1267 /* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231> */
1268 # define _GL_ATTRIBUTE_DEALLOC_FREE \
1269 _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1)
1270 # else
1271 # define _GL_ATTRIBUTE_DEALLOC_FREE \
1272 _GL_ATTRIBUTE_DEALLOC (free, 1)
1273 # endif
1274 #endif
1275
1276 /* _GL_ATTRIBUTE_DEPRECATED: Declares that an entity is deprecated.
1277 The compiler may warn if the entity is used. */
1278 /* Applies to:
1279 - function, variable,
1280 - struct, union, struct/union member,
1281 - enumeration, enumeration item,
1282 - typedef,
1283 in C++ also: namespace, class, template specialization. */
1284 #ifndef _GL_ATTRIBUTE_DEPRECATED
1285 # ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
1286 # if _GL_HAVE___HAS_C_ATTRIBUTE
1287 # if __has_c_attribute (__deprecated__)
1288 # define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]]
1289 # endif
1290 # endif
1291 # endif
1292 # if !defined _GL_ATTRIBUTE_DEPRECATED && _GL_HAS_ATTRIBUTE (deprecated)
1293 # define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__))
1294 # endif
1295 # ifndef _GL_ATTRIBUTE_DEPRECATED
1296 # define _GL_ATTRIBUTE_DEPRECATED
1297 # endif
1298 #endif
1299
1300 /* _GL_ATTRIBUTE_ERROR(msg) requests an error if a function is called and
1301 the function call is not optimized away.
1302 _GL_ATTRIBUTE_WARNING(msg) requests a warning if a function is called and
1303 the function call is not optimized away. */
1304 /* Applies to: functions. */
1305 #if !(defined _GL_ATTRIBUTE_ERROR && defined _GL_ATTRIBUTE_WARNING)
1306 # if _GL_HAS_ATTRIBUTE (error)
1307 # define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg)))
1308 # define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg)))
1309 # elif _GL_HAS_ATTRIBUTE (diagnose_if)
1310 # define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__diagnose_if__ (1, msg, "error")))
1311 # define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__diagnose_if__ (1, msg, "warning")))
1312 # else
1313 # define _GL_ATTRIBUTE_ERROR(msg)
1314 # define _GL_ATTRIBUTE_WARNING(msg)
1315 # endif
1316 #endif
1317
1318 /* _GL_ATTRIBUTE_EXTERNALLY_VISIBLE declares that the entity should remain
1319 visible to debuggers etc., even with '-fwhole-program'. */
1320 /* Applies to: functions, variables. */
1321 #ifndef _GL_ATTRIBUTE_EXTERNALLY_VISIBLE
1322 # if _GL_HAS_ATTRIBUTE (externally_visible)
1323 # define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((externally_visible))
1324 # else
1325 # define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE
1326 # endif
1327 #endif
1328
1329 /* _GL_ATTRIBUTE_FALLTHROUGH declares that it is not a programming mistake if
1330 the control flow falls through to the immediately following 'case' or
1331 'default' label. The compiler should not warn in this case. */
1332 /* Applies to: Empty statement (;), inside a 'switch' statement. */
1333 /* Always expands to something. */
1334 #ifndef _GL_ATTRIBUTE_FALLTHROUGH
1335 # if _GL_HAVE___HAS_C_ATTRIBUTE
1336 # if __has_c_attribute (__fallthrough__)
1337 # define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]]
1338 # endif
1339 # endif
1340 # if !defined _GL_ATTRIBUTE_FALLTHROUGH && _GL_HAS_ATTRIBUTE (fallthrough)
1341 # define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__))
1342 # endif
1343 # ifndef _GL_ATTRIBUTE_FALLTHROUGH
1344 # define _GL_ATTRIBUTE_FALLTHROUGH ((void) 0)
1345 # endif
1346 #endif
1347
1348 /* _GL_ATTRIBUTE_FORMAT ((ARCHETYPE, STRING-INDEX, FIRST-TO-CHECK))
1349 declares that the STRING-INDEXth function argument is a format string of
1350 style ARCHETYPE, which is one of:
1351 printf, gnu_printf
1352 scanf, gnu_scanf,
1353 strftime, gnu_strftime,
1354 strfmon,
1355 or the same thing prefixed and suffixed with '__'.
1356 If FIRST-TO-CHECK is not 0, arguments starting at FIRST-TO_CHECK
1357 are suitable for the format string. */
1358 /* Applies to: functions. */
1359 #ifndef _GL_ATTRIBUTE_FORMAT
1360 # if _GL_HAS_ATTRIBUTE (format)
1361 # define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
1362 # else
1363 # define _GL_ATTRIBUTE_FORMAT(spec)
1364 # endif
1365 #endif
1366
1367 /* _GL_ATTRIBUTE_LEAF declares that if the function is called from some other
1368 compilation unit, it executes code from that unit only by return or by
1369 exception handling. This declaration lets the compiler optimize that unit
1370 more aggressively. */
1371 /* Applies to: functions. */
1372 #ifndef _GL_ATTRIBUTE_LEAF
1373 # if _GL_HAS_ATTRIBUTE (leaf)
1374 # define _GL_ATTRIBUTE_LEAF __attribute__ ((__leaf__))
1375 # else
1376 # define _GL_ATTRIBUTE_LEAF
1377 # endif
1378 #endif
1379
1380 /* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
1381 allocated memory. */
1382 /* Applies to: functions. */
1383 #ifndef _GL_ATTRIBUTE_MALLOC
1384 # if _GL_HAS_ATTRIBUTE (malloc)
1385 # define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
1386 # else
1387 # define _GL_ATTRIBUTE_MALLOC
1388 # endif
1389 #endif
1390
1391 /* _GL_ATTRIBUTE_MAY_ALIAS declares that pointers to the type may point to the
1392 same storage as pointers to other types. Thus this declaration disables
1393 strict aliasing optimization. */
1394 /* Applies to: types. */
1395 /* Oracle Studio 12.6 mishandles may_alias despite __has_attribute OK. */
1396 #ifndef _GL_ATTRIBUTE_MAY_ALIAS
1397 # if _GL_HAS_ATTRIBUTE (may_alias) && !defined __SUNPRO_C
1398 # define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__))
1399 # else
1400 # define _GL_ATTRIBUTE_MAY_ALIAS
1401 # endif
1402 #endif
1403
1404 /* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if
1405 the entity is not used. The compiler should not warn if the entity is not
1406 used. */
1407 /* Applies to:
1408 - function, variable,
1409 - struct, union, struct/union member,
1410 - enumeration, enumeration item,
1411 - typedef,
1412 in C++ also: class. */
1413 /* In C++ and C23, this is spelled [[__maybe_unused__]].
1414 GCC's syntax is __attribute__ ((__unused__)).
1415 clang supports both syntaxes. Except that with clang ≥ 6, < 10, in C++ mode,
1416 __has_c_attribute (__maybe_unused__) yields true but the use of
1417 [[__maybe_unused__]] nevertheless produces a warning. */
1418 #ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
1419 # ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
1420 # if defined __clang__ && defined __cplusplus
1421 # if !defined __apple_build_version__ && __clang_major__ >= 10
1422 # define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
1423 # endif
1424 # elif _GL_HAVE___HAS_C_ATTRIBUTE
1425 # if __has_c_attribute (__maybe_unused__)
1426 # define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
1427 # endif
1428 # endif
1429 # endif
1430 # ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
1431 # define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED
1432 # endif
1433 #endif
1434 /* Alternative spelling of this macro, for convenience and for
1435 compatibility with glibc/include/libc-symbols.h. */
1436 #define _GL_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED
1437 /* Earlier spellings of this macro. */
1438 #define _UNUSED_PARAMETER_ _GL_ATTRIBUTE_MAYBE_UNUSED
1439
1440 /* _GL_ATTRIBUTE_NODISCARD declares that the caller of the function should not
1441 discard the return value. The compiler may warn if the caller does not use
1442 the return value, unless the caller uses something like ignore_value. */
1443 /* Applies to: function, enumeration, class. */
1444 #ifndef _GL_ATTRIBUTE_NODISCARD
1445 # ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
1446 # if defined __clang__ && defined __cplusplus
1447 /* With clang up to 15.0.6 (at least), in C++ mode, [[__nodiscard__]] produces
1448 a warning.
1449 The 1000 below means a yet unknown threshold. When clang++ version X
1450 starts supporting [[__nodiscard__]] without warning about it, you can
1451 replace the 1000 with X. */
1452 # if __clang_major__ >= 1000
1453 # define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]]
1454 # endif
1455 # elif _GL_HAVE___HAS_C_ATTRIBUTE
1456 # if __has_c_attribute (__nodiscard__)
1457 # define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]]
1458 # endif
1459 # endif
1460 # endif
1461 # if !defined _GL_ATTRIBUTE_NODISCARD && _GL_HAS_ATTRIBUTE (warn_unused_result)
1462 # define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__))
1463 # endif
1464 # ifndef _GL_ATTRIBUTE_NODISCARD
1465 # define _GL_ATTRIBUTE_NODISCARD
1466 # endif
1467 #endif
1468
1469 /* _GL_ATTRIBUTE_NOINLINE tells that the compiler should not inline the
1470 function. */
1471 /* Applies to: functions. */
1472 #ifndef _GL_ATTRIBUTE_NOINLINE
1473 # if _GL_HAS_ATTRIBUTE (noinline)
1474 # define _GL_ATTRIBUTE_NOINLINE __attribute__ ((__noinline__))
1475 # else
1476 # define _GL_ATTRIBUTE_NOINLINE
1477 # endif
1478 #endif
1479
1480 /* _GL_ATTRIBUTE_NONNULL ((N1, N2,...)) declares that the arguments N1, N2,...
1481 must not be NULL.
1482 _GL_ATTRIBUTE_NONNULL () declares that all pointer arguments must not be
1483 null. */
1484 /* Applies to: functions. */
1485 #ifndef _GL_ATTRIBUTE_NONNULL
1486 # if _GL_HAS_ATTRIBUTE (nonnull)
1487 # define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args))
1488 # else
1489 # define _GL_ATTRIBUTE_NONNULL(args)
1490 # endif
1491 #endif
1492
1493 /* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is
1494 not meant to be NUL-terminated. */
1495 /* Applies to: struct/union members and variables that are arrays of element
1496 type '[[un]signed] char'. */
1497 #ifndef _GL_ATTRIBUTE_NONSTRING
1498 # if _GL_HAS_ATTRIBUTE (nonstring)
1499 # define _GL_ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__))
1500 # else
1501 # define _GL_ATTRIBUTE_NONSTRING
1502 # endif
1503 #endif
1504
1505 /* There is no _GL_ATTRIBUTE_NORETURN; use _Noreturn instead. */
1506
1507 /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
1508 */
1509 /* Applies to: functions. */
1510 /* After a function's parameter list, this attribute must come first, before
1511 other attributes. */
1512 #ifndef _GL_ATTRIBUTE_NOTHROW
1513 # if defined __cplusplus
1514 # if _GL_GNUC_PREREQ (2, 8) || __clang_major__ >= 4
1515 # if __cplusplus >= 201103L
1516 # define _GL_ATTRIBUTE_NOTHROW noexcept (true)
1517 # else
1518 # define _GL_ATTRIBUTE_NOTHROW throw ()
1519 # endif
1520 # else
1521 # define _GL_ATTRIBUTE_NOTHROW
1522 # endif
1523 # else
1524 # if _GL_HAS_ATTRIBUTE (nothrow)
1525 # define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__))
1526 # else
1527 # define _GL_ATTRIBUTE_NOTHROW
1528 # endif
1529 # endif
1530 #endif
1531
1532 /* _GL_ATTRIBUTE_PACKED declares:
1533 For struct members: The member has the smallest possible alignment.
1534 For struct, union, class: All members have the smallest possible alignment,
1535 minimizing the memory required. */
1536 /* Applies to: struct members, struct, union,
1537 in C++ also: class. */
1538 #ifndef _GL_ATTRIBUTE_PACKED
1539 /* Oracle Studio 12.6 miscompiles code with __attribute__ ((__packed__)) despite
1540 __has_attribute OK. */
1541 # if _GL_HAS_ATTRIBUTE (packed) && !defined __SUNPRO_C
1542 # define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__))
1543 # else
1544 # define _GL_ATTRIBUTE_PACKED
1545 # endif
1546 #endif
1547
1548 /* _GL_ATTRIBUTE_PURE declares:
1549 It is OK for a compiler to move calls to the function and to omit
1550 calls to the function if another call has the same arguments or the
1551 result is not used, and if observable state is the same.
1552 This attribute is safe for a function that does not affect observable state
1553 and always returns exactly once.
1554 (This attribute is looser than _GL_ATTRIBUTE_CONST because the function
1555 can depend on observable state. It is stricter than
1556 _GL_ATTRIBUTE_REPRODUCIBLE because the function must return exactly
1557 once and cannot affect state addressed by its arguments.) */
1558 /* Applies to: functions. */
1559 #ifndef _GL_ATTRIBUTE_PURE
1560 # if _GL_HAS_ATTRIBUTE (pure)
1561 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
1562 # else
1563 # define _GL_ATTRIBUTE_PURE _GL_ATTRIBUTE_REPRODUCIBLE
1564 # endif
1565 #endif
1566
1567 /* _GL_ATTRIBUTE_REPRODUCIBLE declares:
1568 It is OK for a compiler to move calls to the function and to omit duplicate
1569 calls to the function with the same arguments, so long as the state
1570 addressed by its arguments is the same and is updated in time for
1571 the rest of the program.
1572 This attribute is safe for a function that is effectless and idempotent; see
1573 ISO C 23 § 6.7.12.7 for a definition of these terms.
1574 (This attribute is looser than _GL_ATTRIBUTE_UNSEQUENCED because
1575 the function need not be stateless and idempotent. It is looser
1576 than _GL_ATTRIBUTE_PURE because the function need not return
1577 exactly once and can affect state addressed by its arguments.)
1578 See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
1579 <https://stackoverflow.com/questions/76847905/>.
1580 ATTENTION! Efforts are underway to change the meaning of this attribute.
1581 See <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3424.htm>. */
1582 /* Applies to: functions, pointer to functions, function types. */
1583 #ifndef _GL_ATTRIBUTE_REPRODUCIBLE
1584 /* This may be revisited when gcc and clang support [[reproducible]] or possibly
1585 __attribute__ ((__reproducible__)). */
1586 # ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
1587 # if _GL_HAS_ATTRIBUTE (reproducible)
1588 # define _GL_ATTRIBUTE_REPRODUCIBLE [[reproducible]]
1589 # endif
1590 # endif
1591 # ifndef _GL_ATTRIBUTE_REPRODUCIBLE
1592 # define _GL_ATTRIBUTE_REPRODUCIBLE
1593 # endif
1594 #endif
1595
1596 /* _GL_ATTRIBUTE_RETURNS_NONNULL declares that the function's return value is
1597 a non-NULL pointer. */
1598 /* Applies to: functions. */
1599 #ifndef _GL_ATTRIBUTE_RETURNS_NONNULL
1600 # if _GL_HAS_ATTRIBUTE (returns_nonnull)
1601 # define _GL_ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__))
1602 # else
1603 # define _GL_ATTRIBUTE_RETURNS_NONNULL
1604 # endif
1605 #endif
1606
1607 /* _GL_ATTRIBUTE_SENTINEL(pos) declares that the variadic function expects a
1608 trailing NULL argument.
1609 _GL_ATTRIBUTE_SENTINEL () - The last argument is NULL (requires C99).
1610 _GL_ATTRIBUTE_SENTINEL ((N)) - The (N+1)st argument from the end is NULL. */
1611 /* Applies to: functions. */
1612 #ifndef _GL_ATTRIBUTE_SENTINEL
1613 # if _GL_HAS_ATTRIBUTE (sentinel)
1614 # define _GL_ATTRIBUTE_SENTINEL(pos) __attribute__ ((__sentinel__ pos))
1615 # else
1616 # define _GL_ATTRIBUTE_SENTINEL(pos)
1617 # endif
1618 #endif
1619
1620 /* _GL_ATTRIBUTE_UNSEQUENCED declares:
1621 It is OK for a compiler to move calls to the function and to omit duplicate
1622 calls to the function with the same arguments, so long as the state
1623 addressed by its arguments is the same.
1624 This attribute is safe for a function that is effectless, idempotent,
1625 stateless, and independent; see ISO C 23 § 6.7.12.7 for a definition of
1626 these terms.
1627 (This attribute is stricter than _GL_ATTRIBUTE_REPRODUCIBLE because
1628 the function must be stateless and independent. It is looser than
1629 _GL_ATTRIBUTE_CONST because the function need not return exactly
1630 once and can depend on state addressed by its arguments.)
1631 See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
1632 <https://stackoverflow.com/questions/76847905/>.
1633 ATTENTION! Efforts are underway to change the meaning of this attribute.
1634 See <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3424.htm>. */
1635 /* Applies to: functions, pointer to functions, function types. */
1636 #ifndef _GL_ATTRIBUTE_UNSEQUENCED
1637 /* This may be revisited when gcc and clang support [[unsequenced]] or possibly
1638 __attribute__ ((__unsequenced__)). */
1639 # ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
1640 # if _GL_HAS_ATTRIBUTE (unsequenced)
1641 # define _GL_ATTRIBUTE_UNSEQUENCED [[unsequenced]]
1642 # endif
1643 # endif
1644 # ifndef _GL_ATTRIBUTE_UNSEQUENCED
1645 # define _GL_ATTRIBUTE_UNSEQUENCED
1646 # endif
1647 #endif
1648
1649 /* A helper macro. Don't use it directly. */
1650 #ifndef _GL_ATTRIBUTE_UNUSED
1651 # if _GL_HAS_ATTRIBUTE (unused)
1652 # define _GL_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
1653 # else
1654 # define _GL_ATTRIBUTE_UNUSED
1655 # endif
1656 #endif
1657
1658
1659 /* _GL_UNUSED_LABEL; declares that it is not a programming mistake if the
1660 immediately preceding label is not used. The compiler should not warn
1661 if the label is not used. */
1662 /* Applies to: label (both in C and C++). */
1663 /* Note that g++ < 4.5 does not support the '__attribute__ ((__unused__)) ;'
1664 syntax. But clang does. */
1665 #ifndef _GL_UNUSED_LABEL
1666 # if !(defined __cplusplus && !_GL_GNUC_PREREQ (4, 5)) || defined __clang__
1667 # define _GL_UNUSED_LABEL _GL_ATTRIBUTE_UNUSED
1668 # else
1669 # define _GL_UNUSED_LABEL
1670 # endif
1671 #endif
1672
1673 /* The following attributes enable detection of multithread-safety problems
1674 and resource leaks at compile-time, by clang ≥ 15, when the warning option
1675 -Wthread-safety is enabled. For usage, see
1676 <https://clang.llvm.org/docs/ThreadSafetyAnalysis.html>. */
1677 #ifndef _GL_ATTRIBUTE_CAPABILITY_TYPE
1678 # if __clang_major__ >= 15
1679 # define _GL_ATTRIBUTE_CAPABILITY_TYPE(concept) \
1680 __attribute__ ((__capability__ (concept)))
1681 # else
1682 # define _GL_ATTRIBUTE_CAPABILITY_TYPE(concept)
1683 # endif
1684 #endif
1685 #ifndef _GL_ATTRIBUTE_ACQUIRE_CAPABILITY
1686 # if __clang_major__ >= 15
1687 # define _GL_ATTRIBUTE_ACQUIRE_CAPABILITY(resource) \
1688 __attribute__ ((__acquire_capability__ (resource)))
1689 # else
1690 # define _GL_ATTRIBUTE_ACQUIRE_CAPABILITY(resource)
1691 # endif
1692 #endif
1693 #ifndef _GL_ATTRIBUTE_RELEASE_CAPABILITY
1694 # if __clang_major__ >= 15
1695 # define _GL_ATTRIBUTE_RELEASE_CAPABILITY(resource) \
1696 __attribute__ ((__release_capability__ (resource)))
1697 # else
1698 # define _GL_ATTRIBUTE_RELEASE_CAPABILITY(resource)
1699 # endif
1700 #endif
1701
1702
1703 /* In C++, there is the concept of "language linkage", that encompasses
1704 name mangling and function calling conventions.
1705 The following macros start and end a block of "C" linkage. */
1706 #ifdef __cplusplus
1707 # define _GL_BEGIN_C_LINKAGE extern "C" {
1708 # define _GL_END_C_LINKAGE }
1709 #else
1710 # define _GL_BEGIN_C_LINKAGE
1711 # define _GL_END_C_LINKAGE
1712 #endif
1713
1714
1715 /* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
1716 the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
1717 earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
1718 __APPLE__ && __MACH__ test for Mac OS X.
1719 __APPLE_CC__ tests for the Apple compiler and its version.
1720 __STDC_VERSION__ tests for the C99 mode. */
1721 #if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
1722 # define __GNUC_STDC_INLINE__ 1
1723 #endif
1724
1725 /* _GL_CMP (n1, n2) performs a three-valued comparison on n1 vs. n2, where
1726 n1 and n2 are expressions without side effects, that evaluate to real
1727 numbers (excluding NaN).
1728 It returns
1729 1 if n1 > n2
1730 0 if n1 == n2
1731 -1 if n1 < n2
1732 The naïve code (n1 > n2 ? 1 : n1 < n2 ? -1 : 0) produces a conditional
1733 jump with nearly all GCC versions up to GCC 10.
1734 This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional with many
1735 GCC versions up to GCC 9.
1736 The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9
1737 avoids conditional jumps in all GCC versions >= 3.4. */
1738 #define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2)))
1739
1740
1741 /* Define to 'int' if <sys/types.h> does not define. */
1742 #undef mode_t
1743
1744 /* Define to the type of st_nlink in struct stat, or a supertype. */
1745 #undef nlink_t
1746
1747 /* Define as a signed integer type capable of holding a process identifier. */
1748 #undef pid_t
1749
1750 /* Define to the equivalent of the C99 'restrict' keyword, or to
1751 nothing if this is not supported. Do not define if restrict is
1752 supported only directly. */
1753 #undef restrict
1754 /* Work around a bug in older versions of Sun C++, which did not
1755 #define __restrict__ or support _Restrict or __restrict__
1756 even though the corresponding Sun C compiler ended up with
1757 "#define restrict _Restrict" or "#define restrict __restrict__"
1758 in the previous line. This workaround can be removed once
1759 we assume Oracle Developer Studio 12.5 (2016) or later. */
1760 #if defined __SUNPRO_CC && !defined __RESTRICT && !defined __restrict__
1761 # define _Restrict
1762 # define __restrict__
1763 #endif
1764
1765 /* Define as 'unsigned int' if <stddef.h> doesn't define. */
1766 #undef size_t
1767
1768 /* Define as a signed type of the same size as size_t. */
1769 #undef ssize_t
1770
1771 #if !(defined __cplusplus \
1772 ? 1 \
1773 : (defined __clang__ \
1774 ? __STDC_VERSION__ >= 202000L && __clang_major__ >= 15 \
1775 : (defined __GNUC__ \
1776 ? __STDC_VERSION__ >= 202000L && __GNUC__ >= 13 \
1777 : defined HAVE_C_BOOL)))
1778 # if !defined __cplusplus && !defined __bool_true_false_are_defined
1779 # if HAVE_STDBOOL_H
1780 # include <stdbool.h>
1781 # else
1782 # if defined __SUNPRO_C
1783 # error "<stdbool.h> is not usable with this configuration. To make it usable, add -D_STDC_C99= to $CC."
1784 # else
1785 # error "<stdbool.h> does not exist on this platform. Use gnulib module 'stdbool-c99' instead of gnulib module 'stdbool'."
1786 # endif
1787 # endif
1788 # endif
1789 # if !true
1790 # define true (!false)
1791 # endif
1792 #endif
1793
1794 #if (!(defined __clang__ \
1795 ? (defined __cplusplus \
1796 ? __cplusplus >= 201703L \
1797 : __STDC_VERSION__ >= 202000L && __clang_major__ >= 16 \
1798 && !defined __sun) \
1799 : (defined __GNUC__ \
1800 ? (defined __cplusplus \
1801 ? __cplusplus >= 201103L && __GNUG__ >= 6 \
1802 : __STDC_VERSION__ >= 202000L && __GNUC__ >= 13 \
1803 && !defined __sun) \
1804 : defined HAVE_C_STATIC_ASSERT)) \
1805 && !defined assert \
1806 && (!defined __cplusplus \
1807 || (__cpp_static_assert < 201411 \
1808 && __GNUG__ < 6 && __clang_major__ < 6)))
1809 #include <assert.h>
1810 #undef/**/assert
1811 #ifdef __sgi
1812 #undef/**/__ASSERT_H__
1813 #endif
1814 /* Solaris 11.4 <assert.h> defines static_assert as a macro with 2 arguments.
1815 We need it also to be invocable with a single argument.
1816 Haiku 2022 <assert.h> does not define static_assert at all. */
1817 #if (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus
1818 #undef/**/static_assert
1819 #define static_assert _Static_assert
1820 #endif
1821 #endif
1822
1823 #if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
1824 # pragma GCC diagnostic pop
1825 #endif
1826