summaryrefslogtreecommitdiffstats
path: root/gl
diff options
context:
space:
mode:
Diffstat (limited to 'gl')
-rw-r--r--gl/Makefile.am1102
-rw-r--r--gl/_Noreturn.h41
-rw-r--r--gl/af_alg.c188
-rw-r--r--gl/af_alg.h2
-rw-r--r--gl/alloca.in.h2
-rw-r--r--gl/arg-nonnull.h2
-rw-r--r--gl/arpa_inet.c20
-rw-r--r--gl/arpa_inet.in.h60
-rw-r--r--gl/asnprintf.c6
-rw-r--r--gl/asprintf.c6
-rw-r--r--gl/assert.in.h2
-rw-r--r--gl/attribute.h154
-rw-r--r--gl/base64.c66
-rw-r--r--gl/base64.h4
-rw-r--r--gl/basename-lgpl.c11
-rw-r--r--gl/basename-lgpl.h2
-rw-r--r--gl/basename.c2
-rw-r--r--gl/btowc.c2
-rw-r--r--gl/byteswap.c20
-rw-r--r--gl/byteswap.in.h106
-rw-r--r--gl/c++defs.h64
-rw-r--r--gl/c-ctype.c20
-rw-r--r--gl/c-ctype.h366
-rw-r--r--gl/c32is-impl.h105
-rw-r--r--gl/c32isalnum.c26
-rw-r--r--gl/c32isalpha.c26
-rw-r--r--gl/c32isblank.c26
-rw-r--r--gl/c32iscntrl.c26
-rw-r--r--gl/c32isdigit.c26
-rw-r--r--gl/c32isgraph.c26
-rw-r--r--gl/c32islower.c26
-rw-r--r--gl/c32isprint.c26
-rw-r--r--gl/c32ispunct.c26
-rw-r--r--gl/c32isspace.c26
-rw-r--r--gl/c32isupper.c26
-rw-r--r--gl/c32isxdigit.c26
-rw-r--r--gl/c32to-impl.h103
-rw-r--r--gl/c32tolower.c26
-rw-r--r--gl/c32width.c102
-rw-r--r--gl/calloc.c19
-rw-r--r--gl/cdefs.h16
-rw-r--r--gl/cloexec.c2
-rw-r--r--gl/cloexec.h2
-rw-r--r--gl/close.c2
-rw-r--r--gl/dirname-lgpl.c7
-rw-r--r--gl/dirname.c2
-rw-r--r--gl/dirname.h2
-rw-r--r--gl/dup2.c68
-rw-r--r--gl/dynarray.h2
-rw-r--r--gl/errno.in.h29
-rw-r--r--gl/error.c177
-rw-r--r--gl/error.in.h71
-rw-r--r--gl/exitfail.c2
-rw-r--r--gl/exitfail.h2
-rw-r--r--gl/fcntl.c186
-rw-r--r--gl/fcntl.in.h98
-rw-r--r--gl/fd-hook.c2
-rw-r--r--gl/fd-hook.h2
-rw-r--r--gl/fflush.c17
-rw-r--r--gl/filename.h2
-rw-r--r--gl/float+.h2
-rw-r--r--gl/float.c98
-rw-r--r--gl/float.in.h236
-rw-r--r--gl/floor.c2
-rw-r--r--gl/floorf.c2
-rw-r--r--gl/fopen.c51
-rw-r--r--gl/fpurge.c10
-rw-r--r--gl/freading.c12
-rw-r--r--gl/freading.h2
-rw-r--r--gl/free.c8
-rw-r--r--gl/fseek.c2
-rw-r--r--gl/fseeko.c28
-rw-r--r--gl/fseterr.c80
-rw-r--r--gl/fseterr.h55
-rw-r--r--gl/fstat.c11
-rw-r--r--gl/fsusage.c21
-rw-r--r--gl/fsusage.h2
-rw-r--r--gl/ftell.c2
-rw-r--r--gl/ftello.c15
-rw-r--r--gl/gai_strerror.c9
-rw-r--r--gl/getaddrinfo.c105
-rw-r--r--gl/getdelim.c111
-rw-r--r--gl/getdtablesize.c13
-rw-r--r--gl/gethostname.c6
-rw-r--r--gl/getline.c2
-rw-r--r--gl/getloadavg.c268
-rw-r--r--gl/getopt-cdefs.in.h12
-rw-r--r--gl/getopt-core.h2
-rw-r--r--gl/getopt-ext.h2
-rw-r--r--gl/getopt-pfx-core.h12
-rw-r--r--gl/getopt-pfx-ext.h4
-rw-r--r--gl/getopt.c69
-rw-r--r--gl/getopt.in.h7
-rw-r--r--gl/getopt1.c7
-rw-r--r--gl/getopt_int.h2
-rw-r--r--gl/getprogname.c66
-rw-r--r--gl/getprogname.h2
-rw-r--r--gl/gettext.h120
-rw-r--r--gl/gl_openssl.h4
-rw-r--r--gl/glthread/lock.c112
-rw-r--r--gl/glthread/lock.h155
-rw-r--r--gl/glthread/once.c80
-rw-r--r--gl/glthread/once.h272
-rw-r--r--gl/glthread/threadlib.c2
-rw-r--r--gl/hard-locale.c4
-rw-r--r--gl/hard-locale.h2
-rw-r--r--gl/ialloc.c5
-rw-r--r--gl/ialloc.h39
-rw-r--r--gl/idpriv-droptemp.c22
-rw-r--r--gl/idpriv.h2
-rw-r--r--gl/idx.h2
-rw-r--r--gl/inet_ntop.c46
-rw-r--r--gl/inet_pton.c265
-rw-r--r--gl/intprops-internal.h39
-rw-r--r--gl/intprops.h14
-rw-r--r--gl/inttypes.in.h22
-rw-r--r--gl/iswblank.c2
-rw-r--r--gl/iswctype-impl.h2
-rw-r--r--gl/iswctype.c2
-rw-r--r--gl/iswdigit.c2
-rw-r--r--gl/iswpunct.c2
-rw-r--r--gl/iswxdigit.c2
-rw-r--r--gl/itold.c2
-rw-r--r--gl/langinfo.in.h61
-rw-r--r--gl/lc-charset-dispatch.c2
-rw-r--r--gl/lc-charset-dispatch.h2
-rw-r--r--gl/libc-config.h7
-rw-r--r--gl/limits.in.h14
-rw-r--r--gl/localcharset.c67
-rw-r--r--gl/localcharset.h44
-rw-r--r--gl/locale.in.h199
-rw-r--r--gl/localeconv.c2
-rw-r--r--gl/lseek.c2
-rw-r--r--gl/lstat.c97
-rw-r--r--gl/m4/00gnulib.m43
-rw-r--r--gl/m4/__inline.m43
-rw-r--r--gl/m4/absolute-header.m43
-rw-r--r--gl/m4/af_alg.m43
-rw-r--r--gl/m4/alloca.m43
-rw-r--r--gl/m4/arpa_inet_h.m49
-rw-r--r--gl/m4/assert_h.m481
-rw-r--r--gl/m4/base64.m43
-rw-r--r--gl/m4/btowc.m456
-rw-r--r--gl/m4/build-to-host.m4274
-rw-r--r--gl/m4/builtin-expect.m410
-rw-r--r--gl/m4/byteswap.m434
-rw-r--r--gl/m4/c-bool.m420
-rw-r--r--gl/m4/c32rtomb.m4187
-rw-r--r--gl/m4/calloc.m473
-rw-r--r--gl/m4/close.m43
-rw-r--r--gl/m4/codeset.m43
-rw-r--r--gl/m4/double-slash-root.m43
-rw-r--r--gl/m4/dup2.m43
-rw-r--r--gl/m4/eealloc.m432
-rw-r--r--gl/m4/environ.m43
-rw-r--r--gl/m4/errno_h.m468
-rw-r--r--gl/m4/error.m44
-rw-r--r--gl/m4/error_h.m420
-rw-r--r--gl/m4/exponentd.m47
-rw-r--r--gl/m4/extensions-aix.m426
-rw-r--r--gl/m4/extensions.m43
-rw-r--r--gl/m4/extern-inline.m417
-rw-r--r--gl/m4/fclose.m43
-rw-r--r--gl/m4/fcntl-o.m497
-rw-r--r--gl/m4/fcntl.m43
-rw-r--r--gl/m4/fcntl_h.m49
-rw-r--r--gl/m4/fflush.m414
-rw-r--r--gl/m4/float_h.m433
-rw-r--r--gl/m4/floorf.m43
-rw-r--r--gl/m4/fopen.m43
-rw-r--r--gl/m4/fpurge.m494
-rw-r--r--gl/m4/freading.m43
-rw-r--r--gl/m4/free.m47
-rw-r--r--gl/m4/fseek.m43
-rw-r--r--gl/m4/fseeko.m49
-rw-r--r--gl/m4/fseterr.m415
-rw-r--r--gl/m4/fstat.m43
-rw-r--r--gl/m4/fstypename.m43
-rw-r--r--gl/m4/fsusage.m447
-rw-r--r--gl/m4/ftell.m43
-rw-r--r--gl/m4/ftello.m49
-rw-r--r--gl/m4/getaddrinfo.m460
-rw-r--r--gl/m4/getdelim.m452
-rw-r--r--gl/m4/getdtablesize.m43
-rw-r--r--gl/m4/gethostname.m43
-rw-r--r--gl/m4/getline.m452
-rw-r--r--gl/m4/getloadavg.m410
-rw-r--r--gl/m4/getopt.m425
-rw-r--r--gl/m4/getprogname.m411
-rw-r--r--gl/m4/gettext_h.m421
-rw-r--r--gl/m4/gl-openssl.m418
-rw-r--r--gl/m4/gnulib-cache.m42
-rw-r--r--gl/m4/gnulib-common.m4480
-rw-r--r--gl/m4/gnulib-comp.m4532
-rw-r--r--gl/m4/gnulib-i18n.m461
-rw-r--r--gl/m4/gnulib-tool.m48
-rw-r--r--gl/m4/hostent.m43
-rw-r--r--gl/m4/idpriv.m43
-rw-r--r--gl/m4/include_next.m43
-rw-r--r--gl/m4/inet_ntop.m48
-rw-r--r--gl/m4/inet_pton.m473
-rw-r--r--gl/m4/intmax_t.m43
-rw-r--r--gl/m4/inttypes.m43
-rw-r--r--gl/m4/inttypes_h.m43
-rw-r--r--gl/m4/iswblank.m43
-rw-r--r--gl/m4/iswctype.m43
-rw-r--r--gl/m4/iswdigit.m421
-rw-r--r--gl/m4/iswpunct.m43
-rw-r--r--gl/m4/iswxdigit.m421
-rw-r--r--gl/m4/langinfo_h.m449
-rw-r--r--gl/m4/largefile.m414
-rw-r--r--gl/m4/libunistring-base.m4204
-rw-r--r--gl/m4/limits-h.m43
-rw-r--r--gl/m4/localcharset.m43
-rw-r--r--gl/m4/locale-en.m4138
-rw-r--r--gl/m4/locale-fr.m429
-rw-r--r--gl/m4/locale-ja.m414
-rw-r--r--gl/m4/locale-zh.m424
-rw-r--r--gl/m4/locale_h.m456
-rw-r--r--gl/m4/localeconv.m43
-rw-r--r--gl/m4/lock.m49
-rw-r--r--gl/m4/lseek.m43
-rw-r--r--gl/m4/lstat.m482
-rw-r--r--gl/m4/malloc.m4193
-rw-r--r--gl/m4/malloca.m47
-rw-r--r--gl/m4/math_h.m447
-rw-r--r--gl/m4/mbchar.m415
-rw-r--r--gl/m4/mbiter.m416
-rw-r--r--gl/m4/mbrtoc32.m4326
-rw-r--r--gl/m4/mbrtowc.m4100
-rw-r--r--gl/m4/mbsinit.m43
-rw-r--r--gl/m4/mbstate_t.m43
-rw-r--r--gl/m4/mbtowc.m43
-rw-r--r--gl/m4/memchr.m436
-rw-r--r--gl/m4/minmax.m43
-rw-r--r--gl/m4/mktime.m428
-rw-r--r--gl/m4/mmap-anon.m422
-rw-r--r--gl/m4/mode_t.m43
-rw-r--r--gl/m4/mountlist.m429
-rw-r--r--gl/m4/msvc-inval.m43
-rw-r--r--gl/m4/msvc-nothrow.m43
-rw-r--r--gl/m4/multiarch.m43
-rw-r--r--gl/m4/musl.m43
-rw-r--r--gl/m4/netdb_h.m43
-rw-r--r--gl/m4/netinet_in_h.m43
-rw-r--r--gl/m4/nl_langinfo.m440
-rw-r--r--gl/m4/nocrash.m43
-rw-r--r--gl/m4/off64_t.m432
-rw-r--r--gl/m4/off_t.m43
-rw-r--r--gl/m4/once.m414
-rw-r--r--gl/m4/open-cloexec.m43
-rw-r--r--gl/m4/open-slash.m43
-rw-r--r--gl/m4/open.m48
-rw-r--r--gl/m4/pathmax.m43
-rw-r--r--gl/m4/pid_t.m43
-rw-r--r--gl/m4/printf.m4317
-rw-r--r--gl/m4/pthread-once.m483
-rw-r--r--gl/m4/pthread-spin.m472
-rw-r--r--gl/m4/pthread_h.m4293
-rw-r--r--gl/m4/pthread_rwlock_rdlock.m45
-rw-r--r--gl/m4/realloc.m4153
-rw-r--r--gl/m4/reallocarray.m416
-rw-r--r--gl/m4/regex.m426
-rw-r--r--gl/m4/sched_h.m4102
-rw-r--r--gl/m4/servent.m43
-rw-r--r--gl/m4/setenv.m49
-rw-r--r--gl/m4/setlocale_null.m415
-rw-r--r--gl/m4/sha256.m43
-rw-r--r--gl/m4/size_max.m43
-rw-r--r--gl/m4/snprintf.m43
-rw-r--r--gl/m4/socketlib.m43
-rw-r--r--gl/m4/sockets.m43
-rw-r--r--gl/m4/socklen.m47
-rw-r--r--gl/m4/sockpfaf.m415
-rw-r--r--gl/m4/ssize_t.m43
-rw-r--r--gl/m4/stat-time.m44
-rw-r--r--gl/m4/stat.m43
-rw-r--r--gl/m4/std-gnu11.m429
-rw-r--r--gl/m4/stdalign.m424
-rw-r--r--gl/m4/stdckdint_h.m4136
-rw-r--r--gl/m4/stddef_h.m463
-rw-r--r--gl/m4/stdint.m413
-rw-r--r--gl/m4/stdint_h.m43
-rw-r--r--gl/m4/stdio_h.m417
-rw-r--r--gl/m4/stdlib_h.m468
-rw-r--r--gl/m4/strcasecmp.m467
-rw-r--r--gl/m4/strcasestr.m411
-rw-r--r--gl/m4/strerror.m43
-rw-r--r--gl/m4/string_h.m422
-rw-r--r--gl/m4/stringeq.m425
-rw-r--r--gl/m4/strings_h.m418
-rw-r--r--gl/m4/strncasecmp.m4 (renamed from gl/m4/strcase.m4)34
-rw-r--r--gl/m4/strncpy.m494
-rw-r--r--gl/m4/strsep.m43
-rw-r--r--gl/m4/strstr.m411
-rw-r--r--gl/m4/sys_cdefs_h.m426
-rw-r--r--gl/m4/sys_socket_h.m459
-rw-r--r--gl/m4/sys_stat_h.m45
-rw-r--r--gl/m4/sys_types_h.m416
-rw-r--r--gl/m4/sys_uio_h.m43
-rw-r--r--gl/m4/threadlib.m4403
-rw-r--r--gl/m4/time_h.m412
-rw-r--r--gl/m4/time_r.m43
-rw-r--r--gl/m4/timegm.m43
-rw-r--r--gl/m4/uchar_h.m4279
-rw-r--r--gl/m4/ungetc.m43
-rw-r--r--gl/m4/unicase_h.m445
-rw-r--r--gl/m4/unictype_h.m4179
-rw-r--r--gl/m4/uninorm_h.m447
-rw-r--r--gl/m4/unistd_h.m47
-rw-r--r--gl/m4/unitypes_h.m426
-rw-r--r--gl/m4/unlocked-io.m46
-rw-r--r--gl/m4/vararrays.m43
-rw-r--r--gl/m4/vasnprintf.m474
-rw-r--r--gl/m4/vasprintf.m43
-rw-r--r--gl/m4/visibility.m43
-rw-r--r--gl/m4/vsnprintf.m43
-rw-r--r--gl/m4/warn-on-use.m43
-rw-r--r--gl/m4/wchar_h.m412
-rw-r--r--gl/m4/wchar_t.m425
-rw-r--r--gl/m4/wcrtomb.m419
-rw-r--r--gl/m4/wctype.m43
-rw-r--r--gl/m4/wctype_h.m43
-rw-r--r--gl/m4/wcwidth.m4116
-rw-r--r--gl/m4/wint_t.m43
-rw-r--r--gl/m4/xalloc.m43
-rw-r--r--gl/m4/xsize.m43
-rw-r--r--gl/m4/zzgnulib.m43
-rw-r--r--gl/malloc.c13
-rw-r--r--gl/malloc/dynarray-skeleton.c2
-rw-r--r--gl/malloc/dynarray.h2
-rw-r--r--gl/malloc/dynarray_at_failure.c2
-rw-r--r--gl/malloc/dynarray_emplace_enlarge.c2
-rw-r--r--gl/malloc/dynarray_finalize.c2
-rw-r--r--gl/malloc/dynarray_resize.c2
-rw-r--r--gl/malloc/dynarray_resize_clear.c2
-rw-r--r--gl/malloca.c6
-rw-r--r--gl/malloca.h2
-rw-r--r--gl/math.c4
-rw-r--r--gl/math.in.h748
-rw-r--r--gl/mbchar.c22
-rw-r--r--gl/mbchar.h388
-rw-r--r--gl/mbiterf.c20
-rw-r--r--gl/mbiterf.h214
-rw-r--r--gl/mbrtoc32.c288
-rw-r--r--gl/mbrtowc-impl-utf8.h2
-rw-r--r--gl/mbrtowc-impl.h29
-rw-r--r--gl/mbrtowc.c11
-rw-r--r--gl/mbsinit.c2
-rw-r--r--gl/mbsnlen.c60
-rw-r--r--gl/mbszero.c2
-rw-r--r--gl/mbtowc-impl.h9
-rw-r--r--gl/mbtowc-lock.c2
-rw-r--r--gl/mbtowc-lock.h17
-rw-r--r--gl/mbtowc.c2
-rw-r--r--gl/memchr.c174
-rw-r--r--gl/memchr.valgrind2
-rw-r--r--gl/minmax.h6
-rw-r--r--gl/mktime-internal.h16
-rw-r--r--gl/mktime.c171
-rw-r--r--gl/mountlist.c629
-rw-r--r--gl/mountlist.h7
-rw-r--r--gl/msvc-inval.c2
-rw-r--r--gl/msvc-inval.h6
-rw-r--r--gl/msvc-nothrow.c2
-rw-r--r--gl/msvc-nothrow.h2
-rw-r--r--gl/netdb.in.h41
-rw-r--r--gl/netinet_in.in.h2
-rw-r--r--gl/nl_langinfo-lock.c2
-rw-r--r--gl/nl_langinfo.c138
-rw-r--r--gl/open.c131
-rw-r--r--gl/pathmax.h2
-rw-r--r--gl/printf-args.c21
-rw-r--r--gl/printf-args.h13
-rw-r--r--gl/printf-parse.c22
-rw-r--r--gl/printf-parse.h2
-rw-r--r--gl/pthread-once.c148
-rw-r--r--gl/pthread.in.h1981
-rw-r--r--gl/realloc.c75
-rw-r--r--gl/reallocarray.c4
-rw-r--r--gl/regcomp.c67
-rw-r--r--gl/regex.c3
-rw-r--r--gl/regex.h51
-rw-r--r--gl/regex_internal.c9
-rw-r--r--gl/regex_internal.h26
-rw-r--r--gl/regexec.c18
-rw-r--r--gl/sched.in.h110
-rw-r--r--gl/setenv.c117
-rw-r--r--gl/setlocale-lock.c2
-rw-r--r--gl/setlocale_null-unlocked.c10
-rw-r--r--gl/setlocale_null.c15
-rw-r--r--gl/setlocale_null.h2
-rw-r--r--gl/sha256-stream.c17
-rw-r--r--gl/sha256.c19
-rw-r--r--gl/sha256.h2
-rw-r--r--gl/size_max.h2
-rw-r--r--gl/snprintf.c41
-rw-r--r--gl/sockets.c21
-rw-r--r--gl/sockets.h4
-rw-r--r--gl/stat-time.c5
-rw-r--r--gl/stat-time.h48
-rw-r--r--gl/stat-w32.c7
-rw-r--r--gl/stat-w32.h2
-rw-r--r--gl/stat.c18
-rw-r--r--gl/stdckdint.in.h41
-rw-r--r--gl/stddef.in.h103
-rw-r--r--gl/stdint.in.h30
-rw-r--r--gl/stdio-consolesafe.c202
-rw-r--r--gl/stdio-impl.h116
-rw-r--r--gl/stdio-read.c13
-rw-r--r--gl/stdio-write.c19
-rw-r--r--gl/stdio.in.h667
-rw-r--r--gl/stdlib.c21
-rw-r--r--gl/stdlib.in.h567
-rw-r--r--gl/str-two-way.h283
-rw-r--r--gl/strcasecmp.c39
-rw-r--r--gl/strcasestr.c41
-rw-r--r--gl/streq.h6
-rw-r--r--gl/strerror-override.c7
-rw-r--r--gl/strerror-override.h5
-rw-r--r--gl/strerror.c11
-rw-r--r--gl/string.c19
-rw-r--r--gl/string.in.h555
-rw-r--r--gl/strings.in.h151
-rw-r--r--gl/stripslash.c8
-rw-r--r--gl/strncasecmp.c39
-rw-r--r--gl/strncpy.c38
-rw-r--r--gl/strsep.c5
-rw-r--r--gl/strstr.c32
-rw-r--r--gl/sys-limits.h6
-rw-r--r--gl/sys_socket.c4
-rw-r--r--gl/sys_socket.in.h145
-rw-r--r--gl/sys_stat.in.h121
-rw-r--r--gl/sys_types.in.h27
-rw-r--r--gl/sys_uio.in.h2
-rw-r--r--gl/time.in.h141
-rw-r--r--gl/time_r.c2
-rw-r--r--gl/timegm.c5
-rw-r--r--gl/uchar.in.h909
-rw-r--r--gl/unicase.in.h471
-rw-r--r--gl/unicase/.dirstamp0
-rw-r--r--gl/unicase/simple-mapping.h39
-rw-r--r--gl/unicase/tolower.c27
-rw-r--r--gl/unicase/tolower.h759
-rw-r--r--gl/unictype.in.h1147
-rw-r--r--gl/unictype/.dirstamp0
-rw-r--r--gl/unictype/bitmap.h48
-rw-r--r--gl/unictype/ctype_alnum.c32
-rw-r--r--gl/unictype/ctype_alnum.h889
-rw-r--r--gl/unictype/ctype_alpha.c32
-rw-r--r--gl/unictype/ctype_alpha.h889
-rw-r--r--gl/unictype/ctype_blank.c32
-rw-r--r--gl/unictype/ctype_blank.h184
-rw-r--r--gl/unictype/ctype_cntrl.c32
-rw-r--r--gl/unictype/ctype_cntrl.h176
-rw-r--r--gl/unictype/ctype_digit.c32
-rw-r--r--gl/unictype/ctype_digit.h172
-rw-r--r--gl/unictype/ctype_graph.c32
-rw-r--r--gl/unictype/ctype_graph.h1194
-rw-r--r--gl/unictype/ctype_lower.c32
-rw-r--r--gl/unictype/ctype_lower.h371
-rw-r--r--gl/unictype/ctype_print.c32
-rw-r--r--gl/unictype/ctype_print.h1194
-rw-r--r--gl/unictype/ctype_punct.c32
-rw-r--r--gl/unictype/ctype_punct.h874
-rw-r--r--gl/unictype/ctype_space.c32
-rw-r--r--gl/unictype/ctype_space.h184
-rw-r--r--gl/unictype/ctype_upper.c32
-rw-r--r--gl/unictype/ctype_upper.h367
-rw-r--r--gl/unictype/ctype_xdigit.c32
-rw-r--r--gl/unictype/ctype_xdigit.h172
-rw-r--r--gl/uninorm.in.h255
-rw-r--r--gl/unistd.c4
-rw-r--r--gl/unistd.in.h526
-rw-r--r--gl/unitypes.in.h71
-rw-r--r--gl/uniwidth.in.h72
-rw-r--r--gl/uniwidth/.dirstamp0
-rw-r--r--gl/uniwidth/cjk.h37
-rw-r--r--gl/uniwidth/width.c95
-rw-r--r--gl/uniwidth/width0.h504
-rw-r--r--gl/uniwidth/width2.h541
-rw-r--r--gl/unlocked-io.h9
-rw-r--r--gl/unsetenv.c39
-rw-r--r--gl/vasnprintf.c2019
-rw-r--r--gl/vasnprintf.h2
-rw-r--r--gl/vasprintf.c14
-rw-r--r--gl/verify.h38
-rw-r--r--gl/vsnprintf.c41
-rw-r--r--gl/vsnzprintf.c62
-rw-r--r--gl/w32sock.h2
-rw-r--r--gl/warn-on-use.h10
-rw-r--r--gl/wchar.in.h373
-rw-r--r--gl/wcrtomb.c6
-rw-r--r--gl/wctype-h.c4
-rw-r--r--gl/wctype-impl.h26
-rw-r--r--gl/wctype.c2
-rw-r--r--gl/wctype.in.h54
-rw-r--r--gl/wcwidth.c73
-rw-r--r--gl/windows-initguard.h2
-rw-r--r--gl/windows-mutex.c26
-rw-r--r--gl/windows-mutex.h3
-rw-r--r--gl/windows-once.c51
-rw-r--r--gl/windows-once.h7
-rw-r--r--gl/windows-recmutex.c2
-rw-r--r--gl/windows-recmutex.h2
-rw-r--r--gl/windows-rwlock.c24
-rw-r--r--gl/windows-rwlock.h2
-rw-r--r--gl/xalloc-die.c4
-rw-r--r--gl/xalloc-oversized.h5
-rw-r--r--gl/xalloc.h2
-rw-r--r--gl/xmalloc.c22
-rw-r--r--gl/xsize.c5
-rw-r--r--gl/xsize.h20
513 files changed, 32480 insertions, 6810 deletions
diff --git a/gl/Makefile.am b/gl/Makefile.am
index df988b37..6f50b0c5 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -1,6 +1,6 @@
1## DO NOT EDIT! GENERATED AUTOMATICALLY! 1## DO NOT EDIT! GENERATED AUTOMATICALLY!
2## Process this file with automake to produce Makefile.in. 2## Process this file with automake to produce Makefile.in.
3# Copyright (C) 2002-2024 Free Software Foundation, Inc. 3# Copyright (C) 2002-2026 Free Software Foundation, Inc.
4# 4#
5# This file is free software; you can redistribute it and/or modify 5# This file is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by 6# it under the terms of the GNU General Public License as published by
@@ -59,6 +59,7 @@
59AUTOMAKE_OPTIONS = 1.14 gnits subdir-objects 59AUTOMAKE_OPTIONS = 1.14 gnits subdir-objects
60 60
61SUBDIRS = 61SUBDIRS =
62TESTS_ENVIRONMENT =
62noinst_HEADERS = 63noinst_HEADERS =
63noinst_LIBRARIES = 64noinst_LIBRARIES =
64noinst_LTLIBRARIES = 65noinst_LTLIBRARIES =
@@ -80,9 +81,9 @@ AM_CFLAGS =
80noinst_LIBRARIES += libgnu.a 81noinst_LIBRARIES += libgnu.a
81 82
82libgnu_a_SOURCES = 83libgnu_a_SOURCES =
83libgnu_a_CFLAGS = $(AM_CFLAGS) $(GL_CFLAG_GNULIB_WARNINGS) 84libgnu_a_CFLAGS = $(AM_CFLAGS) $(GL_CFLAG_GNULIB_WARNINGS) $(GL_CFLAG_ALLOW_WARNINGS)
84libgnu_a_LIBADD = $(gl_LIBOBJS) 85libgnu_a_LIBADD = $(gl_libgnu_LIBOBJS)
85libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) 86libgnu_a_DEPENDENCIES = $(gl_libgnu_LIBOBJS)
86EXTRA_libgnu_a_SOURCES = 87EXTRA_libgnu_a_SOURCES =
87 88
88## begin gnulib module absolute-header 89## begin gnulib module absolute-header
@@ -116,9 +117,10 @@ EXTRA_DIST += alloca.in.h
116 117
117## end gnulib module alloca-opt 118## end gnulib module alloca-opt
118 119
119## begin gnulib module arpa_inet 120## begin gnulib module arpa_inet-h
120 121
121BUILT_SOURCES += arpa/inet.h 122BUILT_SOURCES += arpa/inet.h
123libgnu_a_SOURCES += arpa_inet.c
122 124
123# We need the following in order to create <arpa/inet.h> when the system 125# We need the following in order to create <arpa/inet.h> when the system
124# doesn't have one. 126# doesn't have one.
@@ -135,8 +137,12 @@ arpa/inet.h: arpa_inet.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON
135 -e 's/@''GNULIB_INET_NTOP''@/$(GL_GNULIB_INET_NTOP)/g' \ 137 -e 's/@''GNULIB_INET_NTOP''@/$(GL_GNULIB_INET_NTOP)/g' \
136 -e 's/@''GNULIB_INET_PTON''@/$(GL_GNULIB_INET_PTON)/g' \ 138 -e 's/@''GNULIB_INET_PTON''@/$(GL_GNULIB_INET_PTON)/g' \
137 -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \ 139 -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \
140 -e 's|@''HAVE_DECL_HTONL''@|$(HAVE_DECL_HTONL)|g' \
141 -e 's|@''HAVE_DECL_HTONS''@|$(HAVE_DECL_HTONS)|g' \
138 -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \ 142 -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \
139 -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \ 143 -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \
144 -e 's|@''HAVE_DECL_NTOHL''@|$(HAVE_DECL_NTOHL)|g' \
145 -e 's|@''HAVE_DECL_NTOHS''@|$(HAVE_DECL_NTOHS)|g' \
140 -e 's|@''REPLACE_INET_NTOP''@|$(REPLACE_INET_NTOP)|g' \ 146 -e 's|@''REPLACE_INET_NTOP''@|$(REPLACE_INET_NTOP)|g' \
141 -e 's|@''REPLACE_INET_PTON''@|$(REPLACE_INET_PTON)|g' \ 147 -e 's|@''REPLACE_INET_PTON''@|$(REPLACE_INET_PTON)|g' \
142 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ 148 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
@@ -149,7 +155,7 @@ MOSTLYCLEANDIRS += arpa
149 155
150EXTRA_DIST += arpa_inet.in.h 156EXTRA_DIST += arpa_inet.in.h
151 157
152## end gnulib module arpa_inet 158## end gnulib module arpa_inet-h
153 159
154## begin gnulib module assert-h 160## begin gnulib module assert-h
155 161
@@ -221,6 +227,7 @@ if GL_GENERATE_BYTESWAP_H
221byteswap.h: byteswap.in.h $(top_builddir)/config.status 227byteswap.h: byteswap.in.h $(top_builddir)/config.status
222 $(gl_V_at)$(SED_HEADER_TO_AT_t) $(srcdir)/byteswap.in.h 228 $(gl_V_at)$(SED_HEADER_TO_AT_t) $(srcdir)/byteswap.in.h
223 $(AM_V_at)mv $@-t $@ 229 $(AM_V_at)mv $@-t $@
230libgnu_a_SOURCES += byteswap.c
224else 231else
225byteswap.h: $(top_builddir)/config.status 232byteswap.h: $(top_builddir)/config.status
226 rm -f $@ 233 rm -f $@
@@ -231,6 +238,122 @@ EXTRA_DIST += byteswap.in.h
231 238
232## end gnulib module byteswap 239## end gnulib module byteswap
233 240
241## begin gnulib module c-ctype
242
243libgnu_a_SOURCES += c-ctype.h c-ctype.c
244
245## end gnulib module c-ctype
246
247## begin gnulib module c32isalnum
248
249libgnu_a_SOURCES += c32isalnum.c
250
251EXTRA_DIST += c32is-impl.h
252
253## end gnulib module c32isalnum
254
255## begin gnulib module c32isalpha
256
257libgnu_a_SOURCES += c32isalpha.c
258
259EXTRA_DIST += c32is-impl.h
260
261## end gnulib module c32isalpha
262
263## begin gnulib module c32isblank
264
265libgnu_a_SOURCES += c32isblank.c
266
267EXTRA_DIST += c32is-impl.h
268
269## end gnulib module c32isblank
270
271## begin gnulib module c32iscntrl
272
273libgnu_a_SOURCES += c32iscntrl.c
274
275EXTRA_DIST += c32is-impl.h
276
277## end gnulib module c32iscntrl
278
279## begin gnulib module c32isdigit
280
281libgnu_a_SOURCES += c32isdigit.c
282
283EXTRA_DIST += c32is-impl.h
284
285## end gnulib module c32isdigit
286
287## begin gnulib module c32isgraph
288
289libgnu_a_SOURCES += c32isgraph.c
290
291EXTRA_DIST += c32is-impl.h
292
293## end gnulib module c32isgraph
294
295## begin gnulib module c32islower
296
297libgnu_a_SOURCES += c32islower.c
298
299EXTRA_DIST += c32is-impl.h
300
301## end gnulib module c32islower
302
303## begin gnulib module c32isprint
304
305libgnu_a_SOURCES += c32isprint.c
306
307EXTRA_DIST += c32is-impl.h
308
309## end gnulib module c32isprint
310
311## begin gnulib module c32ispunct
312
313libgnu_a_SOURCES += c32ispunct.c
314
315EXTRA_DIST += c32is-impl.h
316
317## end gnulib module c32ispunct
318
319## begin gnulib module c32isspace
320
321libgnu_a_SOURCES += c32isspace.c
322
323EXTRA_DIST += c32is-impl.h
324
325## end gnulib module c32isspace
326
327## begin gnulib module c32isupper
328
329libgnu_a_SOURCES += c32isupper.c
330
331EXTRA_DIST += c32is-impl.h
332
333## end gnulib module c32isupper
334
335## begin gnulib module c32isxdigit
336
337libgnu_a_SOURCES += c32isxdigit.c
338
339EXTRA_DIST += c32is-impl.h
340
341## end gnulib module c32isxdigit
342
343## begin gnulib module c32tolower
344
345libgnu_a_SOURCES += c32tolower.c
346
347EXTRA_DIST += c32to-impl.h
348
349## end gnulib module c32tolower
350
351## begin gnulib module c32width
352
353libgnu_a_SOURCES += c32width.c
354
355## end gnulib module c32width
356
234## begin gnulib module calloc-gnu 357## begin gnulib module calloc-gnu
235 358
236 359
@@ -313,7 +436,7 @@ endif
313 436
314## end gnulib module dup2 437## end gnulib module dup2
315 438
316## begin gnulib module errno 439## begin gnulib module errno-h
317 440
318BUILT_SOURCES += $(ERRNO_H) 441BUILT_SOURCES += $(ERRNO_H)
319 442
@@ -327,12 +450,6 @@ errno.h: errno.in.h $(top_builddir)/config.status
327 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ 450 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
328 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ 451 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
329 -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \ 452 -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \
330 -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \
331 -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \
332 -e 's|@''ENOLINK_HIDDEN''@|$(ENOLINK_HIDDEN)|g' \
333 -e 's|@''ENOLINK_VALUE''@|$(ENOLINK_VALUE)|g' \
334 -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \
335 -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \
336 $(srcdir)/errno.in.h > $@-t 453 $(srcdir)/errno.in.h > $@-t
337 $(AM_V_at)mv $@-t $@ 454 $(AM_V_at)mv $@-t $@
338else 455else
@@ -343,7 +460,7 @@ MOSTLYCLEANFILES += errno.h errno.h-t
343 460
344EXTRA_DIST += errno.in.h 461EXTRA_DIST += errno.in.h
345 462
346## end gnulib module errno 463## end gnulib module errno-h
347 464
348## begin gnulib module error 465## begin gnulib module error
349 466
@@ -411,10 +528,12 @@ fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
411 -e 's/@''GNULIB_NONBLOCKING''@/$(GL_GNULIB_NONBLOCKING)/g' \ 528 -e 's/@''GNULIB_NONBLOCKING''@/$(GL_GNULIB_NONBLOCKING)/g' \
412 -e 's/@''GNULIB_OPEN''@/$(GL_GNULIB_OPEN)/g' \ 529 -e 's/@''GNULIB_OPEN''@/$(GL_GNULIB_OPEN)/g' \
413 -e 's/@''GNULIB_OPENAT''@/$(GL_GNULIB_OPENAT)/g' \ 530 -e 's/@''GNULIB_OPENAT''@/$(GL_GNULIB_OPENAT)/g' \
531 -e 's/@''GNULIB_OPENAT2''@/$(GL_GNULIB_OPENAT2)/g' \
414 -e 's/@''GNULIB_MDA_CREAT''@/$(GL_GNULIB_MDA_CREAT)/g' \ 532 -e 's/@''GNULIB_MDA_CREAT''@/$(GL_GNULIB_MDA_CREAT)/g' \
415 -e 's/@''GNULIB_MDA_OPEN''@/$(GL_GNULIB_MDA_OPEN)/g' \ 533 -e 's/@''GNULIB_MDA_OPEN''@/$(GL_GNULIB_MDA_OPEN)/g' \
416 -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \ 534 -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \
417 -e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \ 535 -e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \
536 -e 's|@''HAVE_OPENAT2''@|$(HAVE_OPENAT2)|g' \
418 -e 's|@''REPLACE_CREAT''@|$(REPLACE_CREAT)|g' \ 537 -e 's|@''REPLACE_CREAT''@|$(REPLACE_CREAT)|g' \
419 -e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \ 538 -e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \
420 -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \ 539 -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \
@@ -455,7 +574,7 @@ EXTRA_DIST += filename.h
455 574
456## end gnulib module filename 575## end gnulib module filename
457 576
458## begin gnulib module float 577## begin gnulib module float-h
459 578
460BUILT_SOURCES += $(FLOAT_H) 579BUILT_SOURCES += $(FLOAT_H)
461 580
@@ -487,7 +606,7 @@ endif
487 606
488EXTRA_DIST += float.in.h 607EXTRA_DIST += float.in.h
489 608
490## end gnulib module float 609## end gnulib module float-h
491 610
492## begin gnulib module floorf 611## begin gnulib module floorf
493 612
@@ -563,6 +682,16 @@ EXTRA_DIST += stdio-impl.h
563 682
564## end gnulib module fseeko 683## end gnulib module fseeko
565 684
685## begin gnulib module fseterr
686
687if GL_COND_OBJ_FSETERR
688libgnu_a_SOURCES += fseterr.c
689endif
690
691EXTRA_DIST += fseterr.h stdio-impl.h
692
693## end gnulib module fseterr
694
566## begin gnulib module fstat 695## begin gnulib module fstat
567 696
568if GL_COND_OBJ_FSTAT 697if GL_COND_OBJ_FSTAT
@@ -807,6 +936,14 @@ endif
807 936
808## end gnulib module inet_ntop 937## end gnulib module inet_ntop
809 938
939## begin gnulib module inet_pton
940
941if GL_COND_OBJ_INET_PTON
942libgnu_a_SOURCES += inet_pton.c
943endif
944
945## end gnulib module inet_pton
946
810## begin gnulib module intprops 947## begin gnulib module intprops
811 948
812 949
@@ -814,7 +951,7 @@ EXTRA_DIST += intprops-internal.h intprops.h
814 951
815## end gnulib module intprops 952## end gnulib module intprops
816 953
817## begin gnulib module inttypes-incomplete 954## begin gnulib module inttypes-h-incomplete
818 955
819BUILT_SOURCES += inttypes.h 956BUILT_SOURCES += inttypes.h
820 957
@@ -855,7 +992,7 @@ MOSTLYCLEANFILES += inttypes.h inttypes.h-t
855 992
856EXTRA_DIST += inttypes.in.h 993EXTRA_DIST += inttypes.in.h
857 994
858## end gnulib module inttypes-incomplete 995## end gnulib module inttypes-h-incomplete
859 996
860## begin gnulib module iswblank 997## begin gnulib module iswblank
861 998
@@ -899,7 +1036,7 @@ endif
899 1036
900## end gnulib module iswxdigit 1037## end gnulib module iswxdigit
901 1038
902## begin gnulib module langinfo 1039## begin gnulib module langinfo-h
903 1040
904BUILT_SOURCES += langinfo.h 1041BUILT_SOURCES += langinfo.h
905 1042
@@ -915,10 +1052,9 @@ langinfo.h: langinfo.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_U
915 -e 's|@''NEXT_LANGINFO_H''@|$(NEXT_LANGINFO_H)|g' \ 1052 -e 's|@''NEXT_LANGINFO_H''@|$(NEXT_LANGINFO_H)|g' \
916 -e 's/@''GNULIB_NL_LANGINFO''@/$(GL_GNULIB_NL_LANGINFO)/g' \ 1053 -e 's/@''GNULIB_NL_LANGINFO''@/$(GL_GNULIB_NL_LANGINFO)/g' \
917 -e 's|@''HAVE_LANGINFO_CODESET''@|$(HAVE_LANGINFO_CODESET)|g' \ 1054 -e 's|@''HAVE_LANGINFO_CODESET''@|$(HAVE_LANGINFO_CODESET)|g' \
918 -e 's|@''HAVE_LANGINFO_T_FMT_AMPM''@|$(HAVE_LANGINFO_T_FMT_AMPM)|g' \
919 -e 's|@''HAVE_LANGINFO_ALTMON''@|$(HAVE_LANGINFO_ALTMON)|g' \ 1055 -e 's|@''HAVE_LANGINFO_ALTMON''@|$(HAVE_LANGINFO_ALTMON)|g' \
1056 -e 's|@''HAVE_LANGINFO_ABALTMON''@|$(HAVE_LANGINFO_ABALTMON)|g' \
920 -e 's|@''HAVE_LANGINFO_ERA''@|$(HAVE_LANGINFO_ERA)|g' \ 1057 -e 's|@''HAVE_LANGINFO_ERA''@|$(HAVE_LANGINFO_ERA)|g' \
921 -e 's|@''HAVE_LANGINFO_YESEXPR''@|$(HAVE_LANGINFO_YESEXPR)|g' \
922 -e 's|@''HAVE_NL_LANGINFO''@|$(HAVE_NL_LANGINFO)|g' \ 1058 -e 's|@''HAVE_NL_LANGINFO''@|$(HAVE_NL_LANGINFO)|g' \
923 -e 's|@''REPLACE_NL_LANGINFO''@|$(REPLACE_NL_LANGINFO)|g' \ 1059 -e 's|@''REPLACE_NL_LANGINFO''@|$(REPLACE_NL_LANGINFO)|g' \
924 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ 1060 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
@@ -929,7 +1065,7 @@ MOSTLYCLEANFILES += langinfo.h langinfo.h-t
929 1065
930EXTRA_DIST += langinfo.in.h 1066EXTRA_DIST += langinfo.in.h
931 1067
932## end gnulib module langinfo 1068## end gnulib module langinfo-h
933 1069
934## begin gnulib module libc-config 1070## begin gnulib module libc-config
935 1071
@@ -972,7 +1108,7 @@ EXTRA_DIST += localcharset.h
972 1108
973## end gnulib module localcharset 1109## end gnulib module localcharset
974 1110
975## begin gnulib module locale 1111## begin gnulib module locale-h
976 1112
977BUILT_SOURCES += locale.h 1113BUILT_SOURCES += locale.h
978 1114
@@ -985,20 +1121,28 @@ locale.h: locale.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
985 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ 1121 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
986 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ 1122 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
987 -e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \ 1123 -e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \
1124 -e 's|@''HAVE_LOCALE_T''@|$(HAVE_LOCALE_T)|g' \
1125 -e 's|@''HAVE_WINDOWS_LOCALE_T''@|$(HAVE_WINDOWS_LOCALE_T)|g' \
988 -e 's/@''GNULIB_LOCALECONV''@/$(GL_GNULIB_LOCALECONV)/g' \ 1126 -e 's/@''GNULIB_LOCALECONV''@/$(GL_GNULIB_LOCALECONV)/g' \
989 -e 's/@''GNULIB_SETLOCALE''@/$(GL_GNULIB_SETLOCALE)/g' \ 1127 -e 's/@''GNULIB_SETLOCALE''@/$(GL_GNULIB_SETLOCALE)/g' \
990 -e 's/@''GNULIB_SETLOCALE_NULL''@/$(GL_GNULIB_SETLOCALE_NULL)/g' \ 1128 -e 's/@''GNULIB_SETLOCALE_NULL''@/$(GL_GNULIB_SETLOCALE_NULL)/g' \
1129 -e 's/@''GNULIB_NEWLOCALE''@/$(GL_GNULIB_NEWLOCALE)/g' \
991 -e 's/@''GNULIB_DUPLOCALE''@/$(GL_GNULIB_DUPLOCALE)/g' \ 1130 -e 's/@''GNULIB_DUPLOCALE''@/$(GL_GNULIB_DUPLOCALE)/g' \
1131 -e 's/@''GNULIB_FREELOCALE''@/$(GL_GNULIB_FREELOCALE)/g' \
1132 -e 's/@''GNULIB_GETLOCALENAME_L''@/$(GL_GNULIB_GETLOCALENAME_L)/g' \
1133 -e 's/@''GNULIB_GETLOCALENAME_L_UNSAFE''@/$(GL_GNULIB_GETLOCALENAME_L_UNSAFE)/g' \
992 -e 's/@''GNULIB_LOCALENAME_UNSAFE''@/$(GL_GNULIB_LOCALENAME_UNSAFE)/g' \ 1134 -e 's/@''GNULIB_LOCALENAME_UNSAFE''@/$(GL_GNULIB_LOCALENAME_UNSAFE)/g' \
993 -e 's|@''HAVE_NEWLOCALE''@|$(HAVE_NEWLOCALE)|g' \ 1135 -e 's|@''HAVE_NEWLOCALE''@|$(HAVE_NEWLOCALE)|g' \
994 -e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \ 1136 -e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \
995 -e 's|@''HAVE_FREELOCALE''@|$(HAVE_FREELOCALE)|g' \ 1137 -e 's|@''HAVE_FREELOCALE''@|$(HAVE_FREELOCALE)|g' \
1138 -e 's|@''HAVE_GETLOCALENAME_L''@|$(HAVE_GETLOCALENAME_L)|g' \
996 -e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \ 1139 -e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \
997 -e 's|@''REPLACE_LOCALECONV''@|$(REPLACE_LOCALECONV)|g' \ 1140 -e 's|@''REPLACE_LOCALECONV''@|$(REPLACE_LOCALECONV)|g' \
998 -e 's|@''REPLACE_SETLOCALE''@|$(REPLACE_SETLOCALE)|g' \ 1141 -e 's|@''REPLACE_SETLOCALE''@|$(REPLACE_SETLOCALE)|g' \
999 -e 's|@''REPLACE_NEWLOCALE''@|$(REPLACE_NEWLOCALE)|g' \ 1142 -e 's|@''REPLACE_NEWLOCALE''@|$(REPLACE_NEWLOCALE)|g' \
1000 -e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \ 1143 -e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \
1001 -e 's|@''REPLACE_FREELOCALE''@|$(REPLACE_FREELOCALE)|g' \ 1144 -e 's|@''REPLACE_FREELOCALE''@|$(REPLACE_FREELOCALE)|g' \
1145 -e 's|@''REPLACE_GETLOCALENAME_L''@|$(REPLACE_GETLOCALENAME_L)|g' \
1002 -e 's|@''REPLACE_STRUCT_LCONV''@|$(REPLACE_STRUCT_LCONV)|g' \ 1146 -e 's|@''REPLACE_STRUCT_LCONV''@|$(REPLACE_STRUCT_LCONV)|g' \
1003 -e 's|@''LOCALENAME_ENHANCE_LOCALE_FUNCS''@|$(LOCALENAME_ENHANCE_LOCALE_FUNCS)|g' \ 1147 -e 's|@''LOCALENAME_ENHANCE_LOCALE_FUNCS''@|$(LOCALENAME_ENHANCE_LOCALE_FUNCS)|g' \
1004 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ 1148 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
@@ -1010,7 +1154,7 @@ MOSTLYCLEANFILES += locale.h locale.h-t
1010 1154
1011EXTRA_DIST += locale.in.h 1155EXTRA_DIST += locale.in.h
1012 1156
1013## end gnulib module locale 1157## end gnulib module locale-h
1014 1158
1015## begin gnulib module localeconv 1159## begin gnulib module localeconv
1016 1160
@@ -1034,6 +1178,14 @@ endif
1034 1178
1035## end gnulib module lseek 1179## end gnulib module lseek
1036 1180
1181## begin gnulib module lstat
1182
1183if GL_COND_OBJ_LSTAT
1184libgnu_a_SOURCES += lstat.c
1185endif
1186
1187## end gnulib module lstat
1188
1037## begin gnulib module malloc-gnu 1189## begin gnulib module malloc-gnu
1038 1190
1039 1191
@@ -1060,7 +1212,7 @@ EXTRA_DIST += malloca.h
1060 1212
1061## end gnulib module malloca 1213## end gnulib module malloca
1062 1214
1063## begin gnulib module math 1215## begin gnulib module math-h
1064 1216
1065BUILT_SOURCES += math.h 1217BUILT_SOURCES += math.h
1066libgnu_a_SOURCES += math.c 1218libgnu_a_SOURCES += math.c
@@ -1127,8 +1279,11 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
1127 -e 's/@''GNULIB_ILOGBF''@/$(GL_GNULIB_ILOGBF)/g' \ 1279 -e 's/@''GNULIB_ILOGBF''@/$(GL_GNULIB_ILOGBF)/g' \
1128 -e 's/@''GNULIB_ILOGBL''@/$(GL_GNULIB_ILOGBL)/g' \ 1280 -e 's/@''GNULIB_ILOGBL''@/$(GL_GNULIB_ILOGBL)/g' \
1129 -e 's/@''GNULIB_ISFINITE''@/$(GL_GNULIB_ISFINITE)/g' \ 1281 -e 's/@''GNULIB_ISFINITE''@/$(GL_GNULIB_ISFINITE)/g' \
1282 -e 's/@''GNULIB_ISFINITE_NO_CXX''@/$(GL_GNULIB_ISFINITE_NO_CXX)/g' \
1130 -e 's/@''GNULIB_ISINF''@/$(GL_GNULIB_ISINF)/g' \ 1283 -e 's/@''GNULIB_ISINF''@/$(GL_GNULIB_ISINF)/g' \
1284 -e 's/@''GNULIB_ISINF_NO_CXX''@/$(GL_GNULIB_ISINF_NO_CXX)/g' \
1131 -e 's/@''GNULIB_ISNAN''@/$(GL_GNULIB_ISNAN)/g' \ 1285 -e 's/@''GNULIB_ISNAN''@/$(GL_GNULIB_ISNAN)/g' \
1286 -e 's/@''GNULIB_ISNAN_NO_CXX''@/$(GL_GNULIB_ISNAN_NO_CXX)/g' \
1132 -e 's/@''GNULIB_ISNANF''@/$(GL_GNULIB_ISNANF)/g' \ 1287 -e 's/@''GNULIB_ISNANF''@/$(GL_GNULIB_ISNANF)/g' \
1133 -e 's/@''GNULIB_ISNAND''@/$(GL_GNULIB_ISNAND)/g' \ 1288 -e 's/@''GNULIB_ISNAND''@/$(GL_GNULIB_ISNAND)/g' \
1134 -e 's/@''GNULIB_ISNANL''@/$(GL_GNULIB_ISNANL)/g' \ 1289 -e 's/@''GNULIB_ISNANL''@/$(GL_GNULIB_ISNANL)/g' \
@@ -1150,6 +1305,9 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
1150 -e 's/@''GNULIB_LOGB''@/$(GL_GNULIB_LOGB)/g' \ 1305 -e 's/@''GNULIB_LOGB''@/$(GL_GNULIB_LOGB)/g' \
1151 -e 's/@''GNULIB_LOGBF''@/$(GL_GNULIB_LOGBF)/g' \ 1306 -e 's/@''GNULIB_LOGBF''@/$(GL_GNULIB_LOGBF)/g' \
1152 -e 's/@''GNULIB_LOGBL''@/$(GL_GNULIB_LOGBL)/g' \ 1307 -e 's/@''GNULIB_LOGBL''@/$(GL_GNULIB_LOGBL)/g' \
1308 -e 's/@''GNULIB_LOGP1''@/$(GL_GNULIB_LOGP1)/g' \
1309 -e 's/@''GNULIB_LOGP1F''@/$(GL_GNULIB_LOGP1F)/g' \
1310 -e 's/@''GNULIB_LOGP1L''@/$(GL_GNULIB_LOGP1L)/g' \
1153 -e 's/@''GNULIB_MODF''@/$(GL_GNULIB_MODF)/g' \ 1311 -e 's/@''GNULIB_MODF''@/$(GL_GNULIB_MODF)/g' \
1154 -e 's/@''GNULIB_MODFF''@/$(GL_GNULIB_MODFF)/g' \ 1312 -e 's/@''GNULIB_MODFF''@/$(GL_GNULIB_MODFF)/g' \
1155 -e 's/@''GNULIB_MODFL''@/$(GL_GNULIB_MODFL)/g' \ 1313 -e 's/@''GNULIB_MODFL''@/$(GL_GNULIB_MODFL)/g' \
@@ -1170,6 +1328,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
1170 -e 's/@''GNULIB_SETPAYLOADSIGF''@/$(GL_GNULIB_SETPAYLOADSIGF)/g' \ 1328 -e 's/@''GNULIB_SETPAYLOADSIGF''@/$(GL_GNULIB_SETPAYLOADSIGF)/g' \
1171 -e 's/@''GNULIB_SETPAYLOADSIGL''@/$(GL_GNULIB_SETPAYLOADSIGL)/g' \ 1329 -e 's/@''GNULIB_SETPAYLOADSIGL''@/$(GL_GNULIB_SETPAYLOADSIGL)/g' \
1172 -e 's/@''GNULIB_SIGNBIT''@/$(GL_GNULIB_SIGNBIT)/g' \ 1330 -e 's/@''GNULIB_SIGNBIT''@/$(GL_GNULIB_SIGNBIT)/g' \
1331 -e 's/@''GNULIB_SIGNBIT_NO_CXX''@/$(GL_GNULIB_SIGNBIT_NO_CXX)/g' \
1173 -e 's/@''GNULIB_SINF''@/$(GL_GNULIB_SINF)/g' \ 1332 -e 's/@''GNULIB_SINF''@/$(GL_GNULIB_SINF)/g' \
1174 -e 's/@''GNULIB_SINL''@/$(GL_GNULIB_SINL)/g' \ 1333 -e 's/@''GNULIB_SINL''@/$(GL_GNULIB_SINL)/g' \
1175 -e 's/@''GNULIB_SINHF''@/$(GL_GNULIB_SINHF)/g' \ 1334 -e 's/@''GNULIB_SINHF''@/$(GL_GNULIB_SINHF)/g' \
@@ -1206,14 +1365,19 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
1206 -e 's|@''HAVE_CBRTF''@|$(HAVE_CBRTF)|g' \ 1365 -e 's|@''HAVE_CBRTF''@|$(HAVE_CBRTF)|g' \
1207 -e 's|@''HAVE_CBRTL''@|$(HAVE_CBRTL)|g' \ 1366 -e 's|@''HAVE_CBRTL''@|$(HAVE_CBRTL)|g' \
1208 -e 's|@''HAVE_COPYSIGN''@|$(HAVE_COPYSIGN)|g' \ 1367 -e 's|@''HAVE_COPYSIGN''@|$(HAVE_COPYSIGN)|g' \
1368 -e 's|@''HAVE_COPYSIGNF''@|$(HAVE_COPYSIGNF)|g' \
1209 -e 's|@''HAVE_COPYSIGNL''@|$(HAVE_COPYSIGNL)|g' \ 1369 -e 's|@''HAVE_COPYSIGNL''@|$(HAVE_COPYSIGNL)|g' \
1210 -e 's|@''HAVE_COSF''@|$(HAVE_COSF)|g' \ 1370 -e 's|@''HAVE_COSF''@|$(HAVE_COSF)|g' \
1211 -e 's|@''HAVE_COSL''@|$(HAVE_COSL)|g' \ 1371 -e 's|@''HAVE_COSL''@|$(HAVE_COSL)|g' \
1212 -e 's|@''HAVE_COSHF''@|$(HAVE_COSHF)|g' \ 1372 -e 's|@''HAVE_COSHF''@|$(HAVE_COSHF)|g' \
1213 -e 's|@''HAVE_EXPF''@|$(HAVE_EXPF)|g' \ 1373 -e 's|@''HAVE_EXPF''@|$(HAVE_EXPF)|g' \
1214 -e 's|@''HAVE_EXPL''@|$(HAVE_EXPL)|g' \ 1374 -e 's|@''HAVE_EXPL''@|$(HAVE_EXPL)|g' \
1375 -e 's|@''HAVE_EXP2''@|$(HAVE_EXP2)|g' \
1376 -e 's|@''HAVE_EXP2F''@|$(HAVE_EXP2F)|g' \
1377 -e 's|@''HAVE_EXP2L''@|$(HAVE_EXP2L)|g' \
1215 -e 's|@''HAVE_EXPM1''@|$(HAVE_EXPM1)|g' \ 1378 -e 's|@''HAVE_EXPM1''@|$(HAVE_EXPM1)|g' \
1216 -e 's|@''HAVE_EXPM1F''@|$(HAVE_EXPM1F)|g' \ 1379 -e 's|@''HAVE_EXPM1F''@|$(HAVE_EXPM1F)|g' \
1380 -e 's|@''HAVE_EXPM1L''@|$(HAVE_EXPM1L)|g' \
1217 -e 's|@''HAVE_FABSF''@|$(HAVE_FABSF)|g' \ 1381 -e 's|@''HAVE_FABSF''@|$(HAVE_FABSF)|g' \
1218 -e 's|@''HAVE_FABSL''@|$(HAVE_FABSL)|g' \ 1382 -e 's|@''HAVE_FABSL''@|$(HAVE_FABSL)|g' \
1219 -e 's|@''HAVE_FMA''@|$(HAVE_FMA)|g' \ 1383 -e 's|@''HAVE_FMA''@|$(HAVE_FMA)|g' \
@@ -1241,15 +1405,26 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
1241 -e 's|@''HAVE_LOG1P''@|$(HAVE_LOG1P)|g' \ 1405 -e 's|@''HAVE_LOG1P''@|$(HAVE_LOG1P)|g' \
1242 -e 's|@''HAVE_LOG1PF''@|$(HAVE_LOG1PF)|g' \ 1406 -e 's|@''HAVE_LOG1PF''@|$(HAVE_LOG1PF)|g' \
1243 -e 's|@''HAVE_LOG1PL''@|$(HAVE_LOG1PL)|g' \ 1407 -e 's|@''HAVE_LOG1PL''@|$(HAVE_LOG1PL)|g' \
1408 -e 's|@''HAVE_LOG2''@|$(HAVE_LOG2)|g' \
1409 -e 's|@''HAVE_LOG2F''@|$(HAVE_LOG2F)|g' \
1410 -e 's|@''HAVE_LOG2L''@|$(HAVE_LOG2L)|g' \
1244 -e 's|@''HAVE_LOGBF''@|$(HAVE_LOGBF)|g' \ 1411 -e 's|@''HAVE_LOGBF''@|$(HAVE_LOGBF)|g' \
1245 -e 's|@''HAVE_LOGBL''@|$(HAVE_LOGBL)|g' \ 1412 -e 's|@''HAVE_LOGBL''@|$(HAVE_LOGBL)|g' \
1413 -e 's|@''HAVE_LOGP1''@|$(HAVE_LOGP1)|g' \
1414 -e 's|@''HAVE_LOGP1F''@|$(HAVE_LOGP1F)|g' \
1415 -e 's|@''HAVE_LOGP1L''@|$(HAVE_LOGP1L)|g' \
1246 -e 's|@''HAVE_MODFF''@|$(HAVE_MODFF)|g' \ 1416 -e 's|@''HAVE_MODFF''@|$(HAVE_MODFF)|g' \
1247 -e 's|@''HAVE_MODFL''@|$(HAVE_MODFL)|g' \ 1417 -e 's|@''HAVE_MODFL''@|$(HAVE_MODFL)|g' \
1248 -e 's|@''HAVE_POWF''@|$(HAVE_POWF)|g' \ 1418 -e 's|@''HAVE_POWF''@|$(HAVE_POWF)|g' \
1249 -e 's|@''HAVE_REMAINDER''@|$(HAVE_REMAINDER)|g' \ 1419 -e 's|@''HAVE_REMAINDER''@|$(HAVE_REMAINDER)|g' \
1250 -e 's|@''HAVE_REMAINDERF''@|$(HAVE_REMAINDERF)|g' \ 1420 -e 's|@''HAVE_REMAINDERF''@|$(HAVE_REMAINDERF)|g' \
1421 -e 's|@''HAVE_REMAINDERL''@|$(HAVE_REMAINDERL)|g' \
1251 -e 's|@''HAVE_RINT''@|$(HAVE_RINT)|g' \ 1422 -e 's|@''HAVE_RINT''@|$(HAVE_RINT)|g' \
1423 -e 's|@''HAVE_RINTF''@|$(HAVE_RINTF)|g' \
1252 -e 's|@''HAVE_RINTL''@|$(HAVE_RINTL)|g' \ 1424 -e 's|@''HAVE_RINTL''@|$(HAVE_RINTL)|g' \
1425 -e 's|@''HAVE_ROUND''@|$(HAVE_ROUND)|g' \
1426 -e 's|@''HAVE_ROUNDF''@|$(HAVE_ROUNDF)|g' \
1427 -e 's|@''HAVE_ROUNDL''@|$(HAVE_ROUNDL)|g' \
1253 -e 's|@''HAVE_SETPAYLOAD''@|$(HAVE_SETPAYLOAD)|g' \ 1428 -e 's|@''HAVE_SETPAYLOAD''@|$(HAVE_SETPAYLOAD)|g' \
1254 -e 's|@''HAVE_SETPAYLOADF''@|$(HAVE_SETPAYLOADF)|g' \ 1429 -e 's|@''HAVE_SETPAYLOADF''@|$(HAVE_SETPAYLOADF)|g' \
1255 -e 's|@''HAVE_SETPAYLOADL''@|$(HAVE_SETPAYLOADL)|g' \ 1430 -e 's|@''HAVE_SETPAYLOADL''@|$(HAVE_SETPAYLOADL)|g' \
@@ -1275,33 +1450,17 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
1275 -e 's|@''HAVE_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \ 1450 -e 's|@''HAVE_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \
1276 -e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \ 1451 -e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \
1277 -e 's|@''HAVE_DECL_ATANL''@|$(HAVE_DECL_ATANL)|g' \ 1452 -e 's|@''HAVE_DECL_ATANL''@|$(HAVE_DECL_ATANL)|g' \
1278 -e 's|@''HAVE_DECL_CBRTF''@|$(HAVE_DECL_CBRTF)|g' \
1279 -e 's|@''HAVE_DECL_CBRTL''@|$(HAVE_DECL_CBRTL)|g' \
1280 -e 's|@''HAVE_DECL_CEILF''@|$(HAVE_DECL_CEILF)|g' \ 1453 -e 's|@''HAVE_DECL_CEILF''@|$(HAVE_DECL_CEILF)|g' \
1281 -e 's|@''HAVE_DECL_CEILL''@|$(HAVE_DECL_CEILL)|g' \ 1454 -e 's|@''HAVE_DECL_CEILL''@|$(HAVE_DECL_CEILL)|g' \
1282 -e 's|@''HAVE_DECL_COPYSIGNF''@|$(HAVE_DECL_COPYSIGNF)|g' \
1283 -e 's|@''HAVE_DECL_COSL''@|$(HAVE_DECL_COSL)|g' \ 1455 -e 's|@''HAVE_DECL_COSL''@|$(HAVE_DECL_COSL)|g' \
1284 -e 's|@''HAVE_DECL_EXPL''@|$(HAVE_DECL_EXPL)|g' \ 1456 -e 's|@''HAVE_DECL_EXPL''@|$(HAVE_DECL_EXPL)|g' \
1285 -e 's|@''HAVE_DECL_EXP2''@|$(HAVE_DECL_EXP2)|g' \
1286 -e 's|@''HAVE_DECL_EXP2F''@|$(HAVE_DECL_EXP2F)|g' \
1287 -e 's|@''HAVE_DECL_EXP2L''@|$(HAVE_DECL_EXP2L)|g' \
1288 -e 's|@''HAVE_DECL_EXPM1L''@|$(HAVE_DECL_EXPM1L)|g' \
1289 -e 's|@''HAVE_DECL_FLOORF''@|$(HAVE_DECL_FLOORF)|g' \ 1457 -e 's|@''HAVE_DECL_FLOORF''@|$(HAVE_DECL_FLOORF)|g' \
1290 -e 's|@''HAVE_DECL_FLOORL''@|$(HAVE_DECL_FLOORL)|g' \ 1458 -e 's|@''HAVE_DECL_FLOORL''@|$(HAVE_DECL_FLOORL)|g' \
1291 -e 's|@''HAVE_DECL_FREXPL''@|$(HAVE_DECL_FREXPL)|g' \ 1459 -e 's|@''HAVE_DECL_FREXPL''@|$(HAVE_DECL_FREXPL)|g' \
1292 -e 's|@''HAVE_DECL_LDEXPL''@|$(HAVE_DECL_LDEXPL)|g' \ 1460 -e 's|@''HAVE_DECL_LDEXPL''@|$(HAVE_DECL_LDEXPL)|g' \
1293 -e 's|@''HAVE_DECL_LOGL''@|$(HAVE_DECL_LOGL)|g' \ 1461 -e 's|@''HAVE_DECL_LOGL''@|$(HAVE_DECL_LOGL)|g' \
1294 -e 's|@''HAVE_DECL_LOG10L''@|$(HAVE_DECL_LOG10L)|g' \ 1462 -e 's|@''HAVE_DECL_LOG10L''@|$(HAVE_DECL_LOG10L)|g' \
1295 -e 's|@''HAVE_DECL_LOG2''@|$(HAVE_DECL_LOG2)|g' \
1296 -e 's|@''HAVE_DECL_LOG2F''@|$(HAVE_DECL_LOG2F)|g' \
1297 -e 's|@''HAVE_DECL_LOG2L''@|$(HAVE_DECL_LOG2L)|g' \
1298 -e 's|@''HAVE_DECL_LOGB''@|$(HAVE_DECL_LOGB)|g' \ 1463 -e 's|@''HAVE_DECL_LOGB''@|$(HAVE_DECL_LOGB)|g' \
1299 -e 's|@''HAVE_DECL_REMAINDER''@|$(HAVE_DECL_REMAINDER)|g' \
1300 -e 's|@''HAVE_DECL_REMAINDERL''@|$(HAVE_DECL_REMAINDERL)|g' \
1301 -e 's|@''HAVE_DECL_RINTF''@|$(HAVE_DECL_RINTF)|g' \
1302 -e 's|@''HAVE_DECL_ROUND''@|$(HAVE_DECL_ROUND)|g' \
1303 -e 's|@''HAVE_DECL_ROUNDF''@|$(HAVE_DECL_ROUNDF)|g' \
1304 -e 's|@''HAVE_DECL_ROUNDL''@|$(HAVE_DECL_ROUNDL)|g' \
1305 -e 's|@''HAVE_DECL_SINL''@|$(HAVE_DECL_SINL)|g' \ 1464 -e 's|@''HAVE_DECL_SINL''@|$(HAVE_DECL_SINL)|g' \
1306 -e 's|@''HAVE_DECL_SQRTL''@|$(HAVE_DECL_SQRTL)|g' \ 1465 -e 's|@''HAVE_DECL_SQRTL''@|$(HAVE_DECL_SQRTL)|g' \
1307 -e 's|@''HAVE_DECL_TANL''@|$(HAVE_DECL_TANL)|g' \ 1466 -e 's|@''HAVE_DECL_TANL''@|$(HAVE_DECL_TANL)|g' \
@@ -1389,6 +1548,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
1389 -e 's|@''REPLACE_SIGNBIT_USING_BUILTINS''@|$(REPLACE_SIGNBIT_USING_BUILTINS)|g' \ 1548 -e 's|@''REPLACE_SIGNBIT_USING_BUILTINS''@|$(REPLACE_SIGNBIT_USING_BUILTINS)|g' \
1390 -e 's|@''REPLACE_SINF''@|$(REPLACE_SINF)|g' \ 1549 -e 's|@''REPLACE_SINF''@|$(REPLACE_SINF)|g' \
1391 -e 's|@''REPLACE_SINHF''@|$(REPLACE_SINHF)|g' \ 1550 -e 's|@''REPLACE_SINHF''@|$(REPLACE_SINHF)|g' \
1551 -e 's|@''REPLACE_SINL''@|$(REPLACE_SINL)|g' \
1392 -e 's|@''REPLACE_SQRTF''@|$(REPLACE_SQRTF)|g' \ 1552 -e 's|@''REPLACE_SQRTF''@|$(REPLACE_SQRTF)|g' \
1393 -e 's|@''REPLACE_SQRTL''@|$(REPLACE_SQRTL)|g' \ 1553 -e 's|@''REPLACE_SQRTL''@|$(REPLACE_SQRTL)|g' \
1394 -e 's|@''REPLACE_TANF''@|$(REPLACE_TANF)|g' \ 1554 -e 's|@''REPLACE_TANF''@|$(REPLACE_TANF)|g' \
@@ -1412,7 +1572,33 @@ MOSTLYCLEANFILES += math.h math.h-t1 math.h-t2 math.h-t3 math.h-t4 math.h-t5 mat
1412 1572
1413EXTRA_DIST += math.in.h 1573EXTRA_DIST += math.in.h
1414 1574
1415## end gnulib module math 1575## end gnulib module math-h
1576
1577## begin gnulib module mbchar
1578
1579libgnu_a_SOURCES += mbchar.c
1580
1581EXTRA_DIST += mbchar.h
1582
1583## end gnulib module mbchar
1584
1585## begin gnulib module mbiterf
1586
1587libgnu_a_SOURCES += mbiterf.h mbiterf.c
1588
1589## end gnulib module mbiterf
1590
1591## begin gnulib module mbrtoc32
1592
1593if GL_COND_OBJ_MBRTOC32
1594libgnu_a_SOURCES += mbrtoc32.c
1595endif
1596
1597EXTRA_DIST += lc-charset-dispatch.c lc-charset-dispatch.h mbrtowc-impl-utf8.h mbrtowc-impl.h mbtowc-lock.c mbtowc-lock.h windows-initguard.h
1598
1599EXTRA_libgnu_a_SOURCES += lc-charset-dispatch.c mbtowc-lock.c
1600
1601## end gnulib module mbrtoc32
1416 1602
1417## begin gnulib module mbrtowc 1603## begin gnulib module mbrtowc
1418 1604
@@ -1434,6 +1620,12 @@ endif
1434 1620
1435## end gnulib module mbsinit 1621## end gnulib module mbsinit
1436 1622
1623## begin gnulib module mbsnlen
1624
1625libgnu_a_SOURCES += mbsnlen.c
1626
1627## end gnulib module mbsnlen
1628
1437## begin gnulib module mbszero 1629## begin gnulib module mbszero
1438 1630
1439libgnu_a_SOURCES += mbszero.c 1631libgnu_a_SOURCES += mbszero.c
@@ -1486,9 +1678,7 @@ EXTRA_libgnu_a_SOURCES += mktime.c
1486 1678
1487## begin gnulib module mountlist 1679## begin gnulib module mountlist
1488 1680
1489if GL_COND_OBJ_MOUNTLIST
1490libgnu_a_SOURCES += mountlist.c 1681libgnu_a_SOURCES += mountlist.c
1491endif
1492 1682
1493EXTRA_DIST += mountlist.h 1683EXTRA_DIST += mountlist.h
1494 1684
@@ -1514,7 +1704,7 @@ EXTRA_DIST += msvc-nothrow.h
1514 1704
1515## end gnulib module msvc-nothrow 1705## end gnulib module msvc-nothrow
1516 1706
1517## begin gnulib module netdb 1707## begin gnulib module netdb-h
1518 1708
1519BUILT_SOURCES += netdb.h 1709BUILT_SOURCES += netdb.h
1520 1710
@@ -1545,9 +1735,9 @@ MOSTLYCLEANFILES += netdb.h netdb.h-t
1545 1735
1546EXTRA_DIST += netdb.in.h 1736EXTRA_DIST += netdb.in.h
1547 1737
1548## end gnulib module netdb 1738## end gnulib module netdb-h
1549 1739
1550## begin gnulib module netinet_in 1740## begin gnulib module netinet_in-h
1551 1741
1552BUILT_SOURCES += $(NETINET_IN_H) 1742BUILT_SOURCES += $(NETINET_IN_H)
1553 1743
@@ -1574,7 +1764,7 @@ MOSTLYCLEANDIRS += netinet
1574 1764
1575EXTRA_DIST += netinet_in.in.h 1765EXTRA_DIST += netinet_in.in.h
1576 1766
1577## end gnulib module netinet_in 1767## end gnulib module netinet_in-h
1578 1768
1579## begin gnulib module nl_langinfo 1769## begin gnulib module nl_langinfo
1580 1770
@@ -1589,6 +1779,12 @@ EXTRA_DIST += windows-initguard.h
1589 1779
1590## end gnulib module nl_langinfo 1780## end gnulib module nl_langinfo
1591 1781
1782## begin gnulib module once
1783
1784libgnu_a_SOURCES += glthread/once.h glthread/once.c
1785
1786## end gnulib module once
1787
1592## begin gnulib module open 1788## begin gnulib module open
1593 1789
1594if GL_COND_OBJ_OPEN 1790if GL_COND_OBJ_OPEN
@@ -1604,21 +1800,168 @@ EXTRA_DIST += pathmax.h
1604 1800
1605## end gnulib module pathmax 1801## end gnulib module pathmax
1606 1802
1607## begin gnulib module realloc-gnu 1803## begin gnulib module pthread-h
1608 1804
1805BUILT_SOURCES += pthread.h
1609 1806
1610EXTRA_DIST += realloc.c 1807# We need the following in order to create <pthread.h> when the system
1808# doesn't have one that works with the given compiler.
1809pthread.h: pthread.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
1810 $(gl_V_at)$(SED_HEADER_STDOUT) \
1811 -e 's|@''GUARD_PREFIX''@|GL|g' \
1812 -e 's|@''HAVE_PTHREAD_H''@|$(HAVE_PTHREAD_H)|g' \
1813 -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
1814 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
1815 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
1816 -e 's|@''NEXT_PTHREAD_H''@|$(NEXT_PTHREAD_H)|g' \
1817 -e 's/@''GNULIB_PTHREAD_THREAD''@/$(GL_GNULIB_PTHREAD_THREAD)/g' \
1818 -e 's/@''GNULIB_PTHREAD_ONCE''@/$(GL_GNULIB_PTHREAD_ONCE)/g' \
1819 -e 's/@''GNULIB_PTHREAD_MUTEX''@/$(GL_GNULIB_PTHREAD_MUTEX)/g' \
1820 -e 's/@''GNULIB_PTHREAD_RWLOCK''@/$(GL_GNULIB_PTHREAD_RWLOCK)/g' \
1821 -e 's/@''GNULIB_PTHREAD_COND''@/$(GL_GNULIB_PTHREAD_COND)/g' \
1822 -e 's/@''GNULIB_PTHREAD_TSS''@/$(GL_GNULIB_PTHREAD_TSS)/g' \
1823 -e 's/@''GNULIB_PTHREAD_SPIN''@/$(GL_GNULIB_PTHREAD_SPIN)/g' \
1824 -e 's/@''GNULIB_PTHREAD_MUTEX_TIMEDLOCK''@/$(GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK)/g' \
1825 -e 's|@''HAVE_PTHREAD_T''@|$(HAVE_PTHREAD_T)|g' \
1826 -e 's|@''HAVE_PTHREAD_SPINLOCK_T''@|$(HAVE_PTHREAD_SPINLOCK_T)|g' \
1827 -e 's|@''HAVE_PTHREAD_CREATE_DETACHED''@|$(HAVE_PTHREAD_CREATE_DETACHED)|g' \
1828 -e 's|@''HAVE_PTHREAD_MUTEX_RECURSIVE''@|$(HAVE_PTHREAD_MUTEX_RECURSIVE)|g' \
1829 -e 's|@''HAVE_PTHREAD_MUTEX_ROBUST''@|$(HAVE_PTHREAD_MUTEX_ROBUST)|g' \
1830 -e 's|@''HAVE_PTHREAD_PROCESS_SHARED''@|$(HAVE_PTHREAD_PROCESS_SHARED)|g' \
1831 -e 's|@''HAVE_PTHREAD_CREATE''@|$(HAVE_PTHREAD_CREATE)|g' \
1832 -e 's|@''HAVE_PTHREAD_ATTR_INIT''@|$(HAVE_PTHREAD_ATTR_INIT)|g' \
1833 -e 's|@''HAVE_PTHREAD_ATTR_GETDETACHSTATE''@|$(HAVE_PTHREAD_ATTR_GETDETACHSTATE)|g' \
1834 -e 's|@''HAVE_PTHREAD_ATTR_SETDETACHSTATE''@|$(HAVE_PTHREAD_ATTR_SETDETACHSTATE)|g' \
1835 -e 's|@''HAVE_PTHREAD_ATTR_DESTROY''@|$(HAVE_PTHREAD_ATTR_DESTROY)|g' \
1836 -e 's|@''HAVE_PTHREAD_SELF''@|$(HAVE_PTHREAD_SELF)|g' \
1837 -e 's|@''HAVE_PTHREAD_EQUAL''@|$(HAVE_PTHREAD_EQUAL)|g' \
1838 -e 's|@''HAVE_PTHREAD_DETACH''@|$(HAVE_PTHREAD_DETACH)|g' \
1839 -e 's|@''HAVE_PTHREAD_JOIN''@|$(HAVE_PTHREAD_JOIN)|g' \
1840 -e 's|@''HAVE_PTHREAD_EXIT''@|$(HAVE_PTHREAD_EXIT)|g' \
1841 < $(srcdir)/pthread.in.h > $@-t1
1842 $(AM_V_at)sed \
1843 -e 's|@''HAVE_PTHREAD_ONCE''@|$(HAVE_PTHREAD_ONCE)|g' \
1844 -e 's|@''HAVE_PTHREAD_MUTEX_INIT''@|$(HAVE_PTHREAD_MUTEX_INIT)|g' \
1845 -e 's|@''HAVE_PTHREAD_MUTEXATTR_INIT''@|$(HAVE_PTHREAD_MUTEXATTR_INIT)|g' \
1846 -e 's|@''HAVE_PTHREAD_MUTEXATTR_GETTYPE''@|$(HAVE_PTHREAD_MUTEXATTR_GETTYPE)|g' \
1847 -e 's|@''HAVE_PTHREAD_MUTEXATTR_SETTYPE''@|$(HAVE_PTHREAD_MUTEXATTR_SETTYPE)|g' \
1848 -e 's|@''HAVE_PTHREAD_MUTEXATTR_GETROBUST''@|$(HAVE_PTHREAD_MUTEXATTR_GETROBUST)|g' \
1849 -e 's|@''HAVE_PTHREAD_MUTEXATTR_SETROBUST''@|$(HAVE_PTHREAD_MUTEXATTR_SETROBUST)|g' \
1850 -e 's|@''HAVE_PTHREAD_MUTEXATTR_DESTROY''@|$(HAVE_PTHREAD_MUTEXATTR_DESTROY)|g' \
1851 -e 's|@''HAVE_PTHREAD_MUTEX_LOCK''@|$(HAVE_PTHREAD_MUTEX_LOCK)|g' \
1852 -e 's|@''HAVE_PTHREAD_MUTEX_TRYLOCK''@|$(HAVE_PTHREAD_MUTEX_TRYLOCK)|g' \
1853 -e 's|@''HAVE_PTHREAD_MUTEX_TIMEDLOCK''@|$(HAVE_PTHREAD_MUTEX_TIMEDLOCK)|g' \
1854 -e 's|@''HAVE_PTHREAD_MUTEX_UNLOCK''@|$(HAVE_PTHREAD_MUTEX_UNLOCK)|g' \
1855 -e 's|@''HAVE_PTHREAD_MUTEX_DESTROY''@|$(HAVE_PTHREAD_MUTEX_DESTROY)|g' \
1856 -e 's|@''HAVE_PTHREAD_RWLOCK_INIT''@|$(HAVE_PTHREAD_RWLOCK_INIT)|g' \
1857 -e 's|@''HAVE_PTHREAD_RWLOCKATTR_INIT''@|$(HAVE_PTHREAD_RWLOCKATTR_INIT)|g' \
1858 -e 's|@''HAVE_PTHREAD_RWLOCKATTR_DESTROY''@|$(HAVE_PTHREAD_RWLOCKATTR_DESTROY)|g' \
1859 -e 's|@''HAVE_PTHREAD_RWLOCK_RDLOCK''@|$(HAVE_PTHREAD_RWLOCK_RDLOCK)|g' \
1860 -e 's|@''HAVE_PTHREAD_RWLOCK_WRLOCK''@|$(HAVE_PTHREAD_RWLOCK_WRLOCK)|g' \
1861 -e 's|@''HAVE_PTHREAD_RWLOCK_TRYRDLOCK''@|$(HAVE_PTHREAD_RWLOCK_TRYRDLOCK)|g' \
1862 -e 's|@''HAVE_PTHREAD_RWLOCK_TRYWRLOCK''@|$(HAVE_PTHREAD_RWLOCK_TRYWRLOCK)|g' \
1863 -e 's|@''HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK''@|$(HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK)|g' \
1864 -e 's|@''HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK''@|$(HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK)|g' \
1865 -e 's|@''HAVE_PTHREAD_RWLOCK_UNLOCK''@|$(HAVE_PTHREAD_RWLOCK_UNLOCK)|g' \
1866 -e 's|@''HAVE_PTHREAD_RWLOCK_DESTROY''@|$(HAVE_PTHREAD_RWLOCK_DESTROY)|g' \
1867 -e 's|@''HAVE_PTHREAD_COND_INIT''@|$(HAVE_PTHREAD_COND_INIT)|g' \
1868 -e 's|@''HAVE_PTHREAD_CONDATTR_INIT''@|$(HAVE_PTHREAD_CONDATTR_INIT)|g' \
1869 -e 's|@''HAVE_PTHREAD_CONDATTR_DESTROY''@|$(HAVE_PTHREAD_CONDATTR_DESTROY)|g' \
1870 -e 's|@''HAVE_PTHREAD_COND_WAIT''@|$(HAVE_PTHREAD_COND_WAIT)|g' \
1871 -e 's|@''HAVE_PTHREAD_COND_TIMEDWAIT''@|$(HAVE_PTHREAD_COND_TIMEDWAIT)|g' \
1872 -e 's|@''HAVE_PTHREAD_COND_SIGNAL''@|$(HAVE_PTHREAD_COND_SIGNAL)|g' \
1873 -e 's|@''HAVE_PTHREAD_COND_BROADCAST''@|$(HAVE_PTHREAD_COND_BROADCAST)|g' \
1874 -e 's|@''HAVE_PTHREAD_COND_DESTROY''@|$(HAVE_PTHREAD_COND_DESTROY)|g' \
1875 -e 's|@''HAVE_PTHREAD_KEY_CREATE''@|$(HAVE_PTHREAD_KEY_CREATE)|g' \
1876 -e 's|@''HAVE_PTHREAD_SETSPECIFIC''@|$(HAVE_PTHREAD_SETSPECIFIC)|g' \
1877 -e 's|@''HAVE_PTHREAD_GETSPECIFIC''@|$(HAVE_PTHREAD_GETSPECIFIC)|g' \
1878 -e 's|@''HAVE_PTHREAD_KEY_DELETE''@|$(HAVE_PTHREAD_KEY_DELETE)|g' \
1879 -e 's|@''HAVE_PTHREAD_SPIN_INIT''@|$(HAVE_PTHREAD_SPIN_INIT)|g' \
1880 -e 's|@''HAVE_PTHREAD_SPIN_LOCK''@|$(HAVE_PTHREAD_SPIN_LOCK)|g' \
1881 -e 's|@''HAVE_PTHREAD_SPIN_TRYLOCK''@|$(HAVE_PTHREAD_SPIN_TRYLOCK)|g' \
1882 -e 's|@''HAVE_PTHREAD_SPIN_UNLOCK''@|$(HAVE_PTHREAD_SPIN_UNLOCK)|g' \
1883 -e 's|@''HAVE_PTHREAD_SPIN_DESTROY''@|$(HAVE_PTHREAD_SPIN_DESTROY)|g' \
1884 < $@-t1 > $@-t2
1885 $(AM_V_at)sed \
1886 -e 's|@''REPLACE_PTHREAD_CREATE''@|$(REPLACE_PTHREAD_CREATE)|g' \
1887 -e 's|@''REPLACE_PTHREAD_ATTR_INIT''@|$(REPLACE_PTHREAD_ATTR_INIT)|g' \
1888 -e 's|@''REPLACE_PTHREAD_ATTR_GETDETACHSTATE''@|$(REPLACE_PTHREAD_ATTR_GETDETACHSTATE)|g' \
1889 -e 's|@''REPLACE_PTHREAD_ATTR_SETDETACHSTATE''@|$(REPLACE_PTHREAD_ATTR_SETDETACHSTATE)|g' \
1890 -e 's|@''REPLACE_PTHREAD_ATTR_DESTROY''@|$(REPLACE_PTHREAD_ATTR_DESTROY)|g' \
1891 -e 's|@''REPLACE_PTHREAD_SELF''@|$(REPLACE_PTHREAD_SELF)|g' \
1892 -e 's|@''REPLACE_PTHREAD_EQUAL''@|$(REPLACE_PTHREAD_EQUAL)|g' \
1893 -e 's|@''REPLACE_PTHREAD_DETACH''@|$(REPLACE_PTHREAD_DETACH)|g' \
1894 -e 's|@''REPLACE_PTHREAD_JOIN''@|$(REPLACE_PTHREAD_JOIN)|g' \
1895 -e 's|@''REPLACE_PTHREAD_EXIT''@|$(REPLACE_PTHREAD_EXIT)|g' \
1896 -e 's|@''REPLACE_PTHREAD_ONCE''@|$(REPLACE_PTHREAD_ONCE)|g' \
1897 -e 's|@''REPLACE_PTHREAD_MUTEX_INIT''@|$(REPLACE_PTHREAD_MUTEX_INIT)|g' \
1898 -e 's|@''REPLACE_PTHREAD_MUTEXATTR_INIT''@|$(REPLACE_PTHREAD_MUTEXATTR_INIT)|g' \
1899 -e 's|@''REPLACE_PTHREAD_MUTEXATTR_GETTYPE''@|$(REPLACE_PTHREAD_MUTEXATTR_GETTYPE)|g' \
1900 -e 's|@''REPLACE_PTHREAD_MUTEXATTR_SETTYPE''@|$(REPLACE_PTHREAD_MUTEXATTR_SETTYPE)|g' \
1901 -e 's|@''REPLACE_PTHREAD_MUTEXATTR_GETROBUST''@|$(REPLACE_PTHREAD_MUTEXATTR_GETROBUST)|g' \
1902 -e 's|@''REPLACE_PTHREAD_MUTEXATTR_SETROBUST''@|$(REPLACE_PTHREAD_MUTEXATTR_SETROBUST)|g' \
1903 -e 's|@''REPLACE_PTHREAD_MUTEXATTR_DESTROY''@|$(REPLACE_PTHREAD_MUTEXATTR_DESTROY)|g' \
1904 -e 's|@''REPLACE_PTHREAD_MUTEX_LOCK''@|$(REPLACE_PTHREAD_MUTEX_LOCK)|g' \
1905 -e 's|@''REPLACE_PTHREAD_MUTEX_TRYLOCK''@|$(REPLACE_PTHREAD_MUTEX_TRYLOCK)|g' \
1906 -e 's|@''REPLACE_PTHREAD_MUTEX_TIMEDLOCK''@|$(REPLACE_PTHREAD_MUTEX_TIMEDLOCK)|g' \
1907 -e 's|@''REPLACE_PTHREAD_MUTEX_UNLOCK''@|$(REPLACE_PTHREAD_MUTEX_UNLOCK)|g' \
1908 -e 's|@''REPLACE_PTHREAD_MUTEX_DESTROY''@|$(REPLACE_PTHREAD_MUTEX_DESTROY)|g' \
1909 -e 's|@''REPLACE_PTHREAD_RWLOCK_INIT''@|$(REPLACE_PTHREAD_RWLOCK_INIT)|g' \
1910 -e 's|@''REPLACE_PTHREAD_RWLOCKATTR_INIT''@|$(REPLACE_PTHREAD_RWLOCKATTR_INIT)|g' \
1911 -e 's|@''REPLACE_PTHREAD_RWLOCKATTR_DESTROY''@|$(REPLACE_PTHREAD_RWLOCKATTR_DESTROY)|g' \
1912 -e 's|@''REPLACE_PTHREAD_RWLOCK_RDLOCK''@|$(REPLACE_PTHREAD_RWLOCK_RDLOCK)|g' \
1913 -e 's|@''REPLACE_PTHREAD_RWLOCK_WRLOCK''@|$(REPLACE_PTHREAD_RWLOCK_WRLOCK)|g' \
1914 -e 's|@''REPLACE_PTHREAD_RWLOCK_TRYRDLOCK''@|$(REPLACE_PTHREAD_RWLOCK_TRYRDLOCK)|g' \
1915 -e 's|@''REPLACE_PTHREAD_RWLOCK_TRYWRLOCK''@|$(REPLACE_PTHREAD_RWLOCK_TRYWRLOCK)|g' \
1916 -e 's|@''REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK''@|$(REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK)|g' \
1917 -e 's|@''REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK''@|$(REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK)|g' \
1918 -e 's|@''REPLACE_PTHREAD_RWLOCK_UNLOCK''@|$(REPLACE_PTHREAD_RWLOCK_UNLOCK)|g' \
1919 -e 's|@''REPLACE_PTHREAD_RWLOCK_DESTROY''@|$(REPLACE_PTHREAD_RWLOCK_DESTROY)|g' \
1920 < $@-t2 > $@-t3
1921 $(AM_V_at)sed \
1922 -e 's|@''REPLACE_PTHREAD_COND_INIT''@|$(REPLACE_PTHREAD_COND_INIT)|g' \
1923 -e 's|@''REPLACE_PTHREAD_CONDATTR_INIT''@|$(REPLACE_PTHREAD_CONDATTR_INIT)|g' \
1924 -e 's|@''REPLACE_PTHREAD_CONDATTR_DESTROY''@|$(REPLACE_PTHREAD_CONDATTR_DESTROY)|g' \
1925 -e 's|@''REPLACE_PTHREAD_COND_WAIT''@|$(REPLACE_PTHREAD_COND_WAIT)|g' \
1926 -e 's|@''REPLACE_PTHREAD_COND_TIMEDWAIT''@|$(REPLACE_PTHREAD_COND_TIMEDWAIT)|g' \
1927 -e 's|@''REPLACE_PTHREAD_COND_SIGNAL''@|$(REPLACE_PTHREAD_COND_SIGNAL)|g' \
1928 -e 's|@''REPLACE_PTHREAD_COND_BROADCAST''@|$(REPLACE_PTHREAD_COND_BROADCAST)|g' \
1929 -e 's|@''REPLACE_PTHREAD_COND_DESTROY''@|$(REPLACE_PTHREAD_COND_DESTROY)|g' \
1930 -e 's|@''REPLACE_PTHREAD_KEY_CREATE''@|$(REPLACE_PTHREAD_KEY_CREATE)|g' \
1931 -e 's|@''REPLACE_PTHREAD_SETSPECIFIC''@|$(REPLACE_PTHREAD_SETSPECIFIC)|g' \
1932 -e 's|@''REPLACE_PTHREAD_GETSPECIFIC''@|$(REPLACE_PTHREAD_GETSPECIFIC)|g' \
1933 -e 's|@''REPLACE_PTHREAD_KEY_DELETE''@|$(REPLACE_PTHREAD_KEY_DELETE)|g' \
1934 -e 's|@''REPLACE_PTHREAD_SPIN_INIT''@|$(REPLACE_PTHREAD_SPIN_INIT)|g' \
1935 -e 's|@''REPLACE_PTHREAD_SPIN_LOCK''@|$(REPLACE_PTHREAD_SPIN_LOCK)|g' \
1936 -e 's|@''REPLACE_PTHREAD_SPIN_TRYLOCK''@|$(REPLACE_PTHREAD_SPIN_TRYLOCK)|g' \
1937 -e 's|@''REPLACE_PTHREAD_SPIN_UNLOCK''@|$(REPLACE_PTHREAD_SPIN_UNLOCK)|g' \
1938 -e 's|@''REPLACE_PTHREAD_SPIN_DESTROY''@|$(REPLACE_PTHREAD_SPIN_DESTROY)|g' \
1939 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
1940 -e '/definition of _Noreturn/r $(_NORETURN_H)' \
1941 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
1942 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
1943 < $@-t3 > $@-t4
1944 $(AM_V_at)rm -f $@-t1 $@-t2 $@-t3
1945 $(AM_V_at)mv $@-t4 $@
1946MOSTLYCLEANFILES += pthread.h pthread.h-t1 pthread.h-t2 pthread.h-t3 pthread.h-t4
1611 1947
1612EXTRA_libgnu_a_SOURCES += realloc.c 1948EXTRA_DIST += pthread.in.h
1613 1949
1614## end gnulib module realloc-gnu 1950## end gnulib module pthread-h
1615 1951
1616## begin gnulib module realloc-posix 1952## begin gnulib module pthread-once
1617 1953
1954if GL_COND_OBJ_PTHREAD_ONCE
1955libgnu_a_SOURCES += pthread-once.c
1956endif
1618 1957
1619EXTRA_DIST += realloc.c 1958## end gnulib module pthread-once
1620 1959
1621EXTRA_libgnu_a_SOURCES += realloc.c 1960## begin gnulib module realloc-posix
1961
1962if GL_COND_OBJ_REALLOC_POSIX
1963libgnu_a_SOURCES += realloc.c
1964endif
1622 1965
1623## end gnulib module realloc-posix 1966## end gnulib module realloc-posix
1624 1967
@@ -1642,6 +1985,35 @@ EXTRA_libgnu_a_SOURCES += regcomp.c regex_internal.c regexec.c
1642 1985
1643## end gnulib module regex 1986## end gnulib module regex
1644 1987
1988## begin gnulib module sched-h
1989
1990BUILT_SOURCES += sched.h
1991
1992# We need the following in order to create a replacement for <sched.h> when
1993# the system doesn't have one.
1994sched.h: sched.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
1995 $(gl_V_at)$(SED_HEADER_STDOUT) \
1996 -e 's|@''GUARD_PREFIX''@|GL|g' \
1997 -e 's|@''HAVE_SCHED_H''@|$(HAVE_SCHED_H)|g' \
1998 -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \
1999 -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
2000 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
2001 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
2002 -e 's|@''NEXT_SCHED_H''@|$(NEXT_SCHED_H)|g' \
2003 -e 's|@''HAVE_STRUCT_SCHED_PARAM''@|$(HAVE_STRUCT_SCHED_PARAM)|g' \
2004 -e 's/@''GNULIB_SCHED_YIELD''@/$(GL_GNULIB_SCHED_YIELD)/g' \
2005 -e 's|@''HAVE_SCHED_YIELD''@|$(HAVE_SCHED_YIELD)|g' \
2006 -e 's|@''REPLACE_SCHED_YIELD''@|$(REPLACE_SCHED_YIELD)|g' \
2007 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
2008 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
2009 $(srcdir)/sched.in.h > $@-t
2010 $(AM_V_at)mv $@-t $@
2011MOSTLYCLEANFILES += sched.h sched.h-t
2012
2013EXTRA_DIST += sched.in.h
2014
2015## end gnulib module sched-h
2016
1645## begin gnulib module setenv 2017## begin gnulib module setenv
1646 2018
1647if GL_COND_OBJ_SETENV 2019if GL_COND_OBJ_SETENV
@@ -1760,7 +2132,7 @@ EXTRA_DIST += stat-time.h
1760 2132
1761## end gnulib module stat-time 2133## end gnulib module stat-time
1762 2134
1763## begin gnulib module stdckdint 2135## begin gnulib module stdckdint-h
1764 2136
1765BUILT_SOURCES += $(STDCKDINT_H) 2137BUILT_SOURCES += $(STDCKDINT_H)
1766 2138
@@ -1769,6 +2141,15 @@ BUILT_SOURCES += $(STDCKDINT_H)
1769if GL_GENERATE_STDCKDINT_H 2141if GL_GENERATE_STDCKDINT_H
1770stdckdint.h: stdckdint.in.h $(top_builddir)/config.status 2142stdckdint.h: stdckdint.in.h $(top_builddir)/config.status
1771 $(gl_V_at)$(SED_HEADER_STDOUT) \ 2143 $(gl_V_at)$(SED_HEADER_STDOUT) \
2144 -e 's|@''GUARD_PREFIX''@|GL|g' \
2145 -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
2146 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
2147 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
2148 -e 's|@''NEXT_STDCKDINT_H''@|$(NEXT_STDCKDINT_H)|g' \
2149 -e 's|@''HAVE_C_STDCKDINT_H''@|$(HAVE_C_STDCKDINT_H)|g' \
2150 -e 's|@''HAVE_WORKING_C_STDCKDINT_H''@|$(HAVE_WORKING_C_STDCKDINT_H)|g' \
2151 -e 's|@''HAVE_CXX_STDCKDINT_H''@|$(HAVE_CXX_STDCKDINT_H)|g' \
2152 -e 's|@''HAVE_WORKING_CXX_STDCKDINT_H''@|$(HAVE_WORKING_CXX_STDCKDINT_H)|g' \
1772 $(srcdir)/stdckdint.in.h > $@-t 2153 $(srcdir)/stdckdint.in.h > $@-t
1773 $(AM_V_at)mv $@-t $@ 2154 $(AM_V_at)mv $@-t $@
1774else 2155else
@@ -1779,9 +2160,9 @@ MOSTLYCLEANFILES += stdckdint.h stdckdint.h-t
1779 2160
1780EXTRA_DIST += intprops-internal.h stdckdint.in.h 2161EXTRA_DIST += intprops-internal.h stdckdint.in.h
1781 2162
1782## end gnulib module stdckdint 2163## end gnulib module stdckdint-h
1783 2164
1784## begin gnulib module stddef 2165## begin gnulib module stddef-h
1785 2166
1786BUILT_SOURCES += $(STDDEF_H) 2167BUILT_SOURCES += $(STDDEF_H)
1787 2168
@@ -1795,9 +2176,11 @@ stddef.h: stddef.in.h $(top_builddir)/config.status
1795 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ 2176 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
1796 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ 2177 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
1797 -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ 2178 -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
1798 -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \ 2179 -e 's|@''NULLPTR_T_NEEDS_STDDEF''@|$(NULLPTR_T_NEEDS_STDDEF)|g' \
1799 -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ 2180 -e 's|@''STDDEF_NOT_IDEMPOTENT''@|$(STDDEF_NOT_IDEMPOTENT)|g' \
1800 -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ 2181 -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
2182 -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \
2183 -e 's|@''HAVE_C_UNREACHABLE''@|$(HAVE_C_UNREACHABLE)|g' \
1801 $(srcdir)/stddef.in.h > $@-t 2184 $(srcdir)/stddef.in.h > $@-t
1802 $(AM_V_at)mv $@-t $@ 2185 $(AM_V_at)mv $@-t $@
1803else 2186else
@@ -1808,9 +2191,9 @@ MOSTLYCLEANFILES += stddef.h stddef.h-t
1808 2191
1809EXTRA_DIST += stddef.in.h 2192EXTRA_DIST += stddef.in.h
1810 2193
1811## end gnulib module stddef 2194## end gnulib module stddef-h
1812 2195
1813## begin gnulib module stdint 2196## begin gnulib module stdint-h
1814 2197
1815BUILT_SOURCES += $(STDINT_H) 2198BUILT_SOURCES += $(STDINT_H)
1816 2199
@@ -1856,9 +2239,9 @@ MOSTLYCLEANFILES += stdint.h stdint.h-t
1856 2239
1857EXTRA_DIST += stdint.in.h 2240EXTRA_DIST += stdint.in.h
1858 2241
1859## end gnulib module stdint 2242## end gnulib module stdint-h
1860 2243
1861## begin gnulib module stdio 2244## begin gnulib module stdio-h
1862 2245
1863BUILT_SOURCES += stdio.h 2246BUILT_SOURCES += stdio.h
1864 2247
@@ -1872,6 +2255,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
1872 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ 2255 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
1873 -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ 2256 -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
1874 -e 's/@''GNULIB_DPRINTF''@/$(GL_GNULIB_DPRINTF)/g' \ 2257 -e 's/@''GNULIB_DPRINTF''@/$(GL_GNULIB_DPRINTF)/g' \
2258 -e 's/@''GNULIB_DZPRINTF''@/$(GL_GNULIB_DZPRINTF)/g' \
1875 -e 's/@''GNULIB_FCLOSE''@/$(GL_GNULIB_FCLOSE)/g' \ 2259 -e 's/@''GNULIB_FCLOSE''@/$(GL_GNULIB_FCLOSE)/g' \
1876 -e 's/@''GNULIB_FDOPEN''@/$(GL_GNULIB_FDOPEN)/g' \ 2260 -e 's/@''GNULIB_FDOPEN''@/$(GL_GNULIB_FDOPEN)/g' \
1877 -e 's/@''GNULIB_FFLUSH''@/$(GL_GNULIB_FFLUSH)/g' \ 2261 -e 's/@''GNULIB_FFLUSH''@/$(GL_GNULIB_FFLUSH)/g' \
@@ -1892,12 +2276,14 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
1892 -e 's/@''GNULIB_FTELL''@/$(GL_GNULIB_FTELL)/g' \ 2276 -e 's/@''GNULIB_FTELL''@/$(GL_GNULIB_FTELL)/g' \
1893 -e 's/@''GNULIB_FTELLO''@/$(GL_GNULIB_FTELLO)/g' \ 2277 -e 's/@''GNULIB_FTELLO''@/$(GL_GNULIB_FTELLO)/g' \
1894 -e 's/@''GNULIB_FWRITE''@/$(GL_GNULIB_FWRITE)/g' \ 2278 -e 's/@''GNULIB_FWRITE''@/$(GL_GNULIB_FWRITE)/g' \
2279 -e 's/@''GNULIB_FZPRINTF''@/$(GL_GNULIB_FZPRINTF)/g' \
1895 -e 's/@''GNULIB_GETC''@/$(GL_GNULIB_GETC)/g' \ 2280 -e 's/@''GNULIB_GETC''@/$(GL_GNULIB_GETC)/g' \
1896 -e 's/@''GNULIB_GETCHAR''@/$(GL_GNULIB_GETCHAR)/g' \ 2281 -e 's/@''GNULIB_GETCHAR''@/$(GL_GNULIB_GETCHAR)/g' \
1897 -e 's/@''GNULIB_GETDELIM''@/$(GL_GNULIB_GETDELIM)/g' \ 2282 -e 's/@''GNULIB_GETDELIM''@/$(GL_GNULIB_GETDELIM)/g' \
1898 -e 's/@''GNULIB_GETLINE''@/$(GL_GNULIB_GETLINE)/g' \ 2283 -e 's/@''GNULIB_GETLINE''@/$(GL_GNULIB_GETLINE)/g' \
1899 -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GL_GNULIB_OBSTACK_PRINTF)/g' \ 2284 -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GL_GNULIB_OBSTACK_PRINTF)/g' \
1900 -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GL_GNULIB_OBSTACK_PRINTF_POSIX)/g' \ 2285 -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GL_GNULIB_OBSTACK_PRINTF_POSIX)/g' \
2286 -e 's/@''GNULIB_OBSTACK_ZPRINTF''@/$(GL_GNULIB_OBSTACK_ZPRINTF)/g' \
1901 -e 's/@''GNULIB_PCLOSE''@/$(GL_GNULIB_PCLOSE)/g' \ 2287 -e 's/@''GNULIB_PCLOSE''@/$(GL_GNULIB_PCLOSE)/g' \
1902 -e 's/@''GNULIB_PERROR''@/$(GL_GNULIB_PERROR)/g' \ 2288 -e 's/@''GNULIB_PERROR''@/$(GL_GNULIB_PERROR)/g' \
1903 -e 's/@''GNULIB_POPEN''@/$(GL_GNULIB_POPEN)/g' \ 2289 -e 's/@''GNULIB_POPEN''@/$(GL_GNULIB_POPEN)/g' \
@@ -1911,20 +2297,29 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
1911 -e 's/@''GNULIB_RENAMEAT''@/$(GL_GNULIB_RENAMEAT)/g' \ 2297 -e 's/@''GNULIB_RENAMEAT''@/$(GL_GNULIB_RENAMEAT)/g' \
1912 -e 's/@''GNULIB_SCANF''@/$(GL_GNULIB_SCANF)/g' \ 2298 -e 's/@''GNULIB_SCANF''@/$(GL_GNULIB_SCANF)/g' \
1913 -e 's/@''GNULIB_SNPRINTF''@/$(GL_GNULIB_SNPRINTF)/g' \ 2299 -e 's/@''GNULIB_SNPRINTF''@/$(GL_GNULIB_SNPRINTF)/g' \
2300 -e 's/@''GNULIB_SNZPRINTF''@/$(GL_GNULIB_SNZPRINTF)/g' \
1914 -e 's/@''GNULIB_SPRINTF_POSIX''@/$(GL_GNULIB_SPRINTF_POSIX)/g' \ 2301 -e 's/@''GNULIB_SPRINTF_POSIX''@/$(GL_GNULIB_SPRINTF_POSIX)/g' \
1915 -e 's/@''GNULIB_STDIO_H_NONBLOCKING''@/$(GL_GNULIB_STDIO_H_NONBLOCKING)/g' \ 2302 -e 's/@''GNULIB_STDIO_H_NONBLOCKING''@/$(GL_GNULIB_STDIO_H_NONBLOCKING)/g' \
1916 -e 's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GL_GNULIB_STDIO_H_SIGPIPE)/g' \ 2303 -e 's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GL_GNULIB_STDIO_H_SIGPIPE)/g' \
2304 -e 's/@''GNULIB_SZPRINTF''@/$(GL_GNULIB_SZPRINTF)/g' \
1917 -e 's/@''GNULIB_TMPFILE''@/$(GL_GNULIB_TMPFILE)/g' \ 2305 -e 's/@''GNULIB_TMPFILE''@/$(GL_GNULIB_TMPFILE)/g' \
1918 -e 's/@''GNULIB_VASPRINTF''@/$(GL_GNULIB_VASPRINTF)/g' \ 2306 -e 's/@''GNULIB_VASPRINTF''@/$(GL_GNULIB_VASPRINTF)/g' \
2307 -e 's/@''GNULIB_VASZPRINTF''@/$(GL_GNULIB_VASZPRINTF)/g' \
1919 -e 's/@''GNULIB_VDPRINTF''@/$(GL_GNULIB_VDPRINTF)/g' \ 2308 -e 's/@''GNULIB_VDPRINTF''@/$(GL_GNULIB_VDPRINTF)/g' \
2309 -e 's/@''GNULIB_VDZPRINTF''@/$(GL_GNULIB_VDZPRINTF)/g' \
1920 -e 's/@''GNULIB_VFPRINTF''@/$(GL_GNULIB_VFPRINTF)/g' \ 2310 -e 's/@''GNULIB_VFPRINTF''@/$(GL_GNULIB_VFPRINTF)/g' \
1921 -e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GL_GNULIB_VFPRINTF_POSIX)/g' \ 2311 -e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GL_GNULIB_VFPRINTF_POSIX)/g' \
2312 -e 's/@''GNULIB_VFZPRINTF''@/$(GL_GNULIB_VFZPRINTF)/g' \
1922 -e 's/@''GNULIB_VFSCANF''@/$(GL_GNULIB_VFSCANF)/g' \ 2313 -e 's/@''GNULIB_VFSCANF''@/$(GL_GNULIB_VFSCANF)/g' \
1923 -e 's/@''GNULIB_VSCANF''@/$(GL_GNULIB_VSCANF)/g' \ 2314 -e 's/@''GNULIB_VSCANF''@/$(GL_GNULIB_VSCANF)/g' \
1924 -e 's/@''GNULIB_VPRINTF''@/$(GL_GNULIB_VPRINTF)/g' \ 2315 -e 's/@''GNULIB_VPRINTF''@/$(GL_GNULIB_VPRINTF)/g' \
1925 -e 's/@''GNULIB_VPRINTF_POSIX''@/$(GL_GNULIB_VPRINTF_POSIX)/g' \ 2316 -e 's/@''GNULIB_VPRINTF_POSIX''@/$(GL_GNULIB_VPRINTF_POSIX)/g' \
1926 -e 's/@''GNULIB_VSNPRINTF''@/$(GL_GNULIB_VSNPRINTF)/g' \ 2317 -e 's/@''GNULIB_VSNPRINTF''@/$(GL_GNULIB_VSNPRINTF)/g' \
2318 -e 's/@''GNULIB_VSNZPRINTF''@/$(GL_GNULIB_VSNZPRINTF)/g' \
1927 -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GL_GNULIB_VSPRINTF_POSIX)/g' \ 2319 -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GL_GNULIB_VSPRINTF_POSIX)/g' \
2320 -e 's/@''GNULIB_VSZPRINTF''@/$(GL_GNULIB_VSZPRINTF)/g' \
2321 -e 's/@''GNULIB_VZPRINTF''@/$(GL_GNULIB_VZPRINTF)/g' \
2322 -e 's/@''GNULIB_ZPRINTF''@/$(GL_GNULIB_ZPRINTF)/g' \
1928 -e 's/@''GNULIB_MDA_FCLOSEALL''@/$(GL_GNULIB_MDA_FCLOSEALL)/g' \ 2323 -e 's/@''GNULIB_MDA_FCLOSEALL''@/$(GL_GNULIB_MDA_FCLOSEALL)/g' \
1929 -e 's/@''GNULIB_MDA_FDOPEN''@/$(GL_GNULIB_MDA_FDOPEN)/g' \ 2324 -e 's/@''GNULIB_MDA_FDOPEN''@/$(GL_GNULIB_MDA_FDOPEN)/g' \
1930 -e 's/@''GNULIB_MDA_FILENO''@/$(GL_GNULIB_MDA_FILENO)/g' \ 2325 -e 's/@''GNULIB_MDA_FILENO''@/$(GL_GNULIB_MDA_FILENO)/g' \
@@ -2005,14 +2400,21 @@ endif
2005 2400
2006EXTRA_DIST += stdio.in.h 2401EXTRA_DIST += stdio.in.h
2007 2402
2008## end gnulib module stdio 2403## end gnulib module stdio-h
2404
2405## begin gnulib module stdio-windows
2406
2407if GL_COND_OBJ_STDIO_CONSOLESAFE
2408libgnu_a_SOURCES += stdio-consolesafe.c
2409endif
2009 2410
2010## begin gnulib module stdlib 2411## end gnulib module stdio-windows
2412
2413## begin gnulib module stdlib-h
2011 2414
2012BUILT_SOURCES += stdlib.h 2415BUILT_SOURCES += stdlib.h
2416libgnu_a_SOURCES += stdlib.c
2013 2417
2014# We need the following in order to create <stdlib.h> when the system
2015# doesn't have one that works with the given compiler.
2016stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ 2418stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
2017 $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) 2419 $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
2018 $(gl_V_at)$(SED_HEADER_STDOUT) \ 2420 $(gl_V_at)$(SED_HEADER_STDOUT) \
@@ -2022,6 +2424,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
2022 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ 2424 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
2023 -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ 2425 -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
2024 -e 's/@''GNULIB__EXIT''@/$(GL_GNULIB__EXIT)/g' \ 2426 -e 's/@''GNULIB__EXIT''@/$(GL_GNULIB__EXIT)/g' \
2427 -e 's/@''GNULIB_ABORT_DEBUG''@/$(GL_GNULIB_ABORT_DEBUG)/g' \
2025 -e 's/@''GNULIB_ALIGNED_ALLOC''@/$(GL_GNULIB_ALIGNED_ALLOC)/g' \ 2428 -e 's/@''GNULIB_ALIGNED_ALLOC''@/$(GL_GNULIB_ALIGNED_ALLOC)/g' \
2026 -e 's/@''GNULIB_ATOLL''@/$(GL_GNULIB_ATOLL)/g' \ 2429 -e 's/@''GNULIB_ATOLL''@/$(GL_GNULIB_ATOLL)/g' \
2027 -e 's/@''GNULIB_CALLOC_GNU''@/$(GL_GNULIB_CALLOC_GNU)/g' \ 2430 -e 's/@''GNULIB_CALLOC_GNU''@/$(GL_GNULIB_CALLOC_GNU)/g' \
@@ -2050,13 +2453,13 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
2050 -e 's/@''GNULIB_RAND''@/$(GL_GNULIB_RAND)/g' \ 2453 -e 's/@''GNULIB_RAND''@/$(GL_GNULIB_RAND)/g' \
2051 -e 's/@''GNULIB_RANDOM''@/$(GL_GNULIB_RANDOM)/g' \ 2454 -e 's/@''GNULIB_RANDOM''@/$(GL_GNULIB_RANDOM)/g' \
2052 -e 's/@''GNULIB_RANDOM_R''@/$(GL_GNULIB_RANDOM_R)/g' \ 2455 -e 's/@''GNULIB_RANDOM_R''@/$(GL_GNULIB_RANDOM_R)/g' \
2053 -e 's/@''GNULIB_REALLOC_GNU''@/$(GL_GNULIB_REALLOC_GNU)/g' \
2054 -e 's/@''GNULIB_REALLOC_POSIX''@/$(GL_GNULIB_REALLOC_POSIX)/g' \ 2456 -e 's/@''GNULIB_REALLOC_POSIX''@/$(GL_GNULIB_REALLOC_POSIX)/g' \
2055 -e 's/@''GNULIB_REALLOCARRAY''@/$(GL_GNULIB_REALLOCARRAY)/g' \ 2457 -e 's/@''GNULIB_REALLOCARRAY''@/$(GL_GNULIB_REALLOCARRAY)/g' \
2056 -e 's/@''GNULIB_REALPATH''@/$(GL_GNULIB_REALPATH)/g' \ 2458 -e 's/@''GNULIB_REALPATH''@/$(GL_GNULIB_REALPATH)/g' \
2057 -e 's/@''GNULIB_RPMATCH''@/$(GL_GNULIB_RPMATCH)/g' \ 2459 -e 's/@''GNULIB_RPMATCH''@/$(GL_GNULIB_RPMATCH)/g' \
2058 -e 's/@''GNULIB_SECURE_GETENV''@/$(GL_GNULIB_SECURE_GETENV)/g' \ 2460 -e 's/@''GNULIB_SECURE_GETENV''@/$(GL_GNULIB_SECURE_GETENV)/g' \
2059 -e 's/@''GNULIB_SETENV''@/$(GL_GNULIB_SETENV)/g' \ 2461 -e 's/@''GNULIB_SETENV''@/$(GL_GNULIB_SETENV)/g' \
2462 -e 's/@''GNULIB_STACK_TRACE''@/$(GL_GNULIB_STACK_TRACE)/g' \
2060 -e 's/@''GNULIB_STRTOD''@/$(GL_GNULIB_STRTOD)/g' \ 2463 -e 's/@''GNULIB_STRTOD''@/$(GL_GNULIB_STRTOD)/g' \
2061 -e 's/@''GNULIB_STRTOF''@/$(GL_GNULIB_STRTOF)/g' \ 2464 -e 's/@''GNULIB_STRTOF''@/$(GL_GNULIB_STRTOF)/g' \
2062 -e 's/@''GNULIB_STRTOL''@/$(GL_GNULIB_STRTOL)/g' \ 2465 -e 's/@''GNULIB_STRTOL''@/$(GL_GNULIB_STRTOL)/g' \
@@ -2101,7 +2504,6 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
2101 -e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \ 2504 -e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \
2102 -e 's|@''HAVE_QSORT_R''@|$(HAVE_QSORT_R)|g' \ 2505 -e 's|@''HAVE_QSORT_R''@|$(HAVE_QSORT_R)|g' \
2103 -e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \ 2506 -e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \
2104 -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
2105 -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ 2507 -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
2106 -e 's|@''HAVE_REALLOCARRAY''@|$(HAVE_REALLOCARRAY)|g' \ 2508 -e 's|@''HAVE_REALLOCARRAY''@|$(HAVE_REALLOCARRAY)|g' \
2107 -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \ 2509 -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \
@@ -2119,11 +2521,13 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
2119 -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ 2521 -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \
2120 -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \ 2522 -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \
2121 -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \ 2523 -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \
2524 -e 's|@''HAVE_SYS_PROCESS_H''@|$(HAVE_SYS_PROCESS_H)|g' \
2122 -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \ 2525 -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \
2123 -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \ 2526 -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \
2124 < $@-t1 > $@-t2 2527 < $@-t1 > $@-t2
2125 $(AM_V_at)sed \ 2528 $(AM_V_at)sed \
2126 -e 's|@''REPLACE__EXIT''@|$(REPLACE__EXIT)|g' \ 2529 -e 's|@''REPLACE__EXIT''@|$(REPLACE__EXIT)|g' \
2530 -e 's|@''REPLACE_ABORT''@|$(REPLACE_ABORT)|g' \
2127 -e 's|@''REPLACE_ALIGNED_ALLOC''@|$(REPLACE_ALIGNED_ALLOC)|g' \ 2531 -e 's|@''REPLACE_ALIGNED_ALLOC''@|$(REPLACE_ALIGNED_ALLOC)|g' \
2128 -e 's|@''REPLACE_CALLOC_FOR_CALLOC_GNU''@|$(REPLACE_CALLOC_FOR_CALLOC_GNU)|g' \ 2532 -e 's|@''REPLACE_CALLOC_FOR_CALLOC_GNU''@|$(REPLACE_CALLOC_FOR_CALLOC_GNU)|g' \
2129 -e 's|@''REPLACE_CALLOC_FOR_CALLOC_POSIX''@|$(REPLACE_CALLOC_FOR_CALLOC_POSIX)|g' \ 2533 -e 's|@''REPLACE_CALLOC_FOR_CALLOC_POSIX''@|$(REPLACE_CALLOC_FOR_CALLOC_POSIX)|g' \
@@ -2150,7 +2554,6 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
2150 -e 's|@''REPLACE_RAND''@|$(REPLACE_RAND)|g' \ 2554 -e 's|@''REPLACE_RAND''@|$(REPLACE_RAND)|g' \
2151 -e 's|@''REPLACE_RANDOM''@|$(REPLACE_RANDOM)|g' \ 2555 -e 's|@''REPLACE_RANDOM''@|$(REPLACE_RANDOM)|g' \
2152 -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \ 2556 -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \
2153 -e 's|@''REPLACE_REALLOC_FOR_REALLOC_GNU''@|$(REPLACE_REALLOC_FOR_REALLOC_GNU)|g' \
2154 -e 's|@''REPLACE_REALLOC_FOR_REALLOC_POSIX''@|$(REPLACE_REALLOC_FOR_REALLOC_POSIX)|g' \ 2557 -e 's|@''REPLACE_REALLOC_FOR_REALLOC_POSIX''@|$(REPLACE_REALLOC_FOR_REALLOC_POSIX)|g' \
2155 -e 's|@''REPLACE_REALLOCARRAY''@|$(REPLACE_REALLOCARRAY)|g' \ 2558 -e 's|@''REPLACE_REALLOCARRAY''@|$(REPLACE_REALLOCARRAY)|g' \
2156 -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ 2559 -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
@@ -2165,6 +2568,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
2165 -e 's|@''REPLACE_STRTOULL''@|$(REPLACE_STRTOULL)|g' \ 2568 -e 's|@''REPLACE_STRTOULL''@|$(REPLACE_STRTOULL)|g' \
2166 -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ 2569 -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
2167 -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ 2570 -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \
2571 -e 's|@''CAN_PRINT_STACK_TRACE''@|$(CAN_PRINT_STACK_TRACE)|g' \
2168 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ 2572 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
2169 -e '/definition of _Noreturn/r $(_NORETURN_H)' \ 2573 -e '/definition of _Noreturn/r $(_NORETURN_H)' \
2170 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ 2574 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
@@ -2176,18 +2580,15 @@ MOSTLYCLEANFILES += stdlib.h stdlib.h-t1 stdlib.h-t2 stdlib.h-t3
2176 2580
2177EXTRA_DIST += stdlib.in.h 2581EXTRA_DIST += stdlib.in.h
2178 2582
2179## end gnulib module stdlib 2583## end gnulib module stdlib-h
2180 2584
2181## begin gnulib module strcase 2585## begin gnulib module strcasecmp
2182 2586
2183if GL_COND_OBJ_STRCASECMP 2587if GL_COND_OBJ_STRCASECMP
2184libgnu_a_SOURCES += strcasecmp.c 2588libgnu_a_SOURCES += strcasecmp.c
2185endif 2589endif
2186if GL_COND_OBJ_STRNCASECMP
2187libgnu_a_SOURCES += strncasecmp.c
2188endif
2189 2590
2190## end gnulib module strcase 2591## end gnulib module strcasecmp
2191 2592
2192## begin gnulib module strcasestr 2593## begin gnulib module strcasestr
2193 2594
@@ -2232,7 +2633,7 @@ EXTRA_DIST += strerror-override.h
2232 2633
2233## end gnulib module strerror-override 2634## end gnulib module strerror-override
2234 2635
2235## begin gnulib module string 2636## begin gnulib module string-h
2236 2637
2237BUILT_SOURCES += string.h 2638BUILT_SOURCES += string.h
2238 2639
@@ -2262,6 +2663,8 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
2262 -e 's/@''GNULIB_MBSSPN''@/$(GL_GNULIB_MBSSPN)/g' \ 2663 -e 's/@''GNULIB_MBSSPN''@/$(GL_GNULIB_MBSSPN)/g' \
2263 -e 's/@''GNULIB_MBSSEP''@/$(GL_GNULIB_MBSSEP)/g' \ 2664 -e 's/@''GNULIB_MBSSEP''@/$(GL_GNULIB_MBSSEP)/g' \
2264 -e 's/@''GNULIB_MBSTOK_R''@/$(GL_GNULIB_MBSTOK_R)/g' \ 2665 -e 's/@''GNULIB_MBSTOK_R''@/$(GL_GNULIB_MBSTOK_R)/g' \
2666 -e 's/@''GNULIB_MBS_ENDSWITH''@/$(GL_GNULIB_MBS_ENDSWITH)/g' \
2667 -e 's/@''GNULIB_MBS_STARTSWITH''@/$(GL_GNULIB_MBS_STARTSWITH)/g' \
2265 -e 's/@''GNULIB_MEMCHR''@/$(GL_GNULIB_MEMCHR)/g' \ 2668 -e 's/@''GNULIB_MEMCHR''@/$(GL_GNULIB_MEMCHR)/g' \
2266 -e 's/@''GNULIB_MEMMEM''@/$(GL_GNULIB_MEMMEM)/g' \ 2669 -e 's/@''GNULIB_MEMMEM''@/$(GL_GNULIB_MEMMEM)/g' \
2267 -e 's/@''GNULIB_MEMPCPY''@/$(GL_GNULIB_MEMPCPY)/g' \ 2670 -e 's/@''GNULIB_MEMPCPY''@/$(GL_GNULIB_MEMPCPY)/g' \
@@ -2272,7 +2675,9 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
2272 -e 's/@''GNULIB_STPNCPY''@/$(GL_GNULIB_STPNCPY)/g' \ 2675 -e 's/@''GNULIB_STPNCPY''@/$(GL_GNULIB_STPNCPY)/g' \
2273 -e 's/@''GNULIB_STRCHRNUL''@/$(GL_GNULIB_STRCHRNUL)/g' \ 2676 -e 's/@''GNULIB_STRCHRNUL''@/$(GL_GNULIB_STRCHRNUL)/g' \
2274 -e 's/@''GNULIB_STRDUP''@/$(GL_GNULIB_STRDUP)/g' \ 2677 -e 's/@''GNULIB_STRDUP''@/$(GL_GNULIB_STRDUP)/g' \
2678 -e 's/@''GNULIB_STRINGEQ''@/$(GL_GNULIB_STRINGEQ)/g' \
2275 -e 's/@''GNULIB_STRNCAT''@/$(GL_GNULIB_STRNCAT)/g' \ 2679 -e 's/@''GNULIB_STRNCAT''@/$(GL_GNULIB_STRNCAT)/g' \
2680 -e 's/@''GNULIB_STRNCPY''@/$(GL_GNULIB_STRNCPY)/g' \
2276 -e 's/@''GNULIB_STRNDUP''@/$(GL_GNULIB_STRNDUP)/g' \ 2681 -e 's/@''GNULIB_STRNDUP''@/$(GL_GNULIB_STRNDUP)/g' \
2277 -e 's/@''GNULIB_STRNLEN''@/$(GL_GNULIB_STRNLEN)/g' \ 2682 -e 's/@''GNULIB_STRNLEN''@/$(GL_GNULIB_STRNLEN)/g' \
2278 -e 's/@''GNULIB_STRPBRK''@/$(GL_GNULIB_STRPBRK)/g' \ 2683 -e 's/@''GNULIB_STRPBRK''@/$(GL_GNULIB_STRPBRK)/g' \
@@ -2280,8 +2685,11 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
2280 -e 's/@''GNULIB_STRSTR''@/$(GL_GNULIB_STRSTR)/g' \ 2685 -e 's/@''GNULIB_STRSTR''@/$(GL_GNULIB_STRSTR)/g' \
2281 -e 's/@''GNULIB_STRCASESTR''@/$(GL_GNULIB_STRCASESTR)/g' \ 2686 -e 's/@''GNULIB_STRCASESTR''@/$(GL_GNULIB_STRCASESTR)/g' \
2282 -e 's/@''GNULIB_STRTOK_R''@/$(GL_GNULIB_STRTOK_R)/g' \ 2687 -e 's/@''GNULIB_STRTOK_R''@/$(GL_GNULIB_STRTOK_R)/g' \
2688 -e 's/@''GNULIB_STR_ENDSWITH''@/$(GL_GNULIB_STR_ENDSWITH)/g' \
2689 -e 's/@''GNULIB_STR_STARTSWITH''@/$(GL_GNULIB_STR_STARTSWITH)/g' \
2283 -e 's/@''GNULIB_STRERROR''@/$(GL_GNULIB_STRERROR)/g' \ 2690 -e 's/@''GNULIB_STRERROR''@/$(GL_GNULIB_STRERROR)/g' \
2284 -e 's/@''GNULIB_STRERROR_R''@/$(GL_GNULIB_STRERROR_R)/g' \ 2691 -e 's/@''GNULIB_STRERROR_R''@/$(GL_GNULIB_STRERROR_R)/g' \
2692 -e 's/@''GNULIB_STRERROR_L''@/$(GL_GNULIB_STRERROR_L)/g' \
2285 -e 's/@''GNULIB_STRERRORNAME_NP''@/$(GL_GNULIB_STRERRORNAME_NP)/g' \ 2693 -e 's/@''GNULIB_STRERRORNAME_NP''@/$(GL_GNULIB_STRERRORNAME_NP)/g' \
2286 -e 's/@''GNULIB_SIGABBREV_NP''@/$(GL_GNULIB_SIGABBREV_NP)/g' \ 2694 -e 's/@''GNULIB_SIGABBREV_NP''@/$(GL_GNULIB_SIGABBREV_NP)/g' \
2287 -e 's/@''GNULIB_SIGDESCR_NP''@/$(GL_GNULIB_SIGDESCR_NP)/g' \ 2695 -e 's/@''GNULIB_SIGDESCR_NP''@/$(GL_GNULIB_SIGDESCR_NP)/g' \
@@ -2296,6 +2704,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
2296 -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ 2704 -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \
2297 -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \ 2705 -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \
2298 -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ 2706 -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
2707 -e 's|@''HAVE_DECL_MEMEQ''@|$(HAVE_DECL_MEMEQ)|g' \
2299 -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ 2708 -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
2300 -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ 2709 -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
2301 -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ 2710 -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
@@ -2305,6 +2714,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
2305 -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \ 2714 -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \
2306 -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \ 2715 -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \
2307 -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \ 2716 -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \
2717 -e 's|@''HAVE_DECL_STREQ''@|$(HAVE_DECL_STREQ)|g' \
2308 -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \ 2718 -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \
2309 -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \ 2719 -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \
2310 -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \ 2720 -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \
@@ -2312,6 +2722,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
2312 -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ 2722 -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
2313 -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ 2723 -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
2314 -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \ 2724 -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \
2725 -e 's|@''HAVE_STRERROR_L''@|$(HAVE_STRERROR_L)|g' \
2315 -e 's|@''HAVE_STRERRORNAME_NP''@|$(HAVE_STRERRORNAME_NP)|g' \ 2726 -e 's|@''HAVE_STRERRORNAME_NP''@|$(HAVE_STRERRORNAME_NP)|g' \
2316 -e 's|@''HAVE_SIGABBREV_NP''@|$(HAVE_SIGABBREV_NP)|g' \ 2727 -e 's|@''HAVE_SIGABBREV_NP''@|$(HAVE_SIGABBREV_NP)|g' \
2317 -e 's|@''HAVE_SIGDESCR_NP''@|$(HAVE_SIGDESCR_NP)|g' \ 2728 -e 's|@''HAVE_SIGDESCR_NP''@|$(HAVE_SIGDESCR_NP)|g' \
@@ -2328,6 +2739,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
2328 -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \ 2739 -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \
2329 -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ 2740 -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \
2330 -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \ 2741 -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \
2742 -e 's|@''REPLACE_STRNCPY''@|$(REPLACE_STRNCPY)|g' \
2331 -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \ 2743 -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \
2332 -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \ 2744 -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \
2333 -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ 2745 -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
@@ -2335,6 +2747,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
2335 -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \ 2747 -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
2336 -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ 2748 -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
2337 -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ 2749 -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \
2750 -e 's|@''REPLACE_STRERROR_L''@|$(REPLACE_STRERROR_L)|g' \
2338 -e 's|@''REPLACE_STRERRORNAME_NP''@|$(REPLACE_STRERRORNAME_NP)|g' \ 2751 -e 's|@''REPLACE_STRERRORNAME_NP''@|$(REPLACE_STRERRORNAME_NP)|g' \
2339 -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ 2752 -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
2340 -e 's|@''REPLACE_STRVERSCMP''@|$(REPLACE_STRVERSCMP)|g' \ 2753 -e 's|@''REPLACE_STRVERSCMP''@|$(REPLACE_STRVERSCMP)|g' \
@@ -2349,9 +2762,15 @@ MOSTLYCLEANFILES += string.h string.h-t1 string.h-t2
2349 2762
2350EXTRA_DIST += string.in.h 2763EXTRA_DIST += string.in.h
2351 2764
2352## end gnulib module string 2765## end gnulib module string-h
2766
2767## begin gnulib module stringeq
2768
2769libgnu_a_SOURCES += string.c
2353 2770
2354## begin gnulib module strings 2771## end gnulib module stringeq
2772
2773## begin gnulib module strings-h
2355 2774
2356BUILT_SOURCES += strings.h 2775BUILT_SOURCES += strings.h
2357 2776
@@ -2366,9 +2785,20 @@ strings.h: strings.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE
2366 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ 2785 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
2367 -e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \ 2786 -e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \
2368 -e 's/@''GNULIB_FFS''@/$(GL_GNULIB_FFS)/g' \ 2787 -e 's/@''GNULIB_FFS''@/$(GL_GNULIB_FFS)/g' \
2788 -e 's/@''GNULIB_STRCASECMP''@/$(GL_GNULIB_STRCASECMP)/g' \
2789 -e 's/@''GNULIB_STRCASECMP_L''@/$(GL_GNULIB_STRCASECMP_L)/g' \
2790 -e 's/@''GNULIB_STRNCASECMP''@/$(GL_GNULIB_STRNCASECMP)/g' \
2791 -e 's/@''GNULIB_STRNCASECMP_L''@/$(GL_GNULIB_STRNCASECMP_L)/g' \
2369 -e 's|@''HAVE_FFS''@|$(HAVE_FFS)|g' \ 2792 -e 's|@''HAVE_FFS''@|$(HAVE_FFS)|g' \
2370 -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \ 2793 -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
2794 -e 's|@''HAVE_STRCASECMP_L''@|$(HAVE_STRCASECMP_L)|g' \
2795 -e 's|@''HAVE_STRNCASECMP''@|$(HAVE_STRNCASECMP)|g' \
2796 -e 's|@''HAVE_STRNCASECMP_L''@|$(HAVE_STRNCASECMP_L)|g' \
2371 -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \ 2797 -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
2798 -e 's|@''REPLACE_STRCASECMP''@|$(REPLACE_STRCASECMP)|g' \
2799 -e 's|@''REPLACE_STRCASECMP_L''@|$(REPLACE_STRCASECMP_L)|g' \
2800 -e 's|@''REPLACE_STRNCASECMP''@|$(REPLACE_STRNCASECMP)|g' \
2801 -e 's|@''REPLACE_STRNCASECMP_L''@|$(REPLACE_STRNCASECMP_L)|g' \
2372 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ 2802 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
2373 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ 2803 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
2374 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ 2804 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
@@ -2378,7 +2808,23 @@ MOSTLYCLEANFILES += strings.h strings.h-t
2378 2808
2379EXTRA_DIST += strings.in.h 2809EXTRA_DIST += strings.in.h
2380 2810
2381## end gnulib module strings 2811## end gnulib module strings-h
2812
2813## begin gnulib module strncasecmp
2814
2815if GL_COND_OBJ_STRNCASECMP
2816libgnu_a_SOURCES += strncasecmp.c
2817endif
2818
2819## end gnulib module strncasecmp
2820
2821## begin gnulib module strncpy
2822
2823if GL_COND_OBJ_STRNCPY
2824libgnu_a_SOURCES += strncpy.c
2825endif
2826
2827## end gnulib module strncpy
2382 2828
2383## begin gnulib module strsep 2829## begin gnulib module strsep
2384 2830
@@ -2397,7 +2843,7 @@ EXTRA_libgnu_a_SOURCES += strstr.c
2397 2843
2398## end gnulib module strstr-simple 2844## end gnulib module strstr-simple
2399 2845
2400## begin gnulib module sys_socket 2846## begin gnulib module sys_socket-h
2401 2847
2402BUILT_SOURCES += sys/socket.h 2848BUILT_SOURCES += sys/socket.h
2403libgnu_a_SOURCES += sys_socket.c 2849libgnu_a_SOURCES += sys_socket.c
@@ -2445,9 +2891,9 @@ MOSTLYCLEANDIRS += sys
2445 2891
2446EXTRA_DIST += sys_socket.in.h 2892EXTRA_DIST += sys_socket.in.h
2447 2893
2448## end gnulib module sys_socket 2894## end gnulib module sys_socket-h
2449 2895
2450## begin gnulib module sys_stat 2896## begin gnulib module sys_stat-h
2451 2897
2452BUILT_SOURCES += sys/stat.h 2898BUILT_SOURCES += sys/stat.h
2453 2899
@@ -2518,9 +2964,9 @@ MOSTLYCLEANDIRS += sys
2518 2964
2519EXTRA_DIST += sys_stat.in.h 2965EXTRA_DIST += sys_stat.in.h
2520 2966
2521## end gnulib module sys_stat 2967## end gnulib module sys_stat-h
2522 2968
2523## begin gnulib module sys_types 2969## begin gnulib module sys_types-h
2524 2970
2525BUILT_SOURCES += sys/types.h 2971BUILT_SOURCES += sys/types.h
2526 2972
@@ -2535,16 +2981,20 @@ sys/types.h: sys_types.in.h $(top_builddir)/config.status
2535 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ 2981 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
2536 -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \ 2982 -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \
2537 -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ 2983 -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
2984 -e 's|@''HAVE_OFF64_T''@|$(HAVE_OFF64_T)|g' \
2538 -e 's|@''WINDOWS_STAT_INODES''@|$(WINDOWS_STAT_INODES)|g' \ 2985 -e 's|@''WINDOWS_STAT_INODES''@|$(WINDOWS_STAT_INODES)|g' \
2986 -e 's|@''HAVE_BLKSIZE_T''@|$(HAVE_BLKSIZE_T)|g' \
2987 -e 's|@''HAVE_BLKCNT_T''@|$(HAVE_BLKCNT_T)|g' \
2539 $(srcdir)/sys_types.in.h > $@-t 2988 $(srcdir)/sys_types.in.h > $@-t
2540 $(AM_V_at)mv $@-t $@ 2989 $(AM_V_at)mv $@-t $@
2541MOSTLYCLEANFILES += sys/types.h sys/types.h-t 2990MOSTLYCLEANFILES += sys/types.h sys/types.h-t
2991MOSTLYCLEANDIRS += sys
2542 2992
2543EXTRA_DIST += sys_types.in.h 2993EXTRA_DIST += sys_types.in.h
2544 2994
2545## end gnulib module sys_types 2995## end gnulib module sys_types-h
2546 2996
2547## begin gnulib module sys_uio 2997## begin gnulib module sys_uio-h
2548 2998
2549BUILT_SOURCES += sys/uio.h 2999BUILT_SOURCES += sys/uio.h
2550 3000
@@ -2566,7 +3016,7 @@ MOSTLYCLEANDIRS += sys
2566 3016
2567EXTRA_DIST += sys_uio.in.h 3017EXTRA_DIST += sys_uio.in.h
2568 3018
2569## end gnulib module sys_uio 3019## end gnulib module sys_uio-h
2570 3020
2571## begin gnulib module threadlib 3021## begin gnulib module threadlib
2572 3022
@@ -2599,6 +3049,7 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
2599 -e 's/@''GNULIB_TIMESPEC_GETRES''@/$(GL_GNULIB_TIMESPEC_GETRES)/g' \ 3049 -e 's/@''GNULIB_TIMESPEC_GETRES''@/$(GL_GNULIB_TIMESPEC_GETRES)/g' \
2600 -e 's/@''GNULIB_TIME_R''@/$(GL_GNULIB_TIME_R)/g' \ 3050 -e 's/@''GNULIB_TIME_R''@/$(GL_GNULIB_TIME_R)/g' \
2601 -e 's/@''GNULIB_TIME_RZ''@/$(GL_GNULIB_TIME_RZ)/g' \ 3051 -e 's/@''GNULIB_TIME_RZ''@/$(GL_GNULIB_TIME_RZ)/g' \
3052 -e 's/@''GNULIB_TZNAME''@/$(GL_GNULIB_TZNAME)/g' \
2602 -e 's/@''GNULIB_TZSET''@/$(GL_GNULIB_TZSET)/g' \ 3053 -e 's/@''GNULIB_TZSET''@/$(GL_GNULIB_TZSET)/g' \
2603 -e 's/@''GNULIB_MDA_TZSET''@/$(GL_GNULIB_MDA_TZSET)/g' \ 3054 -e 's/@''GNULIB_MDA_TZSET''@/$(GL_GNULIB_MDA_TZSET)/g' \
2604 -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \ 3055 -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \
@@ -2608,11 +3059,14 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
2608 -e 's|@''HAVE_TIMESPEC_GET''@|$(HAVE_TIMESPEC_GET)|g' \ 3059 -e 's|@''HAVE_TIMESPEC_GET''@|$(HAVE_TIMESPEC_GET)|g' \
2609 -e 's|@''HAVE_TIMESPEC_GETRES''@|$(HAVE_TIMESPEC_GETRES)|g' \ 3060 -e 's|@''HAVE_TIMESPEC_GETRES''@|$(HAVE_TIMESPEC_GETRES)|g' \
2610 -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \ 3061 -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \
3062 -e 's|@''HAVE_TZALLOC''@|$(HAVE_TZALLOC)|g' \
2611 -e 's|@''REPLACE_CTIME''@|$(REPLACE_CTIME)|g' \ 3063 -e 's|@''REPLACE_CTIME''@|$(REPLACE_CTIME)|g' \
2612 -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \ 3064 -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \
2613 -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \ 3065 -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \
2614 -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \ 3066 -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \
3067 -e 's|@''REPLACE_LOCALTIME_RZ''@|$(REPLACE_LOCALTIME_RZ)|g' \
2615 -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \ 3068 -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \
3069 -e 's|@''REPLACE_MKTIME_Z''@|$(REPLACE_MKTIME_Z)|g' \
2616 -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \ 3070 -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
2617 -e 's|@''REPLACE_STRFTIME''@|$(REPLACE_STRFTIME)|g' \ 3071 -e 's|@''REPLACE_STRFTIME''@|$(REPLACE_STRFTIME)|g' \
2618 -e 's|@''REPLACE_TIME''@|$(REPLACE_TIME)|g' \ 3072 -e 's|@''REPLACE_TIME''@|$(REPLACE_TIME)|g' \
@@ -2654,7 +3108,412 @@ EXTRA_DIST += mktime-internal.h
2654 3108
2655## end gnulib module timegm 3109## end gnulib module timegm
2656 3110
2657## begin gnulib module unistd 3111## begin gnulib module uchar-h
3112
3113BUILT_SOURCES += uchar.h
3114
3115uchar.h: uchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
3116 $(gl_V_at)$(SED_HEADER_STDOUT) \
3117 -e 's|@''GUARD_PREFIX''@|GL|g' \
3118 -e 's/@''HAVE_UCHAR_H''@/$(HAVE_UCHAR_H)/g' \
3119 -e 's/@''CXX_HAVE_UCHAR_H''@/$(CXX_HAVE_UCHAR_H)/g' \
3120 -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
3121 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
3122 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
3123 -e 's|@''NEXT_UCHAR_H''@|$(NEXT_UCHAR_H)|g' \
3124 -e 's|@''CXX_HAS_CHAR8_TYPE''@|$(CXX_HAS_CHAR8_TYPE)|g' \
3125 -e 's|@''CXX_HAS_UCHAR_TYPES''@|$(CXX_HAS_UCHAR_TYPES)|g' \
3126 -e 's|@''SMALL_WCHAR_T''@|$(SMALL_WCHAR_T)|g' \
3127 -e 's|@''GNULIBHEADERS_OVERRIDE_CHAR8_T''@|$(GNULIBHEADERS_OVERRIDE_CHAR8_T)|g' \
3128 -e 's|@''GNULIBHEADERS_OVERRIDE_CHAR16_T''@|$(GNULIBHEADERS_OVERRIDE_CHAR16_T)|g' \
3129 -e 's|@''GNULIBHEADERS_OVERRIDE_CHAR32_T''@|$(GNULIBHEADERS_OVERRIDE_CHAR32_T)|g' \
3130 -e 's/@''GNULIB_BTOC32''@/$(GL_GNULIB_BTOC32)/g' \
3131 -e 's/@''GNULIB_BTOWC''@/$(GL_GNULIB_BTOWC)/g' \
3132 -e 's/@''GNULIB_C32ISALNUM''@/$(GL_GNULIB_C32ISALNUM)/g' \
3133 -e 's/@''GNULIB_C32ISALPHA''@/$(GL_GNULIB_C32ISALPHA)/g' \
3134 -e 's/@''GNULIB_C32ISBLANK''@/$(GL_GNULIB_C32ISBLANK)/g' \
3135 -e 's/@''GNULIB_C32ISCNTRL''@/$(GL_GNULIB_C32ISCNTRL)/g' \
3136 -e 's/@''GNULIB_C32ISDIGIT''@/$(GL_GNULIB_C32ISDIGIT)/g' \
3137 -e 's/@''GNULIB_C32ISGRAPH''@/$(GL_GNULIB_C32ISGRAPH)/g' \
3138 -e 's/@''GNULIB_C32ISLOWER''@/$(GL_GNULIB_C32ISLOWER)/g' \
3139 -e 's/@''GNULIB_C32ISPRINT''@/$(GL_GNULIB_C32ISPRINT)/g' \
3140 -e 's/@''GNULIB_C32ISPUNCT''@/$(GL_GNULIB_C32ISPUNCT)/g' \
3141 -e 's/@''GNULIB_C32ISSPACE''@/$(GL_GNULIB_C32ISSPACE)/g' \
3142 -e 's/@''GNULIB_C32ISUPPER''@/$(GL_GNULIB_C32ISUPPER)/g' \
3143 -e 's/@''GNULIB_C32ISXDIGIT''@/$(GL_GNULIB_C32ISXDIGIT)/g' \
3144 -e 's/@''GNULIB_C32TOLOWER''@/$(GL_GNULIB_C32TOLOWER)/g' \
3145 -e 's/@''GNULIB_C32TOUPPER''@/$(GL_GNULIB_C32TOUPPER)/g' \
3146 -e 's/@''GNULIB_C32WIDTH''@/$(GL_GNULIB_C32WIDTH)/g' \
3147 -e 's/@''GNULIB_C32RTOMB''@/$(GL_GNULIB_C32RTOMB)/g' \
3148 -e 's/@''GNULIB_C32SNRTOMBS''@/$(GL_GNULIB_C32SNRTOMBS)/g' \
3149 -e 's/@''GNULIB_C32SRTOMBS''@/$(GL_GNULIB_C32SRTOMBS)/g' \
3150 -e 's/@''GNULIB_C32STOMBS''@/$(GL_GNULIB_C32STOMBS)/g' \
3151 -e 's/@''GNULIB_C32SWIDTH''@/$(GL_GNULIB_C32SWIDTH)/g' \
3152 -e 's/@''GNULIB_C32TOB''@/$(GL_GNULIB_C32TOB)/g' \
3153 -e 's/@''GNULIB_C32_APPLY_MAPPING''@/$(GL_GNULIB_C32_APPLY_MAPPING)/g' \
3154 -e 's/@''GNULIB_C32_APPLY_TYPE_TEST''@/$(GL_GNULIB_C32_APPLY_TYPE_TEST)/g' \
3155 -e 's/@''GNULIB_C32_GET_MAPPING''@/$(GL_GNULIB_C32_GET_MAPPING)/g' \
3156 -e 's/@''GNULIB_C32_GET_TYPE_TEST''@/$(GL_GNULIB_C32_GET_TYPE_TEST)/g' \
3157 -e 's/@''GNULIB_ISWCTYPE''@/$(GL_GNULIB_ISWCTYPE)/g' \
3158 -e 's/@''GNULIB_ISWDIGIT''@/$(GL_GNULIB_ISWDIGIT)/g' \
3159 -e 's/@''GNULIB_ISWXDIGIT''@/$(GL_GNULIB_ISWXDIGIT)/g' \
3160 -e 's/@''GNULIB_MBRTOC16''@/$(GL_GNULIB_MBRTOC16)/g' \
3161 -e 's/@''GNULIB_MBRTOC32''@/$(GL_GNULIB_MBRTOC32)/g' \
3162 -e 's/@''GNULIB_MBSNRTOC32S''@/$(GL_GNULIB_MBSNRTOC32S)/g' \
3163 -e 's/@''GNULIB_MBSNRTOWCS''@/$(GL_GNULIB_MBSNRTOWCS)/g' \
3164 -e 's/@''GNULIB_MBSRTOC32S''@/$(GL_GNULIB_MBSRTOC32S)/g' \
3165 -e 's/@''GNULIB_MBSRTOWCS''@/$(GL_GNULIB_MBSRTOWCS)/g' \
3166 -e 's/@''GNULIB_MBSTOC32S''@/$(GL_GNULIB_MBSTOC32S)/g' \
3167 -e 's/@''GNULIB_TOWCTRANS''@/$(GL_GNULIB_TOWCTRANS)/g' \
3168 -e 's/@''GNULIB_WCSNRTOMBS''@/$(GL_GNULIB_WCSNRTOMBS)/g' \
3169 -e 's/@''GNULIB_WCSRTOMBS''@/$(GL_GNULIB_WCSRTOMBS)/g' \
3170 -e 's/@''GNULIB_WCSWIDTH''@/$(GL_GNULIB_WCSWIDTH)/g' \
3171 -e 's/@''GNULIB_WCTOB''@/$(GL_GNULIB_WCTOB)/g' \
3172 -e 's/@''GNULIB_WCTRANS''@/$(GL_GNULIB_WCTRANS)/g' \
3173 -e 's/@''GNULIB_WCTYPE''@/$(GL_GNULIB_WCTYPE)/g' \
3174 -e 's/@''GNULIB_WCWIDTH''@/$(GL_GNULIB_WCWIDTH)/g' \
3175 -e 's|@''HAVE_C32RTOMB''@|$(HAVE_C32RTOMB)|g' \
3176 -e 's|@''HAVE_MBRTOC16''@|$(HAVE_MBRTOC16)|g' \
3177 -e 's|@''HAVE_MBRTOC32''@|$(HAVE_MBRTOC32)|g' \
3178 -e 's|@''REPLACE_C32RTOMB''@|$(REPLACE_C32RTOMB)|g' \
3179 -e 's|@''REPLACE_MBRTOC16''@|$(REPLACE_MBRTOC16)|g' \
3180 -e 's|@''REPLACE_MBRTOC32''@|$(REPLACE_MBRTOC32)|g' \
3181 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
3182 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
3183 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
3184 $(srcdir)/uchar.in.h > $@-t
3185 $(AM_V_at)mv $@-t $@
3186MOSTLYCLEANFILES += uchar.h uchar.h-t
3187
3188EXTRA_DIST += uchar.in.h
3189
3190## end gnulib module uchar-h
3191
3192## begin gnulib module unicase/base
3193
3194BUILT_SOURCES += $(LIBUNISTRING_UNICASE_H)
3195
3196unicase.h: unicase.in.h
3197 $(gl_V_at)$(SED_HEADER_STDOUT) \
3198 -e 's|@''HAVE_UNISTRING_WOE32DLL_H''@|$(HAVE_UNISTRING_WOE32DLL_H)|g' \
3199 -e 's/@''GNULIB_UNICASE_EMPTY_PREFIX_CONTEXT_DLL_VARIABLE''@/$(GL_GNULIB_UNICASE_EMPTY_PREFIX_CONTEXT_DLL_VARIABLE)/g' \
3200 -e 's/@''GNULIB_UNICASE_EMPTY_SUFFIX_CONTEXT_DLL_VARIABLE''@/$(GL_GNULIB_UNICASE_EMPTY_SUFFIX_CONTEXT_DLL_VARIABLE)/g' \
3201 $(srcdir)/unicase.in.h > $@-t
3202 $(AM_V_at)mv $@-t $@
3203MOSTLYCLEANFILES += unicase.h unicase.h-t
3204
3205EXTRA_DIST += unicase.in.h
3206
3207## end gnulib module unicase/base
3208
3209## begin gnulib module unicase/tolower
3210
3211if LIBUNISTRING_COMPILE_UNICASE_TOLOWER
3212libgnu_a_SOURCES += unicase/tolower.c
3213endif
3214
3215EXTRA_DIST += unicase/simple-mapping.h unicase/tolower.h
3216
3217## end gnulib module unicase/tolower
3218
3219## begin gnulib module unictype/base
3220
3221BUILT_SOURCES += $(LIBUNISTRING_UNICTYPE_H)
3222
3223unictype.h: unictype.in.h
3224 $(gl_V_at)$(SED_HEADER_STDOUT) \
3225 -e 's|@''HAVE_UNISTRING_WOE32DLL_H''@|$(HAVE_UNISTRING_WOE32DLL_H)|g' \
3226 -e 's/@''GNULIB_UNICTYPE_CATEGORY_L_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_L_DLL_VARIABLE)/g' \
3227 -e 's/@''GNULIB_UNICTYPE_CATEGORY_LC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_LC_DLL_VARIABLE)/g' \
3228 -e 's/@''GNULIB_UNICTYPE_CATEGORY_LU_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_LU_DLL_VARIABLE)/g' \
3229 -e 's/@''GNULIB_UNICTYPE_CATEGORY_LL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_LL_DLL_VARIABLE)/g' \
3230 -e 's/@''GNULIB_UNICTYPE_CATEGORY_LT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_LT_DLL_VARIABLE)/g' \
3231 -e 's/@''GNULIB_UNICTYPE_CATEGORY_LM_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_LM_DLL_VARIABLE)/g' \
3232 -e 's/@''GNULIB_UNICTYPE_CATEGORY_LO_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_LO_DLL_VARIABLE)/g' \
3233 -e 's/@''GNULIB_UNICTYPE_CATEGORY_M_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_M_DLL_VARIABLE)/g' \
3234 -e 's/@''GNULIB_UNICTYPE_CATEGORY_MN_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_MN_DLL_VARIABLE)/g' \
3235 -e 's/@''GNULIB_UNICTYPE_CATEGORY_MC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_MC_DLL_VARIABLE)/g' \
3236 -e 's/@''GNULIB_UNICTYPE_CATEGORY_ME_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_ME_DLL_VARIABLE)/g' \
3237 -e 's/@''GNULIB_UNICTYPE_CATEGORY_N_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_N_DLL_VARIABLE)/g' \
3238 -e 's/@''GNULIB_UNICTYPE_CATEGORY_ND_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_ND_DLL_VARIABLE)/g' \
3239 -e 's/@''GNULIB_UNICTYPE_CATEGORY_NL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_NL_DLL_VARIABLE)/g' \
3240 -e 's/@''GNULIB_UNICTYPE_CATEGORY_NO_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_NO_DLL_VARIABLE)/g' \
3241 -e 's/@''GNULIB_UNICTYPE_CATEGORY_P_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_P_DLL_VARIABLE)/g' \
3242 -e 's/@''GNULIB_UNICTYPE_CATEGORY_PC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_PC_DLL_VARIABLE)/g' \
3243 -e 's/@''GNULIB_UNICTYPE_CATEGORY_PD_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_PD_DLL_VARIABLE)/g' \
3244 -e 's/@''GNULIB_UNICTYPE_CATEGORY_PS_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_PS_DLL_VARIABLE)/g' \
3245 -e 's/@''GNULIB_UNICTYPE_CATEGORY_PE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_PE_DLL_VARIABLE)/g' \
3246 -e 's/@''GNULIB_UNICTYPE_CATEGORY_PI_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_PI_DLL_VARIABLE)/g' \
3247 -e 's/@''GNULIB_UNICTYPE_CATEGORY_PF_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_PF_DLL_VARIABLE)/g' \
3248 -e 's/@''GNULIB_UNICTYPE_CATEGORY_PO_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_PO_DLL_VARIABLE)/g' \
3249 -e 's/@''GNULIB_UNICTYPE_CATEGORY_S_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_S_DLL_VARIABLE)/g' \
3250 -e 's/@''GNULIB_UNICTYPE_CATEGORY_SM_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_SM_DLL_VARIABLE)/g' \
3251 -e 's/@''GNULIB_UNICTYPE_CATEGORY_SC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_SC_DLL_VARIABLE)/g' \
3252 -e 's/@''GNULIB_UNICTYPE_CATEGORY_SK_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_SK_DLL_VARIABLE)/g' \
3253 -e 's/@''GNULIB_UNICTYPE_CATEGORY_SO_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_SO_DLL_VARIABLE)/g' \
3254 -e 's/@''GNULIB_UNICTYPE_CATEGORY_Z_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_Z_DLL_VARIABLE)/g' \
3255 -e 's/@''GNULIB_UNICTYPE_CATEGORY_ZS_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_ZS_DLL_VARIABLE)/g' \
3256 -e 's/@''GNULIB_UNICTYPE_CATEGORY_ZL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_ZL_DLL_VARIABLE)/g' \
3257 -e 's/@''GNULIB_UNICTYPE_CATEGORY_ZP_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_ZP_DLL_VARIABLE)/g' \
3258 -e 's/@''GNULIB_UNICTYPE_CATEGORY_C_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_C_DLL_VARIABLE)/g' \
3259 -e 's/@''GNULIB_UNICTYPE_CATEGORY_CC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_CC_DLL_VARIABLE)/g' \
3260 -e 's/@''GNULIB_UNICTYPE_CATEGORY_CF_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_CF_DLL_VARIABLE)/g' \
3261 -e 's/@''GNULIB_UNICTYPE_CATEGORY_CS_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_CS_DLL_VARIABLE)/g' \
3262 -e 's/@''GNULIB_UNICTYPE_CATEGORY_CO_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_CO_DLL_VARIABLE)/g' \
3263 -e 's/@''GNULIB_UNICTYPE_CATEGORY_CN_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_CN_DLL_VARIABLE)/g' \
3264 < $(srcdir)/unictype.in.h > $@-t1
3265 $(AM_V_at)sed \
3266 -e 's/@''GNULIB_UNICTYPE_PROPERTY_WHITE_SPACE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_WHITE_SPACE_DLL_VARIABLE)/g' \
3267 -e 's/@''GNULIB_UNICTYPE_PROPERTY_ALPHABETIC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ALPHABETIC_DLL_VARIABLE)/g' \
3268 -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_ALPHABETIC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_ALPHABETIC_DLL_VARIABLE)/g' \
3269 -e 's/@''GNULIB_UNICTYPE_PROPERTY_NOT_A_CHARACTER_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_NOT_A_CHARACTER_DLL_VARIABLE)/g' \
3270 -e 's/@''GNULIB_UNICTYPE_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE)/g' \
3271 -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE)/g' \
3272 -e 's/@''GNULIB_UNICTYPE_PROPERTY_DEPRECATED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_DEPRECATED_DLL_VARIABLE)/g' \
3273 -e 's/@''GNULIB_UNICTYPE_PROPERTY_LOGICAL_ORDER_EXCEPTION_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_LOGICAL_ORDER_EXCEPTION_DLL_VARIABLE)/g' \
3274 -e 's/@''GNULIB_UNICTYPE_PROPERTY_VARIATION_SELECTOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_VARIATION_SELECTOR_DLL_VARIABLE)/g' \
3275 -e 's/@''GNULIB_UNICTYPE_PROPERTY_PRIVATE_USE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_PRIVATE_USE_DLL_VARIABLE)/g' \
3276 -e 's/@''GNULIB_UNICTYPE_PROPERTY_UNASSIGNED_CODE_VALUE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_UNASSIGNED_CODE_VALUE_DLL_VARIABLE)/g' \
3277 -e 's/@''GNULIB_UNICTYPE_PROPERTY_UPPERCASE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_UPPERCASE_DLL_VARIABLE)/g' \
3278 -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_UPPERCASE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_UPPERCASE_DLL_VARIABLE)/g' \
3279 -e 's/@''GNULIB_UNICTYPE_PROPERTY_LOWERCASE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_LOWERCASE_DLL_VARIABLE)/g' \
3280 -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_LOWERCASE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_LOWERCASE_DLL_VARIABLE)/g' \
3281 -e 's/@''GNULIB_UNICTYPE_PROPERTY_TITLECASE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_TITLECASE_DLL_VARIABLE)/g' \
3282 -e 's/@''GNULIB_UNICTYPE_PROPERTY_CASED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CASED_DLL_VARIABLE)/g' \
3283 -e 's/@''GNULIB_UNICTYPE_PROPERTY_CASE_IGNORABLE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CASE_IGNORABLE_DLL_VARIABLE)/g' \
3284 -e 's/@''GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_LOWERCASED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_LOWERCASED_DLL_VARIABLE)/g' \
3285 -e 's/@''GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_UPPERCASED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_UPPERCASED_DLL_VARIABLE)/g' \
3286 -e 's/@''GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_TITLECASED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_TITLECASED_DLL_VARIABLE)/g' \
3287 -e 's/@''GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEFOLDED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEFOLDED_DLL_VARIABLE)/g' \
3288 -e 's/@''GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEMAPPED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEMAPPED_DLL_VARIABLE)/g' \
3289 -e 's/@''GNULIB_UNICTYPE_PROPERTY_SOFT_DOTTED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_SOFT_DOTTED_DLL_VARIABLE)/g' \
3290 < $@-t1 > $@-t2
3291 $(AM_V_at)sed \
3292 -e 's/@''GNULIB_UNICTYPE_PROPERTY_ID_START_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ID_START_DLL_VARIABLE)/g' \
3293 -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_ID_START_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_ID_START_DLL_VARIABLE)/g' \
3294 -e 's/@''GNULIB_UNICTYPE_PROPERTY_ID_CONTINUE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ID_CONTINUE_DLL_VARIABLE)/g' \
3295 -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_ID_CONTINUE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_ID_CONTINUE_DLL_VARIABLE)/g' \
3296 -e 's/@''GNULIB_UNICTYPE_PROPERTY_XID_START_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_XID_START_DLL_VARIABLE)/g' \
3297 -e 's/@''GNULIB_UNICTYPE_PROPERTY_XID_CONTINUE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_XID_CONTINUE_DLL_VARIABLE)/g' \
3298 -e 's/@''GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_START_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_START_DLL_VARIABLE)/g' \
3299 -e 's/@''GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_CONTINUE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_CONTINUE_DLL_VARIABLE)/g' \
3300 -e 's/@''GNULIB_UNICTYPE_PROPERTY_PATTERN_WHITE_SPACE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_PATTERN_WHITE_SPACE_DLL_VARIABLE)/g' \
3301 -e 's/@''GNULIB_UNICTYPE_PROPERTY_PATTERN_SYNTAX_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_PATTERN_SYNTAX_DLL_VARIABLE)/g' \
3302 -e 's/@''GNULIB_UNICTYPE_PROPERTY_JOIN_CONTROL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_JOIN_CONTROL_DLL_VARIABLE)/g' \
3303 -e 's/@''GNULIB_UNICTYPE_PROPERTY_GRAPHEME_BASE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_GRAPHEME_BASE_DLL_VARIABLE)/g' \
3304 -e 's/@''GNULIB_UNICTYPE_PROPERTY_GRAPHEME_EXTEND_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_GRAPHEME_EXTEND_DLL_VARIABLE)/g' \
3305 -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_GRAPHEME_EXTEND_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_GRAPHEME_EXTEND_DLL_VARIABLE)/g' \
3306 -e 's/@''GNULIB_UNICTYPE_PROPERTY_GRAPHEME_LINK_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_GRAPHEME_LINK_DLL_VARIABLE)/g' \
3307 -e 's/@''GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK_DLL_VARIABLE)/g' \
3308 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_CONTROL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_CONTROL_DLL_VARIABLE)/g' \
3309 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_LEFT_TO_RIGHT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_LEFT_TO_RIGHT_DLL_VARIABLE)/g' \
3310 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT_DLL_VARIABLE)/g' \
3311 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT_DLL_VARIABLE)/g' \
3312 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_EUROPEAN_DIGIT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_EUROPEAN_DIGIT_DLL_VARIABLE)/g' \
3313 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_SEPARATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_SEPARATOR_DLL_VARIABLE)/g' \
3314 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_TERMINATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_TERMINATOR_DLL_VARIABLE)/g' \
3315 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_DIGIT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_DIGIT_DLL_VARIABLE)/g' \
3316 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_COMMON_SEPARATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_COMMON_SEPARATOR_DLL_VARIABLE)/g' \
3317 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_BLOCK_SEPARATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_BLOCK_SEPARATOR_DLL_VARIABLE)/g' \
3318 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_SEGMENT_SEPARATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_SEGMENT_SEPARATOR_DLL_VARIABLE)/g' \
3319 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_WHITESPACE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_WHITESPACE_DLL_VARIABLE)/g' \
3320 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_NON_SPACING_MARK_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_NON_SPACING_MARK_DLL_VARIABLE)/g' \
3321 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_BOUNDARY_NEUTRAL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_BOUNDARY_NEUTRAL_DLL_VARIABLE)/g' \
3322 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_PDF_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_PDF_DLL_VARIABLE)/g' \
3323 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE_DLL_VARIABLE)/g' \
3324 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_OTHER_NEUTRAL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_OTHER_NEUTRAL_DLL_VARIABLE)/g' \
3325 < $@-t2 > $@-t3
3326 $(AM_V_at)sed \
3327 -e 's/@''GNULIB_UNICTYPE_PROPERTY_HEX_DIGIT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_HEX_DIGIT_DLL_VARIABLE)/g' \
3328 -e 's/@''GNULIB_UNICTYPE_PROPERTY_ASCII_HEX_DIGIT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ASCII_HEX_DIGIT_DLL_VARIABLE)/g' \
3329 -e 's/@''GNULIB_UNICTYPE_PROPERTY_IDEOGRAPHIC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_IDEOGRAPHIC_DLL_VARIABLE)/g' \
3330 -e 's/@''GNULIB_UNICTYPE_PROPERTY_UNIFIED_IDEOGRAPH_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_UNIFIED_IDEOGRAPH_DLL_VARIABLE)/g' \
3331 -e 's/@''GNULIB_UNICTYPE_PROPERTY_RADICAL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_RADICAL_DLL_VARIABLE)/g' \
3332 -e 's/@''GNULIB_UNICTYPE_PROPERTY_IDS_UNARY_OPERATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_IDS_UNARY_OPERATOR_DLL_VARIABLE)/g' \
3333 -e 's/@''GNULIB_UNICTYPE_PROPERTY_IDS_BINARY_OPERATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_IDS_BINARY_OPERATOR_DLL_VARIABLE)/g' \
3334 -e 's/@''GNULIB_UNICTYPE_PROPERTY_IDS_TRINARY_OPERATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_IDS_TRINARY_OPERATOR_DLL_VARIABLE)/g' \
3335 -e 's/@''GNULIB_UNICTYPE_PROPERTY_EMOJI_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_EMOJI_DLL_VARIABLE)/g' \
3336 -e 's/@''GNULIB_UNICTYPE_PROPERTY_EMOJI_PRESENTATION_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_EMOJI_PRESENTATION_DLL_VARIABLE)/g' \
3337 -e 's/@''GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_DLL_VARIABLE)/g' \
3338 -e 's/@''GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_BASE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_BASE_DLL_VARIABLE)/g' \
3339 -e 's/@''GNULIB_UNICTYPE_PROPERTY_EMOJI_COMPONENT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_EMOJI_COMPONENT_DLL_VARIABLE)/g' \
3340 -e 's/@''GNULIB_UNICTYPE_PROPERTY_EXTENDED_PICTOGRAPHIC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_EXTENDED_PICTOGRAPHIC_DLL_VARIABLE)/g' \
3341 -e 's/@''GNULIB_UNICTYPE_PROPERTY_ZERO_WIDTH_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ZERO_WIDTH_DLL_VARIABLE)/g' \
3342 -e 's/@''GNULIB_UNICTYPE_PROPERTY_SPACE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_SPACE_DLL_VARIABLE)/g' \
3343 -e 's/@''GNULIB_UNICTYPE_PROPERTY_NON_BREAK_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_NON_BREAK_DLL_VARIABLE)/g' \
3344 -e 's/@''GNULIB_UNICTYPE_PROPERTY_ISO_CONTROL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ISO_CONTROL_DLL_VARIABLE)/g' \
3345 -e 's/@''GNULIB_UNICTYPE_PROPERTY_FORMAT_CONTROL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_FORMAT_CONTROL_DLL_VARIABLE)/g' \
3346 -e 's/@''GNULIB_UNICTYPE_PROPERTY_PREPENDED_CONCATENATION_MARK_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_PREPENDED_CONCATENATION_MARK_DLL_VARIABLE)/g' \
3347 -e 's/@''GNULIB_UNICTYPE_PROPERTY_DASH_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_DASH_DLL_VARIABLE)/g' \
3348 -e 's/@''GNULIB_UNICTYPE_PROPERTY_HYPHEN_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_HYPHEN_DLL_VARIABLE)/g' \
3349 -e 's/@''GNULIB_UNICTYPE_PROPERTY_PUNCTUATION_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_PUNCTUATION_DLL_VARIABLE)/g' \
3350 -e 's/@''GNULIB_UNICTYPE_PROPERTY_LINE_SEPARATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_LINE_SEPARATOR_DLL_VARIABLE)/g' \
3351 -e 's/@''GNULIB_UNICTYPE_PROPERTY_PARAGRAPH_SEPARATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_PARAGRAPH_SEPARATOR_DLL_VARIABLE)/g' \
3352 -e 's/@''GNULIB_UNICTYPE_PROPERTY_QUOTATION_MARK_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_QUOTATION_MARK_DLL_VARIABLE)/g' \
3353 -e 's/@''GNULIB_UNICTYPE_PROPERTY_SENTENCE_TERMINAL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_SENTENCE_TERMINAL_DLL_VARIABLE)/g' \
3354 -e 's/@''GNULIB_UNICTYPE_PROPERTY_TERMINAL_PUNCTUATION_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_TERMINAL_PUNCTUATION_DLL_VARIABLE)/g' \
3355 -e 's/@''GNULIB_UNICTYPE_PROPERTY_CURRENCY_SYMBOL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CURRENCY_SYMBOL_DLL_VARIABLE)/g' \
3356 -e 's/@''GNULIB_UNICTYPE_PROPERTY_MATH_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_MATH_DLL_VARIABLE)/g' \
3357 -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_MATH_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_MATH_DLL_VARIABLE)/g' \
3358 -e 's/@''GNULIB_UNICTYPE_PROPERTY_PAIRED_PUNCTUATION_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_PAIRED_PUNCTUATION_DLL_VARIABLE)/g' \
3359 -e 's/@''GNULIB_UNICTYPE_PROPERTY_LEFT_OF_PAIR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_LEFT_OF_PAIR_DLL_VARIABLE)/g' \
3360 -e 's/@''GNULIB_UNICTYPE_PROPERTY_COMBINING_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_COMBINING_DLL_VARIABLE)/g' \
3361 -e 's/@''GNULIB_UNICTYPE_PROPERTY_COMPOSITE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_COMPOSITE_DLL_VARIABLE)/g' \
3362 -e 's/@''GNULIB_UNICTYPE_PROPERTY_DECIMAL_DIGIT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_DECIMAL_DIGIT_DLL_VARIABLE)/g' \
3363 -e 's/@''GNULIB_UNICTYPE_PROPERTY_NUMERIC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_NUMERIC_DLL_VARIABLE)/g' \
3364 -e 's/@''GNULIB_UNICTYPE_PROPERTY_DIACRITIC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_DIACRITIC_DLL_VARIABLE)/g' \
3365 -e 's/@''GNULIB_UNICTYPE_PROPERTY_EXTENDER_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_EXTENDER_DLL_VARIABLE)/g' \
3366 -e 's/@''GNULIB_UNICTYPE_PROPERTY_IGNORABLE_CONTROL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_IGNORABLE_CONTROL_DLL_VARIABLE)/g' \
3367 -e 's/@''GNULIB_UNICTYPE_PROPERTY_REGIONAL_INDICATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_REGIONAL_INDICATOR_DLL_VARIABLE)/g' \
3368 < $@-t3 > $@-t4
3369 $(AM_V_at)rm -f $@-t1 $@-t2 $@-t3
3370 $(AM_V_at)mv $@-t4 $@
3371MOSTLYCLEANFILES += unictype.h unictype.h-t1 unictype.h-t2 unictype.h-t3 unictype.h-t4
3372
3373EXTRA_DIST += unictype.in.h
3374
3375## end gnulib module unictype/base
3376
3377## begin gnulib module unictype/ctype-alnum
3378
3379if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_ALNUM
3380libgnu_a_SOURCES += unictype/ctype_alnum.c
3381endif
3382
3383EXTRA_DIST += unictype/bitmap.h unictype/ctype_alnum.h
3384
3385## end gnulib module unictype/ctype-alnum
3386
3387## begin gnulib module unictype/ctype-alpha
3388
3389if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_ALPHA
3390libgnu_a_SOURCES += unictype/ctype_alpha.c
3391endif
3392
3393EXTRA_DIST += unictype/bitmap.h unictype/ctype_alpha.h
3394
3395## end gnulib module unictype/ctype-alpha
3396
3397## begin gnulib module unictype/ctype-blank
3398
3399if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_BLANK
3400libgnu_a_SOURCES += unictype/ctype_blank.c
3401endif
3402
3403EXTRA_DIST += unictype/bitmap.h unictype/ctype_blank.h
3404
3405## end gnulib module unictype/ctype-blank
3406
3407## begin gnulib module unictype/ctype-cntrl
3408
3409if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_CNTRL
3410libgnu_a_SOURCES += unictype/ctype_cntrl.c
3411endif
3412
3413EXTRA_DIST += unictype/bitmap.h unictype/ctype_cntrl.h
3414
3415## end gnulib module unictype/ctype-cntrl
3416
3417## begin gnulib module unictype/ctype-digit
3418
3419if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_DIGIT
3420libgnu_a_SOURCES += unictype/ctype_digit.c
3421endif
3422
3423EXTRA_DIST += unictype/bitmap.h unictype/ctype_digit.h
3424
3425## end gnulib module unictype/ctype-digit
3426
3427## begin gnulib module unictype/ctype-graph
3428
3429if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_GRAPH
3430libgnu_a_SOURCES += unictype/ctype_graph.c
3431endif
3432
3433EXTRA_DIST += unictype/bitmap.h unictype/ctype_graph.h
3434
3435## end gnulib module unictype/ctype-graph
3436
3437## begin gnulib module unictype/ctype-lower
3438
3439if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_LOWER
3440libgnu_a_SOURCES += unictype/ctype_lower.c
3441endif
3442
3443EXTRA_DIST += unictype/bitmap.h unictype/ctype_lower.h
3444
3445## end gnulib module unictype/ctype-lower
3446
3447## begin gnulib module unictype/ctype-print
3448
3449if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_PRINT
3450libgnu_a_SOURCES += unictype/ctype_print.c
3451endif
3452
3453EXTRA_DIST += unictype/bitmap.h unictype/ctype_print.h
3454
3455## end gnulib module unictype/ctype-print
3456
3457## begin gnulib module unictype/ctype-punct
3458
3459if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_PUNCT
3460libgnu_a_SOURCES += unictype/ctype_punct.c
3461endif
3462
3463EXTRA_DIST += unictype/bitmap.h unictype/ctype_punct.h
3464
3465## end gnulib module unictype/ctype-punct
3466
3467## begin gnulib module unictype/ctype-space
3468
3469if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_SPACE
3470libgnu_a_SOURCES += unictype/ctype_space.c
3471endif
3472
3473EXTRA_DIST += unictype/bitmap.h unictype/ctype_space.h
3474
3475## end gnulib module unictype/ctype-space
3476
3477## begin gnulib module unictype/ctype-upper
3478
3479if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_UPPER
3480libgnu_a_SOURCES += unictype/ctype_upper.c
3481endif
3482
3483EXTRA_DIST += unictype/bitmap.h unictype/ctype_upper.h
3484
3485## end gnulib module unictype/ctype-upper
3486
3487## begin gnulib module unictype/ctype-xdigit
3488
3489if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_XDIGIT
3490libgnu_a_SOURCES += unictype/ctype_xdigit.c
3491endif
3492
3493EXTRA_DIST += unictype/bitmap.h unictype/ctype_xdigit.h
3494
3495## end gnulib module unictype/ctype-xdigit
3496
3497## begin gnulib module uninorm/base
3498
3499BUILT_SOURCES += $(LIBUNISTRING_UNINORM_H)
3500
3501uninorm.h: uninorm.in.h
3502 $(gl_V_at)$(SED_HEADER_STDOUT) \
3503 -e 's|@''HAVE_UNISTRING_WOE32DLL_H''@|$(HAVE_UNISTRING_WOE32DLL_H)|g' \
3504 -e 's/@''GNULIB_UNINORM_NFD_DLL_VARIABLE''@/$(GL_GNULIB_UNINORM_NFD_DLL_VARIABLE)/g' \
3505 -e 's/@''GNULIB_UNINORM_NFC_DLL_VARIABLE''@/$(GL_GNULIB_UNINORM_NFC_DLL_VARIABLE)/g' \
3506 -e 's/@''GNULIB_UNINORM_NFKD_DLL_VARIABLE''@/$(GL_GNULIB_UNINORM_NFKD_DLL_VARIABLE)/g' \
3507 -e 's/@''GNULIB_UNINORM_NFKC_DLL_VARIABLE''@/$(GL_GNULIB_UNINORM_NFKC_DLL_VARIABLE)/g' \
3508 $(srcdir)/uninorm.in.h > $@-t
3509 $(AM_V_at)mv $@-t $@
3510MOSTLYCLEANFILES += uninorm.h uninorm.h-t
3511
3512EXTRA_DIST += uninorm.in.h
3513
3514## end gnulib module uninorm/base
3515
3516## begin gnulib module unistd-h
2658 3517
2659BUILT_SOURCES += unistd.h 3518BUILT_SOURCES += unistd.h
2660libgnu_a_SOURCES += unistd.c 3519libgnu_a_SOURCES += unistd.c
@@ -2830,11 +3689,13 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
2830 -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \ 3689 -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \
2831 -e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \ 3690 -e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \
2832 -e 's|@''REPLACE_GETENTROPY''@|$(REPLACE_GETENTROPY)|g' \ 3691 -e 's|@''REPLACE_GETENTROPY''@|$(REPLACE_GETENTROPY)|g' \
3692 -e 's|@''REPLACE_GETLOGIN''@|$(REPLACE_GETLOGIN)|g' \
2833 -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \ 3693 -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \
2834 -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ 3694 -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
2835 -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ 3695 -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
2836 -e 's|@''REPLACE_GETPASS''@|$(REPLACE_GETPASS)|g' \ 3696 -e 's|@''REPLACE_GETPASS''@|$(REPLACE_GETPASS)|g' \
2837 -e 's|@''REPLACE_GETPASS_FOR_GETPASS_GNU''@|$(REPLACE_GETPASS_FOR_GETPASS_GNU)|g' \ 3697 -e 's|@''REPLACE_GETPASS_FOR_GETPASS_GNU''@|$(REPLACE_GETPASS_FOR_GETPASS_GNU)|g' \
3698 -e 's|@''REPLACE_GETUSERSHELL''@|$(REPLACE_GETUSERSHELL)|g' \
2838 -e 's|@''REPLACE_ISATTY''@|$(REPLACE_ISATTY)|g' \ 3699 -e 's|@''REPLACE_ISATTY''@|$(REPLACE_ISATTY)|g' \
2839 -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ 3700 -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
2840 -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \ 3701 -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \
@@ -2870,7 +3731,43 @@ MOSTLYCLEANFILES += unistd.h unistd.h-t1 unistd.h-t2 unistd.h-t3 unistd.h-t4
2870 3731
2871EXTRA_DIST += unistd.in.h 3732EXTRA_DIST += unistd.in.h
2872 3733
2873## end gnulib module unistd 3734## end gnulib module unistd-h
3735
3736## begin gnulib module unitypes-h
3737
3738BUILT_SOURCES += $(LIBUNISTRING_UNITYPES_H)
3739
3740unitypes.h: unitypes.in.h
3741 $(gl_V_at)$(SED_HEADER_TO_AT_t) $(srcdir)/unitypes.in.h
3742 $(AM_V_at)mv $@-t $@
3743MOSTLYCLEANFILES += unitypes.h unitypes.h-t
3744
3745EXTRA_DIST += unitypes.in.h
3746
3747## end gnulib module unitypes-h
3748
3749## begin gnulib module uniwidth/base
3750
3751BUILT_SOURCES += $(LIBUNISTRING_UNIWIDTH_H)
3752
3753uniwidth.h: uniwidth.in.h
3754 $(gl_V_at)$(SED_HEADER_TO_AT_t) $(srcdir)/uniwidth.in.h
3755 $(AM_V_at)mv $@-t $@
3756MOSTLYCLEANFILES += uniwidth.h uniwidth.h-t
3757
3758EXTRA_DIST += localcharset.h uniwidth.in.h
3759
3760## end gnulib module uniwidth/base
3761
3762## begin gnulib module uniwidth/width
3763
3764if LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH
3765libgnu_a_SOURCES += uniwidth/width.c
3766endif
3767
3768EXTRA_DIST += unictype/bitmap.h uniwidth/cjk.h uniwidth/width0.h uniwidth/width2.h
3769
3770## end gnulib module uniwidth/width
2874 3771
2875## begin gnulib module unlocked-io-internal 3772## begin gnulib module unlocked-io-internal
2876 3773
@@ -2921,7 +3818,13 @@ EXTRA_libgnu_a_SOURCES += vsnprintf.c
2921 3818
2922## end gnulib module vsnprintf 3819## end gnulib module vsnprintf
2923 3820
2924## begin gnulib module wchar 3821## begin gnulib module vsnzprintf
3822
3823libgnu_a_SOURCES += vsnzprintf.c
3824
3825## end gnulib module vsnzprintf
3826
3827## begin gnulib module wchar-h
2925 3828
2926BUILT_SOURCES += wchar.h 3829BUILT_SOURCES += wchar.h
2927 3830
@@ -3025,7 +3928,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
3025 -e 's|@''HAVE_WCSTOK''@|$(HAVE_WCSTOK)|g' \ 3928 -e 's|@''HAVE_WCSTOK''@|$(HAVE_WCSTOK)|g' \
3026 -e 's|@''HAVE_WCSWIDTH''@|$(HAVE_WCSWIDTH)|g' \ 3929 -e 's|@''HAVE_WCSWIDTH''@|$(HAVE_WCSWIDTH)|g' \
3027 -e 's|@''HAVE_WCSFTIME''@|$(HAVE_WCSFTIME)|g' \ 3930 -e 's|@''HAVE_WCSFTIME''@|$(HAVE_WCSFTIME)|g' \
3028 -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \ 3931 -e 's|@''HAVE_WCTOB''@|$(HAVE_WCTOB)|g' \
3029 -e 's|@''HAVE_DECL_WCSDUP''@|$(HAVE_DECL_WCSDUP)|g' \ 3932 -e 's|@''HAVE_DECL_WCSDUP''@|$(HAVE_DECL_WCSDUP)|g' \
3030 -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ 3933 -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
3031 < $@-t1 > $@-t2 3934 < $@-t1 > $@-t2
@@ -3046,6 +3949,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
3046 -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \ 3949 -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \
3047 -e 's|@''REPLACE_WCSFTIME''@|$(REPLACE_WCSFTIME)|g' \ 3950 -e 's|@''REPLACE_WCSFTIME''@|$(REPLACE_WCSFTIME)|g' \
3048 -e 's|@''REPLACE_WCSCMP''@|$(REPLACE_WCSCMP)|g' \ 3951 -e 's|@''REPLACE_WCSCMP''@|$(REPLACE_WCSCMP)|g' \
3952 -e 's|@''REPLACE_WCSNCAT''@|$(REPLACE_WCSNCAT)|g' \
3049 -e 's|@''REPLACE_WCSNCMP''@|$(REPLACE_WCSNCMP)|g' \ 3953 -e 's|@''REPLACE_WCSNCMP''@|$(REPLACE_WCSNCMP)|g' \
3050 -e 's|@''REPLACE_WCSSTR''@|$(REPLACE_WCSSTR)|g' \ 3954 -e 's|@''REPLACE_WCSSTR''@|$(REPLACE_WCSSTR)|g' \
3051 -e 's|@''REPLACE_WCSTOK''@|$(REPLACE_WCSTOK)|g' \ 3955 -e 's|@''REPLACE_WCSTOK''@|$(REPLACE_WCSTOK)|g' \
@@ -3061,7 +3965,7 @@ MOSTLYCLEANFILES += wchar.h wchar.h-t1 wchar.h-t2 wchar.h-t3
3061 3965
3062EXTRA_DIST += wchar.in.h 3966EXTRA_DIST += wchar.in.h
3063 3967
3064## end gnulib module wchar 3968## end gnulib module wchar-h
3065 3969
3066## begin gnulib module wcrtomb 3970## begin gnulib module wcrtomb
3067 3971
@@ -3130,6 +4034,14 @@ EXTRA_DIST += wctype.in.h
3130 4034
3131## end gnulib module wctype-h 4035## end gnulib module wctype-h
3132 4036
4037## begin gnulib module wcwidth
4038
4039if GL_COND_OBJ_WCWIDTH
4040libgnu_a_SOURCES += wcwidth.c
4041endif
4042
4043## end gnulib module wcwidth
4044
3133## begin gnulib module windows-mutex 4045## begin gnulib module windows-mutex
3134 4046
3135if GL_COND_OBJ_WINDOWS_MUTEX 4047if GL_COND_OBJ_WINDOWS_MUTEX
@@ -3209,5 +4121,5 @@ mostlyclean-local: mostlyclean-generic
3209 : 4121 :
3210distclean-local: distclean-gnulib-libobjs 4122distclean-local: distclean-gnulib-libobjs
3211distclean-gnulib-libobjs: 4123distclean-gnulib-libobjs:
3212 -rm -f @gl_LIBOBJDEPS@ 4124 -rm -f @gl_libgnu_LIBOBJDEPS@
3213maintainer-clean-local: distclean-gnulib-libobjs 4125maintainer-clean-local: distclean-gnulib-libobjs
diff --git a/gl/_Noreturn.h b/gl/_Noreturn.h
index 7326bd47..0bab051e 100644
--- a/gl/_Noreturn.h
+++ b/gl/_Noreturn.h
@@ -1,5 +1,5 @@
1/* A C macro for declaring that a function does not return. 1/* A C macro for declaring that a function does not return.
2 Copyright (C) 2011-2024 Free Software Foundation, Inc. 2 Copyright (C) 2011-2026 Free Software Foundation, Inc.
3 3
4 This program is free software: you can redistribute it and/or modify it 4 This program is free software: you can redistribute it and/or modify it
5 under the terms of the GNU Lesser General Public License as published 5 under the terms of the GNU Lesser General Public License as published
@@ -14,33 +14,26 @@
14 You should have received a copy of the GNU Lesser General Public License 14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16 16
17/* The _Noreturn keyword of C11.
18 Do not use [[noreturn]], because with it the syntax
19 extern _Noreturn void func (...);
20 would not be valid; such a declaration would be valid only with 'extern'
21 and '_Noreturn' swapped, or without the 'extern' keyword. However, some
22 AIX system header files and several gnulib header files use precisely
23 this syntax with 'extern'. So even though C23 deprecates _Noreturn,
24 it is currently more portable to prefer it to [[noreturn]].
25
26 Also, do not try to work around LLVM bug 59792 (clang 15 or earlier).
27 This rare bug can be worked around by compiling with 'clang -D_Noreturn=',
28 though the workaround may generate many false-alarm warnings. */
17#ifndef _Noreturn 29#ifndef _Noreturn
18# if (defined __cplusplus \ 30# if ((!defined __cplusplus || defined __clang__) \
19 && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ 31 && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0)))
20 || (defined _MSC_VER && 1900 <= _MSC_VER)) \
21 && 0)
22 /* [[noreturn]] is not practically usable, because with it the syntax
23 extern _Noreturn void func (...);
24 would not be valid; such a declaration would only be valid with 'extern'
25 and '_Noreturn' swapped, or without the 'extern' keyword. However, some
26 AIX system header files and several gnulib header files use precisely
27 this syntax with 'extern'. */
28# define _Noreturn [[noreturn]]
29# elif (defined __clang__ && __clang_major__ < 16 \
30 && defined _GL_WORK_AROUND_LLVM_BUG_59792)
31 /* Compile with -D_GL_WORK_AROUND_LLVM_BUG_59792 to work around
32 that rare LLVM bug, though you may get many false-alarm warnings. */
33# define _Noreturn
34# elif ((!defined __cplusplus || defined __clang__) \
35 && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
36 || (!defined __STRICT_ANSI__ \
37 && (4 < __GNUC__ + (7 <= __GNUC_MINOR__) \
38 || (defined __apple_build_version__ \
39 ? 6000000 <= __apple_build_version__ \
40 : 3 < __clang_major__ + (5 <= __clang_minor__))))))
41 /* _Noreturn works as-is. */ 32 /* _Noreturn works as-is. */
42# elif (2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ \ 33# elif (2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ \
43 || 0x5110 <= __SUNPRO_C) 34 || 0x5110 <= __SUNPRO_C)
35 /* Prefer __attribute__ ((__noreturn__)) to plain _Noreturn even if the
36 latter works, as 'gcc -std=gnu99 -Wpedantic' warns about _Noreturn. */
44# define _Noreturn __attribute__ ((__noreturn__)) 37# define _Noreturn __attribute__ ((__noreturn__))
45# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) 38# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
46# define _Noreturn __declspec (noreturn) 39# define _Noreturn __declspec (noreturn)
diff --git a/gl/af_alg.c b/gl/af_alg.c
index 6fd08c28..91f3df15 100644
--- a/gl/af_alg.c
+++ b/gl/af_alg.c
@@ -1,5 +1,5 @@
1/* af_alg.c - Compute message digests from file streams and buffers. 1/* af_alg.c - Compute message digests from file streams and buffers.
2 Copyright (C) 2018-2024 Free Software Foundation, Inc. 2 Copyright (C) 2018-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -112,100 +112,102 @@ afalg_stream (FILE *stream, const char *alg,
112 read-write loop work around an empty-input bug noted below. */ 112 read-write loop work around an empty-input bug noted below. */
113 int fd = fileno (stream); 113 int fd = fileno (stream);
114 int result; 114 int result;
115 struct stat st; 115 {
116 off_t off = ftello (stream); 116 struct stat st;
117 if (0 <= off && fstat (fd, &st) == 0 117 off_t off = ftello (stream);
118 && (S_ISREG (st.st_mode) || S_TYPEISSHM (&st) || S_TYPEISTMO (&st)) 118 if (0 <= off && fstat (fd, &st) == 0
119 && off < st.st_size && st.st_size - off < SYS_BUFSIZE_MAX) 119 && (S_ISREG (st.st_mode) || S_TYPEISSHM (&st) || S_TYPEISTMO (&st))
120 { 120 && off < st.st_size && st.st_size - off < SYS_BUFSIZE_MAX)
121 /* Make sure the offset of fileno (stream) reflects how many bytes 121 {
122 have been read from stream before this function got invoked. 122 /* Make sure the offset of fileno (stream) reflects how many bytes
123 Note: fflush on an input stream after ungetc does not work as expected 123 have been read from stream before this function got invoked.
124 on some platforms. Therefore this situation is not supported here. */ 124 Note: fflush on an input stream after ungetc does not work as expected
125 if (fflush (stream)) 125 on some platforms. Therefore this situation is not supported here. */
126 result = -EIO; 126 if (fflush (stream))
127 else 127 result = -EIO;
128 { 128 else
129 off_t nbytes = st.st_size - off; 129 {
130 if (sendfile (ofd, fd, &off, nbytes) == nbytes) 130 off_t nbytes = st.st_size - off;
131 { 131 if (sendfile (ofd, fd, &off, nbytes) == nbytes)
132 if (read (ofd, resblock, hashlen) == hashlen) 132 {
133 { 133 if (read (ofd, resblock, hashlen) == hashlen)
134 /* The input buffers of stream are no longer valid. */ 134 {
135 if (lseek (fd, off, SEEK_SET) != (off_t)-1) 135 /* The input buffers of stream are no longer valid. */
136 result = 0; 136 if (lseek (fd, off, SEEK_SET) != (off_t)-1)
137 else 137 result = 0;
138 /* The file position of fd has not changed. */ 138 else
139 /* The file position of fd has not changed. */
140 result = -EAFNOSUPPORT;
141 }
142 else
143 /* The file position of fd has not changed. */
144 result = -EAFNOSUPPORT;
145 }
146 else
147 /* The file position of fd has not changed. */
148 result = -EAFNOSUPPORT;
149 }
150 }
151 else
152 {
153 /* sendfile not possible, do a classic read-write loop. */
154
155 /* Number of bytes to seek (backwards) in case of error. */
156 off_t nseek = 0;
157
158 for (;;)
159 {
160 char buf[BLOCKSIZE];
161 /* When the stream is not seekable, start with a single-byte block,
162 so that we can use ungetc() in the case that send() fails. */
163 size_t blocksize = (nseek == 0 && off < 0 ? 1 : BLOCKSIZE);
164 ssize_t size = fread (buf, 1, blocksize, stream);
165 if (size == 0)
166 {
167 /* On Linux < 4.9, the value for an empty stream is wrong (all 0).
168 See <https://patchwork.kernel.org/patch/9308641/>.
169 This was not fixed properly until November 2016,
170 see <https://patchwork.kernel.org/patch/9434741/>. */
171 result = ferror (stream) ? -EIO : nseek == 0 ? -EAFNOSUPPORT : 0;
172 break;
173 }
174 nseek -= size;
175 if (send (ofd, buf, size, MSG_MORE) != size)
176 {
177 if (nseek == -1)
178 {
179 /* 1 byte of pushback buffer is guaranteed on stream, even
180 if stream is not seekable. */
181 ungetc ((unsigned char) buf[0], stream);
139 result = -EAFNOSUPPORT; 182 result = -EAFNOSUPPORT;
140 } 183 }
141 else 184 else if (fseeko (stream, nseek, SEEK_CUR) == 0)
142 /* The file position of fd has not changed. */ 185 /* The position of stream has been restored. */
143 result = -EAFNOSUPPORT;
144 }
145 else
146 /* The file position of fd has not changed. */
147 result = -EAFNOSUPPORT;
148 }
149 }
150 else
151 {
152 /* sendfile not possible, do a classic read-write loop. */
153
154 /* Number of bytes to seek (backwards) in case of error. */
155 off_t nseek = 0;
156
157 for (;;)
158 {
159 char buf[BLOCKSIZE];
160 /* When the stream is not seekable, start with a single-byte block,
161 so that we can use ungetc() in the case that send() fails. */
162 size_t blocksize = (nseek == 0 && off < 0 ? 1 : BLOCKSIZE);
163 ssize_t size = fread (buf, 1, blocksize, stream);
164 if (size == 0)
165 {
166 /* On Linux < 4.9, the value for an empty stream is wrong (all 0).
167 See <https://patchwork.kernel.org/patch/9308641/>.
168 This was not fixed properly until November 2016,
169 see <https://patchwork.kernel.org/patch/9434741/>. */
170 result = ferror (stream) ? -EIO : nseek == 0 ? -EAFNOSUPPORT : 0;
171 break;
172 }
173 nseek -= size;
174 if (send (ofd, buf, size, MSG_MORE) != size)
175 {
176 if (nseek == -1)
177 {
178 /* 1 byte of pushback buffer is guaranteed on stream, even
179 if stream is not seekable. */
180 ungetc ((unsigned char) buf[0], stream);
181 result = -EAFNOSUPPORT; 186 result = -EAFNOSUPPORT;
182 } 187 else
183 else if (fseeko (stream, nseek, SEEK_CUR) == 0) 188 result = -EIO;
184 /* The position of stream has been restored. */ 189 break;
185 result = -EAFNOSUPPORT; 190 }
186 else 191
187 result = -EIO; 192 /* Don't assume that EOF is sticky. See:
188 break; 193 <https://sourceware.org/PR19476>. */
189 } 194 if (feof (stream))
190 195 {
191 /* Don't assume that EOF is sticky. See: 196 result = 0;
192 <https://sourceware.org/bugzilla/show_bug.cgi?id=19476>. */ 197 break;
193 if (feof (stream)) 198 }
194 { 199 }
195 result = 0; 200
196 break; 201 if (result == 0 && read (ofd, resblock, hashlen) != hashlen)
197 } 202 {
198 } 203 if (nseek == 0 || fseeko (stream, nseek, SEEK_CUR) == 0)
199 204 /* The position of stream has been restored. */
200 if (result == 0 && read (ofd, resblock, hashlen) != hashlen) 205 result = -EAFNOSUPPORT;
201 { 206 else
202 if (nseek == 0 || fseeko (stream, nseek, SEEK_CUR) == 0) 207 result = -EIO;
203 /* The position of stream has been restored. */ 208 }
204 result = -EAFNOSUPPORT; 209 }
205 else 210 }
206 result = -EIO;
207 }
208 }
209 close (ofd); 211 close (ofd);
210 return result; 212 return result;
211} 213}
diff --git a/gl/af_alg.h b/gl/af_alg.h
index ed933e12..1321970f 100644
--- a/gl/af_alg.h
+++ b/gl/af_alg.h
@@ -1,5 +1,5 @@
1/* af_alg.h - Compute message digests from file streams and buffers. 1/* af_alg.h - Compute message digests from file streams and buffers.
2 Copyright (C) 2018-2024 Free Software Foundation, Inc. 2 Copyright (C) 2018-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/alloca.in.h b/gl/alloca.in.h
index 6aa47df8..bb2cb881 100644
--- a/gl/alloca.in.h
+++ b/gl/alloca.in.h
@@ -1,6 +1,6 @@
1/* Memory allocation on the stack. 1/* Memory allocation on the stack.
2 2
3 Copyright (C) 1995, 1999, 2001-2004, 2006-2024 Free Software Foundation, 3 Copyright (C) 1995, 1999, 2001-2004, 2006-2026 Free Software Foundation,
4 Inc. 4 Inc.
5 5
6 This file is free software: you can redistribute it and/or modify 6 This file is free software: you can redistribute it and/or modify
diff --git a/gl/arg-nonnull.h b/gl/arg-nonnull.h
index 46c711ca..d370d139 100644
--- a/gl/arg-nonnull.h
+++ b/gl/arg-nonnull.h
@@ -1,5 +1,5 @@
1/* A C macro for declaring that specific arguments must not be NULL. 1/* A C macro for declaring that specific arguments must not be NULL.
2 Copyright (C) 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 2009-2026 Free Software Foundation, Inc.
3 3
4 This program is free software: you can redistribute it and/or modify it 4 This program is free software: you can redistribute it and/or modify it
5 under the terms of the GNU Lesser General Public License as published 5 under the terms of the GNU Lesser General Public License as published
diff --git a/gl/arpa_inet.c b/gl/arpa_inet.c
new file mode 100644
index 00000000..d0ff3a31
--- /dev/null
+++ b/gl/arpa_inet.c
@@ -0,0 +1,20 @@
1/* Inline functions for <arpa/inet.h>.
2
3 Copyright (C) 2024-2026 Free Software Foundation, Inc.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#define _GL_ARPA_INET_INLINE _GL_EXTERN_INLINE
19#include <config.h>
20#include <arpa/inet.h>
diff --git a/gl/arpa_inet.in.h b/gl/arpa_inet.in.h
index 523a448c..a9c93d07 100644
--- a/gl/arpa_inet.in.h
+++ b/gl/arpa_inet.in.h
@@ -1,6 +1,6 @@
1/* A GNU-like <arpa/inet.h>. 1/* A GNU-like <arpa/inet.h>.
2 2
3 Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. 3 Copyright (C) 2005-2006, 2008-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -60,6 +60,53 @@
60# include <ws2tcpip.h> 60# include <ws2tcpip.h>
61#endif 61#endif
62 62
63#if !(@HAVE_DECL_HTONL@ || @HAVE_DECL_HTONS@ || @HAVE_DECL_NTOHL@ || @HAVE_DECL_NTOHS@)
64# include <endian.h>
65#endif
66
67_GL_INLINE_HEADER_BEGIN
68#ifndef _GL_ARPA_INET_INLINE
69# define _GL_ARPA_INET_INLINE _GL_INLINE
70#endif
71
72
73/* Host to network byte order. */
74
75#if !@HAVE_DECL_HTONS@
76_GL_ARPA_INET_INLINE uint16_t
77htons (uint16_t value)
78{
79 return htobe16 (value);
80}
81#endif
82
83#if !@HAVE_DECL_HTONL@
84_GL_ARPA_INET_INLINE uint32_t
85htonl (uint32_t value)
86{
87 return htobe32 (value);
88}
89#endif
90
91/* Network to host byte order. */
92
93#if !@HAVE_DECL_NTOHS@
94_GL_ARPA_INET_INLINE uint16_t
95ntohs (uint16_t value)
96{
97 return htobe16 (value);
98}
99#endif
100
101#if !@HAVE_DECL_NTOHL@
102_GL_ARPA_INET_INLINE uint32_t
103ntohl (uint32_t value)
104{
105 return htobe32 (value);
106}
107#endif
108
109
63/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 110/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
64 111
65/* The definition of _GL_ARG_NONNULL is copied here. */ 112/* The definition of _GL_ARG_NONNULL is copied here. */
@@ -90,7 +137,7 @@
90# endif 137# endif
91_GL_FUNCDECL_RPL (inet_ntop, const char *, 138_GL_FUNCDECL_RPL (inet_ntop, const char *,
92 (int af, const void *restrict src, 139 (int af, const void *restrict src,
93 char *restrict dst, socklen_t cnt) 140 char *restrict dst, socklen_t cnt),
94 _GL_ARG_NONNULL ((2, 3))); 141 _GL_ARG_NONNULL ((2, 3)));
95_GL_CXXALIAS_RPL (inet_ntop, const char *, 142_GL_CXXALIAS_RPL (inet_ntop, const char *,
96 (int af, const void *restrict src, 143 (int af, const void *restrict src,
@@ -99,7 +146,7 @@ _GL_CXXALIAS_RPL (inet_ntop, const char *,
99# if !@HAVE_DECL_INET_NTOP@ 146# if !@HAVE_DECL_INET_NTOP@
100_GL_FUNCDECL_SYS (inet_ntop, const char *, 147_GL_FUNCDECL_SYS (inet_ntop, const char *,
101 (int af, const void *restrict src, 148 (int af, const void *restrict src,
102 char *restrict dst, socklen_t cnt) 149 char *restrict dst, socklen_t cnt),
103 _GL_ARG_NONNULL ((2, 3))); 150 _GL_ARG_NONNULL ((2, 3)));
104# endif 151# endif
105/* Need to cast, because on NonStop Kernel, the fourth parameter is 152/* Need to cast, because on NonStop Kernel, the fourth parameter is
@@ -112,7 +159,6 @@ _GL_CXXALIAS_SYS_CAST (inet_ntop, const char *,
112_GL_CXXALIASWARN (inet_ntop); 159_GL_CXXALIASWARN (inet_ntop);
113# endif 160# endif
114#elif defined GNULIB_POSIXCHECK 161#elif defined GNULIB_POSIXCHECK
115# undef inet_ntop
116# if HAVE_RAW_DECL_INET_NTOP 162# if HAVE_RAW_DECL_INET_NTOP
117_GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - " 163_GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - "
118 "use gnulib module inet_ntop for portability"); 164 "use gnulib module inet_ntop for portability");
@@ -126,14 +172,14 @@ _GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - "
126# define inet_pton rpl_inet_pton 172# define inet_pton rpl_inet_pton
127# endif 173# endif
128_GL_FUNCDECL_RPL (inet_pton, int, 174_GL_FUNCDECL_RPL (inet_pton, int,
129 (int af, const char *restrict src, void *restrict dst) 175 (int af, const char *restrict src, void *restrict dst),
130 _GL_ARG_NONNULL ((2, 3))); 176 _GL_ARG_NONNULL ((2, 3)));
131_GL_CXXALIAS_RPL (inet_pton, int, 177_GL_CXXALIAS_RPL (inet_pton, int,
132 (int af, const char *restrict src, void *restrict dst)); 178 (int af, const char *restrict src, void *restrict dst));
133# else 179# else
134# if !@HAVE_DECL_INET_PTON@ 180# if !@HAVE_DECL_INET_PTON@
135_GL_FUNCDECL_SYS (inet_pton, int, 181_GL_FUNCDECL_SYS (inet_pton, int,
136 (int af, const char *restrict src, void *restrict dst) 182 (int af, const char *restrict src, void *restrict dst),
137 _GL_ARG_NONNULL ((2, 3))); 183 _GL_ARG_NONNULL ((2, 3)));
138# endif 184# endif
139_GL_CXXALIAS_SYS (inet_pton, int, 185_GL_CXXALIAS_SYS (inet_pton, int,
@@ -143,13 +189,13 @@ _GL_CXXALIAS_SYS (inet_pton, int,
143_GL_CXXALIASWARN (inet_pton); 189_GL_CXXALIASWARN (inet_pton);
144# endif 190# endif
145#elif defined GNULIB_POSIXCHECK 191#elif defined GNULIB_POSIXCHECK
146# undef inet_pton
147# if HAVE_RAW_DECL_INET_PTON 192# if HAVE_RAW_DECL_INET_PTON
148_GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - " 193_GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - "
149 "use gnulib module inet_pton for portability"); 194 "use gnulib module inet_pton for portability");
150# endif 195# endif
151#endif 196#endif
152 197
198_GL_INLINE_HEADER_END
153 199
154#endif /* _@GUARD_PREFIX@_ARPA_INET_H */ 200#endif /* _@GUARD_PREFIX@_ARPA_INET_H */
155#endif /* _@GUARD_PREFIX@_ARPA_INET_H */ 201#endif /* _@GUARD_PREFIX@_ARPA_INET_H */
diff --git a/gl/asnprintf.c b/gl/asnprintf.c
index a6c09bc2..05582499 100644
--- a/gl/asnprintf.c
+++ b/gl/asnprintf.c
@@ -1,5 +1,5 @@
1/* Formatted output to strings. 1/* Formatted output to strings.
2 Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -25,10 +25,8 @@ char *
25asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) 25asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
26{ 26{
27 va_list args; 27 va_list args;
28 char *result;
29
30 va_start (args, format); 28 va_start (args, format);
31 result = vasnprintf (resultbuf, lengthp, format, args); 29 char *result = vasnprintf (resultbuf, lengthp, format, args);
32 va_end (args); 30 va_end (args);
33 return result; 31 return result;
34} 32}
diff --git a/gl/asprintf.c b/gl/asprintf.c
index b0c33478..5da2d085 100644
--- a/gl/asprintf.c
+++ b/gl/asprintf.c
@@ -1,5 +1,5 @@
1/* Formatted output to strings. 1/* Formatted output to strings.
2 Copyright (C) 1999, 2002, 2006-2007, 2009-2024 Free Software Foundation, 2 Copyright (C) 1999, 2002, 2006-2007, 2009-2026 Free Software Foundation,
3 Inc. 3 Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
@@ -30,10 +30,8 @@ int
30asprintf (char **resultp, const char *format, ...) 30asprintf (char **resultp, const char *format, ...)
31{ 31{
32 va_list args; 32 va_list args;
33 int result;
34
35 va_start (args, format); 33 va_start (args, format);
36 result = vasprintf (resultp, format, args); 34 int result = vasprintf (resultp, format, args);
37 va_end (args); 35 va_end (args);
38 return result; 36 return result;
39} 37}
diff --git a/gl/assert.in.h b/gl/assert.in.h
index 6e4995e1..8a564670 100644
--- a/gl/assert.in.h
+++ b/gl/assert.in.h
@@ -1,5 +1,5 @@
1/* Substitute for and wrapper around <assert.h> 1/* Substitute for and wrapper around <assert.h>
2 Copyright (C) 2011-2024 Free Software Foundation, Inc. 2 Copyright (C) 2011-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/attribute.h b/gl/attribute.h
index 710341ba..c50befdf 100644
--- a/gl/attribute.h
+++ b/gl/attribute.h
@@ -1,6 +1,6 @@
1/* ATTRIBUTE_* macros for using attributes in GCC and similar compilers 1/* ATTRIBUTE_* macros for using attributes in GCC and similar compilers
2 2
3 Copyright 2020-2024 Free Software Foundation, Inc. 3 Copyright 2020-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -20,12 +20,50 @@
20/* Provide public ATTRIBUTE_* names for the private _GL_ATTRIBUTE_* 20/* Provide public ATTRIBUTE_* names for the private _GL_ATTRIBUTE_*
21 macros used within Gnulib. */ 21 macros used within Gnulib. */
22 22
23/* These attributes can be placed in two ways: 23/* The placement of these attributes depends on the kind of declaration
24 - At the start of a declaration (i.e. even before storage-class 24 and, in some cases, also on the programming language (C vs. C++).
25 specifiers!); then they apply to all entities that are declared 25
26 by the declaration. 26 In function declarations and function definitions:
27 - Immediately after the name of an entity being declared by the 27
28 declaration; then they apply to that entity only. */ 28 * ATTRIBUTE_NOTHROW must come after the parameter list.
29
30 * The macros
31 ATTRIBUTE_CONST
32 ATTRIBUTE_PURE
33 DEPRECATED
34 MAYBE_UNUSED
35 NODISCARD
36 REPRODUCIBLE
37 UNSEQUENCED
38 must come before the return type, and more precisely:
39 - In a function declaration/definition without a storage-class
40 specifier: at the beginning of the declaration/definition.
41 - In a function declaration/definition with a storage-class
42 specifier:
43 - In C: before the storage-class specifier.
44 - In C++: between the storage-class specifier and the return type.
45
46 * The other macros can be placed
47 - Either
48 - In a function declaration/definition without a storage-class
49 specifier: at the beginning of the declaration/definition.
50 - In a function declaration/definition with a storage-class
51 specifier: between the storage-class specifier and the return
52 type.
53 - Or, in a function declaration:
54 after the parameter list,
55 ∙ but after ATTRIBUTE_NOTHROW if present.
56
57 In other declarations, such as variable declarations:
58
59 * Either
60 - In C: before the storage-class specifier.
61 - In C++: between the storage-class specifier and the return type.
62 Then they apply to all entities that are declared by the declaration.
63
64 * Or immediately after the name of an entity being declared by the
65 declaration. Then they apply to that entity only.
66 */
29 67
30#ifndef _GL_ATTRIBUTE_H 68#ifndef _GL_ATTRIBUTE_H
31#define _GL_ATTRIBUTE_H 69#define _GL_ATTRIBUTE_H
@@ -48,9 +86,10 @@
48 _GL_ATTRIBUTE_FALLTHROUGH, _GL_ATTRIBUTE_FORMAT, _GL_ATTRIBUTE_LEAF, 86 _GL_ATTRIBUTE_FALLTHROUGH, _GL_ATTRIBUTE_FORMAT, _GL_ATTRIBUTE_LEAF,
49 _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_MAY_ALIAS, _GL_ATTRIBUTE_MAYBE_UNUSED, 87 _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_MAY_ALIAS, _GL_ATTRIBUTE_MAYBE_UNUSED,
50 _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOINLINE, _GL_ATTRIBUTE_NONNULL, 88 _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOINLINE, _GL_ATTRIBUTE_NONNULL,
51 _GL_ATTRIBUTE_NONSTRING, _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PACKED, 89 _GL_ATTRIBUTE_NONNULL_IF_NONZERO, _GL_ATTRIBUTE_NONSTRING,
52 _GL_ATTRIBUTE_PURE, _GL_ATTRIBUTE_RETURNS_NONNULL, 90 _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PACKED, _GL_ATTRIBUTE_PURE,
53 _GL_ATTRIBUTE_SENTINEL. */ 91 _GL_ATTRIBUTE_REPRODUCIBLE, _GL_ATTRIBUTE_RETURNS_NONNULL,
92 _GL_ATTRIBUTE_SENTINEL, _GL_ATTRIBUTE_UNSEQUENCED, _GL_UNNAMED. */
54#if !_GL_CONFIG_H_INCLUDED 93#if !_GL_CONFIG_H_INCLUDED
55 #error "Please include config.h first." 94 #error "Please include config.h first."
56#endif 95#endif
@@ -88,7 +127,7 @@
88 is the size of the returned memory block. 127 is the size of the returned memory block.
89 ATTRIBUTE_ALLOC_SIZE ((M, N)) - Multiply the Mth and Nth arguments 128 ATTRIBUTE_ALLOC_SIZE ((M, N)) - Multiply the Mth and Nth arguments
90 to determine the size of the returned memory block. */ 129 to determine the size of the returned memory block. */
91/* Applies to: function, pointer to function, function types. */ 130/* Applies to: functions, pointer to functions, function types. */
92#define ATTRIBUTE_ALLOC_SIZE(args) _GL_ATTRIBUTE_ALLOC_SIZE (args) 131#define ATTRIBUTE_ALLOC_SIZE(args) _GL_ATTRIBUTE_ALLOC_SIZE (args)
93 132
94/* ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers 133/* ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
@@ -132,6 +171,12 @@
132/* Applies to: functions. */ 171/* Applies to: functions. */
133#define ATTRIBUTE_NONNULL(args) _GL_ATTRIBUTE_NONNULL (args) 172#define ATTRIBUTE_NONNULL(args) _GL_ATTRIBUTE_NONNULL (args)
134 173
174/* ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) - Argument NP (a pointer)
175 must not be NULL if the argument NI (an integer) is != 0. */
176/* Applies to: functions. */
177#define ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) _GL_ATTRIBUTE_NONNULL_IF_NONZERO (np, ni)
178
179
135/* The function's return value is a non-NULL pointer. */ 180/* The function's return value is a non-NULL pointer. */
136/* Applies to: functions. */ 181/* Applies to: functions. */
137#define ATTRIBUTE_RETURNS_NONNULL _GL_ATTRIBUTE_RETURNS_NONNULL 182#define ATTRIBUTE_RETURNS_NONNULL _GL_ATTRIBUTE_RETURNS_NONNULL
@@ -170,7 +215,7 @@
170/* Attributes regarding debugging information emitted by the compiler. */ 215/* Attributes regarding debugging information emitted by the compiler. */
171 216
172/* Omit the function from stack traces when debugging. */ 217/* Omit the function from stack traces when debugging. */
173/* Applies to: function. */ 218/* Applies to: functions. */
174#define ATTRIBUTE_ARTIFICIAL _GL_ATTRIBUTE_ARTIFICIAL 219#define ATTRIBUTE_ARTIFICIAL _GL_ATTRIBUTE_ARTIFICIAL
175 220
176/* Make the entity visible to debuggers etc., even with '-fwhole-program'. */ 221/* Make the entity visible to debuggers etc., even with '-fwhole-program'. */
@@ -192,25 +237,74 @@
192 237
193/* Always inline the function, and report an error if the compiler 238/* Always inline the function, and report an error if the compiler
194 cannot inline. */ 239 cannot inline. */
195/* Applies to: function. */ 240/* Applies to: functions. */
196#define ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE 241#define ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE
197 242
198/* It is OK for a compiler to omit duplicate calls with the same arguments. 243/* It is OK for a compiler to move a call, or omit a duplicate call
199 This attribute is safe for a function that neither depends on 244 and reuse a cached return value, even if the state changes between calls.
200 nor affects observable state, and always returns exactly once - 245 It is also OK to omit a call if the result is not used.
201 e.g., does not loop forever, and does not call longjmp. 246 This attribute is safe if the function does not change observable state,
202 (This attribute is stricter than ATTRIBUTE_PURE.) */ 247 returns a value determined solely by its arguments' values
248 without examining state, and always returns exactly once -
249 e.g., does not raise an exception, call longjmp, or loop forever.
250 (This attribute is stricter than _GL_ATTRIBUTE_PURE because the
251 function cannot observe state. Unlike _GL_ATTRIBUTE_UNSEQUENCED
252 the function must return exactly once and cannot access state
253 addressed by its pointer arguments or that happens to have the same
254 value for all calls to the function, but the function is allowed to
255 return a pointer to storage that can be modified later. */
203/* Applies to: functions. */ 256/* Applies to: functions. */
204#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST 257#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST
205 258
206/* It is OK for a compiler to omit duplicate calls with the same 259/* It is OK for a compiler to move a call, or omit a duplicate call
207 arguments if observable state is not changed between calls. 260 and reuse a cached value returned either directly or indirectly via
208 This attribute is safe for a function that does not affect 261 a pointer, if the state addressed by its pointer arguments is the same;
209 observable state, and always returns exactly once. 262 however, pointer arguments cannot alias.
210 (This attribute is looser than ATTRIBUTE_CONST.) */ 263 This attribute is safe for a function that is effectless, idempotent,
264 stateless, and independent; see ISO C 23 § 6.7.13.8 for a definition of
265 these terms.
266 (This attribute is stricter than _GL_ATTRIBUTE_REPRODUCIBLE because
267 the function must be stateless and independent. Unlike
268 _GL_ATTRIBUTE_CONST the function need not return exactly once, and
269 can depend on state accessed via its pointer arguments or that
270 happens to have the same value for all calls to the function, but
271 the function cannot return a pointer to storage whose contents
272 change later.)
273 See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
274 <https://stackoverflow.com/questions/76847905/>. */
275/* Applies to: functions, pointer to functions, function type. */
276#define UNSEQUENCED _GL_ATTRIBUTE_UNSEQUENCED
277
278/* It is OK for a compiler to move a call, or omit a duplicate call
279 and reuse a cached return value, if observable state is the same.
280 It is also OK to omit a call if the return value is not used.
281 This attribute is safe if the function does not change observable state,
282 returns a value determined solely by its arguments's values
283 together with observable state, and always returns exactly once.
284 (This attribute is looser than _GL_ATTRIBUTE_CONST because the function
285 can depend on observable state.
286 Unlike _GL_ATTRIBUTE_REPRODUCIBLE the function must return exactly
287 once and cannot change state addressed by its arguments, but the
288 function can return a pointer to storage whose contents change later.) */
211/* Applies to: functions. */ 289/* Applies to: functions. */
212#define ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE 290#define ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE
213 291
292/* It is OK for a compiler to move a call, or omit a duplicate call
293 and reuse a cached value returned either directly or indirectly via
294 a pointer, if other observable state is the same;
295 however, pointer arguments cannot alias.
296 This attribute is safe for a function that is effectless and idempotent;
297 see ISO C 23 § 6.7.13.8 for a definition of these terms.
298 (This attribute is looser than _GL_ATTRIBUTE_UNSEQUENCED because
299 the function need not be stateless or independent.
300 Unlike _GL_ATTRIBUTE_PURE the function need not return exactly once
301 and can change state addressed by its pointer arguments, but the
302 function cannot return a pointer to storage whose contents change later.)
303 See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
304 <https://stackoverflow.com/questions/76847905/>. */
305/* Applies to: functions, pointer to functions, function type. */
306#define REPRODUCIBLE _GL_ATTRIBUTE_REPRODUCIBLE
307
214/* The function is rarely executed. */ 308/* The function is rarely executed. */
215/* Applies to: functions. */ 309/* Applies to: functions. */
216#define ATTRIBUTE_COLD _GL_ATTRIBUTE_COLD 310#define ATTRIBUTE_COLD _GL_ATTRIBUTE_COLD
@@ -240,4 +334,18 @@
240#define ATTRIBUTE_MAY_ALIAS _GL_ATTRIBUTE_MAY_ALIAS 334#define ATTRIBUTE_MAY_ALIAS _GL_ATTRIBUTE_MAY_ALIAS
241 335
242 336
337/* ==================== Unnamed function parameters ======================== */
338
339/* Although UNNAMED is not an attribute, it is related to MAYBE_UNUSED
340 and so is defined here for convenience. */
341
342/* UNNAMED (ID) is the "name" of an unnamed function parameter.
343 Each of the function's unnamed parameters should have a unique "name".
344 The "name" cannot be used. This ports both to C17 and earlier, which
345 lack unnamed parameters, and to C++ and later C, which have them. */
346/* Applies to:
347 - function parameters. */
348#define UNNAMED(id) _GL_UNNAMED (id)
349
350
243#endif /* _GL_ATTRIBUTE_H */ 351#endif /* _GL_ATTRIBUTE_H */
diff --git a/gl/base64.c b/gl/base64.c
index c8b3b76b..77ee371b 100644
--- a/gl/base64.c
+++ b/gl/base64.c
@@ -1,5 +1,5 @@
1/* base64.c -- Encode binary data using printable characters. 1/* base64.c -- Encode binary data using printable characters.
2 Copyright (C) 1999-2001, 2004-2006, 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 1999-2001, 2004-2006, 2009-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -39,16 +39,16 @@
39 * 39 *
40 */ 40 */
41 41
42#define BASE64_INLINE _GL_EXTERN_INLINE
42#include <config.h> 43#include <config.h>
43 44
44/* Get prototype. */ 45/* Get prototype. */
45#define BASE64_INLINE _GL_EXTERN_INLINE
46#include "base64.h" 46#include "base64.h"
47 47
48/* Get imalloc. */ 48/* Get imalloc. */
49#include <ialloc.h> 49#include <ialloc.h>
50 50
51#include <intprops.h> 51#include <stdckdint.h>
52 52
53#include <string.h> 53#include <string.h>
54 54
@@ -59,7 +59,7 @@ to_uchar (char ch)
59 return ch; 59 return ch;
60} 60}
61 61
62static const char b64c[64] = 62static const char b64c[64] _GL_ATTRIBUTE_NONSTRING =
63 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 63 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
64 64
65/* Base64 encode IN array of size INLEN into OUT array. OUT needs 65/* Base64 encode IN array of size INLEN into OUT array. OUT needs
@@ -148,7 +148,7 @@ base64_encode_alloc (const char *in, idx_t inlen, char **out)
148 Treat negative INLEN as overflow, for better compatibility with 148 Treat negative INLEN as overflow, for better compatibility with
149 pre-2021-08-27 API, which used size_t. */ 149 pre-2021-08-27 API, which used size_t. */
150 idx_t in_over_3 = inlen / 3 + (inlen % 3 != 0), outlen; 150 idx_t in_over_3 = inlen / 3 + (inlen % 3 != 0), outlen;
151 if (! INT_MULTIPLY_OK (in_over_3, 4, &outlen) || inlen < 0) 151 if (ckd_mul (&outlen, in_over_3, 4) || inlen < 0)
152 { 152 {
153 *out = NULL; 153 *out = NULL;
154 return 0; 154 return 0;
@@ -372,13 +372,14 @@ static bool
372decode_4 (char const *restrict in, idx_t inlen, 372decode_4 (char const *restrict in, idx_t inlen,
373 char *restrict *outp, idx_t *outleft) 373 char *restrict *outp, idx_t *outleft)
374{ 374{
375 char *out = *outp;
376 if (inlen < 2) 375 if (inlen < 2)
377 return false; 376 return false;
378 377
379 if (!isbase64 (in[0]) || !isbase64 (in[1])) 378 if (!isbase64 (in[0]) || !isbase64 (in[1]))
380 return false; 379 return false;
381 380
381 char *out = *outp;
382
382 if (*outleft) 383 if (*outleft)
383 { 384 {
384 *out++ = ((base64_to_int[to_uchar (in[0])] << 2) 385 *out++ = ((base64_to_int[to_uchar (in[0])] << 2)
@@ -466,7 +467,6 @@ base64_decode_ctx (struct base64_decode_context *ctx,
466 const char *restrict in, idx_t inlen, 467 const char *restrict in, idx_t inlen,
467 char *restrict out, idx_t *outlen) 468 char *restrict out, idx_t *outlen)
468{ 469{
469 idx_t outleft = *outlen;
470 bool ignore_newlines = ctx != NULL; 470 bool ignore_newlines = ctx != NULL;
471 bool flush_ctx = false; 471 bool flush_ctx = false;
472 unsigned int ctx_i = 0; 472 unsigned int ctx_i = 0;
@@ -477,6 +477,7 @@ base64_decode_ctx (struct base64_decode_context *ctx,
477 flush_ctx = inlen == 0; 477 flush_ctx = inlen == 0;
478 } 478 }
479 479
480 idx_t outleft = *outlen;
480 481
481 while (true) 482 while (true)
482 { 483 {
@@ -505,35 +506,36 @@ base64_decode_ctx (struct base64_decode_context *ctx,
505 { 506 {
506 ++in; 507 ++in;
507 --inlen; 508 --inlen;
508 continue;
509 } 509 }
510 else
511 {
512 /* Restore OUT and OUTLEFT. */
513 out -= outleft_save - outleft;
514 outleft = outleft_save;
510 515
511 /* Restore OUT and OUTLEFT. */
512 out -= outleft_save - outleft;
513 outleft = outleft_save;
514
515 {
516 char const *in_end = in + inlen;
517 char const *non_nl;
518
519 if (ignore_newlines)
520 non_nl = get_4 (ctx, &in, in_end, &inlen);
521 else
522 non_nl = in; /* Might have nl in this case. */
523
524 /* If the input is empty or consists solely of newlines (0 non-newlines),
525 then we're done. Likewise if there are fewer than 4 bytes when not
526 flushing context and not treating newlines as garbage. */
527 if (inlen == 0 || (inlen < 4 && !flush_ctx && ignore_newlines))
528 { 516 {
529 inlen = 0; 517 char const *in_end = in + inlen;
530 break; 518
531 } 519 char const *non_nl;
532 if (!decode_4 (non_nl, inlen, &out, &outleft)) 520 if (ignore_newlines)
533 break; 521 non_nl = get_4 (ctx, &in, in_end, &inlen);
522 else
523 non_nl = in; /* Might have nl in this case. */
524
525 /* If the input is empty or consists solely of newlines (0 non-newlines),
526 then we're done. Likewise if there are fewer than 4 bytes when not
527 flushing context and not treating newlines as garbage. */
528 if (inlen == 0 || (inlen < 4 && !flush_ctx && ignore_newlines))
529 {
530 inlen = 0;
531 break;
532 }
533 if (!decode_4 (non_nl, inlen, &out, &outleft))
534 break;
534 535
535 inlen = in_end - in; 536 inlen = in_end - in;
536 } 537 }
538 }
537 } 539 }
538 540
539 *outlen -= outleft; 541 *outlen -= outleft;
diff --git a/gl/base64.h b/gl/base64.h
index 7691f6c4..35f8a30b 100644
--- a/gl/base64.h
+++ b/gl/base64.h
@@ -1,5 +1,5 @@
1/* base64.h -- Encode binary data using printable characters. 1/* base64.h -- Encode binary data using printable characters.
2 Copyright (C) 2004-2006, 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 2004-2006, 2009-2026 Free Software Foundation, Inc.
3 Written by Simon Josefsson. 3 Written by Simon Josefsson.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
@@ -27,7 +27,7 @@
27#include <idx.h> 27#include <idx.h>
28 28
29/* Pacify GCC in isubase64. */ 29/* Pacify GCC in isubase64. */
30#if defined __GNUC__ && 4 < __GNUC__ + (3 <= __GNUC_MINOR__) 30#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__) && !defined __clang__
31# pragma GCC diagnostic ignored "-Wtype-limits" 31# pragma GCC diagnostic ignored "-Wtype-limits"
32#endif 32#endif
33 33
diff --git a/gl/basename-lgpl.c b/gl/basename-lgpl.c
index 256f8460..53f3bae5 100644
--- a/gl/basename-lgpl.c
+++ b/gl/basename-lgpl.c
@@ -1,6 +1,6 @@
1/* basename.c -- return the last element in a file name 1/* basename.c -- return the last element in a file name
2 2
3 Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2024 Free Software 3 Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2026 Free Software
4 Foundation, Inc. 4 Foundation, Inc.
5 5
6 This file is free software: you can redistribute it and/or modify 6 This file is free software: you can redistribute it and/or modify
@@ -29,13 +29,11 @@ char *
29last_component (char const *name) 29last_component (char const *name)
30{ 30{
31 char const *base = name + FILE_SYSTEM_PREFIX_LEN (name); 31 char const *base = name + FILE_SYSTEM_PREFIX_LEN (name);
32 char const *p;
33 bool last_was_slash = false;
34
35 while (ISSLASH (*base)) 32 while (ISSLASH (*base))
36 base++; 33 base++;
37 34
38 for (p = base; *p; p++) 35 bool last_was_slash = false;
36 for (char const *p = base; *p; p++)
39 { 37 {
40 if (ISSLASH (*p)) 38 if (ISSLASH (*p))
41 last_was_slash = true; 39 last_was_slash = true;
@@ -53,8 +51,6 @@ size_t
53base_len (char const *name) 51base_len (char const *name)
54{ 52{
55 size_t len; 53 size_t len;
56 size_t prefix_len = FILE_SYSTEM_PREFIX_LEN (name);
57
58 for (len = strlen (name); 1 < len && ISSLASH (name[len - 1]); len--) 54 for (len = strlen (name); 1 < len && ISSLASH (name[len - 1]); len--)
59 continue; 55 continue;
60 56
@@ -62,6 +58,7 @@ base_len (char const *name)
62 && ISSLASH (name[0]) && ISSLASH (name[1]) && ! name[2]) 58 && ISSLASH (name[0]) && ISSLASH (name[1]) && ! name[2])
63 return 2; 59 return 2;
64 60
61 size_t prefix_len = FILE_SYSTEM_PREFIX_LEN (name);
65 if (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE && prefix_len 62 if (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE && prefix_len
66 && len == prefix_len && ISSLASH (name[prefix_len])) 63 && len == prefix_len && ISSLASH (name[prefix_len]))
67 return prefix_len + 1; 64 return prefix_len + 1;
diff --git a/gl/basename-lgpl.h b/gl/basename-lgpl.h
index 2a56be98..fa43cffb 100644
--- a/gl/basename-lgpl.h
+++ b/gl/basename-lgpl.h
@@ -1,6 +1,6 @@
1/* Extract the last component (base name) of a file name. 1/* Extract the last component (base name) of a file name.
2 2
3 Copyright (C) 1998, 2001, 2003-2006, 2009-2024 Free Software Foundation, 3 Copyright (C) 1998, 2001, 2003-2006, 2009-2026 Free Software Foundation,
4 Inc. 4 Inc.
5 5
6 This file is free software: you can redistribute it and/or modify 6 This file is free software: you can redistribute it and/or modify
diff --git a/gl/basename.c b/gl/basename.c
index c5a6bdc9..3a825981 100644
--- a/gl/basename.c
+++ b/gl/basename.c
@@ -1,6 +1,6 @@
1/* basename.c -- return the last element in a file name 1/* basename.c -- return the last element in a file name
2 2
3 Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2024 Free Software 3 Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2026 Free Software
4 Foundation, Inc. 4 Foundation, Inc.
5 5
6 This program is free software: you can redistribute it and/or modify 6 This program is free software: you can redistribute it and/or modify
diff --git a/gl/btowc.c b/gl/btowc.c
index 8bf21aa6..19b490d1 100644
--- a/gl/btowc.c
+++ b/gl/btowc.c
@@ -1,5 +1,5 @@
1/* Convert unibyte character to wide character. 1/* Convert unibyte character to wide character.
2 Copyright (C) 2008, 2010-2024 Free Software Foundation, Inc. 2 Copyright (C) 2008, 2010-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2008. 3 Written by Bruno Haible <bruno@clisp.org>, 2008.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
diff --git a/gl/byteswap.c b/gl/byteswap.c
new file mode 100644
index 00000000..e01eaa9a
--- /dev/null
+++ b/gl/byteswap.c
@@ -0,0 +1,20 @@
1/* Inline functions for <byteswap.h>.
2
3 Copyright 2024-2026 Free Software Foundation, Inc.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#define _GL_BYTESWAP_INLINE _GL_EXTERN_INLINE
19#include <config.h>
20#include <byteswap.h>
diff --git a/gl/byteswap.in.h b/gl/byteswap.in.h
index 8e49efad..b2b26af8 100644
--- a/gl/byteswap.in.h
+++ b/gl/byteswap.in.h
@@ -1,5 +1,5 @@
1/* byteswap.h - Byte swapping 1/* byteswap.h - Byte swapping
2 Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 2005, 2007, 2009-2026 Free Software Foundation, Inc.
3 Written by Oskar Liljeblad <oskar@osk.mine.nu>, 2005. 3 Written by Oskar Liljeblad <oskar@osk.mine.nu>, 2005.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
@@ -16,29 +16,103 @@
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 17
18#ifndef _GL_BYTESWAP_H 18#ifndef _GL_BYTESWAP_H
19#define _GL_BYTESWAP_H 19#define _GL_BYTESWAP_H 1
20
21/* This file uses _GL_INLINE. */
22#if !_GL_CONFIG_H_INCLUDED
23 #error "Please include config.h first."
24#endif
25
26/* Define this now, rather than after including stdint.h, in case
27 stdint.h recursively includes us. This is for Gnulib endian.h. */
28#ifndef _GL_BYTESWAP_INLINE
29# define _GL_BYTESWAP_INLINE _GL_INLINE
30#endif
31
32#include <stdint.h>
33
34_GL_INLINE_HEADER_BEGIN
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
41# define _GL_BYTESWAP_HAS_BUILTIN_BSWAP16 true
42#elif defined __has_builtin
43# if __has_builtin (__builtin_bswap16)
44# define _GL_BYTESWAP_HAS_BUILTIN_BSWAP16 true
45# endif
46#endif
47
48#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
49# define _GL_BYTESWAP_HAS_BUILTIN_BSWAP32 true
50# define _GL_BYTESWAP_HAS_BUILTIN_BSWAP64 true
51#elif defined __has_builtin
52# if __has_builtin (__builtin_bswap32)
53# define _GL_BYTESWAP_HAS_BUILTIN_BSWAP32 true
54# endif
55# if __has_builtin (__builtin_bswap64)
56# define _GL_BYTESWAP_HAS_BUILTIN_BSWAP64 true
57# endif
58#endif
20 59
21/* Given an unsigned 16-bit argument X, return the value corresponding to 60/* Given an unsigned 16-bit argument X, return the value corresponding to
22 X with reversed byte order. */ 61 X with reversed byte order. */
23#define bswap_16(x) ((((x) & 0x00FF) << 8) | \ 62_GL_BYTESWAP_INLINE uint_least16_t
24 (((x) & 0xFF00) >> 8)) 63bswap_16 (uint_least16_t x)
64{
65#ifdef _GL_BYTESWAP_HAS_BUILTIN_BSWAP16
66 return __builtin_bswap16 (x);
67#else
68 uint_fast16_t mask = 0xff;
69 return ( (x & mask << 8 * 1) >> 8 * 1
70 | (x & mask << 8 * 0) << 8 * 1);
71#endif
72}
25 73
26/* Given an unsigned 32-bit argument X, return the value corresponding to 74/* Given an unsigned 32-bit argument X, return the value corresponding to
27 X with reversed byte order. */ 75 X with reversed byte order. */
28#define bswap_32(x) ((((x) & 0x000000FF) << 24) | \ 76_GL_BYTESWAP_INLINE uint_least32_t
29 (((x) & 0x0000FF00) << 8) | \ 77bswap_32 (uint_least32_t x)
30 (((x) & 0x00FF0000) >> 8) | \ 78{
31 (((x) & 0xFF000000) >> 24)) 79#ifdef _GL_BYTESWAP_HAS_BUILTIN_BSWAP32
80 return __builtin_bswap32 (x);
81#else
82 uint_fast32_t mask = 0xff;
83 return ( (x & mask << 8 * 3) >> 8 * 3
84 | (x & mask << 8 * 2) >> 8 * 1
85 | (x & mask << 8 * 1) << 8 * 1
86 | (x & mask << 8 * 0) << 8 * 3);
87#endif
88}
32 89
90#ifdef UINT_LEAST64_MAX
33/* Given an unsigned 64-bit argument X, return the value corresponding to 91/* Given an unsigned 64-bit argument X, return the value corresponding to
34 X with reversed byte order. */ 92 X with reversed byte order. */
35#define bswap_64(x) ((((x) & 0x00000000000000FFULL) << 56) | \ 93_GL_BYTESWAP_INLINE uint_least64_t
36 (((x) & 0x000000000000FF00ULL) << 40) | \ 94bswap_64 (uint_least64_t x)
37 (((x) & 0x0000000000FF0000ULL) << 24) | \ 95{
38 (((x) & 0x00000000FF000000ULL) << 8) | \ 96# ifdef _GL_BYTESWAP_HAS_BUILTIN_BSWAP64
39 (((x) & 0x000000FF00000000ULL) >> 8) | \ 97 return __builtin_bswap64 (x);
40 (((x) & 0x0000FF0000000000ULL) >> 24) | \ 98# else
41 (((x) & 0x00FF000000000000ULL) >> 40) | \ 99 uint_fast64_t mask = 0xff;
42 (((x) & 0xFF00000000000000ULL) >> 56)) 100 return ( (x & mask << 8 * 7) >> 8 * 7
101 | (x & mask << 8 * 6) >> 8 * 5
102 | (x & mask << 8 * 5) >> 8 * 3
103 | (x & mask << 8 * 4) >> 8 * 1
104 | (x & mask << 8 * 3) << 8 * 1
105 | (x & mask << 8 * 2) << 8 * 3
106 | (x & mask << 8 * 1) << 8 * 5
107 | (x & mask << 8 * 0) << 8 * 7);
108# endif
109}
110#endif
111
112#ifdef __cplusplus
113}
114#endif
115
116_GL_INLINE_HEADER_END
43 117
44#endif /* _GL_BYTESWAP_H */ 118#endif /* _GL_BYTESWAP_H */
diff --git a/gl/c++defs.h b/gl/c++defs.h
index eb66967b..cfe68cb1 100644
--- a/gl/c++defs.h
+++ b/gl/c++defs.h
@@ -1,5 +1,5 @@
1/* C++ compatible function declaration macros. 1/* C++ compatible function declaration macros.
2 Copyright (C) 2010-2024 Free Software Foundation, Inc. 2 Copyright (C) 2010-2026 Free Software Foundation, Inc.
3 3
4 This program is free software: you can redistribute it and/or modify it 4 This program is free software: you can redistribute it and/or modify it
5 under the terms of the GNU Lesser General Public License as published 5 under the terms of the GNU Lesser General Public License as published
@@ -93,11 +93,27 @@
93# define _GL_EXTERN_C extern 93# define _GL_EXTERN_C extern
94#endif 94#endif
95 95
96/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 96/* _GL_EXTERN_C_FUNC declaration;
97 performs the declaration of a function with C linkage. */
98#if defined __cplusplus
99# define _GL_EXTERN_C_FUNC extern "C"
100#else
101/* In C mode, omit the 'extern' keyword, because attributes in bracket syntax
102 are not allowed between 'extern' and the return type (see gnulib-common.m4).
103 */
104# define _GL_EXTERN_C_FUNC
105#endif
106
107/* _GL_FUNCDECL_RPL (func, rettype, parameters, [attributes]);
97 declares a replacement function, named rpl_func, with the given prototype, 108 declares a replacement function, named rpl_func, with the given prototype,
98 consisting of return type, parameters, and attributes. 109 consisting of return type, parameters, and attributes.
99 Example: 110 Although attributes are optional, the comma before them is required
100 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 111 for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW,
112 if needed, must be placed after the _GL_FUNCDECL_RPL invocation,
113 at the end of the declaration.
114 Examples:
115 _GL_FUNCDECL_RPL (free, void, (void *ptr), ) _GL_ATTRIBUTE_NOTHROW;
116 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...),
101 _GL_ARG_NONNULL ((1))); 117 _GL_ARG_NONNULL ((1)));
102 118
103 Note: Attributes, such as _GL_ATTRIBUTE_DEPRECATED, are supported in front 119 Note: Attributes, such as _GL_ATTRIBUTE_DEPRECATED, are supported in front
@@ -106,20 +122,34 @@
106 [[...]] extern "C" <declaration>; 122 [[...]] extern "C" <declaration>;
107 is invalid syntax in C++.) 123 is invalid syntax in C++.)
108 */ 124 */
109#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 125#define _GL_FUNCDECL_RPL(func,rettype,parameters,...) \
110 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 126 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters, __VA_ARGS__)
111#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 127#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters,...) \
112 _GL_EXTERN_C rettype rpl_func parameters_and_attributes 128 _GL_EXTERN_C_FUNC __VA_ARGS__ rettype rpl_func parameters
113 129
114/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 130/* _GL_FUNCDECL_SYS_NAME (func) expands to plain func if C++, and to
131 parenthesized func otherwise. Parenthesization is needed in C23 if
132 the function is like strchr and so is a qualifier-generic macro
133 that expands to something more complicated. */
134#ifdef __cplusplus
135# define _GL_FUNCDECL_SYS_NAME(func) func
136#else
137# define _GL_FUNCDECL_SYS_NAME(func) (func)
138#endif
139
140/* _GL_FUNCDECL_SYS (func, rettype, parameters, [attributes]);
115 declares the system function, named func, with the given prototype, 141 declares the system function, named func, with the given prototype,
116 consisting of return type, parameters, and attributes. 142 consisting of return type, parameters, and attributes.
117 Example: 143 Although attributes are optional, the comma before them is required
118 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 144 for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW,
119 _GL_ARG_NONNULL ((1))); 145 if needed, must be placed after the _GL_FUNCDECL_RPL invocation,
146 at the end of the declaration.
147 Examples:
148 _GL_FUNCDECL_SYS (getumask, mode_t, (void), ) _GL_ATTRIBUTE_NOTHROW;
149 _GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD);
120 */ 150 */
121#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 151#define _GL_FUNCDECL_SYS(func,rettype,parameters,...) \
122 _GL_EXTERN_C rettype func parameters_and_attributes 152 _GL_EXTERN_C_FUNC __VA_ARGS__ rettype _GL_FUNCDECL_SYS_NAME (func) parameters
123 153
124/* _GL_CXXALIAS_RPL (func, rettype, parameters); 154/* _GL_CXXALIAS_RPL (func, rettype, parameters);
125 declares a C++ alias called GNULIB_NAMESPACE::func 155 declares a C++ alias called GNULIB_NAMESPACE::func
@@ -290,14 +320,14 @@
290 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 320 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
291# define _GL_CXXALIASWARN_1(func,namespace) \ 321# define _GL_CXXALIASWARN_1(func,namespace) \
292 _GL_CXXALIASWARN_2 (func, namespace) 322 _GL_CXXALIASWARN_2 (func, namespace)
293/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 323/* To work around GCC bug <https://gcc.gnu.org/PR43881>,
294 we enable the warning only when not optimizing. */ 324 we enable the warning only when not optimizing. */
295# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) 325# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
296# define _GL_CXXALIASWARN_2(func,namespace) \ 326# define _GL_CXXALIASWARN_2(func,namespace) \
297 _GL_WARN_ON_USE (func, \ 327 _GL_WARN_ON_USE (func, \
298 "The symbol ::" #func " refers to the system function. " \ 328 "The symbol ::" #func " refers to the system function. " \
299 "Use " #namespace "::" #func " instead.") 329 "Use " #namespace "::" #func " instead.")
300# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 330# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING
301# define _GL_CXXALIASWARN_2(func,namespace) \ 331# define _GL_CXXALIASWARN_2(func,namespace) \
302 extern __typeof__ (func) func 332 extern __typeof__ (func) func
303# else 333# else
@@ -318,7 +348,7 @@
318 GNULIB_NAMESPACE) 348 GNULIB_NAMESPACE)
319# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 349# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
320 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 350 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
321/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 351/* To work around GCC bug <https://gcc.gnu.org/PR43881>,
322 we enable the warning only when not optimizing. */ 352 we enable the warning only when not optimizing. */
323# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) 353# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
324# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 354# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
diff --git a/gl/c-ctype.c b/gl/c-ctype.c
new file mode 100644
index 00000000..cd9a205a
--- /dev/null
+++ b/gl/c-ctype.c
@@ -0,0 +1,20 @@
1/* Character handling in C locale.
2
3 Copyright (C) 2003-2026 Free Software Foundation, Inc.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#define C_CTYPE_INLINE _GL_EXTERN_INLINE
19#include <config.h>
20#include "c-ctype.h"
diff --git a/gl/c-ctype.h b/gl/c-ctype.h
new file mode 100644
index 00000000..e3448a43
--- /dev/null
+++ b/gl/c-ctype.h
@@ -0,0 +1,366 @@
1/* Character handling in C locale.
2
3 These functions work like the corresponding functions in <ctype.h>,
4 except that they have the C (POSIX) locale hardwired, whereas the
5 <ctype.h> functions' behaviour depends on the current locale set via
6 setlocale.
7
8 Copyright (C) 2000-2003, 2006, 2008-2026 Free Software Foundation, Inc.
9
10 This file is free software: you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as
12 published by the Free Software Foundation; either version 2.1 of the
13 License, or (at your option) any later version.
14
15 This file is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with this program. If not, see <https://www.gnu.org/licenses/>. */
22
23#ifndef C_CTYPE_H
24#define C_CTYPE_H
25
26/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE. */
27#if !_GL_CONFIG_H_INCLUDED
28 #error "Please include config.h first."
29#endif
30
31_GL_INLINE_HEADER_BEGIN
32#ifndef C_CTYPE_INLINE
33# define C_CTYPE_INLINE _GL_INLINE
34#endif
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40
41/* The functions defined in this file assume the "C" locale and a character
42 set without diacritics (ASCII-US or EBCDIC-US or something like that).
43 Even if the "C" locale on a particular system is an extension of the ASCII
44 character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it
45 is ISO-8859-1), the functions in this file recognize only the ASCII
46 characters. */
47
48
49#if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
50 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
51 && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
52 && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
53 && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
54 && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
55 && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
56 && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
57 && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
58 && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
59 && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
60 && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
61 && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
62 && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
63 && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
64 && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
65 && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
66 && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
67 && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
68 && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
69 && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
70 && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
71 && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)
72/* The character set is ASCII or one of its variants or extensions, not EBCDIC.
73 Testing the value of '\n' and '\r' is not relevant. */
74# define C_CTYPE_ASCII 1
75#elif ! (' ' == '\x40' && '0' == '\xf0' \
76 && 'A' == '\xc1' && 'J' == '\xd1' && 'S' == '\xe2' \
77 && 'a' == '\x81' && 'j' == '\x91' && 's' == '\xa2')
78# error "Only ASCII and EBCDIC are supported"
79#endif
80
81#if 'A' < 0
82# error "EBCDIC and char is signed -- not supported"
83#endif
84
85/* Cases for control characters. */
86
87#define _C_CTYPE_CNTRL \
88 case '\a': case '\b': case '\f': case '\n': \
89 case '\r': case '\t': case '\v': \
90 _C_CTYPE_OTHER_CNTRL
91
92/* ASCII control characters other than those with \-letter escapes. */
93
94#if C_CTYPE_ASCII
95# define _C_CTYPE_OTHER_CNTRL \
96 case '\x00': case '\x01': case '\x02': case '\x03': \
97 case '\x04': case '\x05': case '\x06': case '\x0e': \
98 case '\x0f': case '\x10': case '\x11': case '\x12': \
99 case '\x13': case '\x14': case '\x15': case '\x16': \
100 case '\x17': case '\x18': case '\x19': case '\x1a': \
101 case '\x1b': case '\x1c': case '\x1d': case '\x1e': \
102 case '\x1f': case '\x7f'
103#else
104 /* Use EBCDIC code page 1047's assignments for ASCII control chars;
105 assume all EBCDIC code pages agree about these assignments. */
106# define _C_CTYPE_OTHER_CNTRL \
107 case '\x00': case '\x01': case '\x02': case '\x03': \
108 case '\x07': case '\x0e': case '\x0f': case '\x10': \
109 case '\x11': case '\x12': case '\x13': case '\x18': \
110 case '\x19': case '\x1c': case '\x1d': case '\x1e': \
111 case '\x1f': case '\x26': case '\x27': case '\x2d': \
112 case '\x2e': case '\x32': case '\x37': case '\x3c': \
113 case '\x3d': case '\x3f'
114#endif
115
116/* Cases for lowercase hex letters, and lowercase letters, all offset by N. */
117
118#define _C_CTYPE_LOWER_A_THRU_F_N(N) \
119 case 'a' + (N): case 'b' + (N): case 'c' + (N): case 'd' + (N): \
120 case 'e' + (N): case 'f' + (N)
121#define _C_CTYPE_LOWER_N(N) \
122 _C_CTYPE_LOWER_A_THRU_F_N(N): \
123 case 'g' + (N): case 'h' + (N): case 'i' + (N): case 'j' + (N): \
124 case 'k' + (N): case 'l' + (N): case 'm' + (N): case 'n' + (N): \
125 case 'o' + (N): case 'p' + (N): case 'q' + (N): case 'r' + (N): \
126 case 's' + (N): case 't' + (N): case 'u' + (N): case 'v' + (N): \
127 case 'w' + (N): case 'x' + (N): case 'y' + (N): case 'z' + (N)
128
129/* Cases for hex letters, digits, lower, punct, and upper. */
130
131#define _C_CTYPE_A_THRU_F \
132 _C_CTYPE_LOWER_A_THRU_F_N (0): \
133 _C_CTYPE_LOWER_A_THRU_F_N ('A' - 'a')
134#define _C_CTYPE_DIGIT \
135 case '0': case '1': case '2': case '3': \
136 case '4': case '5': case '6': case '7': \
137 case '8': case '9'
138#define _C_CTYPE_LOWER _C_CTYPE_LOWER_N (0)
139#define _C_CTYPE_PUNCT \
140 case '!': case '"': case '#': case '$': \
141 case '%': case '&': case '\'': case '(': \
142 case ')': case '*': case '+': case ',': \
143 case '-': case '.': case '/': case ':': \
144 case ';': case '<': case '=': case '>': \
145 case '?': case '@': case '[': case '\\': \
146 case ']': case '^': case '_': case '`': \
147 case '{': case '|': case '}': case '~'
148#define _C_CTYPE_UPPER _C_CTYPE_LOWER_N ('A' - 'a')
149
150
151/* Function definitions. */
152
153/* Unlike the functions in <ctype.h>, which require an argument in the range
154 of the 'unsigned char' type, the functions here operate on values that are
155 in the 'unsigned char' range or in the 'char' range. In other words,
156 when you have a 'char' value, you need to cast it before using it as
157 argument to a <ctype.h> function:
158
159 const char *s = ...;
160 if (isalpha ((unsigned char) *s)) ...
161
162 but you don't need to cast it for the functions defined in this file:
163
164 const char *s = ...;
165 if (c_isalpha (*s)) ...
166 */
167
168C_CTYPE_INLINE bool
169c_isalnum (int c)
170{
171 switch (c)
172 {
173 _C_CTYPE_DIGIT:
174 _C_CTYPE_LOWER:
175 _C_CTYPE_UPPER:
176 return true;
177 default:
178 return false;
179 }
180}
181
182C_CTYPE_INLINE bool
183c_isalpha (int c)
184{
185 switch (c)
186 {
187 _C_CTYPE_LOWER:
188 _C_CTYPE_UPPER:
189 return true;
190 default:
191 return false;
192 }
193}
194
195/* The function isascii is not locale dependent.
196 Its use in EBCDIC is questionable. */
197C_CTYPE_INLINE bool
198c_isascii (int c)
199{
200 switch (c)
201 {
202 case ' ':
203 _C_CTYPE_CNTRL:
204 _C_CTYPE_DIGIT:
205 _C_CTYPE_LOWER:
206 _C_CTYPE_PUNCT:
207 _C_CTYPE_UPPER:
208 return true;
209 default:
210 return false;
211 }
212}
213
214C_CTYPE_INLINE bool
215c_isblank (int c)
216{
217 return c == ' ' || c == '\t';
218}
219
220C_CTYPE_INLINE bool
221c_iscntrl (int c)
222{
223 switch (c)
224 {
225 _C_CTYPE_CNTRL:
226 return true;
227 default:
228 return false;
229 }
230}
231
232C_CTYPE_INLINE bool
233c_isdigit (int c)
234{
235 switch (c)
236 {
237 _C_CTYPE_DIGIT:
238 return true;
239 default:
240 return false;
241 }
242}
243
244C_CTYPE_INLINE bool
245c_isgraph (int c)
246{
247 switch (c)
248 {
249 _C_CTYPE_DIGIT:
250 _C_CTYPE_LOWER:
251 _C_CTYPE_PUNCT:
252 _C_CTYPE_UPPER:
253 return true;
254 default:
255 return false;
256 }
257}
258
259C_CTYPE_INLINE bool
260c_islower (int c)
261{
262 switch (c)
263 {
264 _C_CTYPE_LOWER:
265 return true;
266 default:
267 return false;
268 }
269}
270
271C_CTYPE_INLINE bool
272c_isprint (int c)
273{
274 switch (c)
275 {
276 case ' ':
277 _C_CTYPE_DIGIT:
278 _C_CTYPE_LOWER:
279 _C_CTYPE_PUNCT:
280 _C_CTYPE_UPPER:
281 return true;
282 default:
283 return false;
284 }
285}
286
287C_CTYPE_INLINE bool
288c_ispunct (int c)
289{
290 switch (c)
291 {
292 _C_CTYPE_PUNCT:
293 return true;
294 default:
295 return false;
296 }
297}
298
299C_CTYPE_INLINE bool
300c_isspace (int c)
301{
302 switch (c)
303 {
304 case ' ': case '\t': case '\n': case '\v': case '\f': case '\r':
305 return true;
306 default:
307 return false;
308 }
309}
310
311C_CTYPE_INLINE bool
312c_isupper (int c)
313{
314 switch (c)
315 {
316 _C_CTYPE_UPPER:
317 return true;
318 default:
319 return false;
320 }
321}
322
323C_CTYPE_INLINE bool
324c_isxdigit (int c)
325{
326 switch (c)
327 {
328 _C_CTYPE_DIGIT:
329 _C_CTYPE_A_THRU_F:
330 return true;
331 default:
332 return false;
333 }
334}
335
336C_CTYPE_INLINE int
337c_tolower (int c)
338{
339 switch (c)
340 {
341 _C_CTYPE_UPPER:
342 return c - 'A' + 'a';
343 default:
344 return c;
345 }
346}
347
348C_CTYPE_INLINE int
349c_toupper (int c)
350{
351 switch (c)
352 {
353 _C_CTYPE_LOWER:
354 return c - 'a' + 'A';
355 default:
356 return c;
357 }
358}
359
360#ifdef __cplusplus
361}
362#endif
363
364_GL_INLINE_HEADER_END
365
366#endif /* C_CTYPE_H */
diff --git a/gl/c32is-impl.h b/gl/c32is-impl.h
new file mode 100644
index 00000000..7fa79291
--- /dev/null
+++ b/gl/c32is-impl.h
@@ -0,0 +1,105 @@
1/* Test whether a 32-bit wide character belongs to a specific character class.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17/* Written by Bruno Haible <bruno@clisp.org>, 2020. */
18
19#include <wchar.h>
20#include <wctype.h>
21
22#ifdef __CYGWIN__
23# include <cygwin/version.h>
24#endif
25
26#if GNULIB_defined_mbstate_t
27# include "localcharset.h"
28# include "streq.h"
29#endif
30
31#if GL_CHAR32_T_IS_UNICODE
32# include "lc-charset-unicode.h"
33#endif
34
35#include "unictype.h"
36
37#if _GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t
38_GL_EXTERN_INLINE
39#endif
40int
41FUNC (wint_t wc)
42{
43 /* The char32_t encoding of a multibyte character is defined by the way
44 mbrtoc32() is defined. */
45
46#if GNULIB_defined_mbstate_t /* AIX */
47 /* mbrtoc32() is defined on top of mbtowc() for the non-UTF-8 locales
48 and directly for the UTF-8 locales. */
49 if (wc != WEOF)
50 {
51 const char *encoding = locale_charset ();
52 if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
53 return UCS_FUNC (wc);
54 else
55 return WCHAR_FUNC (wc);
56 }
57 else
58 return 0;
59
60#elif HAVE_WORKING_MBRTOC32 && HAVE_WORKING_C32RTOMB /* glibc, Android */
61 /* mbrtoc32() is essentially defined by the system libc. */
62
63# if _GL_WCHAR_T_IS_UCS4
64 /* The char32_t encoding of a multibyte character is known to be the same as
65 the wchar_t encoding. */
66 return WCHAR_FUNC (wc);
67# else
68 /* The char32_t encoding of a multibyte character is known to be UCS-4,
69 different from the wchar_t encoding. */
70 if (wc != WEOF)
71 return UCS_FUNC (wc);
72 else
73 return 0;
74# endif
75
76#elif _GL_SMALL_WCHAR_T /* Cygwin, mingw, MSVC */
77 /* The wchar_t encoding is UTF-16.
78 The char32_t encoding is UCS-4. */
79
80# if defined __CYGWIN__ && CYGWIN_VERSION_DLL_MAJOR >= 1007
81 /* As an extension to POSIX, the iswalnum() function of Cygwin >= 1.7
82 supports also wc arguments outside the Unicode BMP, that is, outside
83 the 'wchar_t' range. See
84 <https://lists.gnu.org/archive/html/bug-gnulib/2011-02/msg00019.html>
85 = <https://cygwin.com/ml/cygwin/2011-02/msg00044.html>. */
86 return WCHAR_FUNC (wc);
87# else
88 if (wc == WEOF || wc == (wchar_t) wc)
89 /* wc is in the range for the isw* functions. */
90 return WCHAR_FUNC (wc);
91 else
92 return UCS_FUNC (wc);
93# endif
94
95#else /* macOS, FreeBSD, NetBSD, OpenBSD, HP-UX, Solaris, Minix, Android */
96 /* char32_t and wchar_t are equivalent. */
97 static_assert (sizeof (char32_t) == sizeof (wchar_t));
98
99# if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION
100 return UCS_FUNC (wc);
101# else
102 return WCHAR_FUNC (wc);
103# endif
104#endif
105}
diff --git a/gl/c32isalnum.c b/gl/c32isalnum.c
new file mode 100644
index 00000000..0972d5be
--- /dev/null
+++ b/gl/c32isalnum.c
@@ -0,0 +1,26 @@
1/* Test 32-bit wide character for being alphanumeric.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#include <config.h>
18
19#define IN_C32ISALNUM
20/* Specification. */
21#include <uchar.h>
22
23#define FUNC c32isalnum
24#define WCHAR_FUNC iswalnum
25#define UCS_FUNC uc_is_alnum
26#include "c32is-impl.h"
diff --git a/gl/c32isalpha.c b/gl/c32isalpha.c
new file mode 100644
index 00000000..1dde246d
--- /dev/null
+++ b/gl/c32isalpha.c
@@ -0,0 +1,26 @@
1/* Test 32-bit wide character for being alphabetic.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#include <config.h>
18
19#define IN_C32ISALPHA
20/* Specification. */
21#include <uchar.h>
22
23#define FUNC c32isalpha
24#define WCHAR_FUNC iswalpha
25#define UCS_FUNC uc_is_alpha
26#include "c32is-impl.h"
diff --git a/gl/c32isblank.c b/gl/c32isblank.c
new file mode 100644
index 00000000..36f21ec1
--- /dev/null
+++ b/gl/c32isblank.c
@@ -0,0 +1,26 @@
1/* Test 32-bit wide character for being blank.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#include <config.h>
18
19#define IN_C32ISBLANK
20/* Specification. */
21#include <uchar.h>
22
23#define FUNC c32isblank
24#define WCHAR_FUNC iswblank
25#define UCS_FUNC uc_is_blank
26#include "c32is-impl.h"
diff --git a/gl/c32iscntrl.c b/gl/c32iscntrl.c
new file mode 100644
index 00000000..dcb32705
--- /dev/null
+++ b/gl/c32iscntrl.c
@@ -0,0 +1,26 @@
1/* Test 32-bit wide character for being a control character.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#include <config.h>
18
19#define IN_C32ISCNTRL
20/* Specification. */
21#include <uchar.h>
22
23#define FUNC c32iscntrl
24#define WCHAR_FUNC iswcntrl
25#define UCS_FUNC uc_is_cntrl
26#include "c32is-impl.h"
diff --git a/gl/c32isdigit.c b/gl/c32isdigit.c
new file mode 100644
index 00000000..96374718
--- /dev/null
+++ b/gl/c32isdigit.c
@@ -0,0 +1,26 @@
1/* Test 32-bit wide character for being a digit.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#include <config.h>
18
19#define IN_C32ISDIGIT
20/* Specification. */
21#include <uchar.h>
22
23#define FUNC c32isdigit
24#define WCHAR_FUNC iswdigit
25#define UCS_FUNC uc_is_digit
26#include "c32is-impl.h"
diff --git a/gl/c32isgraph.c b/gl/c32isgraph.c
new file mode 100644
index 00000000..f660ceba
--- /dev/null
+++ b/gl/c32isgraph.c
@@ -0,0 +1,26 @@
1/* Test 32-bit wide character for being graphic.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#include <config.h>
18
19#define IN_C32ISGRAPH
20/* Specification. */
21#include <uchar.h>
22
23#define FUNC c32isgraph
24#define WCHAR_FUNC iswgraph
25#define UCS_FUNC uc_is_graph
26#include "c32is-impl.h"
diff --git a/gl/c32islower.c b/gl/c32islower.c
new file mode 100644
index 00000000..98abb8a2
--- /dev/null
+++ b/gl/c32islower.c
@@ -0,0 +1,26 @@
1/* Test 32-bit wide character for being lowercase.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#include <config.h>
18
19#define IN_C32ISLOWER
20/* Specification. */
21#include <uchar.h>
22
23#define FUNC c32islower
24#define WCHAR_FUNC iswlower
25#define UCS_FUNC uc_is_lower
26#include "c32is-impl.h"
diff --git a/gl/c32isprint.c b/gl/c32isprint.c
new file mode 100644
index 00000000..72975751
--- /dev/null
+++ b/gl/c32isprint.c
@@ -0,0 +1,26 @@
1/* Test 32-bit wide character for being printable.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#include <config.h>
18
19#define IN_C32ISPRINT
20/* Specification. */
21#include <uchar.h>
22
23#define FUNC c32isprint
24#define WCHAR_FUNC iswprint
25#define UCS_FUNC uc_is_print
26#include "c32is-impl.h"
diff --git a/gl/c32ispunct.c b/gl/c32ispunct.c
new file mode 100644
index 00000000..1945c6c5
--- /dev/null
+++ b/gl/c32ispunct.c
@@ -0,0 +1,26 @@
1/* Test 32-bit wide character for being a punctuation or symbol character.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#include <config.h>
18
19#define IN_C32ISPUNCT
20/* Specification. */
21#include <uchar.h>
22
23#define FUNC c32ispunct
24#define WCHAR_FUNC iswpunct
25#define UCS_FUNC uc_is_punct
26#include "c32is-impl.h"
diff --git a/gl/c32isspace.c b/gl/c32isspace.c
new file mode 100644
index 00000000..58e2a02a
--- /dev/null
+++ b/gl/c32isspace.c
@@ -0,0 +1,26 @@
1/* Test 32-bit wide character for being white-space.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#include <config.h>
18
19#define IN_C32ISSPACE
20/* Specification. */
21#include <uchar.h>
22
23#define FUNC c32isspace
24#define WCHAR_FUNC iswspace
25#define UCS_FUNC uc_is_space
26#include "c32is-impl.h"
diff --git a/gl/c32isupper.c b/gl/c32isupper.c
new file mode 100644
index 00000000..29558234
--- /dev/null
+++ b/gl/c32isupper.c
@@ -0,0 +1,26 @@
1/* Test 32-bit wide character for being uppercase.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#include <config.h>
18
19#define IN_C32ISUPPER
20/* Specification. */
21#include <uchar.h>
22
23#define FUNC c32isupper
24#define WCHAR_FUNC iswupper
25#define UCS_FUNC uc_is_upper
26#include "c32is-impl.h"
diff --git a/gl/c32isxdigit.c b/gl/c32isxdigit.c
new file mode 100644
index 00000000..c9262b58
--- /dev/null
+++ b/gl/c32isxdigit.c
@@ -0,0 +1,26 @@
1/* Test 32-bit wide character for being a hexadecimal digit.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#include <config.h>
18
19#define IN_C32ISXDIGIT
20/* Specification. */
21#include <uchar.h>
22
23#define FUNC c32isxdigit
24#define WCHAR_FUNC iswxdigit
25#define UCS_FUNC uc_is_xdigit
26#include "c32is-impl.h"
diff --git a/gl/c32to-impl.h b/gl/c32to-impl.h
new file mode 100644
index 00000000..2528e51d
--- /dev/null
+++ b/gl/c32to-impl.h
@@ -0,0 +1,103 @@
1/* Case mapping of a 32-bit wide character.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17/* Written by Bruno Haible <bruno@clisp.org>, 2023. */
18
19#include <wchar.h>
20#include <wctype.h>
21
22#if GNULIB_defined_mbstate_t
23# include "localcharset.h"
24# include "streq.h"
25#endif
26
27#if GL_CHAR32_T_IS_UNICODE
28# include "lc-charset-unicode.h"
29#endif
30
31#include "unicase.h"
32
33#if _GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t
34_GL_EXTERN_INLINE
35#endif
36wint_t
37FUNC (wint_t wc)
38{
39 /* The char32_t encoding of a multibyte character is defined by the way
40 mbrtoc32() is defined. */
41
42#if GNULIB_defined_mbstate_t /* AIX */
43 /* mbrtoc32() is defined on top of mbtowc() for the non-UTF-8 locales
44 and directly for the UTF-8 locales. */
45 if (wc != WEOF)
46 {
47 const char *encoding = locale_charset ();
48 if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
49 return UCS_FUNC (wc);
50 else
51 return WCHAR_FUNC (wc);
52 }
53 else
54 return wc;
55
56#elif HAVE_WORKING_MBRTOC32 && HAVE_WORKING_C32RTOMB /* glibc, Android */
57 /* mbrtoc32() is essentially defined by the system libc. */
58
59# if _GL_WCHAR_T_IS_UCS4
60 /* The char32_t encoding of a multibyte character is known to be the same as
61 the wchar_t encoding. */
62 return WCHAR_FUNC (wc);
63# else
64 /* The char32_t encoding of a multibyte character is known to be UCS-4,
65 different from the wchar_t encoding. */
66 if (wc != WEOF)
67 return UCS_FUNC (wc);
68 else
69 return wc;
70# endif
71
72#elif _GL_SMALL_WCHAR_T /* Cygwin, mingw, MSVC */
73 /* The wchar_t encoding is UTF-16.
74 The char32_t encoding is UCS-4. */
75
76# if defined _WIN32 && !defined __CYGWIN__
77 /* On native Windows, in the UTF-8 locale, towlower and towupper are
78 lacking (at least) the mappings for ISO-8859-1 characters, such as
79 0x00C9 <-> 0x00E9. Since it is expensive to test whether the locale
80 encoding is UTF-8, ignore the system's WCHAR_FUNC altogether. */
81 if (wc != WEOF)
82 return UCS_FUNC (wc);
83 else
84 return wc;
85# else
86 if (wc == WEOF || wc == (wchar_t) wc)
87 /* wc is in the range for the tow* functions. */
88 return WCHAR_FUNC (wc);
89 else
90 return UCS_FUNC (wc);
91# endif
92
93#else /* macOS, FreeBSD, NetBSD, OpenBSD, HP-UX, Solaris, Minix, Android */
94 /* char32_t and wchar_t are equivalent. */
95 static_assert (sizeof (char32_t) == sizeof (wchar_t));
96
97# if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION
98 return UCS_FUNC (wc);
99# else
100 return WCHAR_FUNC (wc);
101# endif
102#endif
103}
diff --git a/gl/c32tolower.c b/gl/c32tolower.c
new file mode 100644
index 00000000..15608d88
--- /dev/null
+++ b/gl/c32tolower.c
@@ -0,0 +1,26 @@
1/* Map a 32-bit wide character to lowercase.
2 Copyright (C) 2023-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#include <config.h>
18
19#define IN_C32TOLOWER
20/* Specification. */
21#include <uchar.h>
22
23#define FUNC c32tolower
24#define WCHAR_FUNC towlower
25#define UCS_FUNC uc_tolower
26#include "c32to-impl.h"
diff --git a/gl/c32width.c b/gl/c32width.c
new file mode 100644
index 00000000..727c2bd3
--- /dev/null
+++ b/gl/c32width.c
@@ -0,0 +1,102 @@
1/* Determine the number of screen columns needed for a 32-bit wide character.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17/* Written by Bruno Haible <bruno@clisp.org>, 2023. */
18
19#include <config.h>
20
21#define IN_C32WIDTH
22/* Specification. */
23#include <uchar.h>
24
25#include <wchar.h>
26
27#ifdef __CYGWIN__
28# include <cygwin/version.h>
29#endif
30
31#if GNULIB_defined_mbstate_t
32# include "streq.h"
33#endif
34
35#include "localcharset.h"
36
37#if GL_CHAR32_T_IS_UNICODE
38# include "lc-charset-unicode.h"
39#endif
40
41#include "uniwidth.h"
42
43#if _GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t
44_GL_EXTERN_INLINE
45#endif
46int
47c32width (char32_t wc)
48{
49 /* The char32_t encoding of a multibyte character is defined by the way
50 mbrtoc32() is defined. */
51
52#if GNULIB_defined_mbstate_t /* AIX */
53 /* mbrtoc32() is defined on top of mbtowc() for the non-UTF-8 locales
54 and directly for the UTF-8 locales. */
55 const char *encoding = locale_charset ();
56 if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
57 return uc_width (wc, encoding);
58 else
59 return wcwidth (wc);
60
61#elif HAVE_WORKING_MBRTOC32 && HAVE_WORKING_C32RTOMB /* glibc, Android */
62 /* mbrtoc32() is essentially defined by the system libc. */
63
64# if _GL_WCHAR_T_IS_UCS4
65 /* The char32_t encoding of a multibyte character is known to be the same as
66 the wchar_t encoding. */
67 return wcwidth (wc);
68# else
69 /* The char32_t encoding of a multibyte character is known to be UCS-4,
70 different from the wchar_t encoding. */
71 return uc_width (wc, locale_charset ());
72# endif
73
74#elif _GL_SMALL_WCHAR_T /* Cygwin, mingw, MSVC */
75 /* The wchar_t encoding is UTF-16.
76 The char32_t encoding is UCS-4. */
77
78# if defined __CYGWIN__ && CYGWIN_VERSION_DLL_MAJOR >= 1007 && 0
79 /* As an extension to POSIX, the wcwidth() function of Cygwin >= 1.7
80 supports also wc arguments outside the Unicode BMP, that is, outside
81 the 'wchar_t' range. See
82 <https://www.cygwin.com/cgit/newlib-cygwin/commit/?id=098a75dc51caa98f369d98a9809d773bc45329aa>.
83 But the resulting values for these characters are not of good quality. */
84 return wcwidth (wc);
85# else
86 if (wc == (wchar_t) wc)
87 /* wc is in the range for the wcwidth function. */
88 return wcwidth (wc);
89 else
90 return uc_width (wc, locale_charset ());
91# endif
92
93#else /* macOS, FreeBSD, NetBSD, OpenBSD, HP-UX, Solaris, Minix, Android */
94 /* char32_t and wchar_t are equivalent. */
95 static_assert (sizeof (char32_t) == sizeof (wchar_t));
96
97# if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION
98 return uc_width (wc, locale_charset ());
99# endif
100 return wcwidth (wc);
101#endif
102}
diff --git a/gl/calloc.c b/gl/calloc.c
index 81dfd3ef..b4ca8f89 100644
--- a/gl/calloc.c
+++ b/gl/calloc.c
@@ -1,6 +1,6 @@
1/* calloc() function that is glibc compatible. 1/* calloc() function that is glibc compatible.
2 This wrapper function is required at least on Tru64 UNIX 5.1 and mingw. 2 This wrapper function is required at least on mingw.
3 Copyright (C) 2004-2007, 2009-2024 Free Software Foundation, Inc. 3 Copyright (C) 2004-2007, 2009-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -17,17 +17,15 @@
17 17
18/* written by Jim Meyering and Bruno Haible */ 18/* written by Jim Meyering and Bruno Haible */
19 19
20/* Ensure that we call the system's calloc() below. */
21#define _GL_USE_STDLIB_ALLOC 1
20#include <config.h> 22#include <config.h>
21 23
22/* Specification. */ 24/* Specification. */
23#include <stdlib.h> 25#include <stdlib.h>
24 26
25#include <errno.h> 27#include <errno.h>
26 28#include <stdckdint.h>
27#include "xalloc-oversized.h"
28
29/* Call the system's calloc below. */
30#undef calloc
31 29
32/* Allocate and zero-fill an NxS-byte block of memory from the heap, 30/* Allocate and zero-fill an NxS-byte block of memory from the heap,
33 even if N or S is zero. */ 31 even if N or S is zero. */
@@ -35,14 +33,19 @@
35void * 33void *
36rpl_calloc (size_t n, size_t s) 34rpl_calloc (size_t n, size_t s)
37{ 35{
36#if !HAVE_MALLOC_0_NONNULL
38 if (n == 0 || s == 0) 37 if (n == 0 || s == 0)
39 n = s = 1; 38 n = s = 1;
39#endif
40 40
41 if (xalloc_oversized (n, s)) 41#if !HAVE_MALLOC_PTRDIFF
42 ptrdiff_t signed_n;
43 if (ckd_mul (&signed_n, n, s))
42 { 44 {
43 errno = ENOMEM; 45 errno = ENOMEM;
44 return NULL; 46 return NULL;
45 } 47 }
48#endif
46 49
47 void *result = calloc (n, s); 50 void *result = calloc (n, s);
48 51
diff --git a/gl/cdefs.h b/gl/cdefs.h
index d38382ad..696e6542 100644
--- a/gl/cdefs.h
+++ b/gl/cdefs.h
@@ -1,4 +1,4 @@
1/* Copyright (C) 1992-2024 Free Software Foundation, Inc. 1/* Copyright (C) 1992-2026 Free Software Foundation, Inc.
2 Copyright The GNU Toolchain Authors. 2 Copyright The GNU Toolchain Authors.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 4
@@ -83,7 +83,7 @@
83# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct 83# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct
84# define __NTHNL(fct) __attribute__ ((__nothrow__)) fct 84# define __NTHNL(fct) __attribute__ ((__nothrow__)) fct
85# else 85# else
86# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major >= 4) 86# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4)
87# if __cplusplus >= 201103L 87# if __cplusplus >= 201103L
88# define __THROW noexcept (true) 88# define __THROW noexcept (true)
89# else 89# else
@@ -277,10 +277,10 @@
277*/ 277*/
278#endif 278#endif
279 279
280/* GCC and clang have various useful declarations that can be made with 280/* GCC, clang, and compatible compilers have various useful declarations
281 the '__attribute__' syntax. All of the ways we use this do fine if 281 that can be made with the '__attribute__' syntax. All of the ways we use
282 they are omitted for compilers that don't understand it. */ 282 this do fine if they are omitted for compilers that don't understand it. */
283#if !(defined __GNUC__ || defined __clang__) 283#if !(defined __GNUC__ || defined __clang__ || defined __TINYC__)
284# define __attribute__(xyz) /* Ignore */ 284# define __attribute__(xyz) /* Ignore */
285#endif 285#endif
286 286
@@ -482,7 +482,7 @@
482 run in pedantic mode if the uses are carefully marked using the 482 run in pedantic mode if the uses are carefully marked using the
483 `__extension__' keyword. But this is not generally available before 483 `__extension__' keyword. But this is not generally available before
484 version 2.8. */ 484 version 2.8. */
485#if !(__GNUC_PREREQ (2,8) || defined __clang__) 485#if ! (__GNUC_PREREQ (2,8) || defined __clang__ || 0x5150 <= __SUNPRO_C)
486# define __extension__ /* Ignore */ 486# define __extension__ /* Ignore */
487#endif 487#endif
488 488
@@ -497,7 +497,7 @@
497# endif 497# endif
498#endif 498#endif
499 499
500/* ISO C99 also allows to declare arrays as non-overlapping. The syntax is 500/* ISO C99 also allows declaring arrays as non-overlapping. The syntax is
501 array_name[restrict] 501 array_name[restrict]
502 GCC 3.1 and clang support this. 502 GCC 3.1 and clang support this.
503 This syntax is not usable in C++ mode. */ 503 This syntax is not usable in C++ mode. */
diff --git a/gl/cloexec.c b/gl/cloexec.c
index cdb0d740..3d4f916b 100644
--- a/gl/cloexec.c
+++ b/gl/cloexec.c
@@ -1,6 +1,6 @@
1/* cloexec.c - set or clear the close-on-exec descriptor flag 1/* cloexec.c - set or clear the close-on-exec descriptor flag
2 2
3 Copyright (C) 1991, 2004-2006, 2009-2024 Free Software Foundation, Inc. 3 Copyright (C) 1991, 2004-2006, 2009-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/cloexec.h b/gl/cloexec.h
index a7944d6d..3716bd72 100644
--- a/gl/cloexec.h
+++ b/gl/cloexec.h
@@ -1,6 +1,6 @@
1/* cloexec.c - set or clear the close-on-exec descriptor flag 1/* cloexec.c - set or clear the close-on-exec descriptor flag
2 2
3 Copyright (C) 2004, 2009-2024 Free Software Foundation, Inc. 3 Copyright (C) 2004, 2009-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/close.c b/gl/close.c
index 830fd820..86ccdf9a 100644
--- a/gl/close.c
+++ b/gl/close.c
@@ -1,5 +1,5 @@
1/* close replacement. 1/* close replacement.
2 Copyright (C) 2008-2024 Free Software Foundation, Inc. 2 Copyright (C) 2008-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/dirname-lgpl.c b/gl/dirname-lgpl.c
index 8333c0eb..9f772e0f 100644
--- a/gl/dirname-lgpl.c
+++ b/gl/dirname-lgpl.c
@@ -1,6 +1,6 @@
1/* dirname.c -- return all but the last element in a file name 1/* dirname.c -- return all but the last element in a file name
2 2
3 Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2024 Free Software 3 Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2026 Free Software
4 Foundation, Inc. 4 Foundation, Inc.
5 5
6 This file is free software: you can redistribute it and/or modify 6 This file is free software: you can redistribute it and/or modify
@@ -32,7 +32,6 @@ size_t
32dir_len (char const *file) 32dir_len (char const *file)
33{ 33{
34 size_t prefix_length = FILE_SYSTEM_PREFIX_LEN (file); 34 size_t prefix_length = FILE_SYSTEM_PREFIX_LEN (file);
35 size_t length;
36 35
37 /* Advance prefix_length beyond important leading slashes. */ 36 /* Advance prefix_length beyond important leading slashes. */
38 prefix_length += (prefix_length != 0 37 prefix_length += (prefix_length != 0
@@ -45,8 +44,10 @@ dir_len (char const *file)
45 : 0)); 44 : 0));
46 45
47 /* Strip the basename and any redundant slashes before it. */ 46 /* Strip the basename and any redundant slashes before it. */
47 size_t length;
48 for (length = last_component (file) - file; 48 for (length = last_component (file) - file;
49 prefix_length < length; length--) 49 prefix_length < length;
50 length--)
50 if (! ISSLASH (file[length - 1])) 51 if (! ISSLASH (file[length - 1]))
51 break; 52 break;
52 return length; 53 return length;
diff --git a/gl/dirname.c b/gl/dirname.c
index 393ec1b4..a67c7593 100644
--- a/gl/dirname.c
+++ b/gl/dirname.c
@@ -1,6 +1,6 @@
1/* dirname.c -- return all but the last element in a file name 1/* dirname.c -- return all but the last element in a file name
2 2
3 Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2024 Free Software 3 Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2026 Free Software
4 Foundation, Inc. 4 Foundation, Inc.
5 5
6 This program is free software: you can redistribute it and/or modify 6 This program is free software: you can redistribute it and/or modify
diff --git a/gl/dirname.h b/gl/dirname.h
index 33935ba9..8ecbb9e6 100644
--- a/gl/dirname.h
+++ b/gl/dirname.h
@@ -1,6 +1,6 @@
1/* Take file names apart into directory and base names. 1/* Take file names apart into directory and base names.
2 2
3 Copyright (C) 1998, 2001, 2003-2006, 2009-2024 Free Software Foundation, 3 Copyright (C) 1998, 2001, 2003-2006, 2009-2026 Free Software Foundation,
4 Inc. 4 Inc.
5 5
6 This file is free software: you can redistribute it and/or modify 6 This file is free software: you can redistribute it and/or modify
diff --git a/gl/dup2.c b/gl/dup2.c
index 916e113d..b9a55263 100644
--- a/gl/dup2.c
+++ b/gl/dup2.c
@@ -1,6 +1,6 @@
1/* Duplicate an open file descriptor to a specified file descriptor. 1/* Duplicate an open file descriptor to a specified file descriptor.
2 2
3 Copyright (C) 1999, 2004-2007, 2009-2024 Free Software Foundation, Inc. 3 Copyright (C) 1999, 2004-2007, 2009-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -70,8 +70,6 @@ dup2_nothrow (int fd, int desired_fd)
70static int 70static int
71ms_windows_dup2 (int fd, int desired_fd) 71ms_windows_dup2 (int fd, int desired_fd)
72{ 72{
73 int result;
74
75 /* If fd is closed, mingw hangs on dup2 (fd, fd). If fd is open, 73 /* If fd is closed, mingw hangs on dup2 (fd, fd). If fd is open,
76 dup2 (fd, fd) returns 0, but all further attempts to use fd in 74 dup2 (fd, fd) returns 0, but all further attempts to use fd in
77 future dup2 calls will hang. */ 75 future dup2 calls will hang. */
@@ -93,7 +91,7 @@ ms_windows_dup2 (int fd, int desired_fd)
93 return -1; 91 return -1;
94 } 92 }
95 93
96 result = dup2_nothrow (fd, desired_fd); 94 int result = dup2_nothrow (fd, desired_fd);
97 95
98 if (result == 0) 96 if (result == 0)
99 result = desired_fd; 97 result = desired_fd;
@@ -110,14 +108,11 @@ ms_windows_dup2 (int fd, int desired_fd)
110static int 108static int
111klibc_dup2dirfd (int fd, int desired_fd) 109klibc_dup2dirfd (int fd, int desired_fd)
112{ 110{
113 int tempfd; 111 int tempfd = open ("NUL", O_RDONLY);
114 int dupfd; 112 if (tempfd < 0)
115 113 return tempfd;
116 tempfd = open ("NUL", O_RDONLY);
117 if (tempfd == -1)
118 return -1;
119 114
120 if (tempfd == desired_fd) 115 if (tempfd >= desired_fd)
121 { 116 {
122 close (tempfd); 117 close (tempfd);
123 118
@@ -125,10 +120,32 @@ klibc_dup2dirfd (int fd, int desired_fd)
125 if (__libc_Back_ioFHToPath (fd, path, sizeof (path))) 120 if (__libc_Back_ioFHToPath (fd, path, sizeof (path)))
126 return -1; 121 return -1;
127 122
128 return open(path, O_RDONLY); 123 for (;;)
124 {
125 close (desired_fd);
126
127 int dupfd = open (path, O_RDONLY);
128 if (dupfd < 0)
129 return dupfd;
130
131 if (dupfd == desired_fd)
132 return dupfd;
133
134 /* If lower FD was closed by other threads, fill again. */
135 if (dupfd < desired_fd)
136 {
137 tempfd = dupfd;
138 break;
139 }
140
141 /* desired_fd was opened by other threads. Try again. */
142 /* FIXME: Closing desired_fd opened by other threads may lead to
143 unexpected behavior. */
144 close (dupfd);
145 }
129 } 146 }
130 147
131 dupfd = klibc_dup2dirfd (fd, desired_fd); 148 int dupfd = klibc_dup2dirfd (fd, desired_fd);
132 149
133 close (tempfd); 150 close (tempfd);
134 151
@@ -138,16 +155,16 @@ klibc_dup2dirfd (int fd, int desired_fd)
138static int 155static int
139klibc_dup2 (int fd, int desired_fd) 156klibc_dup2 (int fd, int desired_fd)
140{ 157{
141 int dupfd; 158 int dupfd = dup2 (fd, desired_fd);
142 struct stat sbuf; 159 if (dupfd < 0 && errno == ENOTSUP)
143
144 dupfd = dup2 (fd, desired_fd);
145 if (dupfd == -1 && errno == ENOTSUP \
146 && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode))
147 { 160 {
148 close (desired_fd); 161 struct stat sbuf;
162 if (!fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode))
163 {
164 close (desired_fd);
149 165
150 return klibc_dup2dirfd (fd, desired_fd); 166 return klibc_dup2dirfd (fd, desired_fd);
167 }
151 } 168 }
152 169
153 return dupfd; 170 return dupfd;
@@ -159,8 +176,6 @@ klibc_dup2 (int fd, int desired_fd)
159int 176int
160rpl_dup2 (int fd, int desired_fd) 177rpl_dup2 (int fd, int desired_fd)
161{ 178{
162 int result;
163
164#ifdef F_GETFL 179#ifdef F_GETFL
165 /* On Linux kernels 2.6.26-2.6.29, dup2 (fd, fd) returns -EBADF. 180 /* On Linux kernels 2.6.26-2.6.29, dup2 (fd, fd) returns -EBADF.
166 On Cygwin 1.5.x, dup2 (1, 1) returns 0. 181 On Cygwin 1.5.x, dup2 (1, 1) returns 0.
@@ -176,13 +191,14 @@ rpl_dup2 (int fd, int desired_fd)
176 return fcntl (fd, F_GETFL) == -1 ? -1 : fd; 191 return fcntl (fd, F_GETFL) == -1 ? -1 : fd;
177#endif 192#endif
178 193
179 result = dup2 (fd, desired_fd); 194 int result = dup2 (fd, desired_fd);
180 195
181 /* Correct an errno value on FreeBSD 6.1 and Cygwin 1.5.x. */ 196 /* Correct an errno value on FreeBSD 6.1 and Cygwin 1.5.x. */
182 if (result == -1 && errno == EMFILE) 197 if (result < 0 && errno == EMFILE)
183 errno = EBADF; 198 errno = EBADF;
199
184#if REPLACE_FCHDIR 200#if REPLACE_FCHDIR
185 if (fd != desired_fd && result != -1) 201 if (! (result < 0 || fd == desired_fd))
186 result = _gl_register_dup (fd, result); 202 result = _gl_register_dup (fd, result);
187#endif 203#endif
188 return result; 204 return result;
diff --git a/gl/dynarray.h b/gl/dynarray.h
index 8940e81b..a5cdf630 100644
--- a/gl/dynarray.h
+++ b/gl/dynarray.h
@@ -1,5 +1,5 @@
1/* Type-safe arrays which grow dynamically. 1/* Type-safe arrays which grow dynamically.
2 Copyright 2021-2024 Free Software Foundation, Inc. 2 Copyright 2021-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/errno.in.h b/gl/errno.in.h
index aa658e62..784a4018 100644
--- a/gl/errno.in.h
+++ b/gl/errno.in.h
@@ -1,6 +1,6 @@
1/* A POSIX-like <errno.h>. 1/* A POSIX-like <errno.h>.
2 2
3 Copyright (C) 2008-2024 Free Software Foundation, Inc. 3 Copyright (C) 2008-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -133,7 +133,7 @@
133 133
134/* These are intentionally the same values as the WSA* error numbers, defined 134/* These are intentionally the same values as the WSA* error numbers, defined
135 in <winsock2.h>. */ 135 in <winsock2.h>. */
136# define ESOCKTNOSUPPORT 10044 /* not required by POSIX */ 136# define ESOCKTNOSUPPORT 10044
137# define EPFNOSUPPORT 10046 /* not required by POSIX */ 137# define EPFNOSUPPORT 10046 /* not required by POSIX */
138# define ESHUTDOWN 10058 /* not required by POSIX */ 138# define ESHUTDOWN 10058 /* not required by POSIX */
139# define ETOOMANYREFS 10059 /* not required by POSIX */ 139# define ETOOMANYREFS 10059 /* not required by POSIX */
@@ -148,27 +148,11 @@
148# endif 148# endif
149 149
150 150
151/* On OSF/1 5.1, when _XOPEN_SOURCE_EXTENDED is not defined, the macros
152 EMULTIHOP, ENOLINK, EOVERFLOW are not defined. */
153# if @EMULTIHOP_HIDDEN@
154# define EMULTIHOP @EMULTIHOP_VALUE@
155# define GNULIB_defined_EMULTIHOP 1
156# endif
157# if @ENOLINK_HIDDEN@
158# define ENOLINK @ENOLINK_VALUE@
159# define GNULIB_defined_ENOLINK 1
160# endif
161# if @EOVERFLOW_HIDDEN@
162# define EOVERFLOW @EOVERFLOW_VALUE@
163# define GNULIB_defined_EOVERFLOW 1
164# endif
165
166
167/* On OpenBSD 4.0 and on native Windows, the macros ENOMSG, EIDRM, ENOLINK, 151/* On OpenBSD 4.0 and on native Windows, the macros ENOMSG, EIDRM, ENOLINK,
168 EPROTO, EMULTIHOP, EBADMSG, EOVERFLOW, ENOTSUP, ECANCELED are not defined. 152 EPROTO, EMULTIHOP, EBADMSG, EOVERFLOW, ENOTSUP, ECANCELED are not defined.
169 Likewise, on NonStop Kernel, EDQUOT is not defined. 153 Likewise, on NonStop Kernel, EDQUOT is not defined.
170 Define them here. Values >= 2000 seem safe to use: Solaris ESTALE = 151, 154 Define them here. Values >= 2000 seem safe to use: Solaris ESTALE = 151,
171 HP-UX EWOULDBLOCK = 246, IRIX EDQUOT = 1133. 155 HP-UX EWOULDBLOCK = 246.
172 156
173 Note: When one of these systems defines some of these macros some day, 157 Note: When one of these systems defines some of these macros some day,
174 binaries will have to be recompiled so that they recognizes the new 158 binaries will have to be recompiled so that they recognizes the new
@@ -270,10 +254,17 @@
270# define GNULIB_defined_ENOTRECOVERABLE 1 254# define GNULIB_defined_ENOTRECOVERABLE 1
271# endif 255# endif
272 256
257/* On LynxOS, the macro EILSEQ is not defined. */
273# ifndef EILSEQ 258# ifndef EILSEQ
274# define EILSEQ 2015 259# define EILSEQ 2015
275# define GNULIB_defined_EILSEQ 1 260# define GNULIB_defined_EILSEQ 1
276# endif 261# endif
277 262
263/* On Haiku, the macro ESOCKTNOSUPPORT is not defined. */
264# ifndef ESOCKTNOSUPPORT
265# define ESOCKTNOSUPPORT 2016
266# define GNULIB_defined_ESOCKTNOSUPPORT 1
267# endif
268
278#endif /* _@GUARD_PREFIX@_ERRNO_H */ 269#endif /* _@GUARD_PREFIX@_ERRNO_H */
279#endif /* _@GUARD_PREFIX@_ERRNO_H */ 270#endif /* _@GUARD_PREFIX@_ERRNO_H */
diff --git a/gl/error.c b/gl/error.c
index c53dfeb6..e066241b 100644
--- a/gl/error.c
+++ b/gl/error.c
@@ -1,25 +1,32 @@
1/* Error handler for noninteractive utilities 1/* Error handler for noninteractive utilities
2 Copyright (C) 1990-1998, 2000-2007, 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 1990-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 4
5 This file is free software: you can redistribute it and/or modify 5 The GNU C Library is free software; you can redistribute it and/or
6 it under the terms of the GNU Lesser General Public License as 6 modify it under the terms of the GNU Lesser General Public
7 published by the Free Software Foundation; either version 2.1 of the 7 License as published by the Free Software Foundation; either
8 License, or (at your option) any later version. 8 version 2.1 of the License, or (at your option) any later version.
9 9
10 This file is distributed in the hope that it will be useful, 10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 GNU Lesser General Public License for more details. 13 Lesser General Public License for more details.
14 14
15 You should have received a copy of the GNU Lesser General Public License 15 You should have received a copy of the GNU Lesser General Public
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
17 18
18/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */ 19/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
19 20
20#if !_LIBC 21#if !_LIBC
21# include <config.h> 22# include <config.h>
22# define _GL_NO_INLINE_ERROR 23# define _GL_NO_INLINE_ERROR
24# define __error_internal(status, err, fmt, args, flags) \
25 verror (status, err, fmt, args)
26# define __error_at_line_internal(status, err, file, line, fmt, args, flags) \
27 verror_at_line (status, err, file, line, fmt, args)
28# define error_tail(status, err, fmt, args, flags) \
29 error_tail (status, err, fmt, args)
23#endif 30#endif
24 31
25#include <error.h> 32#include <error.h>
@@ -31,7 +38,7 @@
31 38
32#if !_LIBC && ENABLE_NLS 39#if !_LIBC && ENABLE_NLS
33# include "gettext.h" 40# include "gettext.h"
34# define _(msgid) gettext (msgid) 41# define _(msgid) dgettext (GNULIB_TEXT_DOMAIN, msgid)
35#endif 42#endif
36 43
37#ifdef _LIBC 44#ifdef _LIBC
@@ -85,7 +92,7 @@ extern void __error_at_line (int status, int errnum, const char *file_name,
85# undef putc 92# undef putc
86# define putc(c, fp) _IO_putc (c, fp) 93# define putc(c, fp) _IO_putc (c, fp)
87 94
88# include <bits/libc-lock.h> 95# include <libc-lock.h>
89 96
90#else /* not _LIBC */ 97#else /* not _LIBC */
91 98
@@ -123,6 +130,13 @@ int strerror_r (int errnum, char *buf, size_t buflen);
123# if GNULIB_STRERROR_R_POSIX || HAVE_STRERROR_R || defined strerror_r 130# if GNULIB_STRERROR_R_POSIX || HAVE_STRERROR_R || defined strerror_r
124# define __strerror_r strerror_r 131# define __strerror_r strerror_r
125# endif /* GNULIB_STRERROR_R_POSIX || HAVE_STRERROR_R || defined strerror_r */ 132# endif /* GNULIB_STRERROR_R_POSIX || HAVE_STRERROR_R || defined strerror_r */
133
134# if GNULIB_defined_verror
135# undef verror
136# endif
137# if GNULIB_defined_verror_at_line
138# undef verror_at_line
139# endif
126#endif /* not _LIBC */ 140#endif /* not _LIBC */
127 141
128#if !_LIBC 142#if !_LIBC
@@ -151,8 +165,8 @@ flush_stdout (void)
151#if !_LIBC 165#if !_LIBC
152 int stdout_fd; 166 int stdout_fd;
153 167
154# if GNULIB_FREOPEN_SAFER 168# if GNULIB_FREOPEN_SAFER || GNULIB_XSTDOPEN
155 /* Use of gnulib's freopen-safer module normally ensures that 169 /* Gnulib's freopen-safer and/or xstdopen modules normally ensure that
156 fileno (stdout) == 1 170 fileno (stdout) == 1
157 whenever stdout is open. */ 171 whenever stdout is open. */
158 stdout_fd = STDOUT_FILENO; 172 stdout_fd = STDOUT_FILENO;
@@ -183,7 +197,7 @@ print_errno_message (int errnum)
183 if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0) 197 if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0)
184 s = errbuf; 198 s = errbuf;
185 else 199 else
186 s = 0; 200 s = NULL;
187# endif 201# endif
188#else 202#else
189 s = strerror (errnum); 203 s = strerror (errnum);
@@ -202,75 +216,18 @@ print_errno_message (int errnum)
202} 216}
203 217
204static void _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) _GL_ARG_NONNULL ((3)) 218static void _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) _GL_ARG_NONNULL ((3))
205error_tail (int status, int errnum, const char *message, va_list args) 219error_tail (int status, int errnum, const char *message, va_list args,
220 unsigned int mode_flags)
206{ 221{
207#if _LIBC 222#if _LIBC
208 if (_IO_fwide (stderr, 0) > 0) 223 int ret = __vfxprintf (stderr, message, args, mode_flags);
209 { 224 if (ret < 0 && errno == ENOMEM && _IO_fwide (stderr, 0) > 0)
210 size_t len = strlen (message) + 1; 225 /* Leave a trace in case the heap allocation of the message string
211 wchar_t *wmessage = NULL; 226 failed. */
212 mbstate_t st; 227 fputws_unlocked (L"out of memory\n", stderr);
213 size_t res; 228#else
214 const char *tmp; 229 vfprintf (stderr, message, args);
215 bool use_malloc = false;
216
217 while (1)
218 {
219 if (__libc_use_alloca (len * sizeof (wchar_t)))
220 wmessage = (wchar_t *) alloca (len * sizeof (wchar_t));
221 else
222 {
223 if (!use_malloc)
224 wmessage = NULL;
225
226 wchar_t *p = (wchar_t *) realloc (wmessage,
227 len * sizeof (wchar_t));
228 if (p == NULL)
229 {
230 free (wmessage);
231 fputws_unlocked (L"out of memory\n", stderr);
232 return;
233 }
234 wmessage = p;
235 use_malloc = true;
236 }
237
238 memset (&st, '\0', sizeof (st));
239 tmp = message;
240
241 res = mbsrtowcs (wmessage, &tmp, len, &st);
242 if (res != len)
243 break;
244
245 if (__builtin_expect (len >= SIZE_MAX / sizeof (wchar_t) / 2, 0))
246 {
247 /* This really should not happen if everything is fine. */
248 res = (size_t) -1;
249 break;
250 }
251
252 len *= 2;
253 }
254
255 if (res == (size_t) -1)
256 {
257 /* The string cannot be converted. */
258 if (use_malloc)
259 {
260 free (wmessage);
261 use_malloc = false;
262 }
263 wmessage = (wchar_t *) L"???";
264 }
265
266 __vfwprintf (stderr, wmessage, args);
267
268 if (use_malloc)
269 free (wmessage);
270 }
271 else
272#endif 230#endif
273 vfprintf (stderr, message, args);
274 231
275 ++error_message_count; 232 ++error_message_count;
276 if (errnum) 233 if (errnum)
@@ -291,16 +248,14 @@ error_tail (int status, int errnum, const char *message, va_list args)
291 If ERRNUM is nonzero, print its corresponding system error message. 248 If ERRNUM is nonzero, print its corresponding system error message.
292 Exit with status STATUS if it is nonzero. */ 249 Exit with status STATUS if it is nonzero. */
293void 250void
294error (int status, int errnum, const char *message, ...) 251__error_internal (int status, int errnum, const char *message,
252 va_list args, unsigned int mode_flags)
295{ 253{
296 va_list args; 254#if defined _LIBC
297
298#if defined _LIBC && defined __libc_ptf_call
299 /* We do not want this call to be cut short by a thread 255 /* We do not want this call to be cut short by a thread
300 cancellation. Therefore disable cancellation for now. */ 256 cancellation. Therefore disable cancellation for now. */
301 int state = PTHREAD_CANCEL_ENABLE; 257 int state = PTHREAD_CANCEL_ENABLE;
302 __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), 258 __pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &state);
303 0);
304#endif 259#endif
305 260
306 flush_stdout (); 261 flush_stdout ();
@@ -318,28 +273,32 @@ error (int status, int errnum, const char *message, ...)
318#endif 273#endif
319 } 274 }
320 275
321 va_start (args, message); 276 error_tail (status, errnum, message, args, mode_flags);
322 error_tail (status, errnum, message, args);
323 va_end (args);
324 277
325#ifdef _LIBC 278#ifdef _LIBC
326 _IO_funlockfile (stderr); 279 _IO_funlockfile (stderr);
327# ifdef __libc_ptf_call 280 __pthread_setcancelstate (state, NULL);
328 __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
329# endif
330#endif 281#endif
331} 282}
283
284void
285error (int status, int errnum, const char *message, ...)
286{
287 va_list ap;
288 va_start (ap, message);
289 __error_internal (status, errnum, message, ap, 0);
290 va_end (ap);
291}
332 292
333/* Sometimes we want to have at most one error per line. This 293/* Sometimes we want to have at most one error per line. This
334 variable controls whether this mode is selected or not. */ 294 variable controls whether this mode is selected or not. */
335int error_one_per_line; 295int error_one_per_line;
336 296
337void 297void
338error_at_line (int status, int errnum, const char *file_name, 298__error_at_line_internal (int status, int errnum, const char *file_name,
339 unsigned int line_number, const char *message, ...) 299 unsigned int line_number, const char *message,
300 va_list args, unsigned int mode_flags)
340{ 301{
341 va_list args;
342
343 if (error_one_per_line) 302 if (error_one_per_line)
344 { 303 {
345 static const char *old_file_name; 304 static const char *old_file_name;
@@ -358,12 +317,11 @@ error_at_line (int status, int errnum, const char *file_name,
358 old_line_number = line_number; 317 old_line_number = line_number;
359 } 318 }
360 319
361#if defined _LIBC && defined __libc_ptf_call 320#if defined _LIBC
362 /* We do not want this call to be cut short by a thread 321 /* We do not want this call to be cut short by a thread
363 cancellation. Therefore disable cancellation for now. */ 322 cancellation. Therefore disable cancellation for now. */
364 int state = PTHREAD_CANCEL_ENABLE; 323 int state = PTHREAD_CANCEL_ENABLE;
365 __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), 324 __pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &state);
366 0);
367#endif 325#endif
368 326
369 flush_stdout (); 327 flush_stdout ();
@@ -389,18 +347,25 @@ error_at_line (int status, int errnum, const char *file_name,
389 file_name, line_number); 347 file_name, line_number);
390#endif 348#endif
391 349
392 va_start (args, message); 350 error_tail (status, errnum, message, args, mode_flags);
393 error_tail (status, errnum, message, args);
394 va_end (args);
395 351
396#ifdef _LIBC 352#ifdef _LIBC
397 _IO_funlockfile (stderr); 353 _IO_funlockfile (stderr);
398# ifdef __libc_ptf_call 354 __pthread_setcancelstate (state, NULL);
399 __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
400# endif
401#endif 355#endif
402} 356}
403 357
358void
359error_at_line (int status, int errnum, const char *file_name,
360 unsigned int line_number, const char *message, ...)
361{
362 va_list ap;
363 va_start (ap, message);
364 __error_at_line_internal (status, errnum, file_name, line_number,
365 message, ap, 0);
366 va_end (ap);
367}
368
404#ifdef _LIBC 369#ifdef _LIBC
405/* Make the weak alias. */ 370/* Make the weak alias. */
406# undef error 371# undef error
diff --git a/gl/error.in.h b/gl/error.in.h
index 51f8cafd..3355fb3b 100644
--- a/gl/error.in.h
+++ b/gl/error.in.h
@@ -1,5 +1,5 @@
1/* Declarations for error-reporting functions. 1/* Declarations for error-reporting functions.
2 Copyright (C) 1995-1997, 2003, 2006, 2008-2024 Free Software Foundation, 2 Copyright (C) 1995-1997, 2003, 2006, 2008-2026 Free Software Foundation,
3 Inc. 3 Inc.
4 This file is part of the GNU C Library. 4 This file is part of the GNU C Library.
5 5
@@ -23,20 +23,23 @@
23 or error_at_line(...) invocations. */ 23 or error_at_line(...) invocations. */
24 24
25/* The include_next requires a split double-inclusion guard. */ 25/* The include_next requires a split double-inclusion guard. */
26#if @HAVE_ERROR_H@ 26#if @HAVE_ERROR_H@ && !defined __MINGW32__
27# @INCLUDE_NEXT@ @NEXT_ERROR_H@ 27# @INCLUDE_NEXT@ @NEXT_ERROR_H@
28#endif 28#endif
29 29
30#ifndef _@GUARD_PREFIX@_ERROR_H 30#ifndef _@GUARD_PREFIX@_ERROR_H
31#define _@GUARD_PREFIX@_ERROR_H 31#define _@GUARD_PREFIX@_ERROR_H
32 32
33/* This file uses _GL_ATTRIBUTE_ALWAYS_INLINE, _GL_ATTRIBUTE_FORMAT, 33/* This file uses _GL_ATTRIBUTE_ALWAYS_INLINE, _GL_ATTRIBUTE_COLD,
34 _GL_ATTRIBUTE_MAYBE_UNUSED. */ 34 _GL_ATTRIBUTE_FORMAT, _GL_ATTRIBUTE_MAYBE_UNUSED. */
35#if !_GL_CONFIG_H_INCLUDED 35#if !_GL_CONFIG_H_INCLUDED
36 #error "Please include config.h first." 36 #error "Please include config.h first."
37#endif 37#endif
38 38
39/* Get 'unreachable'. */ 39/* Get va_list. */
40#include <stdarg.h>
41
42/* Get 'gl_unreachable'. */
40#include <stddef.h> 43#include <stddef.h>
41 44
42/* Get _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM. */ 45/* Get _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM. */
@@ -54,11 +57,11 @@
54 It evaluates its arguments only once. 57 It evaluates its arguments only once.
55 Test case: Compile copy-file.c with "gcc -Wimplicit-fallthrough". */ 58 Test case: Compile copy-file.c with "gcc -Wimplicit-fallthrough". */
56#if defined __GNUC__ || defined __clang__ 59#if defined __GNUC__ || defined __clang__
57/* Use 'unreachable' to tell the compiler when the function call does not 60/* Use 'gl_unreachable' to tell the compiler when the function call does not
58 return. */ 61 return. */
59# define __gl_error_call1(function, status, ...) \ 62# define __gl_error_call1(function, status, ...) \
60 ((function) (status, __VA_ARGS__), \ 63 ((function) (status, __VA_ARGS__), \
61 (status) != 0 ? unreachable () : (void) 0) 64 (status) != 0 ? gl_unreachable () : (void) 0)
62/* If STATUS is a not a constant, the function call may or may not return; 65/* If STATUS is a not a constant, the function call may or may not return;
63 therefore -Wimplicit-fallthrough will produce a warning. Use a compound 66 therefore -Wimplicit-fallthrough will produce a warning. Use a compound
64 statement in order to evaluate STATUS only once. 67 statement in order to evaluate STATUS only once.
@@ -92,7 +95,8 @@ extern "C" {
92# define error rpl_error 95# define error rpl_error
93# endif 96# endif
94_GL_FUNCDECL_RPL (error, void, 97_GL_FUNCDECL_RPL (error, void,
95 (int __status, int __errnum, const char *__format, ...) 98 (int __status, int __errnum, const char *__format, ...),
99 _GL_ATTRIBUTE_COLD
96 _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 3, 4))); 100 _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 3, 4)));
97_GL_CXXALIAS_RPL (error, void, 101_GL_CXXALIAS_RPL (error, void,
98 (int __status, int __errnum, const char *__format, ...)); 102 (int __status, int __errnum, const char *__format, ...));
@@ -104,7 +108,8 @@ _GL_CXXALIAS_RPL (error, void,
104#else 108#else
105# if ! @HAVE_ERROR@ 109# if ! @HAVE_ERROR@
106_GL_FUNCDECL_SYS (error, void, 110_GL_FUNCDECL_SYS (error, void,
107 (int __status, int __errnum, const char *__format, ...) 111 (int __status, int __errnum, const char *__format, ...),
112 _GL_ATTRIBUTE_COLD
108 _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 3, 4))); 113 _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 3, 4)));
109# endif 114# endif
110_GL_CXXALIAS_SYS (error, void, 115_GL_CXXALIAS_SYS (error, void,
@@ -117,7 +122,7 @@ _GL_CXXALIAS_SYS (error, void,
117# pragma GCC diagnostic ignored "-Wattributes" 122# pragma GCC diagnostic ignored "-Wattributes"
118_GL_ATTRIBUTE_MAYBE_UNUSED 123_GL_ATTRIBUTE_MAYBE_UNUSED
119static void 124static void
120_GL_ATTRIBUTE_ALWAYS_INLINE 125_GL_ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_COLD
121_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 3, 4)) 126_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 3, 4))
122_gl_inline_error (int __status, int __errnum, const char *__format, ...) 127_gl_inline_error (int __status, int __errnum, const char *__format, ...)
123{ 128{
@@ -147,7 +152,8 @@ _GL_CXXALIASWARN (error);
147# endif 152# endif
148_GL_FUNCDECL_RPL (error_at_line, void, 153_GL_FUNCDECL_RPL (error_at_line, void,
149 (int __status, int __errnum, const char *__filename, 154 (int __status, int __errnum, const char *__filename,
150 unsigned int __lineno, const char *__format, ...) 155 unsigned int __lineno, const char *__format, ...),
156 _GL_ATTRIBUTE_COLD
151 _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 5, 6))); 157 _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 5, 6)));
152_GL_CXXALIAS_RPL (error_at_line, void, 158_GL_CXXALIAS_RPL (error_at_line, void,
153 (int __status, int __errnum, const char *__filename, 159 (int __status, int __errnum, const char *__filename,
@@ -161,7 +167,8 @@ _GL_CXXALIAS_RPL (error_at_line, void,
161# if ! @HAVE_ERROR_AT_LINE@ 167# if ! @HAVE_ERROR_AT_LINE@
162_GL_FUNCDECL_SYS (error_at_line, void, 168_GL_FUNCDECL_SYS (error_at_line, void,
163 (int __status, int __errnum, const char *__filename, 169 (int __status, int __errnum, const char *__filename,
164 unsigned int __lineno, const char *__format, ...) 170 unsigned int __lineno, const char *__format, ...),
171 _GL_ATTRIBUTE_COLD
165 _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 5, 6))); 172 _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 5, 6)));
166# endif 173# endif
167_GL_CXXALIAS_SYS (error_at_line, void, 174_GL_CXXALIAS_SYS (error_at_line, void,
@@ -175,7 +182,7 @@ _GL_CXXALIAS_SYS (error_at_line, void,
175# pragma GCC diagnostic ignored "-Wattributes" 182# pragma GCC diagnostic ignored "-Wattributes"
176_GL_ATTRIBUTE_MAYBE_UNUSED 183_GL_ATTRIBUTE_MAYBE_UNUSED
177static void 184static void
178_GL_ATTRIBUTE_ALWAYS_INLINE 185_GL_ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_COLD
179_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 5, 6)) 186_GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 5, 6))
180_gl_inline_error_at_line (int __status, int __errnum, const char *__filename, 187_gl_inline_error_at_line (int __status, int __errnum, const char *__filename,
181 unsigned int __lineno, const char *__format, ...) 188 unsigned int __lineno, const char *__format, ...)
@@ -196,6 +203,44 @@ _gl_inline_error_at_line (int __status, int __errnum, const char *__filename,
196#endif 203#endif
197_GL_CXXALIASWARN (error_at_line); 204_GL_CXXALIASWARN (error_at_line);
198 205
206/* Print a message with 'vfprintf (stderr, FORMAT, ARGS)';
207 if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
208 If STATUS is nonzero, terminate the program with 'exit (STATUS)'.
209 Use the globals error_print_progname and error_message_count similarly
210 to error(). */
211
212extern void verror (int __status, int __errnum, const char *__format,
213 va_list __args)
214 _GL_ATTRIBUTE_COLD
215 _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 3, 0));
216#ifndef _GL_NO_INLINE_ERROR
217# ifndef verror
218# define verror(status, ...) \
219 __gl_error_call (verror, status, __VA_ARGS__)
220# define GNULIB_defined_verror 1
221# endif
222#endif
223
224/* Print a message with 'vfprintf (stderr, FORMAT, ARGS)';
225 if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
226 If STATUS is nonzero, terminate the program with 'exit (STATUS)'.
227 If FNAME is not NULL, prepend the message with "FNAME:LINENO:".
228 Use the globals error_print_progname, error_message_count, and
229 error_one_per_line similarly to error_at_line(). */
230
231extern void verror_at_line (int __status, int __errnum, const char *__fname,
232 unsigned int __lineno, const char *__format,
233 va_list __args)
234 _GL_ATTRIBUTE_COLD
235 _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 5, 0));
236#ifdef _GL_NO_INLINE_ERROR
237# ifndef verror_at_line
238# define verror_at_line(status, ...) \
239 __gl_error_call (verror_at_line, status, __VA_ARGS__)
240# define GNULIB_defined_verror_at_line 1
241# endif
242#endif
243
199/* If NULL, error will flush stdout, then print on stderr the program 244/* If NULL, error will flush stdout, then print on stderr the program
200 name, a colon and a space. Otherwise, error will call this 245 name, a colon and a space. Otherwise, error will call this
201 function without parameters instead. */ 246 function without parameters instead. */
diff --git a/gl/exitfail.c b/gl/exitfail.c
index 8a5962e8..148468b7 100644
--- a/gl/exitfail.c
+++ b/gl/exitfail.c
@@ -1,6 +1,6 @@
1/* Failure exit status 1/* Failure exit status
2 2
3 Copyright (C) 2002-2003, 2005-2007, 2009-2024 Free Software Foundation, Inc. 3 Copyright (C) 2002-2003, 2005-2007, 2009-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/exitfail.h b/gl/exitfail.h
index fa264b5c..64e2aa33 100644
--- a/gl/exitfail.h
+++ b/gl/exitfail.h
@@ -1,6 +1,6 @@
1/* Failure exit status 1/* Failure exit status
2 2
3 Copyright (C) 2002, 2009-2024 Free Software Foundation, Inc. 3 Copyright (C) 2002, 2009-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/fcntl.c b/gl/fcntl.c
index 7cd3a0f9..1c0e52d2 100644
--- a/gl/fcntl.c
+++ b/gl/fcntl.c
@@ -1,6 +1,6 @@
1/* Provide file descriptor control. 1/* Provide file descriptor control.
2 2
3 Copyright (C) 2009-2024 Free Software Foundation, Inc. 3 Copyright (C) 2009-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -29,8 +29,8 @@
29#include <unistd.h> 29#include <unistd.h>
30 30
31#ifdef __KLIBC__ 31#ifdef __KLIBC__
32# define INCL_DOS 32# include <emx/io.h>
33# include <os2.h> 33# include <InnoTekLIBC/backend.h>
34#endif 34#endif
35 35
36#if defined _WIN32 && ! defined __CYGWIN__ 36#if defined _WIN32 && ! defined __CYGWIN__
@@ -56,19 +56,15 @@ dupfd (int oldfd, int newfd, int flags)
56{ 56{
57 /* Mingw has no way to create an arbitrary fd. Iterate until all 57 /* Mingw has no way to create an arbitrary fd. Iterate until all
58 file descriptors less than newfd are filled up. */ 58 file descriptors less than newfd are filled up. */
59 HANDLE curr_process = GetCurrentProcess ();
60 HANDLE old_handle = (HANDLE) _get_osfhandle (oldfd);
61 unsigned char fds_to_close[OPEN_MAX_MAX / CHAR_BIT];
62 unsigned int fds_to_close_bound = 0;
63 int result;
64 BOOL inherit = flags & O_CLOEXEC ? FALSE : TRUE;
65 int mode;
66 59
67 if (newfd < 0 || getdtablesize () <= newfd) 60 if (newfd < 0 || getdtablesize () <= newfd)
68 { 61 {
69 errno = EINVAL; 62 errno = EINVAL;
70 return -1; 63 return -1;
71 } 64 }
65
66 HANDLE old_handle = (HANDLE) _get_osfhandle (oldfd);
67 int mode;
72 if (old_handle == INVALID_HANDLE_VALUE 68 if (old_handle == INVALID_HANDLE_VALUE
73 || (mode = _setmode (oldfd, O_BINARY)) == -1) 69 || (mode = _setmode (oldfd, O_BINARY)) == -1)
74 { 70 {
@@ -80,6 +76,11 @@ dupfd (int oldfd, int newfd, int flags)
80 _setmode (oldfd, mode); 76 _setmode (oldfd, mode);
81 flags |= mode; 77 flags |= mode;
82 78
79 HANDLE curr_process = GetCurrentProcess ();
80 BOOL inherit = flags & O_CLOEXEC ? FALSE : TRUE;
81 unsigned char fds_to_close[OPEN_MAX_MAX / CHAR_BIT];
82 unsigned int fds_to_close_bound = 0;
83 int result;
83 for (;;) 84 for (;;)
84 { 85 {
85 HANDLE new_handle; 86 HANDLE new_handle;
@@ -146,9 +147,8 @@ dupfd (int oldfd, int newfd, int flags)
146 /* Close the previous fds that turned out to be too small. */ 147 /* Close the previous fds that turned out to be too small. */
147 { 148 {
148 int saved_errno = errno; 149 int saved_errno = errno;
149 unsigned int duplicated_fd;
150 150
151 for (duplicated_fd = 0; 151 for (unsigned int duplicated_fd = 0;
152 duplicated_fd < fds_to_close_bound * CHAR_BIT; 152 duplicated_fd < fds_to_close_bound * CHAR_BIT;
153 duplicated_fd++) 153 duplicated_fd++)
154 if ((fds_to_close[duplicated_fd / CHAR_BIT] 154 if ((fds_to_close[duplicated_fd / CHAR_BIT]
@@ -206,8 +206,9 @@ fcntl (int fd, int action, /* arg */...)
206#endif 206#endif
207{ 207{
208 va_list arg; 208 va_list arg;
209 int result = -1;
210 va_start (arg, action); 209 va_start (arg, action);
210
211 int result = -1;
211 switch (action) 212 switch (action)
212 { 213 {
213 case F_DUPFD: 214 case F_DUPFD:
@@ -376,12 +377,6 @@ fcntl (int fd, int action, /* arg */...)
376 #ifdef F_NOTIFY /* Linux */ 377 #ifdef F_NOTIFY /* Linux */
377 case F_NOTIFY: 378 case F_NOTIFY:
378 #endif 379 #endif
379 #ifdef F_OPLKACK /* IRIX */
380 case F_OPLKACK:
381 #endif
382 #ifdef F_OPLKREG /* IRIX */
383 case F_OPLKREG:
384 #endif
385 #ifdef F_RDAHEAD /* macOS */ 380 #ifdef F_RDAHEAD /* macOS */
386 case F_RDAHEAD: 381 case F_RDAHEAD:
387 #endif 382 #endif
@@ -439,7 +434,9 @@ fcntl (int fd, int action, /* arg */...)
439 break; 434 break;
440 } 435 }
441 } 436 }
437
442 va_end (arg); 438 va_end (arg);
439
443 return result; 440 return result;
444} 441}
445 442
@@ -546,78 +543,115 @@ rpl_fcntl_DUPFD_CLOEXEC (int fd, int target)
546#undef fcntl 543#undef fcntl
547 544
548#ifdef __KLIBC__ 545#ifdef __KLIBC__
549
550static int 546static int
551klibc_fcntl (int fd, int action, /* arg */...) 547klibc_dupdirfd (int fd, int minfd)
552{ 548{
553 va_list arg_ptr; 549 int tempfd = open ("NUL", O_RDONLY);
554 int arg; 550 if (tempfd == -1)
555 struct stat sbuf; 551 return -1;
556 int result;
557 552
558 va_start (arg_ptr, action); 553 if (tempfd >= minfd)
559 arg = va_arg (arg_ptr, int);
560 result = fcntl (fd, action, arg);
561 /* EPERM for F_DUPFD, ENOTSUP for others */
562 if (result == -1 && (errno == EPERM || errno == ENOTSUP)
563 && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode))
564 { 554 {
565 ULONG ulMode; 555 close (tempfd);
566 556
567 switch (action) 557 char path[_MAX_PATH];
568 { 558 if (__libc_Back_ioFHToPath (fd, path, sizeof (path)))
569 case F_DUPFD: 559 return -1;
570 /* Find available fd */
571 while (fcntl (arg, F_GETFL) != -1 || errno != EBADF)
572 arg++;
573 560
574 result = dup2 (fd, arg); 561 int dupfd = open (path, O_RDONLY);
575 break; 562 if (dupfd == -1)
563 return -1;
576 564
577 /* Using underlying APIs is right ? */ 565 if (dupfd >= minfd)
578 case F_GETFD: 566 return dupfd;
579 if (DosQueryFHState (fd, &ulMode))
580 break;
581
582 result = (ulMode & OPEN_FLAGS_NOINHERIT) ? FD_CLOEXEC : 0;
583 break;
584
585 case F_SETFD:
586 if (arg & ~FD_CLOEXEC)
587 break;
588 567
589 if (DosQueryFHState (fd, &ulMode)) 568 /* Lower FD was closed by other threads. Fill again. */
590 break; 569 tempfd = dupfd;
570 }
591 571
592 if (arg & FD_CLOEXEC) 572 int dupfd = klibc_dupdirfd (fd, minfd);
593 ulMode |= OPEN_FLAGS_NOINHERIT;
594 else
595 ulMode &= ~OPEN_FLAGS_NOINHERIT;
596 573
597 /* Filter supported flags. */ 574 close (tempfd);
598 ulMode &= (OPEN_FLAGS_WRITE_THROUGH | OPEN_FLAGS_FAIL_ON_ERROR
599 | OPEN_FLAGS_NO_CACHE | OPEN_FLAGS_NOINHERIT);
600 575
601 if (DosSetFHState (fd, ulMode)) 576 return dupfd;
602 break; 577}
603
604 result = 0;
605 break;
606 578
607 case F_GETFL: 579static int
608 result = 0; 580klibc_fcntl (int fd, int action, /* arg */...)
609 break; 581{
582 va_list arg_ptr;
583 va_start (arg_ptr, action);
610 584
611 case F_SETFL: 585 int arg = va_arg (arg_ptr, int);
612 if (arg != 0) 586 int result = fcntl (fd, action, arg);
613 break; 587 /* EPERM for F_DUPFD, ENOTSUP for others */
588 if (result == -1 && (errno == EPERM || errno == ENOTSUP))
589 {
590 struct stat sbuf;
591 if (!fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode))
592 {
593 switch (action)
594 {
595 case F_DUPFD:
596 result = klibc_dupdirfd (fd, arg);
597 break;
598
599 case F_GETFD:
600 {
601 PLIBCFH pFH = __libc_FH (fd);
602 if (!pFH)
603 {
604 errno = EBADF;
605 break;
606 }
607
608 result = (pFH->fFlags & ((FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT )
609 | O_NOINHERIT)) ? FD_CLOEXEC : 0;
610 }
611 break;
612
613 case F_SETFD:
614 {
615 if (arg & ~FD_CLOEXEC)
616 break;
617
618 PLIBCFH pFH = __libc_FH (fd);
619 if (!pFH)
620 {
621 errno = EBADF;
622 break;
623 }
624
625 unsigned fFlags = pFH->fFlags;
626 if (arg & FD_CLOEXEC)
627 fFlags |= (FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT) | O_NOINHERIT;
628 else
629 fFlags &= ~((FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT) | O_NOINHERIT);
630
631 result = __libc_FHSetFlags (pFH, fd, fFlags);
632 if (result < 0)
633 {
634 errno = -result;
635 result = -1;
636 }
637 }
638 break;
639
640 case F_GETFL:
641 result = 0;
642 break;
643
644 case F_SETFL:
645 if (arg != 0)
646 break;
614 647
615 result = 0; 648 result = 0;
616 break; 649 break;
617 650
618 default: 651 default:
619 errno = EINVAL; 652 errno = EINVAL;
620 break; 653 break;
654 }
621 } 655 }
622 } 656 }
623 657
diff --git a/gl/fcntl.in.h b/gl/fcntl.in.h
index eea3b954..52727074 100644
--- a/gl/fcntl.in.h
+++ b/gl/fcntl.in.h
@@ -1,6 +1,6 @@
1/* Like <fcntl.h>, but with non-working flags defined to 0. 1/* Like <fcntl.h>, but with non-working flags defined to 0.
2 2
3 Copyright (C) 2006-2024 Free Software Foundation, Inc. 3 Copyright (C) 2006-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -22,8 +22,12 @@
22#endif 22#endif
23@PRAGMA_COLUMNS@ 23@PRAGMA_COLUMNS@
24 24
25#if defined __need_system_fcntl_h 25#if defined __need_system_fcntl_h || defined _@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H
26/* Special invocation convention. */ 26/* Special invocation convention:
27 - On Haiku we have a sequence of nested includes
28 <fcntl.h> -> <unistd.h> -> <fcntl.h>
29 In this situation, GNULIB_defined_O_NONBLOCK gets defined before the
30 system's definition of O_NONBLOCK is processed. */
27 31
28/* Needed before <sys/stat.h>. 32/* Needed before <sys/stat.h>.
29 May also define off_t to a 64-bit type on native Windows. */ 33 May also define off_t to a 64-bit type on native Windows. */
@@ -50,8 +54,11 @@
50 54
51#ifndef _@GUARD_PREFIX@_FCNTL_H 55#ifndef _@GUARD_PREFIX@_FCNTL_H
52 56
57#define _@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H
58
53/* Needed before <sys/stat.h>. 59/* Needed before <sys/stat.h>.
54 May also define off_t to a 64-bit type on native Windows. */ 60 May also define off_t to a 64-bit type on native Windows.
61 Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku. */
55#include <sys/types.h> 62#include <sys/types.h>
56/* On some systems other than glibc, <sys/stat.h> is a prerequisite of 63/* On some systems other than glibc, <sys/stat.h> is a prerequisite of
57 <fcntl.h>. On glibc systems, we would like to avoid namespace pollution. 64 <fcntl.h>. On glibc systems, we would like to avoid namespace pollution.
@@ -71,6 +78,8 @@
71# include <io.h> 78# include <io.h>
72#endif 79#endif
73 80
81#undef _@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H
82
74#ifndef _@GUARD_PREFIX@_FCNTL_H 83#ifndef _@GUARD_PREFIX@_FCNTL_H
75#define _@GUARD_PREFIX@_FCNTL_H 84#define _@GUARD_PREFIX@_FCNTL_H
76 85
@@ -99,7 +108,7 @@
99# undef creat 108# undef creat
100# define creat rpl_creat 109# define creat rpl_creat
101# endif 110# endif
102_GL_FUNCDECL_RPL (creat, int, (const char *filename, mode_t mode) 111_GL_FUNCDECL_RPL (creat, int, (const char *filename, mode_t mode),
103 _GL_ARG_NONNULL ((1))); 112 _GL_ARG_NONNULL ((1)));
104_GL_CXXALIAS_RPL (creat, int, (const char *filename, mode_t mode)); 113_GL_CXXALIAS_RPL (creat, int, (const char *filename, mode_t mode));
105# elif defined _WIN32 && !defined __CYGWIN__ 114# elif defined _WIN32 && !defined __CYGWIN__
@@ -113,7 +122,6 @@ _GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode));
113# endif 122# endif
114_GL_CXXALIASWARN (creat); 123_GL_CXXALIASWARN (creat);
115#elif defined GNULIB_POSIXCHECK 124#elif defined GNULIB_POSIXCHECK
116# undef creat
117/* Assume creat is always declared. */ 125/* Assume creat is always declared. */
118_GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - " 126_GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - "
119 "use gnulib module creat for portability"); 127 "use gnulib module creat for portability");
@@ -140,14 +148,14 @@ _GL_CXXALIASWARN (creat);
140# undef fcntl 148# undef fcntl
141# define fcntl rpl_fcntl 149# define fcntl rpl_fcntl
142# endif 150# endif
143_GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...)); 151_GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...), );
144_GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...)); 152_GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...));
145# if !GNULIB_defined_rpl_fcntl 153# if !GNULIB_defined_rpl_fcntl
146# define GNULIB_defined_rpl_fcntl 1 154# define GNULIB_defined_rpl_fcntl 1
147# endif 155# endif
148# else 156# else
149# if !@HAVE_FCNTL@ 157# if !@HAVE_FCNTL@
150_GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...)); 158_GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...), );
151# if !GNULIB_defined_fcntl 159# if !GNULIB_defined_fcntl
152# define GNULIB_defined_fcntl 1 160# define GNULIB_defined_fcntl 1
153# endif 161# endif
@@ -156,7 +164,6 @@ _GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...));
156# endif 164# endif
157_GL_CXXALIASWARN (fcntl); 165_GL_CXXALIASWARN (fcntl);
158#elif defined GNULIB_POSIXCHECK 166#elif defined GNULIB_POSIXCHECK
159# undef fcntl
160# if HAVE_RAW_DECL_FCNTL 167# if HAVE_RAW_DECL_FCNTL
161_GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - " 168_GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - "
162 "use gnulib module fcntl for portability"); 169 "use gnulib module fcntl for portability");
@@ -169,7 +176,7 @@ _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - "
169# undef open 176# undef open
170# define open rpl_open 177# define open rpl_open
171# endif 178# endif
172_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 179_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...),
173 _GL_ARG_NONNULL ((1))); 180 _GL_ARG_NONNULL ((1)));
174_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 181_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
175# elif defined _WIN32 && !defined __CYGWIN__ 182# elif defined _WIN32 && !defined __CYGWIN__
@@ -187,7 +194,6 @@ _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
187_GL_CXXALIASWARN (open); 194_GL_CXXALIASWARN (open);
188# endif 195# endif
189#elif defined GNULIB_POSIXCHECK 196#elif defined GNULIB_POSIXCHECK
190# undef open
191/* Assume open is always declared. */ 197/* Assume open is always declared. */
192_GL_WARN_ON_USE (open, "open is not always POSIX compliant - " 198_GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
193 "use gnulib module open for portability"); 199 "use gnulib module open for portability");
@@ -200,7 +206,9 @@ _GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
200# undef open 206# undef open
201# define open _open 207# define open _open
202# endif 208# endif
203_GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); 209/* Need to cast, because in MSVC the parameter list of _open as a C++ function
210 is (const char *, int, int = 0). */
211_GL_CXXALIAS_MDA_CAST (open, int, (const char *filename, int flags, ...));
204# else 212# else
205_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 213_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
206# endif 214# endif
@@ -216,14 +224,14 @@ _GL_CXXALIASWARN (open);
216# define openat rpl_openat 224# define openat rpl_openat
217# endif 225# endif
218_GL_FUNCDECL_RPL (openat, int, 226_GL_FUNCDECL_RPL (openat, int,
219 (int fd, char const *file, int flags, /* mode_t mode */ ...) 227 (int fd, char const *file, int flags, /* mode_t mode */ ...),
220 _GL_ARG_NONNULL ((2))); 228 _GL_ARG_NONNULL ((2)));
221_GL_CXXALIAS_RPL (openat, int, 229_GL_CXXALIAS_RPL (openat, int,
222 (int fd, char const *file, int flags, /* mode_t mode */ ...)); 230 (int fd, char const *file, int flags, /* mode_t mode */ ...));
223# else 231# else
224# if !@HAVE_OPENAT@ 232# if !@HAVE_OPENAT@
225_GL_FUNCDECL_SYS (openat, int, 233_GL_FUNCDECL_SYS (openat, int,
226 (int fd, char const *file, int flags, /* mode_t mode */ ...) 234 (int fd, char const *file, int flags, /* mode_t mode */ ...),
227 _GL_ARG_NONNULL ((2))); 235 _GL_ARG_NONNULL ((2)));
228# endif 236# endif
229_GL_CXXALIAS_SYS (openat, int, 237_GL_CXXALIAS_SYS (openat, int,
@@ -231,13 +239,51 @@ _GL_CXXALIAS_SYS (openat, int,
231# endif 239# endif
232_GL_CXXALIASWARN (openat); 240_GL_CXXALIASWARN (openat);
233#elif defined GNULIB_POSIXCHECK 241#elif defined GNULIB_POSIXCHECK
234# undef openat
235# if HAVE_RAW_DECL_OPENAT 242# if HAVE_RAW_DECL_OPENAT
236_GL_WARN_ON_USE (openat, "openat is not portable - " 243_GL_WARN_ON_USE (openat, "openat is not portable - "
237 "use gnulib module openat for portability"); 244 "use gnulib module openat for portability");
238# endif 245# endif
239#endif 246#endif
240 247
248#if @GNULIB_OPENAT2@
249# if !defined RESOLVE_NO_XDEV && defined __has_include
250# if __has_include (<linux/openat2.h>)
251# include <linux/openat2.h>
252# endif
253# endif
254# ifndef RESOLVE_NO_XDEV
255struct open_how
256{
257# ifdef __UINT64_TYPE__
258 __UINT64_TYPE__ flags, mode, resolve;
259# else
260 unsigned long long int flags, mode, resolve;
261# endif
262};
263# define RESOLVE_NO_XDEV 0x01
264# define RESOLVE_NO_MAGICLINKS 0x02
265# define RESOLVE_NO_SYMLINKS 0x04
266# define RESOLVE_BENEATH 0x08
267# define RESOLVE_IN_ROOT 0x10
268# define RESOLVE_CACHED 0x20
269# endif
270
271# if !@HAVE_OPENAT2@
272_GL_FUNCDECL_SYS (openat2, int,
273 (int fd, char const *file, struct open_how const *how,
274 size_t size),
275 _GL_ARG_NONNULL ((2, 3)));
276# endif
277_GL_CXXALIAS_SYS (openat2, int,
278 (int fd, char const *file, struct open_how const *how,
279 size_t size));
280_GL_CXXALIASWARN (openat2);
281#elif defined GNULIB_POSIXCHECK
282# if HAVE_RAW_DECL_OPENAT2
283_GL_WARN_ON_USE (openat2, "openat2 is not portable - "
284 "use gnulib module openat2 for portability");
285# endif
286#endif
241 287
242/* Fix up the FD_* macros, only known to be missing on mingw. */ 288/* Fix up the FD_* macros, only known to be missing on mingw. */
243 289
@@ -282,11 +328,6 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
282# endif 328# endif
283#endif 329#endif
284 330
285#if !defined O_DIRECT && defined O_DIRECTIO
286/* Tru64 spells it 'O_DIRECTIO'. */
287# define O_DIRECT O_DIRECTIO
288#endif
289
290#if !defined O_CLOEXEC && defined O_NOINHERIT 331#if !defined O_CLOEXEC && defined O_NOINHERIT
291/* Mingw spells it 'O_NOINHERIT'. */ 332/* Mingw spells it 'O_NOINHERIT'. */
292# define O_CLOEXEC O_NOINHERIT 333# define O_CLOEXEC O_NOINHERIT
@@ -304,7 +345,7 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
304#endif 345#endif
305 346
306#ifndef O_DIRECTORY 347#ifndef O_DIRECTORY
307# define O_DIRECTORY 0 348# define O_DIRECTORY 0x20000000 /* Try to not collide with system O_* flags. */
308#endif 349#endif
309 350
310#ifndef O_DSYNC 351#ifndef O_DSYNC
@@ -368,8 +409,12 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
368# define O_RSYNC 0 409# define O_RSYNC 0
369#endif 410#endif
370 411
412#if defined O_SEARCH && defined O_PATH && O_SEARCH == O_PATH
413# undef O_SEARCH /* musl mistakenly #defines O_SEARCH to O_PATH. */
414#endif
415
371#ifndef O_SEARCH 416#ifndef O_SEARCH
372# define O_SEARCH O_RDONLY /* This is often close enough in older systems. */ 417# define O_SEARCH O_RDONLY /* Often close enough in non-POSIX systems. */
373#endif 418#endif
374 419
375#ifndef O_SYNC 420#ifndef O_SYNC
@@ -445,6 +490,15 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
445# define AT_NO_AUTOMOUNT 0 490# define AT_NO_AUTOMOUNT 0
446#endif 491#endif
447 492
493/* errno when openat+O_NOFOLLOW fails because the file is a symlink. */
494#if defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__
495# define _GL_OPENAT_ESYMLINK EMLINK
496#elif defined __NetBSD__
497# define _GL_OPENAT_ESYMLINK EFTYPE
498#else
499# define _GL_OPENAT_ESYMLINK ELOOP
500#endif
501
448#endif /* _@GUARD_PREFIX@_FCNTL_H */ 502#endif /* _@GUARD_PREFIX@_FCNTL_H */
449#endif /* _@GUARD_PREFIX@_FCNTL_H */ 503#endif /* _@GUARD_PREFIX@_FCNTL_H */
450#endif 504#endif
diff --git a/gl/fd-hook.c b/gl/fd-hook.c
index 75bbe49c..eef4e81e 100644
--- a/gl/fd-hook.c
+++ b/gl/fd-hook.c
@@ -1,5 +1,5 @@
1/* Hook for making file descriptor functions close(), ioctl() extensible. 1/* Hook for making file descriptor functions close(), ioctl() extensible.
2 Copyright (C) 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 2009-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2009. 3 Written by Bruno Haible <bruno@clisp.org>, 2009.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
diff --git a/gl/fd-hook.h b/gl/fd-hook.h
index 2150460b..0f029d42 100644
--- a/gl/fd-hook.h
+++ b/gl/fd-hook.h
@@ -1,5 +1,5 @@
1/* Hook for making file descriptor functions close(), ioctl() extensible. 1/* Hook for making file descriptor functions close(), ioctl() extensible.
2 Copyright (C) 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 2009-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/fflush.c b/gl/fflush.c
index 36cc14d1..862ff926 100644
--- a/gl/fflush.c
+++ b/gl/fflush.c
@@ -1,5 +1,5 @@
1/* fflush.c -- allow flushing input streams 1/* fflush.c -- allow flushing input streams
2 Copyright (C) 2007-2024 Free Software Foundation, Inc. 2 Copyright (C) 2007-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -33,12 +33,15 @@
33 33
34#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 34#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
35/* GNU libc, BeOS, Haiku, Linux libc5 */ 35/* GNU libc, BeOS, Haiku, Linux libc5 */
36# if !defined __HAIKU__
37# define fp_ fp
38# endif
36 39
37/* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */ 40/* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */
38static void 41static void
39clear_ungetc_buffer_preserving_position (FILE *fp) 42clear_ungetc_buffer_preserving_position (FILE *fp)
40{ 43{
41 if (fp->_flags & _IO_IN_BACKUP) 44 if (fp_->_flags & _IO_IN_BACKUP)
42 /* _IO_free_backup_area is a bit complicated. Simply call fseek. */ 45 /* _IO_free_backup_area is a bit complicated. Simply call fseek. */
43 fseeko (fp, 0, SEEK_CUR); 46 fseeko (fp, 0, SEEK_CUR);
44} 47}
@@ -50,7 +53,7 @@ static void
50clear_ungetc_buffer (FILE *fp) 53clear_ungetc_buffer (FILE *fp)
51{ 54{
52# if defined __sferror || defined __DragonFly__ || defined __ANDROID__ 55# if defined __sferror || defined __DragonFly__ || defined __ANDROID__
53 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ 56 /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
54 if (HASUB (fp)) 57 if (HASUB (fp))
55 { 58 {
56 fp_->_p += fp_->_r; 59 fp_->_p += fp_->_r;
@@ -62,7 +65,7 @@ clear_ungetc_buffer (FILE *fp)
62 fp->_ungetc_count = 0; 65 fp->_ungetc_count = 0;
63 fp->_rcount = - fp->_rcount; 66 fp->_rcount = - fp->_rcount;
64 } 67 }
65# elif defined _IOERR /* Minix, AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */ 68# elif defined _IOERR /* Minix, AIX, HP-UX, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */
66 /* Nothing to do. */ 69 /* Nothing to do. */
67# else /* other implementations */ 70# else /* other implementations */
68 fseeko (fp, 0, SEEK_CUR); 71 fseeko (fp, 0, SEEK_CUR);
@@ -75,7 +78,7 @@ clear_ungetc_buffer (FILE *fp)
75/* GNU libc, BeOS, Haiku, Linux libc5 */ 78/* GNU libc, BeOS, Haiku, Linux libc5 */
76 79
77# if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT 80# if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
78/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ 81/* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
79 82
80static int 83static int
81disable_seek_optimization (FILE *fp) 84disable_seek_optimization (FILE *fp)
@@ -98,7 +101,7 @@ update_fpos_cache (_GL_ATTRIBUTE_MAYBE_UNUSED FILE *fp,
98 _GL_ATTRIBUTE_MAYBE_UNUSED off_t pos) 101 _GL_ATTRIBUTE_MAYBE_UNUSED off_t pos)
99{ 102{
100# if defined __sferror || defined __DragonFly__ || defined __ANDROID__ 103# if defined __sferror || defined __DragonFly__ || defined __ANDROID__
101 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ 104 /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
102# if defined __CYGWIN__ || defined __ANDROID__ 105# if defined __CYGWIN__ || defined __ANDROID__
103 /* fp_->_offset is typed as an integer. */ 106 /* fp_->_offset is typed as an integer. */
104 fp_->_offset = pos; 107 fp_->_offset = pos;
@@ -203,7 +206,7 @@ rpl_fflush (FILE *stream)
203 } 206 }
204 207
205# if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT 208# if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
206 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ 209 /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
207 210
208 { 211 {
209 /* Disable seek optimization for the next fseeko call. This tells the 212 /* Disable seek optimization for the next fseeko call. This tells the
diff --git a/gl/filename.h b/gl/filename.h
index 4f0f0fbc..e353363e 100644
--- a/gl/filename.h
+++ b/gl/filename.h
@@ -1,5 +1,5 @@
1/* Basic filename support macros. 1/* Basic filename support macros.
2 Copyright (C) 2001-2024 Free Software Foundation, Inc. 2 Copyright (C) 2001-2025 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 4
5 The GNU C Library is free software; you can redistribute it and/or 5 The GNU C Library is free software; you can redistribute it and/or
diff --git a/gl/float+.h b/gl/float+.h
index 104f477f..58eca376 100644
--- a/gl/float+.h
+++ b/gl/float+.h
@@ -1,5 +1,5 @@
1/* Supplemental information about the floating-point formats. 1/* Supplemental information about the floating-point formats.
2 Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2007. 3 Written by Bruno Haible <bruno@clisp.org>, 2007.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
diff --git a/gl/float.c b/gl/float.c
index a9ea40b0..2e95957a 100644
--- a/gl/float.c
+++ b/gl/float.c
@@ -1,5 +1,5 @@
1/* Auxiliary definitions for <float.h>. 1/* Auxiliary definitions for <float.h>.
2 Copyright (C) 2011-2024 Free Software Foundation, Inc. 2 Copyright (C) 2011-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2011. 3 Written by Bruno Haible <bruno@clisp.org>, 2011.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
@@ -20,14 +20,98 @@
20/* Specification. */ 20/* Specification. */
21#include <float.h> 21#include <float.h>
22 22
23#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__ 23#if GNULIB_defined_long_double_union
24const union gl_long_double_union gl_LDBL_MAX = 24# ifdef __i386__
25 { { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL } };
26#elif defined __i386__
27const union gl_long_double_union gl_LDBL_MAX = 25const union gl_long_double_union gl_LDBL_MAX =
28 { { 0xFFFFFFFF, 0xFFFFFFFF, 32766 } }; 26 { { 0xFFFFFFFF, 0xFFFFFFFF, 32766 } };
29#else 27# endif
28# if defined __i386__ && (defined __FreeBSD__ || defined __DragonFly__)
29/* We can't even simply evaluate the formula (LDBL_MIN / 9223372036854775808.0L)
30 at run time, because it would require BEGIN_LONG_DOUBLE_ROUNDING /
31 END_LONG_DOUBLE_ROUNDING invocations. It simpler to just write down the
32 representation of LDBL_TRUE_MIN, based on
33 <https://en.wikipedia.org/wiki/Extended_precision#x86_extended_precision_format>. */
34const union gl_long_double_union gl_LDBL_TRUE_MIN =
35 { { 0x00000001, 0x00000000, 0 } };
36# endif
37#endif
38
39#if GNULIB_defined_FLT_SNAN
40/* Define like memory_positive_SNaNf(), see signed-snan.h and snan.h,
41 or like setpayloadsigf() with an arbitrary payload. */
42gl_FLT_SNAN_t gl_FLT_SNAN =
43# if FLT_MANT_DIG == 24
44# if defined __hppa || (defined __mips__ && !MIPS_NAN2008_FLOAT) || defined __sh__
45 /* sign bit: 0, 8 exponent bits: all 1, next bit: 1, payload: 0b10...0 */
46 { { 0x7FE00000U } }
47# else
48 /* sign bit: 0, 8 exponent bits: all 1, next bit: 0, payload: 0b10...0 */
49 { { 0x7FA00000U } }
50# endif
51# endif
52 ;
53#endif
54
55#if GNULIB_defined_DBL_SNAN
56/* Define like memory_positive_SNaNd(), see signed-snan.h and snan.h,
57 or like setpayloadsig() with an arbitrary payload. */
58gl_DBL_SNAN_t gl_DBL_SNAN =
59# if DBL_MANT_DIG == 53
60# if defined __hppa || (defined __mips__ && !MIPS_NAN2008_FLOAT) || defined __sh__
61 /* sign bit: 0, 11 exponent bits: all 1, next bit: 1, payload: 0b10...0 */
62 { { 0x7FFC000000000000ULL } }
63# else
64 /* sign bit: 0, 11 exponent bits: all 1, next bit: 0, payload: 0b10...0 */
65 { { 0x7FF4000000000000ULL } }
66# endif
67# endif
68 ;
69#endif
70
71#if GNULIB_defined_LDBL_SNAN
72# ifdef WORDS_BIGENDIAN
73# define TWO(hi,lo) { hi, lo }
74# else
75# define TWO(hi,lo) { lo, hi }
76# endif
77/* Define like memory_positive_SNaNl(), see signed-snan.h and snan.h,
78 or like setpayloadsigl() with an arbitrary payload. */
79gl_LDBL_SNAN_t gl_LDBL_SNAN =
80# if LDBL_MANT_DIG == 53 /* on arm, hppa, mips, sh, but also MSVC */
81# if defined __hppa || (defined __mips__ && !MIPS_NAN2008_FLOAT) || defined __sh__
82 /* sign bit: 0, 11 exponent bits: all 1, next bit: 1, payload: 0b10...0 */
83 { { 0x7FFC000000000000ULL } }
84# else
85 /* sign bit: 0, 11 exponent bits: all 1, next bit: 0, payload: 0b10...0 */
86 { { 0x7FF4000000000000ULL } }
87# endif
88# elif LDBL_MANT_DIG == 64 /* on i386, x86_64, ia64, m68k */
89# if defined __m68k__
90 /* sign bit: 0, 15 exponent bits: all 1, 16 gap bits: all 0,
91 always=1 bit: 1, next bit: 0, payload: 0b10...0 */
92 { { 0x7FFF0000ULL, 0xA0000000ULL, 0x00000000ULL } }
93# else
94 /* sign bit: 0, 15 exponent bits: all 1, always=1 bit: 1, next bit: 0, payload: 0b10...0
95 (see <https://en.wikipedia.org/wiki/Extended_precision#x86_extended_precision_format>) */
96 { TWO (0x00007FFFULL, 0xA000000000000000ULL) }
97# endif
98# elif LDBL_MANT_DIG == 106 /* on powerpc, powerpc64, powerpc64le */
99 /* most-significant double:
100 sign bit: 0, 11 exponent bits: all 1, next bit: 0, payload: 0b10...0,
101 least-significant double: 0.0 */
102 { { 0x7FF4000000000000ULL, 0ULL } }
103# elif LDBL_MANT_DIG == 113 /* on alpha, arm64, loongarch64, mips64, riscv64, s390x, sparc64 */
104# if (defined __mips__ && !MIPS_NAN2008_FLOAT)
105 /* sign bit: 0, 15 exponent bits: all 1, next bit: 1, payload: 0b10...0 */
106 { TWO (0x7FFFC00000000000ULL, 0ULL) }
107# else
108 /* sign bit: 0, 15 exponent bits: all 1, next bit: 0, payload: 0b10...0 */
109 { TWO (0x7FFF400000000000ULL, 0ULL) }
110# endif
111# endif
112 ;
113#endif
114
30/* This declaration is solely to ensure that after preprocessing 115/* This declaration is solely to ensure that after preprocessing
31 this file is never empty. */ 116 this file is never empty. */
32typedef int dummy; 117typedef int dummy;
33#endif
diff --git a/gl/float.in.h b/gl/float.in.h
index 73e8d406..9f735cb9 100644
--- a/gl/float.in.h
+++ b/gl/float.in.h
@@ -1,6 +1,6 @@
1/* A correct <float.h>. 1/* A correct <float.h>.
2 2
3 Copyright (C) 2007-2024 Free Software Foundation, Inc. 3 Copyright (C) 2007-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -28,6 +28,8 @@
28#ifndef _@GUARD_PREFIX@_FLOAT_H 28#ifndef _@GUARD_PREFIX@_FLOAT_H
29#define _@GUARD_PREFIX@_FLOAT_H 29#define _@GUARD_PREFIX@_FLOAT_H
30 30
31/* ============================ ISO C99 support ============================ */
32
31/* 'long double' properties. */ 33/* 'long double' properties. */
32 34
33#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__) 35#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__)
@@ -113,71 +115,199 @@ extern const union gl_long_double_union gl_LDBL_MAX;
113 115
114/* On AIX 7.1 with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX are 116/* On AIX 7.1 with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX are
115 wrong. 117 wrong.
116 On Linux/PowerPC with gcc 4.4, the value of LDBL_MAX is wrong. */ 118 On Linux/PowerPC with gcc 8.3, the values of LDBL_MAX and LDBL_EPSILON are
117#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__ 119 wrong.
120 Assume these bugs are fixed in any GCC new enough
121 to define __LDBL_NORM_MAX__. */
122#if (defined _ARCH_PPC && LDBL_MANT_DIG == 106 \
123 && defined __GNUC__ && !defined __LDBL_NORM_MAX__)
118# undef LDBL_MIN_EXP 124# undef LDBL_MIN_EXP
119# define LDBL_MIN_EXP DBL_MIN_EXP 125# define LDBL_MIN_EXP (-968)
120# undef LDBL_MIN_10_EXP 126# undef LDBL_MIN_10_EXP
121# define LDBL_MIN_10_EXP DBL_MIN_10_EXP 127# define LDBL_MIN_10_EXP (-291)
122# undef LDBL_MIN 128# undef LDBL_MIN
123# define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */ 129# define LDBL_MIN 0x1p-969L
124#endif 130
125#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__ 131/* IBM long double is tricky: it is represented as the sum of two doubles,
132 and the high double must equal the sum of the two parts rounded to nearest.
133 The maximum finite value for which this is true is
134 { 0x1.fffffffffffffp+1023, 0x1.ffffffffffffep+969 },
135 which represents 0x1.fffffffffffff7ffffffffffff8p+1023L.
136 Although computations can yield representations of numbers larger than this,
137 these computations are considered to have overflowed and behavior is undefined.
138 See <https://gcc.gnu.org/PR120993>. */
126# undef LDBL_MAX 139# undef LDBL_MAX
127/* LDBL_MAX is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xFFFFFFFF }. 140# define LDBL_MAX 0x1.fffffffffffff7ffffffffffff8p+1023L
128 It is not easy to define:
129 #define LDBL_MAX 1.79769313486231580793728971405302307166e308L
130 is too small, whereas
131 #define LDBL_MAX 1.79769313486231580793728971405302307167e308L
132 is too large. Apparently a bug in GCC decimal-to-binary conversion.
133 Also, I can't get values larger than
134 #define LDBL63 ((long double) (1ULL << 63))
135 #define LDBL882 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63)
136 #define LDBL945 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63)
137 #define LDBL1008 (LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63 * LDBL63)
138 #define LDBL_MAX (LDBL1008 * 65535.0L + LDBL945 * (long double) 9223372036821221375ULL + LDBL882 * (long double) 4611686018427387904ULL)
139 which is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xF8000000 }.
140 So, define it like this through a reference to an external variable
141 141
142 const double LDBL_MAX[2] = { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL }; 142/* On PowerPC platforms, 'long double' has a double-double representation.
143 extern const long double LDBL_MAX; 143 Up to ISO C 17, this was outside the scope of ISO C because it can represent
144 numbers with mantissas of the form 1.<52 bits><many zeroes><52 bits>, such as
145 1.0L + 4.94065645841246544176568792868221e-324L = 1 + 2^-1074; see
146 ISO C 17 § 5.2.4.2.2.(3).
147 In ISO C 23, wording has been included that makes this 'long double'
148 representation compliant; see ISO C 23 § 5.2.5.3.3.(8)-(9). In this setting,
149 numbers with mantissas of the form 1.<52 bits><many zeroes><52 bits> are
150 called "unnormalized". And since LDBL_EPSILON must be normalized (per
151 ISO C 23 § 5.2.5.3.3.(33)), it must be 2^-105. */
152# undef LDBL_EPSILON
153# define LDBL_EPSILON 0x1p-105L
154#endif
144 155
145 or through a pointer cast 156/* ============================ ISO C11 support ============================ */
146 157
147 #define LDBL_MAX \ 158/* 'float' properties */
148 (*(const long double *) (double[]) { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL })
149 159
150 Unfortunately, this is not a constant expression, and the latter expression 160#ifndef FLT_HAS_SUBNORM
151 does not work well when GCC is optimizing.. */ 161# define FLT_HAS_SUBNORM 1
152# if !GNULIB_defined_long_double_union 162#endif
153union gl_long_double_union 163#ifndef FLT_DECIMAL_DIG
154 { 164/* FLT_MANT_DIG = 24 => FLT_DECIMAL_DIG = 9 */
155 struct { double hi; double lo; } dd; 165# define FLT_DECIMAL_DIG ((int)(FLT_MANT_DIG * 0.3010299956639812 + 2))
156 long double ld; 166#endif
157 }; 167#if defined _AIX && !defined __GNUC__
158# define GNULIB_defined_long_double_union 1 168/* On AIX, the value of FLT_TRUE_MIN in /usr/include/float.h is a 'double',
169 not a 'float'. */
170# undef FLT_TRUE_MIN
171#endif
172#ifndef FLT_TRUE_MIN
173/* FLT_MIN / 2^(FLT_MANT_DIG-1) */
174# define FLT_TRUE_MIN (FLT_MIN / 8388608.0f)
175#endif
176
177/* 'double' properties */
178
179#ifndef DBL_HAS_SUBNORM
180# define DBL_HAS_SUBNORM 1
181#endif
182#ifndef DBL_DECIMAL_DIG
183/* DBL_MANT_DIG = 53 => DBL_DECIMAL_DIG = 17 */
184# define DBL_DECIMAL_DIG ((int)(DBL_MANT_DIG * 0.3010299956639812 + 2))
185#endif
186#ifndef DBL_TRUE_MIN
187/* DBL_MIN / 2^(DBL_MANT_DIG-1) */
188# define DBL_TRUE_MIN (DBL_MIN / 4503599627370496.0)
189#endif
190
191/* 'long double' properties */
192
193#ifndef LDBL_HAS_SUBNORM
194# define LDBL_HAS_SUBNORM 1
195#endif
196#ifndef LDBL_DECIMAL_DIG
197/* LDBL_MANT_DIG = 53 => LDBL_DECIMAL_DIG = 17 */
198/* LDBL_MANT_DIG = 64 => LDBL_DECIMAL_DIG = 21 */
199/* LDBL_MANT_DIG = 106 => LDBL_DECIMAL_DIG = 33 */
200/* LDBL_MANT_DIG = 113 => LDBL_DECIMAL_DIG = 36 */
201# define LDBL_DECIMAL_DIG ((int)(LDBL_MANT_DIG * 0.3010299956639812 + 2))
202#endif
203#ifndef LDBL_TRUE_MIN
204/* LDBL_MIN / 2^(LDBL_MANT_DIG-1) */
205# if LDBL_MANT_DIG == 53
206# define LDBL_TRUE_MIN (LDBL_MIN / 4503599627370496.0L)
207# elif LDBL_MANT_DIG == 64
208# if defined __i386__ && (defined __FreeBSD__ || defined __DragonFly__)
209/* Work around FreeBSD/x86 problem mentioned above. */
210extern const union gl_long_double_union gl_LDBL_TRUE_MIN;
211# define LDBL_TRUE_MIN (gl_LDBL_TRUE_MIN.ld)
212# else
213# define LDBL_TRUE_MIN (LDBL_MIN / 9223372036854775808.0L)
214# endif
215# elif LDBL_MANT_DIG == 106
216# define LDBL_TRUE_MIN (LDBL_MIN / 40564819207303340847894502572032.0L)
217# elif LDBL_MANT_DIG == 113
218# define LDBL_TRUE_MIN (LDBL_MIN / 5192296858534827628530496329220096.0L)
159# endif 219# endif
160extern const union gl_long_double_union gl_LDBL_MAX;
161# define LDBL_MAX (gl_LDBL_MAX.ld)
162#endif 220#endif
163 221
164/* On IRIX 6.5, with cc, the value of LDBL_MANT_DIG is wrong. 222/* ============================ ISO C23 support ============================ */
165 On IRIX 6.5, with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_EPSILON 223
166 are wrong. */ 224/* 'float' properties */
167#if defined __sgi && (LDBL_MANT_DIG >= 106) 225
168# undef LDBL_MANT_DIG 226#ifndef FLT_IS_IEC_60559
169# define LDBL_MANT_DIG 106 227# if defined __m68k__
170# if defined __GNUC__ 228# define FLT_IS_IEC_60559 0
171# undef LDBL_MIN_EXP 229# else
172# define LDBL_MIN_EXP DBL_MIN_EXP 230# define FLT_IS_IEC_60559 1
173# undef LDBL_MIN_10_EXP 231# endif
174# define LDBL_MIN_10_EXP DBL_MIN_10_EXP 232#endif
175# undef LDBL_MIN 233#ifndef FLT_NORM_MAX
176# define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */ 234# define FLT_NORM_MAX FLT_MAX
177# undef LDBL_EPSILON 235#endif
178# define LDBL_EPSILON 2.46519032881566189191165176650870696773e-32L /* 2^-105 */ 236#ifndef FLT_SNAN
237/* For sh, beware of <https://gcc.gnu.org/PR111814>. */
238# if ((__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__) && !defined __sh__
239# define FLT_SNAN __builtin_nansf ("")
240# else
241typedef union { unsigned int word[1]; float value; } gl_FLT_SNAN_t;
242extern gl_FLT_SNAN_t gl_FLT_SNAN;
243# define FLT_SNAN (gl_FLT_SNAN.value)
244# define GNULIB_defined_FLT_SNAN 1
245# endif
246#endif
247
248/* 'double' properties */
249
250#ifndef DBL_IS_IEC_60559
251# if defined __m68k__
252# define DBL_IS_IEC_60559 0
253# else
254# define DBL_IS_IEC_60559 1
179# endif 255# endif
180#endif 256#endif
257#ifndef DBL_NORM_MAX
258# define DBL_NORM_MAX DBL_MAX
259#endif
260#ifndef DBL_SNAN
261/* For sh, beware of <https://gcc.gnu.org/PR111814>. */
262# if ((__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__) && !defined __sh__
263# define DBL_SNAN __builtin_nans ("")
264# else
265typedef union { unsigned long long word[1]; double value; } gl_DBL_SNAN_t;
266extern gl_DBL_SNAN_t gl_DBL_SNAN;
267# define DBL_SNAN (gl_DBL_SNAN.value)
268# define GNULIB_defined_DBL_SNAN 1
269# endif
270#endif
271
272/* 'long double' properties */
273
274#ifndef LDBL_IS_IEC_60559
275# if defined __m68k__
276# define LDBL_IS_IEC_60559 0
277# elif LDBL_MANT_DIG == 53 || LDBL_MANT_DIG == 113
278# define LDBL_IS_IEC_60559 1
279# else
280# define LDBL_IS_IEC_60559 0
281# endif
282#endif
283#ifndef LDBL_NORM_MAX
284# ifdef __LDBL_NORM_MAX__
285# define LDBL_NORM_MAX __LDBL_NORM_MAX__
286# elif FLT_RADIX == 2 && LDBL_MAX_EXP == 1024 && LDBL_MANT_DIG == 106
287# define LDBL_NORM_MAX 0x1.ffffffffffffffffffffffffff8p+1022L
288# else
289# define LDBL_NORM_MAX LDBL_MAX
290# endif
291#endif
292#ifndef LDBL_SNAN
293/* For sh, beware of <https://gcc.gnu.org/PR111814>. */
294# if ((__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__) && !defined __sh__
295# define LDBL_SNAN __builtin_nansl ("")
296# else
297# if LDBL_MANT_DIG == 53
298typedef union { unsigned long long word[1]; long double value; } gl_LDBL_SNAN_t;
299# elif defined __m68k__
300typedef union { unsigned int word[3]; long double value; } gl_LDBL_SNAN_t;
301# else
302typedef union { unsigned long long word[2]; long double value; } gl_LDBL_SNAN_t;
303# endif
304extern gl_LDBL_SNAN_t gl_LDBL_SNAN;
305# define LDBL_SNAN (gl_LDBL_SNAN.value)
306# define GNULIB_defined_LDBL_SNAN 1
307# endif
308#endif
309
310/* ================================= Other ================================= */
181 311
182#if @REPLACE_ITOLD@ 312#if @REPLACE_ITOLD@
183/* Pull in a function that fixes the 'int' to 'long double' conversion 313/* Pull in a function that fixes the 'int' to 'long double' conversion
diff --git a/gl/floor.c b/gl/floor.c
index 392f2044..9cecb7bb 100644
--- a/gl/floor.c
+++ b/gl/floor.c
@@ -1,5 +1,5 @@
1/* Round towards negative infinity. 1/* Round towards negative infinity.
2 Copyright (C) 2007, 2010-2024 Free Software Foundation, Inc. 2 Copyright (C) 2007, 2010-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/floorf.c b/gl/floorf.c
index f9785d0c..34a507b9 100644
--- a/gl/floorf.c
+++ b/gl/floorf.c
@@ -1,5 +1,5 @@
1/* Round towards negative infinity. 1/* Round towards negative infinity.
2 Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/fopen.c b/gl/fopen.c
index d3b57a98..93710ad0 100644
--- a/gl/fopen.c
+++ b/gl/fopen.c
@@ -1,5 +1,5 @@
1/* Open a stream to a file. 1/* Open a stream to a file.
2 Copyright (C) 2007-2024 Free Software Foundation, Inc. 2 Copyright (C) 2007-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -19,12 +19,12 @@
19/* If the user's config.h happens to include <stdio.h>, let it include only 19/* If the user's config.h happens to include <stdio.h>, let it include only
20 the system's <stdio.h> here, so that orig_fopen doesn't recurse to 20 the system's <stdio.h> here, so that orig_fopen doesn't recurse to
21 rpl_fopen. */ 21 rpl_fopen. */
22#define _GL_ALREADY_INCLUDING_STDIO_H 22#define _GL_SKIP_GNULIB_STDIO_H
23#include <config.h> 23#include <config.h>
24 24
25/* Get the original definition of fopen. It might be defined as a macro. */ 25/* Get the original definition of fopen. It might be defined as a macro. */
26#include <stdio.h> 26#include <stdio.h>
27#undef _GL_ALREADY_INCLUDING_STDIO_H 27#undef _GL_SKIP_GNULIB_STDIO_H
28 28
29static FILE * 29static FILE *
30orig_fopen (const char *filename, const char *mode) 30orig_fopen (const char *filename, const char *mode)
@@ -33,13 +33,7 @@ orig_fopen (const char *filename, const char *mode)
33} 33}
34 34
35/* Specification. */ 35/* Specification. */
36#ifdef __osf__ 36#include <stdio.h>
37/* Write "stdio.h" here, not <stdio.h>, otherwise OSF/1 5.1 DTK cc eliminates
38 this include because of the preliminary #include <stdio.h> above. */
39# include "stdio.h"
40#else
41# include <stdio.h>
42#endif
43 37
44#include <errno.h> 38#include <errno.h>
45#include <fcntl.h> 39#include <fcntl.h>
@@ -51,24 +45,18 @@ orig_fopen (const char *filename, const char *mode)
51FILE * 45FILE *
52rpl_fopen (const char *filename, const char *mode) 46rpl_fopen (const char *filename, const char *mode)
53{ 47{
54 int open_direction;
55 int open_flags;
56#if GNULIB_FOPEN_GNU
57 bool open_flags_gnu;
58# define BUF_SIZE 80
59 char fdopen_mode_buf[BUF_SIZE + 1];
60#endif
61
62#if defined _WIN32 && ! defined __CYGWIN__ 48#if defined _WIN32 && ! defined __CYGWIN__
63 if (strcmp (filename, "/dev/null") == 0) 49 if (streq (filename, "/dev/null"))
64 filename = "NUL"; 50 filename = "NUL";
65#endif 51#endif
66 52
67 /* Parse the mode. */ 53 /* Parse the mode. */
68 open_direction = 0; 54 int open_direction = 0;
69 open_flags = 0; 55 int open_flags = 0;
70#if GNULIB_FOPEN_GNU 56#if GNULIB_FOPEN_GNU
71 open_flags_gnu = false; 57 bool open_flags_gnu = false;
58# define BUF_SIZE 80
59 char fdopen_mode_buf[BUF_SIZE + 1];
72#endif 60#endif
73 { 61 {
74 const char *p = mode; 62 const char *p = mode;
@@ -169,21 +157,18 @@ rpl_fopen (const char *filename, const char *mode)
169 size_t len = strlen (filename); 157 size_t len = strlen (filename);
170 if (len > 0 && filename[len - 1] == '/') 158 if (len > 0 && filename[len - 1] == '/')
171 { 159 {
172 int fd;
173 struct stat statbuf;
174 FILE *fp;
175
176 if (open_direction != O_RDONLY) 160 if (open_direction != O_RDONLY)
177 { 161 {
178 errno = EISDIR; 162 errno = EISDIR;
179 return NULL; 163 return NULL;
180 } 164 }
181 165
182 fd = open (filename, open_direction | open_flags, 166 int fd = open (filename, open_direction | open_flags,
183 S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); 167 S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
184 if (fd < 0) 168 if (fd < 0)
185 return NULL; 169 return NULL;
186 170
171 struct stat statbuf;
187 if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode)) 172 if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode))
188 { 173 {
189 close (fd); 174 close (fd);
@@ -191,6 +176,7 @@ rpl_fopen (const char *filename, const char *mode)
191 return NULL; 176 return NULL;
192 } 177 }
193 178
179 FILE *fp;
194# if GNULIB_FOPEN_GNU 180# if GNULIB_FOPEN_GNU
195 fp = fdopen (fd, fdopen_mode_buf); 181 fp = fdopen (fd, fdopen_mode_buf);
196# else 182# else
@@ -210,15 +196,12 @@ rpl_fopen (const char *filename, const char *mode)
210#if GNULIB_FOPEN_GNU 196#if GNULIB_FOPEN_GNU
211 if (open_flags_gnu) 197 if (open_flags_gnu)
212 { 198 {
213 int fd; 199 int fd = open (filename, open_direction | open_flags,
214 FILE *fp; 200 S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
215
216 fd = open (filename, open_direction | open_flags,
217 S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
218 if (fd < 0) 201 if (fd < 0)
219 return NULL; 202 return NULL;
220 203
221 fp = fdopen (fd, fdopen_mode_buf); 204 FILE *fp = fdopen (fd, fdopen_mode_buf);
222 if (fp == NULL) 205 if (fp == NULL)
223 { 206 {
224 int saved_errno = errno; 207 int saved_errno = errno;
diff --git a/gl/fpurge.c b/gl/fpurge.c
index 52a3dcef..6799b52b 100644
--- a/gl/fpurge.c
+++ b/gl/fpurge.c
@@ -1,5 +1,5 @@
1/* Flushing buffers of a FILE stream. 1/* Flushing buffers of a FILE stream.
2 Copyright (C) 2007-2024 Free Software Foundation, Inc. 2 Copyright (C) 2007-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -37,7 +37,7 @@ fpurge (FILE *fp)
37 /* The __fpurge function does not have a return value. */ 37 /* The __fpurge function does not have a return value. */
38 return 0; 38 return 0;
39 39
40#elif HAVE_FPURGE /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin >= 1.7 */ 40#elif HAVE_FPURGE /* FreeBSD, NetBSD, 2.0 <= OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin >= 1.7 */
41 41
42 /* Call the system's fpurge function. */ 42 /* Call the system's fpurge function. */
43# undef fpurge 43# undef fpurge
@@ -46,7 +46,7 @@ fpurge (FILE *fp)
46# endif 46# endif
47 int result = fpurge (fp); 47 int result = fpurge (fp);
48# if defined __sferror || defined __DragonFly__ || defined __ANDROID__ 48# if defined __sferror || defined __DragonFly__ || defined __ANDROID__
49 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ 49 /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
50 if (result == 0) 50 if (result == 0)
51 /* Correct the invariants that fpurge broke. 51 /* Correct the invariants that fpurge broke.
52 <stdio.h> on BSD systems says: 52 <stdio.h> on BSD systems says:
@@ -76,7 +76,7 @@ fpurge (FILE *fp)
76 } 76 }
77 return 0; 77 return 0;
78# elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ 78# elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
79 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ 79 /* FreeBSD, NetBSD, OpenBSD < 2.0, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
80 fp_->_p = fp_->_bf._base; 80 fp_->_p = fp_->_bf._base;
81 fp_->_r = 0; 81 fp_->_r = 0;
82 fp_->_w = ((fp_->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully buffered and not currently reading? */ 82 fp_->_w = ((fp_->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully buffered and not currently reading? */
@@ -101,7 +101,7 @@ fpurge (FILE *fp)
101 if (fp->_ptr != NULL) 101 if (fp->_ptr != NULL)
102 fp->_count = 0; 102 fp->_count = 0;
103 return 0; 103 return 0;
104# elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */ 104# elif defined _IOERR /* AIX, HP-UX, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */
105 fp_->_ptr = fp_->_base; 105 fp_->_ptr = fp_->_base;
106 if (fp_->_ptr != NULL) 106 if (fp_->_ptr != NULL)
107 fp_->_cnt = 0; 107 fp_->_cnt = 0;
diff --git a/gl/freading.c b/gl/freading.c
index c80d9aa8..8e06282e 100644
--- a/gl/freading.c
+++ b/gl/freading.c
@@ -1,5 +1,5 @@
1/* Retrieve information about a FILE stream. 1/* Retrieve information about a FILE stream.
2 Copyright (C) 2007-2024 Free Software Foundation, Inc. 2 Copyright (C) 2007-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -22,9 +22,13 @@
22#include "stdio-impl.h" 22#include "stdio-impl.h"
23 23
24/* Don't use glibc's __freading function in glibc < 2.7, see 24/* Don't use glibc's __freading function in glibc < 2.7, see
25 <https://sourceware.org/bugzilla/show_bug.cgi?id=4359> */ 25 <https://sourceware.org/PR4359> */
26#if !(HAVE___FREADING && (!defined __GLIBC__ || defined __UCLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7))) 26#if !(HAVE___FREADING && (!defined __GLIBC__ || defined __UCLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)))
27 27
28/* This code is not compiled on systems that have a working __freading function,
29 namely glibc >= 2.7, OpenBSD >= 7.6, Solaris >= 7, UnixWare >= 7.1.4.MP4,
30 Cygwin >= 1.7.34, Android API >= 28, musl libc, Haiku >= hrev58760. */
31
28bool 32bool
29freading (FILE *fp) 33freading (FILE *fp)
30{ 34{
@@ -37,13 +41,13 @@ freading (FILE *fp)
37 || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0 41 || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
38 && fp->_IO_read_base != NULL)); 42 && fp->_IO_read_base != NULL));
39# elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ 43# elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
40 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin < 1.7.34, Minix 3, Android */ 44 /* FreeBSD, NetBSD, OpenBSD < 7.6, DragonFly, Mac OS X, Cygwin < 1.7.34, Minix 3, Android */
41 return (fp_->_flags & __SRD) != 0; 45 return (fp_->_flags & __SRD) != 0;
42# elif defined __EMX__ /* emx+gcc */ 46# elif defined __EMX__ /* emx+gcc */
43 return (fp->_flags & _IOREAD) != 0; 47 return (fp->_flags & _IOREAD) != 0;
44# elif defined __minix /* Minix */ 48# elif defined __minix /* Minix */
45 return (fp->_flags & _IOREADING) != 0; 49 return (fp->_flags & _IOREADING) != 0;
46# elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */ 50# elif defined _IOERR /* AIX, HP-UX, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */
47# if defined __sun /* Solaris */ 51# if defined __sun /* Solaris */
48 return (fp_->_flag & _IOREAD) != 0 && (fp_->_flag & _IOWRT) == 0; 52 return (fp_->_flag & _IOREAD) != 0 && (fp_->_flag & _IOWRT) == 0;
49# else 53# else
diff --git a/gl/freading.h b/gl/freading.h
index 943354f5..3d75d75e 100644
--- a/gl/freading.h
+++ b/gl/freading.h
@@ -1,5 +1,5 @@
1/* Retrieve information about a FILE stream. 1/* Retrieve information about a FILE stream.
2 Copyright (C) 2007-2024 Free Software Foundation, Inc. 2 Copyright (C) 2007-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/free.c b/gl/free.c
index 2f0c40ba..e6e7cf0f 100644
--- a/gl/free.c
+++ b/gl/free.c
@@ -1,6 +1,6 @@
1/* Make free() preserve errno. 1/* Make free() preserve errno.
2 2
3 Copyright (C) 2003, 2006, 2009-2024 Free Software Foundation, Inc. 3 Copyright (C) 2003, 2006, 2009-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -33,7 +33,7 @@ rpl_free (void *p)
33{ 33{
34# if defined __GNUC__ && !defined __clang__ 34# if defined __GNUC__ && !defined __clang__
35 /* An invalid GCC optimization 35 /* An invalid GCC optimization
36 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98396> 36 <https://gcc.gnu.org/PR98396>
37 would optimize away the assignments in the code below, when link-time 37 would optimize away the assignments in the code below, when link-time
38 optimization (LTO) is enabled. Make the code more complicated, so that 38 optimization (LTO) is enabled. Make the code more complicated, so that
39 GCC does not grok how to optimize it. */ 39 GCC does not grok how to optimize it. */
@@ -44,9 +44,9 @@ rpl_free (void *p)
44 free (p); 44 free (p);
45 errno = err[errno == 0]; 45 errno = err[errno == 0];
46# else 46# else
47 int err = errno; 47 int saved_errno = errno;
48 free (p); 48 free (p);
49 errno = err; 49 errno = saved_errno;
50# endif 50# endif
51} 51}
52 52
diff --git a/gl/fseek.c b/gl/fseek.c
index cebc1749..bf1f303f 100644
--- a/gl/fseek.c
+++ b/gl/fseek.c
@@ -1,5 +1,5 @@
1/* An fseek() function that, together with fflush(), is POSIX compliant. 1/* An fseek() function that, together with fflush(), is POSIX compliant.
2 Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/fseeko.c b/gl/fseeko.c
index 2c3b053a..f6cd7cba 100644
--- a/gl/fseeko.c
+++ b/gl/fseeko.c
@@ -1,5 +1,5 @@
1/* An fseeko() function that, together with fflush(), is POSIX compliant. 1/* An fseeko() function that, together with fflush(), is POSIX compliant.
2 Copyright (C) 2007-2024 Free Software Foundation, Inc. 2 Copyright (C) 2007-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -48,12 +48,15 @@ fseeko (FILE *fp, off_t offset, int whence)
48 48
49 /* These tests are based on fpurge.c. */ 49 /* These tests are based on fpurge.c. */
50#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 50#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
51# if !defined __HAIKU__
52# define fp_ fp
53# endif
51 /* GNU libc, BeOS, Haiku, Linux libc5 */ 54 /* GNU libc, BeOS, Haiku, Linux libc5 */
52 if (fp->_IO_read_end == fp->_IO_read_ptr 55 if (fp_->_IO_read_end == fp_->_IO_read_ptr
53 && fp->_IO_write_ptr == fp->_IO_write_base 56 && fp_->_IO_write_ptr == fp_->_IO_write_base
54 && fp->_IO_save_base == NULL) 57 && fp_->_IO_save_base == NULL)
55#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ 58#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
56 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ 59 /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
57# if defined __SL64 && defined __SCLE /* Cygwin */ 60# if defined __SL64 && defined __SCLE /* Cygwin */
58 if ((fp->_flags & __SL64) == 0) 61 if ((fp->_flags & __SL64) == 0)
59 { 62 {
@@ -81,7 +84,7 @@ fseeko (FILE *fp, off_t offset, int whence)
81#elif defined __minix /* Minix */ 84#elif defined __minix /* Minix */
82 if (fp_->_ptr == fp_->_buf 85 if (fp_->_ptr == fp_->_buf
83 && (fp_->_ptr == NULL || fp_->_count == 0)) 86 && (fp_->_ptr == NULL || fp_->_count == 0))
84#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */ 87#elif defined _IOERR /* AIX, HP-UX, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */
85 if (fp_->_ptr == fp_->_base 88 if (fp_->_ptr == fp_->_base
86 && (fp_->_ptr == NULL || fp_->_cnt == 0)) 89 && (fp_->_ptr == NULL || fp_->_cnt == 0))
87#elif defined __UCLIBC__ /* uClibc */ 90#elif defined __UCLIBC__ /* uClibc */
@@ -101,6 +104,9 @@ fseeko (FILE *fp, off_t offset, int whence)
101#elif defined EPLAN9 /* Plan9 */ 104#elif defined EPLAN9 /* Plan9 */
102 if (fp->rp == fp->buf 105 if (fp->rp == fp->buf
103 && fp->wp == fp->buf) 106 && fp->wp == fp->buf)
107#elif defined __OpenBSD__ && !defined __sferror /* OpenBSD >= 7.8 */
108 /* fseeko and fflush work as advertised. */
109 if (0)
104#elif FUNC_FFLUSH_STDIN < 0 && 200809 <= _POSIX_VERSION 110#elif FUNC_FFLUSH_STDIN < 0 && 200809 <= _POSIX_VERSION
105 /* Cross-compiling to some other system advertising conformance to 111 /* Cross-compiling to some other system advertising conformance to
106 POSIX.1-2008 or later. Assume fseeko and fflush work as advertised. 112 POSIX.1-2008 or later. Assume fseeko and fflush work as advertised.
@@ -118,7 +124,7 @@ fseeko (FILE *fp, off_t offset, int whence)
118 if (pos == -1) 124 if (pos == -1)
119 { 125 {
120#if defined __sferror || defined __DragonFly__ || defined __ANDROID__ 126#if defined __sferror || defined __DragonFly__ || defined __ANDROID__
121 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ 127 /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
122 fp_->_flags &= ~__SOFF; 128 fp_->_flags &= ~__SOFF;
123#endif 129#endif
124 return -1; 130 return -1;
@@ -126,10 +132,10 @@ fseeko (FILE *fp, off_t offset, int whence)
126 132
127#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 133#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
128 /* GNU libc, BeOS, Haiku, Linux libc5 */ 134 /* GNU libc, BeOS, Haiku, Linux libc5 */
129 fp->_flags &= ~_IO_EOF_SEEN; 135 fp_->_flags &= ~_IO_EOF_SEEN;
130 fp->_offset = pos; 136 fp_->_offset = pos;
131#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ 137#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
132 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ 138 /* FreeBSD, NetBSD, OpenBSD <= 7.7, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
133# if defined __CYGWIN__ || (defined __NetBSD__ && __NetBSD_Version__ >= 600000000) || defined __minix 139# if defined __CYGWIN__ || (defined __NetBSD__ && __NetBSD_Version__ >= 600000000) || defined __minix
134 /* fp_->_offset is typed as an integer. */ 140 /* fp_->_offset is typed as an integer. */
135 fp_->_offset = pos; 141 fp_->_offset = pos;
@@ -152,7 +158,7 @@ fseeko (FILE *fp, off_t offset, int whence)
152 fp_->_flags &= ~__SEOF; 158 fp_->_flags &= ~__SEOF;
153#elif defined __EMX__ /* emx+gcc */ 159#elif defined __EMX__ /* emx+gcc */
154 fp->_flags &= ~_IOEOF; 160 fp->_flags &= ~_IOEOF;
155#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */ 161#elif defined _IOERR /* AIX, HP-UX, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */
156 fp_->_flag &= ~_IOEOF; 162 fp_->_flag &= ~_IOEOF;
157#elif defined __MINT__ /* Atari FreeMiNT */ 163#elif defined __MINT__ /* Atari FreeMiNT */
158 fp->__offset = pos; 164 fp->__offset = pos;
diff --git a/gl/fseterr.c b/gl/fseterr.c
new file mode 100644
index 00000000..0ab61765
--- /dev/null
+++ b/gl/fseterr.c
@@ -0,0 +1,80 @@
1/* Set the error indicator of a stream.
2 Copyright (C) 2007-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#include <config.h>
18
19/* Specification. */
20#include "fseterr.h"
21
22#include <errno.h>
23
24#include "stdio-impl.h"
25
26/* This file is not used on systems that have the __fseterr function,
27 namely OpenBSD >= 7.6, musl libc, Haiku >= hrev58760. */
28
29void
30fseterr (FILE *fp)
31{
32 /* Most systems provide FILE as a struct and the necessary bitmask in
33 <stdio.h>, because they need it for implementing getc() and putc() as
34 fast macros. */
35#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
36 /* GNU libc, BeOS, Haiku, Linux libc5 */
37 fp->_flags |= _IO_ERR_SEEN;
38#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
39 /* FreeBSD, NetBSD, OpenBSD < 7.6, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
40 fp_->_flags |= __SERR;
41#elif defined __EMX__ /* emx+gcc */
42 fp->_flags |= _IOERR;
43#elif defined __minix /* Minix */
44 fp->_flags |= _IOERR;
45#elif defined _IOERR /* AIX, HP-UX, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */
46 fp_->_flag |= _IOERR;
47#elif defined __UCLIBC__ /* uClibc */
48 fp->__modeflags |= __FLAG_ERROR;
49#elif defined __QNX__ /* QNX */
50 fp->_Mode |= 0x200 /* _MERR */;
51#elif defined __MINT__ /* Atari FreeMiNT */
52 fp->__error = 1;
53#elif defined EPLAN9 /* Plan9 */
54 if (fp->state != 0 /* CLOSED */)
55 fp->state = 5 /* ERR */;
56#elif 0 /* unknown */
57 /* Portable fallback, based on an idea by Rich Felker.
58 Wow! 6 system calls for something that is just a bit operation!
59 Not activated on any system, because there is no way to repair FP when
60 the sequence of system calls fails, and library code should not call
61 abort(). */
62 int saved_errno = errno;
63 fflush (fp);
64 int fd = fileno (fp);
65 int fd2 = dup (fd);
66 if (fd2 >= 0)
67 {
68 close (fd);
69 fputc ('\0', fp); /* This should set the error indicator. */
70 fflush (fp); /* Or this. */
71 if (dup2 (fd2, fd) < 0)
72 /* Whee... we botched the stream and now cannot restore it! */
73 abort ();
74 close (fd2);
75 }
76 errno = saved_errno;
77#else
78 #error "Please port gnulib fseterr.c to your platform! Look at the definitions of ferror and clearerr on your system, then report this to bug-gnulib."
79#endif
80}
diff --git a/gl/fseterr.h b/gl/fseterr.h
new file mode 100644
index 00000000..ac2b793e
--- /dev/null
+++ b/gl/fseterr.h
@@ -0,0 +1,55 @@
1/* Set the error indicator of a stream.
2 Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#ifndef _FSETERR_H
18#define _FSETERR_H
19
20/* This file uses HAVE___FSETERR. */
21#if !_GL_CONFIG_H_INCLUDED
22 #error "Please include config.h first."
23#endif
24
25#include <stdio.h>
26
27/* Set the error indicator of the stream FP.
28 The "error indicator" is set when an I/O operation on the stream fails, and
29 is cleared (together with the "end-of-file" indicator) by clearerr (FP). */
30
31#if HAVE___FSETERR /* musl libc */
32
33/* Haiku has __fseterr but does not declare it. */
34# if defined __HAIKU__
35extern void __fseterr (FILE *fp);
36# endif
37
38# include <stdio_ext.h>
39# define fseterr(fp) __fseterr (fp)
40
41#else
42
43# ifdef __cplusplus
44extern "C" {
45# endif
46
47extern void fseterr (FILE *fp);
48
49# ifdef __cplusplus
50}
51# endif
52
53#endif
54
55#endif /* _FSETERR_H */
diff --git a/gl/fstat.c b/gl/fstat.c
index 205d5aab..292ce75f 100644
--- a/gl/fstat.c
+++ b/gl/fstat.c
@@ -1,5 +1,5 @@
1/* fstat() replacement. 1/* fstat() replacement.
2 Copyright (C) 2011-2024 Free Software Foundation, Inc. 2 Copyright (C) 2011-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -40,14 +40,7 @@ orig_fstat (int fd, struct stat *buf)
40#endif 40#endif
41 41
42/* Specification. */ 42/* Specification. */
43#ifdef __osf__ 43#include <sys/stat.h>
44/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
45 eliminates this include because of the preliminary #include <sys/stat.h>
46 above. */
47# include "sys/stat.h"
48#else
49# include <sys/stat.h>
50#endif
51 44
52#include "stat-time.h" 45#include "stat-time.h"
53 46
diff --git a/gl/fsusage.c b/gl/fsusage.c
index 97d0eef7..1700a19c 100644
--- a/gl/fsusage.c
+++ b/gl/fsusage.c
@@ -1,6 +1,6 @@
1/* fsusage.c -- return space usage of mounted file systems 1/* fsusage.c -- return space usage of mounted file systems
2 2
3 Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2024 Free Software 3 Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2026 Free Software
4 Foundation, Inc. 4 Foundation, Inc.
5 5
6 This file is free software: you can redistribute it and/or modify 6 This file is free software: you can redistribute it and/or modify
@@ -91,10 +91,12 @@ static int
91statvfs_works (void) 91statvfs_works (void)
92{ 92{
93 static int statvfs_works_cache = -1; 93 static int statvfs_works_cache = -1;
94 struct utsname name;
95 if (statvfs_works_cache < 0) 94 if (statvfs_works_cache < 0)
96 statvfs_works_cache = (uname (&name) == 0 95 {
97 && 0 <= strverscmp (name.release, "2.6.36")); 96 struct utsname name;
97 statvfs_works_cache = (uname (&name) == 0
98 && 0 <= strverscmp (name.release, "2.6.36"));
99 }
98 return statvfs_works_cache; 100 return statvfs_works_cache;
99} 101}
100# endif 102# endif
@@ -148,15 +150,6 @@ get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp)
148 ? PROPAGATE_ALL_ONES (fsd.f_frsize) 150 ? PROPAGATE_ALL_ONES (fsd.f_frsize)
149 : PROPAGATE_ALL_ONES (fsd.f_bsize)); 151 : PROPAGATE_ALL_ONES (fsd.f_bsize));
150 152
151#elif defined STAT_STATFS3_OSF1 /* OSF/1 */
152
153 struct statfs fsd;
154
155 if (statfs (file, &fsd, sizeof (struct statfs)) != 0)
156 return -1;
157
158 fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize);
159
160#elif defined STAT_STATFS2_FRSIZE /* 2.6 < glibc/Linux < 2.6.36 */ 153#elif defined STAT_STATFS2_FRSIZE /* 2.6 < glibc/Linux < 2.6.36 */
161 154
162 struct statfs fsd; 155 struct statfs fsd;
@@ -201,7 +194,7 @@ get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp)
201 194
202 fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize); 195 fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize);
203 196
204#elif defined STAT_STATFS4 /* SVR3, old Irix */ 197#elif defined STAT_STATFS4 /* SVR3 */
205 198
206 struct statfs fsd; 199 struct statfs fsd;
207 200
diff --git a/gl/fsusage.h b/gl/fsusage.h
index da878590..bfa1857e 100644
--- a/gl/fsusage.h
+++ b/gl/fsusage.h
@@ -1,6 +1,6 @@
1/* fsusage.h -- declarations for file system space usage info 1/* fsusage.h -- declarations for file system space usage info
2 2
3 Copyright (C) 1991-1992, 1997, 2003-2006, 2009-2024 Free Software 3 Copyright (C) 1991-1992, 1997, 2003-2006, 2009-2026 Free Software
4 Foundation, Inc. 4 Foundation, Inc.
5 5
6 This file is free software: you can redistribute it and/or modify 6 This file is free software: you can redistribute it and/or modify
diff --git a/gl/ftell.c b/gl/ftell.c
index 21cab439..f2a64e73 100644
--- a/gl/ftell.c
+++ b/gl/ftell.c
@@ -1,5 +1,5 @@
1/* An ftell() function that works around platform bugs. 1/* An ftell() function that works around platform bugs.
2 Copyright (C) 2007-2024 Free Software Foundation, Inc. 2 Copyright (C) 2007-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/ftello.c b/gl/ftello.c
index 64119aab..e4f96d1a 100644
--- a/gl/ftello.c
+++ b/gl/ftello.c
@@ -1,5 +1,5 @@
1/* An ftello() function that works around platform bugs. 1/* An ftello() function that works around platform bugs.
2 Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -20,7 +20,7 @@
20#include <stdio.h> 20#include <stdio.h>
21 21
22#include <errno.h> 22#include <errno.h>
23#include "intprops.h" 23#include <stdckdint.h>
24 24
25/* Get lseek. */ 25/* Get lseek. */
26#include <unistd.h> 26#include <unistd.h>
@@ -34,7 +34,10 @@ ftello (FILE *fp)
34# undef ftell 34# undef ftell
35# define ftello ftell 35# define ftello ftell
36#endif 36#endif
37#if _GL_WINDOWS_64_BIT_OFF_T 37#if (defined _WIN32 && !defined __CYGWIN__) \
38 /* We need to test _FILE_OFFSET_BITS for mingw-w64 */ \
39 /* and _GL_WINDOWS_64_BIT_OFF_T for MSVC. */ \
40 && (_FILE_OFFSET_BITS == 64 || _GL_WINDOWS_64_BIT_OFF_T)
38# undef ftello 41# undef ftello
39# if HAVE__FTELLI64 /* msvc, mingw64 */ 42# if HAVE__FTELLI64 /* msvc, mingw64 */
40# define ftello _ftelli64 43# define ftello _ftelli64
@@ -97,7 +100,7 @@ ftello (FILE *fp)
97 100
98 /* Compute pos + buffered, with overflow check. */ 101 /* Compute pos + buffered, with overflow check. */
99 off_t sum; 102 off_t sum;
100 if (! INT_ADD_OK (pos, buffered, &sum)) 103 if (ckd_add (&sum, pos, buffered))
101 { 104 {
102 errno = EOVERFLOW; 105 errno = EOVERFLOW;
103 return -1; 106 return -1;
@@ -121,13 +124,11 @@ ftello (FILE *fp)
121 gets confused by this. */ 124 gets confused by this. */
122 if (fp_->_flag & _IOWRT) 125 if (fp_->_flag & _IOWRT)
123 { 126 {
124 off_t pos;
125
126 /* Call ftello nevertheless, for the side effects that it does on fp. */ 127 /* Call ftello nevertheless, for the side effects that it does on fp. */
127 ftello (fp); 128 ftello (fp);
128 129
129 /* Compute the file position ourselves. */ 130 /* Compute the file position ourselves. */
130 pos = lseek (fileno (fp), (off_t) 0, SEEK_CUR); 131 off_t pos = lseek (fileno (fp), (off_t) 0, SEEK_CUR);
131 if (pos >= 0) 132 if (pos >= 0)
132 { 133 {
133 if ((fp_->_flag & _IONBF) == 0 && fp_->_base != NULL) 134 if ((fp_->_flag & _IONBF) == 0 && fp_->_base != NULL)
diff --git a/gl/gai_strerror.c b/gl/gai_strerror.c
index 37092e29..ef6b506b 100644
--- a/gl/gai_strerror.c
+++ b/gl/gai_strerror.c
@@ -1,4 +1,4 @@
1/* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2024 Free Software 1/* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2026 Free Software
2 Foundation, Inc. 2 Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997. 4 Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.
@@ -27,8 +27,8 @@
27# include <libintl.h> 27# include <libintl.h>
28#else 28#else
29# include "gettext.h" 29# include "gettext.h"
30# define _(String) gettext (String) 30# define _(msgid) dgettext (GNULIB_TEXT_DOMAIN, msgid)
31# define N_(String) String 31# define N_(msgid) msgid
32#endif 32#endif
33 33
34#if HAVE_DECL_GAI_STRERROR 34#if HAVE_DECL_GAI_STRERROR
@@ -79,8 +79,7 @@ values[] =
79const char * 79const char *
80gai_strerror (int code) 80gai_strerror (int code)
81{ 81{
82 size_t i; 82 for (size_t i = 0; i < sizeof (values) / sizeof (values[0]); ++i)
83 for (i = 0; i < sizeof (values) / sizeof (values[0]); ++i)
84 if (values[i].code == code) 83 if (values[i].code == code)
85 return _(values[i].msg); 84 return _(values[i].msg);
86 85
diff --git a/gl/getaddrinfo.c b/gl/getaddrinfo.c
index bf5d61f3..2b60377b 100644
--- a/gl/getaddrinfo.c
+++ b/gl/getaddrinfo.c
@@ -1,5 +1,5 @@
1/* Get address information (partial implementation). 1/* Get address information (partial implementation).
2 Copyright (C) 1997, 2001-2002, 2004-2024 Free Software Foundation, Inc. 2 Copyright (C) 1997, 2001-2002, 2004-2026 Free Software Foundation, Inc.
3 Contributed by Simon Josefsson <simon@josefsson.org>. 3 Contributed by Simon Josefsson <simon@josefsson.org>.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
@@ -40,8 +40,8 @@
40#include <stdio.h> 40#include <stdio.h>
41 41
42#include "gettext.h" 42#include "gettext.h"
43#define _(String) gettext (String) 43#define _(msgid) dgettext (GNULIB_TEXT_DOMAIN, msgid)
44#define N_(String) String 44#define N_(msgid) msgid
45 45
46/* BeOS has AF_INET, but not PF_INET. */ 46/* BeOS has AF_INET, but not PF_INET. */
47#ifndef PF_INET 47#ifndef PF_INET
@@ -52,9 +52,40 @@
52# define PF_UNSPEC 0 52# define PF_UNSPEC 0
53#endif 53#endif
54 54
55#if defined __sun || !HAVE_GETADDRINFO
56
57static bool
58is_numeric_host (const char *host, int family)
59{
60# if HAVE_IPV4
61 if (family == PF_INET || family == PF_UNSPEC)
62 {
63 /* glibc supports IPv4 addresses in numbers-and-dots notation, that is,
64 also hexadecimal and octal number formats and formats that don't
65 require all four bytes to be explicitly written, via inet_aton().
66 But POSIX doesn't require support for these legacy formats. Therefore
67 we are free to use inet_pton() instead of inet_aton(). */
68 struct in_addr addr;
69 if (inet_pton (AF_INET, host, &addr))
70 return true;
71 }
72# endif
73# if HAVE_IPV6
74 if (family == PF_INET6 || family == PF_UNSPEC)
75 {
76 struct in6_addr addr;
77 if (inet_pton (AF_INET6, host, &addr))
78 return true;
79 }
80# endif
81 return false;
82}
83
84#endif
85
55#if HAVE_GETADDRINFO 86#if HAVE_GETADDRINFO
56 87
57/* Override with cdecl calling convention. */ 88/* Override with cdecl calling convention and Windows and Solaris 10 fixes. */
58 89
59int 90int
60getaddrinfo (const char *restrict nodename, 91getaddrinfo (const char *restrict nodename,
@@ -63,6 +94,18 @@ getaddrinfo (const char *restrict nodename,
63 struct addrinfo **restrict res) 94 struct addrinfo **restrict res)
64# undef getaddrinfo 95# undef getaddrinfo
65{ 96{
97 /* Workaround for native Windows. */
98 if (hints && (hints->ai_flags & AI_NUMERICSERV) != 0
99 && servname && !(*servname >= '0' && *servname <= '9'))
100 return EAI_NONAME;
101
102# ifdef __sun
103 /* Workaround for Solaris 10. */
104 if (hints && (hints->ai_flags & AI_NUMERICHOST)
105 && nodename && !is_numeric_host (nodename, hints->ai_family))
106 return EAI_NONAME;
107# endif
108
66 return getaddrinfo (nodename, servname, hints, res); 109 return getaddrinfo (nodename, servname, hints, res);
67} 110}
68 111
@@ -110,14 +153,13 @@ static int
110use_win32_p (void) 153use_win32_p (void)
111{ 154{
112 static int done = 0; 155 static int done = 0;
113 HMODULE h;
114 156
115 if (done) 157 if (done)
116 return getaddrinfo_ptr ? 1 : 0; 158 return getaddrinfo_ptr ? 1 : 0;
117 159
118 done = 1; 160 done = 1;
119 161
120 h = GetModuleHandle ("ws2_32.dll"); 162 HMODULE h = GetModuleHandle ("ws2_32.dll");
121 163
122 if (h) 164 if (h)
123 { 165 {
@@ -169,16 +211,16 @@ validate_family (int family)
169{ 211{
170 /* FIXME: Support more families. */ 212 /* FIXME: Support more families. */
171# if HAVE_IPV4 213# if HAVE_IPV4
172 if (family == PF_INET) 214 if (family == PF_INET)
173 return true; 215 return true;
174# endif 216# endif
175# if HAVE_IPV6 217# if HAVE_IPV6
176 if (family == PF_INET6) 218 if (family == PF_INET6)
177 return true; 219 return true;
178# endif 220# endif
179 if (family == PF_UNSPEC) 221 if (family == PF_UNSPEC)
180 return true; 222 return true;
181 return false; 223 return false;
182} 224}
183 225
184/* Translate name of a service location and/or a service name to set of 226/* Translate name of a service location and/or a service name to set of
@@ -190,11 +232,6 @@ getaddrinfo (const char *restrict nodename,
190 struct addrinfo **restrict res) 232 struct addrinfo **restrict res)
191#undef getaddrinfo 233#undef getaddrinfo
192{ 234{
193 struct addrinfo *tmp;
194 int port = 0;
195 struct hostent *he;
196 void *storage;
197 size_t size;
198# if HAVE_IPV6 235# if HAVE_IPV6
199 struct v6_pair { 236 struct v6_pair {
200 struct addrinfo addrinfo; 237 struct addrinfo addrinfo;
@@ -210,10 +247,17 @@ getaddrinfo (const char *restrict nodename,
210 247
211# ifdef WINDOWS_NATIVE 248# ifdef WINDOWS_NATIVE
212 if (use_win32_p ()) 249 if (use_win32_p ())
213 return getaddrinfo_ptr (nodename, servname, hints, res); 250 {
251 if (hints && (hints->ai_flags & AI_NUMERICSERV) != 0
252 && servname && !(*servname >= '0' && *servname <= '9'))
253 return EAI_NONAME;
254 return getaddrinfo_ptr (nodename, servname, hints, res);
255 }
214# endif 256# endif
215 257
216 if (hints && (hints->ai_flags & ~(AI_CANONNAME|AI_PASSIVE))) 258 if (hints
259 && (hints->ai_flags
260 & ~(AI_CANONNAME | AI_PASSIVE | AI_NUMERICHOST | AI_NUMERICSERV)))
217 /* FIXME: Support more flags. */ 261 /* FIXME: Support more flags. */
218 return EAI_BADFLAGS; 262 return EAI_BADFLAGS;
219 263
@@ -225,18 +269,25 @@ getaddrinfo (const char *restrict nodename,
225 /* FIXME: Support other socktype. */ 269 /* FIXME: Support other socktype. */
226 return EAI_SOCKTYPE; /* FIXME: Better return code? */ 270 return EAI_SOCKTYPE; /* FIXME: Better return code? */
227 271
228 if (!nodename) 272 if (nodename != NULL)
273 {
274 if (hints && (hints->ai_flags & AI_NUMERICHOST) != 0
275 && !is_numeric_host (nodename, hints->ai_family))
276 return EAI_NONAME;
277 }
278 else
229 { 279 {
230 if (!(hints->ai_flags & AI_PASSIVE)) 280 if (!(hints->ai_flags & AI_PASSIVE))
231 return EAI_NONAME; 281 return EAI_NONAME;
232 282
233# ifdef HAVE_IPV6 283# if HAVE_IPV6
234 nodename = (hints->ai_family == AF_INET6) ? "::" : "0.0.0.0"; 284 nodename = (hints->ai_family == AF_INET6) ? "::" : "0.0.0.0";
235# else 285# else
236 nodename = "0.0.0.0"; 286 nodename = "0.0.0.0";
237# endif 287# endif
238 } 288 }
239 289
290 int port = 0;
240 if (servname) 291 if (servname)
241 { 292 {
242 struct servent *se = NULL; 293 struct servent *se = NULL;
@@ -262,10 +313,11 @@ getaddrinfo (const char *restrict nodename,
262 } 313 }
263 314
264 /* FIXME: Use gethostbyname_r if available. */ 315 /* FIXME: Use gethostbyname_r if available. */
265 he = gethostbyname (nodename); 316 struct hostent *he = gethostbyname (nodename);
266 if (!he || he->h_addr_list[0] == NULL) 317 if (!he || he->h_addr_list[0] == NULL)
267 return EAI_NONAME; 318 return EAI_NONAME;
268 319
320 size_t size;
269 switch (he->h_addrtype) 321 switch (he->h_addrtype)
270 { 322 {
271# if HAVE_IPV6 323# if HAVE_IPV6
@@ -284,10 +336,11 @@ getaddrinfo (const char *restrict nodename,
284 return EAI_NODATA; 336 return EAI_NODATA;
285 } 337 }
286 338
287 storage = calloc (1, size); 339 void *storage = calloc (1, size);
288 if (!storage) 340 if (!storage)
289 return EAI_MEMORY; 341 return EAI_MEMORY;
290 342
343 struct addrinfo *tmp;
291 switch (he->h_addrtype) 344 switch (he->h_addrtype)
292 { 345 {
293# if HAVE_IPV6 346# if HAVE_IPV6
@@ -402,9 +455,7 @@ freeaddrinfo (struct addrinfo *ai)
402 455
403 while (ai) 456 while (ai)
404 { 457 {
405 struct addrinfo *cur; 458 struct addrinfo *cur = ai;
406
407 cur = ai;
408 ai = ai->ai_next; 459 ai = ai->ai_next;
409 460
410 free (cur->ai_canonname); 461 free (cur->ai_canonname);
diff --git a/gl/getdelim.c b/gl/getdelim.c
index 58063b15..21f3abc2 100644
--- a/gl/getdelim.c
+++ b/gl/getdelim.c
@@ -1,5 +1,5 @@
1/* getdelim.c --- Implementation of replacement getdelim function. 1/* getdelim.c --- Implementation of replacement getdelim function.
2 Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2024 Free Software 2 Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2026 Free Software
3 Foundation, Inc. 3 Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
@@ -62,10 +62,13 @@ alloc_failed (void)
62ssize_t 62ssize_t
63getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp) 63getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
64{ 64{
65 ssize_t result; 65 if (lineptr == NULL || n == NULL
66 size_t cur_len = 0; 66 /* glibc already declares this function as __nonnull ((4)).
67 67 Avoid a gcc warning "‘nonnull’ argument ‘fp’ compared to NULL". */
68 if (lineptr == NULL || n == NULL || fp == NULL) 68#if !(__GLIBC__ >= 2)
69 || fp == NULL
70#endif
71 )
69 { 72 {
70 errno = EINVAL; 73 errno = EINVAL;
71 return -1; 74 return -1;
@@ -73,6 +76,8 @@ getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
73 76
74 flockfile (fp); 77 flockfile (fp);
75 78
79 ssize_t result;
80
76 if (*lineptr == NULL || *n == 0) 81 if (*lineptr == NULL || *n == 0)
77 { 82 {
78 char *new_lineptr; 83 char *new_lineptr;
@@ -87,54 +92,56 @@ getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
87 *lineptr = new_lineptr; 92 *lineptr = new_lineptr;
88 } 93 }
89 94
90 for (;;) 95 {
91 { 96 size_t cur_len = 0;
92 int i; 97 for (;;)
93 98 {
94 i = getc_maybe_unlocked (fp); 99 int i;
95 if (i == EOF) 100
96 { 101 i = getc_maybe_unlocked (fp);
97 result = -1; 102 if (i == EOF)
103 {
104 result = -1;
105 break;
106 }
107
108 /* Make enough space for len+1 (for final NUL) bytes. */
109 if (cur_len + 1 >= *n)
110 {
111 size_t needed_max =
112 SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX;
113 size_t needed = 2 * *n + 1; /* Be generous. */
114
115 if (needed_max < needed)
116 needed = needed_max;
117 if (cur_len + 1 >= needed)
118 {
119 result = -1;
120 errno = EOVERFLOW;
121 goto unlock_return;
122 }
123
124 char *new_lineptr = (char *) realloc (*lineptr, needed);
125 if (new_lineptr == NULL)
126 {
127 alloc_failed ();
128 result = -1;
129 goto unlock_return;
130 }
131
132 *lineptr = new_lineptr;
133 *n = needed;
134 }
135
136 (*lineptr)[cur_len] = i;
137 cur_len++;
138
139 if (i == delimiter)
98 break; 140 break;
99 } 141 }
100 142 (*lineptr)[cur_len] = '\0';
101 /* Make enough space for len+1 (for final NUL) bytes. */ 143 result = cur_len ? cur_len : result;
102 if (cur_len + 1 >= *n) 144 }
103 {
104 size_t needed_max =
105 SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX;
106 size_t needed = 2 * *n + 1; /* Be generous. */
107 char *new_lineptr;
108
109 if (needed_max < needed)
110 needed = needed_max;
111 if (cur_len + 1 >= needed)
112 {
113 result = -1;
114 errno = EOVERFLOW;
115 goto unlock_return;
116 }
117
118 new_lineptr = (char *) realloc (*lineptr, needed);
119 if (new_lineptr == NULL)
120 {
121 alloc_failed ();
122 result = -1;
123 goto unlock_return;
124 }
125
126 *lineptr = new_lineptr;
127 *n = needed;
128 }
129
130 (*lineptr)[cur_len] = i;
131 cur_len++;
132
133 if (i == delimiter)
134 break;
135 }
136 (*lineptr)[cur_len] = '\0';
137 result = cur_len ? cur_len : result;
138 145
139 unlock_return: 146 unlock_return:
140 funlockfile (fp); /* doesn't set errno */ 147 funlockfile (fp); /* doesn't set errno */
diff --git a/gl/getdtablesize.c b/gl/getdtablesize.c
index 762c100b..cc823952 100644
--- a/gl/getdtablesize.c
+++ b/gl/getdtablesize.c
@@ -1,5 +1,5 @@
1/* getdtablesize() function: Return maximum possible file descriptor value + 1. 1/* getdtablesize() function: Return maximum possible file descriptor value + 1.
2 Copyright (C) 2008-2024 Free Software Foundation, Inc. 2 Copyright (C) 2008-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2008. 3 Written by Bruno Haible <bruno@clisp.org>, 2008.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
@@ -61,13 +61,10 @@ getdtablesize (void)
61 { 61 {
62 /* We are looking for the number N such that the valid file descriptors 62 /* We are looking for the number N such that the valid file descriptors
63 are 0..N-1. It can be obtained through a loop as follows: 63 are 0..N-1. It can be obtained through a loop as follows:
64 { 64 for (int fd = 3; fd < 65536; fd++)
65 int fd; 65 if (dup2 (0, fd) == -1)
66 for (fd = 3; fd < 65536; fd++) 66 break;
67 if (dup2 (0, fd) == -1) 67 return fd;
68 break;
69 return fd;
70 }
71 On Windows XP, the result is 2048. 68 On Windows XP, the result is 2048.
72 The drawback of this loop is that it allocates memory for a libc 69 The drawback of this loop is that it allocates memory for a libc
73 internal array that is never freed. 70 internal array that is never freed.
diff --git a/gl/gethostname.c b/gl/gethostname.c
index c075b6df..464bac39 100644
--- a/gl/gethostname.c
+++ b/gl/gethostname.c
@@ -1,6 +1,6 @@
1/* gethostname emulation for SysV and POSIX.1. 1/* gethostname emulation for SysV and POSIX.1.
2 2
3 Copyright (C) 1992, 2003, 2006, 2008-2024 Free Software Foundation, Inc. 3 Copyright (C) 1992, 2003, 2006, 2008-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -89,12 +89,10 @@ gethostname (char *name, size_t len)
89int 89int
90rpl_gethostname (char *name, size_t len) 90rpl_gethostname (char *name, size_t len)
91{ 91{
92 int r;
93
94 if (len > INT_MAX) 92 if (len > INT_MAX)
95 len = INT_MAX; 93 len = INT_MAX;
96 gl_sockets_startup (SOCKETS_1_1); 94 gl_sockets_startup (SOCKETS_1_1);
97 r = gethostname (name, (int) len); 95 int r = gethostname (name, (int) len);
98 if (r < 0) 96 if (r < 0)
99 set_winsock_errno (); 97 set_winsock_errno ();
100 98
diff --git a/gl/getline.c b/gl/getline.c
index 2d03b646..bbc8712d 100644
--- a/gl/getline.c
+++ b/gl/getline.c
@@ -1,5 +1,5 @@
1/* getline.c --- Implementation of replacement getline function. 1/* getline.c --- Implementation of replacement getline function.
2 Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 2005-2007, 2009-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/getloadavg.c b/gl/getloadavg.c
index c940e4c7..73b2ee28 100644
--- a/gl/getloadavg.c
+++ b/gl/getloadavg.c
@@ -1,6 +1,6 @@
1/* Get the system load averages. 1/* Get the system load averages.
2 2
3 Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2024 Free Software 3 Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2026 Free Software
4 Foundation, Inc. 4 Foundation, Inc.
5 5
6 NOTE: The canonical source of this file is maintained with gnulib. 6 NOTE: The canonical source of this file is maintained with gnulib.
@@ -47,8 +47,6 @@
47 N_NAME_POINTER The nlist n_name element is a pointer, 47 N_NAME_POINTER The nlist n_name element is a pointer,
48 not an array. 48 not an array.
49 HAVE_STRUCT_NLIST_N_UN_N_NAME 'n_un.n_name' is member of 'struct nlist'. 49 HAVE_STRUCT_NLIST_N_UN_N_NAME 'n_un.n_name' is member of 'struct nlist'.
50 LINUX_LDAV_FILE [__linux__, __ANDROID__, __CYGWIN__]: File
51 containing load averages.
52 50
53 Specific system predefines this file uses, aside from setting 51 Specific system predefines this file uses, aside from setting
54 default values if not emacs: 52 default values if not emacs:
@@ -65,8 +63,7 @@
65 UMAX4_3 63 UMAX4_3
66 VMS 64 VMS
67 _WIN32 Native Windows (possibly also defined on Cygwin) 65 _WIN32 Native Windows (possibly also defined on Cygwin)
68 __linux__, __ANDROID__ Linux: assumes /proc file system mounted. 66 __linux__, __ANDROID__ Linux: assumes sysinfo() call.
69 Support from Michael K. Johnson.
70 __CYGWIN__ Cygwin emulates linux /proc/loadavg. 67 __CYGWIN__ Cygwin emulates linux /proc/loadavg.
71 __NetBSD__ NetBSD: assumes /kern file system mounted. 68 __NetBSD__ NetBSD: assumes /kern file system mounted.
72 69
@@ -108,10 +105,10 @@
108# endif 105# endif
109 106
110/* Same issues as for NeXT apply to the HURD-based GNU system. */ 107/* Same issues as for NeXT apply to the HURD-based GNU system. */
111# ifdef __GNU__ 108# if defined __gnu_hurd__ || defined NeXT
112# undef BSD 109# undef BSD
113# undef FSCALE 110# undef FSCALE
114# endif /* __GNU__ */ 111# endif /* __gnu_hurd__ || NeXT */
115 112
116/* Set values that are different from the defaults, which are 113/* Set values that are different from the defaults, which are
117 set a little farther down with #ifndef. */ 114 set a little farther down with #ifndef. */
@@ -143,21 +140,6 @@
143# define SUNOS_5 140# define SUNOS_5
144# endif 141# endif
145 142
146# if defined (__osf__) && (defined (__alpha) || defined (__alpha__))
147# define OSF_ALPHA
148# include <sys/mbuf.h>
149# include <sys/socket.h>
150# include <net/route.h>
151# include <sys/table.h>
152/* Tru64 4.0D's table.h redefines sys */
153# undef sys
154# endif
155
156# if defined (__osf__) && (defined (mips) || defined (__mips__))
157# define OSF_MIPS
158# include <sys/table.h>
159# endif
160
161 143
162/* VAX C can't handle multi-line #ifs, or lines longer than 256 chars. */ 144/* VAX C can't handle multi-line #ifs, or lines longer than 256 chars. */
163# ifndef LOAD_AVE_TYPE 145# ifndef LOAD_AVE_TYPE
@@ -170,31 +152,16 @@
170# define LOAD_AVE_TYPE long 152# define LOAD_AVE_TYPE long
171# endif 153# endif
172 154
173# ifdef sgi
174# define LOAD_AVE_TYPE long
175# endif
176
177# ifdef SVR4 155# ifdef SVR4
178# define LOAD_AVE_TYPE long 156# define LOAD_AVE_TYPE long
179# endif 157# endif
180 158
181# ifdef OSF_ALPHA
182# define LOAD_AVE_TYPE long
183# endif
184
185# if defined _AIX && ! defined HAVE_LIBPERFSTAT 159# if defined _AIX && ! defined HAVE_LIBPERFSTAT
186# define LOAD_AVE_TYPE long 160# define LOAD_AVE_TYPE long
187# endif 161# endif
188 162
189# endif /* No LOAD_AVE_TYPE. */ 163# endif /* No LOAD_AVE_TYPE. */
190 164
191# ifdef OSF_ALPHA
192/* <sys/param.h> defines an incorrect value for FSCALE on Alpha OSF/1,
193 according to ghazi@noc.rutgers.edu. */
194# undef FSCALE
195# define FSCALE 1024.0
196# endif
197
198 165
199# ifndef FSCALE 166# ifndef FSCALE
200 167
@@ -312,8 +279,7 @@
312# endif 279# endif
313# endif 280# endif
314 281
315# if defined (__GNU__) && !defined (NeXT) 282# if defined __gnu_hurd__ && !defined NeXT
316/* Note that NeXT Openstep defines __GNU__ even though it should not. */
317/* GNU system acts much like NeXT, for load average purposes, 283/* GNU system acts much like NeXT, for load average purposes,
318 but not exactly. */ 284 but not exactly. */
319# define NeXT 285# define NeXT
@@ -328,10 +294,6 @@
328# endif 294# endif
329# endif /* NeXT */ 295# endif /* NeXT */
330 296
331# ifdef sgi
332# include <sys/sysmp.h>
333# endif /* sgi */
334
335# ifdef UMAX 297# ifdef UMAX
336# include <signal.h> 298# include <signal.h>
337# include <sys/time.h> 299# include <sys/time.h>
@@ -358,6 +320,11 @@
358# include <sys/dg_sys_info.h> 320# include <sys/dg_sys_info.h>
359# endif 321# endif
360 322
323# if defined __linux__ || defined __ANDROID__
324# include <sys/param.h>
325# include <sys/sysinfo.h>
326# endif
327
361# if (defined __linux__ || defined __ANDROID__ \ 328# if (defined __linux__ || defined __ANDROID__ \
362 || defined __CYGWIN__ || defined SUNOS_5 \ 329 || defined __CYGWIN__ || defined SUNOS_5 \
363 || (defined LOAD_AVE_TYPE && ! defined __VMS)) 330 || (defined LOAD_AVE_TYPE && ! defined __VMS))
@@ -388,7 +355,7 @@ static bool getloadavg_initialized;
388/* Offset in kmem to seek to read load average, or 0 means invalid. */ 355/* Offset in kmem to seek to read load average, or 0 means invalid. */
389static long offset; 356static long offset;
390 357
391# if ! defined __VMS && ! defined sgi && ! (defined __linux__ || defined __ANDROID__) 358# if ! defined __VMS && ! (defined __linux__ || defined __ANDROID__)
392static struct nlist name_list[2]; 359static struct nlist name_list[2];
393# endif 360# endif
394 361
@@ -417,51 +384,47 @@ getloadavg (double loadavg[], int nelem)
417# if !defined (LDAV_DONE) && defined (HAVE_LIBKSTAT) /* Solaris <= 2.6 */ 384# if !defined (LDAV_DONE) && defined (HAVE_LIBKSTAT) /* Solaris <= 2.6 */
418/* Use libkstat because we don't have to be root. */ 385/* Use libkstat because we don't have to be root. */
419# define LDAV_DONE 386# define LDAV_DONE
420 kstat_ctl_t *kc; 387 {
421 kstat_t *ksp; 388 kstat_ctl_t *kc = kstat_open ();
422 kstat_named_t *kn; 389 if (kc == NULL)
423 int saved_errno; 390 return -1;
424 391 kstat_t *ksp = kstat_lookup (kc, "unix", 0, "system_misc");
425 kc = kstat_open (); 392 if (ksp == NULL)
426 if (kc == NULL) 393 return -1;
427 return -1; 394 if (kstat_read (kc, ksp, 0) == -1)
428 ksp = kstat_lookup (kc, "unix", 0, "system_misc"); 395 return -1;
429 if (ksp == NULL)
430 return -1;
431 if (kstat_read (kc, ksp, 0) == -1)
432 return -1;
433
434
435 kn = kstat_data_lookup (ksp, "avenrun_1min");
436 if (kn == NULL)
437 {
438 /* Return -1 if no load average information is available. */
439 nelem = 0;
440 elem = -1;
441 }
442
443 if (nelem >= 1)
444 loadavg[elem++] = (double) kn->value.ul / FSCALE;
445
446 if (nelem >= 2)
447 {
448 kn = kstat_data_lookup (ksp, "avenrun_5min");
449 if (kn != NULL)
450 {
451 loadavg[elem++] = (double) kn->value.ul / FSCALE;
452 396
453 if (nelem >= 3) 397 kstat_named_t *kn = kstat_data_lookup (ksp, "avenrun_1min");
454 { 398 if (kn == NULL)
455 kn = kstat_data_lookup (ksp, "avenrun_15min"); 399 {
456 if (kn != NULL) 400 /* Return -1 if no load average information is available. */
457 loadavg[elem++] = (double) kn->value.ul / FSCALE; 401 nelem = 0;
458 } 402 elem = -1;
459 } 403 }
460 } 404
405 if (nelem >= 1)
406 loadavg[elem++] = (double) kn->value.ul / FSCALE;
407
408 if (nelem >= 2)
409 {
410 kn = kstat_data_lookup (ksp, "avenrun_5min");
411 if (kn != NULL)
412 {
413 loadavg[elem++] = (double) kn->value.ul / FSCALE;
414
415 if (nelem >= 3)
416 {
417 kn = kstat_data_lookup (ksp, "avenrun_15min");
418 if (kn != NULL)
419 loadavg[elem++] = (double) kn->value.ul / FSCALE;
420 }
421 }
422 }
461 423
462 saved_errno = errno; 424 int saved_errno = errno;
463 kstat_close (kc); 425 kstat_close (kc);
464 errno = saved_errno; 426 errno = saved_errno;
427 }
465# endif /* HAVE_LIBKSTAT */ 428# endif /* HAVE_LIBKSTAT */
466 429
467# if !defined (LDAV_DONE) && defined (hpux) && defined (HAVE_PSTAT_GETDYNAMIC) 430# if !defined (LDAV_DONE) && defined (hpux) && defined (HAVE_PSTAT_GETDYNAMIC)
@@ -498,24 +461,36 @@ getloadavg (double loadavg[], int nelem)
498 } 461 }
499# endif 462# endif
500 463
501# if !defined (LDAV_DONE) && (defined __linux__ || defined __ANDROID__ || defined __CYGWIN__) 464# if (!defined LDAV_DONE \
502 /* Linux without glibc, Android, Cygwin */ 465 && (defined __ANDROID__ ? 13 <= __ANDROID_API__ : defined __linux__))
466 /* non-Android Linux without glibc, Android 3.2+, Cygwin */
503# define LDAV_DONE 467# define LDAV_DONE
504# undef LOAD_AVE_TYPE 468# undef LOAD_AVE_TYPE
505 469
506# ifndef LINUX_LDAV_FILE 470 {
507# define LINUX_LDAV_FILE "/proc/loadavg" 471 struct sysinfo info;
508# endif 472 if (sysinfo (&info) < 0)
473 return -1;
474 loadavg[0] = info.loads[0] / (double)(1U << SI_LOAD_SHIFT);
475 loadavg[1] = info.loads[1] / (double)(1U << SI_LOAD_SHIFT);
476 loadavg[2] = info.loads[2] / (double)(1U << SI_LOAD_SHIFT);
477 elem = 3;
478 }
479# endif /* __ANDROID__ ? 13 <= __ANDROID_API__ : __linux__ */
480
481# if !defined (LDAV_DONE) && defined __CYGWIN__
482 /* Cygwin */
483# define LDAV_DONE
484# undef LOAD_AVE_TYPE
509 485
510 char ldavgbuf[3 * (INT_STRLEN_BOUND (int) + sizeof ".00 ")]; 486 char ldavgbuf[3 * (INT_STRLEN_BOUND (int) + sizeof ".00 ")];
511 char const *ptr = ldavgbuf; 487 char const *ptr = ldavgbuf;
512 int fd, count, saved_errno;
513 488
514 fd = open (LINUX_LDAV_FILE, O_RDONLY | O_CLOEXEC); 489 int fd = open ("/proc/loadavg", O_RDONLY | O_CLOEXEC);
515 if (fd == -1) 490 if (fd == -1)
516 return -1; 491 return -1;
517 count = read (fd, ldavgbuf, sizeof ldavgbuf - 1); 492 int count = read (fd, ldavgbuf, sizeof ldavgbuf - 1);
518 saved_errno = errno; 493 int saved_errno = errno;
519 (void) close (fd); 494 (void) close (fd);
520 errno = saved_errno; 495 errno = saved_errno;
521 if (count <= 0) 496 if (count <= 0)
@@ -524,9 +499,6 @@ getloadavg (double loadavg[], int nelem)
524 499
525 for (elem = 0; elem < nelem; elem++) 500 for (elem = 0; elem < nelem; elem++)
526 { 501 {
527 double numerator = 0;
528 double denominator = 1;
529
530 while (*ptr == ' ') 502 while (*ptr == ' ')
531 ptr++; 503 ptr++;
532 504
@@ -542,6 +514,9 @@ getloadavg (double loadavg[], int nelem)
542 break; 514 break;
543 } 515 }
544 516
517 double numerator = 0;
518 double denominator = 1;
519
545 while ('0' <= *ptr && *ptr <= '9') 520 while ('0' <= *ptr && *ptr <= '9')
546 numerator = 10 * numerator + (*ptr++ - '0'); 521 numerator = 10 * numerator + (*ptr++ - '0');
547 522
@@ -554,7 +529,7 @@ getloadavg (double loadavg[], int nelem)
554 529
555 return elem; 530 return elem;
556 531
557# endif /* __linux__ || __ANDROID__ || __CYGWIN__ */ 532# endif /* __CYGWIN__ */
558 533
559# if !defined (LDAV_DONE) && defined (__NetBSD__) /* NetBSD < 0.9 */ 534# if !defined (LDAV_DONE) && defined (__NetBSD__) /* NetBSD < 0.9 */
560# define LDAV_DONE 535# define LDAV_DONE
@@ -564,24 +539,25 @@ getloadavg (double loadavg[], int nelem)
564# define NETBSD_LDAV_FILE "/kern/loadavg" 539# define NETBSD_LDAV_FILE "/kern/loadavg"
565# endif 540# endif
566 541
567 unsigned long int load_ave[3], scale;
568 int count;
569 char readbuf[4 * INT_BUFSIZE_BOUND (unsigned long int) + 1];
570 int fd = open (NETBSD_LDAV_FILE, O_RDONLY | O_CLOEXEC); 542 int fd = open (NETBSD_LDAV_FILE, O_RDONLY | O_CLOEXEC);
571 if (fd < 0) 543 if (fd < 0)
572 return fd; 544 return fd;
545
546 char readbuf[4 * INT_BUFSIZE_BOUND (unsigned long int) + 1];
573 int nread = read (fd, readbuf, sizeof readbuf - 1); 547 int nread = read (fd, readbuf, sizeof readbuf - 1);
574 int err = errno; 548 int saved_errno = errno;
575 close (fd); 549 close (fd);
576 if (nread < 0) 550 if (nread < 0)
577 { 551 {
578 errno = err; 552 errno = saved_errno;
579 return -1; 553 return -1;
580 } 554 }
581 readbuf[nread] = '\0'; 555 readbuf[nread] = '\0';
582 count = sscanf (readbuf, "%lu %lu %lu %lu\n", 556
583 &load_ave[0], &load_ave[1], &load_ave[2], 557 unsigned long int load_ave[3], scale;
584 &scale); 558 int count = sscanf (readbuf, "%lu %lu %lu %lu\n",
559 &load_ave[0], &load_ave[1], &load_ave[2],
560 &scale);
585 if (count != 4) 561 if (count != 4)
586 { 562 {
587 errno = ENOTSUP; 563 errno = ENOTSUP;
@@ -599,10 +575,6 @@ getloadavg (double loadavg[], int nelem)
599# define LDAV_DONE 575# define LDAV_DONE
600 /* The NeXT code was adapted from iscreen 3.2. */ 576 /* The NeXT code was adapted from iscreen 3.2. */
601 577
602 host_t host;
603 struct processor_set_basic_info info;
604 unsigned int info_count;
605
606 /* We only know how to get the 1-minute average for this system, 578 /* We only know how to get the 1-minute average for this system,
607 so even if the caller asks for more than 1, we only return 1. */ 579 so even if the caller asks for more than 1, we only return 1. */
608 580
@@ -614,7 +586,9 @@ getloadavg (double loadavg[], int nelem)
614 586
615 if (getloadavg_initialized) 587 if (getloadavg_initialized)
616 { 588 {
617 info_count = PROCESSOR_SET_BASIC_INFO_COUNT; 589 host_t host;
590 struct processor_set_basic_info info;
591 unsigned int info_count = PROCESSOR_SET_BASIC_INFO_COUNT;
618 if (processor_set_info (default_set, PROCESSOR_SET_BASIC_INFO, &host, 592 if (processor_set_info (default_set, PROCESSOR_SET_BASIC_INFO, &host,
619 (processor_set_info_t) &info, &info_count) 593 (processor_set_info_t) &info, &info_count)
620 != KERN_SUCCESS) 594 != KERN_SUCCESS)
@@ -640,14 +614,9 @@ getloadavg (double loadavg[], int nelem)
640 can be gathered with inq_stats system calls. 614 can be gathered with inq_stats system calls.
641 We only know how to get the 1-minute average for this system. */ 615 We only know how to get the 1-minute average for this system. */
642 616
643 struct proc_summary proc_sum_data;
644 struct stat_descr proc_info;
645 double load;
646 register unsigned int i, j;
647
648 if (cpus == 0) 617 if (cpus == 0)
649 { 618 {
650 register unsigned int c, i; 619 register unsigned int c;
651 struct cpu_config conf; 620 struct cpu_config conf;
652 struct stat_descr desc; 621 struct stat_descr desc;
653 622
@@ -661,7 +630,7 @@ getloadavg (double loadavg[], int nelem)
661 return -1; 630 return -1;
662 631
663 c = 0; 632 c = 0;
664 for (i = 0; i < conf.config_maxclass; ++i) 633 for (unsigned int i = 0; i < conf.config_maxclass; ++i)
665 { 634 {
666 struct class_stats stats; 635 struct class_stats stats;
667 memset (&stats, 0, sizeof stats); 636 memset (&stats, 0, sizeof stats);
@@ -680,6 +649,9 @@ getloadavg (double loadavg[], int nelem)
680 samples = cpus < 2 ? 3 : (2 * cpus / 3); 649 samples = cpus < 2 ? 3 : (2 * cpus / 3);
681 } 650 }
682 651
652 struct proc_summary proc_sum_data;
653
654 struct stat_descr proc_info;
683 proc_info.sd_next = 0; 655 proc_info.sd_next = 0;
684 proc_info.sd_subsys = SUBSYS_PROC; 656 proc_info.sd_subsys = SUBSYS_PROC;
685 proc_info.sd_type = PROCTYPE_SUMMARY; 657 proc_info.sd_type = PROCTYPE_SUMMARY;
@@ -690,9 +662,9 @@ getloadavg (double loadavg[], int nelem)
690 if (inq_stats (1, &proc_info) != 0) 662 if (inq_stats (1, &proc_info) != 0)
691 return -1; 663 return -1;
692 664
693 load = proc_sum_data.ps_nrunnable; 665 double load = proc_sum_data.ps_nrunnable;
694 j = 0; 666 register unsigned int j = 0;
695 for (i = samples - 1; i > 0; --i) 667 for (unsigned int i = samples - 1; i > 0; --i)
696 { 668 {
697 load += proc_sum_data.ps_nrun[j]; 669 load += proc_sum_data.ps_nrun[j];
698 if (j++ == PS_NRUNSIZE) 670 if (j++ == PS_NRUNSIZE)
@@ -767,18 +739,6 @@ getloadavg (double loadavg[], int nelem)
767 } 739 }
768# endif /* __MSDOS__ || WINDOWS32 */ 740# endif /* __MSDOS__ || WINDOWS32 */
769 741
770# if !defined (LDAV_DONE) && defined (OSF_ALPHA) /* OSF/1 */
771# define LDAV_DONE
772
773 struct tbl_loadavg load_ave;
774 table (TBL_LOADAVG, 0, &load_ave, 1, sizeof (load_ave));
775 for (elem = 0; elem < nelem; elem++)
776 loadavg[elem]
777 = (load_ave.tl_lscale == 0
778 ? load_ave.tl_avenrun.d[elem]
779 : (load_ave.tl_avenrun.l[elem] / (double) load_ave.tl_lscale));
780# endif /* OSF_ALPHA */
781
782# if ! defined LDAV_DONE && defined __VMS /* VMS */ 742# if ! defined LDAV_DONE && defined __VMS /* VMS */
783 /* VMS specific code -- read from the Load Ave driver. */ 743 /* VMS specific code -- read from the Load Ave driver. */
784 744
@@ -823,52 +783,44 @@ getloadavg (double loadavg[], int nelem)
823# endif /* ! defined LDAV_DONE && defined __VMS */ 783# endif /* ! defined LDAV_DONE && defined __VMS */
824 784
825# if ! defined LDAV_DONE && defined LOAD_AVE_TYPE && ! defined __VMS 785# if ! defined LDAV_DONE && defined LOAD_AVE_TYPE && ! defined __VMS
826 /* IRIX, other old systems */ 786 /* other old systems */
827 787
828 /* UNIX-specific code -- read the average from /dev/kmem. */ 788 /* UNIX-specific code -- read the average from /dev/kmem. */
829 789
830# define LDAV_PRIVILEGED /* This code requires special installation. */ 790# define LDAV_PRIVILEGED /* This code requires special installation. */
831 791
832 LOAD_AVE_TYPE load_ave[3];
833
834 /* Get the address of LDAV_SYMBOL. */ 792 /* Get the address of LDAV_SYMBOL. */
835 if (offset == 0) 793 if (offset == 0)
836 { 794 {
837# ifndef sgi 795# if ! defined NLIST_STRUCT || ! defined N_NAME_POINTER
838# if ! defined NLIST_STRUCT || ! defined N_NAME_POINTER
839 strcpy (name_list[0].n_name, LDAV_SYMBOL); 796 strcpy (name_list[0].n_name, LDAV_SYMBOL);
840 strcpy (name_list[1].n_name, ""); 797 strcpy (name_list[1].n_name, "");
841# else /* NLIST_STRUCT */ 798# else /* NLIST_STRUCT */
842# ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME 799# ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME
843 name_list[0].n_un.n_name = LDAV_SYMBOL; 800 name_list[0].n_un.n_name = LDAV_SYMBOL;
844 name_list[1].n_un.n_name = 0; 801 name_list[1].n_un.n_name = 0;
845# else /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */ 802# else /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */
846 name_list[0].n_name = LDAV_SYMBOL; 803 name_list[0].n_name = LDAV_SYMBOL;
847 name_list[1].n_name = 0; 804 name_list[1].n_name = 0;
848# endif /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */ 805# endif /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */
849# endif /* NLIST_STRUCT */ 806# endif /* NLIST_STRUCT */
850 807
851# ifndef SUNOS_5 808# ifndef SUNOS_5
852 if ( 809 if (
853# if !defined (_AIX) 810# if !defined (_AIX)
854 nlist (KERNEL_FILE, name_list) 811 nlist (KERNEL_FILE, name_list)
855# else /* _AIX */ 812# else /* _AIX */
856 knlist (name_list, 1, sizeof (name_list[0])) 813 knlist (name_list, 1, sizeof (name_list[0]))
857# endif 814# endif
858 >= 0) 815 >= 0)
859 /* Omit "&& name_list[0].n_type != 0 " -- it breaks on Sun386i. */ 816 /* Omit "&& name_list[0].n_type != 0 " -- it breaks on Sun386i. */
860 { 817 {
861# ifdef FIXUP_KERNEL_SYMBOL_ADDR 818# ifdef FIXUP_KERNEL_SYMBOL_ADDR
862 FIXUP_KERNEL_SYMBOL_ADDR (name_list); 819 FIXUP_KERNEL_SYMBOL_ADDR (name_list);
863# endif 820# endif
864 offset = name_list[0].n_value; 821 offset = name_list[0].n_value;
865 } 822 }
866# endif /* !SUNOS_5 */ 823# endif /* !SUNOS_5 */
867# else /* sgi */
868 ptrdiff_t ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN);
869 if (ldav_off != -1)
870 offset = (long int) ldav_off & 0x7fffffff;
871# endif /* sgi */
872 } 824 }
873 825
874 /* Make sure we have /dev/kmem open. */ 826 /* Make sure we have /dev/kmem open. */
@@ -895,6 +847,8 @@ getloadavg (double loadavg[], int nelem)
895# endif /* SUNOS_5 */ 847# endif /* SUNOS_5 */
896 } 848 }
897 849
850 LOAD_AVE_TYPE load_ave[3];
851
898 /* If we can, get the load average values. */ 852 /* If we can, get the load average values. */
899 if (offset && getloadavg_initialized) 853 if (offset && getloadavg_initialized)
900 { 854 {
diff --git a/gl/getopt-cdefs.in.h b/gl/getopt-cdefs.in.h
index a1d304d4..57406947 100644
--- a/gl/getopt-cdefs.in.h
+++ b/gl/getopt-cdefs.in.h
@@ -1,5 +1,5 @@
1/* getopt-on-non-glibc compatibility macros. 1/* getopt-on-non-glibc compatibility macros.
2 Copyright (C) 1989-2024 Free Software Foundation, Inc. 2 Copyright (C) 1989-2026 Free Software Foundation, Inc.
3 This file is part of gnulib. 3 This file is part of gnulib.
4 Unlike most of the getopt implementation, it is NOT shared 4 Unlike most of the getopt implementation, it is NOT shared
5 with the GNU C Library. 5 with the GNU C Library.
@@ -46,10 +46,14 @@
46# endif 46# endif
47#endif 47#endif
48 48
49#if defined __clang__
50 /* clang really only groks GNU C 4.2, regardless of its value of __GNUC__. */
51# undef __GNUC_PREREQ
52# define __GNUC_PREREQ(maj, min) ((maj) < 4 + ((min) <= 2))
53#endif
49#ifndef __GNUC_PREREQ 54#ifndef __GNUC_PREREQ
50# if defined __GNUC__ && defined __GNUC_VERSION__ 55# if defined __GNUC__ && defined __GNUC_MINOR__
51# define __GNUC_PREREQ(maj, min) \ 56# define __GNUC_PREREQ(maj, min) ((maj) < __GNUC__ + ((min) <= __GNUC_MINOR__))
52 ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
53# else 57# else
54# define __GNUC_PREREQ(maj, min) 0 58# define __GNUC_PREREQ(maj, min) 0
55# endif 59# endif
diff --git a/gl/getopt-core.h b/gl/getopt-core.h
index 12d09a25..c815966f 100644
--- a/gl/getopt-core.h
+++ b/gl/getopt-core.h
@@ -1,5 +1,5 @@
1/* Declarations for getopt (basic, portable features only). 1/* Declarations for getopt (basic, portable features only).
2 Copyright (C) 1989-2024 Free Software Foundation, Inc. 2 Copyright (C) 1989-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library and is also part of gnulib. 3 This file is part of the GNU C Library and is also part of gnulib.
4 Patches to this file should be submitted to both projects. 4 Patches to this file should be submitted to both projects.
5 5
diff --git a/gl/getopt-ext.h b/gl/getopt-ext.h
index e4b499d4..c0784d96 100644
--- a/gl/getopt-ext.h
+++ b/gl/getopt-ext.h
@@ -1,5 +1,5 @@
1/* Declarations for getopt (GNU extensions). 1/* Declarations for getopt (GNU extensions).
2 Copyright (C) 1989-2024 Free Software Foundation, Inc. 2 Copyright (C) 1989-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library and is also part of gnulib. 3 This file is part of the GNU C Library and is also part of gnulib.
4 Patches to this file should be submitted to both projects. 4 Patches to this file should be submitted to both projects.
5 5
diff --git a/gl/getopt-pfx-core.h b/gl/getopt-pfx-core.h
index 78b7816a..d7dd8788 100644
--- a/gl/getopt-pfx-core.h
+++ b/gl/getopt-pfx-core.h
@@ -1,5 +1,5 @@
1/* getopt (basic, portable features) gnulib wrapper header. 1/* getopt (basic, portable features) gnulib wrapper header.
2 Copyright (C) 1989-2024 Free Software Foundation, Inc. 2 Copyright (C) 1989-2026 Free Software Foundation, Inc.
3 This file is part of gnulib. 3 This file is part of gnulib.
4 Unlike most of the getopt implementation, it is NOT shared 4 Unlike most of the getopt implementation, it is NOT shared
5 with the GNU C Library. 5 with the GNU C Library.
@@ -31,6 +31,16 @@
31 functions and variables. Renaming avoids problems with some 31 functions and variables. Renaming avoids problems with some
32 compilers and linkers. */ 32 compilers and linkers. */
33#ifdef __GETOPT_PREFIX 33#ifdef __GETOPT_PREFIX
34
35/* Include platform-dependent header files that may declare getopt() and
36 friends. */
37# if defined _AIX || defined __hpux || defined __sun || defined __QNX__
38# include <stdio.h>
39# endif
40# if defined MUSL_LIBC || (defined __FreeBSD__ || defined __DragonFly__) || defined __NetBSD__ || defined __OpenBSD__ || (defined __APPLE__ && defined __MACH__) || defined _AIX || defined __sun || defined __minix || defined __HAIKU__
41# include <unistd.h>
42# endif
43
34# ifndef __GETOPT_ID 44# ifndef __GETOPT_ID
35# define __GETOPT_CONCAT(x, y) x ## y 45# define __GETOPT_CONCAT(x, y) x ## y
36# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y) 46# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
diff --git a/gl/getopt-pfx-ext.h b/gl/getopt-pfx-ext.h
index f001c11e..db2e27f3 100644
--- a/gl/getopt-pfx-ext.h
+++ b/gl/getopt-pfx-ext.h
@@ -1,5 +1,5 @@
1/* getopt (GNU extensions) gnulib wrapper header. 1/* getopt (GNU extensions) gnulib wrapper header.
2 Copyright (C) 1989-2024 Free Software Foundation, Inc. 2 Copyright (C) 1989-2026 Free Software Foundation, Inc.
3 This file is part of gnulib. 3 This file is part of gnulib.
4 Unlike most of the getopt implementation, it is NOT shared 4 Unlike most of the getopt implementation, it is NOT shared
5 with the GNU C Library. 5 with the GNU C Library.
@@ -38,11 +38,9 @@
38# endif 38# endif
39# undef getopt_long 39# undef getopt_long
40# undef getopt_long_only 40# undef getopt_long_only
41# undef option
42# undef _getopt_internal 41# undef _getopt_internal
43# define getopt_long __GETOPT_ID (getopt_long) 42# define getopt_long __GETOPT_ID (getopt_long)
44# define getopt_long_only __GETOPT_ID (getopt_long_only) 43# define getopt_long_only __GETOPT_ID (getopt_long_only)
45# define option __GETOPT_ID (option)
46# define _getopt_internal __GETOPT_ID (getopt_internal) 44# define _getopt_internal __GETOPT_ID (getopt_internal)
47 45
48/* The system's getopt.h may have already included getopt-ext.h to 46/* The system's getopt.h may have already included getopt-ext.h to
diff --git a/gl/getopt.c b/gl/getopt.c
index f66f119e..406a406b 100644
--- a/gl/getopt.c
+++ b/gl/getopt.c
@@ -1,5 +1,5 @@
1/* Getopt for GNU. 1/* Getopt for GNU.
2 Copyright (C) 1987-2024 Free Software Foundation, Inc. 2 Copyright (C) 1987-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library and is also part of gnulib. 3 This file is part of the GNU C Library and is also part of gnulib.
4 Patches to this file should be submitted to both projects. 4 Patches to this file should be submitted to both projects.
5 5
@@ -42,7 +42,7 @@
42# define funlockfile(fp) _IO_funlockfile (fp) 42# define funlockfile(fp) _IO_funlockfile (fp)
43#else 43#else
44# include "gettext.h" 44# include "gettext.h"
45# define _(msgid) gettext (msgid) 45# define _(msgid) dgettext (GNULIB_TEXT_DOMAIN, msgid)
46/* When used standalone, flockfile and funlockfile might not be 46/* When used standalone, flockfile and funlockfile might not be
47 available. */ 47 available. */
48# if (!defined _POSIX_THREAD_SAFE_FUNCTIONS \ 48# if (!defined _POSIX_THREAD_SAFE_FUNCTIONS \
@@ -133,7 +133,6 @@ exchange (char **argv, struct _getopt_data *d)
133 int bottom = d->__first_nonopt; 133 int bottom = d->__first_nonopt;
134 int middle = d->__last_nonopt; 134 int middle = d->__last_nonopt;
135 int top = d->optind; 135 int top = d->optind;
136 char *tem;
137 136
138 /* Exchange the shorter segment with the far end of the longer segment. 137 /* Exchange the shorter segment with the far end of the longer segment.
139 That puts the shorter segment into the right place. 138 That puts the shorter segment into the right place.
@@ -151,7 +150,7 @@ exchange (char **argv, struct _getopt_data *d)
151 /* Swap it with the top part of the top segment. */ 150 /* Swap it with the top part of the top segment. */
152 for (i = 0; i < len; i++) 151 for (i = 0; i < len; i++)
153 { 152 {
154 tem = argv[bottom + i]; 153 char *tem = argv[bottom + i];
155 argv[bottom + i] = argv[top - (middle - bottom) + i]; 154 argv[bottom + i] = argv[top - (middle - bottom) + i];
156 argv[top - (middle - bottom) + i] = tem; 155 argv[top - (middle - bottom) + i] = tem;
157 } 156 }
@@ -167,7 +166,7 @@ exchange (char **argv, struct _getopt_data *d)
167 /* Swap it with the bottom part of the bottom segment. */ 166 /* Swap it with the bottom part of the bottom segment. */
168 for (i = 0; i < len; i++) 167 for (i = 0; i < len; i++)
169 { 168 {
170 tem = argv[bottom + i]; 169 char *tem = argv[bottom + i];
171 argv[bottom + i] = argv[middle + i]; 170 argv[bottom + i] = argv[middle + i];
172 argv[middle + i] = tem; 171 argv[middle + i] = tem;
173 } 172 }
@@ -196,28 +195,29 @@ process_long_option (int argc, char **argv, const char *optstring,
196 int long_only, struct _getopt_data *d, 195 int long_only, struct _getopt_data *d,
197 int print_errors, const char *prefix) 196 int print_errors, const char *prefix)
198{ 197{
199 char *nameend;
200 size_t namelen;
201 const struct option *p;
202 const struct option *pfound = NULL;
203 int n_options;
204 int option_index;
205 198
199 char *nameend;
206 for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++) 200 for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++)
207 /* Do nothing. */ ; 201 /* Do nothing. */ ;
208 namelen = nameend - d->__nextchar; 202 size_t namelen = nameend - d->__nextchar;
209 203
210 /* First look for an exact match, counting the options as a side 204 /* First look for an exact match, counting the options as a side
211 effect. */ 205 effect. */
212 for (p = longopts, n_options = 0; p->name; p++, n_options++) 206 const struct option *pfound = NULL;
213 if (!strncmp (p->name, d->__nextchar, namelen) 207 int n_options;
214 && namelen == strlen (p->name)) 208 int option_index;
215 { 209 {
216 /* Exact match found. */ 210 const struct option *p;
217 pfound = p; 211 for (p = longopts, n_options = 0; p->name; p++, n_options++)
218 option_index = n_options; 212 if (!strncmp (p->name, d->__nextchar, namelen)
219 break; 213 && namelen == strlen (p->name))
220 } 214 {
215 /* Exact match found. */
216 pfound = p;
217 option_index = n_options;
218 break;
219 }
220 }
221 221
222 if (pfound == NULL) 222 if (pfound == NULL)
223 { 223 {
@@ -227,6 +227,7 @@ process_long_option (int argc, char **argv, const char *optstring,
227 unsigned char ambig_fallback; 227 unsigned char ambig_fallback;
228 void *ambig_malloced = NULL; 228 void *ambig_malloced = NULL;
229 int indfound = -1; 229 int indfound = -1;
230 const struct option *p;
230 231
231 for (p = longopts, option_index = 0; p->name; p++, option_index++) 232 for (p = longopts, option_index = 0; p->name; p++, option_index++)
232 if (!strncmp (p->name, d->__nextchar, namelen)) 233 if (!strncmp (p->name, d->__nextchar, namelen))
@@ -475,11 +476,11 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
475 const struct option *longopts, int *longind, 476 const struct option *longopts, int *longind,
476 int long_only, struct _getopt_data *d, int posixly_correct) 477 int long_only, struct _getopt_data *d, int posixly_correct)
477{ 478{
478 int print_errors = d->opterr;
479
480 if (argc < 1) 479 if (argc < 1)
481 return -1; 480 return -1;
482 481
482 int print_errors = d->opterr;
483
483 d->optarg = NULL; 484 d->optarg = NULL;
484 485
485 if (d->optind == 0 || !d->__initialized) 486 if (d->optind == 0 || !d->__initialized)
@@ -594,11 +595,10 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
594 if (long_only && (argv[d->optind][2] 595 if (long_only && (argv[d->optind][2]
595 || !strchr (optstring, argv[d->optind][1]))) 596 || !strchr (optstring, argv[d->optind][1])))
596 { 597 {
597 int code;
598 d->__nextchar = argv[d->optind] + 1; 598 d->__nextchar = argv[d->optind] + 1;
599 code = process_long_option (argc, argv, optstring, longopts, 599 int code = process_long_option (argc, argv, optstring, longopts,
600 longind, long_only, d, 600 longind, long_only, d,
601 print_errors, "-"); 601 print_errors, "-");
602 if (code != -1) 602 if (code != -1)
603 return code; 603 return code;
604 } 604 }
@@ -707,14 +707,12 @@ _getopt_internal (int argc, char **argv, const char *optstring,
707 const struct option *longopts, int *longind, int long_only, 707 const struct option *longopts, int *longind, int long_only,
708 int posixly_correct) 708 int posixly_correct)
709{ 709{
710 int result;
711
712 getopt_data.optind = optind; 710 getopt_data.optind = optind;
713 getopt_data.opterr = opterr; 711 getopt_data.opterr = opterr;
714 712
715 result = _getopt_internal_r (argc, argv, optstring, longopts, 713 int result = _getopt_internal_r (argc, argv, optstring, longopts,
716 longind, long_only, &getopt_data, 714 longind, long_only, &getopt_data,
717 posixly_correct); 715 posixly_correct);
718 716
719 optind = getopt_data.optind; 717 optind = getopt_data.optind;
720 optarg = getopt_data.optarg; 718 optarg = getopt_data.optarg;
@@ -723,7 +721,7 @@ _getopt_internal (int argc, char **argv, const char *optstring,
723 return result; 721 return result;
724} 722}
725 723
726/* glibc gets a LSB-compliant getopt and a POSIX-complaint __posix_getopt. 724/* glibc gets a LSB-compliant getopt and a POSIX-compliant __posix_getopt.
727 Standalone applications just get a POSIX-compliant getopt. 725 Standalone applications just get a POSIX-compliant getopt.
728 POSIX and LSB both require these functions to take 'char *const *argv' 726 POSIX and LSB both require these functions to take 'char *const *argv'
729 even though this is incorrect (because of the permutation). */ 727 even though this is incorrect (because of the permutation). */
@@ -732,7 +730,7 @@ _getopt_internal (int argc, char **argv, const char *optstring,
732 NAME (int argc, char *const *argv, const char *optstring) \ 730 NAME (int argc, char *const *argv, const char *optstring) \
733 { \ 731 { \
734 return _getopt_internal (argc, (char **)argv, optstring, \ 732 return _getopt_internal (argc, (char **)argv, optstring, \
735 0, 0, 0, POSIXLY_CORRECT); \ 733 NULL, NULL, 0, POSIXLY_CORRECT); \
736 } 734 }
737 735
738#ifdef _LIBC 736#ifdef _LIBC
@@ -751,14 +749,13 @@ GETOPT_ENTRY(getopt, 1)
751int 749int
752main (int argc, char **argv) 750main (int argc, char **argv)
753{ 751{
754 int c;
755 int digit_optind = 0; 752 int digit_optind = 0;
756 753
757 while (1) 754 while (1)
758 { 755 {
759 int this_option_optind = optind ? optind : 1; 756 int this_option_optind = optind ? optind : 1;
760 757
761 c = getopt (argc, argv, "abc:d:0123456789"); 758 int c = getopt (argc, argv, "abc:d:0123456789");
762 if (c == -1) 759 if (c == -1)
763 break; 760 break;
764 761
diff --git a/gl/getopt.in.h b/gl/getopt.in.h
index c2411a75..e72a034b 100644
--- a/gl/getopt.in.h
+++ b/gl/getopt.in.h
@@ -1,5 +1,5 @@
1/* Declarations for getopt. 1/* Declarations for getopt.
2 Copyright (C) 1989-2024 Free Software Foundation, Inc. 2 Copyright (C) 1989-2026 Free Software Foundation, Inc.
3 This file is part of gnulib. 3 This file is part of gnulib.
4 Unlike most of the getopt implementation, it is NOT shared 4 Unlike most of the getopt implementation, it is NOT shared
5 with the GNU C Library, which supplies a different version of 5 with the GNU C Library, which supplies a different version of
@@ -30,7 +30,12 @@
30 <getopt.h>; our definitions will be present soon enough. */ 30 <getopt.h>; our definitions will be present soon enough. */
31#if @HAVE_GETOPT_H@ 31#if @HAVE_GETOPT_H@
32# define _GL_SYSTEM_GETOPT 32# define _GL_SYSTEM_GETOPT
33/* Rename the system's 'struct option' to 'struct sys_option',
34 so that we don't have to rename ours to 'struct rpl_option'
35 (which would cause significant trouble in C++ mode). */
36# define option sys_option
33# @INCLUDE_NEXT@ @NEXT_GETOPT_H@ 37# @INCLUDE_NEXT@ @NEXT_GETOPT_H@
38# undef option
34# undef _GL_SYSTEM_GETOPT 39# undef _GL_SYSTEM_GETOPT
35#endif 40#endif
36 41
diff --git a/gl/getopt1.c b/gl/getopt1.c
index c42d29f8..a5f99888 100644
--- a/gl/getopt1.c
+++ b/gl/getopt1.c
@@ -1,5 +1,5 @@
1/* getopt_long and getopt_long_only entry points for GNU getopt. 1/* getopt_long and getopt_long_only entry points for GNU getopt.
2 Copyright (C) 1987-2024 Free Software Foundation, Inc. 2 Copyright (C) 1987-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library and is also part of gnulib. 3 This file is part of the GNU C Library and is also part of gnulib.
4 Patches to this file should be submitted to both projects. 4 Patches to this file should be submitted to both projects.
5 5
@@ -73,7 +73,6 @@ _getopt_long_only_r (int argc, char **argv, const char *options,
73int 73int
74main (int argc, char **argv) 74main (int argc, char **argv)
75{ 75{
76 int c;
77 int digit_optind = 0; 76 int digit_optind = 0;
78 77
79 while (1) 78 while (1)
@@ -91,8 +90,8 @@ main (int argc, char **argv)
91 {0, 0, 0, 0} 90 {0, 0, 0, 0}
92 }; 91 };
93 92
94 c = getopt_long (argc, argv, "abc:d:0123456789", 93 int c = getopt_long (argc, argv, "abc:d:0123456789",
95 long_options, &option_index); 94 long_options, &option_index);
96 if (c == -1) 95 if (c == -1)
97 break; 96 break;
98 97
diff --git a/gl/getopt_int.h b/gl/getopt_int.h
index c00c0b69..023d8a4f 100644
--- a/gl/getopt_int.h
+++ b/gl/getopt_int.h
@@ -1,5 +1,5 @@
1/* Internal declarations for getopt. 1/* Internal declarations for getopt.
2 Copyright (C) 1989-2024 Free Software Foundation, Inc. 2 Copyright (C) 1989-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library and is also part of gnulib. 3 This file is part of the GNU C Library and is also part of gnulib.
4 Patches to this file should be submitted to both projects. 4 Patches to this file should be submitted to both projects.
5 5
diff --git a/gl/getprogname.c b/gl/getprogname.c
index 392a9a2f..8eec96c5 100644
--- a/gl/getprogname.c
+++ b/gl/getprogname.c
@@ -1,5 +1,5 @@
1/* Program name management. 1/* Program name management.
2 Copyright (C) 2016-2024 Free Software Foundation, Inc. 2 Copyright (C) 2016-2026 Free Software Foundation, Inc.
3 3
4 This program is free software: you can redistribute it and/or modify 4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by 5 it under the terms of the GNU Lesser General Public License as published by
@@ -42,14 +42,6 @@
42# include <string.h> 42# include <string.h>
43#endif 43#endif
44 44
45#if defined __sgi || defined __osf__
46# include <string.h>
47# include <unistd.h>
48# include <stdio.h>
49# include <fcntl.h>
50# include <sys/procfs.h>
51#endif
52
53#if defined __SCO_VERSION__ || defined __sysv5__ 45#if defined __SCO_VERSION__ || defined __sysv5__
54# include <fcntl.h> 46# include <fcntl.h>
55# include <string.h> 47# include <string.h>
@@ -137,7 +129,7 @@ getprogname (void)
137 else 129 else
138 p = cmd; 130 p = cmd;
139 if (strlen (p) > PST_UCOMMLEN - 1 131 if (strlen (p) > PST_UCOMMLEN - 1
140 && memcmp (p, ucomm, PST_UCOMMLEN - 1) == 0) 132 && memeq (p, ucomm, PST_UCOMMLEN - 1))
141 /* p is less truncated than ucomm. */ 133 /* p is less truncated than ucomm. */
142 ; 134 ;
143 else 135 else
@@ -173,7 +165,7 @@ getprogname (void)
173 else 165 else
174 p = cmd; 166 p = cmd;
175 if (strlen (p) > PST_UCOMMLEN - 1 167 if (strlen (p) > PST_UCOMMLEN - 1
176 && memcmp (p, ucomm, PST_UCOMMLEN - 1) == 0) 168 && memeq (p, ucomm, PST_UCOMMLEN - 1))
177 /* p is less truncated than ucomm. */ 169 /* p is less truncated than ucomm. */
178 ; 170 ;
179 else 171 else
@@ -196,7 +188,6 @@ getprogname (void)
196 if (first) 188 if (first)
197 { 189 {
198 pid_t pid = getpid (); 190 pid_t pid = getpid ();
199 int token;
200 W_PSPROC buf; 191 W_PSPROC buf;
201 first = 0; 192 first = 0;
202 memset (&buf, 0, sizeof(buf)); 193 memset (&buf, 0, sizeof(buf));
@@ -205,7 +196,8 @@ getprogname (void)
205 buf.ps_pathptr = (char *) malloc (buf.ps_pathlen = PS_PATHBLEN); 196 buf.ps_pathptr = (char *) malloc (buf.ps_pathlen = PS_PATHBLEN);
206 if (buf.ps_cmdptr && buf.ps_conttyptr && buf.ps_pathptr) 197 if (buf.ps_cmdptr && buf.ps_conttyptr && buf.ps_pathptr)
207 { 198 {
208 for (token = 0; token >= 0; 199 for (int token = 0;
200 token >= 0;
209 token = w_getpsent (token, &buf, sizeof(buf))) 201 token = w_getpsent (token, &buf, sizeof(buf)))
210 { 202 {
211 if (token > 0 && buf.ps_pid == pid) 203 if (token > 0 && buf.ps_pid == pid)
@@ -234,60 +226,22 @@ getprogname (void)
234 free (buf.ps_pathptr); 226 free (buf.ps_pathptr);
235 } 227 }
236 return p; 228 return p;
237# elif defined __sgi || defined __osf__ /* IRIX or Tru64 */
238 char filename[50];
239 int fd;
240
241 # if defined __sgi
242 sprintf (filename, "/proc/pinfo/%d", (int) getpid ());
243 # else
244 sprintf (filename, "/proc/%d", (int) getpid ());
245 # endif
246 fd = open (filename, O_RDONLY | O_CLOEXEC);
247 if (0 <= fd)
248 {
249 prpsinfo_t buf;
250 int ioctl_ok = 0 <= ioctl (fd, PIOCPSINFO, &buf);
251 close (fd);
252 if (ioctl_ok)
253 {
254 char *name = buf.pr_fname;
255 size_t namesize = sizeof buf.pr_fname;
256 /* It may not be NUL-terminated. */
257 char *namenul = memchr (name, '\0', namesize);
258 size_t namelen = namenul ? namenul - name : namesize;
259 char *namecopy = malloc (namelen + 1);
260 if (namecopy)
261 {
262 namecopy[namelen] = '\0';
263 return memcpy (namecopy, name, namelen);
264 }
265 }
266 }
267 return NULL;
268# elif defined __SCO_VERSION__ || defined __sysv5__ /* SCO OpenServer6/UnixWare */ 229# elif defined __SCO_VERSION__ || defined __sysv5__ /* SCO OpenServer6/UnixWare */
269 char buf[80]; 230 char buf[80];
270 int fd;
271 sprintf (buf, "/proc/%d/cmdline", getpid()); 231 sprintf (buf, "/proc/%d/cmdline", getpid());
272 fd = open (buf, O_RDONLY); 232 int fd = open (buf, O_RDONLY);
273 if (0 <= fd) 233 if (0 <= fd)
274 { 234 {
275 size_t n = read (fd, buf, 79); 235 size_t n = read (fd, buf, 79);
276 if (n > 0) 236 if (n > 0)
277 { 237 {
278 buf[n] = '\0'; /* Guarantee null-termination */ 238 buf[n] = '\0'; /* Guarantee null-termination */
279 char *progname; 239 char *progname = strrchr (buf, '/');
280 progname = strrchr (buf, '/');
281 if (progname) 240 if (progname)
282 { 241 progname = progname + 1; /* Skip the '/' */
283 progname = progname + 1; /* Skip the '/' */
284 }
285 else 242 else
286 { 243 progname = buf;
287 progname = buf; 244 char *ret = malloc (strlen (progname) + 1);
288 }
289 char *ret;
290 ret = malloc (strlen (progname) + 1);
291 if (ret) 245 if (ret)
292 { 246 {
293 strcpy (ret, progname); 247 strcpy (ret, progname);
diff --git a/gl/getprogname.h b/gl/getprogname.h
index bee1c1a2..3b5e502e 100644
--- a/gl/getprogname.h
+++ b/gl/getprogname.h
@@ -1,5 +1,5 @@
1/* Program name management. 1/* Program name management.
2 Copyright (C) 2016-2024 Free Software Foundation, Inc. 2 Copyright (C) 2016-2026 Free Software Foundation, Inc.
3 3
4 This program is free software: you can redistribute it and/or modify 4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by 5 it under the terms of the GNU Lesser General Public License as published by
diff --git a/gl/gettext.h b/gl/gettext.h
index 39d5ae4d..0291cf09 100644
--- a/gl/gettext.h
+++ b/gl/gettext.h
@@ -1,6 +1,5 @@
1/* Convenience header for conditional use of GNU <libintl.h>. 1/* Convenience header for conditional use of GNU <libintl.h>.
2 Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2024 Free Software 2 Copyright (C) 1995-2026 Free Software Foundation, Inc.
3 Foundation, Inc.
4 3
5 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -18,6 +17,7 @@
18#ifndef _LIBGETTEXT_H 17#ifndef _LIBGETTEXT_H
19#define _LIBGETTEXT_H 1 18#define _LIBGETTEXT_H 1
20 19
20
21/* NLS can be disabled through the configure --disable-nls option 21/* NLS can be disabled through the configure --disable-nls option
22 or through "#define ENABLE NLS 0" before including this file. */ 22 or through "#define ENABLE NLS 0" before including this file. */
23#if defined ENABLE_NLS && ENABLE_NLS 23#if defined ENABLE_NLS && ENABLE_NLS
@@ -45,32 +45,90 @@
45 as well because people using "gettext.h" will not include <libintl.h>, 45 as well because people using "gettext.h" will not include <libintl.h>,
46 and also including <libintl.h> would fail on SunOS 4, whereas <locale.h> 46 and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
47 is OK. */ 47 is OK. */
48#if defined(__sun) 48# if defined(__sun)
49# include <locale.h> 49# include <locale.h>
50#endif 50# endif
51 51
52/* Many header files from the libstdc++ coming with g++ 3.3 or newer include 52/* Many header files from the libstdc++ coming with g++ 3.3 or newer include
53 <libintl.h>, which chokes if dcgettext is defined as a macro. So include 53 <libintl.h>, which chokes if dcgettext is defined as a macro. So include
54 it now, to make later inclusions of <libintl.h> a NOP. */ 54 it now, to make later inclusions of <libintl.h> a NOP. */
55#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) 55# if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
56# include <cstdlib> 56# include <cstdlib>
57# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H 57# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H
58# include <libintl.h> 58# include <libintl.h>
59# endif
59# endif 60# endif
60#endif
61 61
62/* Disabled NLS. 62/* Disabled NLS. */
63 The casts to 'const char *' serve the purpose of producing warnings 63# if defined __GNUC__ && !defined __clang__ && !defined __cplusplus
64 for invalid uses of the value returned from these functions. 64/* Use inline functions, to avoid warnings
65 On pre-ANSI systems without 'const', the config.h file is supposed to 65 warning: format not a string literal and no format arguments
66 contain "#define const". */ 66 that don't occur with enabled NLS. */
67# undef gettext 67/* The return type 'const char *' serves the purpose of producing warnings
68# define gettext(Msgid) ((const char *) (Msgid)) 68 for invalid uses of the value returned from these functions. */
69# undef dgettext 69# if __GNUC__ >= 9
70# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) 70# pragma GCC diagnostic push
71# undef dcgettext 71# pragma GCC diagnostic ignored "-Wbuiltin-declaration-mismatch"
72# define dcgettext(Domainname, Msgid, Category) \ 72# endif
73 ((void) (Category), dgettext (Domainname, Msgid)) 73# if __GNUC__ + (__GNUC_MINOR__ >= 2) > 4
74__attribute__ ((__always_inline__, __gnu_inline__))
75# else
76__attribute__ ((__always_inline__))
77# endif
78extern inline
79# if !defined(__sun)
80const
81# endif
82char *
83gettext (const char *msgid)
84{
85 return msgid;
86}
87# if __GNUC__ + (__GNUC_MINOR__ >= 2) > 4
88__attribute__ ((__always_inline__, __gnu_inline__))
89# else
90__attribute__ ((__always_inline__))
91# endif
92extern inline
93# if !defined(__sun)
94const
95# endif
96char *
97dgettext (const char *domain, const char *msgid)
98{
99 (void) domain;
100 return msgid;
101}
102# if __GNUC__ + (__GNUC_MINOR__ >= 2) > 4
103__attribute__ ((__always_inline__, __gnu_inline__))
104# else
105__attribute__ ((__always_inline__))
106# endif
107extern inline
108# if !defined(__sun)
109const
110# endif
111char *
112dcgettext (const char *domain, const char *msgid, int category)
113{
114 (void) domain;
115 (void) category;
116 return msgid;
117}
118# if __GNUC__ >= 9
119# pragma GCC diagnostic pop
120# endif
121# else
122/* The casts to 'const char *' serve the purpose of producing warnings
123 for invalid uses of the value returned from these functions. */
124# undef gettext
125# define gettext(Msgid) ((const char *) (Msgid))
126# undef dgettext
127# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
128# undef dcgettext
129# define dcgettext(Domainname, Msgid, Category) \
130 ((void) (Category), dgettext (Domainname, Msgid))
131# endif
74# undef ngettext 132# undef ngettext
75# define ngettext(Msgid1, Msgid2, N) \ 133# define ngettext(Msgid1, Msgid2, N) \
76 ((N) == 1 \ 134 ((N) == 1 \
@@ -93,12 +151,14 @@
93 151
94#endif 152#endif
95 153
154
96/* Prefer gnulib's setlocale override over libintl's setlocale override. */ 155/* Prefer gnulib's setlocale override over libintl's setlocale override. */
97#ifdef GNULIB_defined_setlocale 156#ifdef GNULIB_defined_setlocale
98# undef setlocale 157# undef setlocale
99# define setlocale rpl_setlocale 158# define setlocale rpl_setlocale
100#endif 159#endif
101 160
161
102/* A pseudo function call that serves as a marker for the automated 162/* A pseudo function call that serves as a marker for the automated
103 extraction of messages, but does not call gettext(). The run-time 163 extraction of messages, but does not call gettext(). The run-time
104 translation is done at a different place in the code. 164 translation is done at a different place in the code.
@@ -108,6 +168,7 @@
108 initializer for static 'char[]' or 'const char[]' variables. */ 168 initializer for static 'char[]' or 'const char[]' variables. */
109#define gettext_noop(String) String 169#define gettext_noop(String) String
110 170
171
111/* The separator between msgctxt and msgid in a .mo file. */ 172/* The separator between msgctxt and msgid in a .mo file. */
112#define GETTEXT_CONTEXT_GLUE "\004" 173#define GETTEXT_CONTEXT_GLUE "\004"
113 174
@@ -115,6 +176,9 @@
115 MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be 176 MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be
116 short and rarely need to change. 177 short and rarely need to change.
117 The letter 'p' stands for 'particular' or 'special'. */ 178 The letter 'p' stands for 'particular' or 'special'. */
179
180#include <locale.h> /* for LC_MESSAGES */
181
118#ifdef DEFAULT_TEXT_DOMAIN 182#ifdef DEFAULT_TEXT_DOMAIN
119# define pgettext(Msgctxt, Msgid) \ 183# define pgettext(Msgctxt, Msgid) \
120 pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) 184 pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
@@ -178,11 +242,12 @@ npgettext_aux (const char *domain,
178 return translation; 242 return translation;
179} 243}
180 244
245
181/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID 246/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID
182 can be arbitrary expressions. But for string literals these macros are 247 can be arbitrary expressions. But for string literals these macros are
183 less efficient than those above. */ 248 less efficient than those above. */
184 249
185#include <string.h> 250#include <string.h> /* for memcpy */
186 251
187/* GNULIB_NO_VLA can be defined to disable use of VLAs even if supported. 252/* GNULIB_NO_VLA can be defined to disable use of VLAs even if supported.
188 This relates to the -Wvla and -Wvla-larger-than warnings, enabled in 253 This relates to the -Wvla and -Wvla-larger-than warnings, enabled in
@@ -199,7 +264,7 @@ npgettext_aux (const char *domain,
199#endif 264#endif
200 265
201#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 266#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
202#include <stdlib.h> 267# include <stdlib.h> /* for malloc, free */
203#endif 268#endif
204 269
205#define pgettext_expr(Msgctxt, Msgid) \ 270#define pgettext_expr(Msgctxt, Msgid) \
@@ -233,12 +298,11 @@ dcpgettext_expr (const char *domain,
233 if (msg_ctxt_id != NULL) 298 if (msg_ctxt_id != NULL)
234#endif 299#endif
235 { 300 {
236 int found_translation;
237 memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); 301 memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
238 msg_ctxt_id[msgctxt_len - 1] = '\004'; 302 msg_ctxt_id[msgctxt_len - 1] = '\004';
239 memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); 303 memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
240 translation = dcgettext (domain, msg_ctxt_id, category); 304 translation = dcgettext (domain, msg_ctxt_id, category);
241 found_translation = (translation != msg_ctxt_id); 305 int found_translation = (translation != msg_ctxt_id);
242#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 306#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
243 if (msg_ctxt_id != buf) 307 if (msg_ctxt_id != buf)
244 free (msg_ctxt_id); 308 free (msg_ctxt_id);
@@ -281,12 +345,11 @@ dcnpgettext_expr (const char *domain,
281 if (msg_ctxt_id != NULL) 345 if (msg_ctxt_id != NULL)
282#endif 346#endif
283 { 347 {
284 int found_translation;
285 memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); 348 memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
286 msg_ctxt_id[msgctxt_len - 1] = '\004'; 349 msg_ctxt_id[msgctxt_len - 1] = '\004';
287 memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); 350 memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
288 translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); 351 translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
289 found_translation = !(translation == msg_ctxt_id || translation == msgid_plural); 352 int found_translation = !(translation == msg_ctxt_id || translation == msgid_plural);
290#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 353#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
291 if (msg_ctxt_id != buf) 354 if (msg_ctxt_id != buf)
292 free (msg_ctxt_id); 355 free (msg_ctxt_id);
@@ -297,4 +360,5 @@ dcnpgettext_expr (const char *domain,
297 return (n == 1 ? msgid : msgid_plural); 360 return (n == 1 ? msgid : msgid_plural);
298} 361}
299 362
363
300#endif /* _LIBGETTEXT_H */ 364#endif /* _LIBGETTEXT_H */
diff --git a/gl/gl_openssl.h b/gl/gl_openssl.h
index 06864732..06fd8f66 100644
--- a/gl/gl_openssl.h
+++ b/gl/gl_openssl.h
@@ -1,6 +1,6 @@
1/* Wrap openssl crypto hash routines in gnulib interface. -*- coding: utf-8 -*- 1/* Wrap openssl crypto hash routines in gnulib interface. -*- coding: utf-8 -*-
2 2
3 Copyright (C) 2013-2024 Free Software Foundation, Inc. 3 Copyright (C) 2013-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -103,7 +103,7 @@ GL_OPENSSL_INLINE void *
103GL_CRYPTO_FN (_read_ctx) (const struct _gl_ctx *ctx, void *restrict res) 103GL_CRYPTO_FN (_read_ctx) (const struct _gl_ctx *ctx, void *restrict res)
104{ 104{
105 /* Assume any unprocessed bytes in ctx are not to be ignored. */ 105 /* Assume any unprocessed bytes in ctx are not to be ignored. */
106 _gl_CTX tmp_ctx = *(_gl_CTX *) ctx; 106 _gl_CTX tmp_ctx = *(_gl_CTX const *) ctx;
107 OPENSSL_FN (_Final) ((unsigned char *) res, &tmp_ctx); 107 OPENSSL_FN (_Final) ((unsigned char *) res, &tmp_ctx);
108 return res; 108 return res;
109} 109}
diff --git a/gl/glthread/lock.c b/gl/glthread/lock.c
index 6661ad6a..cfb9393c 100644
--- a/gl/glthread/lock.c
+++ b/gl/glthread/lock.c
@@ -1,5 +1,5 @@
1/* Locking in multithreaded situations. 1/* Locking in multithreaded situations.
2 Copyright (C) 2005-2024 Free Software Foundation, Inc. 2 Copyright (C) 2005-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -240,8 +240,6 @@ glthread_recursive_lock_destroy (gl_recursive_lock_t *lock)
240 return 0; 240 return 0;
241} 241}
242 242
243/* -------------------------- gl_once_t datatype -------------------------- */
244
245#endif 243#endif
246 244
247/* ========================================================================= */ 245/* ========================================================================= */
@@ -257,21 +255,19 @@ glthread_recursive_lock_destroy (gl_recursive_lock_t *lock)
257# if defined PTHREAD_RWLOCK_INITIALIZER || defined PTHREAD_RWLOCK_INITIALIZER_NP 255# if defined PTHREAD_RWLOCK_INITIALIZER || defined PTHREAD_RWLOCK_INITIALIZER_NP
258 256
259# if !HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER 257# if !HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER
260 /* glibc with bug https://sourceware.org/bugzilla/show_bug.cgi?id=13701 */ 258 /* glibc with bug https://sourceware.org/PR13701 */
261 259
262int 260int
263glthread_rwlock_init_for_glibc (pthread_rwlock_t *lock) 261glthread_rwlock_init_for_glibc (pthread_rwlock_t *lock)
264{ 262{
265 pthread_rwlockattr_t attributes; 263 pthread_rwlockattr_t attributes;
266 int err; 264 int err = pthread_rwlockattr_init (&attributes);
267
268 err = pthread_rwlockattr_init (&attributes);
269 if (err != 0) 265 if (err != 0)
270 return err; 266 return err;
271 /* Note: PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP is the only value that 267 /* Note: PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP is the only value that
272 causes the writer to be preferred. PTHREAD_RWLOCK_PREFER_WRITER_NP does not 268 causes the writer to be preferred. PTHREAD_RWLOCK_PREFER_WRITER_NP does not
273 do this; see 269 do this; see
274 http://man7.org/linux/man-pages/man3/pthread_rwlockattr_setkind_np.3.html */ 270 https://man7.org/linux/man-pages/man3/pthread_rwlockattr_setkind_np.3.html */
275 err = pthread_rwlockattr_setkind_np (&attributes, 271 err = pthread_rwlockattr_setkind_np (&attributes,
276 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); 272 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
277 if (err == 0) 273 if (err == 0)
@@ -288,9 +284,7 @@ glthread_rwlock_init_for_glibc (pthread_rwlock_t *lock)
288int 284int
289glthread_rwlock_init_multithreaded (gl_rwlock_t *lock) 285glthread_rwlock_init_multithreaded (gl_rwlock_t *lock)
290{ 286{
291 int err; 287 int err = pthread_rwlock_init (&lock->rwlock, NULL);
292
293 err = pthread_rwlock_init (&lock->rwlock, NULL);
294 if (err != 0) 288 if (err != 0)
295 return err; 289 return err;
296 lock->initialized = 1; 290 lock->initialized = 1;
@@ -302,9 +296,7 @@ glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock)
302{ 296{
303 if (!lock->initialized) 297 if (!lock->initialized)
304 { 298 {
305 int err; 299 int err = pthread_mutex_lock (&lock->guard);
306
307 err = pthread_mutex_lock (&lock->guard);
308 if (err != 0) 300 if (err != 0)
309 return err; 301 return err;
310 if (!lock->initialized) 302 if (!lock->initialized)
@@ -328,9 +320,7 @@ glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock)
328{ 320{
329 if (!lock->initialized) 321 if (!lock->initialized)
330 { 322 {
331 int err; 323 int err = pthread_mutex_lock (&lock->guard);
332
333 err = pthread_mutex_lock (&lock->guard);
334 if (err != 0) 324 if (err != 0)
335 return err; 325 return err;
336 if (!lock->initialized) 326 if (!lock->initialized)
@@ -360,11 +350,9 @@ glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock)
360int 350int
361glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock) 351glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock)
362{ 352{
363 int err;
364
365 if (!lock->initialized) 353 if (!lock->initialized)
366 return EINVAL; 354 return EINVAL;
367 err = pthread_rwlock_destroy (&lock->rwlock); 355 int err = pthread_rwlock_destroy (&lock->rwlock);
368 if (err != 0) 356 if (err != 0)
369 return err; 357 return err;
370 lock->initialized = 0; 358 lock->initialized = 0;
@@ -378,9 +366,7 @@ glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock)
378int 366int
379glthread_rwlock_init_multithreaded (gl_rwlock_t *lock) 367glthread_rwlock_init_multithreaded (gl_rwlock_t *lock)
380{ 368{
381 int err; 369 int err = pthread_mutex_init (&lock->lock, NULL);
382
383 err = pthread_mutex_init (&lock->lock, NULL);
384 if (err != 0) 370 if (err != 0)
385 return err; 371 return err;
386 err = pthread_cond_init (&lock->waiting_readers, NULL); 372 err = pthread_cond_init (&lock->waiting_readers, NULL);
@@ -397,9 +383,7 @@ glthread_rwlock_init_multithreaded (gl_rwlock_t *lock)
397int 383int
398glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock) 384glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock)
399{ 385{
400 int err; 386 int err = pthread_mutex_lock (&lock->lock);
401
402 err = pthread_mutex_lock (&lock->lock);
403 if (err != 0) 387 if (err != 0)
404 return err; 388 return err;
405 /* Test whether only readers are currently running, and whether the runcount 389 /* Test whether only readers are currently running, and whether the runcount
@@ -424,9 +408,7 @@ glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock)
424int 408int
425glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock) 409glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock)
426{ 410{
427 int err; 411 int err = pthread_mutex_lock (&lock->lock);
428
429 err = pthread_mutex_lock (&lock->lock);
430 if (err != 0) 412 if (err != 0)
431 return err; 413 return err;
432 /* Test whether no readers or writers are currently running. */ 414 /* Test whether no readers or writers are currently running. */
@@ -451,9 +433,7 @@ glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock)
451int 433int
452glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock) 434glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock)
453{ 435{
454 int err; 436 int err = pthread_mutex_lock (&lock->lock);
455
456 err = pthread_mutex_lock (&lock->lock);
457 if (err != 0) 437 if (err != 0)
458 return err; 438 return err;
459 if (lock->runcount < 0) 439 if (lock->runcount < 0)
@@ -507,9 +487,7 @@ glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock)
507int 487int
508glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock) 488glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock)
509{ 489{
510 int err; 490 int err = pthread_mutex_destroy (&lock->lock);
511
512 err = pthread_mutex_destroy (&lock->lock);
513 if (err != 0) 491 if (err != 0)
514 return err; 492 return err;
515 err = pthread_cond_destroy (&lock->waiting_readers); 493 err = pthread_cond_destroy (&lock->waiting_readers);
@@ -533,9 +511,7 @@ int
533glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock) 511glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock)
534{ 512{
535 pthread_mutexattr_t attributes; 513 pthread_mutexattr_t attributes;
536 int err; 514 int err = pthread_mutexattr_init (&attributes);
537
538 err = pthread_mutexattr_init (&attributes);
539 if (err != 0) 515 if (err != 0)
540 return err; 516 return err;
541 err = pthread_mutexattr_settype (&attributes, PTHREAD_MUTEX_RECURSIVE); 517 err = pthread_mutexattr_settype (&attributes, PTHREAD_MUTEX_RECURSIVE);
@@ -562,9 +538,7 @@ int
562glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock) 538glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock)
563{ 539{
564 pthread_mutexattr_t attributes; 540 pthread_mutexattr_t attributes;
565 int err; 541 int err = pthread_mutexattr_init (&attributes);
566
567 err = pthread_mutexattr_init (&attributes);
568 if (err != 0) 542 if (err != 0)
569 return err; 543 return err;
570 err = pthread_mutexattr_settype (&attributes, PTHREAD_MUTEX_RECURSIVE); 544 err = pthread_mutexattr_settype (&attributes, PTHREAD_MUTEX_RECURSIVE);
@@ -591,9 +565,7 @@ glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock)
591{ 565{
592 if (!lock->initialized) 566 if (!lock->initialized)
593 { 567 {
594 int err; 568 int err = pthread_mutex_lock (&lock->guard);
595
596 err = pthread_mutex_lock (&lock->guard);
597 if (err != 0) 569 if (err != 0)
598 return err; 570 return err;
599 if (!lock->initialized) 571 if (!lock->initialized)
@@ -623,11 +595,9 @@ glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock)
623int 595int
624glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock) 596glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock)
625{ 597{
626 int err;
627
628 if (!lock->initialized) 598 if (!lock->initialized)
629 return EINVAL; 599 return EINVAL;
630 err = pthread_mutex_destroy (&lock->recmutex); 600 int err = pthread_mutex_destroy (&lock->recmutex);
631 if (err != 0) 601 if (err != 0)
632 return err; 602 return err;
633 lock->initialized = 0; 603 lock->initialized = 0;
@@ -641,9 +611,7 @@ glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock)
641int 611int
642glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock) 612glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock)
643{ 613{
644 int err; 614 int err = pthread_mutex_init (&lock->mutex, NULL);
645
646 err = pthread_mutex_init (&lock->mutex, NULL);
647 if (err != 0) 615 if (err != 0)
648 return err; 616 return err;
649 lock->owner = (pthread_t) 0; 617 lock->owner = (pthread_t) 0;
@@ -657,9 +625,7 @@ glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock)
657 pthread_t self = pthread_self (); 625 pthread_t self = pthread_self ();
658 if (lock->owner != self) 626 if (lock->owner != self)
659 { 627 {
660 int err; 628 int err = pthread_mutex_lock (&lock->mutex);
661
662 err = pthread_mutex_lock (&lock->mutex);
663 if (err != 0) 629 if (err != 0)
664 return err; 630 return err;
665 lock->owner = self; 631 lock->owner = self;
@@ -698,46 +664,6 @@ glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock)
698 664
699# endif 665# endif
700 666
701/* -------------------------- gl_once_t datatype -------------------------- */
702
703static const pthread_once_t fresh_once = PTHREAD_ONCE_INIT;
704
705int
706glthread_once_singlethreaded (pthread_once_t *once_control)
707{
708 /* We don't know whether pthread_once_t is an integer type, a floating-point
709 type, a pointer type, or a structure type. */
710 char *firstbyte = (char *)once_control;
711 if (*firstbyte == *(const char *)&fresh_once)
712 {
713 /* First time use of once_control. Invert the first byte. */
714 *firstbyte = ~ *(const char *)&fresh_once;
715 return 1;
716 }
717 else
718 return 0;
719}
720
721# if !(PTHREAD_IN_USE_DETECTION_HARD || USE_POSIX_THREADS_WEAK)
722
723int
724glthread_once_multithreaded (pthread_once_t *once_control,
725 void (*init_function) (void))
726{
727 int err = pthread_once (once_control, init_function);
728 if (err == ENOSYS)
729 {
730 /* This happens on FreeBSD 11: The pthread_once function in libc returns
731 ENOSYS. */
732 if (glthread_once_singlethreaded (once_control))
733 init_function ();
734 return 0;
735 }
736 return err;
737}
738
739# endif
740
741#endif 667#endif
742 668
743/* ========================================================================= */ 669/* ========================================================================= */
diff --git a/gl/glthread/lock.h b/gl/glthread/lock.h
index 2d5cb320..d8190b6c 100644
--- a/gl/glthread/lock.h
+++ b/gl/glthread/lock.h
@@ -1,5 +1,5 @@
1/* Locking in multithreaded situations. 1/* Locking in multithreaded situations.
2 Copyright (C) 2005-2024 Free Software Foundation, Inc. 2 Copyright (C) 2005-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -64,13 +64,6 @@
64 Taking the lock: err = glthread_recursive_lock_lock (&name); 64 Taking the lock: err = glthread_recursive_lock_lock (&name);
65 Releasing the lock: err = glthread_recursive_lock_unlock (&name); 65 Releasing the lock: err = glthread_recursive_lock_unlock (&name);
66 De-initialization: err = glthread_recursive_lock_destroy (&name); 66 De-initialization: err = glthread_recursive_lock_destroy (&name);
67
68 Once-only execution:
69 Type: gl_once_t
70 Initializer: gl_once_define(extern, name)
71 Execution: gl_once (name, initfunction);
72 Equivalent functions with control of error handling:
73 Execution: err = glthread_once (&name, initfunction);
74*/ 67*/
75 68
76 69
@@ -88,17 +81,9 @@
88#include <errno.h> 81#include <errno.h>
89#include <stdlib.h> 82#include <stdlib.h>
90 83
91#if !defined c11_threads_in_use 84#include "glthread/once.h"
92# if HAVE_THREADS_H && USE_POSIX_THREADS_FROM_LIBC 85
93# define c11_threads_in_use() 1 86/* c11_threads_in_use() is defined in glthread/once.h. */
94# elif HAVE_THREADS_H && USE_POSIX_THREADS_WEAK
95# include <threads.h>
96# pragma weak thrd_exit
97# define c11_threads_in_use() (thrd_exit != NULL)
98# else
99# define c11_threads_in_use() 0
100# endif
101#endif
102 87
103/* ========================================================================= */ 88/* ========================================================================= */
104 89
@@ -195,14 +180,6 @@ extern int glthread_recursive_lock_lock (gl_recursive_lock_t *lock);
195extern int glthread_recursive_lock_unlock (gl_recursive_lock_t *lock); 180extern int glthread_recursive_lock_unlock (gl_recursive_lock_t *lock);
196extern int glthread_recursive_lock_destroy (gl_recursive_lock_t *lock); 181extern int glthread_recursive_lock_destroy (gl_recursive_lock_t *lock);
197 182
198/* -------------------------- gl_once_t datatype -------------------------- */
199
200typedef once_flag gl_once_t;
201# define gl_once_define(STORAGECLASS, NAME) \
202 STORAGECLASS once_flag NAME = ONCE_FLAG_INIT;
203# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
204 (call_once (ONCE_CONTROL, INITFUNCTION), 0)
205
206# ifdef __cplusplus 183# ifdef __cplusplus
207} 184}
208# endif 185# endif
@@ -221,80 +198,7 @@ typedef once_flag gl_once_t;
221extern "C" { 198extern "C" {
222# endif 199# endif
223 200
224# if PTHREAD_IN_USE_DETECTION_HARD 201/* pthread_in_use() is defined in glthread/once.h. */
225
226/* The pthread_in_use() detection needs to be done at runtime. */
227# define pthread_in_use() \
228 glthread_in_use ()
229extern int glthread_in_use (void);
230
231# endif
232
233# if USE_POSIX_THREADS_WEAK
234
235/* Use weak references to the POSIX threads library. */
236
237/* Weak references avoid dragging in external libraries if the other parts
238 of the program don't use them. Here we use them, because we don't want
239 every program that uses libintl to depend on libpthread. This assumes
240 that libpthread would not be loaded after libintl; i.e. if libintl is
241 loaded first, by an executable that does not depend on libpthread, and
242 then a module is dynamically loaded that depends on libpthread, libintl
243 will not be multithread-safe. */
244
245/* The way to test at runtime whether libpthread is present is to test
246 whether a function pointer's value, such as &pthread_mutex_init, is
247 non-NULL. However, some versions of GCC have a bug through which, in
248 PIC mode, &foo != NULL always evaluates to true if there is a direct
249 call to foo(...) in the same function. To avoid this, we test the
250 address of a function in libpthread that we don't use. */
251
252# pragma weak pthread_mutex_init
253# pragma weak pthread_mutex_lock
254# pragma weak pthread_mutex_unlock
255# pragma weak pthread_mutex_destroy
256# pragma weak pthread_rwlock_init
257# pragma weak pthread_rwlock_rdlock
258# pragma weak pthread_rwlock_wrlock
259# pragma weak pthread_rwlock_unlock
260# pragma weak pthread_rwlock_destroy
261# pragma weak pthread_once
262# pragma weak pthread_cond_init
263# pragma weak pthread_cond_wait
264# pragma weak pthread_cond_signal
265# pragma weak pthread_cond_broadcast
266# pragma weak pthread_cond_destroy
267# pragma weak pthread_mutexattr_init
268# pragma weak pthread_mutexattr_settype
269# pragma weak pthread_mutexattr_destroy
270# pragma weak pthread_rwlockattr_init
271# if __GNU_LIBRARY__ > 1
272# pragma weak pthread_rwlockattr_setkind_np
273# endif
274# pragma weak pthread_rwlockattr_destroy
275# ifndef pthread_self
276# pragma weak pthread_self
277# endif
278
279# if !PTHREAD_IN_USE_DETECTION_HARD
280 /* Considering all platforms with USE_POSIX_THREADS_WEAK, only few symbols
281 can be used to determine whether libpthread is in use. These are:
282 pthread_mutexattr_gettype
283 pthread_rwlockattr_destroy
284 pthread_rwlockattr_init
285 */
286# pragma weak pthread_mutexattr_gettype
287# define pthread_in_use() \
288 (pthread_mutexattr_gettype != NULL || c11_threads_in_use ())
289# endif
290
291# else
292
293# if !PTHREAD_IN_USE_DETECTION_HARD
294# define pthread_in_use() 1
295# endif
296
297# endif
298 202
299/* -------------------------- gl_lock_t datatype -------------------------- */ 203/* -------------------------- gl_lock_t datatype -------------------------- */
300 204
@@ -335,7 +239,7 @@ typedef pthread_rwlock_t gl_rwlock_t;
335# endif 239# endif
336# define glthread_rwlock_init(LOCK) \ 240# define glthread_rwlock_init(LOCK) \
337 (pthread_in_use () ? pthread_rwlock_init (LOCK, NULL) : 0) 241 (pthread_in_use () ? pthread_rwlock_init (LOCK, NULL) : 0)
338# else /* glibc with bug https://sourceware.org/bugzilla/show_bug.cgi?id=13701 */ 242# else /* glibc with bug https://sourceware.org/PR13701 */
339# define gl_rwlock_initializer \ 243# define gl_rwlock_initializer \
340 PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP 244 PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
341# define glthread_rwlock_init(LOCK) \ 245# define glthread_rwlock_init(LOCK) \
@@ -510,26 +414,6 @@ extern int glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *l
510 414
511# endif 415# endif
512 416
513/* -------------------------- gl_once_t datatype -------------------------- */
514
515typedef pthread_once_t gl_once_t;
516# define gl_once_define(STORAGECLASS, NAME) \
517 STORAGECLASS pthread_once_t NAME = PTHREAD_ONCE_INIT;
518# if PTHREAD_IN_USE_DETECTION_HARD || USE_POSIX_THREADS_WEAK
519# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
520 (pthread_in_use () \
521 ? pthread_once (ONCE_CONTROL, INITFUNCTION) \
522 : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0))
523# else
524# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
525 (pthread_in_use () \
526 ? glthread_once_multithreaded (ONCE_CONTROL, INITFUNCTION) \
527 : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0))
528extern int glthread_once_multithreaded (pthread_once_t *once_control,
529 void (*init_function) (void));
530# endif
531extern int glthread_once_singlethreaded (pthread_once_t *once_control);
532
533# ifdef __cplusplus 417# ifdef __cplusplus
534} 418}
535# endif 419# endif
@@ -546,7 +430,6 @@ extern int glthread_once_singlethreaded (pthread_once_t *once_control);
546# include "windows-mutex.h" 430# include "windows-mutex.h"
547# include "windows-rwlock.h" 431# include "windows-rwlock.h"
548# include "windows-recmutex.h" 432# include "windows-recmutex.h"
549# include "windows-once.h"
550 433
551# ifdef __cplusplus 434# ifdef __cplusplus
552extern "C" { 435extern "C" {
@@ -619,14 +502,6 @@ typedef glwthread_recmutex_t gl_recursive_lock_t;
619# define glthread_recursive_lock_destroy(LOCK) \ 502# define glthread_recursive_lock_destroy(LOCK) \
620 glwthread_recmutex_destroy (LOCK) 503 glwthread_recmutex_destroy (LOCK)
621 504
622/* -------------------------- gl_once_t datatype -------------------------- */
623
624typedef glwthread_once_t gl_once_t;
625# define gl_once_define(STORAGECLASS, NAME) \
626 STORAGECLASS gl_once_t NAME = GLWTHREAD_ONCE_INIT;
627# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
628 (glwthread_once (ONCE_CONTROL, INITFUNCTION), 0)
629
630# ifdef __cplusplus 505# ifdef __cplusplus
631} 506}
632# endif 507# endif
@@ -670,14 +545,6 @@ typedef int gl_recursive_lock_t;
670# define glthread_recursive_lock_unlock(NAME) 0 545# define glthread_recursive_lock_unlock(NAME) 0
671# define glthread_recursive_lock_destroy(NAME) 0 546# define glthread_recursive_lock_destroy(NAME) 0
672 547
673/* -------------------------- gl_once_t datatype -------------------------- */
674
675typedef int gl_once_t;
676# define gl_once_define(STORAGECLASS, NAME) \
677 STORAGECLASS gl_once_t NAME = 0;
678# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
679 (*(ONCE_CONTROL) == 0 ? (*(ONCE_CONTROL) = ~ 0, INITFUNCTION (), 0) : 0)
680
681#endif 548#endif
682 549
683/* ========================================================================= */ 550/* ========================================================================= */
@@ -784,16 +651,6 @@ typedef int gl_once_t;
784 } \ 651 } \
785 while (0) 652 while (0)
786 653
787/* -------------------------- gl_once_t datatype -------------------------- */
788
789#define gl_once(NAME, INITFUNCTION) \
790 do \
791 { \
792 if (glthread_once (&NAME, INITFUNCTION)) \
793 abort (); \
794 } \
795 while (0)
796
797/* ========================================================================= */ 654/* ========================================================================= */
798 655
799#endif /* _LOCK_H */ 656#endif /* _LOCK_H */
diff --git a/gl/glthread/once.c b/gl/glthread/once.c
new file mode 100644
index 00000000..b72a4a20
--- /dev/null
+++ b/gl/glthread/once.c
@@ -0,0 +1,80 @@
1/* Once-only initialization in multithreaded situations.
2 Copyright (C) 2005-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17/* Written by Bruno Haible <bruno@clisp.org>, 2005.
18 Based on GCC's gthr-posix.h, gthr-posix95.h. */
19
20#include <config.h>
21
22#include "glthread/once.h"
23
24/* ========================================================================= */
25
26#if USE_ISOC_THREADS || USE_ISOC_AND_POSIX_THREADS
27
28#endif
29
30/* ========================================================================= */
31
32#if USE_POSIX_THREADS
33
34static const pthread_once_t fresh_once = PTHREAD_ONCE_INIT;
35
36int
37glthread_once_singlethreaded (pthread_once_t *once_control)
38{
39 /* We don't know whether pthread_once_t is an integer type, a floating-point
40 type, a pointer type, or a structure type. */
41 char *firstbyte = (char *)once_control;
42 if (*firstbyte == *(const char *)&fresh_once)
43 {
44 /* First time use of once_control. Invert the first byte. */
45 *firstbyte = ~ *(const char *)&fresh_once;
46 return 1;
47 }
48 else
49 return 0;
50}
51
52# if !(PTHREAD_IN_USE_DETECTION_HARD || USE_POSIX_THREADS_WEAK)
53
54int
55glthread_once_multithreaded (pthread_once_t *once_control,
56 void (*init_function) (void))
57{
58 int err = pthread_once (once_control, init_function);
59 if (err == ENOSYS)
60 {
61 /* This happens on FreeBSD 11: The pthread_once function in libc returns
62 ENOSYS. */
63 if (glthread_once_singlethreaded (once_control))
64 init_function ();
65 return 0;
66 }
67 return err;
68}
69
70# endif
71
72#endif
73
74/* ========================================================================= */
75
76#if USE_WINDOWS_THREADS
77
78#endif
79
80/* ========================================================================= */
diff --git a/gl/glthread/once.h b/gl/glthread/once.h
new file mode 100644
index 00000000..b6d9ab40
--- /dev/null
+++ b/gl/glthread/once.h
@@ -0,0 +1,272 @@
1/* Once-only initialization in multithreaded situations.
2 Copyright (C) 2005-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17/* Written by Bruno Haible <bruno@clisp.org>, 2005.
18 Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-win32.h. */
19
20/* This file contains once-only initialization primitives for use with a given
21 thread library.
22 It does not contain primitives for creating threads or for other
23 synchronization primitives.
24
25 Once-only execution:
26 Type: gl_once_t
27 Initializer: gl_once_define(extern, name)
28 Execution: gl_once (name, initfunction);
29 Equivalent functions with control of error handling:
30 Execution: err = glthread_once (&name, initfunction);
31*/
32
33
34#ifndef _ONCE_H
35#define _ONCE_H
36
37/* This file uses HAVE_THREADS_H. */
38#if !_GL_CONFIG_H_INCLUDED
39 #error "Please include config.h first."
40#endif
41
42#include <errno.h>
43#include <stdlib.h>
44
45#if !defined c11_threads_in_use
46# if HAVE_THREADS_H && USE_POSIX_THREADS_FROM_LIBC
47# define c11_threads_in_use() 1
48# elif HAVE_THREADS_H && USE_POSIX_THREADS_WEAK
49# include <threads.h>
50# pragma weak thrd_exit
51# define c11_threads_in_use() (thrd_exit != NULL)
52# else
53# define c11_threads_in_use() 0
54# endif
55#endif
56
57/* ========================================================================= */
58
59#if USE_ISOC_THREADS || USE_ISOC_AND_POSIX_THREADS
60
61/* Use the ISO C threads library. */
62
63# include <threads.h>
64
65# ifdef __cplusplus
66extern "C" {
67# endif
68
69/* -------------------------- gl_once_t datatype -------------------------- */
70
71typedef once_flag gl_once_t;
72# define gl_once_define(STORAGECLASS, NAME) \
73 STORAGECLASS once_flag NAME = ONCE_FLAG_INIT;
74# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
75 (call_once (ONCE_CONTROL, INITFUNCTION), 0)
76
77# ifdef __cplusplus
78}
79# endif
80
81#endif
82
83/* ========================================================================= */
84
85#if USE_POSIX_THREADS
86
87/* Use the POSIX threads library. */
88
89# include <pthread.h>
90
91# ifdef __cplusplus
92extern "C" {
93# endif
94
95# if PTHREAD_IN_USE_DETECTION_HARD
96
97/* The pthread_in_use() detection needs to be done at runtime. */
98# define pthread_in_use() \
99 glthread_in_use ()
100extern int glthread_in_use (void);
101
102# endif
103
104# if USE_POSIX_THREADS_WEAK
105
106/* Use weak references to the POSIX threads library. */
107
108/* Weak references avoid dragging in external libraries if the other parts
109 of the program don't use them. Here we use them, because we don't want
110 every program that uses libintl to depend on libpthread. This assumes
111 that libpthread would not be loaded after libintl; i.e. if libintl is
112 loaded first, by an executable that does not depend on libpthread, and
113 then a module is dynamically loaded that depends on libpthread, libintl
114 will not be multithread-safe. */
115
116/* The way to test at runtime whether libpthread is present is to test
117 whether a function pointer's value, such as &pthread_mutex_init, is
118 non-NULL. However, some versions of GCC have a bug through which, in
119 PIC mode, &foo != NULL always evaluates to true if there is a direct
120 call to foo(...) in the same function. To avoid this, we test the
121 address of a function in libpthread that we don't use. */
122
123# pragma weak pthread_mutex_init
124# pragma weak pthread_mutex_lock
125# pragma weak pthread_mutex_unlock
126# pragma weak pthread_mutex_destroy
127/* Work around clang bug <https://github.com/llvm/llvm-project/issues/104670> */
128# ifndef pthread_rwlock_init
129# pragma weak pthread_rwlock_init
130# endif
131# pragma weak pthread_rwlock_rdlock
132# pragma weak pthread_rwlock_wrlock
133# pragma weak pthread_rwlock_unlock
134# pragma weak pthread_rwlock_destroy
135# pragma weak pthread_once
136# pragma weak pthread_cond_init
137# pragma weak pthread_cond_wait
138# pragma weak pthread_cond_signal
139# pragma weak pthread_cond_broadcast
140# pragma weak pthread_cond_destroy
141# pragma weak pthread_mutexattr_init
142# pragma weak pthread_mutexattr_settype
143# pragma weak pthread_mutexattr_destroy
144/* Work around clang bug <https://github.com/llvm/llvm-project/issues/104670> */
145# ifndef pthread_rwlockattr_init
146# pragma weak pthread_rwlockattr_init
147# endif
148# if __GNU_LIBRARY__ > 1
149# pragma weak pthread_rwlockattr_setkind_np
150# endif
151# pragma weak pthread_rwlockattr_destroy
152# ifndef pthread_self
153# pragma weak pthread_self
154# endif
155
156# if !PTHREAD_IN_USE_DETECTION_HARD
157 /* Considering all platforms with USE_POSIX_THREADS_WEAK, only few symbols
158 can be used to determine whether libpthread is in use. These are:
159 pthread_mutexattr_gettype
160 pthread_rwlockattr_destroy
161 pthread_rwlockattr_init
162 */
163# pragma weak pthread_mutexattr_gettype
164# define pthread_in_use() \
165 (pthread_mutexattr_gettype != NULL || c11_threads_in_use ())
166# endif
167
168# else
169
170# if !PTHREAD_IN_USE_DETECTION_HARD
171# define pthread_in_use() 1
172# endif
173
174# endif
175
176/* -------------------------- gl_once_t datatype -------------------------- */
177
178typedef pthread_once_t gl_once_t;
179# define gl_once_define(STORAGECLASS, NAME) \
180 STORAGECLASS pthread_once_t NAME = PTHREAD_ONCE_INIT;
181# if PTHREAD_IN_USE_DETECTION_HARD || USE_POSIX_THREADS_WEAK
182# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
183 (pthread_in_use () \
184 ? pthread_once (ONCE_CONTROL, INITFUNCTION) \
185 : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0))
186# else
187# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
188 (pthread_in_use () \
189 ? glthread_once_multithreaded (ONCE_CONTROL, INITFUNCTION) \
190 : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0))
191extern int glthread_once_multithreaded (pthread_once_t *once_control,
192 void (*init_function) (void));
193# endif
194extern int glthread_once_singlethreaded (pthread_once_t *once_control);
195
196# ifdef __cplusplus
197}
198# endif
199
200#endif
201
202/* ========================================================================= */
203
204#if USE_WINDOWS_THREADS
205
206# define WIN32_LEAN_AND_MEAN /* avoid including junk */
207# include <windows.h>
208
209# include "windows-once.h"
210
211# ifdef __cplusplus
212extern "C" {
213# endif
214
215/* We can use CRITICAL_SECTION directly, rather than the native Windows Event,
216 Mutex, Semaphore types, because
217 - we need only to synchronize inside a single process (address space),
218 not inter-process locking,
219 - we don't need to support trylock operations. (TryEnterCriticalSection
220 does not work on Windows 95/98/ME. Packages that need trylock usually
221 define their own mutex type.) */
222
223/* There is no way to statically initialize a CRITICAL_SECTION. It needs
224 to be done lazily, once only. For this we need spinlocks. */
225
226/* -------------------------- gl_once_t datatype -------------------------- */
227
228typedef glwthread_once_t gl_once_t;
229# define gl_once_define(STORAGECLASS, NAME) \
230 STORAGECLASS gl_once_t NAME = GLWTHREAD_ONCE_INIT;
231# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
232 (glwthread_once (ONCE_CONTROL, INITFUNCTION), 0)
233
234# ifdef __cplusplus
235}
236# endif
237
238#endif
239
240/* ========================================================================= */
241
242#if !(USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS)
243
244/* Provide dummy implementation if threads are not supported. */
245
246/* -------------------------- gl_once_t datatype -------------------------- */
247
248typedef int gl_once_t;
249# define gl_once_define(STORAGECLASS, NAME) \
250 STORAGECLASS gl_once_t NAME = 0;
251# define glthread_once(ONCE_CONTROL, INITFUNCTION) \
252 (*(ONCE_CONTROL) == 0 ? (*(ONCE_CONTROL) = ~ 0, INITFUNCTION (), 0) : 0)
253
254#endif
255
256/* ========================================================================= */
257
258/* Macros with built-in error handling. */
259
260/* -------------------------- gl_once_t datatype -------------------------- */
261
262#define gl_once(NAME, INITFUNCTION) \
263 do \
264 { \
265 if (glthread_once (&NAME, INITFUNCTION)) \
266 abort (); \
267 } \
268 while (0)
269
270/* ========================================================================= */
271
272#endif /* _ONCE_H */
diff --git a/gl/glthread/threadlib.c b/gl/glthread/threadlib.c
index 7a776768..5c0ba1f4 100644
--- a/gl/glthread/threadlib.c
+++ b/gl/glthread/threadlib.c
@@ -1,5 +1,5 @@
1/* Multithreading primitives. 1/* Multithreading primitives.
2 Copyright (C) 2005-2024 Free Software Foundation, Inc. 2 Copyright (C) 2005-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/hard-locale.c b/gl/hard-locale.c
index 653c5809..6a3dad4f 100644
--- a/gl/hard-locale.c
+++ b/gl/hard-locale.c
@@ -1,6 +1,6 @@
1/* hard-locale.c -- Determine whether a locale is hard. 1/* hard-locale.c -- Determine whether a locale is hard.
2 2
3 Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2024 Free Software 3 Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2026 Free Software
4 Foundation, Inc. 4 Foundation, Inc.
5 5
6 This file is free software: you can redistribute it and/or modify 6 This file is free software: you can redistribute it and/or modify
@@ -32,7 +32,7 @@ hard_locale (int category)
32 if (setlocale_null_r (category, locale, sizeof (locale))) 32 if (setlocale_null_r (category, locale, sizeof (locale)))
33 return false; 33 return false;
34 34
35 if (!(strcmp (locale, "C") == 0 || strcmp (locale, "POSIX") == 0)) 35 if (!(streq (locale, "C") || streq (locale, "POSIX")))
36 return true; 36 return true;
37 37
38#if defined __ANDROID__ 38#if defined __ANDROID__
diff --git a/gl/hard-locale.h b/gl/hard-locale.h
index 5d40e522..b8d7029d 100644
--- a/gl/hard-locale.h
+++ b/gl/hard-locale.h
@@ -1,6 +1,6 @@
1/* Determine whether a locale is hard. 1/* Determine whether a locale is hard.
2 2
3 Copyright (C) 1999, 2003-2004, 2009-2024 Free Software Foundation, Inc. 3 Copyright (C) 1999, 2003-2004, 2009-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/ialloc.c b/gl/ialloc.c
index 8564a15b..38ec1d05 100644
--- a/gl/ialloc.c
+++ b/gl/ialloc.c
@@ -1,6 +1,6 @@
1/* malloc with idx_t rather than size_t 1/* malloc with idx_t rather than size_t
2 2
3 Copyright 2021-2024 Free Software Foundation, Inc. 3 Copyright 2021-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -15,7 +15,6 @@
15 You should have received a copy of the GNU Lesser General Public License 15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 17
18#include <config.h>
19
20#define IALLOC_INLINE _GL_EXTERN_INLINE 18#define IALLOC_INLINE _GL_EXTERN_INLINE
19#include <config.h>
21#include "ialloc.h" 20#include "ialloc.h"
diff --git a/gl/ialloc.h b/gl/ialloc.h
index 2aa94ae7..97b0e0c5 100644
--- a/gl/ialloc.h
+++ b/gl/ialloc.h
@@ -1,6 +1,6 @@
1/* ialloc.h -- malloc with idx_t rather than size_t 1/* ialloc.h -- malloc with idx_t rather than size_t
2 2
3 Copyright 2021-2024 Free Software Foundation, Inc. 3 Copyright 2021-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -29,9 +29,6 @@
29#include <errno.h> 29#include <errno.h>
30#include <stdint.h> 30#include <stdint.h>
31#include <stdlib.h> 31#include <stdlib.h>
32#if defined __CHERI_PURE_CAPABILITY__
33# include <cheri.h>
34#endif
35 32
36_GL_INLINE_HEADER_BEGIN 33_GL_INLINE_HEADER_BEGIN
37#ifndef IALLOC_INLINE 34#ifndef IALLOC_INLINE
@@ -68,19 +65,7 @@ IALLOC_INLINE
68void * 65void *
69irealloc (void *p, idx_t s) 66irealloc (void *p, idx_t s)
70{ 67{
71 if (s <= SIZE_MAX) 68 return s <= SIZE_MAX ? realloc (p, s) : _gl_alloc_nomem ();
72 {
73 /* Work around GNU realloc glitch by treating a zero size as if it
74 were 1, so that returning NULL is equivalent to failing. */
75 p = realloc (p, s | !s);
76#if defined __CHERI_PURE_CAPABILITY__
77 if (p != NULL)
78 p = cheri_bounds_set (p, s);
79#endif
80 return p;
81 }
82 else
83 return _gl_alloc_nomem ();
84} 69}
85 70
86/* icalloc (num, size) is like calloc (num, size). 71/* icalloc (num, size) is like calloc (num, size).
@@ -112,23 +97,9 @@ icalloc (idx_t n, idx_t s)
112IALLOC_INLINE void * 97IALLOC_INLINE void *
113ireallocarray (void *p, idx_t n, idx_t s) 98ireallocarray (void *p, idx_t n, idx_t s)
114{ 99{
115 if (n <= SIZE_MAX && s <= SIZE_MAX) 100 return (n <= SIZE_MAX && s <= SIZE_MAX
116 { 101 ? reallocarray (p, n, s)
117 /* Work around GNU reallocarray glitch by treating a zero size as if 102 : _gl_alloc_nomem ());
118 it were 1, so that returning NULL is equivalent to failing. */
119 size_t nx = n;
120 size_t sx = s;
121 if (n == 0 || s == 0)
122 nx = sx = 1;
123 p = reallocarray (p, nx, sx);
124#if defined __CHERI_PURE_CAPABILITY__
125 if (p != NULL && (n == 0 || s == 0))
126 p = cheri_bounds_set (p, 0);
127#endif
128 return p;
129 }
130 else
131 return _gl_alloc_nomem ();
132} 103}
133 104
134#ifdef __cplusplus 105#ifdef __cplusplus
diff --git a/gl/idpriv-droptemp.c b/gl/idpriv-droptemp.c
index eb882dea..993d25b6 100644
--- a/gl/idpriv-droptemp.c
+++ b/gl/idpriv-droptemp.c
@@ -1,5 +1,5 @@
1/* Dropping uid/gid privileges of the current process temporarily. 1/* Dropping uid/gid privileges of the current process temporarily.
2 Copyright (C) 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 2009-2026 Free Software Foundation, Inc.
3 3
4 This program is free software: you can redistribute it and/or modify 4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -25,18 +25,18 @@
25 25
26/* The privileged uid and gid that the process had earlier. */ 26/* The privileged uid and gid that the process had earlier. */
27#if HAVE_GETUID 27#if HAVE_GETUID
28static int saved_uid = -1; 28static uid_t saved_uid = -1;
29#endif 29#endif
30#if HAVE_GETGID 30#if HAVE_GETGID
31static int saved_gid = -1; 31static gid_t saved_gid = -1;
32#endif 32#endif
33 33
34int 34int
35idpriv_temp_drop (void) 35idpriv_temp_drop (void)
36{ 36{
37#if HAVE_GETEUID && HAVE_GETEGID && (HAVE_SETRESUID || HAVE_SETREUID) && (HAVE_SETRESGID || HAVE_SETREGID) 37#if HAVE_GETEUID && HAVE_GETEGID && (HAVE_SETRESUID || HAVE_SETREUID) && (HAVE_SETRESGID || HAVE_SETREGID)
38 int uid = getuid (); 38 uid_t uid = getuid ();
39 int gid = getgid (); 39 gid_t gid = getgid ();
40 40
41 /* Find out about the privileged uid and gid at the first call. */ 41 /* Find out about the privileged uid and gid at the first call. */
42 if (saved_uid == -1) 42 if (saved_uid == -1)
@@ -51,7 +51,7 @@ idpriv_temp_drop (void)
51# if HAVE_SETRESGID /* glibc, FreeBSD, OpenBSD, HP-UX */ 51# if HAVE_SETRESGID /* glibc, FreeBSD, OpenBSD, HP-UX */
52 if (setresgid (-1, gid, saved_gid) < 0) 52 if (setresgid (-1, gid, saved_gid) < 0)
53 return -1; 53 return -1;
54# else /* Mac OS X, NetBSD, AIX, IRIX, Solaris >= 2.5, OSF/1, Cygwin */ 54# else /* Mac OS X, NetBSD, AIX, Solaris >= 2.5, Cygwin */
55 if (setregid (-1, gid) < 0) 55 if (setregid (-1, gid) < 0)
56 return -1; 56 return -1;
57# endif 57# endif
@@ -64,7 +64,7 @@ idpriv_temp_drop (void)
64 figure 14. */ 64 figure 14. */
65 if (setresuid (-1, uid, saved_uid) < 0) 65 if (setresuid (-1, uid, saved_uid) < 0)
66 return -1; 66 return -1;
67# else /* Mac OS X, NetBSD, AIX, IRIX, Solaris >= 2.5, OSF/1, Cygwin */ 67# else /* Mac OS X, NetBSD, AIX, Solaris >= 2.5, Cygwin */
68 if (setreuid (-1, uid) < 0) 68 if (setreuid (-1, uid) < 0)
69 return -1; 69 return -1;
70# endif 70# endif
@@ -124,8 +124,8 @@ int
124idpriv_temp_restore (void) 124idpriv_temp_restore (void)
125{ 125{
126#if HAVE_GETEUID && HAVE_GETEGID && (HAVE_SETRESUID || HAVE_SETREUID) && (HAVE_SETRESGID || HAVE_SETREGID) 126#if HAVE_GETEUID && HAVE_GETEGID && (HAVE_SETRESUID || HAVE_SETREUID) && (HAVE_SETRESGID || HAVE_SETREGID)
127 int uid = getuid (); 127 uid_t uid = getuid ();
128 int gid = getgid (); 128 gid_t gid = getgid ();
129 129
130 if (saved_uid == -1 || saved_gid == -1) 130 if (saved_uid == -1 || saved_gid == -1)
131 /* Caller error: idpriv_temp_drop was never invoked. */ 131 /* Caller error: idpriv_temp_drop was never invoked. */
@@ -142,7 +142,7 @@ idpriv_temp_restore (void)
142 figure 14. */ 142 figure 14. */
143 if (setresuid (-1, saved_uid, -1) < 0) 143 if (setresuid (-1, saved_uid, -1) < 0)
144 return -1; 144 return -1;
145# else /* Mac OS X, NetBSD, AIX, IRIX, Solaris >= 2.5, OSF/1, Cygwin */ 145# else /* Mac OS X, NetBSD, AIX, Solaris >= 2.5, Cygwin */
146 if (setreuid (-1, saved_uid) < 0) 146 if (setreuid (-1, saved_uid) < 0)
147 return -1; 147 return -1;
148# endif 148# endif
@@ -151,7 +151,7 @@ idpriv_temp_restore (void)
151# if HAVE_SETRESGID /* glibc, FreeBSD, OpenBSD, HP-UX */ 151# if HAVE_SETRESGID /* glibc, FreeBSD, OpenBSD, HP-UX */
152 if (setresgid (-1, saved_gid, -1) < 0) 152 if (setresgid (-1, saved_gid, -1) < 0)
153 return -1; 153 return -1;
154# else /* Mac OS X, NetBSD, AIX, IRIX, Solaris >= 2.5, OSF/1, Cygwin */ 154# else /* Mac OS X, NetBSD, AIX, Solaris >= 2.5, Cygwin */
155 if (setregid (-1, saved_gid) < 0) 155 if (setregid (-1, saved_gid) < 0)
156 return -1; 156 return -1;
157# endif 157# endif
diff --git a/gl/idpriv.h b/gl/idpriv.h
index a3ae5926..8fa6c0e6 100644
--- a/gl/idpriv.h
+++ b/gl/idpriv.h
@@ -1,5 +1,5 @@
1/* Dropping uid/gid privileges of the current process. 1/* Dropping uid/gid privileges of the current process.
2 Copyright (C) 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 2009-2026 Free Software Foundation, Inc.
3 3
4 This program is free software: you can redistribute it and/or modify 4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
diff --git a/gl/idx.h b/gl/idx.h
index 43793f2d..deb7dc4c 100644
--- a/gl/idx.h
+++ b/gl/idx.h
@@ -1,5 +1,5 @@
1/* A type for indices and sizes. 1/* A type for indices and sizes.
2 Copyright (C) 2020-2024 Free Software Foundation, Inc. 2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 4
5 The GNU C Library is free software; you can redistribute it and/or 5 The GNU C Library is free software; you can redistribute it and/or
diff --git a/gl/inet_ntop.c b/gl/inet_ntop.c
index 0a4ba20e..599ca4fb 100644
--- a/gl/inet_ntop.c
+++ b/gl/inet_ntop.c
@@ -1,6 +1,6 @@
1/* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form 1/* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form
2 2
3 Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. 3 Copyright (C) 2005-2006, 2008-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -117,7 +117,7 @@ inet_ntop (int af, const void *restrict src,
117 * 'dst' (as a const) 117 * 'dst' (as a const)
118 * notes: 118 * notes:
119 * (1) uses no statics 119 * (1) uses no statics
120 * (2) takes a u_char* not an in_addr as input 120 * (2) takes a 'unsigned char *' not an in_addr as input
121 * author: 121 * author:
122 * Paul Vixie, 1996. 122 * Paul Vixie, 1996.
123 */ 123 */
@@ -125,9 +125,7 @@ static const char *
125inet_ntop4 (const unsigned char *src, char *dst, socklen_t size) 125inet_ntop4 (const unsigned char *src, char *dst, socklen_t size)
126{ 126{
127 char tmp[sizeof "255.255.255.255"]; 127 char tmp[sizeof "255.255.255.255"];
128 int len; 128 int len = sprintf (tmp, "%u.%u.%u.%u", src[0], src[1], src[2], src[3]);
129
130 len = sprintf (tmp, "%u.%u.%u.%u", src[0], src[1], src[2], src[3]);
131 if (len < 0) 129 if (len < 0)
132 return NULL; 130 return NULL;
133 131
@@ -152,33 +150,25 @@ static const char *
152inet_ntop6 (const unsigned char *src, char *dst, socklen_t size) 150inet_ntop6 (const unsigned char *src, char *dst, socklen_t size)
153{ 151{
154 /* 152 /*
155 * Note that int32_t and int16_t need only be "at least" large enough
156 * to contain a value of the specified size. On some systems, like
157 * Crays, there is no such thing as an integer variable with 16 bits.
158 * Keep this in mind if you think this function should have been coded
159 * to use pointer overlays. All the world's not a VAX.
160 */
161 char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
162 struct
163 {
164 int base, len;
165 } best, cur;
166 unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ];
167 int i;
168
169 /*
170 * Preprocess: 153 * Preprocess:
171 * Copy the input (bytewise) array into a wordwise array. 154 * Copy the input (bytewise) array into a wordwise array.
172 * Find the longest run of 0x00's in src[] for :: shorthanding. 155 * Find the longest run of 0x00's in src[] for :: shorthanding.
173 */ 156 */
157 unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ];
174 memset (words, '\0', sizeof words); 158 memset (words, '\0', sizeof words);
175 for (i = 0; i < NS_IN6ADDRSZ; i += 2) 159 for (int i = 0; i < NS_IN6ADDRSZ; i += 2)
176 words[i / 2] = (src[i] << 8) | src[i + 1]; 160 words[i / 2] = (src[i] << 8) | src[i + 1];
161
162 struct
163 {
164 int base, len;
165 } best, cur;
177 best.base = -1; 166 best.base = -1;
178 cur.base = -1; 167 cur.base = -1;
179 IF_LINT(best.len = 0); 168 IF_LINT(best.len = 0);
180 IF_LINT(cur.len = 0); 169 IF_LINT(cur.len = 0);
181 for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) 170
171 for (int i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
182 { 172 {
183 if (words[i] == 0) 173 if (words[i] == 0)
184 { 174 {
@@ -208,8 +198,16 @@ inet_ntop6 (const unsigned char *src, char *dst, socklen_t size)
208 /* 198 /*
209 * Format the result. 199 * Format the result.
210 */ 200 */
211 tp = tmp; 201 /*
212 for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) 202 * Note that int32_t and int16_t need only be "at least" large enough
203 * to contain a value of the specified size. On some systems, like
204 * Crays, there is no such thing as an integer variable with 16 bits.
205 * Keep this in mind if you think this function should have been coded
206 * to use pointer overlays. All the world's not a VAX.
207 */
208 char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"];
209 char *tp = tmp;
210 for (int i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
213 { 211 {
214 /* Are we inside the best run of 0x00's? */ 212 /* Are we inside the best run of 0x00's? */
215 if (best.base != -1 && i >= best.base && i < (best.base + best.len)) 213 if (best.base != -1 && i >= best.base && i < (best.base + best.len))
diff --git a/gl/inet_pton.c b/gl/inet_pton.c
new file mode 100644
index 00000000..1e75c8c5
--- /dev/null
+++ b/gl/inet_pton.c
@@ -0,0 +1,265 @@
1/* inet_pton.c -- convert IPv4 and IPv6 addresses from text to binary form
2
3 Copyright (C) 2006, 2008-2026 Free Software Foundation, Inc.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18/*
19 * Copyright (c) 1996,1999 by Internet Software Consortium.
20 *
21 * Permission to use, copy, modify, and distribute this software for any
22 * purpose with or without fee is hereby granted, provided that the above
23 * copyright notice and this permission notice appear in all copies.
24 *
25 * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
26 * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
27 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
28 * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
29 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
30 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
32 * SOFTWARE.
33 */
34
35#include <config.h>
36
37/* Specification. */
38#include <arpa/inet.h>
39
40#if HAVE_DECL_INET_PTON
41
42# undef inet_pton
43
44int
45rpl_inet_pton (int af, const char *restrict src, void *restrict dst)
46{
47 return inet_pton (af, src, dst);
48}
49
50#else
51
52# include <c-ctype.h>
53# include <string.h>
54# include <errno.h>
55
56# define NS_INADDRSZ 4
57# define NS_IN6ADDRSZ 16
58# define NS_INT16SZ 2
59
60/*
61 * WARNING: Don't even consider trying to compile this on a system where
62 * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
63 */
64
65static int inet_pton4 (const char *src, unsigned char *dst);
66# if HAVE_IPV6
67static int inet_pton6 (const char *src, unsigned char *dst);
68# endif
69
70/* int
71 * inet_pton(af, src, dst)
72 * convert from presentation format (which usually means ASCII printable)
73 * to network format (which is usually some kind of binary format).
74 * return:
75 * 1 if the address was valid for the specified address family
76 * 0 if the address wasn't valid ('dst' is untouched in this case)
77 * -1 if some other error occurred ('dst' is untouched in this case, too)
78 * author:
79 * Paul Vixie, 1996.
80 */
81int
82inet_pton (int af, const char *restrict src, void *restrict dst)
83{
84 switch (af)
85 {
86 case AF_INET:
87 return (inet_pton4 (src, dst));
88
89# if HAVE_IPV6
90 case AF_INET6:
91 return (inet_pton6 (src, dst));
92# endif
93
94 default:
95 errno = EAFNOSUPPORT;
96 return (-1);
97 }
98 /* NOTREACHED */
99}
100
101/* int
102 * inet_pton4(src, dst)
103 * like inet_aton() but without all the hexadecimal, octal (with the
104 * exception of 0) and shorthand.
105 * return:
106 * 1 if 'src' is a valid dotted quad, else 0.
107 * notice:
108 * does not touch 'dst' unless it's returning 1.
109 * author:
110 * Paul Vixie, 1996.
111 */
112static int
113inet_pton4 (const char *restrict src, unsigned char *restrict dst)
114{
115 unsigned char tmp[NS_INADDRSZ];
116
117 {
118 int saw_digit = 0;
119 int octets = 0;
120 unsigned char *tp = tmp;
121 *tp = 0;
122 int ch;
123 while ((ch = *src++) != '\0')
124 {
125 if (ch >= '0' && ch <= '9')
126 {
127 if (saw_digit && *tp == 0)
128 return (0);
129 unsigned new = *tp * 10 + (ch - '0');
130 if (new > 255)
131 return (0);
132 *tp = new;
133 if (!saw_digit)
134 {
135 if (++octets > 4)
136 return (0);
137 saw_digit = 1;
138 }
139 }
140 else if (ch == '.' && saw_digit)
141 {
142 if (octets == 4)
143 return (0);
144 *++tp = 0;
145 saw_digit = 0;
146 }
147 else
148 return (0);
149 }
150 if (octets < 4)
151 return (0);
152 }
153 memcpy (dst, tmp, NS_INADDRSZ);
154 return (1);
155}
156
157# if HAVE_IPV6
158
159/* int
160 * inet_pton6(src, dst)
161 * convert presentation level address to network order binary form.
162 * return:
163 * 1 if 'src' is a valid [RFC1884 2.2] address, else 0.
164 * notice:
165 * (1) does not touch 'dst' unless it's returning 1.
166 * (2) :: in a full address is silently ignored.
167 * credit:
168 * inspired by Mark Andrews.
169 * author:
170 * Paul Vixie, 1996.
171 */
172static int
173inet_pton6 (const char *restrict src, unsigned char *restrict dst)
174{
175 static const char xdigits[] = "0123456789abcdef";
176 unsigned char tmp[NS_IN6ADDRSZ];
177
178 /* Leading :: requires some special handling. */
179 if (*src == ':')
180 if (*++src != ':')
181 return (0);
182
183 {
184 unsigned char *tp = memset (tmp, '\0', NS_IN6ADDRSZ);
185 unsigned char *endp = tp + NS_IN6ADDRSZ;
186 unsigned char *colonp = NULL;
187 const char *curtok = src;
188 int saw_xdigit = 0;
189 unsigned int val = 0;
190 int ch;
191 while ((ch = c_tolower (*src++)) != '\0')
192 {
193 const char *pch = strchr (xdigits, ch);
194 if (pch != NULL)
195 {
196 val <<= 4;
197 val |= (pch - xdigits);
198 if (val > 0xffff)
199 return (0);
200 saw_xdigit = 1;
201 }
202 else if (ch == ':')
203 {
204 curtok = src;
205 if (!saw_xdigit)
206 {
207 if (colonp)
208 return (0);
209 colonp = tp;
210 }
211 else if (*src == '\0')
212 return (0);
213 else if (tp + NS_INT16SZ > endp)
214 return (0);
215 else
216 {
217 *tp++ = (unsigned char) (val >> 8) & 0xff;
218 *tp++ = (unsigned char) val & 0xff;
219 saw_xdigit = 0;
220 val = 0;
221 }
222 }
223 else if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
224 inet_pton4 (curtok, tp) > 0)
225 {
226 tp += NS_INADDRSZ;
227 saw_xdigit = 0;
228 break; /* '\0' was seen by inet_pton4(). */
229 }
230 else
231 return (0);
232 }
233 if (saw_xdigit)
234 {
235 if (tp + NS_INT16SZ > endp)
236 return (0);
237 *tp++ = (unsigned char) (val >> 8) & 0xff;
238 *tp++ = (unsigned char) val & 0xff;
239 }
240 if (colonp != NULL)
241 {
242 if (tp == endp)
243 return (0);
244 /*
245 * Since some memmove()'s erroneously fail to handle
246 * overlapping regions, we'll do the shift by hand.
247 */
248 const int n = tp - colonp;
249 for (int i = 1; i <= n; i++)
250 {
251 endp[-i] = colonp[n - i];
252 colonp[n - i] = 0;
253 }
254 tp = endp;
255 }
256 if (tp != endp)
257 return (0);
258 }
259 memcpy (dst, tmp, NS_IN6ADDRSZ);
260 return (1);
261}
262
263# endif
264
265#endif
diff --git a/gl/intprops-internal.h b/gl/intprops-internal.h
index b5ba8d7c..0df385b9 100644
--- a/gl/intprops-internal.h
+++ b/gl/intprops-internal.h
@@ -1,6 +1,6 @@
1/* intprops-internal.h -- properties of integer types not visible to users 1/* intprops-internal.h -- properties of integer types not visible to users
2 2
3 Copyright (C) 2001-2024 Free Software Foundation, Inc. 3 Copyright (C) 2001-2026 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify it 5 This program is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Lesser General Public License as published 6 under the terms of the GNU Lesser General Public License as published
@@ -21,7 +21,7 @@
21#include <limits.h> 21#include <limits.h>
22 22
23/* Pacify GCC 13.2 in some calls to _GL_EXPR_SIGNED. */ 23/* Pacify GCC 13.2 in some calls to _GL_EXPR_SIGNED. */
24#if defined __GNUC__ && 4 < __GNUC__ + (3 <= __GNUC_MINOR__) 24#if 4 < __GNUC__ + (3 <= __GNUC_MINOR__) && !defined __clang__
25# pragma GCC diagnostic ignored "-Wtype-limits" 25# pragma GCC diagnostic ignored "-Wtype-limits"
26#endif 26#endif
27 27
@@ -29,10 +29,6 @@
29 Do not evaluate E. */ 29 Do not evaluate E. */
30#define _GL_INT_CONVERT(e, v) ((1 ? 0 : (e)) + (v)) 30#define _GL_INT_CONVERT(e, v) ((1 ? 0 : (e)) + (v))
31 31
32/* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see
33 <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00406.html>. */
34#define _GL_INT_NEGATE_CONVERT(e, v) ((1 ? 0 : (e)) - (v))
35
36/* The extra casts in the following macros work around compiler bugs, 32/* The extra casts in the following macros work around compiler bugs,
37 e.g., in Cray C 5.0.3.0. */ 33 e.g., in Cray C 5.0.3.0. */
38 34
@@ -41,7 +37,7 @@
41 37
42/* Return 1 if the real expression E, after promotion, has a 38/* Return 1 if the real expression E, after promotion, has a
43 signed or floating type. Do not evaluate E. */ 39 signed or floating type. Do not evaluate E. */
44#define _GL_EXPR_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0) 40#define _GL_EXPR_SIGNED(e) (_GL_INT_CONVERT (e, -1) < 0)
45 41
46 42
47/* Minimum and maximum values for integer types and expressions. */ 43/* Minimum and maximum values for integer types and expressions. */
@@ -60,7 +56,7 @@
60#define _GL_INT_MAXIMUM(e) \ 56#define _GL_INT_MAXIMUM(e) \
61 (_GL_EXPR_SIGNED (e) \ 57 (_GL_EXPR_SIGNED (e) \
62 ? _GL_SIGNED_INT_MAXIMUM (e) \ 58 ? _GL_SIGNED_INT_MAXIMUM (e) \
63 : _GL_INT_NEGATE_CONVERT (e, 1)) 59 : _GL_INT_CONVERT (e, -1))
64#define _GL_SIGNED_INT_MAXIMUM(e) \ 60#define _GL_SIGNED_INT_MAXIMUM(e) \
65 (((_GL_INT_CONVERT (e, 1) << (_GL_TYPE_WIDTH (+ (e)) - 2)) - 1) * 2 + 1) 61 (((_GL_INT_CONVERT (e, 1) << (_GL_TYPE_WIDTH (+ (e)) - 2)) - 1) * 2 + 1)
66 62
@@ -77,10 +73,11 @@
77 73
78/* Does the __typeof__ keyword work? This could be done by 74/* Does the __typeof__ keyword work? This could be done by
79 'configure', but for now it's easier to do it by hand. */ 75 'configure', but for now it's easier to do it by hand. */
80#if (2 <= __GNUC__ \ 76#if ((defined __GNUC__ && 2 <= __GNUC__) \
81 || (4 <= __clang_major__) \ 77 || (defined __clang_major__ && 4 <= __clang_major__) \
82 || (1210 <= __IBMC__ && defined __IBM__TYPEOF__) \ 78 || (defined __IBMC__ && 1210 <= __IBMC__ && defined __IBM__TYPEOF__) \
83 || (0x5110 <= __SUNPRO_C && !__STDC__)) 79 || (defined __SUNPRO_C && 0x5110 <= __SUNPRO_C && !__STDC__) \
80 || (defined _MSC_VER && 1939 <= _MSC_VER))
84# define _GL_HAVE___TYPEOF__ 1 81# define _GL_HAVE___TYPEOF__ 1
85#else 82#else
86# define _GL_HAVE___TYPEOF__ 0 83# define _GL_HAVE___TYPEOF__ 0
@@ -111,7 +108,7 @@
111#elif defined __has_builtin 108#elif defined __has_builtin
112# define _GL_HAS_BUILTIN_ADD_OVERFLOW __has_builtin (__builtin_add_overflow) 109# define _GL_HAS_BUILTIN_ADD_OVERFLOW __has_builtin (__builtin_add_overflow)
113/* __builtin_{add,sub}_overflow exists but is not reliable in GCC 5.x and 6.x, 110/* __builtin_{add,sub}_overflow exists but is not reliable in GCC 5.x and 6.x,
114 see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98269>. */ 111 see <https://gcc.gnu.org/PR98269>. */
115#elif 7 <= __GNUC__ 112#elif 7 <= __GNUC__
116# define _GL_HAS_BUILTIN_ADD_OVERFLOW 1 113# define _GL_HAS_BUILTIN_ADD_OVERFLOW 1
117#else 114#else
@@ -119,8 +116,8 @@
119#endif 116#endif
120 117
121/* True if __builtin_mul_overflow (A, B, P) works when P is non-null. */ 118/* True if __builtin_mul_overflow (A, B, P) works when P is non-null. */
122#if defined __clang_major__ && __clang_major__ < 14 119#if defined __clang_major__ && __clang_major__ < 21
123/* Work around Clang bug <https://bugs.llvm.org/show_bug.cgi?id=16404>. */ 120/* Work around Clang bug <https://github.com/llvm/llvm-project/issues/16778>. */
124# define _GL_HAS_BUILTIN_MUL_OVERFLOW 0 121# define _GL_HAS_BUILTIN_MUL_OVERFLOW 0
125#else 122#else
126# define _GL_HAS_BUILTIN_MUL_OVERFLOW _GL_HAS_BUILTIN_ADD_OVERFLOW 123# define _GL_HAS_BUILTIN_MUL_OVERFLOW _GL_HAS_BUILTIN_ADD_OVERFLOW
@@ -163,7 +160,7 @@
163#if _GL_HAS_BUILTIN_MUL_OVERFLOW 160#if _GL_HAS_BUILTIN_MUL_OVERFLOW
164# if ((9 < __GNUC__ + (3 <= __GNUC_MINOR__) \ 161# if ((9 < __GNUC__ + (3 <= __GNUC_MINOR__) \
165 || (__GNUC__ == 8 && 4 <= __GNUC_MINOR__)) \ 162 || (__GNUC__ == 8 && 4 <= __GNUC_MINOR__)) \
166 && !defined __EDG__) 163 && !defined __clang__ && !defined __EDG__)
167# define _GL_INT_MULTIPLY_WRAPV(a, b, r) __builtin_mul_overflow (a, b, r) 164# define _GL_INT_MULTIPLY_WRAPV(a, b, r) __builtin_mul_overflow (a, b, r)
168# else 165# else
169 /* Work around GCC bug 91450. */ 166 /* Work around GCC bug 91450. */
@@ -182,13 +179,13 @@
182 _GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW) 179 _GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW)
183#endif 180#endif
184 181
185/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See: 182/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25764. See:
186 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193 183 https://gcc.gnu.org/PR68193
187 https://llvm.org/bugs/show_bug.cgi?id=25390 184 https://github.com/llvm/llvm-project/issues/25764
188 For now, assume all versions of GCC-like compilers generate bogus 185 For now, assume GCC < 14 and all Clang versions generate bogus
189 warnings for _Generic. This matters only for compilers that 186 warnings for _Generic. This matters only for compilers that
190 lack relevant builtins. */ 187 lack relevant builtins. */
191#if __GNUC__ || defined __clang__ 188#if (__GNUC__ && __GNUC__ < 14) || defined __clang__
192# define _GL__GENERIC_BOGUS 1 189# define _GL__GENERIC_BOGUS 1
193#else 190#else
194# define _GL__GENERIC_BOGUS 0 191# define _GL__GENERIC_BOGUS 0
diff --git a/gl/intprops.h b/gl/intprops.h
index 43734f34..924b6f9a 100644
--- a/gl/intprops.h
+++ b/gl/intprops.h
@@ -1,6 +1,6 @@
1/* intprops.h -- properties of integer types 1/* intprops.h -- properties of integer types
2 2
3 Copyright (C) 2001-2024 Free Software Foundation, Inc. 3 Copyright (C) 2001-2026 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify it 5 This program is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Lesser General Public License as published 6 under the terms of the GNU Lesser General Public License as published
@@ -34,6 +34,14 @@
34 signed or floating type. Do not evaluate E. */ 34 signed or floating type. Do not evaluate E. */
35#define EXPR_SIGNED(e) _GL_EXPR_SIGNED (e) 35#define EXPR_SIGNED(e) _GL_EXPR_SIGNED (e)
36 36
37/* The same value as as the arithmetic expression E, but with E's type
38 after integer promotions. For example, if E is of type 'enum {A, B}'
39 then 'switch (INT_PROMOTE (E))' pacifies gcc -Wswitch-enum if some
40 enum values are deliberately omitted from the switch's cases.
41 Here, unary + is safer than a cast or inline function, as unary +
42 does only integer promotions and is disallowed on pointers. */
43#define INT_PROMOTE(e) (+ (e))
44
37 45
38/* Minimum and maximum values for integer types and expressions. */ 46/* Minimum and maximum values for integer types and expressions. */
39 47
@@ -197,11 +205,11 @@
197 || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max)) 205 || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max))
198#endif 206#endif
199#define _GL_DIVIDE_OVERFLOW(a, b, min, max) \ 207#define _GL_DIVIDE_OVERFLOW(a, b, min, max) \
200 ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \ 208 ((min) < 0 ? (b) == _GL_INT_CONVERT (min, -1) && (a) < - (max) \
201 : (a) < 0 ? (b) <= (a) + (b) - 1 \ 209 : (a) < 0 ? (b) <= (a) + (b) - 1 \
202 : (b) < 0 && (a) + (b) <= (a)) 210 : (b) < 0 && (a) + (b) <= (a))
203#define _GL_REMAINDER_OVERFLOW(a, b, min, max) \ 211#define _GL_REMAINDER_OVERFLOW(a, b, min, max) \
204 ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \ 212 ((min) < 0 ? (b) == _GL_INT_CONVERT (min, -1) && (a) < - (max) \
205 : (a) < 0 ? (a) % (b) != ((max) - (b) + 1) % (b) \ 213 : (a) < 0 ? (a) % (b) != ((max) - (b) + 1) % (b) \
206 : (b) < 0 && ! _GL_UNSIGNED_NEG_MULTIPLE (a, b, max)) 214 : (b) < 0 && ! _GL_UNSIGNED_NEG_MULTIPLE (a, b, max))
207 215
diff --git a/gl/inttypes.in.h b/gl/inttypes.in.h
index b9ab8a4b..cbe5a6f0 100644
--- a/gl/inttypes.in.h
+++ b/gl/inttypes.in.h
@@ -1,4 +1,4 @@
1/* Copyright (C) 2006-2024 Free Software Foundation, Inc. 1/* Copyright (C) 2006-2026 Free Software Foundation, Inc.
2 Written by Paul Eggert, Bruno Haible, Derek Price. 2 Written by Paul Eggert, Bruno Haible, Derek Price.
3 This file is part of gnulib. 3 This file is part of gnulib.
4 4
@@ -913,11 +913,11 @@ extern "C" {
913# undef imaxabs 913# undef imaxabs
914# define imaxabs rpl_imaxabs 914# define imaxabs rpl_imaxabs
915# endif 915# endif
916_GL_FUNCDECL_RPL (imaxabs, intmax_t, (intmax_t x)); 916_GL_FUNCDECL_RPL (imaxabs, intmax_t, (intmax_t x), );
917_GL_CXXALIAS_RPL (imaxabs, intmax_t, (intmax_t x)); 917_GL_CXXALIAS_RPL (imaxabs, intmax_t, (intmax_t x));
918# else 918# else
919# if !@HAVE_DECL_IMAXABS@ 919# if !@HAVE_DECL_IMAXABS@
920_GL_FUNCDECL_SYS (imaxabs, intmax_t, (intmax_t x)); 920_GL_FUNCDECL_SYS (imaxabs, intmax_t, (intmax_t x), );
921# endif 921# endif
922_GL_CXXALIAS_SYS (imaxabs, intmax_t, (intmax_t x)); 922_GL_CXXALIAS_SYS (imaxabs, intmax_t, (intmax_t x));
923# endif 923# endif
@@ -925,7 +925,6 @@ _GL_CXXALIAS_SYS (imaxabs, intmax_t, (intmax_t x));
925_GL_CXXALIASWARN (imaxabs); 925_GL_CXXALIASWARN (imaxabs);
926# endif 926# endif
927#elif defined GNULIB_POSIXCHECK 927#elif defined GNULIB_POSIXCHECK
928# undef imaxabs
929# if HAVE_RAW_DECL_IMAXABS 928# if HAVE_RAW_DECL_IMAXABS
930_GL_WARN_ON_USE (imaxabs, "imaxabs is unportable - " 929_GL_WARN_ON_USE (imaxabs, "imaxabs is unportable - "
931 "use gnulib module imaxabs for portability"); 930 "use gnulib module imaxabs for portability");
@@ -944,11 +943,11 @@ typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t;
944# undef imaxdiv 943# undef imaxdiv
945# define imaxdiv rpl_imaxdiv 944# define imaxdiv rpl_imaxdiv
946# endif 945# endif
947_GL_FUNCDECL_RPL (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom)); 946_GL_FUNCDECL_RPL (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom), );
948_GL_CXXALIAS_RPL (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom)); 947_GL_CXXALIAS_RPL (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom));
949# else 948# else
950# if !@HAVE_DECL_IMAXDIV@ 949# if !@HAVE_DECL_IMAXDIV@
951_GL_FUNCDECL_SYS (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom)); 950_GL_FUNCDECL_SYS (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom), );
952# endif 951# endif
953_GL_CXXALIAS_SYS (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom)); 952_GL_CXXALIAS_SYS (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom));
954# endif 953# endif
@@ -956,7 +955,6 @@ _GL_CXXALIAS_SYS (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom));
956_GL_CXXALIASWARN (imaxdiv); 955_GL_CXXALIASWARN (imaxdiv);
957# endif 956# endif
958#elif defined GNULIB_POSIXCHECK 957#elif defined GNULIB_POSIXCHECK
959# undef imaxdiv
960# if HAVE_RAW_DECL_IMAXDIV 958# if HAVE_RAW_DECL_IMAXDIV
961_GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - " 959_GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - "
962 "use gnulib module imaxdiv for portability"); 960 "use gnulib module imaxdiv for portability");
@@ -970,7 +968,7 @@ _GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - "
970# define strtoimax rpl_strtoimax 968# define strtoimax rpl_strtoimax
971# endif 969# endif
972_GL_FUNCDECL_RPL (strtoimax, intmax_t, 970_GL_FUNCDECL_RPL (strtoimax, intmax_t,
973 (const char *restrict, char **restrict, int) 971 (const char *restrict, char **restrict, int),
974 _GL_ARG_NONNULL ((1))); 972 _GL_ARG_NONNULL ((1)));
975_GL_CXXALIAS_RPL (strtoimax, intmax_t, 973_GL_CXXALIAS_RPL (strtoimax, intmax_t,
976 (const char *restrict, char **restrict, int)); 974 (const char *restrict, char **restrict, int));
@@ -978,7 +976,7 @@ _GL_CXXALIAS_RPL (strtoimax, intmax_t,
978# if !@HAVE_DECL_STRTOIMAX@ 976# if !@HAVE_DECL_STRTOIMAX@
979# undef strtoimax 977# undef strtoimax
980_GL_FUNCDECL_SYS (strtoimax, intmax_t, 978_GL_FUNCDECL_SYS (strtoimax, intmax_t,
981 (const char *restrict, char **restrict, int) 979 (const char *restrict, char **restrict, int),
982 _GL_ARG_NONNULL ((1))); 980 _GL_ARG_NONNULL ((1)));
983# endif 981# endif
984_GL_CXXALIAS_SYS (strtoimax, intmax_t, 982_GL_CXXALIAS_SYS (strtoimax, intmax_t,
@@ -986,7 +984,6 @@ _GL_CXXALIAS_SYS (strtoimax, intmax_t,
986# endif 984# endif
987_GL_CXXALIASWARN (strtoimax); 985_GL_CXXALIASWARN (strtoimax);
988#elif defined GNULIB_POSIXCHECK 986#elif defined GNULIB_POSIXCHECK
989# undef strtoimax
990# if HAVE_RAW_DECL_STRTOIMAX 987# if HAVE_RAW_DECL_STRTOIMAX
991_GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - " 988_GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - "
992 "use gnulib module strtoimax for portability"); 989 "use gnulib module strtoimax for portability");
@@ -1000,7 +997,7 @@ _GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - "
1000# define strtoumax rpl_strtoumax 997# define strtoumax rpl_strtoumax
1001# endif 998# endif
1002_GL_FUNCDECL_RPL (strtoumax, uintmax_t, 999_GL_FUNCDECL_RPL (strtoumax, uintmax_t,
1003 (const char *restrict, char **restrict, int) 1000 (const char *restrict, char **restrict, int),
1004 _GL_ARG_NONNULL ((1))); 1001 _GL_ARG_NONNULL ((1)));
1005_GL_CXXALIAS_RPL (strtoumax, uintmax_t, 1002_GL_CXXALIAS_RPL (strtoumax, uintmax_t,
1006 (const char *restrict, char **restrict, int)); 1003 (const char *restrict, char **restrict, int));
@@ -1008,7 +1005,7 @@ _GL_CXXALIAS_RPL (strtoumax, uintmax_t,
1008# if !@HAVE_DECL_STRTOUMAX@ 1005# if !@HAVE_DECL_STRTOUMAX@
1009# undef strtoumax 1006# undef strtoumax
1010_GL_FUNCDECL_SYS (strtoumax, uintmax_t, 1007_GL_FUNCDECL_SYS (strtoumax, uintmax_t,
1011 (const char *restrict, char **restrict, int) 1008 (const char *restrict, char **restrict, int),
1012 _GL_ARG_NONNULL ((1))); 1009 _GL_ARG_NONNULL ((1)));
1013# endif 1010# endif
1014_GL_CXXALIAS_SYS (strtoumax, uintmax_t, 1011_GL_CXXALIAS_SYS (strtoumax, uintmax_t,
@@ -1016,7 +1013,6 @@ _GL_CXXALIAS_SYS (strtoumax, uintmax_t,
1016# endif 1013# endif
1017_GL_CXXALIASWARN (strtoumax); 1014_GL_CXXALIASWARN (strtoumax);
1018#elif defined GNULIB_POSIXCHECK 1015#elif defined GNULIB_POSIXCHECK
1019# undef strtoumax
1020# if HAVE_RAW_DECL_STRTOUMAX 1016# if HAVE_RAW_DECL_STRTOUMAX
1021_GL_WARN_ON_USE (strtoumax, "strtoumax is unportable - " 1017_GL_WARN_ON_USE (strtoumax, "strtoumax is unportable - "
1022 "use gnulib module strtoumax for portability"); 1018 "use gnulib module strtoumax for portability");
diff --git a/gl/iswblank.c b/gl/iswblank.c
index f699850a..c09f33bd 100644
--- a/gl/iswblank.c
+++ b/gl/iswblank.c
@@ -1,5 +1,5 @@
1/* Test wide character for being blank. 1/* Test wide character for being blank.
2 Copyright (C) 2008-2024 Free Software Foundation, Inc. 2 Copyright (C) 2008-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/iswctype-impl.h b/gl/iswctype-impl.h
index 999f220c..34d84b19 100644
--- a/gl/iswctype-impl.h
+++ b/gl/iswctype-impl.h
@@ -1,5 +1,5 @@
1/* Test whether a wide character has a given property. 1/* Test whether a wide character has a given property.
2 Copyright (C) 2011-2024 Free Software Foundation, Inc. 2 Copyright (C) 2011-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2011. 3 Written by Bruno Haible <bruno@clisp.org>, 2011.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
diff --git a/gl/iswctype.c b/gl/iswctype.c
index f4e6f015..97a60032 100644
--- a/gl/iswctype.c
+++ b/gl/iswctype.c
@@ -1,5 +1,5 @@
1/* Test whether a wide character has a given property. 1/* Test whether a wide character has a given property.
2 Copyright (C) 2011-2024 Free Software Foundation, Inc. 2 Copyright (C) 2011-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2011. 3 Written by Bruno Haible <bruno@clisp.org>, 2011.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
diff --git a/gl/iswdigit.c b/gl/iswdigit.c
index 57363ab8..65616822 100644
--- a/gl/iswdigit.c
+++ b/gl/iswdigit.c
@@ -1,5 +1,5 @@
1/* Test wide character for being a digit. 1/* Test wide character for being a digit.
2 Copyright (C) 2020-2024 Free Software Foundation, Inc. 2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/iswpunct.c b/gl/iswpunct.c
index c7cb28b5..5308ddae 100644
--- a/gl/iswpunct.c
+++ b/gl/iswpunct.c
@@ -1,5 +1,5 @@
1/* Test wide character for being a punctuation or symbol character. 1/* Test wide character for being a punctuation or symbol character.
2 Copyright (C) 2023-2024 Free Software Foundation, Inc. 2 Copyright (C) 2023-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/iswxdigit.c b/gl/iswxdigit.c
index d32e3b0f..7db2f676 100644
--- a/gl/iswxdigit.c
+++ b/gl/iswxdigit.c
@@ -1,5 +1,5 @@
1/* Test wide character for being a hexadecimal digit. 1/* Test wide character for being a hexadecimal digit.
2 Copyright (C) 2020-2024 Free Software Foundation, Inc. 2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/itold.c b/gl/itold.c
index e6fbcff4..d240fb7e 100644
--- a/gl/itold.c
+++ b/gl/itold.c
@@ -1,5 +1,5 @@
1/* Replacement for 'int' to 'long double' conversion routine. 1/* Replacement for 'int' to 'long double' conversion routine.
2 Copyright (C) 2011-2024 Free Software Foundation, Inc. 2 Copyright (C) 2011-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2011. 3 Written by Bruno Haible <bruno@clisp.org>, 2011.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
diff --git a/gl/langinfo.in.h b/gl/langinfo.in.h
index febbd25f..4b3f9b5b 100644
--- a/gl/langinfo.in.h
+++ b/gl/langinfo.in.h
@@ -1,5 +1,5 @@
1/* Substitute for and wrapper around <langinfo.h>. 1/* Substitute for and wrapper around <langinfo.h>.
2 Copyright (C) 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 2009-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -115,6 +115,18 @@ typedef int nl_item;
115# define ABMON_10 (ABMON_1 + 9) 115# define ABMON_10 (ABMON_1 + 9)
116# define ABMON_11 (ABMON_1 + 10) 116# define ABMON_11 (ABMON_1 + 10)
117# define ABMON_12 (ABMON_1 + 11) 117# define ABMON_12 (ABMON_1 + 11)
118# define ABALTMON_1 10220
119# define ABALTMON_2 (ABALTMON_1 + 1)
120# define ABALTMON_3 (ABALTMON_1 + 2)
121# define ABALTMON_4 (ABALTMON_1 + 3)
122# define ABALTMON_5 (ABALTMON_1 + 4)
123# define ABALTMON_6 (ABALTMON_1 + 5)
124# define ABALTMON_7 (ABALTMON_1 + 6)
125# define ABALTMON_8 (ABALTMON_1 + 7)
126# define ABALTMON_9 (ABALTMON_1 + 8)
127# define ABALTMON_10 (ABALTMON_1 + 9)
128# define ABALTMON_11 (ABALTMON_1 + 10)
129# define ABALTMON_12 (ABALTMON_1 + 11)
118# define ERA 10047 130# define ERA 10047
119# define ERA_D_FMT 10048 131# define ERA_D_FMT 10048
120# define ERA_D_T_FMT 10049 132# define ERA_D_T_FMT 10049
@@ -150,11 +162,6 @@ typedef int nl_item;
150# define GNULIB_defined_CODESET 1 162# define GNULIB_defined_CODESET 1
151# endif 163# endif
152 164
153# if !@HAVE_LANGINFO_T_FMT_AMPM@
154# define T_FMT_AMPM 10006
155# define GNULIB_defined_T_FMT_AMPM 1
156# endif
157
158# if !@HAVE_LANGINFO_ALTMON@ 165# if !@HAVE_LANGINFO_ALTMON@
159# define ALTMON_1 10200 166# define ALTMON_1 10200
160# define ALTMON_2 (ALTMON_1 + 1) 167# define ALTMON_2 (ALTMON_1 + 1)
@@ -171,6 +178,37 @@ typedef int nl_item;
171# define GNULIB_defined_ALTMON 1 178# define GNULIB_defined_ALTMON 1
172# endif 179# endif
173 180
181# if !@HAVE_LANGINFO_ABALTMON@
182# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 27
183# define ABALTMON_1 _NL_ABALTMON_1
184# define ABALTMON_2 _NL_ABALTMON_2
185# define ABALTMON_3 _NL_ABALTMON_3
186# define ABALTMON_4 _NL_ABALTMON_4
187# define ABALTMON_5 _NL_ABALTMON_5
188# define ABALTMON_6 _NL_ABALTMON_6
189# define ABALTMON_7 _NL_ABALTMON_7
190# define ABALTMON_8 _NL_ABALTMON_8
191# define ABALTMON_9 _NL_ABALTMON_9
192# define ABALTMON_10 _NL_ABALTMON_10
193# define ABALTMON_11 _NL_ABALTMON_11
194# define ABALTMON_12 _NL_ABALTMON_12
195# else
196# define ABALTMON_1 10220
197# define ABALTMON_2 (ABALTMON_1 + 1)
198# define ABALTMON_3 (ABALTMON_1 + 2)
199# define ABALTMON_4 (ABALTMON_1 + 3)
200# define ABALTMON_5 (ABALTMON_1 + 4)
201# define ABALTMON_6 (ABALTMON_1 + 5)
202# define ABALTMON_7 (ABALTMON_1 + 6)
203# define ABALTMON_8 (ABALTMON_1 + 7)
204# define ABALTMON_9 (ABALTMON_1 + 8)
205# define ABALTMON_10 (ABALTMON_1 + 9)
206# define ABALTMON_11 (ABALTMON_1 + 10)
207# define ABALTMON_12 (ABALTMON_1 + 11)
208# define GNULIB_defined_ABALTMON 1
209# endif
210# endif
211
174# if !@HAVE_LANGINFO_ERA@ 212# if !@HAVE_LANGINFO_ERA@
175# define ERA 10047 213# define ERA 10047
176# define ERA_D_FMT 10048 214# define ERA_D_FMT 10048
@@ -180,12 +218,6 @@ typedef int nl_item;
180# define GNULIB_defined_ERA 1 218# define GNULIB_defined_ERA 1
181# endif 219# endif
182 220
183# if !@HAVE_LANGINFO_YESEXPR@
184# define YESEXPR 10053
185# define NOEXPR 10054
186# define GNULIB_defined_YESEXPR 1
187# endif
188
189#endif 221#endif
190 222
191/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 223/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -205,11 +237,11 @@ typedef int nl_item;
205# undef nl_langinfo 237# undef nl_langinfo
206# define nl_langinfo rpl_nl_langinfo 238# define nl_langinfo rpl_nl_langinfo
207# endif 239# endif
208_GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item)); 240_GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item), );
209_GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item)); 241_GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item));
210# else 242# else
211# if !@HAVE_NL_LANGINFO@ 243# if !@HAVE_NL_LANGINFO@
212_GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item)); 244_GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item), );
213# endif 245# endif
214_GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item)); 246_GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item));
215# endif 247# endif
@@ -217,7 +249,6 @@ _GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item));
217_GL_CXXALIASWARN (nl_langinfo); 249_GL_CXXALIASWARN (nl_langinfo);
218# endif 250# endif
219#elif defined GNULIB_POSIXCHECK 251#elif defined GNULIB_POSIXCHECK
220# undef nl_langinfo
221# if HAVE_RAW_DECL_NL_LANGINFO 252# if HAVE_RAW_DECL_NL_LANGINFO
222_GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - " 253_GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - "
223 "use gnulib module nl_langinfo for portability"); 254 "use gnulib module nl_langinfo for portability");
diff --git a/gl/lc-charset-dispatch.c b/gl/lc-charset-dispatch.c
index e2f8b2f5..53a9b2cd 100644
--- a/gl/lc-charset-dispatch.c
+++ b/gl/lc-charset-dispatch.c
@@ -1,5 +1,5 @@
1/* Dispatching based on the current locale's character encoding. 1/* Dispatching based on the current locale's character encoding.
2 Copyright (C) 2018-2024 Free Software Foundation, Inc. 2 Copyright (C) 2018-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/lc-charset-dispatch.h b/gl/lc-charset-dispatch.h
index 4c1cf5f1..665da408 100644
--- a/gl/lc-charset-dispatch.h
+++ b/gl/lc-charset-dispatch.h
@@ -1,5 +1,5 @@
1/* Dispatching based on the current locale's character encoding. 1/* Dispatching based on the current locale's character encoding.
2 Copyright (C) 2018-2024 Free Software Foundation, Inc. 2 Copyright (C) 2018-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/libc-config.h b/gl/libc-config.h
index 70114608..e5102aa9 100644
--- a/gl/libc-config.h
+++ b/gl/libc-config.h
@@ -1,6 +1,6 @@
1/* System definitions for code taken from the GNU C Library 1/* System definitions for code taken from the GNU C Library
2 2
3 Copyright 2017-2024 Free Software Foundation, Inc. 3 Copyright 2017-2026 Free Software Foundation, Inc.
4 4
5 This program is free software; you can redistribute it and/or 5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public 6 modify it under the terms of the GNU Lesser General Public
@@ -48,6 +48,11 @@
48 48
49/* From glibc <features.h>. */ 49/* From glibc <features.h>. */
50 50
51#if defined __clang__
52 /* clang really only groks GNU C 4.2, regardless of its value of __GNUC__. */
53# undef __GNUC_PREREQ
54# define __GNUC_PREREQ(maj, min) ((maj) < 4 + ((min) <= 2))
55#endif
51#ifndef __GNUC_PREREQ 56#ifndef __GNUC_PREREQ
52# if defined __GNUC__ && defined __GNUC_MINOR__ 57# if defined __GNUC__ && defined __GNUC_MINOR__
53# define __GNUC_PREREQ(maj, min) ((maj) < __GNUC__ + ((min) <= __GNUC_MINOR__)) 58# define __GNUC_PREREQ(maj, min) ((maj) < __GNUC__ + ((min) <= __GNUC_MINOR__))
diff --git a/gl/limits.in.h b/gl/limits.in.h
index c65eb4c1..66bd63ee 100644
--- a/gl/limits.in.h
+++ b/gl/limits.in.h
@@ -1,6 +1,6 @@
1/* A GNU-like <limits.h>. 1/* A GNU-like <limits.h>.
2 2
3 Copyright 2016-2024 Free Software Foundation, Inc. 3 Copyright 2016-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -20,7 +20,7 @@
20#endif 20#endif
21@PRAGMA_COLUMNS@ 21@PRAGMA_COLUMNS@
22 22
23#if defined _GL_ALREADY_INCLUDING_LIMITS_H 23#if defined _@GUARD_PREFIX@_ALREADY_INCLUDING_LIMITS_H
24/* Special invocation convention: 24/* Special invocation convention:
25 On Haiku/x86_64, we have a sequence of nested includes 25 On Haiku/x86_64, we have a sequence of nested includes
26 <limits.h> -> <syslimits.h> -> <limits.h>. 26 <limits.h> -> <syslimits.h> -> <limits.h>.
@@ -34,12 +34,12 @@
34 34
35#ifndef _@GUARD_PREFIX@_LIMITS_H 35#ifndef _@GUARD_PREFIX@_LIMITS_H
36 36
37# define _GL_ALREADY_INCLUDING_LIMITS_H 37# define _@GUARD_PREFIX@_ALREADY_INCLUDING_LIMITS_H
38 38
39/* The include_next requires a split double-inclusion guard. */ 39/* The include_next requires a split double-inclusion guard. */
40# @INCLUDE_NEXT@ @NEXT_LIMITS_H@ 40# @INCLUDE_NEXT@ @NEXT_LIMITS_H@
41 41
42# undef _GL_ALREADY_INCLUDING_LIMITS_H 42# undef _@GUARD_PREFIX@_ALREADY_INCLUDING_LIMITS_H
43 43
44#ifndef _@GUARD_PREFIX@_LIMITS_H 44#ifndef _@GUARD_PREFIX@_LIMITS_H
45#define _@GUARD_PREFIX@_LIMITS_H 45#define _@GUARD_PREFIX@_LIMITS_H
@@ -47,7 +47,7 @@
47#ifndef LLONG_MIN 47#ifndef LLONG_MIN
48# if defined LONG_LONG_MIN /* HP-UX 11.31 */ 48# if defined LONG_LONG_MIN /* HP-UX 11.31 */
49# define LLONG_MIN LONG_LONG_MIN 49# define LLONG_MIN LONG_LONG_MIN
50# elif defined LONGLONG_MIN /* IRIX 6.5 */ 50# elif defined LONGLONG_MIN /* AIX, BeOS */
51# define LLONG_MIN LONGLONG_MIN 51# define LLONG_MIN LONGLONG_MIN
52# elif defined __GNUC__ 52# elif defined __GNUC__
53# define LLONG_MIN (- __LONG_LONG_MAX__ - 1LL) 53# define LLONG_MIN (- __LONG_LONG_MAX__ - 1LL)
@@ -56,7 +56,7 @@
56#ifndef LLONG_MAX 56#ifndef LLONG_MAX
57# if defined LONG_LONG_MAX /* HP-UX 11.31 */ 57# if defined LONG_LONG_MAX /* HP-UX 11.31 */
58# define LLONG_MAX LONG_LONG_MAX 58# define LLONG_MAX LONG_LONG_MAX
59# elif defined LONGLONG_MAX /* IRIX 6.5 */ 59# elif defined LONGLONG_MAX /* AIX, BeOS */
60# define LLONG_MAX LONGLONG_MAX 60# define LLONG_MAX LONGLONG_MAX
61# elif defined __GNUC__ 61# elif defined __GNUC__
62# define LLONG_MAX __LONG_LONG_MAX__ 62# define LLONG_MAX __LONG_LONG_MAX__
@@ -65,7 +65,7 @@
65#ifndef ULLONG_MAX 65#ifndef ULLONG_MAX
66# if defined ULONG_LONG_MAX /* HP-UX 11.31 */ 66# if defined ULONG_LONG_MAX /* HP-UX 11.31 */
67# define ULLONG_MAX ULONG_LONG_MAX 67# define ULLONG_MAX ULONG_LONG_MAX
68# elif defined ULONGLONG_MAX /* IRIX 6.5 */ 68# elif defined ULONGLONG_MAX /* AIX, BeOS */
69# define ULLONG_MAX ULONGLONG_MAX 69# define ULLONG_MAX ULONGLONG_MAX
70# elif defined __GNUC__ 70# elif defined __GNUC__
71# define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1ULL) 71# define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1ULL)
diff --git a/gl/localcharset.c b/gl/localcharset.c
index 93c4baa4..22dc38d3 100644
--- a/gl/localcharset.c
+++ b/gl/localcharset.c
@@ -1,6 +1,6 @@
1/* Determine a canonical name for the current locale's character encoding. 1/* Determine a canonical name for the current locale's character encoding.
2 2
3 Copyright (C) 2000-2006, 2008-2024 Free Software Foundation, Inc. 3 Copyright (C) 2000-2006, 2008-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -279,45 +279,6 @@ static const struct table_entry alias_table[] =
279 { "utf8", "UTF-8" } 279 { "utf8", "UTF-8" }
280# define alias_table_defined 280# define alias_table_defined
281# endif 281# endif
282# if defined __sgi /* IRIX */
283 { "ISO8859-1", "ISO-8859-1" },
284 { "ISO8859-15", "ISO-8859-15" },
285 { "ISO8859-2", "ISO-8859-2" },
286 { "ISO8859-5", "ISO-8859-5" },
287 { "ISO8859-7", "ISO-8859-7" },
288 { "ISO8859-9", "ISO-8859-9" },
289 { "eucCN", "GB2312" },
290 { "eucJP", "EUC-JP" },
291 { "eucKR", "EUC-KR" },
292 { "eucTW", "EUC-TW" }
293# define alias_table_defined
294# endif
295# if defined __osf__ /* OSF/1 */
296 /*{ "GBK", "GBK" },*/
297 { "ISO8859-1", "ISO-8859-1" },
298 { "ISO8859-15", "ISO-8859-15" },
299 { "ISO8859-2", "ISO-8859-2" },
300 { "ISO8859-4", "ISO-8859-4" },
301 { "ISO8859-5", "ISO-8859-5" },
302 { "ISO8859-7", "ISO-8859-7" },
303 { "ISO8859-8", "ISO-8859-8" },
304 { "ISO8859-9", "ISO-8859-9" },
305 { "KSC5601", "CP949" },
306 { "SJIS", "SHIFT_JIS" },
307 { "TACTIS", "TIS-620" },
308 /*{ "UTF-8", "UTF-8" },*/
309 { "big5", "BIG5" },
310 { "cp850", "CP850" },
311 { "dechanyu", "DEC-HANYU" },
312 { "dechanzi", "GB2312" },
313 { "deckanji", "DEC-KANJI" },
314 { "deckorean", "EUC-KR" },
315 { "eucJP", "EUC-JP" },
316 { "eucKR", "EUC-KR" },
317 { "eucTW", "EUC-TW" },
318 { "sdeckanji", "EUC-JP" }
319# define alias_table_defined
320# endif
321# if defined __sun /* Solaris */ 282# if defined __sun /* Solaris */
322 { "5601", "EUC-KR" }, 283 { "5601", "EUC-KR" },
323 { "646", "ASCII" }, 284 { "646", "ASCII" },
@@ -380,7 +341,7 @@ static const struct table_entry alias_table[] =
380# if defined OS2 /* OS/2 */ 341# if defined OS2 /* OS/2 */
381 /* The list of encodings is taken from "List of OS/2 Codepages" 342 /* The list of encodings is taken from "List of OS/2 Codepages"
382 by Alex Taylor: 343 by Alex Taylor:
383 <http://altsan.org/os2/toolkits/uls/index.html#codepages>. 344 <https://altsan.org/os2/toolkits/uls/index.html#codepages>.
384 See also "__convcp() of kLIBC": 345 See also "__convcp() of kLIBC":
385 <https://github.com/bitwiseworks/libc/blob/master/src/emx/src/lib/locale/__convcp.c>. */ 346 <https://github.com/bitwiseworks/libc/blob/master/src/emx/src/lib/locale/__convcp.c>. */
386 { "CP1004", "CP1252" }, 347 { "CP1004", "CP1252" },
@@ -850,12 +811,11 @@ locale_charset (void)
850 /* Cygwin < 1.7 does not have locales. nl_langinfo (CODESET) always 811 /* Cygwin < 1.7 does not have locales. nl_langinfo (CODESET) always
851 returns "US-ASCII". Return the suffix of the locale name from the 812 returns "US-ASCII". Return the suffix of the locale name from the
852 environment variables (if present) or the codepage as a number. */ 813 environment variables (if present) or the codepage as a number. */
853 if (codeset != NULL && strcmp (codeset, "US-ASCII") == 0) 814 if (codeset != NULL && streq (codeset, "US-ASCII"))
854 { 815 {
855 const char *locale;
856 static char resultbuf[2 + 10 + 1]; 816 static char resultbuf[2 + 10 + 1];
857 817
858 locale = getenv ("LC_ALL"); 818 const char *locale = getenv ("LC_ALL");
859 if (locale == NULL || locale[0] == '\0') 819 if (locale == NULL || locale[0] == '\0')
860 { 820 {
861 locale = getenv ("LC_CTYPE"); 821 locale = getenv ("LC_CTYPE");
@@ -939,8 +899,9 @@ locale_charset (void)
939 sprintf (buf, "CP%u", GetACP ()); 899 sprintf (buf, "CP%u", GetACP ());
940 } 900 }
941 /* For a locale name such as "French_France.65001", in Windows 10, 901 /* For a locale name such as "French_France.65001", in Windows 10,
942 setlocale now returns "French_France.utf8" instead. */ 902 setlocale now returns "French_France.utf8" instead, or in the UTF-8
943 if (strcmp (buf + 2, "65001") == 0 || strcmp (buf + 2, "utf8") == 0) 903 environment (with modern system settings) "fr_FR.UTF-8". */
904 if (streq (buf + 2, "65001") || streq (buf + 2, "utf8") || streq (buf + 2, "UTF-8"))
944 codeset = "UTF-8"; 905 codeset = "UTF-8";
945 else 906 else
946 { 907 {
@@ -950,16 +911,13 @@ locale_charset (void)
950 911
951# elif defined OS2 912# elif defined OS2
952 913
953 const char *locale;
954 static char resultbuf[2 + 10 + 1]; 914 static char resultbuf[2 + 10 + 1];
955 ULONG cp[3];
956 ULONG cplen;
957 915
958 codeset = NULL; 916 codeset = NULL;
959 917
960 /* Allow user to override the codeset, as set in the operating system, 918 /* Allow user to override the codeset, as set in the operating system,
961 with standard language environment variables. */ 919 with standard language environment variables. */
962 locale = getenv ("LC_ALL"); 920 const char *locale = getenv ("LC_ALL");
963 if (locale == NULL || locale[0] == '\0') 921 if (locale == NULL || locale[0] == '\0')
964 { 922 {
965 locale = getenv ("LC_CTYPE"); 923 locale = getenv ("LC_CTYPE");
@@ -990,12 +948,15 @@ locale_charset (void)
990 } 948 }
991 949
992 /* For the POSIX locale, don't use the system's codepage. */ 950 /* For the POSIX locale, don't use the system's codepage. */
993 if (strcmp (locale, "C") == 0 || strcmp (locale, "POSIX") == 0) 951 if (streq (locale, "C") || streq (locale, "POSIX"))
994 codeset = ""; 952 codeset = "";
995 } 953 }
996 954
997 if (codeset == NULL) 955 if (codeset == NULL)
998 { 956 {
957 ULONG cp[3];
958 ULONG cplen;
959
999 /* OS/2 has a function returning the locale's codepage as a number. */ 960 /* OS/2 has a function returning the locale's codepage as a number. */
1000 if (DosQueryCp (sizeof (cp), cp, &cplen)) 961 if (DosQueryCp (sizeof (cp), cp, &cplen))
1001 codeset = ""; 962 codeset = "";
@@ -1022,7 +983,7 @@ locale_charset (void)
1022 Speed up the common case and slow down the less common cases by 983 Speed up the common case and slow down the less common cases by
1023 testing for this case first. */ 984 testing for this case first. */
1024# if defined __OpenBSD__ || (defined __APPLE__ && defined __MACH__) || defined __sun || defined __CYGWIN__ 985# if defined __OpenBSD__ || (defined __APPLE__ && defined __MACH__) || defined __sun || defined __CYGWIN__
1025 if (strcmp (codeset, "UTF-8") == 0) 986 if (streq (codeset, "UTF-8"))
1026 goto done_table_lookup; 987 goto done_table_lookup;
1027 else 988 else
1028# endif 989# endif
@@ -1151,7 +1112,7 @@ locale_charset (void)
1151#ifdef DARWIN7 1112#ifdef DARWIN7
1152 /* Mac OS X sets MB_CUR_MAX to 1 when LC_ALL=C, and "UTF-8" 1113 /* Mac OS X sets MB_CUR_MAX to 1 when LC_ALL=C, and "UTF-8"
1153 (the default codeset) does not work when MB_CUR_MAX is 1. */ 1114 (the default codeset) does not work when MB_CUR_MAX is 1. */
1154 if (strcmp (codeset, "UTF-8") == 0 && MB_CUR_MAX_L (uselocale (NULL)) <= 1) 1115 if (streq (codeset, "UTF-8") && MB_CUR_MAX_L (uselocale (NULL)) <= 1)
1155 codeset = "ASCII"; 1116 codeset = "ASCII";
1156#endif 1117#endif
1157 1118
diff --git a/gl/localcharset.h b/gl/localcharset.h
index 47214024..59f748d7 100644
--- a/gl/localcharset.h
+++ b/gl/localcharset.h
@@ -1,5 +1,5 @@
1/* Determine a canonical name for the current locale's character encoding. 1/* Determine a canonical name for the current locale's character encoding.
2 Copyright (C) 2000-2003, 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 2000-2003, 2009-2026 Free Software Foundation, Inc.
3 This file is part of the GNU CHARSET Library. 3 This file is part of the GNU CHARSET Library.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
@@ -48,24 +48,24 @@ extern const char * locale_charset (void);
48 (darwin = Mac OS X, windows = native Windows) 48 (darwin = Mac OS X, windows = native Windows)
49 49
50 ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin minix cygwin 50 ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin minix cygwin
51 ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos 51 ISO-8859-1 Y glibc aix hpux solaris freebsd netbsd openbsd darwin cygwin zos
52 ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos 52 ISO-8859-2 Y glibc aix hpux solaris freebsd netbsd openbsd darwin cygwin zos
53 ISO-8859-3 Y glibc solaris cygwin 53 ISO-8859-3 Y glibc solaris cygwin
54 ISO-8859-4 Y hpux osf solaris freebsd netbsd openbsd darwin 54 ISO-8859-4 Y hpux solaris freebsd netbsd openbsd darwin
55 ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos 55 ISO-8859-5 Y glibc aix hpux solaris freebsd netbsd openbsd darwin cygwin zos
56 ISO-8859-6 Y glibc aix hpux solaris cygwin 56 ISO-8859-6 Y glibc aix hpux solaris cygwin
57 ISO-8859-7 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos 57 ISO-8859-7 Y glibc aix hpux solaris freebsd netbsd openbsd darwin cygwin zos
58 ISO-8859-8 Y glibc aix hpux osf solaris cygwin zos 58 ISO-8859-8 Y glibc aix hpux solaris cygwin zos
59 ISO-8859-9 Y glibc aix hpux irix osf solaris freebsd darwin cygwin zos 59 ISO-8859-9 Y glibc aix hpux solaris freebsd darwin cygwin zos
60 ISO-8859-13 glibc hpux solaris freebsd netbsd openbsd darwin cygwin 60 ISO-8859-13 glibc hpux solaris freebsd netbsd openbsd darwin cygwin
61 ISO-8859-14 glibc cygwin 61 ISO-8859-14 glibc cygwin
62 ISO-8859-15 glibc aix irix osf solaris freebsd netbsd openbsd darwin cygwin 62 ISO-8859-15 glibc aix solaris freebsd netbsd openbsd darwin cygwin
63 KOI8-R Y glibc hpux solaris freebsd netbsd openbsd darwin 63 KOI8-R Y glibc hpux solaris freebsd netbsd openbsd darwin
64 KOI8-U Y glibc freebsd netbsd openbsd darwin cygwin 64 KOI8-U Y glibc freebsd netbsd openbsd darwin cygwin
65 KOI8-T glibc 65 KOI8-T glibc
66 CP437 dos 66 CP437 dos
67 CP775 dos 67 CP775 dos
68 CP850 aix osf dos 68 CP850 aix dos
69 CP852 dos 69 CP852 dos
70 CP855 dos 70 CP855 dos
71 CP856 aix 71 CP856 aix
@@ -80,7 +80,7 @@ extern const char * locale_charset (void);
80 CP922 aix 80 CP922 aix
81 CP932 aix cygwin windows dos 81 CP932 aix cygwin windows dos
82 CP943 aix zos 82 CP943 aix zos
83 CP949 osf darwin windows dos 83 CP949 darwin windows dos
84 CP950 windows dos 84 CP950 windows dos
85 CP1046 aix 85 CP1046 aix
86 CP1124 aix 86 CP1124 aix
@@ -95,17 +95,17 @@ extern const char * locale_charset (void);
95 CP1255 glibc windows 95 CP1255 glibc windows
96 CP1256 windows 96 CP1256 windows
97 CP1257 windows 97 CP1257 windows
98 GB2312 Y glibc aix hpux irix solaris freebsd netbsd darwin cygwin zos 98 GB2312 Y glibc aix hpux solaris freebsd netbsd darwin cygwin zos
99 EUC-JP Y glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin 99 EUC-JP Y glibc aix hpux solaris freebsd netbsd darwin cygwin
100 EUC-KR Y glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin zos 100 EUC-KR Y glibc aix hpux solaris freebsd netbsd darwin cygwin zos
101 EUC-TW glibc aix hpux irix osf solaris netbsd 101 EUC-TW glibc aix hpux solaris netbsd
102 BIG5 Y glibc aix hpux osf solaris freebsd netbsd darwin cygwin zos 102 BIG5 Y glibc aix hpux solaris freebsd netbsd darwin cygwin zos
103 BIG5-HKSCS glibc hpux solaris netbsd darwin 103 BIG5-HKSCS glibc hpux solaris netbsd darwin
104 GBK glibc aix osf solaris freebsd darwin cygwin windows dos 104 GBK glibc aix solaris freebsd darwin cygwin windows dos
105 GB18030 glibc hpux solaris freebsd netbsd darwin 105 GB18030 glibc hpux solaris freebsd netbsd darwin
106 SHIFT_JIS Y hpux osf solaris freebsd netbsd darwin 106 SHIFT_JIS Y hpux solaris freebsd netbsd darwin
107 JOHAB solaris windows 107 JOHAB solaris windows
108 TIS-620 glibc aix hpux osf solaris cygwin zos 108 TIS-620 glibc aix hpux solaris cygwin zos
109 ARMSCII-8 glibc freebsd netbsd darwin 109 ARMSCII-8 glibc freebsd netbsd darwin
110 GEORGIAN-PS glibc cygwin 110 GEORGIAN-PS glibc cygwin
111 PT154 glibc netbsd cygwin 111 PT154 glibc netbsd cygwin
@@ -115,9 +115,9 @@ extern const char * locale_charset (void);
115 HP-HEBREW8 hpux 115 HP-HEBREW8 hpux
116 HP-TURKISH8 hpux 116 HP-TURKISH8 hpux
117 HP-KANA8 hpux 117 HP-KANA8 hpux
118 DEC-KANJI osf 118 DEC-KANJI vms
119 DEC-HANYU osf 119 DEC-HANYU vms
120 UTF-8 Y glibc aix hpux osf solaris netbsd darwin cygwin zos 120 UTF-8 Y glibc aix hpux solaris netbsd darwin cygwin zos
121 121
122 Note: Names which are not marked as being a MIME name should not be used in 122 Note: Names which are not marked as being a MIME name should not be used in
123 Internet protocols for information interchange (mail, news, etc.). 123 Internet protocols for information interchange (mail, news, etc.).
diff --git a/gl/locale.in.h b/gl/locale.in.h
index 1b11a41c..c264493e 100644
--- a/gl/locale.in.h
+++ b/gl/locale.in.h
@@ -1,5 +1,5 @@
1/* A POSIX <locale.h>. 1/* A POSIX <locale.h>.
2 Copyright (C) 2007-2024 Free Software Foundation, Inc. 2 Copyright (C) 2007-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -20,7 +20,7 @@
20@PRAGMA_COLUMNS@ 20@PRAGMA_COLUMNS@
21 21
22#if (defined _WIN32 && !defined __CYGWIN__ && defined __need_locale_t) \ 22#if (defined _WIN32 && !defined __CYGWIN__ && defined __need_locale_t) \
23 || defined _GL_ALREADY_INCLUDING_LOCALE_H 23 || defined _@GUARD_PREFIX@_ALREADY_INCLUDING_LOCALE_H
24 24
25/* Special invocation convention: 25/* Special invocation convention:
26 - Inside mingw header files, 26 - Inside mingw header files,
@@ -34,12 +34,12 @@
34 34
35#ifndef _@GUARD_PREFIX@_LOCALE_H 35#ifndef _@GUARD_PREFIX@_LOCALE_H
36 36
37#define _GL_ALREADY_INCLUDING_LOCALE_H 37#define _@GUARD_PREFIX@_ALREADY_INCLUDING_LOCALE_H
38 38
39/* The include_next requires a split double-inclusion guard. */ 39/* The include_next requires a split double-inclusion guard. */
40#@INCLUDE_NEXT@ @NEXT_LOCALE_H@ 40#@INCLUDE_NEXT@ @NEXT_LOCALE_H@
41 41
42#undef _GL_ALREADY_INCLUDING_LOCALE_H 42#undef _@GUARD_PREFIX@_ALREADY_INCLUDING_LOCALE_H
43 43
44#ifndef _@GUARD_PREFIX@_LOCALE_H 44#ifndef _@GUARD_PREFIX@_LOCALE_H
45#define _@GUARD_PREFIX@_LOCALE_H 45#define _@GUARD_PREFIX@_LOCALE_H
@@ -69,6 +69,85 @@
69# define LC_MESSAGES 1729 69# define LC_MESSAGES 1729
70#endif 70#endif
71 71
72#if !@HAVE_LOCALE_T@
73# if !defined GNULIB_defined_locale_t
74/* The values of the POSIX-standardized LC_* macros are:
75
76 LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME
77
78 glibc, Solaris, 3 0 5 4 1 2
79 Android
80 macOS, *BSD 1 2 6 3 4 5
81 native Windows 1 2 1729 3 4 5
82
83 We map these to the log2(LC_*_MASK) values, chosen to be compatible with
84 later releases of the same operating system. */
85# if defined __APPLE__ && defined __MACH__ /* macOS */
86/* LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME
87
88 category 1 2 6 3 4 5
89 log2(LC_*_MASK) 0 1 2 3 4 5
90 */
91# define gl_log2_lc_mask(category) ((0x2543100 >> (4 * (category))) & 0xf)
92# elif defined __FreeBSD__ || defined __DragonFly__ /* FreeBSD */
93/* LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME
94
95 category 1 2 6 3 4 5
96 log2(LC_*_MASK) 0 1 5 2 3 4
97 */
98# define gl_log2_lc_mask(category) ((category) - 1)
99# elif defined _WIN32 && !defined __CYGWIN__ /* native Windows */
100# define gl_log2_lc_mask(category) \
101 ((category) == LC_MESSAGES ? 0 : (category))
102# else /* glibc, Solaris, Android, NetBSD, OpenBSD */
103# define gl_log2_lc_mask(category) (category)
104# endif
105/* From there we map them to array indices 0..5. */
106# if (gl_log2_lc_mask (LC_COLLATE) == 0 || gl_log2_lc_mask (LC_CTYPE) == 0 \
107 || gl_log2_lc_mask (LC_MESSAGES) == 0)
108 /* glibc, Solaris, Android, macOS, FreeBSD, native Windows */
109# define gl_log2_lcmask_to_index(c) (c)
110# define gl_index_to_log2_lcmask(i) (i)
111# else
112 /* NetBSD, OpenBSD */
113# define gl_log2_lcmask_to_index(c) ((c) - 1)
114# define gl_index_to_log2_lcmask(i) ((i) + 1)
115# endif
116/* Define the LC_*_MASK macros. */
117# define LC_COLLATE_MASK (1 << gl_log2_lc_mask (LC_COLLATE))
118# define LC_CTYPE_MASK (1 << gl_log2_lc_mask (LC_CTYPE))
119# define LC_MESSAGES_MASK (1 << gl_log2_lc_mask (LC_MESSAGES))
120# define LC_MONETARY_MASK (1 << gl_log2_lc_mask (LC_MONETARY))
121# define LC_NUMERIC_MASK (1 << gl_log2_lc_mask (LC_NUMERIC))
122# define LC_TIME_MASK (1 << gl_log2_lc_mask (LC_TIME))
123# define LC_ALL_MASK \
124 (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | LC_MONETARY_MASK \
125 | LC_NUMERIC_MASK | LC_TIME_MASK)
126/* Now define the locale_t type. */
127struct gl_locale_category_t
128{
129 char *name;
130 bool is_c_locale;
131# if @HAVE_WINDOWS_LOCALE_T@
132 /* Use the native Windows '_locale_t' type.
133 Documentation:
134 <https://learn.microsoft.com/en-us/cpp/c-runtime-library/locale>
135 This field is NULL if is_c_locale is true. But don't use this NULL value,
136 since for the native Windows *_l functions a null _locale_t means to use
137 the global locale. */
138 _locale_t system_locale;
139# endif
140};
141struct gl_locale_t
142{
143 struct gl_locale_category_t category[6];
144};
145typedef struct gl_locale_t *locale_t;
146# define LC_GLOBAL_LOCALE ((locale_t)(-1))
147# define GNULIB_defined_locale_t 1
148# endif
149#endif
150
72/* On native Windows with MSVC, 'struct lconv' lacks the members int_p_* and 151/* On native Windows with MSVC, 'struct lconv' lacks the members int_p_* and
73 int_n_*. Instead of overriding 'struct lconv', merely define these member 152 int_n_*. Instead of overriding 'struct lconv', merely define these member
74 names as macros. This avoids trouble in C++ mode. */ 153 names as macros. This avoids trouble in C++ mode. */
@@ -83,7 +162,8 @@
83 162
84/* Bionic libc's 'struct lconv' is just a dummy. */ 163/* Bionic libc's 'struct lconv' is just a dummy. */
85#if @REPLACE_STRUCT_LCONV@ 164#if @REPLACE_STRUCT_LCONV@
86# define lconv rpl_lconv 165# if !defined GNULIB_defined_struct_lconv
166# define lconv rpl_lconv
87struct lconv 167struct lconv
88{ 168{
89 /* All 'char *' are actually 'const char *'. */ 169 /* All 'char *' are actually 'const char *'. */
@@ -160,6 +240,8 @@ struct lconv
160 number. */ 240 number. */
161 char int_n_sep_by_space; 241 char int_n_sep_by_space;
162}; 242};
243# define GNULIB_defined_struct_lconv 1
244# endif
163#endif 245#endif
164 246
165#if @GNULIB_LOCALECONV@ 247#if @GNULIB_LOCALECONV@
@@ -168,7 +250,7 @@ struct lconv
168# undef localeconv 250# undef localeconv
169# define localeconv rpl_localeconv 251# define localeconv rpl_localeconv
170# endif 252# endif
171_GL_FUNCDECL_RPL (localeconv, struct lconv *, (void)); 253_GL_FUNCDECL_RPL (localeconv, struct lconv *, (void), );
172_GL_CXXALIAS_RPL (localeconv, struct lconv *, (void)); 254_GL_CXXALIAS_RPL (localeconv, struct lconv *, (void));
173# else 255# else
174_GL_CXXALIAS_SYS (localeconv, struct lconv *, (void)); 256_GL_CXXALIAS_SYS (localeconv, struct lconv *, (void));
@@ -177,10 +259,11 @@ _GL_CXXALIAS_SYS (localeconv, struct lconv *, (void));
177_GL_CXXALIASWARN (localeconv); 259_GL_CXXALIASWARN (localeconv);
178# endif 260# endif
179#elif @REPLACE_STRUCT_LCONV@ 261#elif @REPLACE_STRUCT_LCONV@
180# undef localeconv 262# if !GNULIB_LOCALECONV
181# define localeconv localeconv_used_without_requesting_gnulib_module_localeconv 263# undef localeconv
264# define localeconv localeconv_used_without_requesting_gnulib_module_localeconv
265# endif
182#elif defined GNULIB_POSIXCHECK 266#elif defined GNULIB_POSIXCHECK
183# undef localeconv
184# if HAVE_RAW_DECL_LOCALECONV 267# if HAVE_RAW_DECL_LOCALECONV
185_GL_WARN_ON_USE (localeconv, 268_GL_WARN_ON_USE (localeconv,
186 "localeconv returns too few information on some platforms - " 269 "localeconv returns too few information on some platforms - "
@@ -195,7 +278,7 @@ _GL_WARN_ON_USE (localeconv,
195# define setlocale rpl_setlocale 278# define setlocale rpl_setlocale
196# define GNULIB_defined_setlocale 1 279# define GNULIB_defined_setlocale 1
197# endif 280# endif
198_GL_FUNCDECL_RPL (setlocale, char *, (int category, const char *locale)); 281_GL_FUNCDECL_RPL (setlocale, char *, (int category, const char *locale), );
199_GL_CXXALIAS_RPL (setlocale, char *, (int category, const char *locale)); 282_GL_CXXALIAS_RPL (setlocale, char *, (int category, const char *locale));
200# else 283# else
201_GL_CXXALIAS_SYS (setlocale, char *, (int category, const char *locale)); 284_GL_CXXALIAS_SYS (setlocale, char *, (int category, const char *locale));
@@ -204,7 +287,6 @@ _GL_CXXALIAS_SYS (setlocale, char *, (int category, const char *locale));
204_GL_CXXALIASWARN (setlocale); 287_GL_CXXALIASWARN (setlocale);
205# endif 288# endif
206#elif defined GNULIB_POSIXCHECK 289#elif defined GNULIB_POSIXCHECK
207# undef setlocale
208# if HAVE_RAW_DECL_SETLOCALE 290# if HAVE_RAW_DECL_SETLOCALE
209_GL_WARN_ON_USE (setlocale, "setlocale works differently on native Windows - " 291_GL_WARN_ON_USE (setlocale, "setlocale works differently on native Windows - "
210 "use gnulib module setlocale for portability"); 292 "use gnulib module setlocale for portability");
@@ -216,7 +298,7 @@ _GL_WARN_ON_USE (setlocale, "setlocale works differently on native Windows - "
216# include "setlocale_null.h" 298# include "setlocale_null.h"
217#endif 299#endif
218 300
219#if /*@GNULIB_NEWLOCALE@ ||*/ (@GNULIB_LOCALENAME_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_NEWLOCALE@) 301#if @GNULIB_NEWLOCALE@ || (@GNULIB_GETLOCALENAME_L_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_NEWLOCALE@)
220# if @REPLACE_NEWLOCALE@ 302# if @REPLACE_NEWLOCALE@
221# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 303# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
222# undef newlocale 304# undef newlocale
@@ -224,87 +306,108 @@ _GL_WARN_ON_USE (setlocale, "setlocale works differently on native Windows - "
224# define GNULIB_defined_newlocale 1 306# define GNULIB_defined_newlocale 1
225# endif 307# endif
226_GL_FUNCDECL_RPL (newlocale, locale_t, 308_GL_FUNCDECL_RPL (newlocale, locale_t,
227 (int category_mask, const char *name, locale_t base) 309 (int category_mask, const char *name, locale_t base),
228 _GL_ARG_NONNULL ((2))); 310 _GL_ARG_NONNULL ((2)));
229_GL_CXXALIAS_RPL (newlocale, locale_t, 311_GL_CXXALIAS_RPL (newlocale, locale_t,
230 (int category_mask, const char *name, locale_t base)); 312 (int category_mask, const char *name, locale_t base));
231# else 313# else
232# if @HAVE_NEWLOCALE@ 314# if !@HAVE_NEWLOCALE@
315_GL_FUNCDECL_SYS (newlocale, locale_t,
316 (int category_mask, const char *name, locale_t base),
317 _GL_ARG_NONNULL ((2)));
318# endif
233_GL_CXXALIAS_SYS (newlocale, locale_t, 319_GL_CXXALIAS_SYS (newlocale, locale_t,
234 (int category_mask, const char *name, locale_t base)); 320 (int category_mask, const char *name, locale_t base));
235# endif
236# endif 321# endif
237# if __GLIBC__ >= 2 && @HAVE_NEWLOCALE@ 322# if __GLIBC__ >= 2
238_GL_CXXALIASWARN (newlocale); 323_GL_CXXALIASWARN (newlocale);
239# endif 324# endif
240# if @HAVE_NEWLOCALE@ || @REPLACE_NEWLOCALE@
241# ifndef HAVE_WORKING_NEWLOCALE
242# define HAVE_WORKING_NEWLOCALE 1
243# endif
244# endif
245#elif defined GNULIB_POSIXCHECK 325#elif defined GNULIB_POSIXCHECK
246# undef newlocale
247# if HAVE_RAW_DECL_NEWLOCALE 326# if HAVE_RAW_DECL_NEWLOCALE
248_GL_WARN_ON_USE (newlocale, "newlocale is not portable"); 327_GL_WARN_ON_USE (newlocale, "newlocale is not portable");
249# endif 328# endif
250#endif 329#endif
251 330
252#if @GNULIB_DUPLOCALE@ || (@GNULIB_LOCALENAME_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_DUPLOCALE@) 331#if @GNULIB_DUPLOCALE@ || (@GNULIB_GETLOCALENAME_L_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_DUPLOCALE@)
253# if @HAVE_DUPLOCALE@ /* locale_t may be undefined if !@HAVE_DUPLOCALE@. */ 332# if @REPLACE_DUPLOCALE@
254# if @REPLACE_DUPLOCALE@ 333# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
255# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 334# undef duplocale
256# undef duplocale 335# define duplocale rpl_duplocale
257# define duplocale rpl_duplocale 336# define GNULIB_defined_duplocale 1
258# define GNULIB_defined_duplocale 1 337# endif
259# endif 338_GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale), _GL_ARG_NONNULL ((1)));
260_GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale) _GL_ARG_NONNULL ((1)));
261_GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale)); 339_GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale));
262# else 340# else
263_GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale)); 341# if !@HAVE_DUPLOCALE@
342_GL_FUNCDECL_SYS (duplocale, locale_t, (locale_t locale), _GL_ARG_NONNULL ((1)));
264# endif 343# endif
344_GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale));
265# endif 345# endif
266# if __GLIBC__ >= 2 && @HAVE_DUPLOCALE@ 346# if __GLIBC__ >= 2
267_GL_CXXALIASWARN (duplocale); 347_GL_CXXALIASWARN (duplocale);
268# endif 348# endif
269# if @HAVE_DUPLOCALE@
270# ifndef HAVE_WORKING_DUPLOCALE
271# define HAVE_WORKING_DUPLOCALE 1
272# endif
273# endif
274#elif defined GNULIB_POSIXCHECK 349#elif defined GNULIB_POSIXCHECK
275# undef duplocale
276# if HAVE_RAW_DECL_DUPLOCALE 350# if HAVE_RAW_DECL_DUPLOCALE
277_GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - " 351_GL_WARN_ON_USE (duplocale, "duplocale is unportable and buggy on some glibc systems - "
278 "use gnulib module duplocale for portability"); 352 "use gnulib module duplocale for portability");
279# endif 353# endif
280#endif 354#endif
281 355
282#if /*@GNULIB_FREELOCALE@ ||*/ (@GNULIB_LOCALENAME_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_FREELOCALE@) 356#if @GNULIB_FREELOCALE@ || (@GNULIB_GETLOCALENAME_L_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_FREELOCALE@)
283# if @REPLACE_FREELOCALE@ 357# if @REPLACE_FREELOCALE@
284# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 358# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
285# undef freelocale 359# undef freelocale
286# define freelocale rpl_freelocale 360# define freelocale rpl_freelocale
287# define GNULIB_defined_freelocale 1 361# define GNULIB_defined_freelocale 1
288# endif 362# endif
289_GL_FUNCDECL_RPL (freelocale, void, (locale_t locale) _GL_ARG_NONNULL ((1))); 363_GL_FUNCDECL_RPL (freelocale, void, (locale_t locale), _GL_ARG_NONNULL ((1)));
290_GL_CXXALIAS_RPL (freelocale, void, (locale_t locale)); 364_GL_CXXALIAS_RPL (freelocale, void, (locale_t locale));
291# else 365# else
292# if @HAVE_FREELOCALE@ 366# if !@HAVE_FREELOCALE@
367_GL_FUNCDECL_SYS (freelocale, void, (locale_t locale), _GL_ARG_NONNULL ((1)));
368# endif
293/* Need to cast, because on FreeBSD and Mac OS X 10.13, the return type is 369/* Need to cast, because on FreeBSD and Mac OS X 10.13, the return type is
294 int. */ 370 int. */
295_GL_CXXALIAS_SYS_CAST (freelocale, void, (locale_t locale)); 371_GL_CXXALIAS_SYS_CAST (freelocale, void, (locale_t locale));
296# endif
297# endif 372# endif
298# if __GLIBC__ >= 2 && @HAVE_FREELOCALE@ 373# if __GLIBC__ >= 2
299_GL_CXXALIASWARN (freelocale); 374_GL_CXXALIASWARN (freelocale);
300# endif 375# endif
301#elif defined GNULIB_POSIXCHECK 376#elif defined GNULIB_POSIXCHECK
302# undef freelocale
303# if HAVE_RAW_DECL_FREELOCALE 377# if HAVE_RAW_DECL_FREELOCALE
304_GL_WARN_ON_USE (freelocale, "freelocale is not portable"); 378_GL_WARN_ON_USE (freelocale, "freelocale is not portable");
305# endif 379# endif
306#endif 380#endif
307 381
382#if @GNULIB_GETLOCALENAME_L@
383# if @REPLACE_GETLOCALENAME_L@
384# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
385# undef getlocalename_l
386# define getlocalename_l rpl_getlocalename_l
387# endif
388_GL_FUNCDECL_RPL (getlocalename_l, const char *,
389 (int category, locale_t locale),
390 _GL_ARG_NONNULL ((2)));
391_GL_CXXALIAS_RPL (getlocalename_l, const char *,
392 (int category, locale_t locale));
393# else
394# if !@HAVE_GETLOCALENAME_L@
395_GL_FUNCDECL_SYS (getlocalename_l, const char *,
396 (int category, locale_t locale),
397 _GL_ARG_NONNULL ((2)));
398# endif
399_GL_CXXALIAS_SYS (getlocalename_l, const char *,
400 (int category, locale_t locale));
401# endif
402# if __GLIBC__ >= 2
403_GL_CXXALIASWARN (getlocalename_l);
404# endif
405#elif defined GNULIB_POSIXCHECK
406# if HAVE_RAW_DECL_GETLOCALENAME_L
407_GL_WARN_ON_USE (getlocalename_l, "getlocalename_l is not portable");
408# endif
409#endif
410
308#endif /* _@GUARD_PREFIX@_LOCALE_H */ 411#endif /* _@GUARD_PREFIX@_LOCALE_H */
309#endif /* _@GUARD_PREFIX@_LOCALE_H */ 412#endif /* _@GUARD_PREFIX@_LOCALE_H */
310#endif /* !(__need_locale_t || _GL_ALREADY_INCLUDING_LOCALE_H) */ 413#endif /* !(__need_locale_t || _@GUARD_PREFIX@_ALREADY_INCLUDING_LOCALE_H) */
diff --git a/gl/localeconv.c b/gl/localeconv.c
index 10fc7b74..bf6271ee 100644
--- a/gl/localeconv.c
+++ b/gl/localeconv.c
@@ -1,5 +1,5 @@
1/* Query locale dependent information for formatting numbers. 1/* Query locale dependent information for formatting numbers.
2 Copyright (C) 2012-2024 Free Software Foundation, Inc. 2 Copyright (C) 2012-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/lseek.c b/gl/lseek.c
index 61bd9fcb..7478ea13 100644
--- a/gl/lseek.c
+++ b/gl/lseek.c
@@ -1,5 +1,5 @@
1/* An lseek() function that detects pipes. 1/* An lseek() function that detects pipes.
2 Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/lstat.c b/gl/lstat.c
new file mode 100644
index 00000000..2495568f
--- /dev/null
+++ b/gl/lstat.c
@@ -0,0 +1,97 @@
1/* Work around a bug of lstat on some systems
2
3 Copyright (C) 1997-2006, 2008-2026 Free Software Foundation, Inc.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18/* written by Jim Meyering */
19
20/* If the user's config.h happens to include <sys/stat.h>, let it include only
21 the system's <sys/stat.h> here, so that orig_lstat doesn't recurse to
22 rpl_lstat. */
23#define __need_system_sys_stat_h
24#include <config.h>
25
26#if !HAVE_LSTAT
27/* On systems that lack symlinks, our replacement <sys/stat.h> already
28 defined lstat as stat, so there is nothing further to do other than
29 avoid an empty file. */
30typedef int dummy;
31#else /* HAVE_LSTAT */
32
33/* Get the original definition of lstat. It might be defined as a macro. */
34# include <sys/types.h>
35# include <sys/stat.h>
36# undef __need_system_sys_stat_h
37
38static int
39orig_lstat (const char *filename, struct stat *buf)
40{
41 return lstat (filename, buf);
42}
43
44/* Specification. */
45# include <sys/stat.h>
46
47# include "stat-time.h"
48
49# include <string.h>
50# include <errno.h>
51
52/* lstat works differently on Linux and Solaris systems. POSIX (see
53 "pathname resolution" in the glossary) requires that programs like
54 'ls' take into consideration the fact that FILE has a trailing slash
55 when FILE is a symbolic link. On Linux and Solaris 10 systems, the
56 lstat function already has the desired semantics (in treating
57 'lstat ("symlink/", sbuf)' just like 'lstat ("symlink/.", sbuf)',
58 but on Solaris 9 and earlier it does not.
59
60 If FILE has a trailing slash and specifies a symbolic link,
61 then use stat() to get more info on the referent of FILE.
62 If the referent is a non-directory, then set errno to ENOTDIR
63 and return -1. Otherwise, return stat's result. */
64
65int
66rpl_lstat (const char *file, struct stat *sbuf)
67{
68 int result = orig_lstat (file, sbuf);
69
70 /* This replacement file can blindly check against '/' rather than
71 using the ISSLASH macro, because all platforms with '\\' either
72 lack symlinks (mingw) or have working lstat (cygwin) and thus do
73 not compile this file. 0 len should have already been filtered
74 out above, with a failure return of ENOENT. */
75 if (result == 0)
76 {
77 if (S_ISDIR (sbuf->st_mode) || file[strlen (file) - 1] != '/')
78 result = stat_time_normalize (result, sbuf);
79 else
80 {
81 /* At this point, a trailing slash is permitted only on
82 symlink-to-dir; but it should have found information on the
83 directory, not the symlink. Call 'stat' to get info about the
84 link's referent. Our replacement stat guarantees valid results,
85 even if the symlink is not pointing to a directory. */
86 if (!S_ISLNK (sbuf->st_mode))
87 {
88 errno = ENOTDIR;
89 return -1;
90 }
91 result = stat (file, sbuf);
92 }
93 }
94 return result;
95}
96
97#endif /* HAVE_LSTAT */
diff --git a/gl/m4/00gnulib.m4 b/gl/m4/00gnulib.m4
index cd167718..a4b32403 100644
--- a/gl/m4/00gnulib.m4
+++ b/gl/m4/00gnulib.m4
@@ -1,9 +1,10 @@
1# 00gnulib.m4 1# 00gnulib.m4
2# serial 9 2# serial 9
3dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl This file must be named something that sorts before all other 9dnl This file must be named something that sorts before all other
9dnl gnulib-provided .m4 files. It is needed until the clang fix has 10dnl gnulib-provided .m4 files. It is needed until the clang fix has
diff --git a/gl/m4/__inline.m4 b/gl/m4/__inline.m4
index 20baf164..4dedc0d4 100644
--- a/gl/m4/__inline.m4
+++ b/gl/m4/__inline.m4
@@ -1,9 +1,10 @@
1# __inline.m4 1# __inline.m4
2# serial 1 2# serial 1
3dnl Copyright 2017-2024 Free Software Foundation, Inc. 3dnl Copyright 2017-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Test for __inline keyword 9# Test for __inline keyword
9 10
diff --git a/gl/m4/absolute-header.m4 b/gl/m4/absolute-header.m4
index 0abd6d90..94ecc510 100644
--- a/gl/m4/absolute-header.m4
+++ b/gl/m4/absolute-header.m4
@@ -1,9 +1,10 @@
1# absolute-header.m4 1# absolute-header.m4
2# serial 18 2# serial 18
3dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Derek Price. 9dnl From Derek Price.
9 10
diff --git a/gl/m4/af_alg.m4 b/gl/m4/af_alg.m4
index 33b74945..e4ff9a3d 100644
--- a/gl/m4/af_alg.m4
+++ b/gl/m4/af_alg.m4
@@ -1,9 +1,10 @@
1# af_alg.m4 1# af_alg.m4
2# serial 6 2# serial 6
3dnl Copyright 2018-2024 Free Software Foundation, Inc. 3dnl Copyright 2018-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Matteo Croce. 9dnl From Matteo Croce.
9 10
diff --git a/gl/m4/alloca.m4 b/gl/m4/alloca.m4
index dc78dc19..ff0c59dd 100644
--- a/gl/m4/alloca.m4
+++ b/gl/m4/alloca.m4
@@ -1,10 +1,11 @@
1# alloca.m4 1# alloca.m4
2# serial 21 2# serial 21
3dnl Copyright (C) 2002-2004, 2006-2007, 2009-2024 Free Software Foundation, 3dnl Copyright (C) 2002-2004, 2006-2007, 2009-2026 Free Software Foundation,
4dnl Inc. 4dnl Inc.
5dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
6dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
7dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
8 9
9AC_DEFUN([gl_FUNC_ALLOCA], 10AC_DEFUN([gl_FUNC_ALLOCA],
10[ 11[
diff --git a/gl/m4/arpa_inet_h.m4 b/gl/m4/arpa_inet_h.m4
index 9eac86d7..63634c30 100644
--- a/gl/m4/arpa_inet_h.m4
+++ b/gl/m4/arpa_inet_h.m4
@@ -1,9 +1,10 @@
1# arpa_inet_h.m4 1# arpa_inet_h.m4
2# serial 17 2# serial 18
3dnl Copyright (C) 2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006, 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Written by Simon Josefsson and Bruno Haible 9dnl Written by Simon Josefsson and Bruno Haible
9 10
@@ -68,8 +69,12 @@ AC_DEFUN([gl_ARPA_INET_H_REQUIRE_DEFAULTS],
68AC_DEFUN([gl_ARPA_INET_H_DEFAULTS], 69AC_DEFUN([gl_ARPA_INET_H_DEFAULTS],
69[ 70[
70 dnl Assume proper GNU behavior unless another module says otherwise. 71 dnl Assume proper GNU behavior unless another module says otherwise.
72 HAVE_DECL_HTONL=1; AC_SUBST([HAVE_DECL_HTONL])
73 HAVE_DECL_HTONS=1; AC_SUBST([HAVE_DECL_HTONS])
71 HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP]) 74 HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP])
72 HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON]) 75 HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON])
76 HAVE_DECL_NTOHL=1; AC_SUBST([HAVE_DECL_NTOHL])
77 HAVE_DECL_NTOHS=1; AC_SUBST([HAVE_DECL_NTOHS])
73 REPLACE_INET_NTOP=0; AC_SUBST([REPLACE_INET_NTOP]) 78 REPLACE_INET_NTOP=0; AC_SUBST([REPLACE_INET_NTOP])
74 REPLACE_INET_PTON=0; AC_SUBST([REPLACE_INET_PTON]) 79 REPLACE_INET_PTON=0; AC_SUBST([REPLACE_INET_PTON])
75]) 80])
diff --git a/gl/m4/assert_h.m4 b/gl/m4/assert_h.m4
index b90d0f19..d9433ef7 100644
--- a/gl/m4/assert_h.m4
+++ b/gl/m4/assert_h.m4
@@ -1,9 +1,10 @@
1# assert_h.m4 1# assert_h.m4
2# serial 1 2# serial 6
3dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2011-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Paul Eggert. 9dnl From Paul Eggert.
9 10
@@ -12,30 +13,31 @@ AC_DEFUN([gl_ASSERT_H],
12 AC_CACHE_CHECK([for static_assert], [gl_cv_static_assert], 13 AC_CACHE_CHECK([for static_assert], [gl_cv_static_assert],
13 [gl_saved_CFLAGS=$CFLAGS 14 [gl_saved_CFLAGS=$CFLAGS
14 for gl_working in "yes, a keyword" "yes, an <assert.h> macro"; do 15 for gl_working in "yes, a keyword" "yes, an <assert.h> macro"; do
15 AS_CASE([$gl_working], 16 AS_CASE([$gl_working],
16 [*assert.h*], [CFLAGS="$gl_saved_CFLAGS -DINCLUDE_ASSERT_H"]) 17 [*assert.h*], [CFLAGS="$gl_saved_CFLAGS -DINCLUDE_ASSERT_H"])
17 18 AC_COMPILE_IFELSE(
18 AC_COMPILE_IFELSE( 19 [AC_LANG_PROGRAM(
19 [AC_LANG_PROGRAM( 20 [[#if defined __clang__ && __STDC_VERSION__ < 202311
20 [[#if defined __clang__ && __STDC_VERSION__ < 202311 21 #pragma clang diagnostic error "-Wc2x-extensions"
21 #pragma clang diagnostic error "-Wc2x-extensions" 22 #pragma clang diagnostic error "-Wc++1z-extensions"
22 #pragma clang diagnostic error "-Wc++1z-extensions" 23 #endif
23 #endif 24 #ifdef INCLUDE_ASSERT_H
24 #ifdef INCLUDE_ASSERT_H 25 #include <assert.h>
25 #include <assert.h> 26 #endif
26 #endif 27 static_assert (2 + 2 == 4, "arithmetic does not work");
27 static_assert (2 + 2 == 4, "arithmetic does not work"); 28 static_assert (2 + 2 == 4);
28 static_assert (2 + 2 == 4); 29 ]],
29 ]], 30 [[
30 [[ 31 static_assert (sizeof (char) == 1, "sizeof does not work");
31 static_assert (sizeof (char) == 1, "sizeof does not work"); 32 static_assert (sizeof (char) == 1);
32 static_assert (sizeof (char) == 1); 33 ]])
33 ]])], 34 ],
34 [gl_cv_static_assert=$gl_working], 35 [gl_cv_static_assert=$gl_working],
35 [gl_cv_static_assert=no]) 36 [gl_cv_static_assert=no])
36 CFLAGS=$gl_saved_CFLAGS 37 CFLAGS=$gl_saved_CFLAGS
37 test "$gl_cv_static_assert" != no && break 38 test "$gl_cv_static_assert" != no && break
38 done]) 39 done
40 ])
39 41
40 GL_GENERATE_ASSERT_H=false 42 GL_GENERATE_ASSERT_H=false
41 AS_CASE([$gl_cv_static_assert], 43 AS_CASE([$gl_cv_static_assert],
@@ -48,25 +50,36 @@ AC_DEFUN([gl_ASSERT_H],
48 50
49 dnl The "zz" puts this toward config.h's end, to avoid potential 51 dnl The "zz" puts this toward config.h's end, to avoid potential
50 dnl collisions with other definitions. 52 dnl collisions with other definitions.
53 dnl Hardcode the known configuration results for GCC and clang, so that
54 dnl a configuration made with the C compiler works also with the C++ compiler
55 dnl and vice versa.
56 dnl The seemingly redundant parentheses are necessary for MSVC 14.
51 dnl #undef assert so that programs are not tempted to use it without 57 dnl #undef assert so that programs are not tempted to use it without
52 dnl specifically including assert.h. 58 dnl specifically including assert.h.
53 dnl #undef __ASSERT_H__ so that on IRIX, when programs later include
54 dnl <assert.h>, this include actually defines assert.
55 dnl Break the #undef_s apart with a comment so that 'configure' does 59 dnl Break the #undef_s apart with a comment so that 'configure' does
56 dnl not comment them out. 60 dnl not comment them out.
57 AH_VERBATIM([zzstatic_assert], 61 AH_VERBATIM([zzstatic_assert],
58[#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \ 62[#if (!(defined __clang__ \
63 ? (defined __cplusplus \
64 ? __cplusplus >= 201703L \
65 : __STDC_VERSION__ >= 202000L && __clang_major__ >= 16 \
66 && !defined __sun) \
67 : (defined __GNUC__ \
68 ? (defined __cplusplus \
69 ? __cplusplus >= 201103L && __GNUG__ >= 6 \
70 : __STDC_VERSION__ >= 202000L && __GNUC__ >= 13 \
71 && !defined __sun) \
72 : defined HAVE_C_STATIC_ASSERT)) \
73 && !defined assert \
59 && (!defined __cplusplus \ 74 && (!defined __cplusplus \
60 || (__cpp_static_assert < 201411 \ 75 || (__cpp_static_assert < 201411 \
61 && __GNUG__ < 6 && __clang_major__ < 6))) 76 && __GNUG__ < 6 && __clang_major__ < 6)))
62 #include <assert.h> 77 #include <assert.h>
63 #undef/**/assert 78 #undef/**/assert
64 #ifdef __sgi
65 #undef/**/__ASSERT_H__
66 #endif
67 /* Solaris 11.4 <assert.h> defines static_assert as a macro with 2 arguments. 79 /* Solaris 11.4 <assert.h> defines static_assert as a macro with 2 arguments.
68 We need it also to be invocable with a single argument. */ 80 We need it also to be invocable with a single argument.
69 #if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus 81 Haiku 2022 <assert.h> does not define static_assert at all. */
82 #if (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus
70 #undef/**/static_assert 83 #undef/**/static_assert
71 #define static_assert _Static_assert 84 #define static_assert _Static_assert
72 #endif 85 #endif
diff --git a/gl/m4/base64.m4 b/gl/m4/base64.m4
index 26f2af41..40beb50b 100644
--- a/gl/m4/base64.m4
+++ b/gl/m4/base64.m4
@@ -1,9 +1,10 @@
1# base64.m4 1# base64.m4
2# serial 4 2# serial 4
3dnl Copyright (C) 2004, 2006, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2004, 2006, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_BASE64], 9AC_DEFUN([gl_FUNC_BASE64],
9[ 10[
diff --git a/gl/m4/btowc.m4 b/gl/m4/btowc.m4
index d9dd7036..93c9d769 100644
--- a/gl/m4/btowc.m4
+++ b/gl/m4/btowc.m4
@@ -1,17 +1,19 @@
1# btowc.m4 1# btowc.m4
2# serial 14 2# serial 16
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_BTOWC], 9AC_DEFUN([gl_FUNC_BTOWC],
9[ 10[
10 AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) 11 AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
12 AC_REQUIRE([gt_TYPE_WINT_T])
11 13
12 dnl Check whether <wchar.h> is usable at all, first. Otherwise the test 14 dnl Check whether <wchar.h> is usable at all, first. Otherwise the test
13 dnl program below may lead to an endless loop. See 15 dnl program below may lead to an endless loop. See
14 dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. 16 dnl <https://gcc.gnu.org/PR42440>.
15 AC_REQUIRE([gl_WCHAR_H_INLINE_OK]) 17 AC_REQUIRE([gl_WCHAR_H_INLINE_OK])
16 18
17 AC_CHECK_FUNCS_ONCE([btowc]) 19 AC_CHECK_FUNCS_ONCE([btowc])
@@ -52,43 +54,6 @@ changequote([,])dnl
52 ]) 54 ])
53 ]) 55 ])
54 56
55 dnl IRIX 6.5 btowc(EOF) is 0xFF, not WEOF.
56 AC_CACHE_CHECK([whether btowc(EOF) is correct],
57 [gl_cv_func_btowc_eof],
58 [
59 dnl Initial guess, used when cross-compiling or when no suitable locale
60 dnl is present.
61changequote(,)dnl
62 case "$host_os" in
63 # Guess no on IRIX.
64 irix*) gl_cv_func_btowc_eof="guessing no" ;;
65 # Guess yes on native Windows.
66 mingw* | windows*) gl_cv_func_btowc_eof="guessing yes" ;;
67 # Guess yes otherwise.
68 *) gl_cv_func_btowc_eof="guessing yes" ;;
69 esac
70changequote([,])dnl
71 if test $LOCALE_FR != none; then
72 AC_RUN_IFELSE(
73 [AC_LANG_SOURCE([[
74#include <locale.h>
75#include <stdio.h>
76#include <wchar.h>
77int main ()
78{
79 if (setlocale (LC_ALL, "$LOCALE_FR") != NULL)
80 {
81 if (btowc (EOF) != WEOF)
82 return 1;
83 }
84 return 0;
85}]])],
86 [gl_cv_func_btowc_eof=yes],
87 [gl_cv_func_btowc_eof=no],
88 [:])
89 fi
90 ])
91
92 dnl On mingw, in the C locale, btowc is inconsistent with mbrtowc: 57 dnl On mingw, in the C locale, btowc is inconsistent with mbrtowc:
93 dnl mbrtowc avoids calling MultiByteToWideChar when MB_CUR_MAX is 1 and 58 dnl mbrtowc avoids calling MultiByteToWideChar when MB_CUR_MAX is 1 and
94 dnl ___lc_codepage_func() is 0, but btowc is lacking this special case. 59 dnl ___lc_codepage_func() is 0, but btowc is lacking this special case.
@@ -133,14 +98,17 @@ int main ()
133 ]) 98 ])
134 ]) 99 ])
135 100
101 if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then
102 dnl On mingw/ucrt, we override the return type of btowc().
103 dnl While the original wint_t (= unsigned short) and the overridden wint_t
104 dnl (= unsigned int) are equivalent in function parameters, this is not
105 dnl the case for function return types.
106 REPLACE_BTOWC=1
107 fi
136 case "$gl_cv_func_btowc_nul" in 108 case "$gl_cv_func_btowc_nul" in
137 *yes) ;; 109 *yes) ;;
138 *) REPLACE_BTOWC=1 ;; 110 *) REPLACE_BTOWC=1 ;;
139 esac 111 esac
140 case "$gl_cv_func_btowc_eof" in
141 *yes) ;;
142 *) REPLACE_BTOWC=1 ;;
143 esac
144 case "$gl_cv_func_btowc_consistent" in 112 case "$gl_cv_func_btowc_consistent" in
145 *yes) ;; 113 *yes) ;;
146 *) REPLACE_BTOWC=1 ;; 114 *) REPLACE_BTOWC=1 ;;
diff --git a/gl/m4/build-to-host.m4 b/gl/m4/build-to-host.m4
new file mode 100644
index 00000000..d3b93ce1
--- /dev/null
+++ b/gl/m4/build-to-host.m4
@@ -0,0 +1,274 @@
1# build-to-host.m4
2# serial 5
3dnl Copyright (C) 2023-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl Written by Bruno Haible.
10
11dnl When the build environment ($build_os) is different from the target runtime
12dnl environment ($host_os), file names may need to be converted from the build
13dnl environment syntax to the target runtime environment syntax. This is
14dnl because the Makefiles are executed (mostly) by build environment tools and
15dnl therefore expect file names in build environment syntax, whereas the runtime
16dnl expects file names in target runtime environment syntax.
17dnl
18dnl For example, if $build_os = cygwin and $host_os = mingw32, filenames need
19dnl be converted from Cygwin syntax to native Windows syntax:
20dnl /cygdrive/c/foo/bar -> C:\foo\bar
21dnl /usr/local/share -> C:\cygwin64\usr\local\share
22dnl
23dnl gl_BUILD_TO_HOST([somedir])
24dnl This macro takes as input an AC_SUBSTed variable 'somedir', which must
25dnl already have its final value assigned, and produces two additional
26dnl AC_SUBSTed variables 'somedir_c' and 'somedir_c_make', that designate the
27dnl same file name value, just in different syntax:
28dnl - somedir_c is the file name in target runtime environment syntax,
29dnl as a C string (starting and ending with a double-quote,
30dnl and with escaped backslashes and double-quotes in
31dnl between).
32dnl - somedir_c_make is the same thing, escaped for use in a Makefile.
33
34AC_DEFUN([gl_BUILD_TO_HOST],
35[
36 AC_REQUIRE([AC_CANONICAL_BUILD])
37 AC_REQUIRE([AC_CANONICAL_HOST])
38 AC_REQUIRE([gl_BUILD_TO_HOST_INIT])
39
40 dnl Define somedir_c.
41 gl_final_[$1]="$[$1]"
42 dnl Translate it from build syntax to host syntax.
43 case "$build_os" in
44 cygwin*)
45 case "$host_os" in
46 mingw* | windows*)
47 gl_final_[$1]=`cygpath -w "$gl_final_[$1]"` ;;
48 esac
49 ;;
50 esac
51 dnl Convert it to C string syntax.
52 [$1]_c=`printf '%s\n' "$gl_final_[$1]" | sed -e "$gl_sed_double_backslashes" -e "$gl_sed_escape_doublequotes" | tr -d "$gl_tr_cr"`
53 [$1]_c='"'"$[$1]_c"'"'
54 AC_SUBST([$1_c])
55
56 dnl Define somedir_c_make.
57 [$1]_c_make=`printf '%s\n' "$[$1]_c" | sed -e "$gl_sed_escape_for_make_1" -e "$gl_sed_escape_for_make_2" | tr -d "$gl_tr_cr"`
58 dnl Use the substituted somedir variable, when possible, so that the user
59 dnl may adjust somedir a posteriori when there are no special characters.
60 if test "$[$1]_c_make" = '\"'"${gl_final_[$1]}"'\"'; then
61 [$1]_c_make='\"$([$1])\"'
62 fi
63 AC_SUBST([$1_c_make])
64])
65
66dnl Some initializations for gl_BUILD_TO_HOST.
67AC_DEFUN([gl_BUILD_TO_HOST_INIT],
68[
69 gl_sed_double_backslashes='s/\\/\\\\/g'
70 gl_sed_escape_doublequotes='s/"/\\"/g'
71changequote(,)dnl
72 gl_sed_escape_for_make_1="s,\\([ \"&'();<>\\\\\`|]\\),\\\\\\1,g"
73changequote([,])dnl
74 gl_sed_escape_for_make_2='s,\$,\\$$,g'
75 dnl Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
76 dnl does not understand '\r'.
77 case `echo r | tr -d '\r'` in
78 '') gl_tr_cr='\015' ;;
79 *) gl_tr_cr='\r' ;;
80 esac
81])
82
83
84dnl The following macros are convenience invocations of gl_BUILD_TO_HOST
85dnl for some of the variables that are defined by Autoconf.
86dnl To do so for _all_ the possible variables, use the module 'configmake'.
87
88dnl Defines bindir_c and bindir_c_make.
89AC_DEFUN_ONCE([gl_BUILD_TO_HOST_BINDIR],
90[
91 dnl Find the final value of bindir.
92 gl_saved_prefix="${prefix}"
93 gl_saved_exec_prefix="${exec_prefix}"
94 gl_saved_bindir="${bindir}"
95 dnl Unfortunately, prefix and exec_prefix get only finally determined
96 dnl at the end of configure.
97 if test "X$prefix" = "XNONE"; then
98 prefix="$ac_default_prefix"
99 fi
100 if test "X$exec_prefix" = "XNONE"; then
101 exec_prefix='${prefix}'
102 fi
103 eval exec_prefix="$exec_prefix"
104 eval bindir="$bindir"
105 gl_BUILD_TO_HOST([bindir])
106 bindir="${gl_saved_bindir}"
107 exec_prefix="${gl_saved_exec_prefix}"
108 prefix="${gl_saved_prefix}"
109])
110
111dnl Defines datadir_c and datadir_c_make,
112dnl where datadir = $(datarootdir)
113AC_DEFUN_ONCE([gl_BUILD_TO_HOST_DATADIR],
114[
115 dnl Find the final value of datadir.
116 gl_saved_prefix="${prefix}"
117 gl_saved_datarootdir="${datarootdir}"
118 gl_saved_datadir="${datadir}"
119 dnl Unfortunately, prefix gets only finally determined at the end of
120 dnl configure.
121 if test "X$prefix" = "XNONE"; then
122 prefix="$ac_default_prefix"
123 fi
124 eval datarootdir="$datarootdir"
125 eval datadir="$datadir"
126 gl_BUILD_TO_HOST([datadir])
127 datadir="${gl_saved_datadir}"
128 datarootdir="${gl_saved_datarootdir}"
129 prefix="${gl_saved_prefix}"
130])
131
132dnl Defines libdir_c and libdir_c_make.
133AC_DEFUN_ONCE([gl_BUILD_TO_HOST_LIBDIR],
134[
135 dnl Find the final value of libdir.
136 gl_saved_prefix="${prefix}"
137 gl_saved_exec_prefix="${exec_prefix}"
138 gl_saved_libdir="${libdir}"
139 dnl Unfortunately, prefix and exec_prefix get only finally determined
140 dnl at the end of configure.
141 if test "X$prefix" = "XNONE"; then
142 prefix="$ac_default_prefix"
143 fi
144 if test "X$exec_prefix" = "XNONE"; then
145 exec_prefix='${prefix}'
146 fi
147 eval exec_prefix="$exec_prefix"
148 eval libdir="$libdir"
149 gl_BUILD_TO_HOST([libdir])
150 libdir="${gl_saved_libdir}"
151 exec_prefix="${gl_saved_exec_prefix}"
152 prefix="${gl_saved_prefix}"
153])
154
155dnl Defines libexecdir_c and libexecdir_c_make.
156AC_DEFUN_ONCE([gl_BUILD_TO_HOST_LIBEXECDIR],
157[
158 dnl Find the final value of libexecdir.
159 gl_saved_prefix="${prefix}"
160 gl_saved_exec_prefix="${exec_prefix}"
161 gl_saved_libexecdir="${libexecdir}"
162 dnl Unfortunately, prefix and exec_prefix get only finally determined
163 dnl at the end of configure.
164 if test "X$prefix" = "XNONE"; then
165 prefix="$ac_default_prefix"
166 fi
167 if test "X$exec_prefix" = "XNONE"; then
168 exec_prefix='${prefix}'
169 fi
170 eval exec_prefix="$exec_prefix"
171 eval libexecdir="$libexecdir"
172 gl_BUILD_TO_HOST([libexecdir])
173 libexecdir="${gl_saved_libexecdir}"
174 exec_prefix="${gl_saved_exec_prefix}"
175 prefix="${gl_saved_prefix}"
176])
177
178dnl Defines localedir_c and localedir_c_make.
179AC_DEFUN_ONCE([gl_BUILD_TO_HOST_LOCALEDIR],
180[
181 dnl Find the final value of localedir.
182 gl_saved_prefix="${prefix}"
183 gl_saved_datarootdir="${datarootdir}"
184 gl_saved_localedir="${localedir}"
185 dnl Unfortunately, prefix gets only finally determined at the end of
186 dnl configure.
187 if test "X$prefix" = "XNONE"; then
188 prefix="$ac_default_prefix"
189 fi
190 eval datarootdir="$datarootdir"
191 eval localedir="$localedir"
192 gl_BUILD_TO_HOST([localedir])
193 localedir="${gl_saved_localedir}"
194 datarootdir="${gl_saved_datarootdir}"
195 prefix="${gl_saved_prefix}"
196])
197
198dnl Defines pkgdatadir_c and pkgdatadir_c_make,
199dnl where pkgdatadir = $(datadir)/$(PACKAGE)
200AC_DEFUN_ONCE([gl_BUILD_TO_HOST_PKGDATADIR],
201[
202 dnl Find the final value of pkgdatadir.
203 gl_saved_prefix="${prefix}"
204 gl_saved_datarootdir="${datarootdir}"
205 gl_saved_datadir="${datadir}"
206 gl_saved_pkgdatadir="${pkgdatadir}"
207 dnl Unfortunately, prefix gets only finally determined at the end of
208 dnl configure.
209 if test "X$prefix" = "XNONE"; then
210 prefix="$ac_default_prefix"
211 fi
212 eval datarootdir="$datarootdir"
213 eval datadir="$datadir"
214 eval pkgdatadir="$pkgdatadir"
215 gl_BUILD_TO_HOST([pkgdatadir])
216 pkgdatadir="${gl_saved_pkgdatadir}"
217 datadir="${gl_saved_datadir}"
218 datarootdir="${gl_saved_datarootdir}"
219 prefix="${gl_saved_prefix}"
220])
221
222dnl Defines pkglibdir_c and pkglibdir_c_make,
223dnl where pkglibdir = $(libdir)/$(PACKAGE)
224AC_DEFUN_ONCE([gl_BUILD_TO_HOST_PKGLIBDIR],
225[
226 dnl Find the final value of pkglibdir.
227 gl_saved_prefix="${prefix}"
228 gl_saved_exec_prefix="${exec_prefix}"
229 gl_saved_libdir="${libdir}"
230 gl_saved_pkglibdir="${pkglibdir}"
231 dnl Unfortunately, prefix and exec_prefix get only finally determined
232 dnl at the end of configure.
233 if test "X$prefix" = "XNONE"; then
234 prefix="$ac_default_prefix"
235 fi
236 if test "X$exec_prefix" = "XNONE"; then
237 exec_prefix='${prefix}'
238 fi
239 eval exec_prefix="$exec_prefix"
240 eval libdir="$libdir"
241 eval pkglibdir="$pkglibdir"
242 gl_BUILD_TO_HOST([pkglibdir])
243 pkglibdir="${gl_saved_pkglibdir}"
244 libdir="${gl_saved_libdir}"
245 exec_prefix="${gl_saved_exec_prefix}"
246 prefix="${gl_saved_prefix}"
247])
248
249dnl Defines pkglibexecdir_c and pkglibexecdir_c_make,
250dnl where pkglibexecdir = $(libexecdir)/$(PACKAGE)
251AC_DEFUN_ONCE([gl_BUILD_TO_HOST_PKGLIBEXECDIR],
252[
253 dnl Find the final value of pkglibexecdir.
254 gl_saved_prefix="${prefix}"
255 gl_saved_exec_prefix="${exec_prefix}"
256 gl_saved_libexecdir="${libexecdir}"
257 gl_saved_pkglibexecdir="${pkglibexecdir}"
258 dnl Unfortunately, prefix and exec_prefix get only finally determined
259 dnl at the end of configure.
260 if test "X$prefix" = "XNONE"; then
261 prefix="$ac_default_prefix"
262 fi
263 if test "X$exec_prefix" = "XNONE"; then
264 exec_prefix='${prefix}'
265 fi
266 eval exec_prefix="$exec_prefix"
267 eval libexecdir="$libexecdir"
268 eval pkglibexecdir="$pkglibexecdir"
269 gl_BUILD_TO_HOST([pkglibexecdir])
270 pkglibexecdir="${gl_saved_pkglibexecdir}"
271 libexecdir="${gl_saved_libexecdir}"
272 exec_prefix="${gl_saved_exec_prefix}"
273 prefix="${gl_saved_prefix}"
274])
diff --git a/gl/m4/builtin-expect.m4 b/gl/m4/builtin-expect.m4
index c7af926b..cf96977e 100644
--- a/gl/m4/builtin-expect.m4
+++ b/gl/m4/builtin-expect.m4
@@ -1,11 +1,12 @@
1# builtin-expect.m4 1# builtin-expect.m4
2# serial 1 2# serial 3
3dnl Copyright 2016-2024 Free Software Foundation, Inc. 3dnl Copyright 2016-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Check for __builtin_expect. 9dnl Provide a GCC-compatible __builtin_expect macro in <config.h>.
9 10
10dnl Written by Paul Eggert. 11dnl Written by Paul Eggert.
11 12
@@ -47,5 +48,4 @@ AC_DEFUN([gl___BUILTIN_EXPECT],
47#elif HAVE___BUILTIN_EXPECT == 2 48#elif HAVE___BUILTIN_EXPECT == 2
48# include <builtins.h> 49# include <builtins.h>
49#endif 50#endif
50 ]) 51])])
51])
diff --git a/gl/m4/byteswap.m4 b/gl/m4/byteswap.m4
index 0c76fe93..a0287062 100644
--- a/gl/m4/byteswap.m4
+++ b/gl/m4/byteswap.m4
@@ -1,18 +1,42 @@
1# byteswap.m4 1# byteswap.m4
2# serial 5 2# serial 7
3dnl Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005, 2007, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Written by Oskar Liljeblad. 9dnl Written by Oskar Liljeblad.
9 10
10AC_DEFUN([gl_BYTESWAP], 11AC_DEFUN([gl_BYTESWAP],
11[ 12[
12 dnl Prerequisites of lib/byteswap.in.h. 13 dnl Prerequisites of lib/byteswap.in.h.
13 AC_CHECK_HEADERS([byteswap.h], [ 14 AC_CHECK_HEADERS_ONCE([byteswap.h])
15 if test $ac_cv_header_byteswap_h = yes; then
16 AC_CACHE_CHECK([for working bswap_16, bswap_32, bswap_64],
17 [gl_cv_header_working_byteswap_h],
18 [gl_cv_header_working_byteswap_h=no
19 dnl Check that floating point arguments work.
20 dnl This also checks C libraries with implementations like
21 dnl '#define bswap_16(x) (((x) >> 8 & 0xff) | (((x) & 0xff) << 8))'
22 dnl that mistakenly evaluate their arguments multiple times.
23 AC_COMPILE_IFELSE(
24 [AC_LANG_PROGRAM(
25 [[#include <byteswap.h>
26 ]],
27 [[int value_16 = bswap_16 (0.0);
28 int value_32 = bswap_32 (0.0);
29 int value_64 = bswap_64 (0.0);
30 return !(value_16 + value_32 + value_64);
31 ]])
32 ],
33 [gl_cv_header_working_byteswap_h=yes],
34 [gl_cv_header_working_byteswap_h=no])
35 ])
36 fi
37 if test "$gl_cv_header_working_byteswap_h" = yes; then
14 GL_GENERATE_BYTESWAP_H=false 38 GL_GENERATE_BYTESWAP_H=false
15 ], [ 39 else
16 GL_GENERATE_BYTESWAP_H=true 40 GL_GENERATE_BYTESWAP_H=true
17 ]) 41 fi
18]) 42])
diff --git a/gl/m4/c-bool.m4 b/gl/m4/c-bool.m4
index 0fb0de3b..f04041a4 100644
--- a/gl/m4/c-bool.m4
+++ b/gl/m4/c-bool.m4
@@ -1,9 +1,10 @@
1# c-bool.m4 1# c-bool.m4
2# serial 1 2# serial 3
3dnl Copyright 2022-2024 Free Software Foundation, Inc. 3dnl Copyright 2022-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Check for bool that conforms to C2023. 9# Check for bool that conforms to C2023.
9 10
@@ -29,12 +30,23 @@ AC_DEFUN([gl_C_BOOL],
29 dnl The "zz" puts this toward config.h's end, to avoid potential 30 dnl The "zz" puts this toward config.h's end, to avoid potential
30 dnl collisions with other definitions. 31 dnl collisions with other definitions.
31 dnl If 'bool', 'true' and 'false' do not work, arrange for them to work. 32 dnl If 'bool', 'true' and 'false' do not work, arrange for them to work.
32 dnl In C, this means including <stdbool.h> if it is not already included. 33 dnl Hardcode the known configuration results for GCC and clang, so that
34 dnl a configuration made with the C compiler works also with the C++ compiler
35 dnl and vice versa.
36 dnl The seemingly redundant parentheses are necessary for MSVC 14.
37 dnl "Arrange for them to work", in C, means including <stdbool.h> if it is
38 dnl not already included.
33 dnl However, if the preprocessor mistakenly treats 'true' as 0, 39 dnl However, if the preprocessor mistakenly treats 'true' as 0,
34 dnl define it to a bool expression equal to 1; this is needed in 40 dnl define it to a bool expression equal to 1; this is needed in
35 dnl Sun C++ 5.11 (Oracle Solaris Studio 12.2, 2010) and older. 41 dnl Sun C++ 5.11 (Oracle Solaris Studio 12.2, 2010) and older.
36 AH_VERBATIM([zzbool], 42 AH_VERBATIM([zzbool],
37[#ifndef HAVE_C_BOOL 43[#if !(defined __cplusplus \
44 ? 1 \
45 : (defined __clang__ \
46 ? __STDC_VERSION__ >= 202000L && __clang_major__ >= 15 \
47 : (defined __GNUC__ \
48 ? __STDC_VERSION__ >= 202000L && __GNUC__ >= 13 \
49 : defined HAVE_C_BOOL)))
38# if !defined __cplusplus && !defined __bool_true_false_are_defined 50# if !defined __cplusplus && !defined __bool_true_false_are_defined
39# if HAVE_STDBOOL_H 51# if HAVE_STDBOOL_H
40# include <stdbool.h> 52# include <stdbool.h>
diff --git a/gl/m4/c32rtomb.m4 b/gl/m4/c32rtomb.m4
new file mode 100644
index 00000000..b7a0d44c
--- /dev/null
+++ b/gl/m4/c32rtomb.m4
@@ -0,0 +1,187 @@
1# c32rtomb.m4
2# serial 8
3dnl Copyright (C) 2020-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN([gl_FUNC_C32RTOMB],
10[
11 AC_REQUIRE([gl_UCHAR_H_DEFAULTS])
12 AC_REQUIRE([AC_CANONICAL_HOST])
13
14 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
15 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
16
17 AC_REQUIRE([gl_CHECK_FUNC_C32RTOMB])
18 if test $gl_cv_func_c32rtomb = no; then
19 HAVE_C32RTOMB=0
20 else
21 dnl When we override mbrtoc32, redefining the meaning of the char32_t
22 dnl values, we need to override c32rtomb as well, for consistency.
23 if test $HAVE_WORKING_MBRTOC32 = 0; then
24 REPLACE_C32RTOMB=1
25 fi
26 AC_CACHE_CHECK([whether c32rtomb return value is correct],
27 [gl_cv_func_c32rtomb_retval],
28 [
29 dnl Initial guess, used when cross-compiling.
30changequote(,)dnl
31 case "$host_os" in
32 # Guess no on AIX.
33 aix*) gl_cv_func_c32rtomb_retval="guessing no" ;;
34 # Guess yes otherwise.
35 *) gl_cv_func_c32rtomb_retval="guessing yes" ;;
36 esac
37changequote([,])dnl
38 AC_RUN_IFELSE(
39 [AC_LANG_SOURCE([[
40#include <stddef.h>
41#ifdef __HAIKU__
42 #include <stdint.h>
43#endif
44#include <uchar.h>
45int main ()
46{
47 int result = 0;
48 if (c32rtomb (NULL, 0, NULL) != 1)
49 result |= 1;
50 return result;
51}]])],
52 [gl_cv_func_c32rtomb_retval=yes],
53 [gl_cv_func_c32rtomb_retval=no],
54 [:])
55 ])
56 case "$gl_cv_func_c32rtomb_retval" in
57 *yes) ;;
58 *) AC_DEFINE([C32RTOMB_RETVAL_BUG], [1],
59 [Define if the c32rtomb function has an incorrect return value.])
60 REPLACE_C32RTOMB=1 ;;
61 esac
62 if test $HAVE_WORKING_C32RTOMB = 0; then
63 REPLACE_C32RTOMB=1
64 fi
65 fi
66])
67
68AC_DEFUN([gl_CHECK_FUNC_C32RTOMB],
69[
70 dnl Cf. gl_CHECK_FUNCS_ANDROID
71 AC_CHECK_DECL([c32rtomb], , ,
72 [[#ifdef __HAIKU__
73 #include <stdint.h>
74 #endif
75 #include <uchar.h>
76 ]])
77 if test $ac_cv_have_decl_c32rtomb = yes; then
78 dnl We can't use AC_CHECK_FUNC here, because c32rtomb() is defined as a
79 dnl static inline function on Haiku 2020.
80 AC_CACHE_CHECK([for c32rtomb], [gl_cv_func_c32rtomb],
81 [AC_LINK_IFELSE(
82 [AC_LANG_PROGRAM(
83 [[#include <stdlib.h>
84 #ifdef __HAIKU__
85 #include <stdint.h>
86 #endif
87 #include <uchar.h>
88 ]],
89 [[char buf[8];
90 return c32rtomb (buf, 0, NULL) == 0;
91 ]])
92 ],
93 [gl_cv_func_c32rtomb=yes],
94 [gl_cv_func_c32rtomb=no])
95 ])
96 else
97 gl_cv_func_c32rtomb=no
98 fi
99])
100
101dnl Test whether c32rtomb works not worse than wcrtomb.
102dnl Result is HAVE_WORKING_C32RTOMB.
103
104AC_DEFUN([gl_C32RTOMB_SANITYCHECK],
105[
106 AC_REQUIRE([AC_PROG_CC])
107 AC_REQUIRE([gl_TYPE_CHAR32_T])
108 AC_REQUIRE([gl_CHECK_FUNC_C32RTOMB])
109 AC_REQUIRE([gt_LOCALE_ZH_CN])
110 AC_REQUIRE([AC_CANONICAL_HOST])
111 if test $GNULIBHEADERS_OVERRIDE_CHAR32_T = 1 || test $gl_cv_func_c32rtomb = no; then
112 HAVE_WORKING_C32RTOMB=0
113 else
114 AC_CACHE_CHECK([whether c32rtomb works as well as wcrtomb],
115 [gl_cv_func_c32rtomb_sanitycheck],
116 [
117 dnl Initial guess, used when cross-compiling or when no suitable locale
118 dnl is present.
119changequote(,)dnl
120 case "$host_os" in
121 # Guess no on Solaris derivatives.
122 solaris*)
123 if test -f /etc/release && grep 'Oracle Solaris' /etc/release >/dev/null; then
124 gl_cv_func_c32rtomb_sanitycheck="guessing yes"
125 else
126 gl_cv_func_c32rtomb_sanitycheck="guessing no"
127 fi
128 ;;
129 # Guess yes otherwise.
130 *)
131 gl_cv_func_c32rtomb_sanitycheck="guessing yes"
132 ;;
133 esac
134changequote([,])dnl
135 if test $LOCALE_ZH_CN != none; then
136 AC_RUN_IFELSE(
137 [AC_LANG_SOURCE([[
138#include <locale.h>
139#include <stdlib.h>
140#include <string.h>
141#include <wchar.h>
142#ifdef __HAIKU__
143 #include <stdint.h>
144#endif
145#include <uchar.h>
146int main ()
147{
148 int result = 0;
149 /* This fails on Solaris 11 OmniOS:
150 c32rtomb returns (size_t)-1.
151 wcrtomb returns 4 (correct). */
152 if (strcmp ("$LOCALE_ZH_CN", "none") != 0
153 && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
154 {
155 mbstate_t state;
156 wchar_t wc = (wchar_t) 0xBADFACE;
157 char buf[16];
158 memset (&state, '\0', sizeof (mbstate_t));
159 if (mbrtowc (&wc, "\201\060\211\070", 4, &state) == 4
160 && wcrtomb (buf, wc, NULL) == 4
161 && memcmp (buf, "\201\060\211\070", 4) == 0)
162 {
163 char32_t c32 = (wchar_t) 0xBADFACE;
164 memset (&state, '\0', sizeof (mbstate_t));
165 if (mbrtoc32 (&c32, "\201\060\211\070", 4, &state) == 4
166 && c32rtomb (buf, c32, NULL) != 4)
167 result |= 1;
168 }
169 }
170 return result;
171}]])],
172 [gl_cv_func_c32rtomb_sanitycheck=yes],
173 [gl_cv_func_c32rtomb_sanitycheck=no],
174 [:])
175 fi
176 ])
177 case "$gl_cv_func_c32rtomb_sanitycheck" in
178 *yes)
179 HAVE_WORKING_C32RTOMB=1
180 AC_DEFINE([HAVE_WORKING_C32RTOMB], [1],
181 [Define if the c32rtomb function basically works.])
182 ;;
183 *) HAVE_WORKING_C32RTOMB=0 ;;
184 esac
185 fi
186 AC_SUBST([HAVE_WORKING_C32RTOMB])
187])
diff --git a/gl/m4/calloc.m4 b/gl/m4/calloc.m4
index 550cf5cc..2ed64332 100644
--- a/gl/m4/calloc.m4
+++ b/gl/m4/calloc.m4
@@ -1,9 +1,10 @@
1# calloc.m4 1# calloc.m4
2# serial 31 2# serial 36
3dnl Copyright (C) 2004-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2004-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Written by Jim Meyering. 9# Written by Jim Meyering.
9 10
@@ -12,42 +13,35 @@ dnl with or without modifications, as long as this notice is preserved.
12# If so, define HAVE_CALLOC. Otherwise, define calloc to rpl_calloc 13# If so, define HAVE_CALLOC. Otherwise, define calloc to rpl_calloc
13# and arrange to use a calloc wrapper function that does work in that case. 14# and arrange to use a calloc wrapper function that does work in that case.
14 15
15# _AC_FUNC_CALLOC_IF([IF-WORKS], [IF-NOT]) 16# gl_FUNC_CALLOC_IF([IF-WORKS], [IF-NOT])
16# ------------------------------------- 17# ---------------------------------------
17# If calloc is compatible with GNU calloc, run IF-WORKS, otherwise, IF-NOT. 18# If calloc is compatible with GNU calloc, run IF-WORKS, otherwise, IF-NOT.
18AC_DEFUN([_AC_FUNC_CALLOC_IF], 19AC_DEFUN([gl_FUNC_CALLOC_IF],
19[ 20[
20 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 21 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
21 AC_CACHE_CHECK([whether calloc (0, n) and calloc (n, 0) return nonnull], 22 AC_CACHE_CHECK([whether calloc (0, n) and calloc (n, 0) return nonnull],
22 [ac_cv_func_calloc_0_nonnull], 23 [gl_cv_func_calloc_0_nonnull],
23 [if test $cross_compiling != yes; then 24 [AC_RUN_IFELSE(
24 ac_cv_func_calloc_0_nonnull=yes 25 [AC_LANG_PROGRAM(
25 AC_RUN_IFELSE( 26 [[#include <stdlib.h>
26 [AC_LANG_PROGRAM( 27 /* Use pcalloc to test; "volatile" prevents the compiler
27 [AC_INCLUDES_DEFAULT], 28 from optimizing the calloc call away. */
28 [[int result = 0; 29 void *(*volatile pcalloc) (size_t, size_t) = calloc;]],
29 char * volatile p = calloc (0, 0); 30 [[void *p = pcalloc (0, 0);
30 if (!p) 31 int result = !p;
31 result |= 1; 32 free (p);
32 free (p); 33 return result;]])],
33 return result; 34 [gl_cv_func_calloc_0_nonnull=yes],
34 ]])], 35 [gl_cv_func_calloc_0_nonnull=no],
35 [], 36 [AS_CASE([$host_os],
36 [ac_cv_func_calloc_0_nonnull=no]) 37 [# Guess yes on platforms where we know the result.
37 else 38 *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \
38 case "$host_os" in 39 | gnu* | *-musl* | midipix* | midnightbsd* \
39 # Guess yes on glibc systems. 40 | hpux* | solaris* | cygwin* | mingw* | windows* | msys*],
40 *-gnu* | gnu*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; 41 [gl_cv_func_calloc_0_nonnull="guessing yes"],
41 # Guess yes on musl systems. 42 [# If we don't know, obey --enable-cross-guesses.
42 *-musl* | midipix*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; 43 gl_cv_func_calloc_0_nonnull="$gl_cross_guess_normal"])])])
43 # Guess yes on native Windows. 44 AS_CASE([$gl_cv_func_calloc_0_nonnull], [*yes], [$1], [$2])
44 mingw* | windows*) ac_cv_func_calloc_0_nonnull="guessing yes" ;;
45 # If we don't know, obey --enable-cross-guesses.
46 *) ac_cv_func_calloc_0_nonnull="$gl_cross_guess_normal" ;;
47 esac
48 fi
49 ])
50 AS_CASE([$ac_cv_func_calloc_0_nonnull], [*yes], [$1], [$2])
51]) 45])
52 46
53 47
@@ -58,9 +52,14 @@ AC_DEFUN([gl_FUNC_CALLOC_GNU],
58[ 52[
59 AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) 53 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
60 AC_REQUIRE([gl_FUNC_CALLOC_POSIX]) 54 AC_REQUIRE([gl_FUNC_CALLOC_POSIX])
55
56 dnl Through the dependency on module extensions-aix, _LINUX_SOURCE_COMPAT
57 dnl gets defined already before this macro gets invoked. This helps
58 dnl if !(__VEC__ || __AIXVEC), and doesn't hurt otherwise.
59
61 REPLACE_CALLOC_FOR_CALLOC_GNU="$REPLACE_CALLOC_FOR_CALLOC_POSIX" 60 REPLACE_CALLOC_FOR_CALLOC_GNU="$REPLACE_CALLOC_FOR_CALLOC_POSIX"
62 if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 0; then 61 if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 0; then
63 _AC_FUNC_CALLOC_IF([], [REPLACE_CALLOC_FOR_CALLOC_GNU=1]) 62 gl_FUNC_CALLOC_IF([], [REPLACE_CALLOC_FOR_CALLOC_GNU=1])
64 fi 63 fi
65])# gl_FUNC_CALLOC_GNU 64])# gl_FUNC_CALLOC_GNU
66 65
@@ -73,9 +72,7 @@ AC_DEFUN([gl_FUNC_CALLOC_POSIX],
73[ 72[
74 AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) 73 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
75 AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) 74 AC_REQUIRE([gl_FUNC_MALLOC_POSIX])
76 if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then 75 REPLACE_CALLOC_FOR_CALLOC_POSIX=$REPLACE_MALLOC_FOR_MALLOC_POSIX
77 REPLACE_CALLOC_FOR_CALLOC_POSIX=1
78 fi
79 dnl Although in theory we should also test for size_t overflow, 76 dnl Although in theory we should also test for size_t overflow,
80 dnl in practice testing for ptrdiff_t overflow suffices 77 dnl in practice testing for ptrdiff_t overflow suffices
81 dnl since PTRDIFF_MAX <= SIZE_MAX on all known Gnulib porting targets. 78 dnl since PTRDIFF_MAX <= SIZE_MAX on all known Gnulib porting targets.
diff --git a/gl/m4/close.m4 b/gl/m4/close.m4
index 88c37fab..9b498643 100644
--- a/gl/m4/close.m4
+++ b/gl/m4/close.m4
@@ -1,9 +1,10 @@
1# close.m4 1# close.m4
2# serial 10 2# serial 10
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_FUNC_CLOSE], 9AC_DEFUN_ONCE([gl_FUNC_CLOSE],
9[ 10[
diff --git a/gl/m4/codeset.m4 b/gl/m4/codeset.m4
index e69b7402..4ab542f4 100644
--- a/gl/m4/codeset.m4
+++ b/gl/m4/codeset.m4
@@ -1,10 +1,11 @@
1# codeset.m4 1# codeset.m4
2# serial 5 (gettext-0.18.2) 2# serial 5 (gettext-0.18.2)
3dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016, 2019-2024 Free Software 3dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016, 2019-2026 Free Software
4dnl Foundation, Inc. 4dnl Foundation, Inc.
5dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
6dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
7dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
8 9
9dnl From Bruno Haible. 10dnl From Bruno Haible.
10 11
diff --git a/gl/m4/double-slash-root.m4 b/gl/m4/double-slash-root.m4
index 3437c699..957adca6 100644
--- a/gl/m4/double-slash-root.m4
+++ b/gl/m4/double-slash-root.m4
@@ -1,9 +1,10 @@
1# double-slash-root.m4 1# double-slash-root.m4
2# serial 4 -*- Autoconf -*- 2# serial 4 -*- Autoconf -*-
3dnl Copyright (C) 2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006, 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_DOUBLE_SLASH_ROOT], 9AC_DEFUN([gl_DOUBLE_SLASH_ROOT],
9[ 10[
diff --git a/gl/m4/dup2.m4 b/gl/m4/dup2.m4
index 786121fd..e1d51898 100644
--- a/gl/m4/dup2.m4
+++ b/gl/m4/dup2.m4
@@ -1,9 +1,10 @@
1# dup2.m4 1# dup2.m4
2# serial 28 2# serial 28
3dnl Copyright (C) 2002, 2005, 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002, 2005, 2007, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_DUP2], 9AC_DEFUN([gl_FUNC_DUP2],
9[ 10[
diff --git a/gl/m4/eealloc.m4 b/gl/m4/eealloc.m4
deleted file mode 100644
index 8a15e705..00000000
--- a/gl/m4/eealloc.m4
+++ /dev/null
@@ -1,32 +0,0 @@
1# eealloc.m4
2# serial 3
3dnl Copyright (C) 2003, 2009-2024 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8AC_DEFUN([gl_EEALLOC],
9[
10 AC_REQUIRE([gl_EEMALLOC])
11 AC_REQUIRE([gl_EEREALLOC])
12])
13
14AC_DEFUN([gl_EEMALLOC],
15[
16 _AC_FUNC_MALLOC_IF(
17 [gl_cv_func_malloc_0_nonnull=1],
18 [gl_cv_func_malloc_0_nonnull=0])
19 AC_DEFINE_UNQUOTED([MALLOC_0_IS_NONNULL], [$gl_cv_func_malloc_0_nonnull],
20 [If malloc(0) is != NULL, define this to 1. Otherwise define this
21 to 0.])
22])
23
24AC_DEFUN([gl_EEREALLOC],
25[
26 _AC_FUNC_REALLOC_IF(
27 [gl_cv_func_realloc_0_nonnull=1],
28 [gl_cv_func_realloc_0_nonnull=0])
29 AC_DEFINE_UNQUOTED([REALLOC_0_IS_NONNULL], [$gl_cv_func_realloc_0_nonnull],
30 [If realloc(NULL,0) is != NULL, define this to 1. Otherwise define this
31 to 0.])
32])
diff --git a/gl/m4/environ.m4 b/gl/m4/environ.m4
index 107960b2..5c0644ab 100644
--- a/gl/m4/environ.m4
+++ b/gl/m4/environ.m4
@@ -1,9 +1,10 @@
1# environ.m4 1# environ.m4
2# serial 8 2# serial 8
3dnl Copyright (C) 2001-2004, 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2001-2004, 2006-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_ENVIRON], 9AC_DEFUN_ONCE([gl_ENVIRON],
9[ 10[
diff --git a/gl/m4/errno_h.m4 b/gl/m4/errno_h.m4
index b6050e5d..ade19b6f 100644
--- a/gl/m4/errno_h.m4
+++ b/gl/m4/errno_h.m4
@@ -1,15 +1,21 @@
1# errno_h.m4 1# errno_h.m4
2# serial 14 2# serial 19
3dnl Copyright (C) 2004, 2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2004, 2006, 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_PREREQ([2.61]) 9AC_PREREQ([2.61])
9 10
10AC_DEFUN_ONCE([gl_HEADER_ERRNO_H], 11AC_DEFUN_ONCE([gl_HEADER_ERRNO_H],
11[ 12[
12 AC_REQUIRE([AC_PROG_CC]) 13 AC_REQUIRE([AC_PROG_CC])
14
15 dnl Through the dependency on module extensions-aix, _LINUX_SOURCE_COMPAT
16 dnl gets defined already before this macro gets invoked. This persuades
17 dnl AIX 7.3 errno.h to assign ENOTEMPTY a value different than EEXIST.
18
13 AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [ 19 AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [
14 AC_EGREP_CPP([booboo],[ 20 AC_EGREP_CPP([booboo],[
15#include <errno.h> 21#include <errno.h>
@@ -64,6 +70,9 @@ booboo
64#if !defined EILSEQ 70#if !defined EILSEQ
65booboo 71booboo
66#endif 72#endif
73#if !defined ESOCKTNOSUPPORT
74booboo
75#endif
67 ], 76 ],
68 [gl_cv_header_errno_h_complete=no], 77 [gl_cv_header_errno_h_complete=no],
69 [gl_cv_header_errno_h_complete=yes]) 78 [gl_cv_header_errno_h_complete=yes])
@@ -74,59 +83,4 @@ booboo
74 gl_NEXT_HEADERS([errno.h]) 83 gl_NEXT_HEADERS([errno.h])
75 GL_GENERATE_ERRNO_H=true 84 GL_GENERATE_ERRNO_H=true
76 fi 85 fi
77 gl_REPLACE_ERRNO_VALUE([EMULTIHOP])
78 gl_REPLACE_ERRNO_VALUE([ENOLINK])
79 gl_REPLACE_ERRNO_VALUE([EOVERFLOW])
80])
81
82# Assuming $1 = EOVERFLOW.
83# The EOVERFLOW errno value ought to be defined in <errno.h>, according to
84# POSIX. But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and
85# some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined.
86# Check for the value of EOVERFLOW.
87# Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE.
88AC_DEFUN([gl_REPLACE_ERRNO_VALUE],
89[
90 if $GL_GENERATE_ERRNO_H; then
91 AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [
92 AC_EGREP_CPP([yes],[
93#include <errno.h>
94#ifdef ]$1[
95yes
96#endif
97 ],
98 [gl_cv_header_errno_h_]$1[=yes],
99 [gl_cv_header_errno_h_]$1[=no])
100 if test $gl_cv_header_errno_h_]$1[ = no; then
101 AC_EGREP_CPP([yes],[
102#define _XOPEN_SOURCE_EXTENDED 1
103#include <errno.h>
104#ifdef ]$1[
105yes
106#endif
107 ], [gl_cv_header_errno_h_]$1[=hidden])
108 if test $gl_cv_header_errno_h_]$1[ = hidden; then
109 dnl The macro exists but is hidden.
110 dnl Define it to the same value.
111 AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [
112#define _XOPEN_SOURCE_EXTENDED 1
113#include <errno.h>
114/* The following two lines are a workaround against an autoconf-2.52 bug. */
115#include <stdio.h>
116#include <stdlib.h>
117])
118 fi
119 fi
120 ])
121 case $gl_cv_header_errno_h_]$1[ in
122 yes | no)
123 ]$1[_HIDDEN=0; ]$1[_VALUE=
124 ;;
125 *)
126 ]$1[_HIDDEN=1; ]$1[_VALUE="$gl_cv_header_errno_h_]$1["
127 ;;
128 esac
129 AC_SUBST($1[_HIDDEN])
130 AC_SUBST($1[_VALUE])
131 fi
132]) 86])
diff --git a/gl/m4/error.m4 b/gl/m4/error.m4
index 273b636b..f14b9ceb 100644
--- a/gl/m4/error.m4
+++ b/gl/m4/error.m4
@@ -1,9 +1,11 @@
1# error.m4 1# error.m4
2# serial 16 2# serial 16
3dnl Copyright (C) 1996-1998, 2001-2004, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 1996-1998, 2001-2004, 2009-2026 Free Software Foundation,
4dnl Inc.
4dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
7 9
8AC_DEFUN([gl_ERROR], 10AC_DEFUN([gl_ERROR],
9[ 11[
diff --git a/gl/m4/error_h.m4 b/gl/m4/error_h.m4
index 050a410c..73e96943 100644
--- a/gl/m4/error_h.m4
+++ b/gl/m4/error_h.m4
@@ -1,9 +1,10 @@
1# error_h.m4 1# error_h.m4
2# serial 4 2# serial 5
3dnl Copyright (C) 1996-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 1996-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Bruno Haible. 9dnl From Bruno Haible.
9dnl Provide a working <error.h>. 10dnl Provide a working <error.h>.
@@ -111,12 +112,15 @@ AC_DEFUN_ONCE([gl_ERROR_H],
111 esac 112 esac
112 fi 113 fi
113 114
114 if test $HAVE_ERROR = 0 || test $REPLACE_ERROR = 1 \ 115 m4_ifdef([gl_HAVE_MODULE_VERROR],
115 || test $HAVE_ERROR_AT_LINE = 0 || test $REPLACE_ERROR_AT_LINE = 1; then 116 [COMPILE_ERROR_C=1],
116 COMPILE_ERROR_C=1 117 [if test $HAVE_ERROR = 0 || test $REPLACE_ERROR = 1 \
117 else 118 || test $HAVE_ERROR_AT_LINE = 0 \
118 COMPILE_ERROR_C=0 119 || test $REPLACE_ERROR_AT_LINE = 1; then
119 fi 120 COMPILE_ERROR_C=1
121 else
122 COMPILE_ERROR_C=0
123 fi])
120 124
121 AC_SUBST([HAVE_ERROR]) 125 AC_SUBST([HAVE_ERROR])
122 AC_SUBST([HAVE_ERROR_AT_LINE]) 126 AC_SUBST([HAVE_ERROR_AT_LINE])
diff --git a/gl/m4/exponentd.m4 b/gl/m4/exponentd.m4
index db597afc..bff98570 100644
--- a/gl/m4/exponentd.m4
+++ b/gl/m4/exponentd.m4
@@ -1,9 +1,10 @@
1# exponentd.m4 1# exponentd.m4
2# serial 4 2# serial 5
3dnl Copyright (C) 2007-2008, 2010-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2008, 2010-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7AC_DEFUN_ONCE([gl_DOUBLE_EXPONENT_LOCATION], 8AC_DEFUN_ONCE([gl_DOUBLE_EXPONENT_LOCATION],
8[ 9[
9 AC_CACHE_CHECK([where to find the exponent in a 'double'], 10 AC_CACHE_CHECK([where to find the exponent in a 'double'],
@@ -84,7 +85,7 @@ int main ()
84 dnl The newer VFP instructions assume little-endian order 85 dnl The newer VFP instructions assume little-endian order
85 dnl consistently. 86 dnl consistently.
86 AC_EGREP_CPP([mixed_endianness], [ 87 AC_EGREP_CPP([mixed_endianness], [
87#if defined arm || defined __arm || defined __arm__ 88#if defined __arm__
88 mixed_endianness 89 mixed_endianness
89#endif 90#endif
90 ], 91 ],
diff --git a/gl/m4/extensions-aix.m4 b/gl/m4/extensions-aix.m4
new file mode 100644
index 00000000..9036d7bb
--- /dev/null
+++ b/gl/m4/extensions-aix.m4
@@ -0,0 +1,26 @@
1# extensions-aix.m4
2# serial 1
3dnl Copyright (C) 2024-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9# On AIX, most extensions are already enabled through the _ALL_SOURCE macro,
10# defined by gl_USE_SYSTEM_EXTENSIONS. gl_USE_AIX_EXTENSIONS additionally
11# activates more GNU and Linux-like behaviours, affecting
12# - the time_t type,
13# - errno values in <errno.h>: ENOTEMPTY
14# - functions in <stdlib.h>: malloc calloc realloc valloc
15# <https://www.ibm.com/docs/en/aix/7.3?topic=m-malloc-free-realloc-calloc-mallopt-mallinfo-mallinfo-heap-alloca-valloc-posix-memalign-subroutine>
16# - functions in <string.h>: strerror_r (returns 'char *', like glibc)
17# - functions in <dirent.h>: scandir, alphasort, readdir_r
18# - functions in <netdb.h>: gethostbyname_r gethostbyaddr_r
19# - declarations in <unistd.h>: sbrk
20# and a couple of secondary <sys/*> header files.
21
22AC_DEFUN_ONCE([gl_USE_AIX_EXTENSIONS],
23[
24 AC_DEFINE([_LINUX_SOURCE_COMPAT], [1],
25 [Define so that AIX headers are more compatible with GNU/Linux.])
26])
diff --git a/gl/m4/extensions.m4 b/gl/m4/extensions.m4
index 1fb68956..01a8e5f9 100644
--- a/gl/m4/extensions.m4
+++ b/gl/m4/extensions.m4
@@ -1,9 +1,10 @@
1# extensions.m4 1# extensions.m4
2# serial 25 -*- Autoconf -*- 2# serial 25 -*- Autoconf -*-
3dnl Copyright (C) 2003, 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2006-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Enable extensions on systems that normally disable them. 9# Enable extensions on systems that normally disable them.
9 10
diff --git a/gl/m4/extern-inline.m4 b/gl/m4/extern-inline.m4
index 547da82a..4ccc4a95 100644
--- a/gl/m4/extern-inline.m4
+++ b/gl/m4/extern-inline.m4
@@ -1,9 +1,10 @@
1# extern-inline.m4 1# extern-inline.m4
2# serial 1 2# serial 2
3dnl Copyright 2012-2024 Free Software Foundation, Inc. 3dnl Copyright 2012-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl 'extern inline' a la ISO C99. 9dnl 'extern inline' a la ISO C99.
9 10
@@ -42,9 +43,11 @@ AC_DEFUN([gl_EXTERN_INLINE],
42 functions or macros in standard C headers like <ctype.h>. For example, 43 functions or macros in standard C headers like <ctype.h>. For example,
43 if isdigit is mistakenly implemented via a static inline function, 44 if isdigit is mistakenly implemented via a static inline function,
44 a program containing an extern inline function that calls isdigit 45 a program containing an extern inline function that calls isdigit
45 may not work since the C standard prohibits extern inline functions 46 may not work since C99 through C23 prohibit extern inline functions
46 from calling static functions (ISO C 99 section 6.7.4.(3). 47 from calling static functions (ISO C 23 § 6.7.5 ¶ 3)).
47 This bug is known to occur on: 48 Although a future C standard will likely relax this restriction
49 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3622.txt>,
50 respect it for now. This bug is known to occur on:
48 51
49 OS X 10.8 and earlier; see: 52 OS X 10.8 and earlier; see:
50 https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html 53 https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html
@@ -111,8 +114,8 @@ AC_DEFUN([gl_EXTERN_INLINE],
111 suppress bogus "no previous prototype for 'FOO'" 114 suppress bogus "no previous prototype for 'FOO'"
112 and "no previous declaration for 'FOO'" diagnostics, 115 and "no previous declaration for 'FOO'" diagnostics,
113 when FOO is an inline function in the header; see 116 when FOO is an inline function in the header; see
114 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113> and 117 <https://gcc.gnu.org/PR54113> and
115 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877>. */ 118 <https://gcc.gnu.org/PR63877>. */
116#if __GNUC__ == 4 && 6 <= __GNUC_MINOR__ 119#if __GNUC__ == 4 && 6 <= __GNUC_MINOR__
117# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ 120# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
118# define _GL_INLINE_HEADER_CONST_PRAGMA 121# define _GL_INLINE_HEADER_CONST_PRAGMA
diff --git a/gl/m4/fclose.m4 b/gl/m4/fclose.m4
index 0c1358ed..65eb7705 100644
--- a/gl/m4/fclose.m4
+++ b/gl/m4/fclose.m4
@@ -1,9 +1,10 @@
1# fclose.m4 1# fclose.m4
2# serial 12 2# serial 12
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_FUNC_FCLOSE], 9AC_DEFUN_ONCE([gl_FUNC_FCLOSE],
9[ 10[
diff --git a/gl/m4/fcntl-o.m4 b/gl/m4/fcntl-o.m4
index 43aa1325..a94fc557 100644
--- a/gl/m4/fcntl-o.m4
+++ b/gl/m4/fcntl-o.m4
@@ -1,15 +1,17 @@
1# fcntl-o.m4 1# fcntl-o.m4
2# serial 8 2# serial 12
3dnl Copyright (C) 2006, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Written by Paul Eggert. 9dnl Written by Paul Eggert.
9 10
10AC_PREREQ([2.60]) 11AC_PREREQ([2.60])
11 12
12# Test whether the flags O_NOATIME and O_NOFOLLOW actually work. 13# Test whether the flags O_DIRECTORY, O_NOATIME and O_NOFOLLOW actually work.
14# Define HAVE_WORKING_O_DIRECTORY to 1 if O_DIRECTORY works, or to 0 otherwise.
13# Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise. 15# Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise.
14# Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise. 16# Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise.
15AC_DEFUN([gl_FCNTL_O_FLAGS], 17AC_DEFUN([gl_FCNTL_O_FLAGS],
@@ -30,16 +32,23 @@ AC_DEFUN([gl_FCNTL_O_FLAGS],
30 #else /* on Windows with MSVC */ 32 #else /* on Windows with MSVC */
31 # include <io.h> 33 # include <io.h>
32 # include <stdlib.h> 34 # include <stdlib.h>
33 # defined sleep(n) _sleep ((n) * 1000) 35 # define sleep(n) _sleep ((n) * 1000)
34 #endif 36 #endif
37 #include <errno.h>
35 #include <fcntl.h> 38 #include <fcntl.h>
36 ]GL_MDA_DEFINES[ 39 ]GL_MDA_DEFINES[
40 #ifndef O_DIRECTORY
41 #define O_DIRECTORY 0
42 #endif
37 #ifndef O_NOATIME 43 #ifndef O_NOATIME
38 #define O_NOATIME 0 44 #define O_NOATIME 0
39 #endif 45 #endif
40 #ifndef O_NOFOLLOW 46 #ifndef O_NOFOLLOW
41 #define O_NOFOLLOW 0 47 #define O_NOFOLLOW 0
42 #endif 48 #endif
49 #ifndef O_SEARCH
50 #define O_SEARCH O_RDONLY
51 #endif
43 static int const constants[] = 52 static int const constants[] =
44 { 53 {
45 O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, 54 O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND,
@@ -52,31 +61,38 @@ AC_DEFUN([gl_FCNTL_O_FLAGS],
52 { 61 {
53 static char const sym[] = "conftest.sym"; 62 static char const sym[] = "conftest.sym";
54 if (symlink ("/dev/null", sym) != 0) 63 if (symlink ("/dev/null", sym) != 0)
55 result |= 2; 64 result |= 1;
56 else 65 else
57 { 66 {
58 int fd = open (sym, O_WRONLY | O_NOFOLLOW | O_CREAT, 0); 67 int fd = open (sym, O_WRONLY | O_NOFOLLOW | O_CREAT, 0);
59 if (fd >= 0) 68 if (fd >= 0)
60 { 69 {
61 close (fd); 70 close (fd);
62 result |= 4; 71 result |= 3;
63 } 72 }
64 } 73 }
65 if (unlink (sym) != 0 || symlink (".", sym) != 0) 74 if (unlink (sym) != 0 || symlink (".", sym) != 0)
66 result |= 2; 75 result |= 1;
67 else 76 else
68 { 77 {
69 int fd = open (sym, O_RDONLY | O_NOFOLLOW); 78 int fd = open (sym, O_RDONLY | O_NOFOLLOW);
70 if (fd >= 0) 79 if (fd >= 0)
71 { 80 {
72 close (fd); 81 close (fd);
73 result |= 4; 82 result |= 3;
74 } 83 }
75 } 84 }
76 unlink (sym); 85 unlink (sym);
77 } 86 }
78 #endif 87 #endif
79 { 88 {
89 int fd = open ("confdefs.h", O_SEARCH | O_DIRECTORY);
90 if (!(fd < 0 && errno == ENOTDIR))
91 result |= 4;
92 if (0 <= fd)
93 close (fd);
94 }
95 {
80 static char const file[] = "confdefs.h"; 96 static char const file[] = "confdefs.h";
81 int fd = open (file, O_RDONLY | O_NOATIME); 97 int fd = open (file, O_RDONLY | O_NOATIME);
82 if (fd < 0) 98 if (fd < 0)
@@ -111,31 +127,46 @@ AC_DEFUN([gl_FCNTL_O_FLAGS],
111 } 127 }
112 return result;]])], 128 return result;]])],
113 [gl_cv_header_working_fcntl_h=yes], 129 [gl_cv_header_working_fcntl_h=yes],
114 [case $? in #( 130 [AS_CASE([$?],
115 4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( 131 dnl We cannot catch exit code 1 or 2 here, because
116 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( 132 dnl - exit code 1 can occur through a compilation error on mingw (e.g.
117 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( 133 dnl when O_NOCTTY, O_NONBLOCK, O_SYNC are not defined) or when
118 *) gl_cv_header_working_fcntl_h='no';; 134 dnl result = 1, whereas
119 esac], 135 dnl - exit code 2 can occur through a compilation error on MSVC (e.g.
120 [case "$host_os" in 136 dnl again when O_NOCTTY, O_NONBLOCK, O_SYNC are not defined) or when
121 # Guess 'no' on native Windows. 137 dnl result = 2.
122 mingw* | windows*) gl_cv_header_working_fcntl_h='no' ;; 138 [ 3], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW)"],
123 *) gl_cv_header_working_fcntl_h=cross-compiling ;; 139 [ 4], [gl_cv_header_working_fcntl_h="no (bad O_DIRECTORY)"],
124 esac 140 [ 7], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW, O_DIRECTORY)"],
125 ]) 141 [64], [gl_cv_header_working_fcntl_h="no (bad O_NOATIME)"],
126 ]) 142 [67], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW, O_NOATIME)"],
143 [68], [gl_cv_header_working_fcntl_h="no (bad O_DIRECTORY, O_NOATIME)"],
144 [71], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW, O_DIRECTORY, O_NOATIME)"],
145 [gl_cv_header_working_fcntl_h="no"])],
146 [AS_CASE([$host_os,$gl_cross_guess_normal],
147 # The O_DIRECTORY test is known to fail on Mac OS X 10.4.11 (2007)
148 # (see <https://bugs.gnu.org/78509#95>)
149 # and to succeed on Mac OS X 10.5.8 [darwin9.8.0] (2009).
150 # Guess it fails on Mac OS X 10.4.x and earlier.
151 [darwin[[0-8]].*yes],
152 [gl_cv_header_working_fcntl_h="guessing no (bad O_DIRECTORY)"],
153 # Known to be "no" on native MS-Windows.
154 [mingw* | windows*],
155 [gl_cv_header_working_fcntl_h=no],
156 [gl_cv_header_working_fcntl_h=$gl_cross_guess_normal])])])
157
158 AS_CASE([$gl_cv_header_working_fcntl_h],
159 [*O_DIRECTORY* | *no], [gl_val=0], [gl_val=1])
160 AC_DEFINE_UNQUOTED([HAVE_WORKING_O_DIRECTORY], [$gl_val],
161 [Define to 1 if O_DIRECTORY works, 0 otherwise.])
127 162
128 case $gl_cv_header_working_fcntl_h in #( 163 AS_CASE([$gl_cv_header_working_fcntl_h],
129 *O_NOATIME* | no | cross-compiling) ac_val=0;; #( 164 [*O_NOATIME* | *no], [gl_val=0], [gl_val=1])
130 *) ac_val=1;; 165 AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$gl_val],
131 esac 166 [Define to 1 if O_NOATIME works, 0 otherwise.])
132 AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val],
133 [Define to 1 if O_NOATIME works.])
134 167
135 case $gl_cv_header_working_fcntl_h in #( 168 AS_CASE([$gl_cv_header_working_fcntl_h],
136 *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #( 169 [*O_NOFOLLOW* | *no], [gl_val=0], [gl_val=1])
137 *) ac_val=1;; 170 AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$gl_val],
138 esac 171 [Define to 1 if O_NOFOLLOW works, 0 otherwise.])
139 AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val],
140 [Define to 1 if O_NOFOLLOW works.])
141]) 172])
diff --git a/gl/m4/fcntl.m4 b/gl/m4/fcntl.m4
index f6d0f377..69ac76f9 100644
--- a/gl/m4/fcntl.m4
+++ b/gl/m4/fcntl.m4
@@ -1,9 +1,10 @@
1# fcntl.m4 1# fcntl.m4
2# serial 12 2# serial 12
3dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# For now, this module ensures that fcntl() 9# For now, this module ensures that fcntl()
9# - supports F_DUPFD correctly 10# - supports F_DUPFD correctly
diff --git a/gl/m4/fcntl_h.m4 b/gl/m4/fcntl_h.m4
index b69f7a0c..946a0bd6 100644
--- a/gl/m4/fcntl_h.m4
+++ b/gl/m4/fcntl_h.m4
@@ -1,9 +1,10 @@
1# fcntl_h.m4 1# fcntl_h.m4
2# serial 20 2# serial 21
3dnl Copyright (C) 2006-2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006-2007, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Configure fcntl.h. 9# Configure fcntl.h.
9 10
@@ -25,7 +26,7 @@ AC_DEFUN_ONCE([gl_FCNTL_H],
25 dnl corresponding gnulib module is not in use, if it is not common 26 dnl corresponding gnulib module is not in use, if it is not common
26 dnl enough to be declared everywhere. 27 dnl enough to be declared everywhere.
27 gl_WARN_ON_USE_PREPARE([[#include <fcntl.h> 28 gl_WARN_ON_USE_PREPARE([[#include <fcntl.h>
28 ]], [fcntl openat]) 29 ]], [fcntl openat openat2])
29]) 30])
30 31
31# gl_FCNTL_MODULE_INDICATOR([modulename]) 32# gl_FCNTL_MODULE_INDICATOR([modulename])
@@ -52,6 +53,7 @@ AC_DEFUN([gl_FCNTL_H_REQUIRE_DEFAULTS],
52 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NONBLOCKING]) 53 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NONBLOCKING])
53 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPEN]) 54 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPEN])
54 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENAT]) 55 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENAT])
56 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENAT2])
55 dnl Support Microsoft deprecated alias function names by default. 57 dnl Support Microsoft deprecated alias function names by default.
56 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CREAT], [1]) 58 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CREAT], [1])
57 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_OPEN], [1]) 59 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_OPEN], [1])
@@ -65,6 +67,7 @@ AC_DEFUN([gl_FCNTL_H_DEFAULTS],
65 dnl Assume proper GNU behavior unless another module says otherwise. 67 dnl Assume proper GNU behavior unless another module says otherwise.
66 HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL]) 68 HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL])
67 HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT]) 69 HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT])
70 HAVE_OPENAT2=0; AC_SUBST([HAVE_OPENAT2])
68 REPLACE_CREAT=0; AC_SUBST([REPLACE_CREAT]) 71 REPLACE_CREAT=0; AC_SUBST([REPLACE_CREAT])
69 REPLACE_FCNTL=0; AC_SUBST([REPLACE_FCNTL]) 72 REPLACE_FCNTL=0; AC_SUBST([REPLACE_FCNTL])
70 REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN]) 73 REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN])
diff --git a/gl/m4/fflush.m4 b/gl/m4/fflush.m4
index 43fc3bf3..c5913b23 100644
--- a/gl/m4/fflush.m4
+++ b/gl/m4/fflush.m4
@@ -1,9 +1,10 @@
1# fflush.m4 1# fflush.m4
2# serial 19 2# serial 20
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Eric Blake 9dnl From Eric Blake
9 10
@@ -79,8 +80,9 @@ AC_DEFUN([gl_FUNC_FFLUSH_STDIN],
79 [gl_cv_func_fflush_stdin=yes], 80 [gl_cv_func_fflush_stdin=yes],
80 [gl_cv_func_fflush_stdin=no], 81 [gl_cv_func_fflush_stdin=no],
81 [case "$host_os" in 82 [case "$host_os" in
82 # Guess no on native Windows. 83 # Guess no on NetBSD, OpenBSD, native Windows.
83 mingw* | windows*) gl_cv_func_fflush_stdin="guessing no" ;; 84 netbsd* | openbsd* | mingw* | windows*)
85 gl_cv_func_fflush_stdin="guessing no" ;;
84 *) gl_cv_func_fflush_stdin=cross ;; 86 *) gl_cv_func_fflush_stdin=cross ;;
85 esac 87 esac
86 ]) 88 ])
@@ -92,8 +94,8 @@ AC_DEFUN([gl_FUNC_FFLUSH_STDIN],
92 *) gl_func_fflush_stdin='(-1)' ;; 94 *) gl_func_fflush_stdin='(-1)' ;;
93 esac 95 esac
94 AC_DEFINE_UNQUOTED([FUNC_FFLUSH_STDIN], [$gl_func_fflush_stdin], 96 AC_DEFINE_UNQUOTED([FUNC_FFLUSH_STDIN], [$gl_func_fflush_stdin],
95 [Define to 1 if fflush is known to work on stdin as per POSIX.1-2008, 97 [Define to 1 if fflush is known to work on stdin as per POSIX.1-2008
96 0 if fflush is known to not work, -1 if unknown.]) 98 or later, 0 if fflush is known to not work, -1 if unknown.])
97]) 99])
98 100
99# Prerequisites of lib/fflush.c. 101# Prerequisites of lib/fflush.c.
diff --git a/gl/m4/float_h.m4 b/gl/m4/float_h.m4
index c95d4171..c0ee7f8f 100644
--- a/gl/m4/float_h.m4
+++ b/gl/m4/float_h.m4
@@ -1,9 +1,10 @@
1# float_h.m4 1# float_h.m4
2# serial 14 2# serial 17
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FLOAT_H], 9AC_DEFUN([gl_FLOAT_H],
9[ 10[
@@ -12,7 +13,7 @@ AC_DEFUN([gl_FLOAT_H],
12 GL_GENERATE_FLOAT_H=false 13 GL_GENERATE_FLOAT_H=false
13 REPLACE_FLOAT_LDBL=0 14 REPLACE_FLOAT_LDBL=0
14 case "$host_os" in 15 case "$host_os" in
15 aix* | beos* | openbsd* | mirbsd* | irix*) 16 aix* | beos* | openbsd* | mirbsd*)
16 GL_GENERATE_FLOAT_H=true 17 GL_GENERATE_FLOAT_H=true
17 ;; 18 ;;
18 freebsd* | dragonfly*) 19 freebsd* | dragonfly*)
@@ -54,6 +55,32 @@ changequote([,])dnl
54 ;; 55 ;;
55 esac 56 esac
56 57
58 dnl Test for completeness w.r.t. ISO C 23.
59 REPLACE_FLOAT_SNAN=0
60 AC_CACHE_CHECK([whether float.h conforms to ISO C23],
61 [gl_cv_header_float_h_isoc23],
62 [AC_COMPILE_IFELSE(
63 [AC_LANG_PROGRAM(
64 [[#include <float.h>
65 int x[] = { FLT_DECIMAL_DIG, DBL_DECIMAL_DIG, LDBL_DECIMAL_DIG };
66 int y[] = { FLT_IS_IEC_60559, DBL_IS_IEC_60559, LDBL_IS_IEC_60559 };
67 float maxf = FLT_NORM_MAX;
68 double maxd = DBL_NORM_MAX;
69 long double maxl = LDBL_NORM_MAX;
70 ]],
71 [[float sf = FLT_SNAN;
72 double sd = DBL_SNAN;
73 long double sl = LDBL_SNAN;
74 return (sf != 0) + (sd != 0) + (sl != 0);
75 ]])],
76 [gl_cv_header_float_h_isoc23=yes],
77 [gl_cv_header_float_h_isoc23=no])
78 ])
79 if test $gl_cv_header_float_h_isoc23 != yes; then
80 GL_GENERATE_FLOAT_H=true
81 REPLACE_FLOAT_SNAN=1
82 fi
83
57 dnl Test against glibc-2.7 Linux/SPARC64 bug. 84 dnl Test against glibc-2.7 Linux/SPARC64 bug.
58 REPLACE_ITOLD=0 85 REPLACE_ITOLD=0
59 AC_CACHE_CHECK([whether conversion from 'int' to 'long double' works], 86 AC_CACHE_CHECK([whether conversion from 'int' to 'long double' works],
diff --git a/gl/m4/floorf.m4 b/gl/m4/floorf.m4
index 2572c848..731f0b0a 100644
--- a/gl/m4/floorf.m4
+++ b/gl/m4/floorf.m4
@@ -1,9 +1,10 @@
1# floorf.m4 1# floorf.m4
2# serial 21 2# serial 21
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_FLOORF], 9AC_DEFUN([gl_FUNC_FLOORF],
9[ 10[
diff --git a/gl/m4/fopen.m4 b/gl/m4/fopen.m4
index f3b7aadd..07779a16 100644
--- a/gl/m4/fopen.m4
+++ b/gl/m4/fopen.m4
@@ -1,9 +1,10 @@
1# fopen.m4 1# fopen.m4
2# serial 16 2# serial 16
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_FOPEN_ITSELF], 9AC_DEFUN([gl_FUNC_FOPEN_ITSELF],
9[ 10[
diff --git a/gl/m4/fpurge.m4 b/gl/m4/fpurge.m4
index a77f5b96..a7cf67dc 100644
--- a/gl/m4/fpurge.m4
+++ b/gl/m4/fpurge.m4
@@ -1,65 +1,65 @@
1# fpurge.m4 1# fpurge.m4
2# serial 14 2# serial 16
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_FPURGE], 9AC_DEFUN([gl_FUNC_FPURGE],
9[ 10[
10 AC_REQUIRE([gl_STDIO_H_DEFAULTS]) 11 AC_REQUIRE([gl_STDIO_H_DEFAULTS])
11 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
12 AC_CHECK_HEADERS_ONCE([stdio_ext.h]) 12 AC_CHECK_HEADERS_ONCE([stdio_ext.h])
13 AC_CHECK_FUNCS_ONCE([fpurge]) 13 AC_CHECK_FUNCS_ONCE([fpurge])
14 gl_CHECK_FUNCS_ANDROID([__fpurge], [[#include <stdio_ext.h>]]) 14 gl_CHECK_FUNCS_ANDROID([__fpurge], [[#include <stdio_ext.h>]])
15 AC_CHECK_DECLS([fpurge], , , [[#include <stdio.h>]]) 15 AC_CHECK_DECLS([fpurge], , , [[#include <stdio.h>]])
16 if test "x$ac_cv_func_fpurge" = xyes; then 16 if test $ac_cv_func_fpurge = yes; then
17 HAVE_FPURGE=1 17 HAVE_FPURGE=1
18 # Detect BSD bug. Only cygwin 1.7 and musl are known to be immune. 18 # Detect BSD bug. Only cygwin 1.7 and musl are known to be immune.
19 AC_CACHE_CHECK([whether fpurge works], [gl_cv_func_fpurge_works], 19 AC_CACHE_CHECK([whether fpurge works], [gl_cv_func_fpurge_works],
20 [AC_RUN_IFELSE( 20 [if test $ac_cv_have_decl_fpurge = yes; then
21 [AC_LANG_PROGRAM( 21 AC_RUN_IFELSE(
22 [[#include <stdio.h> 22 [AC_LANG_PROGRAM(
23]], 23 [[#include <stdio.h>
24 [[FILE *f = fopen ("conftest.txt", "w+"); 24 ]],
25 if (!f) 25 [[FILE *f = fopen ("conftest.txt", "w+");
26 return 1; 26 if (!f)
27 if (fputc ('a', f) != 'a') 27 return 1;
28 { fclose (f); return 2; } 28 if (fputc ('a', f) != 'a')
29 rewind (f); 29 { fclose (f); return 2; }
30 if (fgetc (f) != 'a') 30 rewind (f);
31 { fclose (f); return 3; } 31 if (fgetc (f) != 'a')
32 if (fgetc (f) != EOF) 32 { fclose (f); return 3; }
33 { fclose (f); return 4; } 33 if (fgetc (f) != EOF)
34 if (fpurge (f) != 0) 34 { fclose (f); return 4; }
35 { fclose (f); return 5; } 35 if (fpurge (f) != 0)
36 if (putc ('b', f) != 'b') 36 { fclose (f); return 5; }
37 { fclose (f); return 6; } 37 if (putc ('b', f) != 'b')
38 if (fclose (f) != 0) 38 { fclose (f); return 6; }
39 return 7; 39 if (fclose (f) != 0)
40 if ((f = fopen ("conftest.txt", "r")) == NULL) 40 return 7;
41 return 8; 41 if ((f = fopen ("conftest.txt", "r")) == NULL)
42 if (fgetc (f) != 'a') 42 return 8;
43 { fclose (f); return 9; } 43 if (fgetc (f) != 'a')
44 if (fgetc (f) != 'b') 44 { fclose (f); return 9; }
45 { fclose (f); return 10; } 45 if (fgetc (f) != 'b')
46 if (fgetc (f) != EOF) 46 { fclose (f); return 10; }
47 { fclose (f); return 11; } 47 if (fgetc (f) != EOF)
48 if (fclose (f) != 0) 48 { fclose (f); return 11; }
49 return 12; 49 if (fclose (f) != 0)
50 if (remove ("conftest.txt") != 0) 50 return 12;
51 return 13; 51 if (remove ("conftest.txt") != 0)
52 return 0; 52 return 13;
53 ]])], 53 return 0;
54 [gl_cv_func_fpurge_works=yes], 54 ]])],
55 [gl_cv_func_fpurge_works=no], 55 [gl_cv_func_fpurge_works=yes],
56 [case "$host_os" in 56 [gl_cv_func_fpurge_works=no],
57 # Guess yes on musl systems. 57 [# Obey --enable-cross-guesses.
58 *-musl* | midipix*) gl_cv_func_fpurge_works="guessing yes" ;; 58 gl_cv_func_fpurge_works="$gl_cross_guess_normal"
59 # Otherwise obey --enable-cross-guesses. 59 ])
60 *) gl_cv_func_fpurge_works="$gl_cross_guess_normal" ;; 60 else
61 esac 61 gl_cv_func_fpurge_works=no
62 ]) 62 fi
63 ]) 63 ])
64 case "$gl_cv_func_fpurge_works" in 64 case "$gl_cv_func_fpurge_works" in
65 *yes) ;; 65 *yes) ;;
diff --git a/gl/m4/freading.m4 b/gl/m4/freading.m4
index be899456..b5b54f40 100644
--- a/gl/m4/freading.m4
+++ b/gl/m4/freading.m4
@@ -1,9 +1,10 @@
1# freading.m4 1# freading.m4
2# serial 3 2# serial 3
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_FREADING], 9AC_DEFUN([gl_FUNC_FREADING],
9[ 10[
diff --git a/gl/m4/free.m4 b/gl/m4/free.m4
index a2b596d6..c7a134ba 100644
--- a/gl/m4/free.m4
+++ b/gl/m4/free.m4
@@ -1,9 +1,10 @@
1# free.m4 1# free.m4
2# serial 6 2# serial 6
3dnl Copyright (C) 2003-2005, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003-2005, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Written by Paul Eggert and Bruno Haible. 9# Written by Paul Eggert and Bruno Haible.
9 10
@@ -13,10 +14,10 @@ AC_DEFUN([gl_FUNC_FREE],
13 14
14 dnl In the next release of POSIX, free must preserve errno. 15 dnl In the next release of POSIX, free must preserve errno.
15 dnl https://www.austingroupbugs.net/view.php?id=385 16 dnl https://www.austingroupbugs.net/view.php?id=385
16 dnl https://sourceware.org/bugzilla/show_bug.cgi?id=17924 17 dnl https://sourceware.org/PR17924
17 dnl So far, we know of three platforms that do this: 18 dnl So far, we know of three platforms that do this:
18 dnl * glibc >= 2.33, thanks to the fix for this bug: 19 dnl * glibc >= 2.33, thanks to the fix for this bug:
19 dnl <https://sourceware.org/bugzilla/show_bug.cgi?id=17924> 20 dnl <https://sourceware.org/PR17924>
20 dnl * OpenBSD >= 4.5, thanks to this commit: 21 dnl * OpenBSD >= 4.5, thanks to this commit:
21 dnl <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdlib/malloc.c.diff?r1=1.100&r2=1.101&f=h> 22 dnl <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdlib/malloc.c.diff?r1=1.100&r2=1.101&f=h>
22 dnl * Solaris, because its malloc() implementation is based on brk(), 23 dnl * Solaris, because its malloc() implementation is based on brk(),
diff --git a/gl/m4/fseek.m4 b/gl/m4/fseek.m4
index fb220a1f..398fd5f8 100644
--- a/gl/m4/fseek.m4
+++ b/gl/m4/fseek.m4
@@ -1,9 +1,10 @@
1# fseek.m4 1# fseek.m4
2# serial 4 2# serial 4
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_FSEEK], 9AC_DEFUN([gl_FUNC_FSEEK],
9[ 10[
diff --git a/gl/m4/fseeko.m4 b/gl/m4/fseeko.m4
index 5682a1f2..cd81961a 100644
--- a/gl/m4/fseeko.m4
+++ b/gl/m4/fseeko.m4
@@ -1,9 +1,10 @@
1# fseeko.m4 1# fseeko.m4
2# serial 20 2# serial 21
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_FSEEKO], 9AC_DEFUN([gl_FUNC_FSEEKO],
9[ 10[
@@ -69,6 +70,10 @@ AC_DEFUN([gl_STDIN_LARGE_OFFSET],
69# Prerequisites of lib/fseeko.c. 70# Prerequisites of lib/fseeko.c.
70AC_DEFUN([gl_PREREQ_FSEEKO], 71AC_DEFUN([gl_PREREQ_FSEEKO],
71[ 72[
73 if test $gl_cv_func_fseeko != no; then
74 AC_DEFINE([HAVE_FSEEKO], [1],
75 [Define to 1 if the system has the fseeko function.])
76 fi
72 dnl Native Windows has the function _fseeki64. mingw hides it in some 77 dnl Native Windows has the function _fseeki64. mingw hides it in some
73 dnl circumstances, but mingw64 makes it usable again. 78 dnl circumstances, but mingw64 makes it usable again.
74 AC_CHECK_FUNCS([_fseeki64]) 79 AC_CHECK_FUNCS([_fseeki64])
diff --git a/gl/m4/fseterr.m4 b/gl/m4/fseterr.m4
new file mode 100644
index 00000000..e5ad635b
--- /dev/null
+++ b/gl/m4/fseterr.m4
@@ -0,0 +1,15 @@
1# fseterr.m4
2# serial 2
3dnl Copyright (C) 2012-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN([gl_FUNC_FSETERR],
10[
11 gl_CHECK_FUNCS_ANDROID([__fseterr],
12 [[#include <stdio.h>
13 #include <stdio_ext.h>
14 ]])
15])
diff --git a/gl/m4/fstat.m4 b/gl/m4/fstat.m4
index 47777b0c..7db4e346 100644
--- a/gl/m4/fstat.m4
+++ b/gl/m4/fstat.m4
@@ -1,9 +1,10 @@
1# fstat.m4 1# fstat.m4
2# serial 10 2# serial 10
3dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2011-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_FSTAT], 9AC_DEFUN([gl_FUNC_FSTAT],
9[ 10[
diff --git a/gl/m4/fstypename.m4 b/gl/m4/fstypename.m4
index 05a68805..64122a73 100644
--- a/gl/m4/fstypename.m4
+++ b/gl/m4/fstypename.m4
@@ -1,10 +1,11 @@
1# fstypename.m4 1# fstypename.m4
2# serial 6 2# serial 6
3dnl Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2024 Free Software 3dnl Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2026 Free Software
4dnl Foundation, Inc. 4dnl Foundation, Inc.
5dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
6dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
7dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
8 9
9dnl From Jim Meyering. 10dnl From Jim Meyering.
10dnl 11dnl
diff --git a/gl/m4/fsusage.m4 b/gl/m4/fsusage.m4
index 1ce90660..db6e0e3b 100644
--- a/gl/m4/fsusage.m4
+++ b/gl/m4/fsusage.m4
@@ -1,9 +1,11 @@
1# fsusage.m4 1# fsusage.m4
2# serial 35 2# serial 37
3dnl Copyright (C) 1997-1998, 2000-2001, 2003-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 1997-1998, 2000-2001, 2003-2026 Free Software Foundation,
4dnl Inc.
4dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
7 9
8# Obtaining file system usage information. 10# Obtaining file system usage information.
9 11
@@ -46,16 +48,12 @@ AC_DEFUN([gl_FILE_SYSTEM_USAGE],
46 # is what it gets when this test fails. 48 # is what it gets when this test fails.
47 if test $ac_fsusage_space = no; then 49 if test $ac_fsusage_space = no; then
48 # glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0, 50 # glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0,
49 # OpenBSD >= 4.4, AIX, HP-UX, IRIX, Solaris, Cygwin, Interix, BeOS. 51 # OpenBSD >= 4.4, AIX, HP-UX, Solaris, Cygwin, Interix, BeOS.
50 AC_CACHE_CHECK([for statvfs function (SVR4)], 52 AC_CACHE_CHECK([for statvfs function (SVR4)],
51 [fu_cv_sys_stat_statvfs], 53 [fu_cv_sys_stat_statvfs],
52 [AC_LINK_IFELSE( 54 [AC_LINK_IFELSE(
53 [AC_LANG_PROGRAM([[ 55 [AC_LANG_PROGRAM([[
54#include <sys/types.h> 56#include <sys/types.h>
55#ifdef __osf__
56"Do not use Tru64's statvfs implementation"
57#endif
58
59#include <sys/statvfs.h> 57#include <sys/statvfs.h>
60 58
61struct statvfs fsd; 59struct statvfs fsd;
@@ -77,7 +75,7 @@ int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 32 ? -1 : 1];
77 if test $fu_cv_sys_stat_statvfs = yes; then 75 if test $fu_cv_sys_stat_statvfs = yes; then
78 ac_fsusage_space=yes 76 ac_fsusage_space=yes
79 # AIX >= 5.2 has statvfs64 that has a wider f_blocks field than statvfs. 77 # AIX >= 5.2 has statvfs64 that has a wider f_blocks field than statvfs.
80 # glibc, HP-UX, IRIX, Solaris have statvfs64 as well, but on these systems 78 # glibc, HP-UX, Solaris have statvfs64 as well, but on these systems
81 # statvfs with large-file support is already equivalent to statvfs64. 79 # statvfs with large-file support is already equivalent to statvfs64.
82 AC_CACHE_CHECK([whether to use statvfs64], 80 AC_CACHE_CHECK([whether to use statvfs64],
83 [fu_cv_sys_stat_statvfs64], 81 [fu_cv_sys_stat_statvfs64],
@@ -139,37 +137,9 @@ int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 32 ? -1 : 1];
139 fi 137 fi
140 138
141 if test $ac_fsusage_space = no; then 139 if test $ac_fsusage_space = no; then
142 # DEC Alpha running OSF/1
143 AC_CACHE_CHECK([for 3-argument statfs function (DEC OSF/1)],
144 [fu_cv_sys_stat_statfs3_osf1],
145 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
146#include <sys/param.h>
147#include <sys/types.h>
148#include <sys/mount.h>
149 int
150 main ()
151 {
152 struct statfs fsd;
153 fsd.f_fsize = 0;
154 return statfs (".", &fsd, sizeof (struct statfs)) != 0;
155 }]])],
156 [fu_cv_sys_stat_statfs3_osf1=yes],
157 [fu_cv_sys_stat_statfs3_osf1=no],
158 [fu_cv_sys_stat_statfs3_osf1=no])
159 ])
160 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
161 ac_fsusage_space=yes
162 AC_DEFINE([STAT_STATFS3_OSF1], [1],
163 [Define if statfs takes 3 args. (DEC Alpha running OSF/1)])
164 fi
165 fi
166
167 if test $ac_fsusage_space = no; then
168 # glibc/Linux, Mac OS X, FreeBSD < 5.0, NetBSD < 3.0, OpenBSD < 4.4. 140 # glibc/Linux, Mac OS X, FreeBSD < 5.0, NetBSD < 3.0, OpenBSD < 4.4.
169 # (glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0, 141 # (glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0,
170 # OpenBSD >= 4.4, AIX, HP-UX, OSF/1, Cygwin already handled above.) 142 # OpenBSD >= 4.4, AIX, HP-UX, Cygwin already handled above.)
171 # (On IRIX you need to include <sys/statfs.h>, not only <sys/mount.h> and
172 # <sys/vfs.h>.)
173 # (On Solaris, statfs has 4 arguments.) 143 # (On Solaris, statfs has 4 arguments.)
174 AC_CACHE_CHECK([for two-argument statfs with statfs.f_bsize member (AIX, 4.3BSD)], 144 AC_CACHE_CHECK([for two-argument statfs with statfs.f_bsize member (AIX, 4.3BSD)],
175 [fu_cv_sys_stat_statfs2_bsize], 145 [fu_cv_sys_stat_statfs2_bsize],
@@ -223,13 +193,12 @@ int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 32 ? -1 : 1];
223 if test $fu_cv_sys_stat_statfs4 = yes; then 193 if test $fu_cv_sys_stat_statfs4 = yes; then
224 ac_fsusage_space=yes 194 ac_fsusage_space=yes
225 AC_DEFINE([STAT_STATFS4], [1], 195 AC_DEFINE([STAT_STATFS4], [1],
226 [Define if statfs takes 4 args. (SVR3, old Irix)]) 196 [Define if statfs takes 4 args. (SVR3)])
227 fi 197 fi
228 fi 198 fi
229 199
230 if test $ac_fsusage_space = no; then 200 if test $ac_fsusage_space = no; then
231 # 4.4BSD and older NetBSD 201 # 4.4BSD and older NetBSD
232 # (OSF/1 already handled above.)
233 # (On AIX, you need to include <sys/statfs.h>, not only <sys/mount.h>.) 202 # (On AIX, you need to include <sys/statfs.h>, not only <sys/mount.h>.)
234 # (On Solaris, statfs has 4 arguments and 'struct statfs' is not declared in 203 # (On Solaris, statfs has 4 arguments and 'struct statfs' is not declared in
235 # <sys/mount.h>.) 204 # <sys/mount.h>.)
diff --git a/gl/m4/ftell.m4 b/gl/m4/ftell.m4
index ab10736b..0b389f86 100644
--- a/gl/m4/ftell.m4
+++ b/gl/m4/ftell.m4
@@ -1,9 +1,10 @@
1# ftell.m4 1# ftell.m4
2# serial 3 2# serial 3
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_FTELL], 9AC_DEFUN([gl_FUNC_FTELL],
9[ 10[
diff --git a/gl/m4/ftello.m4 b/gl/m4/ftello.m4
index 0eb8fa0d..ae0e884f 100644
--- a/gl/m4/ftello.m4
+++ b/gl/m4/ftello.m4
@@ -1,9 +1,10 @@
1# ftello.m4 1# ftello.m4
2# serial 16 2# serial 17
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_FTELLO], 9AC_DEFUN([gl_FUNC_FTELLO],
9[ 10[
@@ -157,6 +158,10 @@ main (void)
157# Prerequisites of lib/ftello.c. 158# Prerequisites of lib/ftello.c.
158AC_DEFUN([gl_PREREQ_FTELLO], 159AC_DEFUN([gl_PREREQ_FTELLO],
159[ 160[
161 if test $gl_cv_func_ftello != no; then
162 AC_DEFINE([HAVE_FTELLO], [1],
163 [Define to 1 if the system has the ftello function.])
164 fi
160 dnl Native Windows has the function _ftelli64. mingw hides it, but mingw64 165 dnl Native Windows has the function _ftelli64. mingw hides it, but mingw64
161 dnl makes it usable again. 166 dnl makes it usable again.
162 AC_CHECK_FUNCS([_ftelli64]) 167 AC_CHECK_FUNCS([_ftelli64])
diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4
index 8e209177..8a63600b 100644
--- a/gl/m4/getaddrinfo.m4
+++ b/gl/m4/getaddrinfo.m4
@@ -1,14 +1,16 @@
1# getaddrinfo.m4 1# getaddrinfo.m4
2# serial 35 2# serial 39
3dnl Copyright (C) 2004-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2004-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_GETADDRINFO], 9AC_DEFUN([gl_GETADDRINFO],
9[ 10[
10 AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H 11 AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
11 AC_REQUIRE([gl_NETDB_H])dnl for HAVE_NETDB_H 12 AC_REQUIRE([gl_NETDB_H])dnl for HAVE_NETDB_H
13 AC_REQUIRE([AC_CANONICAL_HOST])
12 GETADDRINFO_LIB= 14 GETADDRINFO_LIB=
13 gai_saved_LIBS="$LIBS" 15 gai_saved_LIBS="$LIBS"
14 16
@@ -87,6 +89,60 @@ int getaddrinfo (const char *, const char *, const struct addrinfo *, struct add
87 HAVE_GETADDRINFO=0 89 HAVE_GETADDRINFO=0
88 fi 90 fi
89 fi 91 fi
92 if test $HAVE_GETADDRINFO != 0; then
93 AC_CACHE_CHECK([whether getaddrinfo supports AI_NUMERICHOST and AI_NUMERICSERV],
94 [gl_cv_func_getaddrinfo_works],
95 [AC_RUN_IFELSE(
96 [AC_LANG_PROGRAM([[
97#include <sys/types.h>
98#ifdef HAVE_SYS_SOCKET_H
99#include <sys/socket.h>
100#endif
101#ifdef HAVE_NETDB_H
102#include <netdb.h>
103#endif
104#ifdef HAVE_WS2TCPIP_H
105#include <ws2tcpip.h>
106#endif
107#include <stddef.h>
108#include <string.h>
109 ]], [[
110 int result = 0;
111 struct addrinfo *ai;
112 {
113 struct addrinfo hints;
114 memset (&hints, 0, sizeof (hints));
115 hints.ai_flags = AI_NUMERICHOST;
116 if (getaddrinfo ("www.gnu.org", "http", &hints, &ai) != EAI_NONAME)
117 result |= 1;
118 }
119 {
120 struct addrinfo hints;
121 memset (&hints, 0, sizeof (hints));
122 hints.ai_flags = AI_NUMERICSERV;
123 if (getaddrinfo ("www.gnu.org", "http", &hints, &ai) != EAI_NONAME)
124 result |= 2;
125 }
126 return result;
127 ]])
128 ],
129 [gl_cv_func_getaddrinfo_works=yes],
130 [gl_cv_func_getaddrinfo_works=no],
131 [case "$host_os" in
132 # Guess no on Solaris.
133 solaris*) gl_cv_func_getaddrinfo_works="guessing no" ;;
134 # Guess no on native Windows.
135 mingw* | windows*) gl_cv_func_getaddrinfo_works="guessing no" ;;
136 # Guess yes otherwise.
137 *) gl_cv_func_getaddrinfo_works="guessing yes" ;;
138 esac
139 ])
140 ])
141 case "$gl_cv_func_getaddrinfo_works" in
142 *yes) ;;
143 *) REPLACE_GETADDRINFO=1 ;;
144 esac
145 fi
90 AC_DEFINE_UNQUOTED([HAVE_GETADDRINFO], [$HAVE_GETADDRINFO], 146 AC_DEFINE_UNQUOTED([HAVE_GETADDRINFO], [$HAVE_GETADDRINFO],
91 [Define to 1 if getaddrinfo exists, or to 0 otherwise.]) 147 [Define to 1 if getaddrinfo exists, or to 0 otherwise.])
92 148
diff --git a/gl/m4/getdelim.m4 b/gl/m4/getdelim.m4
index 61139039..8b6eff47 100644
--- a/gl/m4/getdelim.m4
+++ b/gl/m4/getdelim.m4
@@ -1,11 +1,12 @@
1# getdelim.m4 1# getdelim.m4
2# serial 19 2# serial 21
3 3
4dnl Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc. 4dnl Copyright (C) 2005-2007, 2009-2026 Free Software Foundation, Inc.
5dnl 5dnl
6dnl This file is free software; the Free Software Foundation 6dnl This file is free software; the Free Software Foundation
7dnl gives unlimited permission to copy and/or distribute it, 7dnl gives unlimited permission to copy and/or distribute it,
8dnl with or without modifications, as long as this notice is preserved. 8dnl with or without modifications, as long as this notice is preserved.
9dnl This file is offered as-is, without any warranty.
9 10
10AC_PREREQ([2.59]) 11AC_PREREQ([2.59])
11 12
@@ -36,6 +37,7 @@ AC_DEFUN([gl_FUNC_GETDELIM],
36 gl_cv_func_working_getdelim=no ;; 37 gl_cv_func_working_getdelim=no ;;
37 *) 38 *)
38 echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data 39 echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data
40 touch conftest.empty
39 AC_RUN_IFELSE([AC_LANG_SOURCE([[ 41 AC_RUN_IFELSE([AC_LANG_SOURCE([[
40# include <stdio.h> 42# include <stdio.h>
41# include <stdlib.h> 43# include <stdlib.h>
@@ -43,6 +45,7 @@ AC_DEFUN([gl_FUNC_GETDELIM],
43 int main () 45 int main ()
44 { 46 {
45 FILE *in = fopen ("./conftest.data", "r"); 47 FILE *in = fopen ("./conftest.data", "r");
48 int result = 0;
46 if (!in) 49 if (!in)
47 return 1; 50 return 1;
48 { 51 {
@@ -52,7 +55,7 @@ AC_DEFUN([gl_FUNC_GETDELIM],
52 size_t siz = 0; 55 size_t siz = 0;
53 int len = getdelim (&line, &siz, '\n', in); 56 int len = getdelim (&line, &siz, '\n', in);
54 if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) 57 if (!(len == 4 && line && strcmp (line, "foo\n") == 0))
55 { free (line); fclose (in); return 2; } 58 result |= 2;
56 free (line); 59 free (line);
57 } 60 }
58 { 61 {
@@ -61,35 +64,40 @@ AC_DEFUN([gl_FUNC_GETDELIM],
61 char *line = NULL; 64 char *line = NULL;
62 size_t siz = (size_t)(~0) / 4; 65 size_t siz = (size_t)(~0) / 4;
63 if (getdelim (&line, &siz, '\n', in) == -1) 66 if (getdelim (&line, &siz, '\n', in) == -1)
64 { fclose (in); return 3; } 67 result |= 4;
65 free (line); 68 free (line);
66 } 69 }
67 fclose (in); 70 fclose (in);
68 return 0; 71 {
72 /* Test that reading EOF as the first character sets the first byte
73 in the buffer to NUL. This fails on glibc 2.42 and earlier. */
74 in = fopen ("./conftest.empty", "r");
75 if (!in)
76 return 1;
77 char *line = malloc (1);
78 line[0] = 'A';
79 size_t siz = 1;
80 if (getdelim (&line, &siz, '\n', in) != -1 || line[0] != '\0')
81 result |= 8;
82 free (line);
83 }
84 fclose (in);
85 return result;
69 } 86 }
70 ]])], 87 ]])],
71 [gl_cv_func_working_getdelim=yes], 88 [gl_cv_func_working_getdelim=yes],
72 [gl_cv_func_working_getdelim=no], 89 [gl_cv_func_working_getdelim=no],
73 [dnl We're cross compiling. 90 [case "$host_os" in
74 dnl Guess it works on glibc2 systems and musl systems. 91 # Guess yes on musl.
75 AC_EGREP_CPP([Lucky GNU user], 92 *-musl* | midipix*) gl_cv_func_working_getdelim="guessing yes" ;;
76 [ 93 # Guess no on glibc.
77#include <features.h> 94 *-gnu* | gnu*) gl_cv_func_working_getdelim="guessing no" ;;
78#ifdef __GNU_LIBRARY__ 95 *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;;
79 #if (__GLIBC__ >= 2) && !defined __UCLIBC__ 96 esac
80 Lucky GNU user
81 #endif
82#endif
83 ],
84 [gl_cv_func_working_getdelim="guessing yes"],
85 [case "$host_os" in
86 *-musl* | midipix*) gl_cv_func_working_getdelim="guessing yes" ;;
87 *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;;
88 esac
89 ])
90 ]) 97 ])
91 ;; 98 ;;
92 esac 99 esac
100 rm -f conftest.data conftest.empty
93 ]) 101 ])
94 case "$gl_cv_func_working_getdelim" in 102 case "$gl_cv_func_working_getdelim" in
95 *yes) ;; 103 *yes) ;;
diff --git a/gl/m4/getdtablesize.m4 b/gl/m4/getdtablesize.m4
index aaefe9b2..0b780110 100644
--- a/gl/m4/getdtablesize.m4
+++ b/gl/m4/getdtablesize.m4
@@ -1,9 +1,10 @@
1# getdtablesize.m4 1# getdtablesize.m4
2# serial 8 2# serial 8
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_GETDTABLESIZE], 9AC_DEFUN([gl_FUNC_GETDTABLESIZE],
9[ 10[
diff --git a/gl/m4/gethostname.m4 b/gl/m4/gethostname.m4
index 2f743b7d..33293521 100644
--- a/gl/m4/gethostname.m4
+++ b/gl/m4/gethostname.m4
@@ -1,9 +1,10 @@
1# gethostname.m4 1# gethostname.m4
2# serial 16 2# serial 16
3dnl Copyright (C) 2002, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002, 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Ensure 9# Ensure
9# - the gethostname() function, 10# - the gethostname() function,
diff --git a/gl/m4/getline.m4 b/gl/m4/getline.m4
index 36513cd4..ed32fa10 100644
--- a/gl/m4/getline.m4
+++ b/gl/m4/getline.m4
@@ -1,12 +1,13 @@
1# getline.m4 1# getline.m4
2# serial 33 2# serial 35
3 3
4dnl Copyright (C) 1998-2003, 2005-2007, 2009-2024 Free Software Foundation, 4dnl Copyright (C) 1998-2003, 2005-2007, 2009-2026 Free Software Foundation,
5dnl Inc. 5dnl Inc.
6dnl 6dnl
7dnl This file is free software; the Free Software Foundation 7dnl This file is free software; the Free Software Foundation
8dnl gives unlimited permission to copy and/or distribute it, 8dnl gives unlimited permission to copy and/or distribute it,
9dnl with or without modifications, as long as this notice is preserved. 9dnl with or without modifications, as long as this notice is preserved.
10dnl This file is offered as-is, without any warranty.
10 11
11AC_PREREQ([2.59]) 12AC_PREREQ([2.59])
12 13
@@ -30,6 +31,7 @@ AC_DEFUN([gl_FUNC_GETLINE],
30 AC_CACHE_CHECK([for working getline function], 31 AC_CACHE_CHECK([for working getline function],
31 [am_cv_func_working_getline], 32 [am_cv_func_working_getline],
32 [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data 33 [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data
34 touch conftest.empty
33 AC_RUN_IFELSE([AC_LANG_SOURCE([[ 35 AC_RUN_IFELSE([AC_LANG_SOURCE([[
34# include <stdio.h> 36# include <stdio.h>
35# include <stdlib.h> 37# include <stdlib.h>
@@ -37,6 +39,7 @@ AC_DEFUN([gl_FUNC_GETLINE],
37 int main () 39 int main ()
38 { 40 {
39 FILE *in = fopen ("./conftest.data", "r"); 41 FILE *in = fopen ("./conftest.data", "r");
42 int result = 0;
40 if (!in) 43 if (!in)
41 return 1; 44 return 1;
42 { 45 {
@@ -46,7 +49,7 @@ AC_DEFUN([gl_FUNC_GETLINE],
46 size_t siz = 0; 49 size_t siz = 0;
47 int len = getline (&line, &siz, in); 50 int len = getline (&line, &siz, in);
48 if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) 51 if (!(len == 4 && line && strcmp (line, "foo\n") == 0))
49 { free (line); fclose (in); return 2; } 52 result |= 2;
50 free (line); 53 free (line);
51 } 54 }
52 { 55 {
@@ -55,33 +58,38 @@ AC_DEFUN([gl_FUNC_GETLINE],
55 char *line = NULL; 58 char *line = NULL;
56 size_t siz = (size_t)(~0) / 4; 59 size_t siz = (size_t)(~0) / 4;
57 if (getline (&line, &siz, in) == -1) 60 if (getline (&line, &siz, in) == -1)
58 { fclose (in); return 3; } 61 result |= 4;
59 free (line); 62 free (line);
60 } 63 }
61 fclose (in); 64 fclose (in);
62 return 0; 65 {
66 /* Test that reading EOF as the first character sets the first byte
67 in the buffer to NUL. This fails on glibc 2.42 and earlier. */
68 in = fopen ("./conftest.empty", "r");
69 if (!in)
70 return 1;
71 char *line = malloc (1);
72 line[0] = 'A';
73 size_t siz = 1;
74 if (getline (&line, &siz, in) != -1 || line[0] != '\0')
75 result |= 8;
76 free (line);
77 }
78 fclose (in);
79 return result;
63 } 80 }
64 ]])], 81 ]])],
65 [am_cv_func_working_getline=yes], 82 [am_cv_func_working_getline=yes],
66 [am_cv_func_working_getline=no], 83 [am_cv_func_working_getline=no],
67 [dnl We're cross compiling. 84 [case "$host_os" in
68 dnl Guess it works on glibc2 systems and musl systems. 85 # Guess yes on musl.
69 AC_EGREP_CPP([Lucky GNU user], 86 *-musl* | midipix*) am_cv_func_working_getline="guessing yes" ;;
70 [ 87 # Guess no on glibc.
71#include <features.h> 88 *-gnu* | gnu*) am_cv_func_working_getline="guessing no" ;;
72#ifdef __GNU_LIBRARY__ 89 *) am_cv_func_working_getline="$gl_cross_guess_normal" ;;
73 #if (__GLIBC__ >= 2) && !defined __UCLIBC__ 90 esac
74 Lucky GNU user
75 #endif
76#endif
77 ],
78 [am_cv_func_working_getline="guessing yes"],
79 [case "$host_os" in
80 *-musl* | midipix*) am_cv_func_working_getline="guessing yes" ;;
81 *) am_cv_func_working_getline="$gl_cross_guess_normal" ;;
82 esac
83 ])
84 ]) 91 ])
92 rm -f conftest.data conftest.empty
85 ]) 93 ])
86 else 94 else
87 am_cv_func_working_getline=no 95 am_cv_func_working_getline=no
diff --git a/gl/m4/getloadavg.m4 b/gl/m4/getloadavg.m4
index 0918bcd2..dc226168 100644
--- a/gl/m4/getloadavg.m4
+++ b/gl/m4/getloadavg.m4
@@ -1,10 +1,11 @@
1# getloadavg.m4 1# getloadavg.m4
2# serial 13 2# serial 14
3dnl Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2024 Free Software 3dnl Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2026 Free
4dnl Foundation, Inc. 4dnl Software Foundation, Inc.
5dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
6dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
7dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
8 9
9# Check for getloadavg. 10# Check for getloadavg.
10 11
@@ -123,8 +124,7 @@ if test $gl_func_getloadavg_done = no; then
123fi 124fi
124 125
125# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it 126# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
126# uses stabs), but it is still SVR4. We cannot check for <elf.h> because 127# uses stabs), but it is still SVR4.
127# Irix 4.0.5F has the header but not the library.
128if test $gl_func_getloadavg_done = no && test "$ac_cv_lib_elf_elf_begin" = yes \ 128if test $gl_func_getloadavg_done = no && test "$ac_cv_lib_elf_elf_begin" = yes \
129 && test "$ac_cv_lib_kvm_kvm_open" = yes; then 129 && test "$ac_cv_lib_kvm_kvm_open" = yes; then
130 gl_func_getloadavg_done=yes 130 gl_func_getloadavg_done=yes
diff --git a/gl/m4/getopt.m4 b/gl/m4/getopt.m4
index 297722ea..c620b2b7 100644
--- a/gl/m4/getopt.m4
+++ b/gl/m4/getopt.m4
@@ -1,9 +1,10 @@
1# getopt.m4 1# getopt.m4
2# serial 49 2# serial 52
3dnl Copyright (C) 2002-2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2006, 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Request a POSIX compliant getopt function. 9# Request a POSIX compliant getopt function.
9AC_DEFUN([gl_FUNC_GETOPT_POSIX], 10AC_DEFUN([gl_FUNC_GETOPT_POSIX],
@@ -77,7 +78,7 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
77 fi 78 fi
78 79
79 dnl POSIX 2008 does not specify leading '+' behavior, but see 80 dnl POSIX 2008 does not specify leading '+' behavior, but see
80 dnl http://austingroupbugs.net/view.php?id=191 for a recommendation on 81 dnl https://austingroupbugs.net/view.php?id=191 for a recommendation on
81 dnl the next version of POSIX. For now, we only guarantee leading '+' 82 dnl the next version of POSIX. For now, we only guarantee leading '+'
82 dnl behavior with getopt-gnu. 83 dnl behavior with getopt-gnu.
83 if test -z "$gl_replace_getopt"; then 84 if test -z "$gl_replace_getopt"; then
@@ -87,8 +88,8 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
87 dnl Merging these three different test programs into a single one 88 dnl Merging these three different test programs into a single one
88 dnl would require a reset mechanism. On BSD systems, it can be done 89 dnl would require a reset mechanism. On BSD systems, it can be done
89 dnl through 'optreset'; on some others (glibc), it can be done by 90 dnl through 'optreset'; on some others (glibc), it can be done by
90 dnl setting 'optind' to 0; on others again (HP-UX, IRIX, OSF/1, 91 dnl setting 'optind' to 0; on others again (HP-UX, Solaris 9,
91 dnl Solaris 9, musl libc), there is no such mechanism. 92 dnl musl libc), there is no such mechanism.
92 if test $cross_compiling = no; then 93 if test $cross_compiling = no; then
93 dnl Sanity check. Succeeds everywhere (except on MSVC, 94 dnl Sanity check. Succeeds everywhere (except on MSVC,
94 dnl which lacks <unistd.h> and getopt() entirely). 95 dnl which lacks <unistd.h> and getopt() entirely).
@@ -237,8 +238,7 @@ dnl is ambiguous with environment values that contain newlines.
237 nocrash_init(); 238 nocrash_init();
238 239
239 /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw, 240 /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw,
240 and fails on Mac OS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5, 241 and fails on Mac OS X 10.5, AIX 5.2, HP-UX 11, Solaris 10. */
241 OSF/1 5.1, Solaris 10. */
242 { 242 {
243 static char conftest[] = "conftest"; 243 static char conftest[] = "conftest";
244 static char plus[] = "-+"; 244 static char plus[] = "-+";
@@ -249,7 +249,7 @@ dnl is ambiguous with environment values that contain newlines.
249 } 249 }
250 /* This code succeeds on glibc 2.8, mingw, 250 /* This code succeeds on glibc 2.8, mingw,
251 and fails on Mac OS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11, 251 and fails on Mac OS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11,
252 IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x. */ 252 Solaris 10, Cygwin 1.5.x. */
253 { 253 {
254 static char program[] = "program"; 254 static char program[] = "program";
255 static char p[] = "-p"; 255 static char p[] = "-p";
@@ -366,14 +366,7 @@ dnl is ambiguous with environment values that contain newlines.
366 366
367AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], 367AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
368[ 368[
369 AC_CHECK_HEADERS_ONCE([sys/cdefs.h]) 369 gl_CHECK_HEADER_SYS_CDEFS_H
370 if test $ac_cv_header_sys_cdefs_h = yes; then
371 HAVE_SYS_CDEFS_H=1
372 else
373 HAVE_SYS_CDEFS_H=0
374 fi
375 AC_SUBST([HAVE_SYS_CDEFS_H])
376
377 AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], 370 AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
378 [Define to rpl_ if the getopt replacement functions and variables 371 [Define to rpl_ if the getopt replacement functions and variables
379 should be used.]) 372 should be used.])
diff --git a/gl/m4/getprogname.m4 b/gl/m4/getprogname.m4
index b24f4480..d60f3efb 100644
--- a/gl/m4/getprogname.m4
+++ b/gl/m4/getprogname.m4
@@ -1,9 +1,10 @@
1# getprogname.m4 1# getprogname.m4
2# serial 8 2# serial 9
3dnl Copyright (C) 2016-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2016-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Check for getprogname or replacements for it 9# Check for getprogname or replacements for it
9 10
@@ -11,6 +12,12 @@ AC_DEFUN([gl_FUNC_GETPROGNAME],
11[ 12[
12 AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) 13 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
13 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 14 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
15 AC_CHECK_HEADERS_ONCE([sys/process.h])
16 if test $ac_cv_header_sys_process_h = yes; then
17 HAVE_SYS_PROCESS_H=1
18 else
19 HAVE_SYS_PROCESS_H=0
20 fi
14 gl_CHECK_FUNCS_ANDROID([getprogname], [[#include <stdlib.h>]]) 21 gl_CHECK_FUNCS_ANDROID([getprogname], [[#include <stdlib.h>]])
15 if test $ac_cv_func_getprogname = no; then 22 if test $ac_cv_func_getprogname = no; then
16 HAVE_GETPROGNAME=0 23 HAVE_GETPROGNAME=0
diff --git a/gl/m4/gettext_h.m4 b/gl/m4/gettext_h.m4
new file mode 100644
index 00000000..7ef89541
--- /dev/null
+++ b/gl/m4/gettext_h.m4
@@ -0,0 +1,21 @@
1# gettext_h.m4
2# serial 1
3dnl Copyright (C) 2025-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN_ONCE([gl_GETTEXT_H],
10[
11 AC_SUBST([LIBINTL])
12 AC_SUBST([LTLIBINTL])
13 AH_BOTTOM([
14/* The text domainname for Gnulib messages. Ordinarily this is "gnulib",
15 but packages that do their own translations of Gnulib can use something
16 different by defining GNULIB_TEXT_DOMAIN in their config.h file. */
17#ifndef GNULIB_TEXT_DOMAIN
18# define GNULIB_TEXT_DOMAIN/**/"gnulib"
19#endif
20])
21])
diff --git a/gl/m4/gl-openssl.m4 b/gl/m4/gl-openssl.m4
index c5e1f7ba..70f43a55 100644
--- a/gl/m4/gl-openssl.m4
+++ b/gl/m4/gl-openssl.m4
@@ -1,9 +1,10 @@
1# gl-openssl.m4 1# gl-openssl.m4
2# serial 7 2# serial 8
3dnl Copyright (C) 2013-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2013-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_SET_CRYPTO_CHECK_DEFAULT], 9AC_DEFUN([gl_SET_CRYPTO_CHECK_DEFAULT],
9[ 10[
@@ -57,12 +58,17 @@ AC_DEFUN([gl_CRYPTO_CHECK],
57 fi 58 fi
58 if test "x$with_openssl" != xauto-gpl-compat || 59 if test "x$with_openssl" != xauto-gpl-compat ||
59 test "x$gl_cv_openssl_gpl_compat" = xyes; then 60 test "x$gl_cv_openssl_gpl_compat" = xyes; then
60 AC_CHECK_LIB([crypto], [$1], 61 m4_if([$1], [SHA3],
61 [AC_CHECK_HEADERS( 62 [AC_CHECK_LIB([crypto], [EVP_sha3_224],
62 m4_if([$1], [MD5], [openssl/md5.h], [openssl/sha.h]),
63 [LIB_CRYPTO=-lcrypto 63 [LIB_CRYPTO=-lcrypto
64 AC_DEFINE([HAVE_OPENSSL_$1], [1], 64 AC_DEFINE([HAVE_OPENSSL_$1], [1],
65 [Define to 1 if libcrypto is used for $1.])])]) 65 [Define to 1 if libcrypto is used for $1.])])],
66 [AC_CHECK_LIB([crypto], [$1],
67 [AC_CHECK_HEADERS(
68 m4_if([$1], [MD5], [openssl/md5.h], [openssl/sha.h]),
69 [LIB_CRYPTO=-lcrypto
70 AC_DEFINE([HAVE_OPENSSL_$1], [1],
71 [Define to 1 if libcrypto is used for $1.])])])])
66 fi 72 fi
67 if test "x$LIB_CRYPTO" = x; then 73 if test "x$LIB_CRYPTO" = x; then
68 message='openssl development library not found for $1. 74 message='openssl development library not found for $1.
diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4
index fcf84226..1b964b34 100644
--- a/gl/m4/gnulib-cache.m4
+++ b/gl/m4/gnulib-cache.m4
@@ -1,4 +1,4 @@
1# Copyright (C) 2002-2024 Free Software Foundation, Inc. 1# Copyright (C) 2002-2026 Free Software Foundation, Inc.
2# 2#
3# This file is free software; you can redistribute it and/or modify 3# This file is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by 4# it under the terms of the GNU General Public License as published by
diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4
index cb730449..26eef771 100644
--- a/gl/m4/gnulib-common.m4
+++ b/gl/m4/gnulib-common.m4
@@ -1,9 +1,10 @@
1# gnulib-common.m4 1# gnulib-common.m4
2# serial 93 2# serial 115
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_PREREQ([2.62]) 9AC_PREREQ([2.62])
9 10
@@ -20,43 +21,61 @@ AC_DEFUN([gl_COMMON_BODY], [
20[/* Witness that <config.h> has been included. */ 21[/* Witness that <config.h> has been included. */
21#define _GL_CONFIG_H_INCLUDED 1 22#define _GL_CONFIG_H_INCLUDED 1
22]) 23])
24 dnl Avoid warnings from gcc -Wtrailing-whitespace.
25 dnl This is a temporary workaround until Autoconf fixes it.
26 dnl Test case:
27 dnl empty1=; empty2=; AC_DEFINE_UNQUOTED([FOO], [$empty1$empty2], [...])
28 dnl should produce "#define FOO /**/", not "#define FOO ".
29 AH_TOP([#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
30# pragma GCC diagnostic push
31# pragma GCC diagnostic ignored "-Wtrailing-whitespace"
32#endif
33])
34 AH_BOTTOM([#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
35# pragma GCC diagnostic pop
36#endif
37])
23 AH_VERBATIM([_GL_GNUC_PREREQ], 38 AH_VERBATIM([_GL_GNUC_PREREQ],
24[/* True if the compiler says it groks GNU C version MAJOR.MINOR. */ 39[/* True if the compiler says it groks GNU C version MAJOR.MINOR.
25#if defined __GNUC__ && defined __GNUC_MINOR__ 40 Except that
41 - clang groks GNU C 4.2, even on Windows, where it does not define
42 __GNUC__.
43 - The OpenMandriva-modified clang compiler pretends that it groks
44 GNU C version 13.1, but it doesn't: It does not support
45 __attribute__ ((__malloc__ (f, i))), nor does it support
46 __attribute__ ((__warning__ (message))) on a function redeclaration.
47 - Users can make clang lie as well, through the -fgnuc-version option. */
48#if defined __GNUC__ && defined __GNUC_MINOR__ && !defined __clang__
26# define _GL_GNUC_PREREQ(major, minor) \ 49# define _GL_GNUC_PREREQ(major, minor) \
27 ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__)) 50 ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__))
51#elif defined __clang__
52 /* clang really only groks GNU C 4.2. */
53# define _GL_GNUC_PREREQ(major, minor) \
54 ((major) < 4 + ((minor) <= 2))
28#else 55#else
29# define _GL_GNUC_PREREQ(major, minor) 0 56# define _GL_GNUC_PREREQ(major, minor) 0
30#endif 57#endif
31]) 58])
32 AH_VERBATIM([_Noreturn], 59 AH_VERBATIM([_Noreturn],
33[/* The _Noreturn keyword of C11. */ 60[/* The _Noreturn keyword of C11.
61 Do not use [[noreturn]], because with it the syntax
62 extern _Noreturn void func (...);
63 would not be valid; such a declaration would be valid only with 'extern'
64 and '_Noreturn' swapped, or without the 'extern' keyword. However, some
65 AIX system header files and several gnulib header files use precisely
66 this syntax with 'extern'. So even though C23 deprecates _Noreturn,
67 it is currently more portable to prefer it to [[noreturn]].
68
69 Also, do not try to work around LLVM bug 59792 (clang 15 or earlier).
70 This rare bug can be worked around by compiling with 'clang -D_Noreturn=',
71 though the workaround may generate many false-alarm warnings. */
34#ifndef _Noreturn 72#ifndef _Noreturn
35# if (defined __cplusplus \ 73# if ((!defined __cplusplus || defined __clang__) \
36 && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ 74 && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0)))
37 || (defined _MSC_VER && 1900 <= _MSC_VER)) \
38 && 0)
39 /* [[noreturn]] is not practically usable, because with it the syntax
40 extern _Noreturn void func (...);
41 would not be valid; such a declaration would only be valid with 'extern'
42 and '_Noreturn' swapped, or without the 'extern' keyword. However, some
43 AIX system header files and several gnulib header files use precisely
44 this syntax with 'extern'. */
45# define _Noreturn [[noreturn]]
46# elif (defined __clang__ && __clang_major__ < 16 \
47 && defined _GL_WORK_AROUND_LLVM_BUG_59792)
48 /* Compile with -D_GL_WORK_AROUND_LLVM_BUG_59792 to work around
49 that rare LLVM bug, though you may get many false-alarm warnings. */
50# define _Noreturn
51# elif ((!defined __cplusplus || defined __clang__) \
52 && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
53 || (!defined __STRICT_ANSI__ \
54 && (_GL_GNUC_PREREQ (4, 7) \
55 || (defined __apple_build_version__ \
56 ? 6000000 <= __apple_build_version__ \
57 : 3 < __clang_major__ + (5 <= __clang_minor__))))))
58 /* _Noreturn works as-is. */ 75 /* _Noreturn works as-is. */
59# elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C 76# elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C
77 /* Prefer __attribute__ ((__noreturn__)) to plain _Noreturn even if the
78 latter works, as 'gcc -std=gnu99 -Wpedantic' warns about _Noreturn. */
60# define _Noreturn __attribute__ ((__noreturn__)) 79# define _Noreturn __attribute__ ((__noreturn__))
61# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) 80# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
62# define _Noreturn __declspec (noreturn) 81# define _Noreturn __declspec (noreturn)
@@ -90,6 +109,9 @@ AC_DEFUN([gl_COMMON_BODY], [
90# define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) 109# define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__)
91# else 110# else
92# define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr 111# define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr
112/* The following lines list the first GCC version that supports the attribute.
113 Although the lines are not used in GCC 5 and later (as GCC 5 introduced
114 __has_attribute support), list GCC versions 5+ anyway for completeness. */
93# define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3) 115# define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3)
94# define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2) 116# define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2)
95# define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3) 117# define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3)
@@ -110,12 +132,15 @@ AC_DEFUN([gl_COMMON_BODY], [
110# endif 132# endif
111# define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1) 133# define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1)
112# define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3) 134# define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3)
135# define _GL_ATTR_nonnull_if_nonzero _GL_GNUC_PREREQ (15, 1)
113# define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0) 136# define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0)
114# define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3) 137# define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3)
115# define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7) 138# define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7)
116# define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96) 139# define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96)
140# define _GL_ATTR_reproducible _GL_GNUC_PREREQ (15, 1)
117# define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9) 141# define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9)
118# define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0) 142# define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0)
143# define _GL_ATTR_unsequenced _GL_GNUC_PREREQ (15, 1)
119# define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7) 144# define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7)
120# define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4) 145# define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4)
121# endif 146# endif
@@ -131,6 +156,23 @@ AC_DEFUN([gl_COMMON_BODY], [
131# define _GL_HAVE___HAS_C_ATTRIBUTE 0 156# define _GL_HAVE___HAS_C_ATTRIBUTE 0
132#endif 157#endif
133 158
159/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...))
160 syntax, in function declarations. There are two problems here.
161 (Last tested with gcc/g++ 14 and clang/clang++ 18.)
162
163 1) We want that the _GL_ATTRIBUTE_* can be cumulated on the same declaration
164 in any order.
165 =========================== foo.c = foo.cc ===========================
166 __attribute__ ((__deprecated__)) [[__nodiscard__]] int bar1 (int);
167 [[__nodiscard__]] __attribute__ ((__deprecated__)) int bar2 (int);
168 ======================================================================
169 This gives a syntax error
170 - in C mode with gcc
171 <https://gcc.gnu.org/PR108796>, and
172 - in C++ mode with clang++ version < 16, and
173 - in C++ mode, inside extern "C" {}, still in newer clang++ versions
174 <https://github.com/llvm/llvm-project/issues/101990>.
175 */
134/* Define if, in a function declaration, the attributes in bracket syntax 176/* Define if, in a function declaration, the attributes in bracket syntax
135 [[...]] must come before the attributes in __attribute__((...)) syntax. 177 [[...]] must come before the attributes in __attribute__((...)) syntax.
136 If this is defined, it is best to avoid the bracket syntax, so that the 178 If this is defined, it is best to avoid the bracket syntax, so that the
@@ -145,6 +187,176 @@ AC_DEFUN([gl_COMMON_BODY], [
145# define _GL_BRACKET_BEFORE_ATTRIBUTE 1 187# define _GL_BRACKET_BEFORE_ATTRIBUTE 1
146# endif 188# endif
147#endif 189#endif
190/*
191 2) We want that the _GL_ATTRIBUTE_* can be placed in a declaration
192 - without 'extern', in C as well as in C++,
193 - with 'extern', in C,
194 - with 'extern "C"', in C++
195 in the same position. That is, we don't want to be forced to use a
196 macro which arranges for the attribute to come before 'extern' in
197 one case and after 'extern' in the other case, because such a macro
198 would make the source code of .h files pretty ugly.
199 =========================== foo.c = foo.cc ===========================
200 #ifdef __cplusplus
201 # define CC "C"
202 #else
203 # define CC
204 #endif
205
206 #define ND [[__nodiscard__]]
207 #define WUR __attribute__((__warn_unused_result__))
208
209 #ifdef __cplusplus
210 extern "C" {
211 #endif
212 // gcc clang g++ clang++
213
214 ND int foo (int);
215 int ND foo (int); // warn error warn error
216 int foo ND (int);
217 int foo (int) ND; // warn error warn error
218
219 WUR int foo (int);
220 int WUR foo (int);
221 int fo1 WUR (int); // error error error error
222 int foo (int) WUR;
223
224 #ifdef __cplusplus
225 }
226 #endif
227
228 // gcc clang g++ clang++
229
230 ND extern CC int foo (int); // error error
231 extern CC ND int foo (int); // error error
232 extern CC int ND foo (int); // warn error warn error
233 extern CC int foo ND (int);
234 extern CC int foo (int) ND; // warn error warn error
235
236 WUR extern CC int foo (int); // warn
237 extern CC WUR int foo (int);
238 extern CC int WUR foo (int);
239 extern CC int foo WUR (int); // error error error error
240 extern CC int foo (int) WUR;
241
242 ND EXTERN_C_FUNC int foo (int); // error error
243 EXTERN_C_FUNC ND int foo (int);
244 EXTERN_C_FUNC int ND foo (int); // warn error warn error
245 EXTERN_C_FUNC int foo ND (int);
246 EXTERN_C_FUNC int foo (int) ND; // warn error warn error
247
248 WUR EXTERN_C_FUNC int foo (int); // warn
249 EXTERN_C_FUNC WUR int foo (int);
250 EXTERN_C_FUNC int WUR foo (int);
251 EXTERN_C_FUNC int fo2 WUR (int); // error error error error
252 EXTERN_C_FUNC int foo (int) WUR;
253 ======================================================================
254 So, if we insist on using the 'extern' keyword ('extern CC' idiom):
255 * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]]
256 in both C and C++, there is one available position:
257 - between the function name and the parameter list.
258 * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax
259 in both C and C++, there are several available positions:
260 - before the return type,
261 - between return type and function name,
262 - at the end of the declaration.
263 * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] in C and to
264 __attribute__((...)) syntax in C++, there is no available position:
265 it would need to come before 'extern' in C but after 'extern "C"'
266 in C++.
267 * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax in C and
268 to bracket syntax [[...]] in C++, there is one available position:
269 - before the return type.
270 Whereas, if we use the 'EXTERN_C_FUNC' idiom, which conditionally
271 omits the 'extern' keyword:
272 * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]]
273 in both C and C++, there are two available positions:
274 - before the return type,
275 - between the function name and the parameter list.
276 * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax
277 in both C and C++, there are several available positions:
278 - before the return type,
279 - between return type and function name,
280 - at the end of the declaration.
281 * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] in C and to
282 __attribute__((...)) syntax in C++, there is one available position:
283 - before the return type.
284 * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax in C and
285 to bracket syntax [[...]] in C++, there is one available position:
286 - before the return type.
287 The best choice is therefore to use the 'EXTERN_C_FUNC' idiom and
288 put the attributes before the return type. This works regardless
289 to what the _GL_ATTRIBUTE_* macros expand.
290 */
291
292/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...))
293 syntax, in static/inline function definitions.
294
295 There are similar constraints as for function declarations. However, here,
296 we cannot omit the storage-class specifier. Therefore, the following rule
297 applies:
298 * The macros
299 _GL_ATTRIBUTE_CONST
300 _GL_ATTRIBUTE_DEPRECATED
301 _GL_ATTRIBUTE_MAYBE_UNUSED
302 _GL_ATTRIBUTE_NODISCARD
303 _GL_ATTRIBUTE_PURE
304 _GL_ATTRIBUTE_REPRODUCIBLE
305 _GL_ATTRIBUTE_UNSEQUENCED
306 which may expand to bracket syntax [[...]], must come first, before the
307 storage-class specifier.
308 * Other _GL_ATTRIBUTE_* macros, that expand to __attribute__((...)) syntax,
309 are better placed between the storage-class specifier and the return
310 type.
311 */
312
313/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...))
314 syntax, in variable declarations.
315
316 At which position can they be placed?
317 (Last tested with gcc/g++ 14 and clang/clang++ 18.)
318
319 =========================== foo.c = foo.cc ===========================
320 #ifdef __cplusplus
321 # define CC "C"
322 #else
323 # define CC
324 #endif
325
326 #define BD [[__deprecated__]]
327 #define AD __attribute__ ((__deprecated__))
328
329 // gcc clang g++ clang++
330
331 BD extern CC int var; // error error
332 extern CC BD int var; // error error
333 extern CC int BD var; // warn error warn error
334 extern CC int var BD;
335
336 AD extern CC int var; // warn
337 extern CC AD int var;
338 extern CC int AD var;
339 extern CC int var AD;
340
341 BD extern CC int z[]; // error error
342 extern CC BD int z[]; // error error
343 extern CC int BD z[]; // warn error warn error
344 extern CC int z1 BD [];
345 extern CC int z[] BD; // warn error error
346
347 AD extern CC int z[]; // warn
348 extern CC AD int z[];
349 extern CC int AD z[];
350 extern CC int z2 AD []; // error error error error
351 extern CC int z[] AD;
352 ======================================================================
353
354 * For non-array variables, the only good position is after the variable name,
355 that is, at the end of the declaration.
356 * For array variables, you will need to distinguish C and C++:
357 - In C, before the 'extern' keyword.
358 - In C++, between the 'extern "C"' and the variable's type.
359 */
148]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's alignas instead. 360]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's alignas instead.
149[ 361[
150/* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function 362/* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function
@@ -152,7 +364,7 @@ AC_DEFUN([gl_COMMON_BODY], [
152 _GL_ATTRIBUTE_ALLOC_SIZE ((M, N)) declares that the Mth argument multiplied 364 _GL_ATTRIBUTE_ALLOC_SIZE ((M, N)) declares that the Mth argument multiplied
153 by the Nth argument of the function is the size of the returned memory block. 365 by the Nth argument of the function is the size of the returned memory block.
154 */ 366 */
155/* Applies to: function, pointer to function, function types. */ 367/* Applies to: functions, pointer to functions, function types. */
156#ifndef _GL_ATTRIBUTE_ALLOC_SIZE 368#ifndef _GL_ATTRIBUTE_ALLOC_SIZE
157# if _GL_HAS_ATTRIBUTE (alloc_size) 369# if _GL_HAS_ATTRIBUTE (alloc_size)
158# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) 370# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args))
@@ -163,7 +375,7 @@ AC_DEFUN([gl_COMMON_BODY], [
163 375
164/* _GL_ATTRIBUTE_ALWAYS_INLINE tells that the compiler should always inline the 376/* _GL_ATTRIBUTE_ALWAYS_INLINE tells that the compiler should always inline the
165 function and report an error if it cannot do so. */ 377 function and report an error if it cannot do so. */
166/* Applies to: function. */ 378/* Applies to: functions. */
167#ifndef _GL_ATTRIBUTE_ALWAYS_INLINE 379#ifndef _GL_ATTRIBUTE_ALWAYS_INLINE
168# if _GL_HAS_ATTRIBUTE (always_inline) 380# if _GL_HAS_ATTRIBUTE (always_inline)
169# define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__)) 381# define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__))
@@ -175,7 +387,7 @@ AC_DEFUN([gl_COMMON_BODY], [
175/* _GL_ATTRIBUTE_ARTIFICIAL declares that the function is not important to show 387/* _GL_ATTRIBUTE_ARTIFICIAL declares that the function is not important to show
176 in stack traces when debugging. The compiler should omit the function from 388 in stack traces when debugging. The compiler should omit the function from
177 stack traces. */ 389 stack traces. */
178/* Applies to: function. */ 390/* Applies to: functions. */
179#ifndef _GL_ATTRIBUTE_ARTIFICIAL 391#ifndef _GL_ATTRIBUTE_ARTIFICIAL
180# if _GL_HAS_ATTRIBUTE (artificial) 392# if _GL_HAS_ATTRIBUTE (artificial)
181# define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__)) 393# define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__))
@@ -201,12 +413,20 @@ AC_DEFUN([gl_COMMON_BODY], [
201# endif 413# endif
202#endif 414#endif
203 415
204/* _GL_ATTRIBUTE_CONST declares that it is OK for a compiler to omit duplicate 416/* _GL_ATTRIBUTE_CONST declares:
205 calls to the function with the same arguments. 417 It is OK for a compiler to move a call, or omit a duplicate call
206 This attribute is safe for a function that neither depends on nor affects 418 and reuse a cached return value, even if the state changes between calls.
207 observable state, and always returns exactly once - e.g., does not loop 419 It is also OK to omit a call if the result is not used.
208 forever, and does not call longjmp. 420 This attribute is safe if the function does not change observable state,
209 (This attribute is stricter than _GL_ATTRIBUTE_PURE.) */ 421 returns a value determined solely by its arguments' values
422 without examining state, and always returns exactly once -
423 e.g., does not raise an exception, call longjmp, or loop forever.
424 (This attribute is stricter than _GL_ATTRIBUTE_PURE because the
425 function cannot observe state. Unlike _GL_ATTRIBUTE_UNSEQUENCED
426 the function must return exactly once and cannot access state
427 addressed by its pointer arguments or that happens to have the same
428 value for all calls to the function, but the function is allowed to
429 return a pointer to storage that can be modified later. */
210/* Applies to: functions. */ 430/* Applies to: functions. */
211#ifndef _GL_ATTRIBUTE_CONST 431#ifndef _GL_ATTRIBUTE_CONST
212# if _GL_HAS_ATTRIBUTE (const) 432# if _GL_HAS_ATTRIBUTE (const)
@@ -234,7 +454,7 @@ AC_DEFUN([gl_COMMON_BODY], [
234 yet. */ 454 yet. */
235#ifndef _GL_ATTRIBUTE_DEALLOC_FREE 455#ifndef _GL_ATTRIBUTE_DEALLOC_FREE
236# if defined __cplusplus && defined __GNUC__ && !defined __clang__ 456# if defined __cplusplus && defined __GNUC__ && !defined __clang__
237/* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231> */ 457/* Work around GCC bug <https://gcc.gnu.org/PR108231> */
238# define _GL_ATTRIBUTE_DEALLOC_FREE \ 458# define _GL_ATTRIBUTE_DEALLOC_FREE \
239 _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1) 459 _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1)
240# else 460# else
@@ -373,7 +593,9 @@ AC_DEFUN([gl_COMMON_BODY], [
373 593
374/* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if 594/* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if
375 the entity is not used. The compiler should not warn if the entity is not 595 the entity is not used. The compiler should not warn if the entity is not
376 used. */ 596 used. However, 'int _GL_UNNAMED (i)' is preferable to
597 '_GL_ATTRIBUTE_MAYBE_UNUSED int i' when parameter I is unused
598 regardless of preprocessor macro settings. */
377/* Applies to: 599/* Applies to:
378 - function, variable, 600 - function, variable,
379 - struct, union, struct/union member, 601 - struct, union, struct/union member,
@@ -460,6 +682,17 @@ AC_DEFUN([gl_COMMON_BODY], [
460# endif 682# endif
461#endif 683#endif
462 684
685/* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP
686 (a pointer) must not be NULL if the argument NI (an integer) is != 0. */
687/* Applies to: functions. */
688#ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO
689# if _GL_HAS_ATTRIBUTE (nonnull_if_nonzero)
690# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) __attribute__ ((__nonnull_if_nonzero__ (np, ni)))
691# else
692# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni)
693# endif
694#endif
695
463/* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is 696/* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is
464 not meant to be NUL-terminated. */ 697 not meant to be NUL-terminated. */
465/* Applies to: struct/union members and variables that are arrays of element 698/* Applies to: struct/union members and variables that are arrays of element
@@ -481,7 +714,7 @@ AC_DEFUN([gl_COMMON_BODY], [
481 other attributes. */ 714 other attributes. */
482#ifndef _GL_ATTRIBUTE_NOTHROW 715#ifndef _GL_ATTRIBUTE_NOTHROW
483# if defined __cplusplus 716# if defined __cplusplus
484# if _GL_GNUC_PREREQ (2, 8) || __clang_major >= 4 717# if _GL_GNUC_PREREQ (2, 8) || __clang_major__ >= 4
485# if __cplusplus >= 201103L 718# if __cplusplus >= 201103L
486# define _GL_ATTRIBUTE_NOTHROW noexcept (true) 719# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
487# else 720# else
@@ -505,9 +738,9 @@ AC_DEFUN([gl_COMMON_BODY], [
505 minimizing the memory required. */ 738 minimizing the memory required. */
506/* Applies to: struct members, struct, union, 739/* Applies to: struct members, struct, union,
507 in C++ also: class. */ 740 in C++ also: class. */
741#ifndef _GL_ATTRIBUTE_PACKED
508/* Oracle Studio 12.6 miscompiles code with __attribute__ ((__packed__)) despite 742/* Oracle Studio 12.6 miscompiles code with __attribute__ ((__packed__)) despite
509 __has_attribute OK. */ 743 __has_attribute OK. */
510#ifndef _GL_ATTRIBUTE_PACKED
511# if _GL_HAS_ATTRIBUTE (packed) && !defined __SUNPRO_C 744# if _GL_HAS_ATTRIBUTE (packed) && !defined __SUNPRO_C
512# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) 745# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__))
513# else 746# else
@@ -515,12 +748,18 @@ AC_DEFUN([gl_COMMON_BODY], [
515# endif 748# endif
516#endif 749#endif
517 750
518/* _GL_ATTRIBUTE_PURE declares that It is OK for a compiler to omit duplicate 751/* _GL_ATTRIBUTE_PURE declares:
519 calls to the function with the same arguments if observable state is not 752 It is OK for a compiler to move a call, or omit a duplicate call
520 changed between calls. 753 and reuse a cached return value, if observable state is the same.
521 This attribute is safe for a function that does not affect 754 It is also OK to omit a call if the return value is not used.
522 observable state, and always returns exactly once. 755 This attribute is safe if the function does not change observable state,
523 (This attribute is looser than _GL_ATTRIBUTE_CONST.) */ 756 returns a value determined solely by its arguments's values
757 together with observable state, and always returns exactly once.
758 (This attribute is looser than _GL_ATTRIBUTE_CONST because the function
759 can depend on observable state.
760 Unlike _GL_ATTRIBUTE_REPRODUCIBLE the function must return exactly
761 once and cannot change state addressed by its arguments, but the
762 function can return a pointer to storage whose contents change later.) */
524/* Applies to: functions. */ 763/* Applies to: functions. */
525#ifndef _GL_ATTRIBUTE_PURE 764#ifndef _GL_ATTRIBUTE_PURE
526# if _GL_HAS_ATTRIBUTE (pure) 765# if _GL_HAS_ATTRIBUTE (pure)
@@ -530,6 +769,34 @@ AC_DEFUN([gl_COMMON_BODY], [
530# endif 769# endif
531#endif 770#endif
532 771
772/* _GL_ATTRIBUTE_REPRODUCIBLE declares:
773 It is OK for a compiler to move a call, or omit a duplicate call
774 and reuse a cached value returned either directly or indirectly via
775 a pointer, if other observable state is the same;
776 however, pointer arguments cannot alias.
777 This attribute is safe for a function that is effectless and idempotent;
778 see ISO C 23 § 6.7.13.8 for a definition of these terms.
779 (This attribute is looser than _GL_ATTRIBUTE_UNSEQUENCED because
780 the function need not be stateless or independent.
781 Unlike _GL_ATTRIBUTE_PURE the function need not return exactly once
782 and can change state addressed by its pointer arguments, but the
783 function cannot return a pointer to storage whose contents change later.)
784 See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
785 <https://stackoverflow.com/questions/76847905/>. */
786/* Applies to: functions, pointer to functions, function types. */
787#ifndef _GL_ATTRIBUTE_REPRODUCIBLE
788/* This may be revisited when gcc and clang support [[reproducible]] or possibly
789 __attribute__ ((__reproducible__)). */
790# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
791# if _GL_HAS_ATTRIBUTE (reproducible)
792# define _GL_ATTRIBUTE_REPRODUCIBLE [[reproducible]]
793# endif
794# endif
795# ifndef _GL_ATTRIBUTE_REPRODUCIBLE
796# define _GL_ATTRIBUTE_REPRODUCIBLE
797# endif
798#endif
799
533/* _GL_ATTRIBUTE_RETURNS_NONNULL declares that the function's return value is 800/* _GL_ATTRIBUTE_RETURNS_NONNULL declares that the function's return value is
534 a non-NULL pointer. */ 801 a non-NULL pointer. */
535/* Applies to: functions. */ 802/* Applies to: functions. */
@@ -554,6 +821,37 @@ AC_DEFUN([gl_COMMON_BODY], [
554# endif 821# endif
555#endif 822#endif
556 823
824/* _GL_ATTRIBUTE_UNSEQUENCED declares:
825 It is OK for a compiler to move a call, or omit a duplicate call
826 and reuse a cached value returned either directly or indirectly via
827 a pointer, if the state addressed by its pointer arguments is the same;
828 however, pointer arguments cannot alias.
829 This attribute is safe for a function that is effectless, idempotent,
830 stateless, and independent; see ISO C 23 § 6.7.13.8 for a definition of
831 these terms.
832 (This attribute is stricter than _GL_ATTRIBUTE_REPRODUCIBLE because
833 the function must be stateless and independent. Unlike
834 _GL_ATTRIBUTE_CONST the function need not return exactly once, and
835 can depend on state accessed via its pointer arguments or that
836 happens to have the same value for all calls to the function, but
837 the function cannot return a pointer to storage whose contents
838 change later.)
839 See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
840 <https://stackoverflow.com/questions/76847905/>. */
841/* Applies to: functions, pointer to functions, function types. */
842#ifndef _GL_ATTRIBUTE_UNSEQUENCED
843/* This may be revisited when gcc and clang support [[unsequenced]] or possibly
844 __attribute__ ((__unsequenced__)). */
845# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
846# if _GL_HAS_ATTRIBUTE (unsequenced)
847# define _GL_ATTRIBUTE_UNSEQUENCED [[unsequenced]]
848# endif
849# endif
850# ifndef _GL_ATTRIBUTE_UNSEQUENCED
851# define _GL_ATTRIBUTE_UNSEQUENCED
852# endif
853#endif
854
557/* A helper macro. Don't use it directly. */ 855/* A helper macro. Don't use it directly. */
558#ifndef _GL_ATTRIBUTE_UNUSED 856#ifndef _GL_ATTRIBUTE_UNUSED
559# if _GL_HAS_ATTRIBUTE (unused) 857# if _GL_HAS_ATTRIBUTE (unused)
@@ -578,6 +876,50 @@ AC_DEFUN([gl_COMMON_BODY], [
578# define _GL_UNUSED_LABEL 876# define _GL_UNUSED_LABEL
579# endif 877# endif
580#endif 878#endif
879
880/* _GL_UNNAMED (ID) is the "name" of an unnamed function parameter.
881 Each of the function's unnamed parameters should have a unique "name".
882 The "name" cannot be used. This ports both to C17 and earlier, which
883 lack unnamed parameters, and to C++ and later C, which have them. */
884/* Applies to:
885 - function parameters. */
886#ifndef _GL_UNNAMED
887# if ((defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 202311 \
888 && !defined __cplusplus)
889# define _GL_UNNAMED(id) unnamed_##id _GL_ATTRIBUTE_UNUSED
890# else
891# define _GL_UNNAMED(id)
892# endif
893#endif
894
895/* The following attributes enable detection of multithread-safety problems
896 and resource leaks at compile-time, by clang ≥ 15, when the warning option
897 -Wthread-safety is enabled. For usage, see
898 <https://clang.llvm.org/docs/ThreadSafetyAnalysis.html>. */
899#ifndef _GL_ATTRIBUTE_CAPABILITY_TYPE
900# if __clang_major__ >= 15
901# define _GL_ATTRIBUTE_CAPABILITY_TYPE(concept) \
902 __attribute__ ((__capability__ (concept)))
903# else
904# define _GL_ATTRIBUTE_CAPABILITY_TYPE(concept)
905# endif
906#endif
907#ifndef _GL_ATTRIBUTE_ACQUIRE_CAPABILITY
908# if __clang_major__ >= 15
909# define _GL_ATTRIBUTE_ACQUIRE_CAPABILITY(resource) \
910 __attribute__ ((__acquire_capability__ (resource)))
911# else
912# define _GL_ATTRIBUTE_ACQUIRE_CAPABILITY(resource)
913# endif
914#endif
915#ifndef _GL_ATTRIBUTE_RELEASE_CAPABILITY
916# if __clang_major__ >= 15
917# define _GL_ATTRIBUTE_RELEASE_CAPABILITY(resource) \
918 __attribute__ ((__release_capability__ (resource)))
919# else
920# define _GL_ATTRIBUTE_RELEASE_CAPABILITY(resource)
921# endif
922#endif
581]) 923])
582 AH_VERBATIM([c_linkage], 924 AH_VERBATIM([c_linkage],
583[/* In C++, there is the concept of "language linkage", that encompasses 925[/* In C++, there is the concept of "language linkage", that encompasses
@@ -628,8 +970,8 @@ AC_DEFUN([gl_COMMON_BODY], [
628 -1 if n1 < n2 970 -1 if n1 < n2
629 The naïve code (n1 > n2 ? 1 : n1 < n2 ? -1 : 0) produces a conditional 971 The naïve code (n1 > n2 ? 1 : n1 < n2 ? -1 : 0) produces a conditional
630 jump with nearly all GCC versions up to GCC 10. 972 jump with nearly all GCC versions up to GCC 10.
631 This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional with many 973 This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional jump with
632 GCC versions up to GCC 9. 974 many GCC versions up to GCC 9.
633 The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9 975 The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9
634 avoids conditional jumps in all GCC versions >= 3.4. */ 976 avoids conditional jumps in all GCC versions >= 3.4. */
635#define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2))) 977#define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2)))
@@ -1006,7 +1348,7 @@ AC_DEFUN([gl_CC_ALLOW_WARNINGS],
1006 AC_REQUIRE([AC_PROG_CC]) 1348 AC_REQUIRE([AC_PROG_CC])
1007 AC_CACHE_CHECK([for C compiler option to allow warnings], 1349 AC_CACHE_CHECK([for C compiler option to allow warnings],
1008 [gl_cv_cc_wallow], 1350 [gl_cv_cc_wallow],
1009 [rm -f conftest* 1351 [rm -fr conftest*
1010 echo 'int dummy;' > conftest.c 1352 echo 'int dummy;' > conftest.c
1011 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null 1353 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null
1012 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Wno-error -c conftest.c 2>conftest2.err]) >/dev/null 1354 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Wno-error -c conftest.c 2>conftest2.err]) >/dev/null
@@ -1019,7 +1361,7 @@ AC_DEFUN([gl_CC_ALLOW_WARNINGS],
1019 else 1361 else
1020 gl_cv_cc_wallow=none 1362 gl_cv_cc_wallow=none
1021 fi 1363 fi
1022 rm -f conftest* 1364 rm -fr conftest*
1023 ]) 1365 ])
1024 case "$gl_cv_cc_wallow" in 1366 case "$gl_cv_cc_wallow" in
1025 none) GL_CFLAG_ALLOW_WARNINGS='' ;; 1367 none) GL_CFLAG_ALLOW_WARNINGS='' ;;
@@ -1037,7 +1379,7 @@ AC_DEFUN([gl_CXX_ALLOW_WARNINGS],
1037 if test -n "$CXX" && test "$CXX" != no; then 1379 if test -n "$CXX" && test "$CXX" != no; then
1038 AC_CACHE_CHECK([for C++ compiler option to allow warnings], 1380 AC_CACHE_CHECK([for C++ compiler option to allow warnings],
1039 [gl_cv_cxx_wallow], 1381 [gl_cv_cxx_wallow],
1040 [rm -f conftest* 1382 [rm -fr conftest*
1041 echo 'int dummy;' > conftest.cc 1383 echo 'int dummy;' > conftest.cc
1042 AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null 1384 AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null
1043 AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -Wno-error -c conftest.cc 2>conftest2.err]) >/dev/null 1385 AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -Wno-error -c conftest.cc 2>conftest2.err]) >/dev/null
@@ -1050,7 +1392,7 @@ AC_DEFUN([gl_CXX_ALLOW_WARNINGS],
1050 else 1392 else
1051 gl_cv_cxx_wallow=none 1393 gl_cv_cxx_wallow=none
1052 fi 1394 fi
1053 rm -f conftest* 1395 rm -fr conftest*
1054 ]) 1396 ])
1055 case "$gl_cv_cxx_wallow" in 1397 case "$gl_cv_cxx_wallow" in
1056 none) GL_CXXFLAG_ALLOW_WARNINGS='' ;; 1398 none) GL_CXXFLAG_ALLOW_WARNINGS='' ;;
@@ -1087,11 +1429,12 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
1087 dnl -Wno-type-limits >= 4.3 >= 3.9 1429 dnl -Wno-type-limits >= 4.3 >= 3.9
1088 dnl -Wno-undef >= 3 >= 3.9 1430 dnl -Wno-undef >= 3 >= 3.9
1089 dnl -Wno-unsuffixed-float-constants >= 4.5 1431 dnl -Wno-unsuffixed-float-constants >= 4.5
1432 dnl -Wno-unused-const-variable >= 6.1 >= 3.9
1090 dnl -Wno-unused-function >= 3 >= 3.9 1433 dnl -Wno-unused-function >= 3 >= 3.9
1091 dnl -Wno-unused-parameter >= 3 >= 3.9 1434 dnl -Wno-unused-parameter >= 3 >= 3.9
1092 dnl 1435 dnl
1093 cat > conftest.c <<\EOF 1436 cat > conftest.c <<\EOF
1094 #if __GNUC__ >= 3 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1437 #if (__GNUC__ >= 3 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1095 -Wno-cast-qual 1438 -Wno-cast-qual
1096 -Wno-conversion 1439 -Wno-conversion
1097 -Wno-float-equal 1440 -Wno-float-equal
@@ -1100,23 +1443,26 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
1100 -Wno-unused-function 1443 -Wno-unused-function
1101 -Wno-unused-parameter 1444 -Wno-unused-parameter
1102 #endif 1445 #endif
1103 #if __GNUC__ + (__GNUC_MINOR__ >= 9) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1446 #if (__GNUC__ + (__GNUC_MINOR__ >= 9) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1104 -Wno-float-conversion 1447 -Wno-float-conversion
1105 #endif 1448 #endif
1106 #if __GNUC__ >= 7 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1449 #if (__GNUC__ >= 7 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1107 -Wimplicit-fallthrough 1450 -Wimplicit-fallthrough
1108 #endif 1451 #endif
1109 #if __GNUC__ + (__GNUC_MINOR__ >= 8) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1452 #if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1110 -Wno-pedantic 1453 -Wno-pedantic
1111 #endif 1454 #endif
1112 #if 3 < __clang_major__ + (9 <= __clang_minor__) 1455 #if 3 < __clang_major__ + (9 <= __clang_minor__)
1113 -Wno-tautological-constant-out-of-range-compare 1456 -Wno-tautological-constant-out-of-range-compare
1114 #endif 1457 #endif
1115 #if __GNUC__ + (__GNUC_MINOR__ >= 3) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1458 #if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1116 -Wno-sign-conversion 1459 -Wno-sign-conversion
1117 -Wno-type-limits 1460 -Wno-type-limits
1118 #endif 1461 #endif
1119 #if __GNUC__ + (__GNUC_MINOR__ >= 5) > 4 1462 #if (__GNUC__ + (__GNUC_MINOR__ >= 1) > 6 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1463 -Wno-unused-const-variable
1464 #endif
1465 #if (__GNUC__ + (__GNUC_MINOR__ >= 5) > 4 && !defined __clang__)
1120 -Wno-unsuffixed-float-constants 1466 -Wno-unsuffixed-float-constants
1121 #endif 1467 #endif
1122EOF 1468EOF
@@ -1240,13 +1586,25 @@ AC_DEFUN([gl_CHECK_FUNCS_CASE_FOR_MACOS],
1240 if test $[ac_cv_func_][$1] = yes; then 1586 if test $[ac_cv_func_][$1] = yes; then
1241 [gl_cv_onwards_func_][$1]=yes 1587 [gl_cv_onwards_func_][$1]=yes
1242 else 1588 else
1589 dnl This is a bit complicated, because here we need the behaviour
1590 dnl of AC_CHECK_DECL before the
1591 dnl commit e1bbc9b93cdff61d70719c224b37970e065008bb (2025-05-26).
1592 [ac_cv_have_decl_][$1][_saved]="$[ac_cv_have_decl_][$1]"
1243 unset [ac_cv_have_decl_][$1] 1593 unset [ac_cv_have_decl_][$1]
1594 ac_c_future_darwin_options_saved="$ac_c_future_darwin_options"
1595 ac_cxx_future_darwin_options_saved="$ac_cxx_future_darwin_options"
1596 ac_c_future_darwin_options=
1597 ac_cxx_future_darwin_options=
1244 AC_CHECK_DECL([$1], , , [$2]) 1598 AC_CHECK_DECL([$1], , , [$2])
1599 ac_c_future_darwin_options="$ac_c_future_darwin_options_saved"
1600 ac_cxx_future_darwin_options="$ac_cxx_future_darwin_options_saved"
1245 if test $[ac_cv_have_decl_][$1] = yes; then 1601 if test $[ac_cv_have_decl_][$1] = yes; then
1246 [gl_cv_onwards_func_][$1]='future OS version' 1602 [gl_cv_onwards_func_][$1]='future OS version'
1247 else 1603 else
1248 [gl_cv_onwards_func_][$1]=no 1604 [gl_cv_onwards_func_][$1]=no
1249 fi 1605 fi
1606 [ac_cv_have_decl_][$1]="$[ac_cv_have_decl_][$1][_saved]"
1607 unset [ac_cv_have_decl_][$1][_saved]
1250 fi 1608 fi
1251 else 1609 else
1252 AC_CHECK_FUNC([$1]) 1610 AC_CHECK_FUNC([$1])
@@ -1299,7 +1657,7 @@ dnl
1299dnl This macro sets two variables: 1657dnl This macro sets two variables:
1300dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version" 1658dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version"
1301dnl - ac_cv_func_<func> to yes / no / no 1659dnl - ac_cv_func_<func> to yes / no / no
1302dnl The first variable allows to distinguish all three cases. 1660dnl The first variable allows distinguishing all three cases.
1303dnl The second variable is set, so that an invocation 1661dnl The second variable is set, so that an invocation
1304dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]]) 1662dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]])
1305dnl can be used as a drop-in replacement for 1663dnl can be used as a drop-in replacement for
@@ -1352,7 +1710,7 @@ dnl
1352dnl This macro sets two variables: 1710dnl This macro sets two variables:
1353dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version" 1711dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version"
1354dnl - ac_cv_func_<func> to yes / no / no 1712dnl - ac_cv_func_<func> to yes / no / no
1355dnl The first variable allows to distinguish all three cases. 1713dnl The first variable allows distinguishing all three cases.
1356dnl The second variable is set, so that an invocation 1714dnl The second variable is set, so that an invocation
1357dnl gl_CHECK_FUNCS_MACOS([func], [[#include <foo.h>]]) 1715dnl gl_CHECK_FUNCS_MACOS([func], [[#include <foo.h>]])
1358dnl can be used as a drop-in replacement for 1716dnl can be used as a drop-in replacement for
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index 83a0f727..cdd46759 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -1,5 +1,5 @@
1# DO NOT EDIT! GENERATED AUTOMATICALLY! 1# DO NOT EDIT! GENERATED AUTOMATICALLY!
2# Copyright (C) 2002-2024 Free Software Foundation, Inc. 2# Copyright (C) 2002-2026 Free Software Foundation, Inc.
3# 3#
4# This file is free software; you can redistribute it and/or modify 4# This file is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by 5# it under the terms of the GNU General Public License as published by
@@ -45,14 +45,30 @@ AC_DEFUN([gl_EARLY],
45 # Code from module absolute-header: 45 # Code from module absolute-header:
46 # Code from module alignasof: 46 # Code from module alignasof:
47 # Code from module alloca-opt: 47 # Code from module alloca-opt:
48 # Code from module arpa_inet: 48 # Code from module arpa_inet-h:
49 # Code from module assert-h: 49 # Code from module assert-h:
50 # Code from module attribute: 50 # Code from module attribute:
51 # Code from module base64: 51 # Code from module base64:
52 # Code from module basename-lgpl: 52 # Code from module basename-lgpl:
53 # Code from module bool:
53 # Code from module btowc: 54 # Code from module btowc:
54 # Code from module builtin-expect: 55 # Code from module builtin-expect:
55 # Code from module byteswap: 56 # Code from module byteswap:
57 # Code from module c-ctype:
58 # Code from module c32isalnum:
59 # Code from module c32isalpha:
60 # Code from module c32isblank:
61 # Code from module c32iscntrl:
62 # Code from module c32isdigit:
63 # Code from module c32isgraph:
64 # Code from module c32islower:
65 # Code from module c32isprint:
66 # Code from module c32ispunct:
67 # Code from module c32isspace:
68 # Code from module c32isupper:
69 # Code from module c32isxdigit:
70 # Code from module c32tolower:
71 # Code from module c32width:
56 # Code from module c99: 72 # Code from module c99:
57 # Code from module calloc-gnu: 73 # Code from module calloc-gnu:
58 # Code from module calloc-posix: 74 # Code from module calloc-posix:
@@ -66,11 +82,15 @@ AC_DEFUN([gl_EARLY],
66 # Code from module double-slash-root: 82 # Code from module double-slash-root:
67 # Code from module dup2: 83 # Code from module dup2:
68 # Code from module environ: 84 # Code from module environ:
69 # Code from module errno: 85 # Code from module errno-h:
70 # Code from module error: 86 # Code from module error:
71 # Code from module error-h: 87 # Code from module error-h:
72 # Code from module exitfail: 88 # Code from module exitfail:
73 # Code from module extensions: 89 # Code from module extensions:
90 # This is actually already done in the pre-early phase.
91 # AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
92 # Code from module extensions-aix:
93 AC_REQUIRE([gl_USE_AIX_EXTENSIONS])
74 # Code from module extern-inline: 94 # Code from module extern-inline:
75 # Code from module fcntl: 95 # Code from module fcntl:
76 # Code from module fcntl-h: 96 # Code from module fcntl-h:
@@ -78,7 +98,7 @@ AC_DEFUN([gl_EARLY],
78 # Code from module fflush: 98 # Code from module fflush:
79 AC_REQUIRE([gl_SET_LARGEFILE_SOURCE]) 99 AC_REQUIRE([gl_SET_LARGEFILE_SOURCE])
80 # Code from module filename: 100 # Code from module filename:
81 # Code from module float: 101 # Code from module float-h:
82 # Code from module floorf: 102 # Code from module floorf:
83 # Code from module fopen: 103 # Code from module fopen:
84 # Code from module fopen-gnu: 104 # Code from module fopen-gnu:
@@ -88,6 +108,7 @@ AC_DEFUN([gl_EARLY],
88 # Code from module fseek: 108 # Code from module fseek:
89 # Code from module fseeko: 109 # Code from module fseeko:
90 AC_REQUIRE([gl_SET_LARGEFILE_SOURCE]) 110 AC_REQUIRE([gl_SET_LARGEFILE_SOURCE])
111 # Code from module fseterr:
91 # Code from module fstat: 112 # Code from module fstat:
92 # Code from module fsusage: 113 # Code from module fsusage:
93 # Code from module ftell: 114 # Code from module ftell:
@@ -105,6 +126,7 @@ AC_DEFUN([gl_EARLY],
105 # Code from module getprogname: 126 # Code from module getprogname:
106 # Code from module gettext-h: 127 # Code from module gettext-h:
107 # Code from module glibc-internal/dynarray: 128 # Code from module glibc-internal/dynarray:
129 # Code from module gnulib-i18n:
108 # Code from module hard-locale: 130 # Code from module hard-locale:
109 # Code from module hostent: 131 # Code from module hostent:
110 # Code from module ialloc: 132 # Code from module ialloc:
@@ -112,29 +134,35 @@ AC_DEFUN([gl_EARLY],
112 # Code from module idx: 134 # Code from module idx:
113 # Code from module include_next: 135 # Code from module include_next:
114 # Code from module inet_ntop: 136 # Code from module inet_ntop:
137 # Code from module inet_pton:
115 # Code from module intprops: 138 # Code from module intprops:
116 # Code from module inttypes-incomplete: 139 # Code from module inttypes-h-incomplete:
117 # Code from module iswblank: 140 # Code from module iswblank:
118 # Code from module iswctype: 141 # Code from module iswctype:
119 # Code from module iswdigit: 142 # Code from module iswdigit:
120 # Code from module iswpunct: 143 # Code from module iswpunct:
121 # Code from module iswxdigit: 144 # Code from module iswxdigit:
122 # Code from module langinfo: 145 # Code from module langinfo-h:
123 # Code from module largefile: 146 # Code from module largefile:
124 AC_REQUIRE([AC_SYS_LARGEFILE]) 147 AC_REQUIRE([AC_SYS_LARGEFILE])
125 # Code from module libc-config: 148 # Code from module libc-config:
126 # Code from module limits-h: 149 # Code from module limits-h:
127 # Code from module localcharset: 150 # Code from module localcharset:
128 # Code from module locale: 151 # Code from module locale-h:
129 # Code from module localeconv: 152 # Code from module localeconv:
130 # Code from module lock: 153 # Code from module lock:
131 # Code from module lseek: 154 # Code from module lseek:
155 # Code from module lstat:
132 # Code from module malloc-gnu: 156 # Code from module malloc-gnu:
133 # Code from module malloc-posix: 157 # Code from module malloc-posix:
134 # Code from module malloca: 158 # Code from module malloca:
135 # Code from module math: 159 # Code from module math-h:
160 # Code from module mbchar:
161 # Code from module mbiterf:
162 # Code from module mbrtoc32:
136 # Code from module mbrtowc: 163 # Code from module mbrtowc:
137 # Code from module mbsinit: 164 # Code from module mbsinit:
165 # Code from module mbsnlen:
138 # Code from module mbszero: 166 # Code from module mbszero:
139 # Code from module mbtowc: 167 # Code from module mbtowc:
140 # Code from module memchr: 168 # Code from module memchr:
@@ -145,16 +173,20 @@ AC_DEFUN([gl_EARLY],
145 # Code from module msvc-inval: 173 # Code from module msvc-inval:
146 # Code from module msvc-nothrow: 174 # Code from module msvc-nothrow:
147 # Code from module multiarch: 175 # Code from module multiarch:
148 # Code from module netdb: 176 # Code from module netdb-h:
149 # Code from module netinet_in: 177 # Code from module netinet_in-h:
150 # Code from module nl_langinfo: 178 # Code from module nl_langinfo:
151 # Code from module nocrash: 179 # Code from module nocrash:
180 # Code from module once:
152 # Code from module open: 181 # Code from module open:
153 # Code from module pathmax: 182 # Code from module pathmax:
154 # Code from module realloc-gnu: 183 # Code from module pthread-h:
184 gl_ANYTHREADLIB_EARLY
185 # Code from module pthread-once:
155 # Code from module realloc-posix: 186 # Code from module realloc-posix:
156 # Code from module reallocarray: 187 # Code from module reallocarray:
157 # Code from module regex: 188 # Code from module regex:
189 # Code from module sched-h:
158 # Code from module servent: 190 # Code from module servent:
159 # Code from module setenv: 191 # Code from module setenv:
160 # Code from module setlocale-null: 192 # Code from module setlocale-null:
@@ -172,33 +204,58 @@ AC_DEFUN([gl_EARLY],
172 # Code from module stat: 204 # Code from module stat:
173 # Code from module stat-time: 205 # Code from module stat-time:
174 # Code from module std-gnu11: 206 # Code from module std-gnu11:
175 # Code from module stdbool: 207 # Code from module stdckdint-h:
176 # Code from module stdckdint: 208 # Code from module stddef-h:
177 # Code from module stddef: 209 # Code from module stdint-h:
178 # Code from module stdint: 210 # Code from module stdio-h:
179 # Code from module stdio:
180 gl_STDIO_H_EARLY 211 gl_STDIO_H_EARLY
181 # Code from module stdlib: 212 # Code from module stdio-windows:
213 # Code from module stdlib-h:
182 # Code from module strcase: 214 # Code from module strcase:
215 # Code from module strcasecmp:
183 # Code from module strcasestr: 216 # Code from module strcasestr:
184 # Code from module strcasestr-simple: 217 # Code from module strcasestr-simple:
185 # Code from module streq: 218 # Code from module streq:
186 # Code from module strerror: 219 # Code from module strerror:
187 # Code from module strerror-override: 220 # Code from module strerror-override:
188 # Code from module string: 221 # Code from module string-h:
189 # Code from module strings: 222 # Code from module stringeq:
223 # Code from module strings-h:
224 # Code from module strncasecmp:
225 # Code from module strncpy:
190 # Code from module strsep: 226 # Code from module strsep:
191 # Code from module strstr-simple: 227 # Code from module strstr-simple:
192 # Code from module sys_socket: 228 # Code from module sys_socket-h:
193 # Code from module sys_stat: 229 # Code from module sys_stat-h:
194 # Code from module sys_types: 230 # Code from module sys_types-h:
195 # Code from module sys_uio: 231 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
232 # Code from module sys_uio-h:
196 # Code from module threadlib: 233 # Code from module threadlib:
197 gl_THREADLIB_EARLY 234 gl_THREADLIB_EARLY
198 # Code from module time-h: 235 # Code from module time-h:
199 # Code from module time_r: 236 # Code from module time_r:
200 # Code from module timegm: 237 # Code from module timegm:
201 # Code from module unistd: 238 # Code from module uchar-h:
239 # Code from module unicase/base:
240 # Code from module unicase/tolower:
241 # Code from module unictype/base:
242 # Code from module unictype/ctype-alnum:
243 # Code from module unictype/ctype-alpha:
244 # Code from module unictype/ctype-blank:
245 # Code from module unictype/ctype-cntrl:
246 # Code from module unictype/ctype-digit:
247 # Code from module unictype/ctype-graph:
248 # Code from module unictype/ctype-lower:
249 # Code from module unictype/ctype-print:
250 # Code from module unictype/ctype-punct:
251 # Code from module unictype/ctype-space:
252 # Code from module unictype/ctype-upper:
253 # Code from module unictype/ctype-xdigit:
254 # Code from module uninorm/base:
255 # Code from module unistd-h:
256 # Code from module unitypes-h:
257 # Code from module uniwidth/base:
258 # Code from module uniwidth/width:
202 # Code from module unlocked-io-internal: 259 # Code from module unlocked-io-internal:
203 # Code from module unsetenv: 260 # Code from module unsetenv:
204 # Code from module vararrays: 261 # Code from module vararrays:
@@ -206,10 +263,12 @@ AC_DEFUN([gl_EARLY],
206 # Code from module vasprintf: 263 # Code from module vasprintf:
207 # Code from module verify: 264 # Code from module verify:
208 # Code from module vsnprintf: 265 # Code from module vsnprintf:
209 # Code from module wchar: 266 # Code from module vsnzprintf:
267 # Code from module wchar-h:
210 # Code from module wcrtomb: 268 # Code from module wcrtomb:
211 # Code from module wctype: 269 # Code from module wctype:
212 # Code from module wctype-h: 270 # Code from module wctype-h:
271 # Code from module wcwidth:
213 # Code from module windows-mutex: 272 # Code from module windows-mutex:
214 # Code from module windows-once: 273 # Code from module windows-once:
215 # Code from module windows-recmutex: 274 # Code from module windows-recmutex:
@@ -250,6 +309,7 @@ AC_DEFUN([gl_INIT],
250 gl_CONDITIONAL_HEADER([assert.h]) 309 gl_CONDITIONAL_HEADER([assert.h])
251 AC_PROG_MKDIR_P 310 AC_PROG_MKDIR_P
252 gl_FUNC_BASE64 311 gl_FUNC_BASE64
312 gl_C_BOOL
253 gl_FUNC_BTOWC 313 gl_FUNC_BTOWC
254 gl_CONDITIONAL([GL_COND_OBJ_BTOWC], 314 gl_CONDITIONAL([GL_COND_OBJ_BTOWC],
255 [test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1]) 315 [test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1])
@@ -261,6 +321,104 @@ AC_DEFUN([gl_INIT],
261 gl_BYTESWAP 321 gl_BYTESWAP
262 gl_CONDITIONAL_HEADER([byteswap.h]) 322 gl_CONDITIONAL_HEADER([byteswap.h])
263 AC_PROG_MKDIR_P 323 AC_PROG_MKDIR_P
324 AC_REQUIRE([gl_UCHAR_H])
325 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
326 dnl determined. It describes how mbrtoc32 is implemented.
327 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
328 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
329 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
330 gl_UCHAR_MODULE_INDICATOR([c32isalnum])
331 AC_REQUIRE([gl_UCHAR_H])
332 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
333 dnl determined. It describes how mbrtoc32 is implemented.
334 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
335 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
336 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
337 gl_UCHAR_MODULE_INDICATOR([c32isalpha])
338 AC_REQUIRE([gl_UCHAR_H])
339 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
340 dnl determined. It describes how mbrtoc32 is implemented.
341 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
342 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
343 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
344 gl_UCHAR_MODULE_INDICATOR([c32isblank])
345 AC_REQUIRE([gl_UCHAR_H])
346 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
347 dnl determined. It describes how mbrtoc32 is implemented.
348 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
349 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
350 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
351 gl_UCHAR_MODULE_INDICATOR([c32iscntrl])
352 AC_REQUIRE([gl_UCHAR_H])
353 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
354 dnl determined. It describes how mbrtoc32 is implemented.
355 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
356 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
357 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
358 gl_UCHAR_MODULE_INDICATOR([c32isdigit])
359 AC_REQUIRE([gl_UCHAR_H])
360 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
361 dnl determined. It describes how mbrtoc32 is implemented.
362 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
363 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
364 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
365 gl_UCHAR_MODULE_INDICATOR([c32isgraph])
366 AC_REQUIRE([gl_UCHAR_H])
367 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
368 dnl determined. It describes how mbrtoc32 is implemented.
369 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
370 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
371 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
372 gl_UCHAR_MODULE_INDICATOR([c32islower])
373 AC_REQUIRE([gl_UCHAR_H])
374 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
375 dnl determined. It describes how mbrtoc32 is implemented.
376 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
377 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
378 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
379 gl_UCHAR_MODULE_INDICATOR([c32isprint])
380 AC_REQUIRE([gl_UCHAR_H])
381 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
382 dnl determined. It describes how mbrtoc32 is implemented.
383 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
384 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
385 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
386 gl_UCHAR_MODULE_INDICATOR([c32ispunct])
387 AC_REQUIRE([gl_UCHAR_H])
388 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
389 dnl determined. It describes how mbrtoc32 is implemented.
390 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
391 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
392 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
393 gl_UCHAR_MODULE_INDICATOR([c32isspace])
394 AC_REQUIRE([gl_UCHAR_H])
395 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
396 dnl determined. It describes how mbrtoc32 is implemented.
397 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
398 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
399 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
400 gl_UCHAR_MODULE_INDICATOR([c32isupper])
401 AC_REQUIRE([gl_UCHAR_H])
402 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
403 dnl determined. It describes how mbrtoc32 is implemented.
404 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
405 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
406 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
407 gl_UCHAR_MODULE_INDICATOR([c32isxdigit])
408 AC_REQUIRE([gl_UCHAR_H])
409 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
410 dnl determined. It describes how mbrtoc32 is implemented.
411 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
412 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
413 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
414 gl_UCHAR_MODULE_INDICATOR([c32tolower])
415 AC_REQUIRE([gl_UCHAR_H])
416 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
417 dnl determined. It describes how mbrtoc32 is implemented.
418 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
419 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
420 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
421 gl_UCHAR_MODULE_INDICATOR([c32width])
264 gl_FUNC_CALLOC_GNU 422 gl_FUNC_CALLOC_GNU
265 if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 1; then 423 if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 1; then
266 AC_LIBOBJ([calloc]) 424 AC_LIBOBJ([calloc])
@@ -275,6 +433,7 @@ AC_DEFUN([gl_INIT],
275 gl_FUNC_CLOSE 433 gl_FUNC_CLOSE
276 gl_CONDITIONAL([GL_COND_OBJ_CLOSE], [test $REPLACE_CLOSE = 1]) 434 gl_CONDITIONAL([GL_COND_OBJ_CLOSE], [test $REPLACE_CLOSE = 1])
277 gl_UNISTD_MODULE_INDICATOR([close]) 435 gl_UNISTD_MODULE_INDICATOR([close])
436 gl_MODULE_INDICATOR([close])
278 gl_AF_ALG 437 gl_AF_ALG
279 AC_REQUIRE([AC_C_RESTRICT]) 438 AC_REQUIRE([AC_C_RESTRICT])
280 gl_SHA256 439 gl_SHA256
@@ -320,8 +479,11 @@ AC_DEFUN([gl_INIT],
320 gl_FLOAT_H 479 gl_FLOAT_H
321 gl_CONDITIONAL_HEADER([float.h]) 480 gl_CONDITIONAL_HEADER([float.h])
322 AC_PROG_MKDIR_P 481 AC_PROG_MKDIR_P
323 gl_CONDITIONAL([GL_COND_OBJ_FLOAT], [test $REPLACE_FLOAT_LDBL = 1]) 482 gl_CONDITIONAL([GL_COND_OBJ_FLOAT],
483 [test $REPLACE_FLOAT_LDBL = 1 || test $REPLACE_FLOAT_SNAN = 1])
324 gl_CONDITIONAL([GL_COND_OBJ_ITOLD], [test $REPLACE_ITOLD = 1]) 484 gl_CONDITIONAL([GL_COND_OBJ_ITOLD], [test $REPLACE_ITOLD = 1])
485 dnl Prerequisites of lib/float.c.
486 AC_REQUIRE([gl_BIGENDIAN])
325 gl_FUNC_FLOORF 487 gl_FUNC_FLOORF
326 gl_CONDITIONAL([GL_COND_OBJ_FLOORF], 488 gl_CONDITIONAL([GL_COND_OBJ_FLOORF],
327 [test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1]) 489 [test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1])
@@ -360,6 +522,8 @@ AC_DEFUN([gl_INIT],
360 gl_PREREQ_FSEEKO 522 gl_PREREQ_FSEEKO
361 ]) 523 ])
362 gl_STDIO_MODULE_INDICATOR([fseeko]) 524 gl_STDIO_MODULE_INDICATOR([fseeko])
525 gl_FUNC_FSETERR
526 gl_CONDITIONAL([GL_COND_OBJ_FSETERR], [test $ac_cv_func___fseterr = no])
363 gl_FUNC_FSTAT 527 gl_FUNC_FSTAT
364 gl_CONDITIONAL([GL_COND_OBJ_FSTAT], [test $REPLACE_FSTAT = 1]) 528 gl_CONDITIONAL([GL_COND_OBJ_FSTAT], [test $REPLACE_FSTAT = 1])
365 AM_COND_IF([GL_COND_OBJ_FSTAT], [ 529 AM_COND_IF([GL_COND_OBJ_FSTAT], [
@@ -371,6 +535,7 @@ AC_DEFUN([gl_INIT],
371 gl_PREREQ_FSTAT 535 gl_PREREQ_FSTAT
372 ]) 536 ])
373 gl_SYS_STAT_MODULE_INDICATOR([fstat]) 537 gl_SYS_STAT_MODULE_INDICATOR([fstat])
538 gl_MODULE_INDICATOR([fstat])
374 gl_FSUSAGE 539 gl_FSUSAGE
375 gl_CONDITIONAL([GL_COND_OBJ_FSUSAGE], [test $gl_cv_fs_space = yes]) 540 gl_CONDITIONAL([GL_COND_OBJ_FSUSAGE], [test $gl_cv_fs_space = yes])
376 AM_COND_IF([GL_COND_OBJ_FSUSAGE], [ 541 AM_COND_IF([GL_COND_OBJ_FSUSAGE], [
@@ -407,11 +572,13 @@ AC_DEFUN([gl_INIT],
407 ]) 572 ])
408 gl_UNISTD_MODULE_INDICATOR([getdtablesize]) 573 gl_UNISTD_MODULE_INDICATOR([getdtablesize])
409 gl_FUNC_GETHOSTNAME 574 gl_FUNC_GETHOSTNAME
410 gl_CONDITIONAL([GL_COND_OBJ_GETHOSTNAME], [test $HAVE_GETHOSTNAME = 0]) 575 gl_CONDITIONAL([GL_COND_OBJ_GETHOSTNAME],
576 [test $HAVE_GETHOSTNAME = 0 || test $UNISTD_H_HAVE_WINSOCK2_H = 1])
411 AM_COND_IF([GL_COND_OBJ_GETHOSTNAME], [ 577 AM_COND_IF([GL_COND_OBJ_GETHOSTNAME], [
412 gl_PREREQ_GETHOSTNAME 578 gl_PREREQ_GETHOSTNAME
413 ]) 579 ])
414 gl_UNISTD_MODULE_INDICATOR([gethostname]) 580 gl_UNISTD_MODULE_INDICATOR([gethostname])
581 gl_MODULE_INDICATOR([gethostname])
415 gl_FUNC_GETLINE 582 gl_FUNC_GETLINE
416 gl_CONDITIONAL([GL_COND_OBJ_GETLINE], [test $REPLACE_GETLINE = 1]) 583 gl_CONDITIONAL([GL_COND_OBJ_GETLINE], [test $REPLACE_GETLINE = 1])
417 AM_COND_IF([GL_COND_OBJ_GETLINE], [ 584 AM_COND_IF([GL_COND_OBJ_GETLINE], [
@@ -441,6 +608,8 @@ AC_DEFUN([gl_INIT],
441 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT], [1]) 608 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT], [1])
442 ]) 609 ])
443 gl_UNISTD_MODULE_INDICATOR([getopt-posix]) 610 gl_UNISTD_MODULE_INDICATOR([getopt-posix])
611 gl_MUSL_LIBC
612 AC_REQUIRE([AC_CANONICAL_HOST])
444 gl_FUNC_GETPROGNAME 613 gl_FUNC_GETPROGNAME
445 gl_CONDITIONAL([GL_COND_OBJ_GETPROGNAME], 614 gl_CONDITIONAL([GL_COND_OBJ_GETPROGNAME],
446 [test $HAVE_GETPROGNAME = 0 || test $REPLACE_GETPROGNAME = 1]) 615 [test $HAVE_GETPROGNAME = 0 || test $REPLACE_GETPROGNAME = 1])
@@ -448,9 +617,9 @@ AC_DEFUN([gl_INIT],
448 gl_PREREQ_GETPROGNAME 617 gl_PREREQ_GETPROGNAME
449 ]) 618 ])
450 gl_STDLIB_MODULE_INDICATOR([getprogname]) 619 gl_STDLIB_MODULE_INDICATOR([getprogname])
451 AC_SUBST([LIBINTL]) 620 gl_GETTEXT_H
452 AC_SUBST([LTLIBINTL])
453 AC_PROG_MKDIR_P 621 AC_PROG_MKDIR_P
622 GNULIB_I18N
454 AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) 623 AC_REQUIRE([gl_FUNC_SETLOCALE_NULL])
455 HARD_LOCALE_LIB="$SETLOCALE_NULL_LIB" 624 HARD_LOCALE_LIB="$SETLOCALE_NULL_LIB"
456 AC_SUBST([HARD_LOCALE_LIB]) 625 AC_SUBST([HARD_LOCALE_LIB])
@@ -466,6 +635,13 @@ AC_DEFUN([gl_INIT],
466 gl_PREREQ_INET_NTOP 635 gl_PREREQ_INET_NTOP
467 ]) 636 ])
468 gl_ARPA_INET_MODULE_INDICATOR([inet_ntop]) 637 gl_ARPA_INET_MODULE_INDICATOR([inet_ntop])
638 gl_FUNC_INET_PTON
639 gl_CONDITIONAL([GL_COND_OBJ_INET_PTON],
640 [test $HAVE_INET_PTON = 0 || test $REPLACE_INET_PTON = 1])
641 AM_COND_IF([GL_COND_OBJ_INET_PTON], [
642 gl_PREREQ_INET_PTON
643 ])
644 gl_ARPA_INET_MODULE_INDICATOR([inet_pton])
469 gl_INTTYPES_INCOMPLETE 645 gl_INTTYPES_INCOMPLETE
470 gl_INTTYPES_H_REQUIRE_DEFAULTS 646 gl_INTTYPES_H_REQUIRE_DEFAULTS
471 AC_PROG_MKDIR_P 647 AC_PROG_MKDIR_P
@@ -510,11 +686,19 @@ AC_DEFUN([gl_INIT],
510 gl_PREREQ_LOCALECONV 686 gl_PREREQ_LOCALECONV
511 ]) 687 ])
512 gl_LOCALE_MODULE_INDICATOR([localeconv]) 688 gl_LOCALE_MODULE_INDICATOR([localeconv])
689 gl_MODULE_INDICATOR([localeconv])
513 gl_LOCK 690 gl_LOCK
514 gl_MODULE_INDICATOR([lock]) 691 gl_MODULE_INDICATOR([lock])
515 gl_FUNC_LSEEK 692 gl_FUNC_LSEEK
516 gl_CONDITIONAL([GL_COND_OBJ_LSEEK], [test $REPLACE_LSEEK = 1]) 693 gl_CONDITIONAL([GL_COND_OBJ_LSEEK], [test $REPLACE_LSEEK = 1])
517 gl_UNISTD_MODULE_INDICATOR([lseek]) 694 gl_UNISTD_MODULE_INDICATOR([lseek])
695 gl_FUNC_LSTAT
696 gl_CONDITIONAL([GL_COND_OBJ_LSTAT], [test $REPLACE_LSTAT = 1])
697 AM_COND_IF([GL_COND_OBJ_LSTAT], [
698 gl_PREREQ_LSTAT
699 ])
700 gl_SYS_STAT_MODULE_INDICATOR([lstat])
701 gl_MODULE_INDICATOR([lstat])
518 gl_FUNC_MALLOC_GNU 702 gl_FUNC_MALLOC_GNU
519 if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 1; then 703 if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 1; then
520 AC_LIBOBJ([malloc]) 704 AC_LIBOBJ([malloc])
@@ -529,6 +713,20 @@ AC_DEFUN([gl_INIT],
529 gl_MATH_H 713 gl_MATH_H
530 gl_MATH_H_REQUIRE_DEFAULTS 714 gl_MATH_H_REQUIRE_DEFAULTS
531 AC_PROG_MKDIR_P 715 AC_PROG_MKDIR_P
716 gl_MBCHAR
717 gl_MBITER
718 gl_FUNC_MBRTOC32
719 gl_CONDITIONAL([GL_COND_OBJ_MBRTOC32],
720 [test $HAVE_MBRTOC32 = 0 || test $REPLACE_MBRTOC32 = 1])
721 AM_COND_IF([GL_COND_OBJ_MBRTOC32], [
722 if test $REPLACE_MBSTATE_T = 1; then
723 AC_LIBOBJ([lc-charset-dispatch])
724 AC_LIBOBJ([mbtowc-lock])
725 gl_PREREQ_MBTOWC_LOCK
726 fi
727 gl_PREREQ_MBRTOC32
728 ])
729 gl_UCHAR_MODULE_INDICATOR([mbrtoc32])
532 gl_FUNC_MBRTOWC 730 gl_FUNC_MBRTOWC
533 gl_CONDITIONAL([GL_COND_OBJ_MBRTOWC], 731 gl_CONDITIONAL([GL_COND_OBJ_MBRTOWC],
534 [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]) 732 [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1])
@@ -548,6 +746,7 @@ AC_DEFUN([gl_INIT],
548 gl_PREREQ_MBSINIT 746 gl_PREREQ_MBSINIT
549 ]) 747 ])
550 gl_WCHAR_MODULE_INDICATOR([mbsinit]) 748 gl_WCHAR_MODULE_INDICATOR([mbsinit])
749 gl_STRING_MODULE_INDICATOR([mbsnlen])
551 AC_REQUIRE([AC_TYPE_MBSTATE_T]) 750 AC_REQUIRE([AC_TYPE_MBSTATE_T])
552 gl_MBSTATE_T_BROKEN 751 gl_MBSTATE_T_BROKEN
553 gl_MUSL_LIBC 752 gl_MUSL_LIBC
@@ -578,10 +777,7 @@ AC_DEFUN([gl_INIT],
578 gl_PREREQ_MKTIME 777 gl_PREREQ_MKTIME
579 fi 778 fi
580 gl_MOUNTLIST 779 gl_MOUNTLIST
581 gl_CONDITIONAL([GL_COND_OBJ_MOUNTLIST], [test $gl_cv_list_mounted_fs = yes]) 780 gl_PREREQ_MOUNTLIST_EXTRA
582 AM_COND_IF([GL_COND_OBJ_MOUNTLIST], [
583 gl_PREREQ_MOUNTLIST_EXTRA
584 ])
585 AC_REQUIRE([gl_MSVC_INVAL]) 781 AC_REQUIRE([gl_MSVC_INVAL])
586 gl_CONDITIONAL([GL_COND_OBJ_MSVC_INVAL], 782 gl_CONDITIONAL([GL_COND_OBJ_MSVC_INVAL],
587 [test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1]) 783 [test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1])
@@ -605,6 +801,7 @@ AC_DEFUN([gl_INIT],
605 gl_PREREQ_NL_LANGINFO_LOCK 801 gl_PREREQ_NL_LANGINFO_LOCK
606 fi 802 fi
607 gl_LANGINFO_MODULE_INDICATOR([nl_langinfo]) 803 gl_LANGINFO_MODULE_INDICATOR([nl_langinfo])
804 gl_ONCE
608 gl_FUNC_OPEN 805 gl_FUNC_OPEN
609 gl_CONDITIONAL([GL_COND_OBJ_OPEN], [test $REPLACE_OPEN = 1]) 806 gl_CONDITIONAL([GL_COND_OBJ_OPEN], [test $REPLACE_OPEN = 1])
610 AM_COND_IF([GL_COND_OBJ_OPEN], [ 807 AM_COND_IF([GL_COND_OBJ_OPEN], [
@@ -612,15 +809,17 @@ AC_DEFUN([gl_INIT],
612 ]) 809 ])
613 gl_FCNTL_MODULE_INDICATOR([open]) 810 gl_FCNTL_MODULE_INDICATOR([open])
614 gl_PATHMAX 811 gl_PATHMAX
615 gl_FUNC_REALLOC_GNU 812 gl_PTHREAD_H
616 if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 1; then 813 gl_PTHREAD_H_REQUIRE_DEFAULTS
617 AC_LIBOBJ([realloc]) 814 AC_PROG_MKDIR_P
618 fi 815 gl_PTHREAD_ONCE
619 gl_STDLIB_MODULE_INDICATOR([realloc-gnu]) 816 gl_CONDITIONAL([GL_COND_OBJ_PTHREAD_ONCE],
817 [test $HAVE_PTHREAD_ONCE = 0 || test $REPLACE_PTHREAD_ONCE = 1])
818 gl_PTHREAD_MODULE_INDICATOR([pthread-once])
620 gl_FUNC_REALLOC_POSIX 819 gl_FUNC_REALLOC_POSIX
621 if test $REPLACE_REALLOC_FOR_REALLOC_POSIX = 1; then 820 gl_FUNC_REALLOC_0_NONNULL
622 AC_LIBOBJ([realloc]) 821 gl_CONDITIONAL([GL_COND_OBJ_REALLOC_POSIX],
623 fi 822 [test $REPLACE_REALLOC_FOR_REALLOC_POSIX != 0])
624 gl_STDLIB_MODULE_INDICATOR([realloc-posix]) 823 gl_STDLIB_MODULE_INDICATOR([realloc-posix])
625 gl_FUNC_REALLOCARRAY 824 gl_FUNC_REALLOCARRAY
626 gl_CONDITIONAL([GL_COND_OBJ_REALLOCARRAY], 825 gl_CONDITIONAL([GL_COND_OBJ_REALLOCARRAY],
@@ -635,6 +834,9 @@ AC_DEFUN([gl_INIT],
635 AM_COND_IF([GL_COND_OBJ_REGEX], [ 834 AM_COND_IF([GL_COND_OBJ_REGEX], [
636 gl_PREREQ_REGEX 835 gl_PREREQ_REGEX
637 ]) 836 ])
837 gl_SCHED_H
838 gl_SCHED_H_REQUIRE_DEFAULTS
839 AC_PROG_MKDIR_P
638 gl_SERVENT 840 gl_SERVENT
639 gl_FUNC_SETENV 841 gl_FUNC_SETENV
640 gl_CONDITIONAL([GL_COND_OBJ_SETENV], 842 gl_CONDITIONAL([GL_COND_OBJ_SETENV],
@@ -666,15 +868,10 @@ AC_DEFUN([gl_INIT],
666 gl_PREREQ_STAT 868 gl_PREREQ_STAT
667 ]) 869 ])
668 gl_SYS_STAT_MODULE_INDICATOR([stat]) 870 gl_SYS_STAT_MODULE_INDICATOR([stat])
871 gl_MODULE_INDICATOR([stat])
669 gl_STAT_TIME 872 gl_STAT_TIME
670 gl_STAT_BIRTHTIME 873 gl_STAT_BIRTHTIME
671 gl_C_BOOL 874 gl_STDCKDINT_H
672 AC_CHECK_HEADERS_ONCE([stdckdint.h])
673 if test $ac_cv_header_stdckdint_h = yes; then
674 GL_GENERATE_STDCKDINT_H=false
675 else
676 GL_GENERATE_STDCKDINT_H=true
677 fi
678 gl_CONDITIONAL_HEADER([stdckdint.h]) 875 gl_CONDITIONAL_HEADER([stdckdint.h])
679 AC_PROG_MKDIR_P 876 AC_PROG_MKDIR_P
680 gl_STDDEF_H 877 gl_STDDEF_H
@@ -714,18 +911,30 @@ AC_DEFUN([gl_INIT],
714 gl_STDIO_MODULE_INDICATOR([fputs]) 911 gl_STDIO_MODULE_INDICATOR([fputs])
715 gl_STDIO_MODULE_INDICATOR([puts]) 912 gl_STDIO_MODULE_INDICATOR([puts])
716 gl_STDIO_MODULE_INDICATOR([fwrite]) 913 gl_STDIO_MODULE_INDICATOR([fwrite])
914 AC_REQUIRE([AC_CANONICAL_HOST])
915 USES_MSVCRT=0
916 case "$host_os" in
917 mingw* | windows*)
918 AC_EGREP_CPP([Special], [
919 #ifndef _UCRT
920 Special
921 #endif
922 ],
923 [USES_MSVCRT=1])
924 ;;
925 esac
926 gl_CONDITIONAL([GL_COND_OBJ_STDIO_CONSOLESAFE], [test $USES_MSVCRT = 1])
927 AC_CHECK_FUNCS([vasprintf])
717 gl_STDLIB_H 928 gl_STDLIB_H
718 gl_STDLIB_H_REQUIRE_DEFAULTS 929 gl_STDLIB_H_REQUIRE_DEFAULTS
719 AC_PROG_MKDIR_P 930 AC_PROG_MKDIR_P
720 gl_STRCASE 931 gl_FUNC_STRCASECMP
721 gl_CONDITIONAL([GL_COND_OBJ_STRCASECMP], [test $HAVE_STRCASECMP = 0]) 932 gl_CONDITIONAL([GL_COND_OBJ_STRCASECMP],
933 [test $HAVE_STRCASECMP = 0 || test $REPLACE_STRCASECMP = 1])
722 AM_COND_IF([GL_COND_OBJ_STRCASECMP], [ 934 AM_COND_IF([GL_COND_OBJ_STRCASECMP], [
723 gl_PREREQ_STRCASECMP 935 gl_PREREQ_STRCASECMP
724 ]) 936 ])
725 gl_CONDITIONAL([GL_COND_OBJ_STRNCASECMP], [test $HAVE_STRNCASECMP = 0]) 937 gl_STRINGS_MODULE_INDICATOR([strcasecmp])
726 AM_COND_IF([GL_COND_OBJ_STRNCASECMP], [
727 gl_PREREQ_STRNCASECMP
728 ])
729 gl_FUNC_STRCASESTR 938 gl_FUNC_STRCASESTR
730 if test $HAVE_STRCASESTR = 0 || test $REPLACE_STRCASESTR = 1; then 939 if test $HAVE_STRCASESTR = 0 || test $REPLACE_STRCASESTR = 1; then
731 AC_LIBOBJ([strcasestr]) 940 AC_LIBOBJ([strcasestr])
@@ -751,9 +960,25 @@ AC_DEFUN([gl_INIT],
751 gl_STRING_H 960 gl_STRING_H
752 gl_STRING_H_REQUIRE_DEFAULTS 961 gl_STRING_H_REQUIRE_DEFAULTS
753 AC_PROG_MKDIR_P 962 AC_PROG_MKDIR_P
963 gl_FUNC_STREQ
964 gl_FUNC_MEMEQ
965 gl_STRING_MODULE_INDICATOR([stringeq])
754 gl_STRINGS_H 966 gl_STRINGS_H
755 gl_STRINGS_H_REQUIRE_DEFAULTS 967 gl_STRINGS_H_REQUIRE_DEFAULTS
756 AC_PROG_MKDIR_P 968 AC_PROG_MKDIR_P
969 gl_FUNC_STRNCASECMP
970 gl_CONDITIONAL([GL_COND_OBJ_STRNCASECMP],
971 [test $HAVE_STRNCASECMP = 0 || test $REPLACE_STRNCASECMP = 1])
972 AM_COND_IF([GL_COND_OBJ_STRNCASECMP], [
973 gl_PREREQ_STRNCASECMP
974 ])
975 gl_STRINGS_MODULE_INDICATOR([strncasecmp])
976 gl_FUNC_STRNCPY
977 gl_CONDITIONAL([GL_COND_OBJ_STRNCPY], [test $REPLACE_STRNCPY = 1])
978 AM_COND_IF([GL_COND_OBJ_STRNCPY], [
979 gl_PREREQ_STRNCPY
980 ])
981 gl_STRING_MODULE_INDICATOR([strncpy])
757 gl_FUNC_STRSEP 982 gl_FUNC_STRSEP
758 gl_CONDITIONAL([GL_COND_OBJ_STRSEP], [test $HAVE_STRSEP = 0]) 983 gl_CONDITIONAL([GL_COND_OBJ_STRSEP], [test $HAVE_STRSEP = 0])
759 AM_COND_IF([GL_COND_OBJ_STRSEP], [ 984 AM_COND_IF([GL_COND_OBJ_STRSEP], [
@@ -795,9 +1020,55 @@ AC_DEFUN([gl_INIT],
795 gl_PREREQ_TIMEGM 1020 gl_PREREQ_TIMEGM
796 ]) 1021 ])
797 gl_TIME_MODULE_INDICATOR([timegm]) 1022 gl_TIME_MODULE_INDICATOR([timegm])
1023 gl_UCHAR_H
1024 gl_UCHAR_H_REQUIRE_DEFAULTS
1025 AC_PROG_MKDIR_P
1026 gl_LIBUNISTRING_LIBHEADER([1.2], [unicase.h])
1027 gl_UNICASE_H
1028 gl_UNICASE_H_REQUIRE_DEFAULTS
1029 AC_PROG_MKDIR_P
1030 gl_LIBUNISTRING_MODULE([1.4], [unicase/tolower])
1031 gl_LIBUNISTRING_LIBHEADER([1.3], [unictype.h])
1032 gl_UNICTYPE_H
1033 gl_UNICTYPE_H_REQUIRE_DEFAULTS
1034 AC_PROG_MKDIR_P
1035 AC_REQUIRE([AC_C_INLINE])
1036 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-alnum])
1037 AC_REQUIRE([AC_C_INLINE])
1038 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-alpha])
1039 AC_REQUIRE([AC_C_INLINE])
1040 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-blank])
1041 AC_REQUIRE([AC_C_INLINE])
1042 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-cntrl])
1043 AC_REQUIRE([AC_C_INLINE])
1044 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-digit])
1045 AC_REQUIRE([AC_C_INLINE])
1046 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-graph])
1047 AC_REQUIRE([AC_C_INLINE])
1048 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-lower])
1049 AC_REQUIRE([AC_C_INLINE])
1050 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-print])
1051 AC_REQUIRE([AC_C_INLINE])
1052 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-punct])
1053 AC_REQUIRE([AC_C_INLINE])
1054 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-space])
1055 AC_REQUIRE([AC_C_INLINE])
1056 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-upper])
1057 AC_REQUIRE([AC_C_INLINE])
1058 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-xdigit])
1059 gl_LIBUNISTRING_LIBHEADER([1.2], [uninorm.h])
1060 gl_UNINORM_H
1061 gl_UNINORM_H_REQUIRE_DEFAULTS
1062 AC_PROG_MKDIR_P
798 gl_UNISTD_H 1063 gl_UNISTD_H
799 gl_UNISTD_H_REQUIRE_DEFAULTS 1064 gl_UNISTD_H_REQUIRE_DEFAULTS
800 AC_PROG_MKDIR_P 1065 AC_PROG_MKDIR_P
1066 gl_LIBUNISTRING_LIBHEADER([0.9.11], [unitypes.h])
1067 AC_PROG_MKDIR_P
1068 gl_UNITYPES_H
1069 gl_LIBUNISTRING_LIBHEADER([0.9.11], [uniwidth.h])
1070 AC_PROG_MKDIR_P
1071 gl_LIBUNISTRING_MODULE([1.4], [uniwidth/width])
801 gl_FUNC_GLIBC_UNLOCKED_IO 1072 gl_FUNC_GLIBC_UNLOCKED_IO
802 gl_FUNC_UNSETENV 1073 gl_FUNC_UNSETENV
803 gl_CONDITIONAL([GL_COND_OBJ_UNSETENV], 1074 gl_CONDITIONAL([GL_COND_OBJ_UNSETENV],
@@ -816,6 +1087,7 @@ AC_DEFUN([gl_INIT],
816 AM_][XGETTEXT_OPTION([--flag=vasprintf:2:c-format])]) 1087 AM_][XGETTEXT_OPTION([--flag=vasprintf:2:c-format])])
817 gl_FUNC_VSNPRINTF 1088 gl_FUNC_VSNPRINTF
818 gl_STDIO_MODULE_INDICATOR([vsnprintf]) 1089 gl_STDIO_MODULE_INDICATOR([vsnprintf])
1090 gl_STDIO_MODULE_INDICATOR([vsnzprintf])
819 gl_WCHAR_H 1091 gl_WCHAR_H
820 gl_WCHAR_H_REQUIRE_DEFAULTS 1092 gl_WCHAR_H_REQUIRE_DEFAULTS
821 AC_PROG_MKDIR_P 1093 AC_PROG_MKDIR_P
@@ -832,6 +1104,13 @@ AC_DEFUN([gl_INIT],
832 gl_WCTYPE_H 1104 gl_WCTYPE_H
833 gl_WCTYPE_H_REQUIRE_DEFAULTS 1105 gl_WCTYPE_H_REQUIRE_DEFAULTS
834 AC_PROG_MKDIR_P 1106 AC_PROG_MKDIR_P
1107 gl_FUNC_WCWIDTH
1108 gl_CONDITIONAL([GL_COND_OBJ_WCWIDTH],
1109 [test $HAVE_WCWIDTH = 0 || test $REPLACE_WCWIDTH = 1])
1110 AM_COND_IF([GL_COND_OBJ_WCWIDTH], [
1111 gl_PREREQ_WCWIDTH
1112 ])
1113 gl_WCHAR_MODULE_INDICATOR([wcwidth])
835 AC_REQUIRE([AC_CANONICAL_HOST]) 1114 AC_REQUIRE([AC_CANONICAL_HOST])
836 gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_MUTEX], 1115 gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_MUTEX],
837 [case "$host_os" in mingw* | windows*) true;; *) false;; esac]) 1116 [case "$host_os" in mingw* | windows*) true;; *) false;; esac])
@@ -871,27 +1150,35 @@ AC_DEFUN([gl_INIT],
871 gl_libobjs= 1150 gl_libobjs=
872 gl_ltlibobjs= 1151 gl_ltlibobjs=
873 gl_libobjdeps= 1152 gl_libobjdeps=
1153 gl_libgnu_libobjs=
1154 gl_libgnu_ltlibobjs=
1155 gl_libgnu_libobjdeps=
874 if test -n "$gl_LIBOBJS"; then 1156 if test -n "$gl_LIBOBJS"; then
875 # Remove the extension. 1157 # Remove the extension.
876changequote(,)dnl 1158changequote(,)dnl
877 sed_drop_objext='s/\.o$//;s/\.obj$//' 1159 sed_drop_objext='s/\.o$//;s/\.obj$//'
878 sed_dirname1='s,//*,/,g' 1160 sed_dirname1='s,//*,/,g'
879 sed_dirname2='s,\(.\)/$,\1,' 1161 sed_dirname2='s,\(.\)/$,\1,'
880 sed_dirname3='s,^[^/]*$,.,' 1162 sed_dirname3='s,[^/]*$,,'
881 sed_dirname4='s,\(.\)/[^/]*$,\1,'
882 sed_basename1='s,.*/,,' 1163 sed_basename1='s,.*/,,'
883changequote([, ])dnl 1164changequote([, ])dnl
884 for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do 1165 for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do
885 gl_libobjs="$gl_libobjs $i.$ac_objext" 1166 gl_libobjs="$gl_libobjs $i.$ac_objext"
886 gl_ltlibobjs="$gl_ltlibobjs $i.lo" 1167 gl_ltlibobjs="$gl_ltlibobjs $i.lo"
887 i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3" -e "$sed_dirname4"` 1168 i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3"`
888 i_base=`echo "$i" | sed -e "$sed_basename1"` 1169 i_base=`echo "$i" | sed -e "$sed_basename1"`
889 gl_libobjdeps="$gl_libobjdeps $i_dir/\$(DEPDIR)/$i_base.Po" 1170 gl_libgnu_libobjs="$gl_libgnu_libobjs $i_dir""libgnu_a-$i_base.$ac_objext"
1171 gl_libgnu_ltlibobjs="$gl_libgnu_ltlibobjs $i_dir""libgnu_la-$i_base.lo"
1172 gl_libobjdeps="$gl_libobjdeps $i_dir\$(DEPDIR)/$i_base.Po"
1173 gl_libgnu_libobjdeps="$gl_libgnu_libobjdeps $i_dir\$(DEPDIR)/libgnu_a-$i_base.Po"
890 done 1174 done
891 fi 1175 fi
892 AC_SUBST([gl_LIBOBJS], [$gl_libobjs]) 1176 AC_SUBST([gl_LIBOBJS], [$gl_libobjs])
893 AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs]) 1177 AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs])
894 AC_SUBST([gl_LIBOBJDEPS], [$gl_libobjdeps]) 1178 AC_SUBST([gl_LIBOBJDEPS], [$gl_libobjdeps])
1179 AC_SUBST([gl_libgnu_LIBOBJS], [$gl_libgnu_libobjs])
1180 AC_SUBST([gl_libgnu_LTLIBOBJS], [$gl_libgnu_ltlibobjs])
1181 AC_SUBST([gl_libgnu_LIBOBJDEPS], [$gl_libgnu_libobjdeps])
895 ]) 1182 ])
896 gltests_libdeps= 1183 gltests_libdeps=
897 gltests_ltlibdeps= 1184 gltests_ltlibdeps=
@@ -934,27 +1221,35 @@ changequote([, ])dnl
934 gltests_libobjs= 1221 gltests_libobjs=
935 gltests_ltlibobjs= 1222 gltests_ltlibobjs=
936 gltests_libobjdeps= 1223 gltests_libobjdeps=
1224 gltests_libgnu_libobjs=
1225 gltests_libgnu_ltlibobjs=
1226 gltests_libgnu_libobjdeps=
937 if test -n "$gltests_LIBOBJS"; then 1227 if test -n "$gltests_LIBOBJS"; then
938 # Remove the extension. 1228 # Remove the extension.
939changequote(,)dnl 1229changequote(,)dnl
940 sed_drop_objext='s/\.o$//;s/\.obj$//' 1230 sed_drop_objext='s/\.o$//;s/\.obj$//'
941 sed_dirname1='s,//*,/,g' 1231 sed_dirname1='s,//*,/,g'
942 sed_dirname2='s,\(.\)/$,\1,' 1232 sed_dirname2='s,\(.\)/$,\1,'
943 sed_dirname3='s,^[^/]*$,.,' 1233 sed_dirname3='s,[^/]*$,,'
944 sed_dirname4='s,\(.\)/[^/]*$,\1,'
945 sed_basename1='s,.*/,,' 1234 sed_basename1='s,.*/,,'
946changequote([, ])dnl 1235changequote([, ])dnl
947 for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do 1236 for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do
948 gltests_libobjs="$gltests_libobjs $i.$ac_objext" 1237 gltests_libobjs="$gltests_libobjs $i.$ac_objext"
949 gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" 1238 gltests_ltlibobjs="$gltests_ltlibobjs $i.lo"
950 i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3" -e "$sed_dirname4"` 1239 i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3"`
951 i_base=`echo "$i" | sed -e "$sed_basename1"` 1240 i_base=`echo "$i" | sed -e "$sed_basename1"`
952 gltests_libobjdeps="$gltests_libobjdeps $i_dir/\$(DEPDIR)/$i_base.Po" 1241 gltests_libgnu_libobjs="$gltests_libgnu_libobjs $i_dir""libgnu_a-$i_base.$ac_objext"
1242 gltests_libgnu_ltlibobjs="$gltests_libgnu_ltlibobjs $i_dir""libgnu_la-$i_base.lo"
1243 gltests_libobjdeps="$gltests_libobjdeps $i_dir\$(DEPDIR)/$i_base.Po"
1244 gltests_libgnu_libobjdeps="$gltests_libgnu_libobjdeps $i_dir\$(DEPDIR)/libgnu_a-$i_base.Po"
953 done 1245 done
954 fi 1246 fi
955 AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs]) 1247 AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs])
956 AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs]) 1248 AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs])
957 AC_SUBST([gltests_LIBOBJDEPS], [$gltests_libobjdeps]) 1249 AC_SUBST([gltests_LIBOBJDEPS], [$gltests_libobjdeps])
1250 AC_SUBST([gltests_libgnu_LIBOBJS], [$gltests_libgnu_libobjs])
1251 AC_SUBST([gltests_libgnu_LTLIBOBJS], [$gltests_libgnu_ltlibobjs])
1252 AC_SUBST([gltests_libgnu_LIBOBJDEPS], [$gltests_libgnu_libobjdeps])
958 ]) 1253 ])
959 AC_REQUIRE([gl_CC_GNULIB_WARNINGS]) 1254 AC_REQUIRE([gl_CC_GNULIB_WARNINGS])
960 LIBGNU_LIBDEPS="$gl_libdeps" 1255 LIBGNU_LIBDEPS="$gl_libdeps"
@@ -1025,6 +1320,7 @@ AC_DEFUN([gl_FILE_LIST], [
1025 lib/af_alg.h 1320 lib/af_alg.h
1026 lib/alloca.in.h 1321 lib/alloca.in.h
1027 lib/arg-nonnull.h 1322 lib/arg-nonnull.h
1323 lib/arpa_inet.c
1028 lib/arpa_inet.in.h 1324 lib/arpa_inet.in.h
1029 lib/asnprintf.c 1325 lib/asnprintf.c
1030 lib/asprintf.c 1326 lib/asprintf.c
@@ -1036,8 +1332,27 @@ AC_DEFUN([gl_FILE_LIST], [
1036 lib/basename-lgpl.h 1332 lib/basename-lgpl.h
1037 lib/basename.c 1333 lib/basename.c
1038 lib/btowc.c 1334 lib/btowc.c
1335 lib/byteswap.c
1039 lib/byteswap.in.h 1336 lib/byteswap.in.h
1040 lib/c++defs.h 1337 lib/c++defs.h
1338 lib/c-ctype.c
1339 lib/c-ctype.h
1340 lib/c32is-impl.h
1341 lib/c32isalnum.c
1342 lib/c32isalpha.c
1343 lib/c32isblank.c
1344 lib/c32iscntrl.c
1345 lib/c32isdigit.c
1346 lib/c32isgraph.c
1347 lib/c32islower.c
1348 lib/c32isprint.c
1349 lib/c32ispunct.c
1350 lib/c32isspace.c
1351 lib/c32isupper.c
1352 lib/c32isxdigit.c
1353 lib/c32to-impl.h
1354 lib/c32tolower.c
1355 lib/c32width.c
1041 lib/calloc.c 1356 lib/calloc.c
1042 lib/cdefs.h 1357 lib/cdefs.h
1043 lib/cloexec.c 1358 lib/cloexec.c
@@ -1071,6 +1386,8 @@ AC_DEFUN([gl_FILE_LIST], [
1071 lib/free.c 1386 lib/free.c
1072 lib/fseek.c 1387 lib/fseek.c
1073 lib/fseeko.c 1388 lib/fseeko.c
1389 lib/fseterr.c
1390 lib/fseterr.h
1074 lib/fstat.c 1391 lib/fstat.c
1075 lib/fsusage.c 1392 lib/fsusage.c
1076 lib/fsusage.h 1393 lib/fsusage.h
@@ -1098,6 +1415,8 @@ AC_DEFUN([gl_FILE_LIST], [
1098 lib/gl_openssl.h 1415 lib/gl_openssl.h
1099 lib/glthread/lock.c 1416 lib/glthread/lock.c
1100 lib/glthread/lock.h 1417 lib/glthread/lock.h
1418 lib/glthread/once.c
1419 lib/glthread/once.h
1101 lib/glthread/threadlib.c 1420 lib/glthread/threadlib.c
1102 lib/hard-locale.c 1421 lib/hard-locale.c
1103 lib/hard-locale.h 1422 lib/hard-locale.h
@@ -1107,6 +1426,7 @@ AC_DEFUN([gl_FILE_LIST], [
1107 lib/idpriv.h 1426 lib/idpriv.h
1108 lib/idx.h 1427 lib/idx.h
1109 lib/inet_ntop.c 1428 lib/inet_ntop.c
1429 lib/inet_pton.c
1110 lib/intprops-internal.h 1430 lib/intprops-internal.h
1111 lib/intprops.h 1431 lib/intprops.h
1112 lib/inttypes.in.h 1432 lib/inttypes.in.h
@@ -1127,6 +1447,7 @@ AC_DEFUN([gl_FILE_LIST], [
1127 lib/locale.in.h 1447 lib/locale.in.h
1128 lib/localeconv.c 1448 lib/localeconv.c
1129 lib/lseek.c 1449 lib/lseek.c
1450 lib/lstat.c
1130 lib/malloc.c 1451 lib/malloc.c
1131 lib/malloc/dynarray-skeleton.c 1452 lib/malloc/dynarray-skeleton.c
1132 lib/malloc/dynarray.h 1453 lib/malloc/dynarray.h
@@ -1139,10 +1460,16 @@ AC_DEFUN([gl_FILE_LIST], [
1139 lib/malloca.h 1460 lib/malloca.h
1140 lib/math.c 1461 lib/math.c
1141 lib/math.in.h 1462 lib/math.in.h
1463 lib/mbchar.c
1464 lib/mbchar.h
1465 lib/mbiterf.c
1466 lib/mbiterf.h
1467 lib/mbrtoc32.c
1142 lib/mbrtowc-impl-utf8.h 1468 lib/mbrtowc-impl-utf8.h
1143 lib/mbrtowc-impl.h 1469 lib/mbrtowc-impl.h
1144 lib/mbrtowc.c 1470 lib/mbrtowc.c
1145 lib/mbsinit.c 1471 lib/mbsinit.c
1472 lib/mbsnlen.c
1146 lib/mbszero.c 1473 lib/mbszero.c
1147 lib/mbtowc-impl.h 1474 lib/mbtowc-impl.h
1148 lib/mbtowc-lock.c 1475 lib/mbtowc-lock.c
@@ -1169,6 +1496,8 @@ AC_DEFUN([gl_FILE_LIST], [
1169 lib/printf-args.h 1496 lib/printf-args.h
1170 lib/printf-parse.c 1497 lib/printf-parse.c
1171 lib/printf-parse.h 1498 lib/printf-parse.h
1499 lib/pthread-once.c
1500 lib/pthread.in.h
1172 lib/realloc.c 1501 lib/realloc.c
1173 lib/reallocarray.c 1502 lib/reallocarray.c
1174 lib/regcomp.c 1503 lib/regcomp.c
@@ -1177,6 +1506,7 @@ AC_DEFUN([gl_FILE_LIST], [
1177 lib/regex_internal.c 1506 lib/regex_internal.c
1178 lib/regex_internal.h 1507 lib/regex_internal.h
1179 lib/regexec.c 1508 lib/regexec.c
1509 lib/sched.in.h
1180 lib/setenv.c 1510 lib/setenv.c
1181 lib/setlocale-lock.c 1511 lib/setlocale-lock.c
1182 lib/setlocale_null-unlocked.c 1512 lib/setlocale_null-unlocked.c
@@ -1197,10 +1527,12 @@ AC_DEFUN([gl_FILE_LIST], [
1197 lib/stdckdint.in.h 1527 lib/stdckdint.in.h
1198 lib/stddef.in.h 1528 lib/stddef.in.h
1199 lib/stdint.in.h 1529 lib/stdint.in.h
1530 lib/stdio-consolesafe.c
1200 lib/stdio-impl.h 1531 lib/stdio-impl.h
1201 lib/stdio-read.c 1532 lib/stdio-read.c
1202 lib/stdio-write.c 1533 lib/stdio-write.c
1203 lib/stdio.in.h 1534 lib/stdio.in.h
1535 lib/stdlib.c
1204 lib/stdlib.in.h 1536 lib/stdlib.in.h
1205 lib/str-two-way.h 1537 lib/str-two-way.h
1206 lib/strcasecmp.c 1538 lib/strcasecmp.c
@@ -1209,10 +1541,12 @@ AC_DEFUN([gl_FILE_LIST], [
1209 lib/strerror-override.c 1541 lib/strerror-override.c
1210 lib/strerror-override.h 1542 lib/strerror-override.h
1211 lib/strerror.c 1543 lib/strerror.c
1544 lib/string.c
1212 lib/string.in.h 1545 lib/string.in.h
1213 lib/strings.in.h 1546 lib/strings.in.h
1214 lib/stripslash.c 1547 lib/stripslash.c
1215 lib/strncasecmp.c 1548 lib/strncasecmp.c
1549 lib/strncpy.c
1216 lib/strsep.c 1550 lib/strsep.c
1217 lib/strstr.c 1551 lib/strstr.c
1218 lib/sys-limits.h 1552 lib/sys-limits.h
@@ -1224,8 +1558,46 @@ AC_DEFUN([gl_FILE_LIST], [
1224 lib/time.in.h 1558 lib/time.in.h
1225 lib/time_r.c 1559 lib/time_r.c
1226 lib/timegm.c 1560 lib/timegm.c
1561 lib/uchar.in.h
1562 lib/unicase.in.h
1563 lib/unicase/simple-mapping.h
1564 lib/unicase/tolower.c
1565 lib/unicase/tolower.h
1566 lib/unictype.in.h
1567 lib/unictype/bitmap.h
1568 lib/unictype/ctype_alnum.c
1569 lib/unictype/ctype_alnum.h
1570 lib/unictype/ctype_alpha.c
1571 lib/unictype/ctype_alpha.h
1572 lib/unictype/ctype_blank.c
1573 lib/unictype/ctype_blank.h
1574 lib/unictype/ctype_cntrl.c
1575 lib/unictype/ctype_cntrl.h
1576 lib/unictype/ctype_digit.c
1577 lib/unictype/ctype_digit.h
1578 lib/unictype/ctype_graph.c
1579 lib/unictype/ctype_graph.h
1580 lib/unictype/ctype_lower.c
1581 lib/unictype/ctype_lower.h
1582 lib/unictype/ctype_print.c
1583 lib/unictype/ctype_print.h
1584 lib/unictype/ctype_punct.c
1585 lib/unictype/ctype_punct.h
1586 lib/unictype/ctype_space.c
1587 lib/unictype/ctype_space.h
1588 lib/unictype/ctype_upper.c
1589 lib/unictype/ctype_upper.h
1590 lib/unictype/ctype_xdigit.c
1591 lib/unictype/ctype_xdigit.h
1592 lib/uninorm.in.h
1227 lib/unistd.c 1593 lib/unistd.c
1228 lib/unistd.in.h 1594 lib/unistd.in.h
1595 lib/unitypes.in.h
1596 lib/uniwidth.in.h
1597 lib/uniwidth/cjk.h
1598 lib/uniwidth/width.c
1599 lib/uniwidth/width0.h
1600 lib/uniwidth/width2.h
1229 lib/unlocked-io.h 1601 lib/unlocked-io.h
1230 lib/unsetenv.c 1602 lib/unsetenv.c
1231 lib/vasnprintf.c 1603 lib/vasnprintf.c
@@ -1233,6 +1605,7 @@ AC_DEFUN([gl_FILE_LIST], [
1233 lib/vasprintf.c 1605 lib/vasprintf.c
1234 lib/verify.h 1606 lib/verify.h
1235 lib/vsnprintf.c 1607 lib/vsnprintf.c
1608 lib/vsnzprintf.c
1236 lib/w32sock.h 1609 lib/w32sock.h
1237 lib/warn-on-use.h 1610 lib/warn-on-use.h
1238 lib/wchar.in.h 1611 lib/wchar.in.h
@@ -1241,6 +1614,7 @@ AC_DEFUN([gl_FILE_LIST], [
1241 lib/wctype-impl.h 1614 lib/wctype-impl.h
1242 lib/wctype.c 1615 lib/wctype.c
1243 lib/wctype.in.h 1616 lib/wctype.in.h
1617 lib/wcwidth.c
1244 lib/windows-initguard.h 1618 lib/windows-initguard.h
1245 lib/windows-mutex.c 1619 lib/windows-mutex.c
1246 lib/windows-mutex.h 1620 lib/windows-mutex.h
@@ -1265,20 +1639,22 @@ AC_DEFUN([gl_FILE_LIST], [
1265 m4/assert_h.m4 1639 m4/assert_h.m4
1266 m4/base64.m4 1640 m4/base64.m4
1267 m4/btowc.m4 1641 m4/btowc.m4
1642 m4/build-to-host.m4
1268 m4/builtin-expect.m4 1643 m4/builtin-expect.m4
1269 m4/byteswap.m4 1644 m4/byteswap.m4
1270 m4/c-bool.m4 1645 m4/c-bool.m4
1646 m4/c32rtomb.m4
1271 m4/calloc.m4 1647 m4/calloc.m4
1272 m4/close.m4 1648 m4/close.m4
1273 m4/codeset.m4 1649 m4/codeset.m4
1274 m4/double-slash-root.m4 1650 m4/double-slash-root.m4
1275 m4/dup2.m4 1651 m4/dup2.m4
1276 m4/eealloc.m4
1277 m4/environ.m4 1652 m4/environ.m4
1278 m4/errno_h.m4 1653 m4/errno_h.m4
1279 m4/error.m4 1654 m4/error.m4
1280 m4/error_h.m4 1655 m4/error_h.m4
1281 m4/exponentd.m4 1656 m4/exponentd.m4
1657 m4/extensions-aix.m4
1282 m4/extensions.m4 1658 m4/extensions.m4
1283 m4/extern-inline.m4 1659 m4/extern-inline.m4
1284 m4/fclose.m4 1660 m4/fclose.m4
@@ -1294,6 +1670,7 @@ AC_DEFUN([gl_FILE_LIST], [
1294 m4/free.m4 1670 m4/free.m4
1295 m4/fseek.m4 1671 m4/fseek.m4
1296 m4/fseeko.m4 1672 m4/fseeko.m4
1673 m4/fseterr.m4
1297 m4/fstat.m4 1674 m4/fstat.m4
1298 m4/fstypename.m4 1675 m4/fstypename.m4
1299 m4/fsusage.m4 1676 m4/fsusage.m4
@@ -1307,12 +1684,15 @@ AC_DEFUN([gl_FILE_LIST], [
1307 m4/getloadavg.m4 1684 m4/getloadavg.m4
1308 m4/getopt.m4 1685 m4/getopt.m4
1309 m4/getprogname.m4 1686 m4/getprogname.m4
1687 m4/gettext_h.m4
1310 m4/gl-openssl.m4 1688 m4/gl-openssl.m4
1311 m4/gnulib-common.m4 1689 m4/gnulib-common.m4
1690 m4/gnulib-i18n.m4
1312 m4/hostent.m4 1691 m4/hostent.m4
1313 m4/idpriv.m4 1692 m4/idpriv.m4
1314 m4/include_next.m4 1693 m4/include_next.m4
1315 m4/inet_ntop.m4 1694 m4/inet_ntop.m4
1695 m4/inet_pton.m4
1316 m4/intmax_t.m4 1696 m4/intmax_t.m4
1317 m4/inttypes.m4 1697 m4/inttypes.m4
1318 m4/inttypes_h.m4 1698 m4/inttypes_h.m4
@@ -1323,8 +1703,10 @@ AC_DEFUN([gl_FILE_LIST], [
1323 m4/iswxdigit.m4 1703 m4/iswxdigit.m4
1324 m4/langinfo_h.m4 1704 m4/langinfo_h.m4
1325 m4/largefile.m4 1705 m4/largefile.m4
1706 m4/libunistring-base.m4
1326 m4/limits-h.m4 1707 m4/limits-h.m4
1327 m4/localcharset.m4 1708 m4/localcharset.m4
1709 m4/locale-en.m4
1328 m4/locale-fr.m4 1710 m4/locale-fr.m4
1329 m4/locale-ja.m4 1711 m4/locale-ja.m4
1330 m4/locale-zh.m4 1712 m4/locale-zh.m4
@@ -1332,9 +1714,13 @@ AC_DEFUN([gl_FILE_LIST], [
1332 m4/localeconv.m4 1714 m4/localeconv.m4
1333 m4/lock.m4 1715 m4/lock.m4
1334 m4/lseek.m4 1716 m4/lseek.m4
1717 m4/lstat.m4
1335 m4/malloc.m4 1718 m4/malloc.m4
1336 m4/malloca.m4 1719 m4/malloca.m4
1337 m4/math_h.m4 1720 m4/math_h.m4
1721 m4/mbchar.m4
1722 m4/mbiter.m4
1723 m4/mbrtoc32.m4
1338 m4/mbrtowc.m4 1724 m4/mbrtowc.m4
1339 m4/mbsinit.m4 1725 m4/mbsinit.m4
1340 m4/mbstate_t.m4 1726 m4/mbstate_t.m4
@@ -1353,17 +1739,23 @@ AC_DEFUN([gl_FILE_LIST], [
1353 m4/netinet_in_h.m4 1739 m4/netinet_in_h.m4
1354 m4/nl_langinfo.m4 1740 m4/nl_langinfo.m4
1355 m4/nocrash.m4 1741 m4/nocrash.m4
1742 m4/off64_t.m4
1356 m4/off_t.m4 1743 m4/off_t.m4
1744 m4/once.m4
1357 m4/open-cloexec.m4 1745 m4/open-cloexec.m4
1358 m4/open-slash.m4 1746 m4/open-slash.m4
1359 m4/open.m4 1747 m4/open.m4
1360 m4/pathmax.m4 1748 m4/pathmax.m4
1361 m4/pid_t.m4 1749 m4/pid_t.m4
1362 m4/printf.m4 1750 m4/printf.m4
1751 m4/pthread-once.m4
1752 m4/pthread-spin.m4
1753 m4/pthread_h.m4
1363 m4/pthread_rwlock_rdlock.m4 1754 m4/pthread_rwlock_rdlock.m4
1364 m4/realloc.m4 1755 m4/realloc.m4
1365 m4/reallocarray.m4 1756 m4/reallocarray.m4
1366 m4/regex.m4 1757 m4/regex.m4
1758 m4/sched_h.m4
1367 m4/servent.m4 1759 m4/servent.m4
1368 m4/setenv.m4 1760 m4/setenv.m4
1369 m4/setlocale_null.m4 1761 m4/setlocale_null.m4
@@ -1379,18 +1771,23 @@ AC_DEFUN([gl_FILE_LIST], [
1379 m4/stat.m4 1771 m4/stat.m4
1380 m4/std-gnu11.m4 1772 m4/std-gnu11.m4
1381 m4/stdalign.m4 1773 m4/stdalign.m4
1774 m4/stdckdint_h.m4
1382 m4/stddef_h.m4 1775 m4/stddef_h.m4
1383 m4/stdint.m4 1776 m4/stdint.m4
1384 m4/stdint_h.m4 1777 m4/stdint_h.m4
1385 m4/stdio_h.m4 1778 m4/stdio_h.m4
1386 m4/stdlib_h.m4 1779 m4/stdlib_h.m4
1387 m4/strcase.m4 1780 m4/strcasecmp.m4
1388 m4/strcasestr.m4 1781 m4/strcasestr.m4
1389 m4/strerror.m4 1782 m4/strerror.m4
1390 m4/string_h.m4 1783 m4/string_h.m4
1784 m4/stringeq.m4
1391 m4/strings_h.m4 1785 m4/strings_h.m4
1786 m4/strncasecmp.m4
1787 m4/strncpy.m4
1392 m4/strsep.m4 1788 m4/strsep.m4
1393 m4/strstr.m4 1789 m4/strstr.m4
1790 m4/sys_cdefs_h.m4
1394 m4/sys_socket_h.m4 1791 m4/sys_socket_h.m4
1395 m4/sys_stat_h.m4 1792 m4/sys_stat_h.m4
1396 m4/sys_types_h.m4 1793 m4/sys_types_h.m4
@@ -1399,8 +1796,13 @@ AC_DEFUN([gl_FILE_LIST], [
1399 m4/time_h.m4 1796 m4/time_h.m4
1400 m4/time_r.m4 1797 m4/time_r.m4
1401 m4/timegm.m4 1798 m4/timegm.m4
1799 m4/uchar_h.m4
1402 m4/ungetc.m4 1800 m4/ungetc.m4
1801 m4/unicase_h.m4
1802 m4/unictype_h.m4
1803 m4/uninorm_h.m4
1403 m4/unistd_h.m4 1804 m4/unistd_h.m4
1805 m4/unitypes_h.m4
1404 m4/unlocked-io.m4 1806 m4/unlocked-io.m4
1405 m4/vararrays.m4 1807 m4/vararrays.m4
1406 m4/vasnprintf.m4 1808 m4/vasnprintf.m4
@@ -1409,10 +1811,10 @@ AC_DEFUN([gl_FILE_LIST], [
1409 m4/vsnprintf.m4 1811 m4/vsnprintf.m4
1410 m4/warn-on-use.m4 1812 m4/warn-on-use.m4
1411 m4/wchar_h.m4 1813 m4/wchar_h.m4
1412 m4/wchar_t.m4
1413 m4/wcrtomb.m4 1814 m4/wcrtomb.m4
1414 m4/wctype.m4 1815 m4/wctype.m4
1415 m4/wctype_h.m4 1816 m4/wctype_h.m4
1817 m4/wcwidth.m4
1416 m4/wint_t.m4 1818 m4/wint_t.m4
1417 m4/xalloc.m4 1819 m4/xalloc.m4
1418 m4/xsize.m4 1820 m4/xsize.m4
diff --git a/gl/m4/gnulib-i18n.m4 b/gl/m4/gnulib-i18n.m4
new file mode 100644
index 00000000..9a389187
--- /dev/null
+++ b/gl/m4/gnulib-i18n.m4
@@ -0,0 +1,61 @@
1# gnulib-i18n.m4
2# serial 1
3dnl Copyright (C) 2005-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl From Bruno Haible.
10
11dnl Support for internationalization of Gnulib code.
12
13dnl GNULIB_I18N
14dnl Sets GNULIB_LOCALEDIR to indicate where to find the gnulib.mo files.
15dnl Also it defines GNULIB_LOCALEDIR as macro in config.h, that expands to
16dnl the corresponding C string.
17AC_DEFUN([GNULIB_I18N],
18[
19 dnl It is best to not test "$USE_NLS" here, because: It would be empty
20 dnl in case the package is internationalized but this macro is used before
21 dnl AM_GNU_GETTEXT. We would need to warn about this situation. But since
22 dnl this module is used as a dependency of many packages, such a warning is
23 dnl not welcome.
24
25 dnl Determine gnulib's localedir.
26 dnl Generally, accept an option --with-gnulib-prefix=PREFIX to indicate
27 dnl where to find gnulib's runtime data.
28 dnl Usually ${prefix}/share/locale, but can be influenced by the configure
29 dnl options --datarootdir and --localedir.
30 GNULIB_LOCALEDIR="${localedir}"
31 AC_ARG_WITH([gnulib-prefix],
32 [[ --with-gnulib-prefix=DIR search for gnulib's runtime data in DIR/share]],
33 [if test "X$withval" != "X" && test "X$withval" != "Xno"; then
34 GNULIB_LOCALEDIR="$withval/share/locale"
35 fi
36 ])
37 AC_SUBST([GNULIB_LOCALEDIR])
38
39 dnl Define GNULIB_LOCALEDIR_c and GNULIB_LOCALEDIR_c_make.
40 dnl Find the final value of GNULIB_LOCALEDIR.
41 gl_saved_prefix="${prefix}"
42 gl_saved_datarootdir="${datarootdir}"
43 gl_saved_localedir="${localedir}"
44 gl_saved_gnuliblocaledir="${GNULIB_LOCALEDIR}"
45 dnl Unfortunately, prefix gets only finally determined at the end of
46 dnl configure.
47 if test "X$prefix" = "XNONE"; then
48 prefix="$ac_default_prefix"
49 fi
50 eval datarootdir="$datarootdir"
51 eval localedir="$localedir"
52 eval GNULIB_LOCALEDIR="$GNULIB_LOCALEDIR"
53 gl_BUILD_TO_HOST([GNULIB_LOCALEDIR])
54 GNULIB_LOCALEDIR="${gl_saved_gnuliblocaledir}"
55 localedir="${gl_saved_localedir}"
56 datarootdir="${gl_saved_datarootdir}"
57 prefix="${gl_saved_prefix}"
58
59 AC_DEFINE_UNQUOTED([GNULIB_LOCALEDIR], [${GNULIB_LOCALEDIR_c}],
60 [Define to the directory where to find the localizations of the translation domain 'gnulib', as a C string.])
61])
diff --git a/gl/m4/gnulib-tool.m4 b/gl/m4/gnulib-tool.m4
index ef45f51f..83d1e701 100644
--- a/gl/m4/gnulib-tool.m4
+++ b/gl/m4/gnulib-tool.m4
@@ -1,9 +1,10 @@
1# gnulib-tool.m4 1# gnulib-tool.m4
2# serial 4 2# serial 5
3dnl Copyright (C) 2004-2005, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2004-2005, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl The following macros need not be invoked explicitly. 9dnl The following macros need not be invoked explicitly.
9dnl Invoking them does nothing except to declare default arguments 10dnl Invoking them does nothing except to declare default arguments
@@ -42,6 +43,9 @@ AC_DEFUN([gl_LIB], [])
42dnl Usage: gl_LGPL or gl_LGPL([VERSION]) 43dnl Usage: gl_LGPL or gl_LGPL([VERSION])
43AC_DEFUN([gl_LGPL], []) 44AC_DEFUN([gl_LGPL], [])
44 45
46dnl Usage: gl_GPL([VERSION])
47AC_DEFUN([gl_GPL], [])
48
45dnl Usage: gl_MAKEFILE_NAME([FILENAME]) 49dnl Usage: gl_MAKEFILE_NAME([FILENAME])
46AC_DEFUN([gl_MAKEFILE_NAME], []) 50AC_DEFUN([gl_MAKEFILE_NAME], [])
47 51
diff --git a/gl/m4/hostent.m4 b/gl/m4/hostent.m4
index 36dc636e..0303ff80 100644
--- a/gl/m4/hostent.m4
+++ b/gl/m4/hostent.m4
@@ -1,9 +1,10 @@
1# hostent.m4 1# hostent.m4
2# serial 5 2# serial 5
3dnl Copyright (C) 2008, 2010-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008, 2010-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_HOSTENT], 9AC_DEFUN([gl_HOSTENT],
9[ 10[
diff --git a/gl/m4/idpriv.m4 b/gl/m4/idpriv.m4
index 53693527..a7091ad3 100644
--- a/gl/m4/idpriv.m4
+++ b/gl/m4/idpriv.m4
@@ -1,9 +1,10 @@
1# idpriv.m4 1# idpriv.m4
2# serial 1 2# serial 1
3dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_IDPRIV], 9AC_DEFUN([gl_IDPRIV],
9[ 10[
diff --git a/gl/m4/include_next.m4 b/gl/m4/include_next.m4
index 03e85251..a19f2dfd 100644
--- a/gl/m4/include_next.m4
+++ b/gl/m4/include_next.m4
@@ -1,9 +1,10 @@
1# include_next.m4 1# include_next.m4
2# serial 27 2# serial 27
3dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Paul Eggert and Derek Price. 9dnl From Paul Eggert and Derek Price.
9 10
diff --git a/gl/m4/inet_ntop.m4 b/gl/m4/inet_ntop.m4
index 168e17e0..62e7a575 100644
--- a/gl/m4/inet_ntop.m4
+++ b/gl/m4/inet_ntop.m4
@@ -1,9 +1,10 @@
1# inet_ntop.m4 1# inet_ntop.m4
2# serial 22 2# serial 23
3dnl Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-2006, 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_INET_NTOP], 9AC_DEFUN([gl_FUNC_INET_NTOP],
9[ 10[
@@ -18,6 +19,7 @@ AC_DEFUN([gl_FUNC_INET_NTOP],
18 dnl Solaris 8..10 provide inet_ntop in libnsl instead. 19 dnl Solaris 8..10 provide inet_ntop in libnsl instead.
19 dnl Solaris 2.6..7 provide inet_ntop in libresolv instead. 20 dnl Solaris 2.6..7 provide inet_ntop in libresolv instead.
20 dnl Haiku provides it in -lnetwork. 21 dnl Haiku provides it in -lnetwork.
22 dnl QNX provides it in -lsocket.
21 dnl Native Windows provides it in -lws2_32 instead, with a declaration in 23 dnl Native Windows provides it in -lws2_32 instead, with a declaration in
22 dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl 24 dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl
23 dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it). 25 dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it).
@@ -38,7 +40,7 @@ AC_DEFUN([gl_FUNC_INET_NTOP],
38 fi 40 fi
39 else 41 else
40 gl_saved_LIBS=$LIBS 42 gl_saved_LIBS=$LIBS
41 AC_SEARCH_LIBS([inet_ntop], [nsl resolv network], [], 43 AC_SEARCH_LIBS([inet_ntop], [nsl resolv network socket], [],
42 [AC_CHECK_FUNCS([inet_ntop]) 44 [AC_CHECK_FUNCS([inet_ntop])
43 if test $ac_cv_func_inet_ntop = no; then 45 if test $ac_cv_func_inet_ntop = no; then
44 HAVE_INET_NTOP=0 46 HAVE_INET_NTOP=0
diff --git a/gl/m4/inet_pton.m4 b/gl/m4/inet_pton.m4
new file mode 100644
index 00000000..150c3a07
--- /dev/null
+++ b/gl/m4/inet_pton.m4
@@ -0,0 +1,73 @@
1# inet_pton.m4
2# serial 21
3dnl Copyright (C) 2006, 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN([gl_FUNC_INET_PTON],
10[
11 AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
12
13 dnl Persuade Solaris <arpa/inet.h> to declare inet_pton.
14 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
15
16 AC_REQUIRE([AC_C_RESTRICT])
17
18 dnl Most platforms that provide inet_pton define it in libc.
19 dnl Solaris 8..10 provide inet_pton in libnsl instead.
20 dnl Solaris 2.6..7 provide inet_pton in libresolv instead.
21 dnl Haiku provides it in -lnetwork.
22 dnl QNX provides it in -lsocket.
23 dnl Native Windows provides it in -lws2_32 instead, with a declaration in
24 dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl
25 dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it).
26 HAVE_INET_PTON=1
27 INET_PTON_LIB=
28 gl_PREREQ_SYS_H_WINSOCK2
29 if test $HAVE_WINSOCK2_H = 1; then
30 dnl It needs to be overridden, because the stdcall calling convention
31 dnl is not compliant with POSIX. Set REPLACE_INET_PTON in order to avoid
32 dnl a name conflict at the linker level, even though the header file
33 dnl <ws2tcpip.h> declares inet_pton only if _WIN32_WINNT >= 0x0600.
34 REPLACE_INET_PTON=1
35 AC_CHECK_DECLS([inet_pton],,, [[#include <ws2tcpip.h>]])
36 if test $ac_cv_have_decl_inet_pton = yes; then
37 INET_PTON_LIB="-lws2_32"
38 else
39 HAVE_DECL_INET_PTON=0
40 fi
41 else
42 gl_saved_LIBS=$LIBS
43 AC_SEARCH_LIBS([inet_pton], [nsl resolv network socket], [],
44 [AC_CHECK_FUNCS([inet_pton])
45 if test $ac_cv_func_inet_pton = no; then
46 HAVE_INET_PTON=0
47 fi
48 ])
49 LIBS=$gl_saved_LIBS
50
51 if test "$ac_cv_search_inet_pton" != "no" \
52 && test "$ac_cv_search_inet_pton" != "none required"; then
53 INET_PTON_LIB="$ac_cv_search_inet_pton"
54 fi
55
56 AC_CHECK_HEADERS_ONCE([netdb.h])
57 AC_CHECK_DECLS([inet_pton],,,
58 [[#include <arpa/inet.h>
59 #if HAVE_NETDB_H
60 # include <netdb.h>
61 #endif
62 ]])
63 if test $ac_cv_have_decl_inet_pton = no; then
64 HAVE_DECL_INET_PTON=0
65 fi
66 fi
67 AC_SUBST([INET_PTON_LIB])
68])
69
70# Prerequisites of lib/inet_pton.c.
71AC_DEFUN([gl_PREREQ_INET_PTON], [
72 AC_REQUIRE([gl_SOCKET_FAMILIES])
73])
diff --git a/gl/m4/intmax_t.m4 b/gl/m4/intmax_t.m4
index 72858ea8..ad79536c 100644
--- a/gl/m4/intmax_t.m4
+++ b/gl/m4/intmax_t.m4
@@ -1,10 +1,11 @@
1# intmax_t.m4 1# intmax_t.m4
2# serial 9 2# serial 9
3dnl Copyright (C) 1997-2004, 2006-2007, 2009-2024 Free Software Foundation, 3dnl Copyright (C) 1997-2004, 2006-2007, 2009-2026 Free Software Foundation,
4dnl Inc. 4dnl Inc.
5dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
6dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
7dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
8 9
9dnl From Paul Eggert. 10dnl From Paul Eggert.
10 11
diff --git a/gl/m4/inttypes.m4 b/gl/m4/inttypes.m4
index c43cd162..ec17c237 100644
--- a/gl/m4/inttypes.m4
+++ b/gl/m4/inttypes.m4
@@ -1,9 +1,10 @@
1# inttypes.m4 1# inttypes.m4
2# serial 37 2# serial 37
3dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Derek Price, Bruno Haible. 9dnl From Derek Price, Bruno Haible.
9dnl Test whether <inttypes.h> is supported or must be substituted. 10dnl Test whether <inttypes.h> is supported or must be substituted.
diff --git a/gl/m4/inttypes_h.m4 b/gl/m4/inttypes_h.m4
index 3b9da5b0..ed9e7033 100644
--- a/gl/m4/inttypes_h.m4
+++ b/gl/m4/inttypes_h.m4
@@ -1,9 +1,10 @@
1# inttypes_h.m4 1# inttypes_h.m4
2# serial 10 2# serial 10
3dnl Copyright (C) 1997-2004, 2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 1997-2004, 2006, 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Paul Eggert. 9dnl From Paul Eggert.
9 10
diff --git a/gl/m4/iswblank.m4 b/gl/m4/iswblank.m4
index 4dc12d9a..2c301a97 100644
--- a/gl/m4/iswblank.m4
+++ b/gl/m4/iswblank.m4
@@ -1,9 +1,10 @@
1# iswblank.m4 1# iswblank.m4
2# serial 7 2# serial 7
3dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2011-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_ISWBLANK], 9AC_DEFUN([gl_FUNC_ISWBLANK],
9[ 10[
diff --git a/gl/m4/iswctype.m4 b/gl/m4/iswctype.m4
index 16031be4..3b179a76 100644
--- a/gl/m4/iswctype.m4
+++ b/gl/m4/iswctype.m4
@@ -1,9 +1,10 @@
1# iswctype.m4 1# iswctype.m4
2# serial 3 2# serial 3
3dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2011-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_ISWCTYPE], 9AC_DEFUN([gl_FUNC_ISWCTYPE],
9[ 10[
diff --git a/gl/m4/iswdigit.m4 b/gl/m4/iswdigit.m4
index 999acd28..7fca8167 100644
--- a/gl/m4/iswdigit.m4
+++ b/gl/m4/iswdigit.m4
@@ -1,9 +1,10 @@
1# iswdigit.m4 1# iswdigit.m4
2# serial 7 2# serial 9
3dnl Copyright (C) 2020-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2020-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_ISWDIGIT], 9AC_DEFUN([gl_FUNC_ISWDIGIT],
9[ 10[
@@ -11,7 +12,7 @@ AC_DEFUN([gl_FUNC_ISWDIGIT],
11 AC_REQUIRE([gl_WCTYPE_H]) 12 AC_REQUIRE([gl_WCTYPE_H])
12 AC_REQUIRE([gt_LOCALE_FR]) 13 AC_REQUIRE([gt_LOCALE_FR])
13 AC_REQUIRE([gt_LOCALE_JA]) 14 AC_REQUIRE([gt_LOCALE_JA])
14 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 15 AC_REQUIRE([gt_LOCALE_EN_UTF8])
15 AC_REQUIRE([gt_LOCALE_ZH_CN]) 16 AC_REQUIRE([gt_LOCALE_ZH_CN])
16 AC_REQUIRE([AC_CANONICAL_HOST]) 17 AC_REQUIRE([AC_CANONICAL_HOST])
17 18
@@ -26,14 +27,14 @@ AC_DEFUN([gl_FUNC_ISWDIGIT],
26 dnl is present. 27 dnl is present.
27changequote(,)dnl 28changequote(,)dnl
28 case "$host_os" in 29 case "$host_os" in
29 # Guess no on FreeBSD, NetBSD, Solaris, native Windows. 30 # Guess no on FreeBSD, NetBSD, OpenBSD, Solaris, native Windows, Haiku, Android.
30 freebsd* | dragonfly* | netbsd* | solaris* | mingw* | windows*) 31 freebsd* | dragonfly* | netbsd* | openbsd* | solaris* | mingw* | windows* | haiku* | *-android*)
31 gl_cv_func_iswdigit_works="guessing no" ;; 32 gl_cv_func_iswdigit_works="guessing no" ;;
32 # Guess yes otherwise. 33 # Guess yes otherwise.
33 *) gl_cv_func_iswdigit_works="guessing yes" ;; 34 *) gl_cv_func_iswdigit_works="guessing yes" ;;
34 esac 35 esac
35changequote([,])dnl 36changequote([,])dnl
36 if test $LOCALE_FR != none || test $LOCALE_JA != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_ZH_CN != none; then 37 if test $LOCALE_FR != none || test $LOCALE_JA != none || test "$LOCALE_EN_UTF8" != none || test $LOCALE_ZH_CN != none; then
37 AC_RUN_IFELSE( 38 AC_RUN_IFELSE(
38 [AC_LANG_SOURCE([[ 39 [AC_LANG_SOURCE([[
39#include <locale.h> 40#include <locale.h>
@@ -83,15 +84,15 @@ main (int argc, char *argv[])
83 if (!(is == 0)) 84 if (!(is == 0))
84 result |= 2; 85 result |= 2;
85 } 86 }
86 if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 87 if (strcmp ("$LOCALE_EN_UTF8", "none") != 0
87 && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 88 && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
88 { 89 {
89 /* This fails on FreeBSD 13.0, NetBSD 10.0, MSVC 14. */ 90 /* This fails on FreeBSD 13.0, NetBSD 10.0, OpenBSD 7.5, MSVC 14, Haiku, Android. */
90 /* U+0663 ARABIC-INDIC DIGIT THREE */ 91 /* U+0663 ARABIC-INDIC DIGIT THREE */
91 is = for_character ("\331\243", 2); 92 is = for_character ("\331\243", 2);
92 if (!(is == 0)) 93 if (!(is == 0))
93 result |= 4; 94 result |= 4;
94 /* This fails on FreeBSD 13.0, NetBSD 10.0, MSVC 14. */ 95 /* This fails on FreeBSD 13.0, NetBSD 10.0, OpenBSD 7.5, MSVC 14, Haiku, Android. */
95 /* U+FF11 FULLWIDTH DIGIT ONE */ 96 /* U+FF11 FULLWIDTH DIGIT ONE */
96 is = for_character ("\357\274\221", 3); 97 is = for_character ("\357\274\221", 3);
97 if (!(is == 0)) 98 if (!(is == 0))
diff --git a/gl/m4/iswpunct.m4 b/gl/m4/iswpunct.m4
index 1edf58aa..be312d6c 100644
--- a/gl/m4/iswpunct.m4
+++ b/gl/m4/iswpunct.m4
@@ -1,9 +1,10 @@
1# iswpunct.m4 1# iswpunct.m4
2# serial 2 2# serial 2
3dnl Copyright (C) 2023-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2023-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_ISWPUNCT], 9AC_DEFUN([gl_FUNC_ISWPUNCT],
9[ 10[
diff --git a/gl/m4/iswxdigit.m4 b/gl/m4/iswxdigit.m4
index 6085bf6b..2cb8e873 100644
--- a/gl/m4/iswxdigit.m4
+++ b/gl/m4/iswxdigit.m4
@@ -1,16 +1,17 @@
1# iswxdigit.m4 1# iswxdigit.m4
2# serial 7 2# serial 9
3dnl Copyright (C) 2020-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2020-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_ISWXDIGIT], 9AC_DEFUN([gl_FUNC_ISWXDIGIT],
9[ 10[
10 AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) 11 AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
11 AC_REQUIRE([gl_WCTYPE_H]) 12 AC_REQUIRE([gl_WCTYPE_H])
12 AC_REQUIRE([gt_LOCALE_JA]) 13 AC_REQUIRE([gt_LOCALE_JA])
13 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 14 AC_REQUIRE([gt_LOCALE_EN_UTF8])
14 AC_REQUIRE([gt_LOCALE_ZH_CN]) 15 AC_REQUIRE([gt_LOCALE_ZH_CN])
15 AC_REQUIRE([AC_CANONICAL_HOST]) 16 AC_REQUIRE([AC_CANONICAL_HOST])
16 17
@@ -25,14 +26,14 @@ AC_DEFUN([gl_FUNC_ISWXDIGIT],
25 dnl is present. 26 dnl is present.
26changequote(,)dnl 27changequote(,)dnl
27 case "$host_os" in 28 case "$host_os" in
28 # Guess no on FreeBSD, NetBSD, Solaris, native Windows. 29 # Guess no on FreeBSD, NetBSD, OpenBSD, Solaris, native Windows, Haiku, Android.
29 freebsd* | dragonfly* | netbsd* | solaris* | mingw* | windows*) 30 freebsd* | dragonfly* | netbsd* | openbsd* | solaris* | mingw* | windows* | haiku* | *-android*)
30 gl_cv_func_iswxdigit_works="guessing no" ;; 31 gl_cv_func_iswxdigit_works="guessing no" ;;
31 # Guess yes otherwise. 32 # Guess yes otherwise.
32 *) gl_cv_func_iswxdigit_works="guessing yes" ;; 33 *) gl_cv_func_iswxdigit_works="guessing yes" ;;
33 esac 34 esac
34changequote([,])dnl 35changequote([,])dnl
35 if test $LOCALE_JA != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_ZH_CN != none; then 36 if test $LOCALE_JA != none || test "$LOCALE_EN_UTF8" != none || test $LOCALE_ZH_CN != none; then
36 AC_RUN_IFELSE( 37 AC_RUN_IFELSE(
37 [AC_LANG_SOURCE([[ 38 [AC_LANG_SOURCE([[
38#include <locale.h> 39#include <locale.h>
@@ -73,15 +74,15 @@ main (int argc, char *argv[])
73 if (!(is == 0)) 74 if (!(is == 0))
74 result |= 1; 75 result |= 1;
75 } 76 }
76 if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 77 if (strcmp ("$LOCALE_EN_UTF8", "none") != 0
77 && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 78 && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
78 { 79 {
79 /* This fails on FreeBSD 13.0. */ 80 /* This fails on FreeBSD 13.0, Haiku, Android. */
80 /* U+0663 ARABIC-INDIC DIGIT THREE */ 81 /* U+0663 ARABIC-INDIC DIGIT THREE */
81 is = for_character ("\331\243", 2); 82 is = for_character ("\331\243", 2);
82 if (!(is == 0)) 83 if (!(is == 0))
83 result |= 2; 84 result |= 2;
84 /* This fails on NetBSD 10.0, MSVC 14. */ 85 /* This fails on NetBSD 10.0, OpenBSD 7.5, MSVC 14, Haiku, Android. */
85 /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */ 86 /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */
86 is = for_character ("\357\274\241", 3); 87 is = for_character ("\357\274\241", 3);
87 if (!(is == 0)) 88 if (!(is == 0))
diff --git a/gl/m4/langinfo_h.m4 b/gl/m4/langinfo_h.m4
index 5eee8a71..3ed8d593 100644
--- a/gl/m4/langinfo_h.m4
+++ b/gl/m4/langinfo_h.m4
@@ -1,9 +1,10 @@
1# langinfo_h.m4 1# langinfo_h.m4
2# serial 12 2# serial 14
3dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_LANGINFO_H], 9AC_DEFUN_ONCE([gl_LANGINFO_H],
9[ 10[
@@ -17,18 +18,17 @@ AC_DEFUN_ONCE([gl_LANGINFO_H],
17 18
18 dnl Determine whether <langinfo.h> exists. It is missing on mingw and BeOS. 19 dnl Determine whether <langinfo.h> exists. It is missing on mingw and BeOS.
19 HAVE_LANGINFO_CODESET=0 20 HAVE_LANGINFO_CODESET=0
20 HAVE_LANGINFO_T_FMT_AMPM=0
21 HAVE_LANGINFO_ALTMON=0 21 HAVE_LANGINFO_ALTMON=0
22 HAVE_LANGINFO_ABALTMON=0
22 HAVE_LANGINFO_ERA=0 23 HAVE_LANGINFO_ERA=0
23 HAVE_LANGINFO_YESEXPR=0
24 AC_CHECK_HEADERS_ONCE([langinfo.h]) 24 AC_CHECK_HEADERS_ONCE([langinfo.h])
25 if test $ac_cv_header_langinfo_h = yes; then 25 if test $ac_cv_header_langinfo_h = yes; then
26 HAVE_LANGINFO_H=1 26 HAVE_LANGINFO_H=1
27 dnl Determine what <langinfo.h> defines. 27 dnl Determine what <langinfo.h> defines.
28 dnl CODESET is missing on OpenBSD 3.8. 28 dnl CODESET is missing on OpenBSD 3.8.
29 dnl ERA etc. are missing on OpenBSD 6.7. 29 dnl ERA etc. are missing on OpenBSD 6.7.
30 dnl T_FMT_AMPM and YESEXPR, NOEXPR are missing on IRIX 5.3.
31 dnl ALTMON_* are missing on glibc 2.26 and many other systems. 30 dnl ALTMON_* are missing on glibc 2.26 and many other systems.
31 dnl ABALTMON_* are missing on glibc 2.41 and many other systems.
32 AC_CACHE_CHECK([whether langinfo.h defines CODESET], 32 AC_CACHE_CHECK([whether langinfo.h defines CODESET],
33 [gl_cv_header_langinfo_codeset], 33 [gl_cv_header_langinfo_codeset],
34 [AC_COMPILE_IFELSE( 34 [AC_COMPILE_IFELSE(
@@ -41,18 +41,6 @@ int a = CODESET;
41 if test $gl_cv_header_langinfo_codeset = yes; then 41 if test $gl_cv_header_langinfo_codeset = yes; then
42 HAVE_LANGINFO_CODESET=1 42 HAVE_LANGINFO_CODESET=1
43 fi 43 fi
44 AC_CACHE_CHECK([whether langinfo.h defines T_FMT_AMPM],
45 [gl_cv_header_langinfo_t_fmt_ampm],
46 [AC_COMPILE_IFELSE(
47 [AC_LANG_PROGRAM([[#include <langinfo.h>
48int a = T_FMT_AMPM;
49]])],
50 [gl_cv_header_langinfo_t_fmt_ampm=yes],
51 [gl_cv_header_langinfo_t_fmt_ampm=no])
52 ])
53 if test $gl_cv_header_langinfo_t_fmt_ampm = yes; then
54 HAVE_LANGINFO_T_FMT_AMPM=1
55 fi
56 AC_CACHE_CHECK([whether langinfo.h defines ALTMON_1], 44 AC_CACHE_CHECK([whether langinfo.h defines ALTMON_1],
57 [gl_cv_header_langinfo_altmon], 45 [gl_cv_header_langinfo_altmon],
58 [AC_COMPILE_IFELSE( 46 [AC_COMPILE_IFELSE(
@@ -65,6 +53,18 @@ int a = ALTMON_1;
65 if test $gl_cv_header_langinfo_altmon = yes; then 53 if test $gl_cv_header_langinfo_altmon = yes; then
66 HAVE_LANGINFO_ALTMON=1 54 HAVE_LANGINFO_ALTMON=1
67 fi 55 fi
56 AC_CACHE_CHECK([whether langinfo.h defines ABALTMON_1],
57 [gl_cv_header_langinfo_abaltmon],
58 [AC_COMPILE_IFELSE(
59 [AC_LANG_PROGRAM([[#include <langinfo.h>
60int a = ABALTMON_1;
61]])],
62 [gl_cv_header_langinfo_abaltmon=yes],
63 [gl_cv_header_langinfo_abaltmon=no])
64 ])
65 if test $gl_cv_header_langinfo_abaltmon = yes; then
66 HAVE_LANGINFO_ABALTMON=1
67 fi
68 AC_CACHE_CHECK([whether langinfo.h defines ERA], 68 AC_CACHE_CHECK([whether langinfo.h defines ERA],
69 [gl_cv_header_langinfo_era], 69 [gl_cv_header_langinfo_era],
70 [AC_COMPILE_IFELSE( 70 [AC_COMPILE_IFELSE(
@@ -77,27 +77,14 @@ int a = ERA;
77 if test $gl_cv_header_langinfo_era = yes; then 77 if test $gl_cv_header_langinfo_era = yes; then
78 HAVE_LANGINFO_ERA=1 78 HAVE_LANGINFO_ERA=1
79 fi 79 fi
80 AC_CACHE_CHECK([whether langinfo.h defines YESEXPR],
81 [gl_cv_header_langinfo_yesexpr],
82 [AC_COMPILE_IFELSE(
83 [AC_LANG_PROGRAM([[#include <langinfo.h>
84int a = YESEXPR;
85]])],
86 [gl_cv_header_langinfo_yesexpr=yes],
87 [gl_cv_header_langinfo_yesexpr=no])
88 ])
89 if test $gl_cv_header_langinfo_yesexpr = yes; then
90 HAVE_LANGINFO_YESEXPR=1
91 fi
92 else 80 else
93 HAVE_LANGINFO_H=0 81 HAVE_LANGINFO_H=0
94 fi 82 fi
95 AC_SUBST([HAVE_LANGINFO_H]) 83 AC_SUBST([HAVE_LANGINFO_H])
96 AC_SUBST([HAVE_LANGINFO_CODESET]) 84 AC_SUBST([HAVE_LANGINFO_CODESET])
97 AC_SUBST([HAVE_LANGINFO_T_FMT_AMPM])
98 AC_SUBST([HAVE_LANGINFO_ALTMON]) 85 AC_SUBST([HAVE_LANGINFO_ALTMON])
86 AC_SUBST([HAVE_LANGINFO_ABALTMON])
99 AC_SUBST([HAVE_LANGINFO_ERA]) 87 AC_SUBST([HAVE_LANGINFO_ERA])
100 AC_SUBST([HAVE_LANGINFO_YESEXPR])
101 88
102 dnl Check for declarations of anything we want to poison if the 89 dnl Check for declarations of anything we want to poison if the
103 dnl corresponding gnulib module is not in use. 90 dnl corresponding gnulib module is not in use.
diff --git a/gl/m4/largefile.m4 b/gl/m4/largefile.m4
index 2f824089..3134f336 100644
--- a/gl/m4/largefile.m4
+++ b/gl/m4/largefile.m4
@@ -1,9 +1,10 @@
1# largefile.m4 1# largefile.m4
2# serial 1 2# serial 4
3dnl Copyright 1992-1996, 1998-2024 Free Software Foundation, Inc. 3dnl Copyright 1992-1996, 1998-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Enable large files on systems where this is not the default. 9# Enable large files on systems where this is not the default.
9# Enable support for files on Linux file systems with 64-bit inode numbers. 10# Enable support for files on Linux file systems with 64-bit inode numbers.
@@ -88,7 +89,7 @@ m4_define([_AC_SYS_YEAR2038_OPTIONS], m4_normalize(
88# If you change this macro you may also need to change 89# If you change this macro you may also need to change
89# _AC_SYS_YEAR2038_OPTIONS. 90# _AC_SYS_YEAR2038_OPTIONS.
90AC_DEFUN([_AC_SYS_YEAR2038_PROBE], 91AC_DEFUN([_AC_SYS_YEAR2038_PROBE],
91[AC_CACHE_CHECK([for $CPPFLAGS option for timestamps after 2038], 92[AC_CACHE_CHECK([for $CC option to support timestamps after 2038],
92 [ac_cv_sys_year2038_opts], 93 [ac_cv_sys_year2038_opts],
93 [ac_save_CPPFLAGS="$CPPFLAGS" 94 [ac_save_CPPFLAGS="$CPPFLAGS"
94 ac_opt_found=no 95 ac_opt_found=no
@@ -234,7 +235,7 @@ m4_define([_AC_SYS_LARGEFILE_OPTIONS], m4_normalize(
234# If you change this macro you may also need to change 235# If you change this macro you may also need to change
235# _AC_SYS_LARGEFILE_OPTIONS. 236# _AC_SYS_LARGEFILE_OPTIONS.
236AC_DEFUN([_AC_SYS_LARGEFILE_PROBE], 237AC_DEFUN([_AC_SYS_LARGEFILE_PROBE],
237[AC_CACHE_CHECK([for $CPPFLAGS option for large files], 238[AC_CACHE_CHECK([for $CC option to support large files],
238 [ac_cv_sys_largefile_opts], 239 [ac_cv_sys_largefile_opts],
239 [ac_save_CPPFLAGS=$CPPFLAGS 240 [ac_save_CPPFLAGS=$CPPFLAGS
240 ac_opt_found=no 241 ac_opt_found=no
@@ -294,7 +295,7 @@ AC_CONFIG_COMMANDS_PRE([_AC_SYS_YEAR2038_ENABLE])])
294# By default, many hosts won't let programs access large files; 295# By default, many hosts won't let programs access large files;
295# one must use special compiler options to get large-file access to work. 296# one must use special compiler options to get large-file access to work.
296# For more details about this brain damage please see: 297# For more details about this brain damage please see:
297# http://www.unix.org/version2/whatsnew/lfs20mar.html 298# https://www.unix.org/version2/whatsnew/lfs20mar.html
298# Additionally, on Linux file systems with 64-bit inodes a file that happens 299# Additionally, on Linux file systems with 64-bit inodes a file that happens
299# to have a 64-bit inode number cannot be accessed by 32-bit applications on 300# to have a 64-bit inode number cannot be accessed by 32-bit applications on
300# Linux x86/x86_64. This can occur with file systems such as XFS and NFS. 301# Linux x86/x86_64. This can occur with file systems such as XFS and NFS.
@@ -354,8 +355,7 @@ AC_DEFUN([gl_LARGEFILE],
354 *) 355 *)
355 dnl Nothing to do on gnulib's side. 356 dnl Nothing to do on gnulib's side.
356 dnl A 64-bit off_t is 357 dnl A 64-bit off_t is
357 dnl - already the default on Mac OS X, FreeBSD, NetBSD, OpenBSD, IRIX, 358 dnl - already the default on Mac OS X, FreeBSD, NetBSD, OpenBSD, Cygwin,
358 dnl OSF/1, Cygwin,
359 dnl - enabled by _FILE_OFFSET_BITS=64 (ensured by AC_SYS_LARGEFILE) on 359 dnl - enabled by _FILE_OFFSET_BITS=64 (ensured by AC_SYS_LARGEFILE) on
360 dnl glibc, HP-UX, Solaris, 360 dnl glibc, HP-UX, Solaris,
361 dnl - enabled by _LARGE_FILES=1 (ensured by AC_SYS_LARGEFILE) on AIX, 361 dnl - enabled by _LARGE_FILES=1 (ensured by AC_SYS_LARGEFILE) on AIX,
diff --git a/gl/m4/libunistring-base.m4 b/gl/m4/libunistring-base.m4
new file mode 100644
index 00000000..f2f144ac
--- /dev/null
+++ b/gl/m4/libunistring-base.m4
@@ -0,0 +1,204 @@
1# libunistring-base.m4
2# serial 10
3dnl Copyright (C) 2010-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl From Paolo Bonzini and Bruno Haible.
10
11dnl gl_LIBUNISTRING_MODULE([VERSION], [Module])
12dnl Declares that the source files of Module should be compiled, unless we
13dnl are linking with libunistring and its version is >= the given VERSION.
14dnl Defines an automake conditional LIBUNISTRING_COMPILE_$MODULE that is
15dnl true if the source files of Module should be compiled.
16dnl This macro is to be used for public libunistring API, not for
17dnl undocumented API.
18dnl
19dnl You have to bump the VERSION argument to the next projected version
20dnl number each time you make a change that affects the behaviour of the
21dnl functions defined in Module (even if the sources of Module itself do not
22dnl change).
23dnl
24dnl This macro invocation must not occur in macros that are AC_REQUIREd.
25
26AC_DEFUN([gl_LIBUNISTRING_MODULE],
27[
28 AC_REQUIRE([gl_LIBUNISTRING_LIB_PREPARE])
29 dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from
30 dnl gl_LIBUNISTRING_CORE if that macro has been run.
31 gl_CONDITIONAL(AS_TR_CPP([LIBUNISTRING_COMPILE_$2]),
32 [gl_LIBUNISTRING_VERSION_CMP([$1])])
33])
34
35dnl gl_LIBUNISTRING_MODULE_WITH_VARIABLE([VERSION], [Module])
36dnl is like gl_LIBUNISTRING_MODULE([VERSION], [Module]), except that it also
37dnl defines an AC_SUBSTed autoconf variable GNULIB_$MODULE_DLL_VARIABLE.
38dnl What's the expansion of this autoconf variable?
39dnl - When building libunistring, it expands to LIBUNISTRING_DLL_VARIABLE.
40dnl (This is necessary because this token must be present in the .h files
41dnl when the .h files get installed.)
42dnl - When building gnulib or application code it expands to
43dnl - LIBUNISTRING_DLL_VARIABLE by default,
44dnl - if the automake conditional LIBUNISTRING_COMPILE_$MODULE evaluates
45dnl to true: the value of
46dnl ${module_indicator_prefix}_GNULIB_LIBUNISTRING_DLL_VARIABLE_NAME
47dnl (which usually is empty, unless explicitly set in configure.ac).
48dnl (This is necessary because when the conditional evaluates to false,
49dnl the application code expects to use the declared variable from the
50dnl installed libunistring; it's in this case that the
51dnl LIBUNISTRING_DLL_VARIABLE macro from the installed
52dnl <unistring/woe32dll.h> must be used.)
53dnl
54dnl This macro invocation must not occur in macros that are AC_REQUIREd.
55
56AC_DEFUN([gl_LIBUNISTRING_MODULE_WITH_VARIABLE],
57[
58 gl_LIBUNISTRING_MODULE([$1], [$2])
59 m4_ifndef([gl_IN_LIBUNISTRING],
60 [if test -z "${AS_TR_CPP([LIBUNISTRING_COMPILE_$2])_TRUE}"; then
61 GL_MODULE_INDICATOR_PREFIX[]_GNULIB_[]AS_TR_CPP([$2_DLL_VARIABLE])=$GL_MODULE_INDICATOR_PREFIX[]_GNULIB_LIBUNISTRING_DLL_VARIABLE_NAME
62 fi
63 ])
64])
65
66dnl gl_LIBUNISTRING_LIBHEADER([VERSION], [HeaderFile])
67dnl Declares that HeaderFile should be created, unless we are linking
68dnl with libunistring and its version is >= the given VERSION.
69dnl HeaderFile should be relative to the lib directory and end in '.h'.
70dnl Prepares for substituting LIBUNISTRING_HEADERFILE (to HeaderFile or empty).
71dnl
72dnl When we are linking with the already installed libunistring and its version
73dnl is < VERSION, we create HeaderFile here, because we may compile functions
74dnl (via gl_LIBUNISTRING_MODULE above) that are not contained in the installed
75dnl version.
76dnl When we are linking with the already installed libunistring and its version
77dnl is > VERSION, we don't create HeaderFile here: it could cause compilation
78dnl errors in other libunistring header files if some types are missing.
79dnl
80dnl You have to bump the VERSION argument to the next projected version
81dnl number each time you make a non-comment change to the HeaderFile.
82
83AC_DEFUN([gl_LIBUNISTRING_LIBHEADER],
84[
85 AC_REQUIRE([gl_LIBUNISTRING_LIB_PREPARE])
86 dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from
87 dnl gl_LIBUNISTRING_CORE if that macro has been run.
88 if gl_LIBUNISTRING_VERSION_CMP([$1]); then
89 dnl It is OK to use a .h file in lib/ from within tests/, but not vice
90 dnl versa.
91 if test -z "$LIBUNISTRING_[]AS_TR_CPP([$2])"; then
92 LIBUNISTRING_[]AS_TR_CPP([$2])="${gl_source_base_prefix}$2"
93 fi
94 else
95 LIBUNISTRING_[]AS_TR_CPP([$2])=
96 fi
97 AC_SUBST([LIBUNISTRING_]AS_TR_CPP([$2]))
98])
99
100dnl Miscellaneous preparations/initializations.
101
102AC_DEFUN([gl_LIBUNISTRING_LIB_PREPARE],
103[
104 dnl Ensure that HAVE_LIBUNISTRING is fully determined at this point.
105 m4_ifdef([gl_LIBUNISTRING], [AC_REQUIRE([gl_LIBUNISTRING])])
106
107 AC_REQUIRE([AC_PROG_AWK])
108
109dnl Sed expressions to extract the parts of a version number.
110changequote(,)
111gl_libunistring_sed_extract_major='/^[0-9]/{s/^\([0-9]*\).*/\1/p;q;}
112i\
1130
114q
115'
116gl_libunistring_sed_extract_minor='/^[0-9][0-9]*[.][0-9]/{s/^[0-9]*[.]\([0-9]*\).*/\1/p;q;}
117i\
1180
119q
120'
121gl_libunistring_sed_extract_subminor='/^[0-9][0-9]*[.][0-9][0-9]*[.][0-9]/{s/^[0-9]*[.][0-9]*[.]\([0-9]*\).*/\1/p;q;}
122i\
1230
124q
125'
126changequote([,])
127
128 if test "$HAVE_LIBUNISTRING" = yes; then
129 LIBUNISTRING_VERSION_MAJOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_major"`
130 LIBUNISTRING_VERSION_MINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_minor"`
131 LIBUNISTRING_VERSION_SUBMINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_subminor"`
132 fi
133
134 dnl Determine whether <unistring/woe32dll.h> from an installed libunistring
135 dnl is available.
136 m4_ifdef([gl_IN_LIBUNISTRING],
137 [dnl In libunistring, all .h files that declare variables need to
138 dnl #include <unistring/woe32dll.h>. This references the file
139 dnl unistring/woe32dll.h in libunistring.
140 HAVE_UNISTRING_WOE32DLL_H=1
141 ],
142 [dnl In gnulib or in applications, we need a #include <unistring/woe32dll.h>
143 dnl if and only if an installed libunistring is available.
144 if test "$HAVE_LIBUNISTRING" = yes; then
145 AC_CHECK_HEADERS([unistring/woe32dll.h],
146 [HAVE_UNISTRING_WOE32DLL_H=1],
147 [HAVE_UNISTRING_WOE32DLL_H=0])
148 else
149 HAVE_UNISTRING_WOE32DLL_H=0
150 fi
151 ])
152 AC_SUBST([HAVE_UNISTRING_WOE32DLL_H])
153])
154
155dnl gl_LIBUNISTRING_VERSION_CMP([VERSION])
156dnl Expands to a shell statement that evaluates to true if LIBUNISTRING_VERSION
157dnl is less than the VERSION argument.
158AC_DEFUN([gl_LIBUNISTRING_VERSION_CMP],
159[dnl VERSION = 999.9 means to evaluates to true always, i.e. to ignore
160dnl the installed libunistring regardless of its version.
161m4_if([$1], [999.9],
162[true],
163[ { test "$HAVE_LIBUNISTRING" != yes \
164 || {
165 dnl AS_LITERAL_IF exists and works fine since autoconf-2.59 at least.
166 AS_LITERAL_IF([$1],
167 [dnl This is the optimized variant, that assumes the argument is a literal:
168 m4_pushdef([requested_version_major],
169 [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^\([0-9]*\).*], [\1]), [])])
170 m4_pushdef([requested_version_minor],
171 [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^[0-9]*[.]\([0-9]*\).*], [\1]), [$1])])
172 m4_pushdef([requested_version_subminor],
173 [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^[0-9]*[.][0-9]*[.]\([0-9]*\).*], [\1]), [$1])])
174 test $LIBUNISTRING_VERSION_MAJOR -lt requested_version_major \
175 || { test $LIBUNISTRING_VERSION_MAJOR -eq requested_version_major \
176 && { test $LIBUNISTRING_VERSION_MINOR -lt requested_version_minor \
177 || { test $LIBUNISTRING_VERSION_MINOR -eq requested_version_minor \
178 && test $LIBUNISTRING_VERSION_SUBMINOR -lt requested_version_subminor
179 }
180 }
181 }
182 m4_popdef([requested_version_subminor])
183 m4_popdef([requested_version_minor])
184 m4_popdef([requested_version_major])
185 ],
186 [dnl This is the unoptimized variant:
187 requested_version_major=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_major"`
188 requested_version_minor=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_minor"`
189 requested_version_subminor=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_subminor"`
190 test $LIBUNISTRING_VERSION_MAJOR -lt $requested_version_major \
191 || { test $LIBUNISTRING_VERSION_MAJOR -eq $requested_version_major \
192 && { test $LIBUNISTRING_VERSION_MINOR -lt $requested_version_minor \
193 || { test $LIBUNISTRING_VERSION_MINOR -eq $requested_version_minor \
194 && test $LIBUNISTRING_VERSION_SUBMINOR -lt $requested_version_subminor
195 }
196 }
197 }
198 ])
199 }
200 }])])
201
202dnl gl_LIBUNISTRING_ARG_OR_ZERO([ARG], [ORIG]) expands to ARG if it is not the
203dnl same as ORIG, otherwise to 0.
204m4_define([gl_LIBUNISTRING_ARG_OR_ZERO], [m4_if([$1], [$2], [0], [$1])])
diff --git a/gl/m4/limits-h.m4 b/gl/m4/limits-h.m4
index 1b619e1e..048c8fab 100644
--- a/gl/m4/limits-h.m4
+++ b/gl/m4/limits-h.m4
@@ -1,9 +1,10 @@
1# limits-h.m4 1# limits-h.m4
2# serial 1 2# serial 1
3dnl Copyright 2016-2024 Free Software Foundation, Inc. 3dnl Copyright 2016-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Check whether limits.h has needed features. 9dnl Check whether limits.h has needed features.
9 10
diff --git a/gl/m4/localcharset.m4 b/gl/m4/localcharset.m4
index 807a5eed..8e2c2755 100644
--- a/gl/m4/localcharset.m4
+++ b/gl/m4/localcharset.m4
@@ -1,9 +1,10 @@
1# localcharset.m4 1# localcharset.m4
2# serial 8 2# serial 8
3dnl Copyright (C) 2002, 2004, 2006, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002, 2004, 2006, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_LOCALCHARSET], 9AC_DEFUN([gl_LOCALCHARSET],
9[ 10[
diff --git a/gl/m4/locale-en.m4 b/gl/m4/locale-en.m4
new file mode 100644
index 00000000..f5e035f3
--- /dev/null
+++ b/gl/m4/locale-en.m4
@@ -0,0 +1,138 @@
1# locale-en.m4
2# serial 1
3dnl Copyright (C) 2003-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl From Bruno Haible.
10
11dnl Determine the name of an English (or American English) locale with
12dnl UTF-8 encoding.
13AC_DEFUN_ONCE([gt_LOCALE_EN_UTF8],
14[
15 AC_REQUIRE([AC_CANONICAL_HOST])
16 AC_REQUIRE([AM_LANGINFO_CODESET])
17 AC_CACHE_CHECK([for an english Unicode locale], [gt_cv_locale_en_utf8], [
18 case "$host_os" in
19 *-musl* | midipix*)
20 dnl On musl libc, all kinds of ll_CC.UTF-8 locales exist, even without
21 dnl any locale file on disk. But they are effectively equivalent to the
22 dnl C.UTF-8 locale, except for locale categories (such as LC_MESSAGES)
23 dnl for which localizations (.mo files) have been installed.
24 gt_cv_locale_en_utf8=en_US.UTF-8
25 ;;
26 *)
27 AC_LANG_CONFTEST([AC_LANG_SOURCE([[
28#include <locale.h>
29#include <time.h>
30#if HAVE_LANGINFO_CODESET
31# include <langinfo.h>
32#endif
33#include <stdlib.h>
34#include <string.h>
35struct tm t;
36char buf[16];
37int main () {
38 /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl
39 imitates locale dependent behaviour by looking at the environment
40 variables, and all locales use the UTF-8 encoding. */
41#if !(defined __BEOS__ || defined __HAIKU__)
42 /* Check whether the given locale name is recognized by the system. */
43# if defined _WIN32 && !defined __CYGWIN__
44 /* On native Windows, setlocale(category, "") looks at the system settings,
45 not at the environment variables. Also, when an encoding suffix such
46 as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE
47 category of the locale to "C". */
48 if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL
49 || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
50 return 1;
51# else
52 if (setlocale (LC_ALL, "") == NULL) return 1;
53# endif
54 /* Check whether nl_langinfo(CODESET) is "UTF-8" or equivalent. */
55# if HAVE_LANGINFO_CODESET
56 {
57 const char *cs = nl_langinfo (CODESET);
58 if (!(strcmp (cs, "UTF-8") == 0 || strcmp (cs, "UTF8") == 0
59 || strcmp (cs, "utf-8") == 0 || strcmp (cs, "utf8") == 0))
60 return 1;
61 }
62# endif
63# ifdef __CYGWIN__
64 /* On Cygwin, avoid locale names without encoding suffix, because the
65 locale_charset() function relies on the encoding suffix. Note that
66 LC_ALL is set on the command line. */
67 if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1;
68# endif
69 /* Check the third month name. */
70 t.tm_year = 1975 - 1900; t.tm_mon = 3 - 1; t.tm_mday = 24;
71 if (strftime (buf, sizeof (buf), "%B", &t) < 5 || strcmp (buf, "March") != 0)
72 return 1;
73#endif
74#if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */
75 /* Check whether the decimal separator is a dot. */
76 if (localeconv () ->decimal_point[0] != '.') return 1;
77#endif
78 return 0;
79}
80 ]])])
81 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
82 case "$host_os" in
83 # Handle native Windows specially, because there setlocale() interprets
84 # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256",
85 # "en" or "eng" as "English" or "English_United States.1252",
86 # "fr" or "fra" as "French" or "French_France.1252",
87 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
88 # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932",
89 # and similar.
90 mingw* | windows*)
91 # Test for the hypothetical native Windows locale name.
92 if (LC_ALL='English_United States.65001' LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
93 gt_cv_locale_en_utf8='English_United States.65001'
94 else
95 # None found.
96 gt_cv_locale_en_utf8=none
97 fi
98 ;;
99 *)
100 # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
101 # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the
102 # configure script would override the LC_ALL setting. Likewise for
103 # LC_CTYPE, which is also set at the beginning of the configure script.
104 # Test for the locale name with explicit encoding suffix first
105 # (this is necessary on Haiku).
106 if (LC_ALL=en_US.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
107 gt_cv_locale_en_utf8=en_US.UTF-8
108 else
109 # Test for the locale name without encoding suffix.
110 if (LC_ALL=en_US LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
111 gt_cv_locale_en_utf8=en_US
112 else
113 # Test for the Solaris 10 locale name.
114 if (LC_ALL=en.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
115 gt_cv_locale_en_utf8=en.UTF-8
116 else
117 # None found.
118 gt_cv_locale_en_utf8=none
119 fi
120 fi
121 fi
122 ;;
123 esac
124 fi
125 rm -fr conftest*
126 ;;
127 esac
128 ])
129 LOCALE_EN_UTF8="$gt_cv_locale_en_utf8"
130 case "$LOCALE_EN_UTF8" in #(
131 '' | *[[\"\$\'*@<:@]]*)
132 dnl The empty value occurs when the conftest.c program above could not
133 dnl be compiled. The other values might cause trouble with sh or make.
134 AC_MSG_WARN([invalid locale "$LOCALE_EN_UTF8"; assuming "none"])
135 LOCALE_EN_UTF8=none;;
136 esac
137 AC_SUBST([LOCALE_EN_UTF8])
138])
diff --git a/gl/m4/locale-fr.m4 b/gl/m4/locale-fr.m4
index f8d7c543..097cefa6 100644
--- a/gl/m4/locale-fr.m4
+++ b/gl/m4/locale-fr.m4
@@ -1,9 +1,10 @@
1# locale-fr.m4 1# locale-fr.m4
2# serial 23 2# serial 25
3dnl Copyright (C) 2003, 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2005-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Bruno Haible. 9dnl From Bruno Haible.
9 10
@@ -71,8 +72,9 @@ int main () {
71 if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; 72 if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1;
72# if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ 73# if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */
73 /* Check whether the decimal separator is a comma. 74 /* Check whether the decimal separator is a comma.
74 On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point 75 On NetBSD 3.0 in the fr_FR.ISO8859-1 locale
75 are nl_langinfo(RADIXCHAR) are both ".". */ 76 and on Haiku in the fr_FR.UTF-8 locale,
77 localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */
76 if (localeconv () ->decimal_point[0] != ',') return 1; 78 if (localeconv () ->decimal_point[0] != ',') return 1;
77# endif 79# endif
78 return 0; 80 return 0;
@@ -82,10 +84,11 @@ int main () {
82 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then 84 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
83 case "$host_os" in 85 case "$host_os" in
84 # Handle native Windows specially, because there setlocale() interprets 86 # Handle native Windows specially, because there setlocale() interprets
85 # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", 87 # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256",
88 # "en" or "eng" as "English" or "English_United States.1252",
86 # "fr" or "fra" as "French" or "French_France.1252", 89 # "fr" or "fra" as "French" or "French_France.1252",
87 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", 90 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
88 # "ja" as "Japanese" or "Japanese_Japan.932", 91 # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932",
89 # and similar. 92 # and similar.
90 mingw* | windows*) 93 mingw* | windows*)
91 # Test for the native Windows locale name. 94 # Test for the native Windows locale name.
@@ -109,7 +112,7 @@ int main () {
109 if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 112 if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
110 gt_cv_locale_fr=fr_FR.ISO-8859-1 113 gt_cv_locale_fr=fr_FR.ISO-8859-1
111 else 114 else
112 # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name. 115 # Test for the AIX, FreeBSD, NetBSD, OpenBSD locale name.
113 if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 116 if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
114 gt_cv_locale_fr=fr_FR.ISO8859-1 117 gt_cv_locale_fr=fr_FR.ISO8859-1
115 else 118 else
@@ -153,7 +156,7 @@ AC_DEFUN_ONCE([gt_LOCALE_FR_UTF8],
153 *-musl* | midipix*) 156 *-musl* | midipix*)
154 dnl On musl libc, all kinds of ll_CC.UTF-8 locales exist, even without 157 dnl On musl libc, all kinds of ll_CC.UTF-8 locales exist, even without
155 dnl any locale file on disk. But they are effectively equivalent to the 158 dnl any locale file on disk. But they are effectively equivalent to the
156 dnl C.UTF-8 locale, except for locale categories (such as LC_MESSSAGES) 159 dnl C.UTF-8 locale, except for locale categories (such as LC_MESSAGES)
157 dnl for which localizations (.mo files) have been installed. 160 dnl for which localizations (.mo files) have been installed.
158 gt_cv_locale_fr_utf8=fr_FR.UTF-8 161 gt_cv_locale_fr_utf8=fr_FR.UTF-8
159 ;; 162 ;;
@@ -214,8 +217,9 @@ int main () {
214#endif 217#endif
215#if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ 218#if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */
216 /* Check whether the decimal separator is a comma. 219 /* Check whether the decimal separator is a comma.
217 On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point 220 On NetBSD 3.0 in the fr_FR.ISO8859-1 locale
218 are nl_langinfo(RADIXCHAR) are both ".". */ 221 and on Haiku in the fr_FR.UTF-8 locale,
222 localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */
219 if (localeconv () ->decimal_point[0] != ',') return 1; 223 if (localeconv () ->decimal_point[0] != ',') return 1;
220#endif 224#endif
221 return 0; 225 return 0;
@@ -224,10 +228,11 @@ int main () {
224 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then 228 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
225 case "$host_os" in 229 case "$host_os" in
226 # Handle native Windows specially, because there setlocale() interprets 230 # Handle native Windows specially, because there setlocale() interprets
227 # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", 231 # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256",
232 # "en" or "eng" as "English" or "English_United States.1252",
228 # "fr" or "fra" as "French" or "French_France.1252", 233 # "fr" or "fra" as "French" or "French_France.1252",
229 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", 234 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
230 # "ja" as "Japanese" or "Japanese_Japan.932", 235 # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932",
231 # and similar. 236 # and similar.
232 mingw* | windows*) 237 mingw* | windows*)
233 # Test for the hypothetical native Windows locale name. 238 # Test for the hypothetical native Windows locale name.
diff --git a/gl/m4/locale-ja.m4 b/gl/m4/locale-ja.m4
index 8423bcb9..ee4309ed 100644
--- a/gl/m4/locale-ja.m4
+++ b/gl/m4/locale-ja.m4
@@ -1,9 +1,10 @@
1# locale-ja.m4 1# locale-ja.m4
2# serial 18 2# serial 21
3dnl Copyright (C) 2003, 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2005-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Bruno Haible. 9dnl From Bruno Haible.
9 10
@@ -86,10 +87,11 @@ int main ()
86 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then 87 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
87 case "$host_os" in 88 case "$host_os" in
88 # Handle native Windows specially, because there setlocale() interprets 89 # Handle native Windows specially, because there setlocale() interprets
89 # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", 90 # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256",
91 # "en" or "eng" as "English" or "English_United States.1252",
90 # "fr" or "fra" as "French" or "French_France.1252", 92 # "fr" or "fra" as "French" or "French_France.1252",
91 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", 93 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
92 # "ja" as "Japanese" or "Japanese_Japan.932", 94 # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932",
93 # and similar. 95 # and similar.
94 mingw* | windows*) 96 mingw* | windows*)
95 # Note that on native Windows, the Japanese locale is 97 # Note that on native Windows, the Japanese locale is
@@ -110,11 +112,11 @@ int main ()
110 if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 112 if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
111 gt_cv_locale_ja=ja_JP.EUC-JP 113 gt_cv_locale_ja=ja_JP.EUC-JP
112 else 114 else
113 # Test for the HP-UX, OSF/1, NetBSD locale name. 115 # Test for the HP-UX, NetBSD locale name.
114 if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 116 if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
115 gt_cv_locale_ja=ja_JP.eucJP 117 gt_cv_locale_ja=ja_JP.eucJP
116 else 118 else
117 # Test for the IRIX, FreeBSD locale name. 119 # Test for the FreeBSD locale name.
118 if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 120 if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
119 gt_cv_locale_ja=ja_JP.EUC 121 gt_cv_locale_ja=ja_JP.EUC
120 else 122 else
diff --git a/gl/m4/locale-zh.m4 b/gl/m4/locale-zh.m4
index 7f1a10be..98975bdd 100644
--- a/gl/m4/locale-zh.m4
+++ b/gl/m4/locale-zh.m4
@@ -1,9 +1,10 @@
1# locale-zh.m4 1# locale-zh.m4
2# serial 18 2# serial 20
3dnl Copyright (C) 2003, 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2005-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Bruno Haible. 9dnl From Bruno Haible.
9 10
@@ -22,6 +23,7 @@ AC_DEFUN_ONCE([gt_LOCALE_ZH_CN],
22#endif 23#endif
23#include <stdlib.h> 24#include <stdlib.h>
24#include <string.h> 25#include <string.h>
26#include <wchar.h>
25struct tm t; 27struct tm t;
26char buf[16]; 28char buf[16];
27int main () 29int main ()
@@ -80,6 +82,19 @@ int main ()
80 single wide character. This excludes the GB2312 and GBK encodings. */ 82 single wide character. This excludes the GB2312 and GBK encodings. */
81 if (mblen ("\203\062\332\066", 5) != 4) 83 if (mblen ("\203\062\332\066", 5) != 4)
82 return 1; 84 return 1;
85 /* Check whether mbrtowc accept this character one byte at a time.
86 This excludes NetBSD 10.0. */
87 if (sizeof (wchar_t) > 2)
88 {
89 wchar_t wc;
90 mbstate_t state;
91 memset (&state, 0, sizeof (state));
92 if (!(mbrtowc (&wc, "\203", 1, &state) == (size_t)(-2)
93 && mbrtowc (&wc, "\062", 1, &state) == (size_t)(-2)
94 && mbrtowc (&wc, "\332", 1, &state) == (size_t)(-2)
95 && mbrtowc (&wc, "\066", 1, &state) == 1))
96 return 1;
97 }
83 return 0; 98 return 0;
84#endif 99#endif
85} 100}
@@ -87,10 +102,11 @@ int main ()
87 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then 102 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
88 case "$host_os" in 103 case "$host_os" in
89 # Handle native Windows specially, because there setlocale() interprets 104 # Handle native Windows specially, because there setlocale() interprets
90 # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", 105 # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256",
106 # "en" or "eng" as "English" or "English_United States.1252",
91 # "fr" or "fra" as "French" or "French_France.1252", 107 # "fr" or "fra" as "French" or "French_France.1252",
92 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", 108 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
93 # "ja" as "Japanese" or "Japanese_Japan.932", 109 # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932",
94 # and similar. 110 # and similar.
95 mingw* | windows*) 111 mingw* | windows*)
96 # Test for the hypothetical native Windows locale name. 112 # Test for the hypothetical native Windows locale name.
diff --git a/gl/m4/locale_h.m4 b/gl/m4/locale_h.m4
index cd1c81ec..aeda9f9d 100644
--- a/gl/m4/locale_h.m4
+++ b/gl/m4/locale_h.m4
@@ -1,9 +1,10 @@
1# locale_h.m4 1# locale_h.m4
2# serial 31 2# serial 39
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_LOCALE_H], 9AC_DEFUN_ONCE([gl_LOCALE_H],
9[ 10[
@@ -19,6 +20,26 @@ AC_DEFUN_ONCE([gl_LOCALE_H],
19 AC_REQUIRE([gl_STDDEF_H]) 20 AC_REQUIRE([gl_STDDEF_H])
20 21
21 AC_REQUIRE([gl_LOCALE_T]) 22 AC_REQUIRE([gl_LOCALE_T])
23 dnl On native Windows, there is a type '_locale_t' that can be used to
24 dnl define locale_t.
25 AC_CACHE_CHECK([whether locale.h defines _locale_t],
26 [gl_cv_header_locale_has_windows_locale_t],
27 [AC_COMPILE_IFELSE(
28 [AC_LANG_PROGRAM(
29 [[#include <locale.h>
30 _locale_t x;]],
31 [[]])],
32 [gl_cv_header_locale_has_windows_locale_t=yes],
33 [gl_cv_header_locale_has_windows_locale_t=no])
34 ])
35 if test $gl_cv_header_locale_has_windows_locale_t = yes; then
36 HAVE_WINDOWS_LOCALE_T=1
37 AC_DEFINE([HAVE_WINDOWS_LOCALE_T], [1],
38 [Define to 1 if <locale.h> defines the _locale_t type.])
39 else
40 HAVE_WINDOWS_LOCALE_T=0
41 fi
42 AC_SUBST([HAVE_WINDOWS_LOCALE_T])
22 43
23 dnl Solaris 11.0 defines the int_p_*, int_n_* members of 'struct lconv' 44 dnl Solaris 11.0 defines the int_p_*, int_n_* members of 'struct lconv'
24 dnl only if _LCONV_C99 is defined. 45 dnl only if _LCONV_C99 is defined.
@@ -42,8 +63,8 @@ AC_DEFUN_ONCE([gl_LOCALE_H],
42 63
43 dnl Check whether 'struct lconv' is complete. 64 dnl Check whether 'struct lconv' is complete.
44 dnl Bionic libc's 'struct lconv' is just a dummy. 65 dnl Bionic libc's 'struct lconv' is just a dummy.
45 dnl On OpenBSD 4.9, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin 1.5.x, 66 dnl On OpenBSD 4.9, HP-UX 11, Solaris 9, Cygwin 1.5.x, mingw, MSVC 9,
46 dnl mingw, MSVC 9, it lacks the int_p_* and int_n_* members. 67 dnl it lacks the int_p_* and int_n_* members.
47 AC_CACHE_CHECK([whether struct lconv is properly defined], 68 AC_CACHE_CHECK([whether struct lconv is properly defined],
48 [gl_cv_sys_struct_lconv_ok], 69 [gl_cv_sys_struct_lconv_ok],
49 [AC_COMPILE_IFELSE( 70 [AC_COMPILE_IFELSE(
@@ -86,7 +107,7 @@ AC_DEFUN_ONCE([gl_LOCALE_H],
86# include <xlocale.h> 107# include <xlocale.h>
87#endif 108#endif
88 ]], 109 ]],
89 [setlocale newlocale duplocale freelocale]) 110 [setlocale newlocale duplocale freelocale getlocalename_l])
90]) 111])
91 112
92dnl Checks to determine whether the system has the locale_t type, 113dnl Checks to determine whether the system has the locale_t type,
@@ -130,6 +151,7 @@ AC_DEFUN([gl_LOCALE_T],
130 fi 151 fi
131 fi 152 fi
132 AC_SUBST([HAVE_XLOCALE_H]) 153 AC_SUBST([HAVE_XLOCALE_H])
154 AC_SUBST([HAVE_LOCALE_T])
133]) 155])
134 156
135# gl_LOCALE_MODULE_INDICATOR([modulename]) 157# gl_LOCALE_MODULE_INDICATOR([modulename])
@@ -154,7 +176,11 @@ AC_DEFUN([gl_LOCALE_H_REQUIRE_DEFAULTS],
154 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALECONV]) 176 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALECONV])
155 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE]) 177 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE])
156 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE_NULL]) 178 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE_NULL])
179 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NEWLOCALE])
157 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUPLOCALE]) 180 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUPLOCALE])
181 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREELOCALE])
182 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOCALENAME_L])
183 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOCALENAME_L_UNSAFE])
158 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALENAME_UNSAFE]) 184 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALENAME_UNSAFE])
159 ]) 185 ])
160 m4_require(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS]) 186 m4_require(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS])
@@ -164,14 +190,16 @@ AC_DEFUN([gl_LOCALE_H_REQUIRE_DEFAULTS],
164AC_DEFUN([gl_LOCALE_H_DEFAULTS], 190AC_DEFUN([gl_LOCALE_H_DEFAULTS],
165[ 191[
166 dnl Assume proper GNU behavior unless another module says otherwise. 192 dnl Assume proper GNU behavior unless another module says otherwise.
167 HAVE_NEWLOCALE=1; AC_SUBST([HAVE_NEWLOCALE]) 193 HAVE_NEWLOCALE=1; AC_SUBST([HAVE_NEWLOCALE])
168 HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE]) 194 HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE])
169 HAVE_FREELOCALE=1; AC_SUBST([HAVE_FREELOCALE]) 195 HAVE_FREELOCALE=1; AC_SUBST([HAVE_FREELOCALE])
170 REPLACE_LOCALECONV=0; AC_SUBST([REPLACE_LOCALECONV]) 196 HAVE_GETLOCALENAME_L=1; AC_SUBST([HAVE_GETLOCALENAME_L])
171 REPLACE_SETLOCALE=0; AC_SUBST([REPLACE_SETLOCALE]) 197 REPLACE_LOCALECONV=0; AC_SUBST([REPLACE_LOCALECONV])
172 REPLACE_NEWLOCALE=0; AC_SUBST([REPLACE_NEWLOCALE]) 198 REPLACE_SETLOCALE=0; AC_SUBST([REPLACE_SETLOCALE])
173 REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE]) 199 REPLACE_NEWLOCALE=0; AC_SUBST([REPLACE_NEWLOCALE])
174 REPLACE_FREELOCALE=0; AC_SUBST([REPLACE_FREELOCALE]) 200 REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE])
175 REPLACE_STRUCT_LCONV=0; AC_SUBST([REPLACE_STRUCT_LCONV]) 201 REPLACE_FREELOCALE=0; AC_SUBST([REPLACE_FREELOCALE])
202 REPLACE_GETLOCALENAME_L=0; AC_SUBST([REPLACE_GETLOCALENAME_L])
203 REPLACE_STRUCT_LCONV=0; AC_SUBST([REPLACE_STRUCT_LCONV])
176 LOCALENAME_ENHANCE_LOCALE_FUNCS=0; AC_SUBST([LOCALENAME_ENHANCE_LOCALE_FUNCS]) 204 LOCALENAME_ENHANCE_LOCALE_FUNCS=0; AC_SUBST([LOCALENAME_ENHANCE_LOCALE_FUNCS])
177]) 205])
diff --git a/gl/m4/localeconv.m4 b/gl/m4/localeconv.m4
index 77d5684f..9fa31de8 100644
--- a/gl/m4/localeconv.m4
+++ b/gl/m4/localeconv.m4
@@ -1,9 +1,10 @@
1# localeconv.m4 1# localeconv.m4
2# serial 3 2# serial 3
3dnl Copyright (C) 2012-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2012-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_LOCALECONV], 9AC_DEFUN([gl_FUNC_LOCALECONV],
9[ 10[
diff --git a/gl/m4/lock.m4 b/gl/m4/lock.m4
index eb0fc6a1..7058fb30 100644
--- a/gl/m4/lock.m4
+++ b/gl/m4/lock.m4
@@ -1,9 +1,10 @@
1# lock.m4 1# lock.m4
2# serial 14 2# serial 15
3dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Bruno Haible. 9dnl From Bruno Haible.
9 10
@@ -11,8 +12,8 @@ AC_DEFUN([gl_LOCK],
11[ 12[
12 AC_REQUIRE([gl_THREADLIB]) 13 AC_REQUIRE([gl_THREADLIB])
13 if test "$gl_threads_api" = posix; then 14 if test "$gl_threads_api" = posix; then
14 # OSF/1 4.0 and Mac OS X 10.1 lack the pthread_rwlock_t type and the 15 # Mac OS X 10.1 lacks the pthread_rwlock_t type and the pthread_rwlock_*
15 # pthread_rwlock_* functions. 16 # functions.
16 has_rwlock=false 17 has_rwlock=false
17 AC_CHECK_TYPE([pthread_rwlock_t], 18 AC_CHECK_TYPE([pthread_rwlock_t],
18 [has_rwlock=true 19 [has_rwlock=true
diff --git a/gl/m4/lseek.m4 b/gl/m4/lseek.m4
index 0bc3d65e..342fc55b 100644
--- a/gl/m4/lseek.m4
+++ b/gl/m4/lseek.m4
@@ -1,9 +1,10 @@
1# lseek.m4 1# lseek.m4
2# serial 15 2# serial 15
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_LSEEK], 9AC_DEFUN([gl_FUNC_LSEEK],
9[ 10[
diff --git a/gl/m4/lstat.m4 b/gl/m4/lstat.m4
new file mode 100644
index 00000000..57df6fd9
--- /dev/null
+++ b/gl/m4/lstat.m4
@@ -0,0 +1,82 @@
1# lstat.m4
2# serial 36
3dnl Copyright (C) 1997-2001, 2003-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl From Jim Meyering.
10
11AC_DEFUN([gl_FUNC_LSTAT],
12[
13 AC_REQUIRE([AC_CANONICAL_HOST])
14 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
15 dnl If lstat does not exist, the replacement <sys/stat.h> does
16 dnl "#define lstat stat", and lstat.c is a no-op.
17 AC_CHECK_FUNCS_ONCE([lstat])
18 if test $ac_cv_func_lstat = yes; then
19 AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
20 case $host_os,$gl_cv_func_lstat_dereferences_slashed_symlink in
21 darwin* | solaris* | *no)
22 REPLACE_LSTAT=1
23 ;;
24 esac
25 else
26 HAVE_LSTAT=0
27 fi
28])
29
30# Prerequisites of lib/lstat.c.
31AC_DEFUN([gl_PREREQ_LSTAT], [:])
32
33AC_DEFUN([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK],
34[
35 dnl We don't use AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK any more, because it
36 dnl is no longer maintained in Autoconf and because it invokes AC_LIBOBJ.
37 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
38 AC_CACHE_CHECK([whether lstat correctly handles trailing slash],
39 [gl_cv_func_lstat_dereferences_slashed_symlink],
40 [rm -f conftest.sym conftest.file
41 echo >conftest.file
42 AC_RUN_IFELSE(
43 [AC_LANG_PROGRAM(
44 [AC_INCLUDES_DEFAULT],
45 [[struct stat sbuf;
46 if (symlink ("conftest.file", "conftest.sym") != 0)
47 return 1;
48 /* Linux will dereference the symlink and fail, as required by
49 POSIX. That is better in the sense that it means we will not
50 have to compile and use the lstat wrapper. */
51 return lstat ("conftest.sym/", &sbuf) == 0;
52 ]])],
53 [gl_cv_func_lstat_dereferences_slashed_symlink=yes],
54 [gl_cv_func_lstat_dereferences_slashed_symlink=no],
55 [case "$host_os" in
56 linux-* | linux)
57 # Guess yes on Linux systems.
58 gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;
59 midipix*)
60 # Guess yes on systems that emulate the Linux system calls.
61 gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;
62 *-gnu* | gnu*)
63 # Guess yes on glibc systems.
64 gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;
65 mingw* | windows*)
66 # Guess no on native Windows.
67 gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;;
68 *)
69 # If we don't know, obey --enable-cross-guesses.
70 gl_cv_func_lstat_dereferences_slashed_symlink="$gl_cross_guess_normal" ;;
71 esac
72 ])
73 rm -f conftest.sym conftest.file
74 ])
75 case "$gl_cv_func_lstat_dereferences_slashed_symlink" in
76 *yes)
77 AC_DEFINE_UNQUOTED([LSTAT_FOLLOWS_SLASHED_SYMLINK], [1],
78 [Define to 1 if 'lstat' dereferences a symlink specified
79 with a trailing slash.])
80 ;;
81 esac
82])
diff --git a/gl/m4/malloc.m4 b/gl/m4/malloc.m4
index 41a46937..a95e33db 100644
--- a/gl/m4/malloc.m4
+++ b/gl/m4/malloc.m4
@@ -1,12 +1,24 @@
1# malloc.m4 1# malloc.m4
2# serial 31 2# serial 46
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# This is adapted with modifications from upstream Autoconf here: 9m4_version_prereq([2.73], [], [
9# https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n949 10# Modules that use this macro directly or indirectly should depend
11# on extensions-aix, so that _LINUX_SOURCE_COMPAT gets defined
12# before this macro gets invoked. This helps on AIX 7.2 and earlier
13# if !(__VEC__ || __AIXVEC), and doesn't hurt otherwise.
14#
15# This is copied from upstream Autoconf here:
16# https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=1f38316f6af7bf63e5e7dd187ff6456e07ad743e#n971
17# _AC_FUNC_MALLOC_IF(IF-WORKS, IF-NOT[, UNKNOWN-ASSUME])
18# ------------------------------------------------------
19# If 'malloc (0)' returns nonnull, run IF-WORKS, otherwise, IF-NOT.
20# If it is not known whether it works, assume the shell word UNKNOWN-ASSUME,
21# which should end in "yes" or in something else (the latter is the default).
10AC_DEFUN([_AC_FUNC_MALLOC_IF], 22AC_DEFUN([_AC_FUNC_MALLOC_IF],
11[ 23[
12 AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles 24 AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
@@ -15,56 +27,81 @@ AC_DEFUN([_AC_FUNC_MALLOC_IF],
15 [AC_RUN_IFELSE( 27 [AC_RUN_IFELSE(
16 [AC_LANG_PROGRAM( 28 [AC_LANG_PROGRAM(
17 [[#include <stdlib.h> 29 [[#include <stdlib.h>
18 ]], 30 /* Use pmalloc to test; 'volatile' prevents the compiler
19 [[void *p = malloc (0); 31 from optimizing the malloc call away. */
20 void * volatile vp = p; 32 void *(*volatile pmalloc) (size_t) = malloc;]],
21 int result = !vp; 33 [[void *p = pmalloc (0);
34 int result = !p;
22 free (p); 35 free (p);
23 return result;]]) 36 return result;]])],
24 ],
25 [ac_cv_func_malloc_0_nonnull=yes], 37 [ac_cv_func_malloc_0_nonnull=yes],
26 [ac_cv_func_malloc_0_nonnull=no], 38 [ac_cv_func_malloc_0_nonnull=no],
27 [case "$host_os" in 39 [AS_CASE([$host_os],
28 # Guess yes on platforms where we know the result. 40 [# Guess yes on platforms where we know the result.
29 *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ 41 *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \
30 | gnu* | *-musl* | midipix* | midnightbsd* \ 42 | gnu* | *-musl* | midipix* | midnightbsd* \
31 | hpux* | solaris* | cygwin* | mingw* | windows* | msys* ) 43 | hpux* | solaris* | cygwin* | mingw* | windows* | msys*],
32 ac_cv_func_malloc_0_nonnull="guessing yes" ;; 44 [ac_cv_func_malloc_0_nonnull="guessing yes"],
33 # If we don't know, obey --enable-cross-guesses. 45 [# Guess as follows if we don't know.
34 *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;; 46 ac_cv_func_malloc_0_nonnull=m4_default([$3], ["guessing no"])])])])
35 esac
36 ])
37 ])
38 AS_CASE([$ac_cv_func_malloc_0_nonnull], [*yes], [$1], [$2]) 47 AS_CASE([$ac_cv_func_malloc_0_nonnull], [*yes], [$1], [$2])
39])# _AC_FUNC_MALLOC_IF 48])# _AC_FUNC_MALLOC_IF
49])
50
51# gl_FUNC_MALLOC_0_NONNULL
52# ------------------------
53# If 'malloc (0)' returns nonnull define HAVE_MALLOC_0_NONNULL.
54# Also, set ac_cv_func_malloc_0_nonnull to a string that ends in
55# "yes", otherwise set it to something else. If unknown whether
56# malloc (0) works, guess as normal for cross-builds.
57AC_DEFUN([gl_FUNC_MALLOC_0_NONNULL],
58[
59 _AC_FUNC_MALLOC_IF(
60 [AC_DEFINE([HAVE_MALLOC_0_NONNULL], [1],
61 [Define to 1 if malloc (0) returns nonnull.])],
62 [],
63 ["$gl_cross_guess_normal"])
64])
40 65
41# gl_FUNC_MALLOC_GNU 66# gl_FUNC_MALLOC_GNU
42# ------------------ 67# ------------------
43# Replace malloc if it is not compatible with GNU libc. 68# Test whether malloc (0) is compatible with GNU libc.
69# Replace malloc if not.
70# Define HAVE_MALLOC_0_NONNULL if malloc (0) returns nonnull (except upon
71# out-of-memory).
72# Define HAVE_MALLOC_PTRDIFF if malloc (N) reliably fails when N exceeds
73# PTRDIFF_MAX.
44AC_DEFUN([gl_FUNC_MALLOC_GNU], 74AC_DEFUN([gl_FUNC_MALLOC_GNU],
45[ 75[
46 AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) 76 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
47 AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) 77 AC_REQUIRE([gl_FUNC_MALLOC_POSIX])
48 REPLACE_MALLOC_FOR_MALLOC_GNU="$REPLACE_MALLOC_FOR_MALLOC_POSIX" 78 AC_REQUIRE([gl_FUNC_MALLOC_0_NONNULL])
49 if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 0; then 79
50 _AC_FUNC_MALLOC_IF([], [REPLACE_MALLOC_FOR_MALLOC_GNU=1]) 80 AS_CASE([$ac_cv_func_malloc_0_nonnull],
51 fi 81 [*yes],
82 [REPLACE_MALLOC_FOR_MALLOC_GNU=$REPLACE_MALLOC_FOR_MALLOC_POSIX],
83 [REPLACE_MALLOC_FOR_MALLOC_GNU=1])
52]) 84])
53 85
54# gl_FUNC_MALLOC_PTRDIFF 86# gl_FUNC_MALLOC_PTRDIFF
55# ---------------------- 87# ----------------------
56# Test whether malloc (N) reliably fails when N exceeds PTRDIFF_MAX, 88# Test whether malloc (N) reliably fails when N exceeds PTRDIFF_MAX.
57# and replace malloc otherwise. 89# Define HAVE_MALLOC_PTRDIFF if yes.
90# Replace malloc if not.
58AC_DEFUN([gl_FUNC_MALLOC_PTRDIFF], 91AC_DEFUN([gl_FUNC_MALLOC_PTRDIFF],
59[ 92[
60 AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) 93 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
61 AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) 94 AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF])
62 test "$gl_cv_malloc_ptrdiff" = yes || REPLACE_MALLOC_FOR_MALLOC_POSIX=1 95 AS_IF([test "$gl_cv_malloc_ptrdiff" = yes],
96 [AC_DEFINE([HAVE_MALLOC_PTRDIFF], 1,
97 [Define to 1 if malloc-like functions do not allocate objects
98 larger than PTRDIFF_MAX bytes.])],
99 [REPLACE_MALLOC_FOR_MALLOC_POSIX=1])
63]) 100])
64 101
65# Test whether malloc, realloc, calloc refuse to create objects 102# Test whether malloc, calloc refuse to create objects
66# larger than what can be expressed in ptrdiff_t. 103# larger than what can be expressed in ptrdiff_t.
67# Set gl_cv_func_malloc_gnu to yes or no accordingly. 104# Set gl_cv_func_malloc_gnu.
68AC_DEFUN([gl_CHECK_MALLOC_PTRDIFF], 105AC_DEFUN([gl_CHECK_MALLOC_PTRDIFF],
69[ 106[
70 AC_CACHE_CHECK([whether malloc is ptrdiff_t safe], 107 AC_CACHE_CHECK([whether malloc is ptrdiff_t safe],
@@ -108,64 +145,84 @@ AC_DEFUN([gl_FUNC_MALLOC_POSIX],
108 AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) 145 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
109 AC_REQUIRE([gl_FUNC_MALLOC_PTRDIFF]) 146 AC_REQUIRE([gl_FUNC_MALLOC_PTRDIFF])
110 AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) 147 AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
111 if test "$gl_cv_func_malloc_posix" = yes; then 148 case "$gl_cv_func_malloc_posix" in
112 AC_DEFINE([HAVE_MALLOC_POSIX], [1], 149 *yes)
113 [Define if malloc, realloc, and calloc set errno on allocation failure.]) 150 AC_DEFINE([HAVE_MALLOC_POSIX], [1],
114 else 151 [Define if malloc and calloc set errno on allocation failure.])
115 REPLACE_MALLOC_FOR_MALLOC_POSIX=1 152 ;;
116 fi 153 *)
154 REPLACE_MALLOC_FOR_MALLOC_POSIX=1
155 ;;
156 esac
117]) 157])
118 158
119# Test whether malloc, realloc, calloc set errno to ENOMEM on failure. 159# Test whether malloc, calloc set errno to ENOMEM on failure.
120# Set gl_cv_func_malloc_posix to yes or no accordingly. 160# Set gl_cv_func_malloc_posix to *yes or *no accordingly.
121AC_DEFUN([gl_CHECK_MALLOC_POSIX], 161AC_DEFUN([gl_CHECK_MALLOC_POSIX],
122[ 162[
123 AC_REQUIRE([AC_CANONICAL_HOST]) 163 AC_REQUIRE([AC_CANONICAL_HOST])
124 AC_CACHE_CHECK([whether malloc, realloc, calloc set errno on failure], 164 AC_CACHE_CHECK([whether malloc, calloc set errno on failure],
125 [gl_cv_func_malloc_posix], 165 [gl_cv_func_malloc_posix],
126 [ 166 [
127 dnl It is too dangerous to try to allocate a large amount of memory: 167 dnl It is too dangerous to try to allocate a large amount of memory:
128 dnl some systems go to their knees when you do that. So assume that 168 dnl some systems go to their knees when you do that. So assume that
129 dnl all Unix implementations of the function set errno on failure, 169 dnl all Unix implementations of the function set errno on failure,
130 dnl except on those platforms where we have seen 'test-malloc-gnu', 170 dnl except on those platforms where we have seen 'test-malloc-gnu',
131 dnl 'test-realloc-gnu', 'test-calloc-gnu' fail. 171 dnl 'test-realloc-posix', 'test-calloc-gnu' fail. For platforms
172 dnl where only 'test-realloc-posix', see realloc.m4.
132 case "$host_os" in 173 case "$host_os" in
133 mingw* | windows*) 174 mingw* | windows*)
134 gl_cv_func_malloc_posix=no ;; 175 dnl Old MSVCRT from 2001 did not set errno=ENOMEM when malloc failed.
135 irix* | solaris*) 176 dnl More recent MSVCRT from 2019 does so.
136 dnl On IRIX 6.5, the three functions return NULL with errno unset 177 dnl UCRT is the successor of MSVCRT. Assume that UCRT does so as well.
137 dnl when the argument is larger than PTRDIFF_MAX. 178 AC_COMPILE_IFELSE(
138 dnl On Solaris 11.3, the three functions return NULL with errno set 179 [AC_LANG_PROGRAM(
180 [[#include <stdio.h>
181 #ifndef _UCRT
182 msvcrt yuck
183 #endif
184 ]],
185 [[]])
186 ],
187 [gl_cv_func_malloc_posix="guessing yes"],
188 [gl_cv_func_malloc_posix="guessing no"])
189 ;;
190 solaris*)
191 dnl On Solaris 11.3, the three functions might fail with errno set
139 dnl to EAGAIN, not ENOMEM, when the argument is larger than 192 dnl to EAGAIN, not ENOMEM, when the argument is larger than
140 dnl PTRDIFF_MAX. 193 dnl PTRDIFF_MAX. See:
194 dnl https://lists.gnu.org/r/bug-gnulib/2021-05/msg00052.html
141 dnl Here is a test program: 195 dnl Here is a test program:
196
142m4_divert_push([KILL]) 197m4_divert_push([KILL])
143#include <errno.h> 198#include <errno.h>
199#include <stddef.h>
144#include <stdio.h> 200#include <stdio.h>
201#include <stdint.h>
145#include <stdlib.h> 202#include <stdlib.h>
146#define ptrdiff_t long
147#ifndef PTRDIFF_MAX
148# define PTRDIFF_MAX ((ptrdiff_t) ((1UL << (8 * sizeof (ptrdiff_t) - 1)) - 1))
149#endif
150
151int main ()
152{
153 void *p;
154
155 fprintf (stderr, "PTRDIFF_MAX = %lu\n", (unsigned long) PTRDIFF_MAX);
156 203
157 errno = 0; 204#define TEST_CALL(call) \
158 p = malloc ((unsigned long) PTRDIFF_MAX + 1); 205 do { \
159 fprintf (stderr, "p=%p errno=%d\n", p, errno); 206 void *p = call; \
160 207 if (p) \
161 errno = 0; 208 fprintf (stderr, "returned %p (incorrect success)\n", p); \
162 p = calloc (PTRDIFF_MAX / 2 + 1, 2); 209 else if (errno == ENOMEM) \
163 fprintf (stderr, "p=%p errno=%d\n", p, errno); 210 perror ("correct failure"); \
164 211 else \
165 errno = 0; 212 perror ("incorrect failure (wrong errno)"); \
166 p = realloc (NULL, (unsigned long) PTRDIFF_MAX + 1); 213 free (p); \
167 fprintf (stderr, "p=%p errno=%d\n", p, errno); 214 } while (0)
168 215
216int
217main ()
218{
219 size_t big = PTRDIFF_MAX;
220 TEST_CALL (malloc (big + 1));
221 TEST_CALL (calloc (big / 2 + 1, 2));
222 TEST_CALL (realloc (NULL, big + 1));
223 void *small = malloc (1);
224 TEST_CALL (realloc (small, big + 1));
225 free (small);
169 return 0; 226 return 0;
170} 227}
171m4_divert_pop([KILL]) 228m4_divert_pop([KILL])
diff --git a/gl/m4/malloca.m4 b/gl/m4/malloca.m4
index 9e09d22c..2c0ed8ea 100644
--- a/gl/m4/malloca.m4
+++ b/gl/m4/malloca.m4
@@ -1,15 +1,16 @@
1# malloca.m4 1# malloca.m4
2# serial 2 2# serial 3
3dnl Copyright (C) 2003-2004, 2006-2007, 2009-2024 Free Software Foundation, 3dnl Copyright (C) 2003-2004, 2006-2007, 2009-2026 Free Software Foundation,
4dnl Inc. 4dnl Inc.
5dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
6dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
7dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
8 9
9AC_DEFUN([gl_MALLOCA], 10AC_DEFUN([gl_MALLOCA],
10[ 11[
11 dnl Use the autoconf tests for alloca(), but not the AC_SUBSTed variables 12 dnl Use the autoconf tests for alloca(), but not the AC_SUBSTed variables
12 dnl @ALLOCA@ and @LTALLOCA@. 13 dnl @ALLOCA@ and @LTALLOCA@.
13 dnl gl_FUNC_ALLOCA dnl Already brought in by the module dependencies. 14 dnl gl_FUNC_ALLOCA dnl Already brought in by the module dependencies.
14 AC_REQUIRE([gl_EEMALLOC]) 15 AC_REQUIRE([gl_FUNC_MALLOC_GNU])
15]) 16])
diff --git a/gl/m4/math_h.m4 b/gl/m4/math_h.m4
index 4b26c9e9..4cf59671 100644
--- a/gl/m4/math_h.m4
+++ b/gl/m4/math_h.m4
@@ -1,9 +1,10 @@
1# math_h.m4 1# math_h.m4
2# serial 138 2# serial 146
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_MATH_H], 9AC_DEFUN_ONCE([gl_MATH_H],
9[ 10[
@@ -49,7 +50,7 @@ AC_DEFUN_ONCE([gl_MATH_H],
49 ilogb ilogbf ilogbl 50 ilogb ilogbf ilogbl
50 ldexpf ldexpl 51 ldexpf ldexpl
51 log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l 52 log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l
52 logb logbf logbl 53 logb logbf logbl logp1 log1pf logp1l
53 modf modff modfl powf 54 modf modff modfl powf
54 remainder remainderf remainderl 55 remainder remainderf remainderl
55 rint rintf rintl round roundf roundl 56 rint rintf rintl round roundf roundl
@@ -130,8 +131,11 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS],
130 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ILOGBF]) 131 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ILOGBF])
131 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ILOGBL]) 132 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ILOGBL])
132 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISFINITE]) 133 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISFINITE])
134 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISFINITE_NO_CXX])
133 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISINF]) 135 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISINF])
136 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISINF_NO_CXX])
134 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNAN]) 137 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNAN])
138 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNAN_NO_CXX])
135 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANF]) 139 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANF])
136 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNAND]) 140 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNAND])
137 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANL]) 141 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANL])
@@ -153,6 +157,9 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS],
153 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGB]) 157 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGB])
154 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBF]) 158 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBF])
155 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBL]) 159 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBL])
160 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1])
161 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1F])
162 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1L])
156 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODF]) 163 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODF])
157 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFF]) 164 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFF])
158 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFL]) 165 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFL])
@@ -173,6 +180,7 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS],
173 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADSIGF]) 180 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADSIGF])
174 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADSIGL]) 181 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADSIGL])
175 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGNBIT]) 182 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGNBIT])
183 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGNBIT_NO_CXX])
176 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINF]) 184 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINF])
177 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINL]) 185 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINL])
178 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINHF]) 186 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINHF])
@@ -216,14 +224,19 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
216 HAVE_CBRTF=1; AC_SUBST([HAVE_CBRTF]) 224 HAVE_CBRTF=1; AC_SUBST([HAVE_CBRTF])
217 HAVE_CBRTL=1; AC_SUBST([HAVE_CBRTL]) 225 HAVE_CBRTL=1; AC_SUBST([HAVE_CBRTL])
218 HAVE_COPYSIGN=1; AC_SUBST([HAVE_COPYSIGN]) 226 HAVE_COPYSIGN=1; AC_SUBST([HAVE_COPYSIGN])
227 HAVE_COPYSIGNF=1; AC_SUBST([HAVE_COPYSIGNF])
219 HAVE_COPYSIGNL=1; AC_SUBST([HAVE_COPYSIGNL]) 228 HAVE_COPYSIGNL=1; AC_SUBST([HAVE_COPYSIGNL])
220 HAVE_COSF=1; AC_SUBST([HAVE_COSF]) 229 HAVE_COSF=1; AC_SUBST([HAVE_COSF])
221 HAVE_COSL=1; AC_SUBST([HAVE_COSL]) 230 HAVE_COSL=1; AC_SUBST([HAVE_COSL])
222 HAVE_COSHF=1; AC_SUBST([HAVE_COSHF]) 231 HAVE_COSHF=1; AC_SUBST([HAVE_COSHF])
223 HAVE_EXPF=1; AC_SUBST([HAVE_EXPF]) 232 HAVE_EXPF=1; AC_SUBST([HAVE_EXPF])
224 HAVE_EXPL=1; AC_SUBST([HAVE_EXPL]) 233 HAVE_EXPL=1; AC_SUBST([HAVE_EXPL])
234 HAVE_EXP2=1; AC_SUBST([HAVE_EXP2])
235 HAVE_EXP2F=1; AC_SUBST([HAVE_EXP2F])
236 HAVE_EXP2L=1; AC_SUBST([HAVE_EXP2L])
225 HAVE_EXPM1=1; AC_SUBST([HAVE_EXPM1]) 237 HAVE_EXPM1=1; AC_SUBST([HAVE_EXPM1])
226 HAVE_EXPM1F=1; AC_SUBST([HAVE_EXPM1F]) 238 HAVE_EXPM1F=1; AC_SUBST([HAVE_EXPM1F])
239 HAVE_EXPM1L=1; AC_SUBST([HAVE_EXPM1L])
227 HAVE_FABSF=1; AC_SUBST([HAVE_FABSF]) 240 HAVE_FABSF=1; AC_SUBST([HAVE_FABSF])
228 HAVE_FABSL=1; AC_SUBST([HAVE_FABSL]) 241 HAVE_FABSL=1; AC_SUBST([HAVE_FABSL])
229 HAVE_FMA=1; AC_SUBST([HAVE_FMA]) 242 HAVE_FMA=1; AC_SUBST([HAVE_FMA])
@@ -251,15 +264,26 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
251 HAVE_LOG1P=1; AC_SUBST([HAVE_LOG1P]) 264 HAVE_LOG1P=1; AC_SUBST([HAVE_LOG1P])
252 HAVE_LOG1PF=1; AC_SUBST([HAVE_LOG1PF]) 265 HAVE_LOG1PF=1; AC_SUBST([HAVE_LOG1PF])
253 HAVE_LOG1PL=1; AC_SUBST([HAVE_LOG1PL]) 266 HAVE_LOG1PL=1; AC_SUBST([HAVE_LOG1PL])
267 HAVE_LOG2=1; AC_SUBST([HAVE_LOG2])
268 HAVE_LOG2F=1; AC_SUBST([HAVE_LOG2F])
269 HAVE_LOG2L=1; AC_SUBST([HAVE_LOG2L])
254 HAVE_LOGBF=1; AC_SUBST([HAVE_LOGBF]) 270 HAVE_LOGBF=1; AC_SUBST([HAVE_LOGBF])
255 HAVE_LOGBL=1; AC_SUBST([HAVE_LOGBL]) 271 HAVE_LOGBL=1; AC_SUBST([HAVE_LOGBL])
272 HAVE_LOGP1=1; AC_SUBST([HAVE_LOGP1])
273 HAVE_LOGP1F=1; AC_SUBST([HAVE_LOGP1F])
274 HAVE_LOGP1L=1; AC_SUBST([HAVE_LOGP1L])
256 HAVE_MODFF=1; AC_SUBST([HAVE_MODFF]) 275 HAVE_MODFF=1; AC_SUBST([HAVE_MODFF])
257 HAVE_MODFL=1; AC_SUBST([HAVE_MODFL]) 276 HAVE_MODFL=1; AC_SUBST([HAVE_MODFL])
258 HAVE_POWF=1; AC_SUBST([HAVE_POWF]) 277 HAVE_POWF=1; AC_SUBST([HAVE_POWF])
259 HAVE_REMAINDER=1; AC_SUBST([HAVE_REMAINDER]) 278 HAVE_REMAINDER=1; AC_SUBST([HAVE_REMAINDER])
260 HAVE_REMAINDERF=1; AC_SUBST([HAVE_REMAINDERF]) 279 HAVE_REMAINDERF=1; AC_SUBST([HAVE_REMAINDERF])
280 HAVE_REMAINDERL=1; AC_SUBST([HAVE_REMAINDERL])
261 HAVE_RINT=1; AC_SUBST([HAVE_RINT]) 281 HAVE_RINT=1; AC_SUBST([HAVE_RINT])
282 HAVE_RINTF=1; AC_SUBST([HAVE_RINTF])
262 HAVE_RINTL=1; AC_SUBST([HAVE_RINTL]) 283 HAVE_RINTL=1; AC_SUBST([HAVE_RINTL])
284 HAVE_ROUND=1; AC_SUBST([HAVE_ROUND])
285 HAVE_ROUNDF=1; AC_SUBST([HAVE_ROUNDF])
286 HAVE_ROUNDL=1; AC_SUBST([HAVE_ROUNDL])
263 HAVE_SETPAYLOAD=1; AC_SUBST([HAVE_SETPAYLOAD]) 287 HAVE_SETPAYLOAD=1; AC_SUBST([HAVE_SETPAYLOAD])
264 HAVE_SETPAYLOADF=1; AC_SUBST([HAVE_SETPAYLOADF]) 288 HAVE_SETPAYLOADF=1; AC_SUBST([HAVE_SETPAYLOADF])
265 HAVE_SETPAYLOADL=1; AC_SUBST([HAVE_SETPAYLOADL]) 289 HAVE_SETPAYLOADL=1; AC_SUBST([HAVE_SETPAYLOADL])
@@ -283,33 +307,17 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
283 HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) 307 HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL])
284 HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) 308 HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL])
285 HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL]) 309 HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL])
286 HAVE_DECL_CBRTF=1; AC_SUBST([HAVE_DECL_CBRTF])
287 HAVE_DECL_CBRTL=1; AC_SUBST([HAVE_DECL_CBRTL])
288 HAVE_DECL_CEILF=1; AC_SUBST([HAVE_DECL_CEILF]) 310 HAVE_DECL_CEILF=1; AC_SUBST([HAVE_DECL_CEILF])
289 HAVE_DECL_CEILL=1; AC_SUBST([HAVE_DECL_CEILL]) 311 HAVE_DECL_CEILL=1; AC_SUBST([HAVE_DECL_CEILL])
290 HAVE_DECL_COPYSIGNF=1; AC_SUBST([HAVE_DECL_COPYSIGNF])
291 HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL]) 312 HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL])
292 HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL]) 313 HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL])
293 HAVE_DECL_EXP2=1; AC_SUBST([HAVE_DECL_EXP2])
294 HAVE_DECL_EXP2F=1; AC_SUBST([HAVE_DECL_EXP2F])
295 HAVE_DECL_EXP2L=1; AC_SUBST([HAVE_DECL_EXP2L])
296 HAVE_DECL_EXPM1L=1; AC_SUBST([HAVE_DECL_EXPM1L])
297 HAVE_DECL_FLOORF=1; AC_SUBST([HAVE_DECL_FLOORF]) 314 HAVE_DECL_FLOORF=1; AC_SUBST([HAVE_DECL_FLOORF])
298 HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL]) 315 HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL])
299 HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL]) 316 HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL])
300 HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL]) 317 HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL])
301 HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL]) 318 HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL])
302 HAVE_DECL_LOG10L=1; AC_SUBST([HAVE_DECL_LOG10L]) 319 HAVE_DECL_LOG10L=1; AC_SUBST([HAVE_DECL_LOG10L])
303 HAVE_DECL_LOG2=1; AC_SUBST([HAVE_DECL_LOG2])
304 HAVE_DECL_LOG2F=1; AC_SUBST([HAVE_DECL_LOG2F])
305 HAVE_DECL_LOG2L=1; AC_SUBST([HAVE_DECL_LOG2L])
306 HAVE_DECL_LOGB=1; AC_SUBST([HAVE_DECL_LOGB]) 320 HAVE_DECL_LOGB=1; AC_SUBST([HAVE_DECL_LOGB])
307 HAVE_DECL_REMAINDER=1; AC_SUBST([HAVE_DECL_REMAINDER])
308 HAVE_DECL_REMAINDERL=1; AC_SUBST([HAVE_DECL_REMAINDERL])
309 HAVE_DECL_RINTF=1; AC_SUBST([HAVE_DECL_RINTF])
310 HAVE_DECL_ROUND=1; AC_SUBST([HAVE_DECL_ROUND])
311 HAVE_DECL_ROUNDF=1; AC_SUBST([HAVE_DECL_ROUNDF])
312 HAVE_DECL_ROUNDL=1; AC_SUBST([HAVE_DECL_ROUNDL])
313 HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL]) 321 HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL])
314 HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL]) 322 HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL])
315 HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL]) 323 HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL])
@@ -392,6 +400,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
392 REPLACE_SIGNBIT_USING_BUILTINS=0; AC_SUBST([REPLACE_SIGNBIT_USING_BUILTINS]) 400 REPLACE_SIGNBIT_USING_BUILTINS=0; AC_SUBST([REPLACE_SIGNBIT_USING_BUILTINS])
393 REPLACE_SINF=0; AC_SUBST([REPLACE_SINF]) 401 REPLACE_SINF=0; AC_SUBST([REPLACE_SINF])
394 REPLACE_SINHF=0; AC_SUBST([REPLACE_SINHF]) 402 REPLACE_SINHF=0; AC_SUBST([REPLACE_SINHF])
403 REPLACE_SINL=0; AC_SUBST([REPLACE_SINL])
395 REPLACE_SQRTF=0; AC_SUBST([REPLACE_SQRTF]) 404 REPLACE_SQRTF=0; AC_SUBST([REPLACE_SQRTF])
396 REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL]) 405 REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL])
397 REPLACE_TANF=0; AC_SUBST([REPLACE_TANF]) 406 REPLACE_TANF=0; AC_SUBST([REPLACE_TANF])
diff --git a/gl/m4/mbchar.m4 b/gl/m4/mbchar.m4
new file mode 100644
index 00000000..4251a84c
--- /dev/null
+++ b/gl/m4/mbchar.m4
@@ -0,0 +1,15 @@
1# mbchar.m4
2# serial 9
3dnl Copyright (C) 2005-2007, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl autoconf tests required for use of mbchar.m4
10dnl From Bruno Haible.
11
12AC_DEFUN([gl_MBCHAR],
13[
14 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
15])
diff --git a/gl/m4/mbiter.m4 b/gl/m4/mbiter.m4
new file mode 100644
index 00000000..927876bc
--- /dev/null
+++ b/gl/m4/mbiter.m4
@@ -0,0 +1,16 @@
1# mbiter.m4
2# serial 7
3dnl Copyright (C) 2005, 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl autoconf tests required for use of mbiter.h
10dnl From Bruno Haible.
11
12AC_DEFUN([gl_MBITER],
13[
14 AC_REQUIRE([AC_TYPE_MBSTATE_T])
15 :
16])
diff --git a/gl/m4/mbrtoc32.m4 b/gl/m4/mbrtoc32.m4
new file mode 100644
index 00000000..d1690fb4
--- /dev/null
+++ b/gl/m4/mbrtoc32.m4
@@ -0,0 +1,326 @@
1# mbrtoc32.m4
2# serial 21
3dnl Copyright (C) 2014-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN([gl_FUNC_MBRTOC32],
10[
11 AC_REQUIRE([gl_UCHAR_H_DEFAULTS])
12
13 AC_REQUIRE([AC_TYPE_MBSTATE_T])
14 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
15 dnl determined. It describes how our overridden mbrtowc is implemented.
16 dnl We then implement mbrtoc32 accordingly.
17 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
18
19 AC_REQUIRE([gl_TYPE_CHAR32_T])
20 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
21
22 AC_REQUIRE([gl_CHECK_FUNC_MBRTOC32])
23 if test $gl_cv_func_mbrtoc32 = no; then
24 HAVE_MBRTOC32=0
25 else
26 if test $GNULIBHEADERS_OVERRIDE_CHAR32_T = 1 || test $REPLACE_MBSTATE_T = 1; then
27 REPLACE_MBRTOC32=1
28 else
29 gl_MBRTOC32_EMPTY_INPUT
30 gl_MBRTOC32_C_LOCALE
31 gl_MBRTOC32_UTF8_LOCALE
32 case "$gl_cv_func_mbrtoc32_empty_input" in
33 *yes) ;;
34 *) AC_DEFINE([MBRTOC32_EMPTY_INPUT_BUG], [1],
35 [Define if the mbrtoc32 function does not return (size_t) -2 for empty input.])
36 REPLACE_MBRTOC32=1
37 ;;
38 esac
39 case "$gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ" in
40 *yes) ;;
41 *) AC_DEFINE([MBRTOC32_IN_C_LOCALE_MAYBE_EILSEQ], [1],
42 [Define if the mbrtoc32 function may signal encoding errors in the C locale.])
43 REPLACE_MBRTOC32=1
44 ;;
45 esac
46 case "$gl_cv_func_mbrtoc32_utf8_locale_works" in
47 *yes) ;;
48 *) AC_DEFINE([MBRTOC32_MULTIBYTE_LOCALE_BUG], [1],
49 [Define if the mbrtoc32 function does not accept the input bytes one-by-one.])
50 REPLACE_MBRTOC32=1
51 dnl Our replacement mbrtoc32 can handle UTF-8, but not GB18030.
52 LOCALE_ZH_CN=none
53 ;;
54 esac
55 fi
56 if test $HAVE_WORKING_MBRTOC32 = 0; then
57 REPLACE_MBRTOC32=1
58 fi
59 fi
60])
61
62AC_DEFUN([gl_CHECK_FUNC_MBRTOC32],
63[
64 dnl Cf. gl_CHECK_FUNCS_ANDROID
65 AC_CHECK_DECL([mbrtoc32], , ,
66 [[#ifdef __HAIKU__
67 #include <stdint.h>
68 #endif
69 #include <uchar.h>
70 ]])
71 if test $ac_cv_have_decl_mbrtoc32 = yes; then
72 dnl We can't use AC_CHECK_FUNC here, because mbrtoc32() is defined as a
73 dnl static inline function on Haiku 2020.
74 AC_CACHE_CHECK([for mbrtoc32], [gl_cv_func_mbrtoc32],
75 [AC_LINK_IFELSE(
76 [AC_LANG_PROGRAM(
77 [[#include <stdlib.h>
78 #ifdef __HAIKU__
79 #include <stdint.h>
80 #endif
81 #include <uchar.h>
82 ]],
83 [[char32_t c;
84 return mbrtoc32 (&c, "", 1, NULL) == 0;
85 ]])
86 ],
87 [gl_cv_func_mbrtoc32=yes],
88 [gl_cv_func_mbrtoc32=no])
89 ])
90 else
91 gl_cv_func_mbrtoc32=no
92 fi
93])
94
95dnl Test whether mbrtoc32 returns the correct value on empty input.
96
97AC_DEFUN([gl_MBRTOC32_EMPTY_INPUT],
98[
99 AC_REQUIRE([AC_PROG_CC])
100 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
101 AC_CACHE_CHECK([whether mbrtoc32 works on empty input],
102 [gl_cv_func_mbrtoc32_empty_input],
103 [
104 AC_RUN_IFELSE(
105 [AC_LANG_SOURCE([[
106 #ifdef __HAIKU__
107 #include <stdint.h>
108 #endif
109 #include <uchar.h>
110 static char32_t wc;
111 static mbstate_t mbs;
112 int
113 main (void)
114 {
115 return mbrtoc32 (&wc, "", 0, &mbs) != (size_t) -2;
116 }]])],
117 [gl_cv_func_mbrtoc32_empty_input=yes],
118 [gl_cv_func_mbrtoc32_empty_input=no],
119 [case "$host_os" in
120 # Guess no on glibc systems.
121 *-gnu* | gnu*) gl_cv_func_mbrtoc32_empty_input="guessing no" ;;
122 # Guess no on Android.
123 linux*-android*) gl_cv_func_mbrtoc32_empty_input="guessing no" ;;
124 # Guess no on native Windows.
125 mingw* | windows*) gl_cv_func_mbrtoc32_empty_input="guessing no" ;;
126 *) gl_cv_func_mbrtoc32_empty_input="guessing yes" ;;
127 esac
128 ])
129 ])
130])
131
132dnl <https://pubs.opengroup.org/onlinepubs/9699919799/functions/mbrtowc.html>
133dnl POSIX:2018 says regarding mbrtowc: "In the POSIX locale an [EILSEQ] error
134dnl cannot occur since all byte values are valid characters." It is reasonable
135dnl to expect mbrtoc32 to behave in the same way.
136
137AC_DEFUN([gl_MBRTOC32_C_LOCALE],
138[
139 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
140 AC_CACHE_CHECK([whether the C locale is free of encoding errors],
141 [gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ],
142 [AC_RUN_IFELSE(
143 [AC_LANG_PROGRAM(
144 [[#include <limits.h>
145 #include <locale.h>
146 #ifdef __HAIKU__
147 #include <stdint.h>
148 #endif
149 #include <uchar.h>
150 ]], [[
151 int i;
152 char *locale = setlocale (LC_ALL, "C");
153 if (! locale)
154 return 2;
155 for (i = CHAR_MIN; i <= CHAR_MAX; i++)
156 {
157 char c = i;
158 char32_t wc;
159 mbstate_t mbs = { 0, };
160 size_t ss = mbrtoc32 (&wc, &c, 1, &mbs);
161 if (1 < ss)
162 return 3;
163 }
164 return 0;
165 ]])],
166 [gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ=yes],
167 [gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ=no],
168 [case "$host_os" in
169 # Guess yes on native Windows.
170 mingw* | windows*) gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ="guessing yes" ;;
171 *) gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ="$gl_cross_guess_normal" ;;
172 esac
173 ])
174 ])
175])
176
177dnl Test whether mbrtoc32 works when it's fed the bytes one-by-one in an UTF-8
178dnl locale.
179
180AC_DEFUN([gl_MBRTOC32_UTF8_LOCALE],
181[
182 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
183 AC_CACHE_CHECK([whether mbrtoc32 works in an UTF-8 locale],
184 [gl_cv_func_mbrtoc32_utf8_locale_works],
185 [AC_RUN_IFELSE(
186 [AC_LANG_PROGRAM(
187 [[#include <locale.h>
188 #ifdef __HAIKU__
189 #include <stdint.h>
190 #endif
191 #include <uchar.h>
192 ]], [[
193 char *locale = setlocale (LC_ALL, "en_US.UTF-8");
194 if (locale)
195 {
196 /* This test fails on Cygwin 3.5.3. */
197 mbstate_t state = { 0, };
198 char32_t uc = 0xDEADBEEF;
199 /* \360\237\220\203 = U+0001F403 */
200 if (mbrtoc32 (&uc, "\360", 1, &state) != (size_t)-2)
201 return 1;
202 if (mbrtoc32 (&uc, "\237", 1, &state) != (size_t)-2)
203 return 2;
204 if (mbrtoc32 (&uc, "\220", 1, &state) != (size_t)-2)
205 return 3;
206 if (mbrtoc32 (&uc, "\203", 1, &state) != 1)
207 return 4;
208 if (uc != 0x0001F403)
209 return 5;
210 }
211 return 0;
212 ]])],
213 [gl_cv_func_mbrtoc32_utf8_locale_works=yes],
214 [gl_cv_func_mbrtoc32_utf8_locale_works=no],
215 [case "$host_os" in
216 # Guess no on Cygwin.
217 cygwin*) gl_cv_func_mbrtoc32_utf8_locale_works="guessing no" ;;
218 *) gl_cv_func_mbrtoc32_utf8_locale_works="$gl_cross_guess_normal" ;;
219 esac
220 ])
221 ])
222])
223
224dnl Test whether mbrtoc32 works not worse than mbrtowc.
225dnl Result is HAVE_WORKING_MBRTOC32.
226
227AC_DEFUN([gl_MBRTOC32_SANITYCHECK],
228[
229 AC_REQUIRE([AC_PROG_CC])
230 AC_REQUIRE([gl_TYPE_CHAR32_T])
231 AC_REQUIRE([gl_CHECK_FUNC_MBRTOC32])
232 AC_REQUIRE([gt_LOCALE_FR])
233 AC_REQUIRE([gt_LOCALE_ZH_CN])
234 AC_REQUIRE([AC_CANONICAL_HOST])
235 if test $GNULIBHEADERS_OVERRIDE_CHAR32_T = 1 || test $gl_cv_func_mbrtoc32 = no; then
236 HAVE_WORKING_MBRTOC32=0
237 else
238 AC_CACHE_CHECK([whether mbrtoc32 works as well as mbrtowc],
239 [gl_cv_func_mbrtoc32_sanitycheck],
240 [
241 dnl Initial guess, used when cross-compiling or when no suitable locale
242 dnl is present.
243changequote(,)dnl
244 case "$host_os" in
245 # Guess no on FreeBSD, Solaris, native Windows.
246 freebsd* | midnightbsd* | solaris* | mingw* | windows*)
247 gl_cv_func_mbrtoc32_sanitycheck="guessing no"
248 ;;
249 # Guess yes otherwise.
250 *)
251 gl_cv_func_mbrtoc32_sanitycheck="guessing yes"
252 ;;
253 esac
254changequote([,])dnl
255 if test $LOCALE_FR != none || test $LOCALE_ZH_CN != none; then
256 AC_RUN_IFELSE(
257 [AC_LANG_SOURCE([[
258#include <locale.h>
259#include <stdlib.h>
260#include <string.h>
261#include <wchar.h>
262#ifdef __HAIKU__
263 #include <stdint.h>
264#endif
265#include <uchar.h>
266int main ()
267{
268 int result = 0;
269 /* This fails on native Windows:
270 mbrtoc32 returns (size_t)-1.
271 mbrtowc returns 1 (correct). */
272 if (strcmp ("$LOCALE_FR", "none") != 0
273 && setlocale (LC_ALL, "$LOCALE_FR") != NULL)
274 {
275 mbstate_t state;
276 wchar_t wc = (wchar_t) 0xBADFACE;
277 memset (&state, '\0', sizeof (mbstate_t));
278 if (mbrtowc (&wc, "\374", 1, &state) == 1)
279 {
280 char32_t c32 = (wchar_t) 0xBADFACE;
281 memset (&state, '\0', sizeof (mbstate_t));
282 if (mbrtoc32 (&c32, "\374", 1, &state) != 1)
283 result |= 1;
284 }
285 }
286 /* This fails on FreeBSD 13.0 and Solaris 11.4:
287 mbrtoc32 returns (size_t)-2 or (size_t)-1.
288 mbrtowc returns 4 (correct). */
289 if (strcmp ("$LOCALE_ZH_CN", "none") != 0
290 && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
291 {
292 mbstate_t state;
293 wchar_t wc = (wchar_t) 0xBADFACE;
294 memset (&state, '\0', sizeof (mbstate_t));
295 if (mbrtowc (&wc, "\224\071\375\067", 4, &state) == 4)
296 {
297 char32_t c32 = (wchar_t) 0xBADFACE;
298 memset (&state, '\0', sizeof (mbstate_t));
299 if (mbrtoc32 (&c32, "\224\071\375\067", 4, &state) != 4)
300 result |= 2;
301 }
302 }
303 return result;
304}]])],
305 [gl_cv_func_mbrtoc32_sanitycheck=yes],
306 [gl_cv_func_mbrtoc32_sanitycheck=no],
307 [:])
308 fi
309 ])
310 case "$gl_cv_func_mbrtoc32_sanitycheck" in
311 *yes)
312 HAVE_WORKING_MBRTOC32=1
313 AC_DEFINE([HAVE_WORKING_MBRTOC32], [1],
314 [Define if the mbrtoc32 function basically works.])
315 ;;
316 *) HAVE_WORKING_MBRTOC32=0 ;;
317 esac
318 fi
319 AC_SUBST([HAVE_WORKING_MBRTOC32])
320])
321
322# Prerequisites of lib/mbrtoc32.c and lib/lc-charset-dispatch.c.
323AC_DEFUN([gl_PREREQ_MBRTOC32], [
324 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
325 :
326])
diff --git a/gl/m4/mbrtowc.m4 b/gl/m4/mbrtowc.m4
index 62c4fdb3..a49872fa 100644
--- a/gl/m4/mbrtowc.m4
+++ b/gl/m4/mbrtowc.m4
@@ -1,10 +1,11 @@
1# mbrtowc.m4 1# mbrtowc.m4
2# serial 44 -*- coding: utf-8 -*- 2# serial 47
3dnl Copyright (C) 2001-2002, 2004-2005, 2008-2024 Free Software Foundation, 3dnl Copyright (C) 2001-2002, 2004-2005, 2008-2026 Free Software Foundation,
4dnl Inc. 4dnl Inc.
5dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
6dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
7dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
8 9
9AC_DEFUN([gl_FUNC_MBRTOWC], 10AC_DEFUN([gl_FUNC_MBRTOWC],
10[ 11[
@@ -32,7 +33,6 @@ AC_DEFUN([gl_FUNC_MBRTOWC],
32 REPLACE_MBRTOWC=1 33 REPLACE_MBRTOWC=1
33 else 34 else
34 gl_MBRTOWC_NULL_ARG1 35 gl_MBRTOWC_NULL_ARG1
35 gl_MBRTOWC_NULL_ARG2
36 gl_MBRTOWC_RETVAL 36 gl_MBRTOWC_RETVAL
37 gl_MBRTOWC_NUL_RETVAL 37 gl_MBRTOWC_NUL_RETVAL
38 gl_MBRTOWC_STORES_INCOMPLETE 38 gl_MBRTOWC_STORES_INCOMPLETE
@@ -45,13 +45,6 @@ AC_DEFUN([gl_FUNC_MBRTOWC],
45 REPLACE_MBRTOWC=1 45 REPLACE_MBRTOWC=1
46 ;; 46 ;;
47 esac 47 esac
48 case "$gl_cv_func_mbrtowc_null_arg2" in
49 *yes) ;;
50 *) AC_DEFINE([MBRTOWC_NULL_ARG2_BUG], [1],
51 [Define if the mbrtowc function has the NULL string argument bug.])
52 REPLACE_MBRTOWC=1
53 ;;
54 esac
55 case "$gl_cv_func_mbrtowc_retval" in 48 case "$gl_cv_func_mbrtowc_retval" in
56 *yes) ;; 49 *yes) ;;
57 *) AC_DEFINE([MBRTOWC_RETVAL_BUG], [1], 50 *) AC_DEFINE([MBRTOWC_RETVAL_BUG], [1],
@@ -160,7 +153,7 @@ AC_DEFUN([gl_MBRTOWC_INCOMPLETE_STATE],
160[ 153[
161 AC_REQUIRE([AC_PROG_CC]) 154 AC_REQUIRE([AC_PROG_CC])
162 AC_REQUIRE([gt_LOCALE_JA]) 155 AC_REQUIRE([gt_LOCALE_JA])
163 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 156 AC_REQUIRE([gt_LOCALE_EN_UTF8])
164 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 157 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
165 AC_CACHE_CHECK([whether mbrtowc handles incomplete characters], 158 AC_CACHE_CHECK([whether mbrtowc handles incomplete characters],
166 [gl_cv_func_mbrtowc_incomplete_state], 159 [gl_cv_func_mbrtowc_incomplete_state],
@@ -169,10 +162,10 @@ AC_DEFUN([gl_MBRTOWC_INCOMPLETE_STATE],
169 dnl is present. 162 dnl is present.
170changequote(,)dnl 163changequote(,)dnl
171 case "$host_os" in 164 case "$host_os" in
172 # Guess no on AIX and OSF/1. 165 # Guess no on AIX.
173 aix* | osf*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;; 166 aix*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;;
174 # Guess yes otherwise. 167 # Guess yes otherwise.
175 *) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;; 168 *) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;;
176 esac 169 esac
177changequote([,])dnl 170changequote([,])dnl
178 if test $LOCALE_JA != none; then 171 if test $LOCALE_JA != none; then
@@ -200,7 +193,7 @@ int main ()
200 [gl_cv_func_mbrtowc_incomplete_state=no], 193 [gl_cv_func_mbrtowc_incomplete_state=no],
201 [:]) 194 [:])
202 else 195 else
203 if test $LOCALE_FR_UTF8 != none; then 196 if test "$LOCALE_EN_UTF8" != none; then
204 AC_RUN_IFELSE( 197 AC_RUN_IFELSE(
205 [AC_LANG_SOURCE([[ 198 [AC_LANG_SOURCE([[
206#include <locale.h> 199#include <locale.h>
@@ -208,7 +201,7 @@ int main ()
208#include <wchar.h> 201#include <wchar.h>
209int main () 202int main ()
210{ 203{
211 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 204 if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
212 { 205 {
213 const char input[] = "B\303\274\303\237er"; /* "Büßer" */ 206 const char input[] = "B\303\274\303\237er"; /* "Büßer" */
214 mbstate_t state; 207 mbstate_t state;
@@ -288,7 +281,7 @@ dnl Result is gl_cv_func_mbrtowc_null_arg1.
288AC_DEFUN([gl_MBRTOWC_NULL_ARG1], 281AC_DEFUN([gl_MBRTOWC_NULL_ARG1],
289[ 282[
290 AC_REQUIRE([AC_PROG_CC]) 283 AC_REQUIRE([AC_PROG_CC])
291 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 284 AC_REQUIRE([gt_LOCALE_EN_UTF8])
292 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 285 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
293 AC_CACHE_CHECK([whether mbrtowc handles a NULL pwc argument], 286 AC_CACHE_CHECK([whether mbrtowc handles a NULL pwc argument],
294 [gl_cv_func_mbrtowc_null_arg1], 287 [gl_cv_func_mbrtowc_null_arg1],
@@ -303,7 +296,7 @@ changequote(,)dnl
303 *) gl_cv_func_mbrtowc_null_arg1="guessing yes" ;; 296 *) gl_cv_func_mbrtowc_null_arg1="guessing yes" ;;
304 esac 297 esac
305changequote([,])dnl 298changequote([,])dnl
306 if test $LOCALE_FR_UTF8 != none; then 299 if test "$LOCALE_EN_UTF8" != none; then
307 AC_RUN_IFELSE( 300 AC_RUN_IFELSE(
308 [AC_LANG_SOURCE([[ 301 [AC_LANG_SOURCE([[
309#include <locale.h> 302#include <locale.h>
@@ -314,7 +307,7 @@ int main ()
314{ 307{
315 int result = 0; 308 int result = 0;
316 309
317 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 310 if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
318 { 311 {
319 char input[] = "\303\237er"; 312 char input[] = "\303\237er";
320 mbstate_t state; 313 mbstate_t state;
@@ -345,57 +338,6 @@ int main ()
345 ]) 338 ])
346]) 339])
347 340
348dnl Test whether mbrtowc supports a NULL string argument correctly.
349dnl Result is gl_cv_func_mbrtowc_null_arg2.
350
351AC_DEFUN([gl_MBRTOWC_NULL_ARG2],
352[
353 AC_REQUIRE([AC_PROG_CC])
354 AC_REQUIRE([gt_LOCALE_FR_UTF8])
355 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
356 AC_CACHE_CHECK([whether mbrtowc handles a NULL string argument],
357 [gl_cv_func_mbrtowc_null_arg2],
358 [
359 dnl Initial guess, used when cross-compiling or when no suitable locale
360 dnl is present.
361changequote(,)dnl
362 case "$host_os" in
363 # Guess no on OSF/1.
364 osf*) gl_cv_func_mbrtowc_null_arg2="guessing no" ;;
365 # Guess yes otherwise.
366 *) gl_cv_func_mbrtowc_null_arg2="guessing yes" ;;
367 esac
368changequote([,])dnl
369 if test $LOCALE_FR_UTF8 != none; then
370 AC_RUN_IFELSE(
371 [AC_LANG_SOURCE([[
372#include <locale.h>
373#include <string.h>
374#include <wchar.h>
375int main ()
376{
377 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
378 {
379 mbstate_t state;
380 wchar_t wc;
381 int ret;
382
383 memset (&state, '\0', sizeof (mbstate_t));
384 wc = (wchar_t) 0xBADFACE;
385 mbrtowc (&wc, NULL, 5, &state);
386 /* Check that wc was not modified. */
387 if (wc != (wchar_t) 0xBADFACE)
388 return 2;
389 }
390 return 0;
391}]])],
392 [gl_cv_func_mbrtowc_null_arg2=yes],
393 [gl_cv_func_mbrtowc_null_arg2=no],
394 [:])
395 fi
396 ])
397])
398
399dnl Test whether mbrtowc, when parsing the end of a multibyte character, 341dnl Test whether mbrtowc, when parsing the end of a multibyte character,
400dnl correctly returns the number of bytes that were needed to complete the 342dnl correctly returns the number of bytes that were needed to complete the
401dnl character (not the total number of bytes of the multibyte character). 343dnl character (not the total number of bytes of the multibyte character).
@@ -404,7 +346,7 @@ dnl Result is gl_cv_func_mbrtowc_retval.
404AC_DEFUN([gl_MBRTOWC_RETVAL], 346AC_DEFUN([gl_MBRTOWC_RETVAL],
405[ 347[
406 AC_REQUIRE([AC_PROG_CC]) 348 AC_REQUIRE([AC_PROG_CC])
407 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 349 AC_REQUIRE([gt_LOCALE_EN_UTF8])
408 AC_REQUIRE([gt_LOCALE_JA]) 350 AC_REQUIRE([gt_LOCALE_JA])
409 AC_REQUIRE([AC_CANONICAL_HOST]) 351 AC_REQUIRE([AC_CANONICAL_HOST])
410 AC_CACHE_CHECK([whether mbrtowc has a correct return value], 352 AC_CACHE_CHECK([whether mbrtowc has a correct return value],
@@ -422,7 +364,7 @@ changequote(,)dnl
422 gl_cv_func_mbrtowc_retval="guessing yes" ;; 364 gl_cv_func_mbrtowc_retval="guessing yes" ;;
423 esac 365 esac
424changequote([,])dnl 366changequote([,])dnl
425 if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none \ 367 if test "$LOCALE_EN_UTF8" != none || test $LOCALE_JA != none \
426 || { case "$host_os" in mingw* | windows*) true;; *) false;; esac; }; then 368 || { case "$host_os" in mingw* | windows*) true;; *) false;; esac; }; then
427 AC_RUN_IFELSE( 369 AC_RUN_IFELSE(
428 [AC_LANG_SOURCE([[ 370 [AC_LANG_SOURCE([[
@@ -434,8 +376,8 @@ int main ()
434 int result = 0; 376 int result = 0;
435 int found_some_locale = 0; 377 int found_some_locale = 0;
436 /* This fails on Solaris. */ 378 /* This fails on Solaris. */
437 if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 379 if (strcmp ("$LOCALE_EN_UTF8", "none") != 0
438 && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 380 && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
439 { 381 {
440 char input[] = "B\303\274\303\237er"; /* "Büßer" */ 382 char input[] = "B\303\274\303\237er"; /* "Büßer" */
441 mbstate_t state; 383 mbstate_t state;
@@ -649,8 +591,8 @@ int main ()
649 [:]) 591 [:])
650 ;; 592 ;;
651 *) 593 *)
652 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 594 AC_REQUIRE([gt_LOCALE_EN_UTF8])
653 if test $LOCALE_FR_UTF8 != none; then 595 if test "$LOCALE_EN_UTF8" != none; then
654 AC_RUN_IFELSE( 596 AC_RUN_IFELSE(
655 [AC_LANG_SOURCE([[ 597 [AC_LANG_SOURCE([[
656#include <locale.h> 598#include <locale.h>
@@ -658,7 +600,7 @@ int main ()
658#include <wchar.h> 600#include <wchar.h>
659int main () 601int main ()
660{ 602{
661 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 603 if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
662 { 604 {
663 wchar_t wc = (wchar_t) 0xBADFACE; 605 wchar_t wc = (wchar_t) 0xBADFACE;
664 mbstate_t state; 606 mbstate_t state;
@@ -715,7 +657,7 @@ AC_DEFUN([gl_MBRTOWC_EMPTY_INPUT],
715dnl Test whether mbrtowc reports encoding errors in the C locale. 657dnl Test whether mbrtowc reports encoding errors in the C locale.
716dnl Although POSIX was never intended to allow this, the GNU C Library 658dnl Although POSIX was never intended to allow this, the GNU C Library
717dnl and other implementations do it. See: 659dnl and other implementations do it. See:
718dnl https://sourceware.org/bugzilla/show_bug.cgi?id=19932 660dnl https://sourceware.org/PR19932
719dnl POSIX has now clarified it: 661dnl POSIX has now clarified it:
720dnl <https://pubs.opengroup.org/onlinepubs/9699919799/functions/mbrtowc.html> 662dnl <https://pubs.opengroup.org/onlinepubs/9699919799/functions/mbrtowc.html>
721dnl says: "In the POSIX locale an [EILSEQ] error cannot occur since all byte 663dnl says: "In the POSIX locale an [EILSEQ] error cannot occur since all byte
diff --git a/gl/m4/mbsinit.m4 b/gl/m4/mbsinit.m4
index 10c86ba9..757f2360 100644
--- a/gl/m4/mbsinit.m4
+++ b/gl/m4/mbsinit.m4
@@ -1,9 +1,10 @@
1# mbsinit.m4 1# mbsinit.m4
2# serial 10 2# serial 10
3dnl Copyright (C) 2008, 2010-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008, 2010-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_MBSINIT], 9AC_DEFUN([gl_FUNC_MBSINIT],
9[ 10[
diff --git a/gl/m4/mbstate_t.m4 b/gl/m4/mbstate_t.m4
index 66d65cd7..88307d7a 100644
--- a/gl/m4/mbstate_t.m4
+++ b/gl/m4/mbstate_t.m4
@@ -1,9 +1,10 @@
1# mbstate_t.m4 1# mbstate_t.m4
2# serial 14 2# serial 14
3dnl Copyright (C) 2000-2002, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2000-2002, 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# From Paul Eggert. 9# From Paul Eggert.
9 10
diff --git a/gl/m4/mbtowc.m4 b/gl/m4/mbtowc.m4
index 603b0c1a..9c5887d3 100644
--- a/gl/m4/mbtowc.m4
+++ b/gl/m4/mbtowc.m4
@@ -1,9 +1,10 @@
1# mbtowc.m4 1# mbtowc.m4
2# serial 5 2# serial 5
3dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2011-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_MBTOWC], 9AC_DEFUN([gl_FUNC_MBTOWC],
9[ 10[
diff --git a/gl/m4/memchr.m4 b/gl/m4/memchr.m4
index 346a2882..c5c74682 100644
--- a/gl/m4/memchr.m4
+++ b/gl/m4/memchr.m4
@@ -1,9 +1,10 @@
1# memchr.m4 1# memchr.m4
2# serial 19 2# serial 21
3dnl Copyright (C) 2002-2004, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2004, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_FUNC_MEMCHR], 9AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
9[ 10[
@@ -20,7 +21,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
20 # https://bugzilla.redhat.com/show_bug.cgi?id=499689 21 # https://bugzilla.redhat.com/show_bug.cgi?id=499689
21 # memchr should not dereference overestimated length after a match 22 # memchr should not dereference overestimated length after a match
22 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 23 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737
23 # https://sourceware.org/bugzilla/show_bug.cgi?id=10162 24 # https://sourceware.org/PR10162
24 # memchr should cast the second argument to 'unsigned char'. 25 # memchr should cast the second argument to 'unsigned char'.
25 # This bug exists in Android 4.3. 26 # This bug exists in Android 4.3.
26 # Assume that memchr works on platforms that lack mprotect. 27 # Assume that memchr works on platforms that lack mprotect.
@@ -32,31 +33,20 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
32# include <unistd.h> 33# include <unistd.h>
33# include <sys/types.h> 34# include <sys/types.h>
34# include <sys/mman.h> 35# include <sys/mman.h>
35# ifndef MAP_FILE
36# define MAP_FILE 0
37# endif
38#endif 36#endif
39]], [[ 37]], [[
40 int result = 0; 38 int result = 0;
41 char *fence = NULL; 39 char *fence = NULL;
42#if HAVE_SYS_MMAN_H && HAVE_MPROTECT 40#if HAVE_SYS_MMAN_H && HAVE_MPROTECT
43# if HAVE_MAP_ANONYMOUS 41 {
44 const int flags = MAP_ANONYMOUS | MAP_PRIVATE; 42 long int pagesize = sysconf (_SC_PAGESIZE);
45 const int fd = -1; 43 char *two_pages =
46# else /* !HAVE_MAP_ANONYMOUS */ 44 (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
47 const int flags = MAP_FILE | MAP_PRIVATE; 45 MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
48 int fd = open ("/dev/zero", O_RDONLY, 0666); 46 if (two_pages != (char *)(-1)
49 if (fd >= 0) 47 && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
50# endif 48 fence = two_pages + pagesize;
51 { 49 }
52 int pagesize = getpagesize ();
53 char *two_pages =
54 (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
55 flags, fd, 0);
56 if (two_pages != (char *)(-1)
57 && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
58 fence = two_pages + pagesize;
59 }
60#endif 50#endif
61 if (fence) 51 if (fence)
62 { 52 {
diff --git a/gl/m4/minmax.m4 b/gl/m4/minmax.m4
index bc7d0c34..3344e3f7 100644
--- a/gl/m4/minmax.m4
+++ b/gl/m4/minmax.m4
@@ -1,9 +1,10 @@
1# minmax.m4 1# minmax.m4
2# serial 4 2# serial 4
3dnl Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_PREREQ([2.53]) 9AC_PREREQ([2.53])
9 10
diff --git a/gl/m4/mktime.m4 b/gl/m4/mktime.m4
index 85c52454..fa32d138 100644
--- a/gl/m4/mktime.m4
+++ b/gl/m4/mktime.m4
@@ -1,9 +1,11 @@
1# mktime.m4 1# mktime.m4
2# serial 39 2# serial 43
3dnl Copyright (C) 2002-2003, 2005-2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2003, 2005-2007, 2009-2026 Free Software Foundation,
4dnl Inc.
4dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
7 9
8dnl From Jim Meyering. 10dnl From Jim Meyering.
9 11
@@ -111,22 +113,6 @@ mktime_test (time_t now)
111} 113}
112 114
113static int 115static int
114irix_6_4_bug ()
115{
116 /* Based on code from Ariel Faigon. */
117 struct tm tm;
118 tm.tm_year = 96;
119 tm.tm_mon = 3;
120 tm.tm_mday = 0;
121 tm.tm_hour = 0;
122 tm.tm_min = 0;
123 tm.tm_sec = 0;
124 tm.tm_isdst = -1;
125 mktime (&tm);
126 return tm.tm_mon == 2 && tm.tm_mday == 31;
127}
128
129static int
130bigtime_test (int j) 116bigtime_test (int j)
131{ 117{
132 struct tm tm; 118 struct tm tm;
@@ -253,12 +239,10 @@ main ()
253 if ((result & 8) == 0 && ! bigtime_test (INT_MAX)) 239 if ((result & 8) == 0 && ! bigtime_test (INT_MAX))
254 result |= 8; 240 result |= 8;
255 } 241 }
256 if (! irix_6_4_bug ())
257 result |= 16;
258 if (! spring_forward_gap ()) 242 if (! spring_forward_gap ())
259 result |= 32; 243 result |= 16;
260 if (! year_2050_test () || ! indiana_test ()) 244 if (! year_2050_test () || ! indiana_test ())
261 result |= 64; 245 result |= 32;
262 return result; 246 return result;
263}]])], 247}]])],
264 [gl_cv_func_working_mktime=yes], 248 [gl_cv_func_working_mktime=yes],
diff --git a/gl/m4/mmap-anon.m4 b/gl/m4/mmap-anon.m4
index 61ca0120..b5e323d4 100644
--- a/gl/m4/mmap-anon.m4
+++ b/gl/m4/mmap-anon.m4
@@ -1,18 +1,17 @@
1# mmap-anon.m4 1# mmap-anon.m4
2# serial 12 2# serial 15
3dnl Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005, 2007, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Detect how mmap can be used to create anonymous (not file-backed) memory 9# Detect how mmap can be used to create anonymous (not file-backed) memory
9# mappings. 10# mappings.
10# - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS 11# - On Linux, AIX, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS and
11# and MAP_ANON exist and have the same value. 12# MAP_ANON exist and have the same value.
12# - On HP-UX, only MAP_ANONYMOUS exists. 13# - On HP-UX, only MAP_ANONYMOUS exists.
13# - On Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, only MAP_ANON exists. 14# - On Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, only MAP_ANON exists.
14# - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be
15# used.
16 15
17AC_DEFUN_ONCE([gl_FUNC_MMAP_ANON], 16AC_DEFUN_ONCE([gl_FUNC_MMAP_ANON],
18[ 17[
@@ -22,11 +21,13 @@ AC_DEFUN_ONCE([gl_FUNC_MMAP_ANON],
22 # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it 21 # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it
23 # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is 22 # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is
24 # irrelevant for anonymous mappings. 23 # irrelevant for anonymous mappings.
25 AC_CHECK_FUNC([mmap], [gl_have_mmap=yes], [gl_have_mmap=no]) 24 # Instead, assume that mmap() exists if and only if <sys/mman.h> exists.
25 # Code needs to tests HAVE_SYS_MMAN_H, not HAVE_MMAP.
26 AC_CHECK_HEADERS_ONCE([sys/mman.h])
26 27
27 # Try to allow MAP_ANONYMOUS. 28 # Try to allow MAP_ANONYMOUS.
28 gl_have_mmap_anonymous=no 29 gl_have_mmap_anonymous=no
29 if test $gl_have_mmap = yes; then 30 if test $ac_cv_header_sys_mman_h = yes; then
30 AC_MSG_CHECKING([for MAP_ANONYMOUS]) 31 AC_MSG_CHECKING([for MAP_ANONYMOUS])
31 AC_EGREP_CPP([I cannot identify this map], [ 32 AC_EGREP_CPP([I cannot identify this map], [
32#include <sys/mman.h> 33#include <sys/mman.h>
@@ -47,10 +48,5 @@ AC_DEFUN_ONCE([gl_FUNC_MMAP_ANON],
47 gl_have_mmap_anonymous=yes]) 48 gl_have_mmap_anonymous=yes])
48 fi 49 fi
49 AC_MSG_RESULT([$gl_have_mmap_anonymous]) 50 AC_MSG_RESULT([$gl_have_mmap_anonymous])
50 if test $gl_have_mmap_anonymous = yes; then
51 AC_DEFINE([HAVE_MAP_ANONYMOUS], [1],
52 [Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including
53 config.h and <sys/mman.h>.])
54 fi
55 fi 51 fi
56]) 52])
diff --git a/gl/m4/mode_t.m4 b/gl/m4/mode_t.m4
index 0d5c2808..4621813d 100644
--- a/gl/m4/mode_t.m4
+++ b/gl/m4/mode_t.m4
@@ -1,9 +1,10 @@
1# mode_t.m4 1# mode_t.m4
2# serial 2 2# serial 2
3dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# For using mode_t, it's sufficient to use AC_TYPE_MODE_T and 9# For using mode_t, it's sufficient to use AC_TYPE_MODE_T and
9# include <sys/types.h>. 10# include <sys/types.h>.
diff --git a/gl/m4/mountlist.m4 b/gl/m4/mountlist.m4
index ff414e66..311e00b2 100644
--- a/gl/m4/mountlist.m4
+++ b/gl/m4/mountlist.m4
@@ -1,9 +1,10 @@
1# mountlist.m4 1# mountlist.m4
2# serial 17 2# serial 20
3dnl Copyright (C) 2002-2006, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2006, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Jim Meyering. 9dnl From Jim Meyering.
9 10
@@ -74,7 +75,7 @@ $ac_includes_default
74 # Determine whether it's the one-argument variant or the two-argument one. 75 # Determine whether it's the one-argument variant or the two-argument one.
75 76
76 if test -z "$ac_list_mounted_fs"; then 77 if test -z "$ac_list_mounted_fs"; then
77 # glibc, HP-UX, IRIX, Cygwin, Android, also (obsolete) 4.3BSD, SunOS. 78 # glibc, HP-UX, Cygwin, Android, also (obsolete) 4.3BSD, SunOS.
78 AC_CACHE_CHECK([for one-argument getmntent function], 79 AC_CACHE_CHECK([for one-argument getmntent function],
79 [fu_cv_sys_mounted_getmntent1], 80 [fu_cv_sys_mounted_getmntent1],
80 [AC_COMPILE_IFELSE( 81 [AC_COMPILE_IFELSE(
@@ -106,7 +107,7 @@ $ac_includes_default
106 AC_DEFINE([MOUNTED_GETMNTENT1], [1], 107 AC_DEFINE([MOUNTED_GETMNTENT1], [1],
107 [Define if there is a function named getmntent for reading the list 108 [Define if there is a function named getmntent for reading the list
108 of mounted file systems, and that function takes a single argument. 109 of mounted file systems, and that function takes a single argument.
109 (4.3BSD, SunOS, HP-UX, Irix)]) 110 (4.3BSD, SunOS, HP-UX)])
110 gl_CHECK_FUNCS_ANDROID([setmntent], 111 gl_CHECK_FUNCS_ANDROID([setmntent],
111 [[#include <stdio.h> 112 [[#include <stdio.h>
112 #include <mntent.h> 113 #include <mntent.h>
@@ -158,7 +159,7 @@ $ac_includes_default
158 fi 159 fi
159 160
160 if test -z "$ac_list_mounted_fs"; then 161 if test -z "$ac_list_mounted_fs"; then
161 # OSF/1, also (obsolete) Apple Darwin 1.3. 162 # (obsolete) Apple Darwin 1.3.
162 # powerpc-apple-darwin1.3.7 needs sys/param.h sys/ucred.h sys/fs_types.h 163 # powerpc-apple-darwin1.3.7 needs sys/param.h sys/ucred.h sys/fs_types.h
163 164
164 AC_CACHE_CHECK([for getfsstat function], 165 AC_CACHE_CHECK([for getfsstat function],
@@ -184,7 +185,7 @@ $getfsstat_includes
184 ac_list_mounted_fs=found 185 ac_list_mounted_fs=found
185 AC_DEFINE([MOUNTED_GETFSSTAT], [1], 186 AC_DEFINE([MOUNTED_GETFSSTAT], [1],
186 [Define if there is a function named getfsstat for reading the 187 [Define if there is a function named getfsstat for reading the
187 list of mounted file systems. (DEC Alpha running OSF/1)]) 188 list of mounted file systems. (obsolete Darwin)])
188 fi 189 fi
189 fi 190 fi
190 191
@@ -211,10 +212,9 @@ $getfsstat_includes
211 212
212 if test -z "$ac_list_mounted_fs"; then 213 if test -z "$ac_list_mounted_fs"; then
213 # Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, also (obsolete) 4.4BSD. 214 # Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, also (obsolete) 4.4BSD.
214 # OSF/1 also has getmntinfo but is already handled above.
215 # We cannot use AC_CHECK_FUNCS([getmntinfo]) here, because at the linker 215 # We cannot use AC_CHECK_FUNCS([getmntinfo]) here, because at the linker
216 # level the function is sometimes called getmntinfo64 or getmntinfo$INODE64 216 # level the function is sometimes called getmntinfo64 or getmntinfo$INODE64
217 # on Mac OS X, __getmntinfo13 on NetBSD and Minix, _F64_getmntinfo on OSF/1. 217 # on Mac OS X, __getmntinfo13 on NetBSD and Minix.
218 AC_CACHE_CHECK([for getmntinfo function], 218 AC_CACHE_CHECK([for getmntinfo function],
219 [fu_cv_sys_mounted_getmntinfo], 219 [fu_cv_sys_mounted_getmntinfo],
220 [AC_LINK_IFELSE( 220 [AC_LINK_IFELSE(
@@ -318,12 +318,17 @@ int getmntinfo (struct statfs **, int);
318 fi 318 fi
319 319
320 if test -z "$ac_list_mounted_fs"; then 320 if test -z "$ac_list_mounted_fs"; then
321 AC_MSG_ERROR([could not determine how to read list of mounted file systems]) 321 case "$host_os" in
322 # FIXME -- no need to abort building the whole package 322 mingw* | windows*) ac_list_mounted_fs=found ;;
323 # Can't build mountlist.c or anything that needs its functions 323 esac
324 fi
325
326 if test -z "$ac_list_mounted_fs"; then
327 AC_DEFINE([MOUNTED_NOT_PORTED], [1],
328 [Define if we don't know how to determine the list of mounted file systems.])
324 fi 329 fi
325 330
326 if test $ac_list_mounted_fs = found; then 331 if test "$ac_list_mounted_fs" = found; then
327 gl_cv_list_mounted_fs=yes 332 gl_cv_list_mounted_fs=yes
328 else 333 else
329 gl_cv_list_mounted_fs=no 334 gl_cv_list_mounted_fs=no
diff --git a/gl/m4/msvc-inval.m4 b/gl/m4/msvc-inval.m4
index 7919ff12..565c0d3a 100644
--- a/gl/m4/msvc-inval.m4
+++ b/gl/m4/msvc-inval.m4
@@ -1,9 +1,10 @@
1# msvc-inval.m4 1# msvc-inval.m4
2# serial 1 2# serial 1
3dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2011-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_MSVC_INVAL], 9AC_DEFUN([gl_MSVC_INVAL],
9[ 10[
diff --git a/gl/m4/msvc-nothrow.m4 b/gl/m4/msvc-nothrow.m4
index 007c7620..1c2b491e 100644
--- a/gl/m4/msvc-nothrow.m4
+++ b/gl/m4/msvc-nothrow.m4
@@ -1,9 +1,10 @@
1# msvc-nothrow.m4 1# msvc-nothrow.m4
2# serial 1 2# serial 1
3dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2011-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_MSVC_NOTHROW], 9AC_DEFUN([gl_MSVC_NOTHROW],
9[ 10[
diff --git a/gl/m4/multiarch.m4 b/gl/m4/multiarch.m4
index 3af29d39..4fb642b7 100644
--- a/gl/m4/multiarch.m4
+++ b/gl/m4/multiarch.m4
@@ -1,9 +1,10 @@
1# multiarch.m4 1# multiarch.m4
2# serial 9 2# serial 9
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Determine whether the compiler is or may be producing universal binaries. 9# Determine whether the compiler is or may be producing universal binaries.
9# 10#
diff --git a/gl/m4/musl.m4 b/gl/m4/musl.m4
index 0d4de892..15b34466 100644
--- a/gl/m4/musl.m4
+++ b/gl/m4/musl.m4
@@ -1,9 +1,10 @@
1# musl.m4 1# musl.m4
2# serial 4 2# serial 4
3dnl Copyright (C) 2019-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2019-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Test for musl libc, despite the musl libc authors don't like it 9# Test for musl libc, despite the musl libc authors don't like it
9# <https://wiki.musl-libc.org/faq.html> 10# <https://wiki.musl-libc.org/faq.html>
diff --git a/gl/m4/netdb_h.m4 b/gl/m4/netdb_h.m4
index d8c00217..bcf19b01 100644
--- a/gl/m4/netdb_h.m4
+++ b/gl/m4/netdb_h.m4
@@ -1,9 +1,10 @@
1# netdb_h.m4 1# netdb_h.m4
2# serial 15 2# serial 15
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_NETDB_H], 9AC_DEFUN_ONCE([gl_NETDB_H],
9[ 10[
diff --git a/gl/m4/netinet_in_h.m4 b/gl/m4/netinet_in_h.m4
index 926f7f95..6d9eaf97 100644
--- a/gl/m4/netinet_in_h.m4
+++ b/gl/m4/netinet_in_h.m4
@@ -1,9 +1,10 @@
1# netinet_in_h.m4 1# netinet_in_h.m4
2# serial 6 2# serial 6
3dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_HEADER_NETINET_IN], 9AC_DEFUN([gl_HEADER_NETINET_IN],
9[ 10[
diff --git a/gl/m4/nl_langinfo.m4 b/gl/m4/nl_langinfo.m4
index f38f11bb..a3ec57f7 100644
--- a/gl/m4/nl_langinfo.m4
+++ b/gl/m4/nl_langinfo.m4
@@ -1,9 +1,10 @@
1# nl_langinfo.m4 1# nl_langinfo.m4
2# serial 11 2# serial 14
3dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_NL_LANGINFO], 9AC_DEFUN([gl_FUNC_NL_LANGINFO],
9[ 10[
@@ -15,43 +16,18 @@ AC_DEFUN([gl_FUNC_NL_LANGINFO],
15 AC_REQUIRE([gl_PTHREADLIB]) 16 AC_REQUIRE([gl_PTHREADLIB])
16 AC_CHECK_HEADERS_ONCE([threads.h]) 17 AC_CHECK_HEADERS_ONCE([threads.h])
17 if test $ac_cv_func_nl_langinfo = yes; then 18 if test $ac_cv_func_nl_langinfo = yes; then
18 # On Irix 6.5, YESEXPR is defined, but nl_langinfo(YESEXPR) is broken. 19 # On macOS 26, Solaris 10, and Solaris 11.3, nl_langinfo is not
19 AC_CACHE_CHECK([whether YESEXPR works], 20 # multithread-safe.
20 [gl_cv_func_nl_langinfo_yesexpr_works],
21 [AC_RUN_IFELSE(
22 [AC_LANG_PROGRAM([[#include <langinfo.h>
23]], [[return !*nl_langinfo(YESEXPR);
24]])],
25 [gl_cv_func_nl_langinfo_yesexpr_works=yes],
26 [gl_cv_func_nl_langinfo_yesexpr_works=no],
27 [
28 case "$host_os" in
29 # Guess no on irix systems.
30 irix*) gl_cv_func_nl_langinfo_yesexpr_works="guessing no";;
31 # Guess yes elsewhere.
32 *) gl_cv_func_nl_langinfo_yesexpr_works="guessing yes";;
33 esac
34 ])
35 ])
36 case $gl_cv_func_nl_langinfo_yesexpr_works in
37 *yes) FUNC_NL_LANGINFO_YESEXPR_WORKS=1 ;;
38 *) FUNC_NL_LANGINFO_YESEXPR_WORKS=0 ;;
39 esac
40 AC_DEFINE_UNQUOTED([FUNC_NL_LANGINFO_YESEXPR_WORKS],
41 [$FUNC_NL_LANGINFO_YESEXPR_WORKS],
42 [Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string.])
43 # On Solaris 10 and Solaris 11.3, nl_langinfo is not multithread-safe.
44 case "$host_os" in 21 case "$host_os" in
45 solaris*) NL_LANGINFO_MTSAFE=0 ;; 22 darwin* | solaris*) NL_LANGINFO_MTSAFE=0 ;;
46 *) NL_LANGINFO_MTSAFE=1 ;; 23 *) NL_LANGINFO_MTSAFE=1 ;;
47 esac 24 esac
48 AC_DEFINE_UNQUOTED([NL_LANGINFO_MTSAFE], [$NL_LANGINFO_MTSAFE], 25 AC_DEFINE_UNQUOTED([NL_LANGINFO_MTSAFE], [$NL_LANGINFO_MTSAFE],
49 [Define to 1 if nl_langinfo is multithread-safe.]) 26 [Define to 1 if nl_langinfo is multithread-safe.])
50 if test $HAVE_LANGINFO_CODESET = 1 \ 27 if test $HAVE_LANGINFO_CODESET = 1 \
51 && test $HAVE_LANGINFO_T_FMT_AMPM = 1 \
52 && test $HAVE_LANGINFO_ALTMON = 1 \ 28 && test $HAVE_LANGINFO_ALTMON = 1 \
29 && test $HAVE_LANGINFO_ABALTMON = 1 \
53 && test $HAVE_LANGINFO_ERA = 1 \ 30 && test $HAVE_LANGINFO_ERA = 1 \
54 && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1 \
55 && test $NL_LANGINFO_MTSAFE = 1; then 31 && test $NL_LANGINFO_MTSAFE = 1; then
56 : 32 :
57 else 33 else
diff --git a/gl/m4/nocrash.m4 b/gl/m4/nocrash.m4
index cbe8fe82..5c1af8c7 100644
--- a/gl/m4/nocrash.m4
+++ b/gl/m4/nocrash.m4
@@ -1,9 +1,10 @@
1# nocrash.m4 1# nocrash.m4
2# serial 5 2# serial 5
3dnl Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Based on libsigsegv, from Bruno Haible and Paolo Bonzini. 9dnl Based on libsigsegv, from Bruno Haible and Paolo Bonzini.
9 10
diff --git a/gl/m4/off64_t.m4 b/gl/m4/off64_t.m4
new file mode 100644
index 00000000..93d9e37b
--- /dev/null
+++ b/gl/m4/off64_t.m4
@@ -0,0 +1,32 @@
1# off64_t.m4
2# serial 1
3dnl Copyright (C) 2024-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl Check whether <sys/types.h> defines the 'off64_t' type.
10dnl Set HAVE_OFF64_T.
11
12AC_DEFUN([gl_TYPE_OFF64_T],
13[
14 dnl Persuade glibc <sys/types.h>, <stdio.h>, <fcntl.h>, <unistd.h>, <aio.h>
15 dnl to define off64_t.
16 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
17
18 AC_CACHE_CHECK([for off64_t], [gl_cv_off64_t],
19 [AC_COMPILE_IFELSE(
20 [AC_LANG_PROGRAM(
21 [[#include <sys/types.h>]],
22 [[int x = sizeof (off64_t *) + sizeof (off64_t);
23 return !x;]])],
24 [gl_cv_off64_t=yes], [gl_cv_off64_t=no])])
25
26 if test $gl_cv_off64_t != no; then
27 HAVE_OFF64_T=1
28 else
29 HAVE_OFF64_T=0
30 fi
31 AC_SUBST([HAVE_OFF64_T])
32])
diff --git a/gl/m4/off_t.m4 b/gl/m4/off_t.m4
index db6035db..d7d6aa0c 100644
--- a/gl/m4/off_t.m4
+++ b/gl/m4/off_t.m4
@@ -1,9 +1,10 @@
1# off_t.m4 1# off_t.m4
2# serial 1 2# serial 1
3dnl Copyright (C) 2012-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2012-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Check whether to override the 'off_t' type. 9dnl Check whether to override the 'off_t' type.
9dnl Set WINDOWS_64_BIT_OFF_T. 10dnl Set WINDOWS_64_BIT_OFF_T.
diff --git a/gl/m4/once.m4 b/gl/m4/once.m4
new file mode 100644
index 00000000..a478d81a
--- /dev/null
+++ b/gl/m4/once.m4
@@ -0,0 +1,14 @@
1# once.m4
2# serial 1
3dnl Copyright (C) 2024-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl From Bruno Haible.
10
11AC_DEFUN([gl_ONCE],
12[
13 AC_REQUIRE([gl_THREADLIB])
14])
diff --git a/gl/m4/open-cloexec.m4 b/gl/m4/open-cloexec.m4
index 6defdfb4..9c9aef23 100644
--- a/gl/m4/open-cloexec.m4
+++ b/gl/m4/open-cloexec.m4
@@ -1,9 +1,10 @@
1# open-cloexec.m4 1# open-cloexec.m4
2# serial 1 2# serial 1
3dnl Copyright 2017-2024 Free Software Foundation, Inc. 3dnl Copyright 2017-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Test whether O_CLOEXEC is defined. 9# Test whether O_CLOEXEC is defined.
9 10
diff --git a/gl/m4/open-slash.m4 b/gl/m4/open-slash.m4
index 03460e42..c36bdced 100644
--- a/gl/m4/open-slash.m4
+++ b/gl/m4/open-slash.m4
@@ -1,9 +1,10 @@
1# open-slash.m4 1# open-slash.m4
2# serial 2 2# serial 2
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Tests whether open() and creat() recognize a trailing slash. 9dnl Tests whether open() and creat() recognize a trailing slash.
9dnl Sets gl_cv_func_open_slash. 10dnl Sets gl_cv_func_open_slash.
diff --git a/gl/m4/open.m4 b/gl/m4/open.m4
index 62a11a11..f5b2a91c 100644
--- a/gl/m4/open.m4
+++ b/gl/m4/open.m4
@@ -1,14 +1,18 @@
1# open.m4 1# open.m4
2# serial 16 2# serial 17
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_OPEN], 9AC_DEFUN([gl_FUNC_OPEN],
9[ 10[
10 AC_REQUIRE([AC_CANONICAL_HOST]) 11 AC_REQUIRE([AC_CANONICAL_HOST])
11 AC_REQUIRE([gl_PREPROC_O_CLOEXEC]) 12 AC_REQUIRE([gl_PREPROC_O_CLOEXEC])
13 AC_REQUIRE([gl_FCNTL_O_FLAGS])
14 AS_CASE([$gl_cv_header_working_fcntl_h],
15 [*O_DIRECTORY* | *no], [REPLACE_OPEN=1])
12 case "$host_os" in 16 case "$host_os" in
13 mingw* | windows* | pw*) 17 mingw* | windows* | pw*)
14 REPLACE_OPEN=1 18 REPLACE_OPEN=1
diff --git a/gl/m4/pathmax.m4 b/gl/m4/pathmax.m4
index 4280837f..d6bdf43e 100644
--- a/gl/m4/pathmax.m4
+++ b/gl/m4/pathmax.m4
@@ -1,10 +1,11 @@
1# pathmax.m4 1# pathmax.m4
2# serial 11 2# serial 11
3dnl Copyright (C) 2002-2003, 2005-2006, 2009-2024 Free Software Foundation, 3dnl Copyright (C) 2002-2003, 2005-2006, 2009-2026 Free Software Foundation,
4dnl Inc. 4dnl Inc.
5dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
6dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
7dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
8 9
9AC_DEFUN([gl_PATHMAX], 10AC_DEFUN([gl_PATHMAX],
10[ 11[
diff --git a/gl/m4/pid_t.m4 b/gl/m4/pid_t.m4
index 8bedcc6b..314792ed 100644
--- a/gl/m4/pid_t.m4
+++ b/gl/m4/pid_t.m4
@@ -1,9 +1,10 @@
1# pid_t.m4 1# pid_t.m4
2# serial 4 2# serial 4
3dnl Copyright (C) 2020-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2020-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# The following implementation works around a problem in autoconf <= 2.69. 9# The following implementation works around a problem in autoconf <= 2.69.
9m4_version_prereq([2.70], [], [ 10m4_version_prereq([2.70], [], [
diff --git a/gl/m4/printf.m4 b/gl/m4/printf.m4
index 0cb14d6f..0de493b6 100644
--- a/gl/m4/printf.m4
+++ b/gl/m4/printf.m4
@@ -1,9 +1,10 @@
1# printf.m4 1# printf.m4
2# serial 91 2# serial 98
3dnl Copyright (C) 2003, 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2007-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Test whether the *printf family of functions supports the 'j', 'z', 't', 9dnl Test whether the *printf family of functions supports the 'j', 'z', 't',
9dnl 'L' size specifiers. (ISO C99, POSIX:2001) 10dnl 'L' size specifiers. (ISO C99, POSIX:2001)
@@ -616,6 +617,7 @@ static double zero = 0.0;
616int main () 617int main ()
617{ 618{
618 int result = 0; 619 int result = 0;
620 /* This fails on FreeBSD 5.2.1, Solaris 11.4. */
619 if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 621 if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0
620 || (strcmp (buf, "0x1.922p+1 33") != 0 622 || (strcmp (buf, "0x1.922p+1 33") != 0
621 && strcmp (buf, "0x3.244p+0 33") != 0 623 && strcmp (buf, "0x3.244p+0 33") != 0
@@ -627,27 +629,29 @@ int main ()
627 && strcmp (buf, "-0X3.244P+0 33") != 0 629 && strcmp (buf, "-0X3.244P+0 33") != 0
628 && strcmp (buf, "-0X6.488P-1 33") != 0 630 && strcmp (buf, "-0X6.488P-1 33") != 0
629 && strcmp (buf, "-0XC.91P-2 33") != 0)) 631 && strcmp (buf, "-0XC.91P-2 33") != 0))
630 result |= 2; 632 result |= 1;
631 /* This catches a FreeBSD 13.0 bug: it doesn't round. */ 633 /* This catches a Mac OS X 10.5, FreeBSD 6.4, NetBSD 10.0 bug:
634 it doesn't round. */
632 if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 635 if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0
633 || (strcmp (buf, "0x1.83p+0 33") != 0 636 || (strcmp (buf, "0x1.83p+0 33") != 0
634 && strcmp (buf, "0x3.05p-1 33") != 0 637 && strcmp (buf, "0x3.05p-1 33") != 0
635 && strcmp (buf, "0x6.0ap-2 33") != 0 638 && strcmp (buf, "0x6.0ap-2 33") != 0
636 && strcmp (buf, "0xc.14p-3 33") != 0)) 639 && strcmp (buf, "0xc.14p-3 33") != 0))
637 result |= 4; 640 result |= 2;
638 /* This catches a Mac OS X 10.12.4 (Darwin 16.5) bug: it doesn't round. */ 641 /* This catches a macOS 14 (Darwin 23), FreeBSD 14.0, OpenBSD 7.5, AIX 7.3,
642 Solaris 11.4 bug: it doesn't round. */
639 if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0 643 if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0
640 || (strcmp (buf, "0x2p+0 33") != 0 644 || (strcmp (buf, "0x2p+0 33") != 0
641 && strcmp (buf, "0x3p-1 33") != 0 645 && strcmp (buf, "0x3p-1 33") != 0
642 && strcmp (buf, "0x6p-2 33") != 0 646 && strcmp (buf, "0x6p-2 33") != 0
643 && strcmp (buf, "0xcp-3 33") != 0)) 647 && strcmp (buf, "0xcp-3 33") != 0))
644 result |= 4; 648 result |= 4;
645 /* This catches a FreeBSD 6.1 bug. See 649 /* This catches a Mac OS X 10.5, FreeBSD 6.4 bug. See
646 <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */ 650 <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */
647 if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0 651 if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0
648 || buf[0] == '0') 652 || buf[0] == '0')
649 result |= 8; 653 result |= 8;
650 /* This catches a Mac OS X 10.3.9 (Darwin 7.9) bug. */ 654 /* This catches a Mac OS X 10.3.9 (Darwin 7.9), FreeBSD 6.4 bug. */
651 if (sprintf (buf, "%.1a", 1.999) < 0 655 if (sprintf (buf, "%.1a", 1.999) < 0
652 || (strcmp (buf, "0x1.0p+1") != 0 656 || (strcmp (buf, "0x1.0p+1") != 0
653 && strcmp (buf, "0x2.0p+0") != 0 657 && strcmp (buf, "0x2.0p+0") != 0
@@ -655,7 +659,8 @@ int main ()
655 && strcmp (buf, "0x8.0p-2") != 0)) 659 && strcmp (buf, "0x8.0p-2") != 0))
656 result |= 16; 660 result |= 16;
657 /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a 661 /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a
658 glibc 2.4 bug <https://sourceware.org/bugzilla/show_bug.cgi?id=2908>. */ 662 glibc 2.4 bug <https://sourceware.org/PR2908>
663 and a FreeBSD 6.4, NetBSD 10.0 bug. */
659 if (sprintf (buf, "%.1La", 1.999L) < 0 664 if (sprintf (buf, "%.1La", 1.999L) < 0
660 || (strcmp (buf, "0x1.0p+1") != 0 665 || (strcmp (buf, "0x1.0p+1") != 0
661 && strcmp (buf, "0x2.0p+0") != 0 666 && strcmp (buf, "0x2.0p+0") != 0
@@ -893,9 +898,14 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N],
893 [AC_LANG_SOURCE([[ 898 [AC_LANG_SOURCE([[
894#include <signal.h> 899#include <signal.h>
895#include <stdio.h> 900#include <stdio.h>
896#include <stdlib.h>
897#include <string.h> 901#include <string.h>
902#if defined _WIN32 && !defined __CYGWIN__
903# include <stdlib.h>
904#else
905# include <unistd.h>
906#endif
898#ifdef _MSC_VER 907#ifdef _MSC_VER
908#include <crtdbg.h>
899#include <inttypes.h> 909#include <inttypes.h>
900/* See page about "Parameter Validation" on msdn.microsoft.com. 910/* See page about "Parameter Validation" on msdn.microsoft.com.
901 <https://docs.microsoft.com/en-us/cpp/c-runtime-library/parameter-validation> 911 <https://docs.microsoft.com/en-us/cpp/c-runtime-library/parameter-validation>
@@ -922,9 +932,12 @@ int main ()
922 int count = -1; 932 int count = -1;
923#ifdef _MSC_VER 933#ifdef _MSC_VER
924 _set_invalid_parameter_handler (invalid_parameter_handler); 934 _set_invalid_parameter_handler (invalid_parameter_handler);
935 /* Also avoid an Abort/Retry/Ignore dialog in debug builds.
936 <https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/crtsetreportmode> */
937 _CrtSetReportMode (_CRT_ASSERT, 0);
925#endif 938#endif
926 signal (SIGABRT, abort_handler); 939 signal (SIGABRT, abort_handler);
927 /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) 940 /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE >= 2)
928 support %n in format strings in read-only memory but not in writable 941 support %n in format strings in read-only memory but not in writable
929 memory. */ 942 memory. */
930 strcpy (fmtstring, "%d %n"); 943 strcpy (fmtstring, "%d %n");
@@ -981,7 +994,7 @@ int main ()
981 int result = 0; 994 int result = 0;
982 char buf[100]; 995 char buf[100];
983 /* Test whether %ls works at all. 996 /* Test whether %ls works at all.
984 This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, but not on 997 This test fails on OpenBSD 4.0, Solaris 2.6, Haiku, but not on
985 Cygwin 1.5. */ 998 Cygwin 1.5. */
986 { 999 {
987 static const wchar_t wstring[] = { 'a', 'b', 'c', 0 }; 1000 static const wchar_t wstring[] = { 'a', 'b', 'c', 0 };
@@ -990,8 +1003,8 @@ int main ()
990 || strcmp (buf, "abc") != 0) 1003 || strcmp (buf, "abc") != 0)
991 result |= 1; 1004 result |= 1;
992 } 1005 }
993 /* This test fails on IRIX 6.5, Solaris 2.6, Cygwin 1.5, Haiku (with an 1006 /* This test fails on Solaris 2.6, Cygwin 1.5, Haiku (with an assertion
994 assertion failure inside libc), but not on OpenBSD 4.0. */ 1007 failure inside libc), but not on OpenBSD 4.0. */
995 { 1008 {
996 static const wchar_t wstring[] = { 'a', 0 }; 1009 static const wchar_t wstring[] = { 'a', 0 };
997 buf[0] = '\0'; 1010 buf[0] = '\0';
@@ -1024,7 +1037,6 @@ changequote(,)dnl
1024 # Guess yes on OpenBSD >= 6.0. 1037 # Guess yes on OpenBSD >= 6.0.
1025 openbsd[1-5].*) gl_cv_func_printf_directive_ls="guessing no";; 1038 openbsd[1-5].*) gl_cv_func_printf_directive_ls="guessing no";;
1026 openbsd*) gl_cv_func_printf_directive_ls="guessing yes";; 1039 openbsd*) gl_cv_func_printf_directive_ls="guessing yes";;
1027 irix*) gl_cv_func_printf_directive_ls="guessing no";;
1028 solaris*) gl_cv_func_printf_directive_ls="guessing no";; 1040 solaris*) gl_cv_func_printf_directive_ls="guessing no";;
1029 cygwin*) gl_cv_func_printf_directive_ls="guessing no";; 1041 cygwin*) gl_cv_func_printf_directive_ls="guessing no";;
1030 beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; 1042 beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";;
@@ -1173,6 +1185,112 @@ changequote([,])dnl
1173 ]) 1185 ])
1174]) 1186])
1175 1187
1188dnl Test whether the *printf family of functions supports POSIX/XSI format
1189dnl strings with the ' flag for grouping of decimal digits on integers,
1190dnl together with a precision.
1191dnl Result is gl_cv_func_printf_flag_grouping_int_precision.
1192
1193AC_DEFUN([gl_PRINTF_FLAG_GROUPING_INT_PRECISION],
1194[
1195 AC_REQUIRE([AC_PROG_CC])
1196 AC_REQUIRE([AC_CANONICAL_HOST])
1197 AC_CACHE_CHECK([whether printf supports grouping on integers with a precision],
1198 [gl_cv_func_printf_flag_grouping_int_precision],
1199 [
1200 dnl Prepare a guess, used when cross-compiling or when specific locales
1201 dnl are not available.
1202 case "$host_os" in
1203 # Guess no on FreeBSD, NetBSD, Solaris, Cygwin, Haiku.
1204 freebsd* | dragonfly* | netbsd* | solaris* | cygwin* | haiku*)
1205 gl_cv_func_printf_flag_grouping_int_precision="guessing no";;
1206 *)
1207 gl_cv_func_printf_flag_grouping_int_precision="guessing yes";;
1208 esac
1209 AC_RUN_IFELSE(
1210 [AC_LANG_SOURCE([[
1211#include <locale.h>
1212#include <stdio.h>
1213#include <string.h>
1214static char buf[100];
1215int main ()
1216{
1217 if (setlocale (LC_ALL, "fr_FR.UTF-8") != NULL
1218 || setlocale (LC_ALL, "fr_FR") != NULL
1219 || setlocale (LC_ALL, "fr_FR.ISO-8859-1") != NULL
1220 || setlocale (LC_ALL, "fr_FR.ISO8859-1") != NULL)
1221 {
1222 if (sprintf (buf, "%'.10d", 1000) < 0)
1223 return 1;
1224 if (strlen (buf) == 10 && strcmp (buf, "0000001000") != 0)
1225 /* The sprintf implementation has produced fewer than 10 digits. */
1226 return 2;
1227 else
1228 return 0;
1229 }
1230 return 3;
1231}]])],
1232 [gl_cv_func_printf_flag_grouping_int_precision=yes],
1233 [if test $? = 2; then
1234 gl_cv_func_printf_flag_grouping_int_precision=no
1235 fi
1236 ],
1237 [:])
1238 ])
1239])
1240
1241dnl Test whether the *printf family of functions supports POSIX/XSI format
1242dnl strings with the ' flag for grouping of decimal digits, when the thousands
1243dnl separator is a multibyte character (such as U+00A0 or U+202F in a UTF-8
1244dnl locale).
1245dnl Result is gl_cv_func_printf_flag_grouping_multibyte.
1246
1247AC_DEFUN([gl_PRINTF_FLAG_GROUPING_MULTIBYTE],
1248[
1249 AC_REQUIRE([AC_PROG_CC])
1250 AC_REQUIRE([AC_CANONICAL_HOST])
1251 AC_CACHE_CHECK([whether printf supports grouping with a multibyte separator],
1252 [gl_cv_func_printf_flag_grouping_multibyte],
1253 [
1254 dnl Prepare a guess, used when cross-compiling or when specific locales
1255 dnl are not available.
1256 case "$host_os" in
1257 # Guess no on NetBSD and Solaris 11 OpenIndiana.
1258 netbsd* | solaris*)
1259 gl_cv_func_printf_flag_grouping_multibyte="guessing no";;
1260 *)
1261 gl_cv_func_printf_flag_grouping_multibyte="guessing yes";;
1262 esac
1263 AC_RUN_IFELSE(
1264 [AC_LANG_SOURCE([[
1265#include <locale.h>
1266#include <stdio.h>
1267#include <string.h>
1268static char buf[100];
1269int main ()
1270{
1271 if (setlocale (LC_ALL, "fr_FR.UTF-8") == NULL)
1272 return 0;
1273 if (sprintf (buf, "%'.0f", 1000.0) < 0)
1274 return 1;
1275 if (strlen (localeconv ()->thousands_sep) > 1)
1276 {
1277 if (strlen (buf) <= 4 + 1)
1278 return 2;
1279 else
1280 return 3;
1281 }
1282 return 0;
1283}]])],
1284 [:],
1285 [case $? in
1286 2) gl_cv_func_printf_flag_grouping_multibyte=no ;;
1287 3) gl_cv_func_printf_flag_grouping_multibyte=yes ;;
1288 esac
1289 ],
1290 [:])
1291 ])
1292])
1293
1176dnl Test whether the *printf family of functions supports the - flag correctly. 1294dnl Test whether the *printf family of functions supports the - flag correctly.
1177dnl (ISO C99.) See 1295dnl (ISO C99.) See
1178dnl <https://lists.gnu.org/r/bug-coreutils/2008-02/msg00035.html> 1296dnl <https://lists.gnu.org/r/bug-coreutils/2008-02/msg00035.html>
@@ -1470,10 +1588,6 @@ changequote(,)dnl
1470 *) gl_cv_func_printf_enomem="guessing no";; 1588 *) gl_cv_func_printf_enomem="guessing no";;
1471 esac 1589 esac
1472 ;; 1590 ;;
1473 # Guess yes on IRIX.
1474 irix*) gl_cv_func_printf_enomem="guessing yes";;
1475 # Guess yes on OSF/1.
1476 osf*) gl_cv_func_printf_enomem="guessing yes";;
1477 # Guess yes on BeOS. 1591 # Guess yes on BeOS.
1478 beos*) gl_cv_func_printf_enomem="guessing yes";; 1592 beos*) gl_cv_func_printf_enomem="guessing yes";;
1479 # Guess yes on Haiku. 1593 # Guess yes on Haiku.
@@ -1565,11 +1679,6 @@ changequote(,)dnl
1565 # Guess yes on HP-UX >= 11. 1679 # Guess yes on HP-UX >= 11.
1566 hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";; 1680 hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";;
1567 hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";; 1681 hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1568 # Guess yes on IRIX >= 6.5.
1569 irix6.5) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1570 # Guess yes on OSF/1 >= 5.
1571 osf[3-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
1572 osf*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1573 # Guess yes on NetBSD >= 3. 1682 # Guess yes on NetBSD >= 3.
1574 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) 1683 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
1575 gl_cv_func_snprintf_truncation_c99="guessing no";; 1684 gl_cv_func_snprintf_truncation_c99="guessing no";;
@@ -1591,7 +1700,7 @@ changequote([,])dnl
1591dnl Test whether the return value of the snprintf function is the number 1700dnl Test whether the return value of the snprintf function is the number
1592dnl of bytes (excluding the terminating NUL) that would have been produced 1701dnl of bytes (excluding the terminating NUL) that would have been produced
1593dnl if the buffer had been large enough. (ISO C99, POSIX:2001) 1702dnl if the buffer had been large enough. (ISO C99, POSIX:2001)
1594dnl For example, this test program fails on IRIX 6.5: 1703dnl For example, this test program fails on HP-UX 11.31 and Solaris 9:
1595dnl --------------------------------------------------------------------- 1704dnl ---------------------------------------------------------------------
1596dnl #include <stdio.h> 1705dnl #include <stdio.h>
1597dnl int main() 1706dnl int main()
@@ -1709,6 +1818,11 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N],
1709#include <signal.h> 1818#include <signal.h>
1710#include <stdio.h> 1819#include <stdio.h>
1711#include <string.h> 1820#include <string.h>
1821#if defined _WIN32 && !defined __CYGWIN__
1822# include <stdlib.h>
1823#else
1824# include <unistd.h>
1825#endif
1712#if HAVE_SNPRINTF 1826#if HAVE_SNPRINTF
1713# define my_snprintf snprintf 1827# define my_snprintf snprintf
1714#else 1828#else
@@ -1735,7 +1849,7 @@ int main ()
1735{ 1849{
1736 int count = -1; 1850 int count = -1;
1737 signal (SIGABRT, abort_handler); 1851 signal (SIGABRT, abort_handler);
1738 /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) 1852 /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE >= 2)
1739 support %n in format strings in read-only memory but not in writable 1853 support %n in format strings in read-only memory but not in writable
1740 memory. */ 1854 memory. */
1741 strcpy (fmtstring, "%d %n"); 1855 strcpy (fmtstring, "%d %n");
@@ -1775,11 +1889,6 @@ changequote(,)dnl
1775 # Guess yes on AIX >= 4. 1889 # Guess yes on AIX >= 4.
1776 aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";; 1890 aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";;
1777 aix*) gl_cv_func_snprintf_directive_n="guessing yes";; 1891 aix*) gl_cv_func_snprintf_directive_n="guessing yes";;
1778 # Guess yes on IRIX >= 6.5.
1779 irix6.5) gl_cv_func_snprintf_directive_n="guessing yes";;
1780 # Guess yes on OSF/1 >= 5.
1781 osf[3-4]*) gl_cv_func_snprintf_directive_n="guessing no";;
1782 osf*) gl_cv_func_snprintf_directive_n="guessing yes";;
1783 # Guess yes on NetBSD >= 3. 1892 # Guess yes on NetBSD >= 3.
1784 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) 1893 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
1785 gl_cv_func_snprintf_directive_n="guessing no";; 1894 gl_cv_func_snprintf_directive_n="guessing no";;
@@ -1934,8 +2043,6 @@ changequote(,)dnl
1934 # Guess yes on AIX >= 4. 2043 # Guess yes on AIX >= 4.
1935 aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; 2044 aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
1936 aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; 2045 aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1937 # Guess yes on IRIX >= 6.5.
1938 irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1939 # Guess yes on NetBSD >= 3. 2046 # Guess yes on NetBSD >= 3.
1940 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) 2047 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
1941 gl_cv_func_vsnprintf_zerosize_c99="guessing no";; 2048 gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
@@ -2143,20 +2250,22 @@ dnl 11 = gl_PRINTF_DIRECTIVE_LS
2143dnl 12 = gl_PRINTF_DIRECTIVE_LC 2250dnl 12 = gl_PRINTF_DIRECTIVE_LC
2144dnl 13 = gl_PRINTF_POSITIONS 2251dnl 13 = gl_PRINTF_POSITIONS
2145dnl 14 = gl_PRINTF_FLAG_GROUPING 2252dnl 14 = gl_PRINTF_FLAG_GROUPING
2146dnl 15 = gl_PRINTF_FLAG_LEFTADJUST 2253dnl 15 = gl_PRINTF_FLAG_GROUPING_INT_PRECISION
2147dnl 16 = gl_PRINTF_FLAG_ZERO 2254dnl 16 = gl_PRINTF_FLAG_GROUPING_MULTIBYTE
2148dnl 17 = gl_PRINTF_FLAG_ALT_PRECISION_ZERO 2255dnl 17 = gl_PRINTF_FLAG_LEFTADJUST
2149dnl 18 = gl_PRINTF_PRECISION 2256dnl 18 = gl_PRINTF_FLAG_ZERO
2150dnl 19 = gl_PRINTF_ENOMEM 2257dnl 19 = gl_PRINTF_FLAG_ALT_PRECISION_ZERO
2151dnl 20 = gl_SNPRINTF_PRESENCE 2258dnl 20 = gl_PRINTF_PRECISION
2152dnl 21 = gl_SNPRINTF_TRUNCATION_C99 2259dnl 21 = gl_PRINTF_ENOMEM
2153dnl 22 = gl_SNPRINTF_RETVAL_C99 2260dnl 22 = gl_SNPRINTF_PRESENCE
2154dnl 23 = gl_SNPRINTF_DIRECTIVE_N 2261dnl 23 = gl_SNPRINTF_TRUNCATION_C99
2155dnl 24 = gl_SNPRINTF_SIZE1 2262dnl 24 = gl_SNPRINTF_RETVAL_C99
2156dnl 25 = gl_VSNPRINTF_ZEROSIZE_C99 2263dnl 25 = gl_SNPRINTF_DIRECTIVE_N
2157dnl 26 = gl_SWPRINTF_WORKS 2264dnl 26 = gl_SNPRINTF_SIZE1
2158dnl 27 = gl_SWPRINTF_DIRECTIVE_LA 2265dnl 27 = gl_VSNPRINTF_ZEROSIZE_C99
2159dnl 28 = gl_SWPRINTF_DIRECTIVE_LC 2266dnl 28 = gl_SWPRINTF_WORKS
2267dnl 29 = gl_SWPRINTF_DIRECTIVE_LA
2268dnl 30 = gl_SWPRINTF_DIRECTIVE_LC
2160dnl 2269dnl
2161dnl 1 = checking whether printf supports size specifiers as in C99... 2270dnl 1 = checking whether printf supports size specifiers as in C99...
2162dnl 2 = checking whether printf supports size specifiers as in C23... 2271dnl 2 = checking whether printf supports size specifiers as in C23...
@@ -2172,62 +2281,64 @@ dnl 11 = checking whether printf supports the 'ls' directive...
2172dnl 12 = checking whether printf supports the 'lc' directive correctly... 2281dnl 12 = checking whether printf supports the 'lc' directive correctly...
2173dnl 13 = checking whether printf supports POSIX/XSI format strings with positions... 2282dnl 13 = checking whether printf supports POSIX/XSI format strings with positions...
2174dnl 14 = checking whether printf supports the grouping flag... 2283dnl 14 = checking whether printf supports the grouping flag...
2175dnl 15 = checking whether printf supports the left-adjust flag correctly... 2284dnl 15 = checking whether printf supports grouping on integers with a precision...
2176dnl 16 = checking whether printf supports the zero flag correctly... 2285dnl 16 = checking whether printf supports grouping with a multibyte separator...
2177dnl 17 = checking whether printf supports the alternative flag with a zero precision... 2286dnl 17 = checking whether printf supports the left-adjust flag correctly...
2178dnl 18 = checking whether printf supports large precisions... 2287dnl 18 = checking whether printf supports the zero flag correctly...
2179dnl 19 = checking whether printf survives out-of-memory conditions... 2288dnl 19 = checking whether printf supports the alternative flag with a zero precision...
2180dnl 20 = checking for snprintf... 2289dnl 20 = checking whether printf supports large precisions...
2181dnl 21 = checking whether snprintf truncates the result as in C99... 2290dnl 21 = checking whether printf survives out-of-memory conditions...
2182dnl 22 = checking whether snprintf returns a byte count as in C99... 2291dnl 22 = checking for snprintf...
2183dnl 23 = checking whether snprintf fully supports the 'n' directive... 2292dnl 23 = checking whether snprintf truncates the result as in C99...
2184dnl 24 = checking whether snprintf respects a size of 1... 2293dnl 24 = checking whether snprintf returns a byte count as in C99...
2185dnl 25 = checking whether vsnprintf respects a zero size as in C99... 2294dnl 25 = checking whether snprintf fully supports the 'n' directive...
2186dnl 26 = checking whether swprintf works... 2295dnl 26 = checking whether snprintf respects a size of 1...
2187dnl 27 = checking whether swprintf supports the 'La' and 'LA' directives... 2296dnl 27 = checking whether vsnprintf respects a zero size as in C99...
2188dnl 28 = checking whether swprintf supports the 'lc' directive... 2297dnl 28 = checking whether swprintf works...
2298dnl 29 = checking whether swprintf supports the 'La' and 'LA' directives...
2299dnl 30 = checking whether swprintf supports the 'lc' directive...
2189dnl 2300dnl
2190dnl . = yes, # = no. 2301dnl . = yes, # = no.
2191dnl 2302dnl
2192dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 2303dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
2193dnl musl libc 1.2.3 . # . . . . # # . . . # . . . . ? . . . . . . . . # . # 2304dnl musl libc 1.2.3 . # . . . . # # . . . # . . . . . . . . . . . . . . . # . #
2194dnl glibc 2.35 . # . . . . . . . . . . . . . . . . . . . . . . . . . . 2305dnl glibc 2.35 . # . . . . . . . . . . . . # . . . . . . . . . . . . . . .
2195dnl glibc 2.5 . # . . . . # # . . . . . . . . . . . . . . . . . . # . 2306dnl glibc 2.5 . # . . . . # # . . . . . . # . . . . . . . . . . . . . # .
2196dnl glibc 2.3.6 . # . . . # # # . . . . . . . . . . . . . . . . . . # . 2307dnl glibc 2.3.6 . # . . . # # # . . . . . . . . . . . . . . . . . . . . # .
2197dnl FreeBSD 14.0 . . . . . # . . . . . . . . . . . . # . . . . . . # . # 2308dnl FreeBSD 14.0 . . . . . # . . . . . . . . # . . . . . # . . . . . . # . #
2198dnl FreeBSD 13.0 . # . . . # # # . . . . . . . . . . # . . . . . . # . # 2309dnl FreeBSD 13.0 . # . . . # # # . . . . . . # . . . . . # . . . . . . # . #
2199dnl FreeBSD 5.4, 6.1 . # . . . # # # . . . . . . . # ? . # . . . . . . # ? ? 2310dnl FreeBSD 5.4, 6.1 . # . . . # # # . . . . . . . . . # ? . # . . . . . . # ? ?
2200dnl Mac OS X 10.13.5 . # . . # # # # . # . . . . . . . . . . . . # . . # ? ? 2311dnl Mac OS X 10.13.5 . # . . # # # # . # . . . . ? ? . . . . . . . . # . . # ? ?
2201dnl Mac OS X 10.5.8 . # . . # # # # . . . . . . . # # . . . . . . . . # ? ? 2312dnl Mac OS X 10.5.8 . # . . # # # # . . . . . . ? ? . # # . . . . . . . . # ? ?
2202dnl Mac OS X 10.3.9 . # . . . # # # . . . . . . . # # . # . . . . . . # ? ? 2313dnl Mac OS X 10.3.9 . # . . . # # # . . . . . . ? ? . # # . # . . . . . . # ? ?
2203dnl OpenBSD 6.0, 6.7 . # . . . # # # . . . . . . . . . . # . . . . . . # . # 2314dnl OpenBSD 6.0, 6.7 . # . . . # # # . . . . . . . . . . . . # . . . . . . # . #
2204dnl OpenBSD 3.9, 4.0 . # . # # # # # # . # . . # . # ? . # . . . . . . # ? ? 2315dnl OpenBSD 3.9, 4.0 . # . # # # # # # . # . . # ? ? . # ? . # . . . . . . # ? ?
2205dnl Cygwin 1.7.0 (2009) . # . . # . # # . . ? ? . . . . ? . ? . . . . . . ? ? ? 2316dnl Cygwin 1.7.0 (2009) . # . . # . # # . . ? ? . . ? ? . . ? . ? . . . . . . ? ? ?
2206dnl Cygwin 1.5.25 (2008) . # . . # # # # . . # ? . . . . ? . # . . . . . . ? ? ? 2317dnl Cygwin 1.5.25 (2008) . # . . # # # # . . # ? . . ? ? . . ? . # . . . . . . ? ? ?
2207dnl Cygwin 1.5.19 (2006) # # . . # # # # # . # ? . # . # ? # # . . . . . . ? ? ? 2318dnl Cygwin 1.5.19 (2006) # # . . # # # # # . # ? . # ? ? . # ? # # . . . . . . ? ? ?
2208dnl Solaris 11.4 . # . # # # # # . . # . . . . # . . . . . . . . . . # . 2319dnl Solaris 11.4 . # . # # # # # . . # . . . # # . # . . . . . . . . . . # .
2209dnl Solaris 11.3 . # . . . # # # . . # . . . . . . . . . . . . . . . # . 2320dnl Solaris 11.3 . # . . . # # # . . # . . . ? ? . . . . . . . . . . . . # .
2210dnl Solaris 11.0 . # . # # # # # . . # . . . . # . . . . . . . . . ? ? ? 2321dnl Solaris 11.0 . # . # # # # # . . # . . . ? ? . # . . . . . . . . . ? ? ?
2211dnl Solaris 10 . # . # # # # # . . # . . . . # . # . . . . . . . . # . 2322dnl Solaris 10 . # . # # # # # . . # . . . # # . # . # . . . . . . . . # .
2212dnl Solaris 2.6 ... 9 # # . # # # # # # . # . . . . # ? # . . . # . . . ? ? ? 2323dnl Solaris 2.6 ... 9 # # . # # # # # # . # . . . ? ? . # ? # . . . # . . . ? ? ?
2213dnl Solaris 2.5.1 # # . # # # # # # . # . . . . # ? . . # # # # # # ? ? ? 2324dnl Solaris 2.5.1 # # . # # # # # # . # . . . ? ? . # ? . . # # # # # # ? ? ?
2214dnl AIX 7.1 . # . # # # # # . . . . . . . # . # . . . . . . . # . . 2325dnl AIX 7.1 . # . # # # # # . . . . . . . . . # . # . . . . . . . # . .
2215dnl AIX 5.2 . # . # # # # # . . . . . . . # ? . . . . . . . . # ? ? 2326dnl AIX 5.2 . # . # # # # # . . . . . . ? ? . # ? . . . . . . . . # ? ?
2216dnl AIX 4.3.2, 5.1 # # . # # # # # # . . . . . . # ? . . . . # . . . # ? ? 2327dnl AIX 4.3.2, 5.1 # # . # # # # # # . . . . . ? ? . # ? . . . . # . . . # ? ?
2217dnl HP-UX 11.31 . # . . . # # # . . . ? . . . # ? . . . . # # . . ? ? ? 2328dnl HP-UX 11.31 . # . . . # # # . . . ? . . ? ? . # ? . . . . # # . . ? ? ?
2218dnl HP-UX 11.{00,11,23} # # . . . # # # # . . ? . . . # ? . . . . # # . # ? ? ? 2329dnl HP-UX 11.{00,11,23} # # . . . # # # # . . ? . . ? ? . # ? . . . . # # . # ? ? ?
2219dnl HP-UX 10.20 # # . # . # # # # . ? ? . . # # ? . . . . # # ? # ? ? ? 2330dnl HP-UX 10.20 # # . # . # # # # . ? ? . . ? ? # # ? . . . . # # ? # ? ? ?
2220dnl IRIX 6.5 # # . # # # # # # . # . . . . # ? . . . . # . . . # ? ? 2331dnl IRIX 6.5 # # . # # # # # # . # . . . ? ? . # ? . . . . # . . . # ? ?
2221dnl OSF/1 5.1 # # . # # # # # # . . ? . . . # ? . . . . # . . # ? ? ? 2332dnl OSF/1 5.1 # # . # # # # # # . . ? . . ? ? . # ? . . . . # . . # ? ? ?
2222dnl OSF/1 4.0d # # . # # # # # # . . ? . . . # ? . . # # # # # # ? ? ? 2333dnl OSF/1 4.0d # # . # # # # # # . . ? . . ? ? . # ? . . # # # # # # ? ? ?
2223dnl NetBSD 9.0 . # . . . # # # . . . . . . . . . . . . . . . . . # . # 2334dnl NetBSD 9.0 . # . . . # # # . . . . . . # # . . . . . . . . . . . # . #
2224dnl NetBSD 5.0 . # . . # # # # . . . . . . . # ? . # . . . . . . # ? ? 2335dnl NetBSD 5.0 . # . . # # # # . . . . . . ? ? . # ? . # . . . . . . # ? ?
2225dnl NetBSD 4.0 . # ? ? ? ? # # ? . ? . . ? ? ? ? ? ? . . . ? ? ? # ? ? 2336dnl NetBSD 4.0 . # ? ? ? ? # # ? . ? . . ? ? ? ? ? ? ? ? . . . ? ? ? # ? ?
2226dnl NetBSD 3.0 . # . . . # # # # . ? . # # ? # ? . # . . . . . . # ? ? 2337dnl NetBSD 3.0 . # . . . # # # # . ? . # # ? ? ? # ? . # . . . . . . # ? ?
2227dnl Haiku . # . . # # # # # . # ? . . . . ? . ? . . ? . . . . # . 2338dnl Haiku . # . . # # # # # . # ? . . # . . . ? . ? . . ? . . . . # .
2228dnl BeOS # # # . # # # # # . ? ? # . ? . ? # ? . . ? . . . ? ? ? 2339dnl BeOS # # # . # # # # # . ? ? # . ? ? ? . ? # ? . . ? . . . ? ? ?
2229dnl Android 4.3 . # . # # # # # # # # ? . # . # ? . # . . . # . . ? ? ? 2340dnl Android 4.3 . # . # # # # # # # # ? . # ? ? . # ? . # . . . # . . ? ? ?
2230dnl old mingw / msvcrt # # # # # # # # # . . ? # # . # ? # ? . # # # . . # ? ? 2341dnl old mingw / msvcrt # # # # # # # # # . . ? # # ? ? . # ? # ? . # # # . . # ? ?
2231dnl MSVC 9 # # # # # # # # # # . ? # # . # ? # ? # # # # . . # ? ? 2342dnl MSVC 9 # # # # # # # # # # . ? # # ? ? . # ? # ? # # # # . . # ? ?
2232dnl mingw 2009-2011 . # # . # . # # . . . ? # # . . ? . ? . . . . . . # ? ? 2343dnl mingw 2009-2011 . # # . # . # # . . . ? # # ? ? . . ? . ? . . . . . . # ? ?
2233dnl mingw-w64 2011 # # # # # # # # # . . ? # # . # ? # ? . # # # . . # ? ? 2344dnl mingw-w64 2011 # # # # # # # # # . . ? # # ? ? . # ? # ? . # # # . . # ? ?
diff --git a/gl/m4/pthread-once.m4 b/gl/m4/pthread-once.m4
new file mode 100644
index 00000000..9080363d
--- /dev/null
+++ b/gl/m4/pthread-once.m4
@@ -0,0 +1,83 @@
1# pthread-once.m4
2# serial 6
3dnl Copyright (C) 2019-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN([gl_PTHREAD_ONCE],
10[
11 AC_REQUIRE([gl_PTHREAD_H])
12 AC_REQUIRE([AC_CANONICAL_HOST])
13 AC_REQUIRE([gl_PTHREADLIB])
14
15 if { case "$host_os" in mingw* | windows*) true;; *) false;; esac; } \
16 && test $gl_threads_api = windows; then
17 dnl Choose function names that don't conflict with the mingw-w64 winpthreads
18 dnl library.
19 REPLACE_PTHREAD_ONCE=1
20 PTHREAD_ONCE_LIB=
21 else
22 if test $HAVE_PTHREAD_H = 0; then
23 HAVE_PTHREAD_ONCE=0
24 PTHREAD_ONCE_LIB=
25 else
26 dnl Work around Cygwin 3.5.3 bug.
27 AC_CACHE_CHECK([whether pthread_once works],
28 [gl_cv_func_pthread_once_works],
29 [case "$host_os" in
30 cygwin*) gl_cv_func_pthread_once_works="guessing no" ;;
31 *) gl_cv_func_pthread_once_works="yes" ;;
32 esac
33 ])
34 case "$gl_cv_func_pthread_once_works" in
35 *yes) ;;
36 *) REPLACE_PTHREAD_ONCE=1 ;;
37 esac
38 dnl Determine whether linking requires $(LIBPMULTITHREAD) or only
39 dnl $(LIBPTHREAD).
40 if test -z "$LIBPTHREAD" && test -n "$LIBPMULTITHREAD"; then
41 AC_CACHE_CHECK([whether pthread_once can be used without linking with libpthread],
42 [gl_cv_func_pthread_once_no_lib],
43 [AC_RUN_IFELSE(
44 [AC_LANG_PROGRAM(
45 [[#include <pthread.h>
46 static pthread_once_t a_once = PTHREAD_ONCE_INIT;
47 static int a;
48 static void a_init (void) { a = 8647; }
49 ]],
50 [[if (pthread_once (&a_once, a_init)) return 1;
51 if (a != 8647) return 2;
52 return 0;
53 ]])],
54 [gl_cv_func_pthread_once_no_lib=yes],
55 [gl_cv_func_pthread_once_no_lib=no],
56 [case "$host_os" in
57 # Guess no on glibc.
58 *-gnu* | gnu*)
59 gl_cv_func_pthread_once_no_lib="guessing no" ;;
60 # Guess no on FreeBSD.
61 freebsd* | dragonfly* | midnightbsd*)
62 gl_cv_func_pthread_once_no_lib="guessing no" ;;
63 # Guess yes otherwise.
64 *)
65 gl_cv_func_pthread_once_no_lib="guessing yes" ;;
66 esac
67 ])
68 ])
69 case "$gl_cv_func_pthread_once_no_lib" in
70 *yes) PTHREAD_ONCE_LIB="$LIBPTHREAD" ;;
71 *) PTHREAD_ONCE_LIB="$LIBPMULTITHREAD" ;;
72 esac
73 dnl Expected result:
74 dnl PTHREAD_ONCE_LIB is $(LIBPMULTITHREAD) on glibc < 2.34, FreeBSD.
75 dnl PTHREAD_ONCE_LIB is $(LIBPTHREAD) in particular on
76 dnl musl libc, macOS, NetBSD, Solaris, Cygwin, Haiku, Android.
77 else
78 PTHREAD_ONCE_LIB="$LIBPTHREAD"
79 fi
80 fi
81 fi
82 AC_SUBST([PTHREAD_ONCE_LIB])
83])
diff --git a/gl/m4/pthread-spin.m4 b/gl/m4/pthread-spin.m4
new file mode 100644
index 00000000..17fa3b5e
--- /dev/null
+++ b/gl/m4/pthread-spin.m4
@@ -0,0 +1,72 @@
1# pthread-spin.m4
2# serial 8
3dnl Copyright (C) 2019-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN_ONCE([gl_PTHREAD_SPIN],
10[
11 AC_REQUIRE([gl_PTHREAD_H_PART1])
12 AC_REQUIRE([AC_CANONICAL_HOST])
13
14 if { case "$host_os" in mingw* | windows*) true;; *) false;; esac; } \
15 && test $gl_threads_api = windows; then
16 dnl Choose function names that don't conflict with the mingw-w64 winpthreads
17 dnl library.
18 REPLACE_PTHREAD_SPIN_INIT=1
19 REPLACE_PTHREAD_SPIN_LOCK=1
20 REPLACE_PTHREAD_SPIN_TRYLOCK=1
21 REPLACE_PTHREAD_SPIN_UNLOCK=1
22 REPLACE_PTHREAD_SPIN_DESTROY=1
23 else
24 if test $HAVE_PTHREAD_H = 0 || test $HAVE_PTHREAD_SPINLOCK_T = 0; then
25 HAVE_PTHREAD_SPIN_INIT=0
26 HAVE_PTHREAD_SPIN_LOCK=0
27 HAVE_PTHREAD_SPIN_TRYLOCK=0
28 HAVE_PTHREAD_SPIN_UNLOCK=0
29 HAVE_PTHREAD_SPIN_DESTROY=0
30 else
31 dnl Test whether the gnulib module 'threadlib' is in use.
32 dnl Some packages like Emacs use --avoid=threadlib.
33 dnl Write the symbol in such a way that it does not cause 'aclocal' to pick
34 dnl the threadlib.m4 file that is installed in $PREFIX/share/aclocal/.
35 m4_ifdef([gl_][THREADLIB], [
36 AC_REQUIRE([gl_][THREADLIB])
37 dnl Test whether the functions actually exist.
38 dnl FreeBSD 5.2.1 declares them but does not define them.
39 AC_CACHE_CHECK([for pthread_spin_init],
40 [gl_cv_func_pthread_spin_init_in_LIBMULTITHREAD],
41 [gl_saved_LIBS="$LIBS"
42 LIBS="$LIBS $LIBMULTITHREAD"
43 AC_LINK_IFELSE(
44 [AC_LANG_PROGRAM(
45 [[#include <pthread.h>
46 ]],
47 [[pthread_spinlock_t lock;
48 return pthread_spin_init (&lock, 0);
49 ]])
50 ],
51 [gl_cv_func_pthread_spin_init_in_LIBMULTITHREAD=yes],
52 [gl_cv_func_pthread_spin_init_in_LIBMULTITHREAD=no])
53 LIBS="$gl_saved_LIBS"
54 ])
55 if test $gl_cv_func_pthread_spin_init_in_LIBMULTITHREAD != yes; then
56 HAVE_PTHREAD_SPIN_INIT=0
57 REPLACE_PTHREAD_SPIN_INIT=1
58 HAVE_PTHREAD_SPIN_LOCK=0
59 REPLACE_PTHREAD_SPIN_LOCK=1
60 HAVE_PTHREAD_SPIN_TRYLOCK=0
61 REPLACE_PTHREAD_SPIN_TRYLOCK=1
62 HAVE_PTHREAD_SPIN_UNLOCK=0
63 REPLACE_PTHREAD_SPIN_UNLOCK=1
64 HAVE_PTHREAD_SPIN_DESTROY=0
65 REPLACE_PTHREAD_SPIN_DESTROY=1
66 fi
67 ], [
68 :
69 ])
70 fi
71 fi
72])
diff --git a/gl/m4/pthread_h.m4 b/gl/m4/pthread_h.m4
new file mode 100644
index 00000000..f01dc3d3
--- /dev/null
+++ b/gl/m4/pthread_h.m4
@@ -0,0 +1,293 @@
1# pthread_h.m4
2# serial 11
3dnl Copyright (C) 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN_ONCE([gl_PTHREAD_H_PART1],
10[
11 dnl Ensure to expand the default settings once only, before all statements
12 dnl that occur in other macros.
13 AC_REQUIRE([gl_PTHREAD_H_DEFAULTS])
14
15 AC_REQUIRE([AC_CANONICAL_HOST])
16 AC_REQUIRE([gl_PTHREADLIB])
17
18 gl_CHECK_NEXT_HEADERS([pthread.h])
19 if test $ac_cv_header_pthread_h = yes; then
20 HAVE_PTHREAD_H=1
21 dnl On mingw, if --enable-threads=windows or gl_AVOID_WINPTHREAD is used,
22 dnl ignore the <pthread.h> from the mingw-w64 winpthreads library.
23 m4_ifdef([gl_][THREADLIB], [
24 AC_REQUIRE([gl_][THREADLIB])
25 if { case "$host_os" in mingw* | windows*) true;; *) false;; esac; } \
26 && test $gl_threads_api = windows; then
27 HAVE_PTHREAD_H=0
28 fi
29 ])
30 else
31 HAVE_PTHREAD_H=0
32 fi
33 AC_SUBST([HAVE_PTHREAD_H])
34
35 AC_CHECK_TYPES([pthread_t, pthread_spinlock_t], [], [],
36 [AC_INCLUDES_DEFAULT[
37 #if HAVE_PTHREAD_H
38 #include <pthread.h>
39 #endif]])
40 if test $ac_cv_type_pthread_t != yes; then
41 HAVE_PTHREAD_T=0
42 fi
43 if test $ac_cv_type_pthread_spinlock_t != yes; then
44 HAVE_PTHREAD_SPINLOCK_T=0
45 fi
46])
47
48AC_DEFUN([gl_PTHREAD_H],
49[
50 AC_REQUIRE([gl_PTHREAD_H_PART1])
51
52 dnl Set HAVE_PTHREAD_SPIN_INIT, REPLACE_PTHREAD_SPIN_INIT.
53 gl_PTHREAD_SPIN
54
55 dnl Constants may be defined as C preprocessor macros or as enum items.
56
57 AC_CACHE_CHECK([for PTHREAD_CREATE_DETACHED],
58 [gl_cv_const_PTHREAD_CREATE_DETACHED],
59 [AC_COMPILE_IFELSE(
60 [AC_LANG_PROGRAM(
61 [[#include <pthread.h>
62 int x = PTHREAD_CREATE_DETACHED;
63 ]],
64 [[]])],
65 [gl_cv_const_PTHREAD_CREATE_DETACHED=yes],
66 [gl_cv_const_PTHREAD_CREATE_DETACHED=no])
67 ])
68 if test $gl_cv_const_PTHREAD_CREATE_DETACHED != yes; then
69 HAVE_PTHREAD_CREATE_DETACHED=0
70 fi
71
72 AC_CACHE_CHECK([for PTHREAD_MUTEX_RECURSIVE],
73 [gl_cv_const_PTHREAD_MUTEX_RECURSIVE],
74 [AC_COMPILE_IFELSE(
75 [AC_LANG_PROGRAM(
76 [[#include <pthread.h>
77 int x = PTHREAD_MUTEX_RECURSIVE;
78 ]],
79 [[]])],
80 [gl_cv_const_PTHREAD_MUTEX_RECURSIVE=yes],
81 [gl_cv_const_PTHREAD_MUTEX_RECURSIVE=no])
82 ])
83 if test $gl_cv_const_PTHREAD_MUTEX_RECURSIVE != yes; then
84 HAVE_PTHREAD_MUTEX_RECURSIVE=0
85 fi
86
87 AC_CACHE_CHECK([for PTHREAD_MUTEX_ROBUST],
88 [gl_cv_const_PTHREAD_MUTEX_ROBUST],
89 [AC_COMPILE_IFELSE(
90 [AC_LANG_PROGRAM(
91 [[#include <pthread.h>
92 int x = PTHREAD_MUTEX_ROBUST;
93 ]],
94 [[]])],
95 [gl_cv_const_PTHREAD_MUTEX_ROBUST=yes],
96 [gl_cv_const_PTHREAD_MUTEX_ROBUST=no])
97 ])
98 if test $gl_cv_const_PTHREAD_MUTEX_ROBUST != yes; then
99 HAVE_PTHREAD_MUTEX_ROBUST=0
100 fi
101
102 AC_CACHE_CHECK([for PTHREAD_PROCESS_SHARED],
103 [gl_cv_const_PTHREAD_PROCESS_SHARED],
104 [AC_COMPILE_IFELSE(
105 [AC_LANG_PROGRAM(
106 [[#include <pthread.h>
107 int x = PTHREAD_PROCESS_SHARED;
108 ]],
109 [[]])],
110 [gl_cv_const_PTHREAD_PROCESS_SHARED=yes],
111 [gl_cv_const_PTHREAD_PROCESS_SHARED=no])
112 ])
113 if test $gl_cv_const_PTHREAD_PROCESS_SHARED != yes; then
114 HAVE_PTHREAD_PROCESS_SHARED=0
115 fi
116
117 dnl Check for declarations of anything we want to poison if the
118 dnl corresponding gnulib module is not in use, if it is not common
119 dnl enough to be declared everywhere.
120 gl_WARN_ON_USE_PREPARE([[#include <pthread.h>
121 ]], [
122 pthread_create pthread_attr_init pthread_attr_getdetachstate
123 pthread_attr_setdetachstate pthread_attr_destroy pthread_self pthread_equal
124 pthread_detach pthread_join pthread_exit
125 pthread_once
126 pthread_mutex_init pthread_mutexattr_init pthread_mutexattr_gettype
127 pthread_mutexattr_settype pthread_mutexattr_getrobust
128 pthread_mutexattr_setrobust pthread_mutexattr_destroy pthread_mutex_lock
129 pthread_mutex_trylock pthread_mutex_timedlock pthread_mutex_unlock
130 pthread_mutex_destroy
131 pthread_rwlock_init pthread_rwlockattr_init pthread_rwlockattr_destroy
132 pthread_rwlock_rdlock pthread_rwlock_wrlock pthread_rwlock_tryrdlock
133 pthread_rwlock_trywrlock pthread_rwlock_timedrdlock
134 pthread_rwlock_timedwrlock pthread_rwlock_unlock pthread_rwlock_destroy
135 pthread_cond_init pthread_condattr_init pthread_condattr_destroy
136 pthread_cond_wait pthread_cond_timedwait pthread_cond_signal
137 pthread_cond_broadcast pthread_cond_destroy
138 pthread_key_create pthread_setspecific pthread_getspecific
139 pthread_key_delete
140 pthread_spin_init pthread_spin_lock pthread_spin_trylock pthread_spin_unlock
141 pthread_spin_destroy])
142
143 AC_REQUIRE([AC_C_RESTRICT])
144
145 dnl For backward compatibility with gnulib versions <= 2019-07.
146 LIB_PTHREAD="$LIBPMULTITHREAD"
147 AC_SUBST([LIB_PTHREAD])
148])
149
150# gl_PTHREAD_MODULE_INDICATOR([modulename])
151# sets the shell variable that indicates the presence of the given module
152# to a C preprocessor expression that will evaluate to 1.
153# This macro invocation must not occur in macros that are AC_REQUIREd.
154AC_DEFUN([gl_PTHREAD_MODULE_INDICATOR],
155[
156 dnl Ensure to expand the default settings once only.
157 gl_PTHREAD_H_REQUIRE_DEFAULTS
158 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
159 dnl Define it also as a C macro, for the benefit of the unit tests.
160 gl_MODULE_INDICATOR_FOR_TESTS([$1])
161])
162
163# Initializes the default values for AC_SUBSTed shell variables.
164# This macro must not be AC_REQUIREd. It must only be invoked, and only
165# outside of macros or in macros that are not AC_REQUIREd.
166AC_DEFUN([gl_PTHREAD_H_REQUIRE_DEFAULTS],
167[
168 m4_defun(GL_MODULE_INDICATOR_PREFIX[_PTHREAD_H_MODULE_INDICATOR_DEFAULTS], [
169 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_THREAD])
170 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_ONCE])
171 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_MUTEX])
172 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_RWLOCK])
173 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_COND])
174 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_TSS])
175 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_SPIN])
176 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_MUTEX_TIMEDLOCK])
177 ])
178 m4_require(GL_MODULE_INDICATOR_PREFIX[_PTHREAD_H_MODULE_INDICATOR_DEFAULTS])
179 AC_REQUIRE([gl_PTHREAD_H_DEFAULTS])
180])
181
182AC_DEFUN([gl_PTHREAD_H_DEFAULTS],
183[
184 dnl Assume proper GNU behavior unless another module says otherwise.
185 HAVE_PTHREAD_T=1; AC_SUBST([HAVE_PTHREAD_T])
186 HAVE_PTHREAD_SPINLOCK_T=1; AC_SUBST([HAVE_PTHREAD_SPINLOCK_T])
187 HAVE_PTHREAD_CREATE_DETACHED=1; AC_SUBST([HAVE_PTHREAD_CREATE_DETACHED])
188 HAVE_PTHREAD_MUTEX_RECURSIVE=1; AC_SUBST([HAVE_PTHREAD_MUTEX_RECURSIVE])
189 HAVE_PTHREAD_MUTEX_ROBUST=1; AC_SUBST([HAVE_PTHREAD_MUTEX_ROBUST])
190 HAVE_PTHREAD_PROCESS_SHARED=1; AC_SUBST([HAVE_PTHREAD_PROCESS_SHARED])
191 HAVE_PTHREAD_CREATE=1; AC_SUBST([HAVE_PTHREAD_CREATE])
192 HAVE_PTHREAD_ATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_ATTR_INIT])
193 HAVE_PTHREAD_ATTR_GETDETACHSTATE=1; AC_SUBST([HAVE_PTHREAD_ATTR_GETDETACHSTATE])
194 HAVE_PTHREAD_ATTR_SETDETACHSTATE=1; AC_SUBST([HAVE_PTHREAD_ATTR_SETDETACHSTATE])
195 HAVE_PTHREAD_ATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_ATTR_DESTROY])
196 HAVE_PTHREAD_SELF=1; AC_SUBST([HAVE_PTHREAD_SELF])
197 HAVE_PTHREAD_EQUAL=1; AC_SUBST([HAVE_PTHREAD_EQUAL])
198 HAVE_PTHREAD_DETACH=1; AC_SUBST([HAVE_PTHREAD_DETACH])
199 HAVE_PTHREAD_JOIN=1; AC_SUBST([HAVE_PTHREAD_JOIN])
200 HAVE_PTHREAD_EXIT=1; AC_SUBST([HAVE_PTHREAD_EXIT])
201 HAVE_PTHREAD_ONCE=1; AC_SUBST([HAVE_PTHREAD_ONCE])
202 HAVE_PTHREAD_MUTEX_INIT=1; AC_SUBST([HAVE_PTHREAD_MUTEX_INIT])
203 HAVE_PTHREAD_MUTEXATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_INIT])
204 HAVE_PTHREAD_MUTEXATTR_GETTYPE=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_GETTYPE])
205 HAVE_PTHREAD_MUTEXATTR_SETTYPE=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_SETTYPE])
206 HAVE_PTHREAD_MUTEXATTR_GETROBUST=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_GETROBUST])
207 HAVE_PTHREAD_MUTEXATTR_SETROBUST=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_SETROBUST])
208 HAVE_PTHREAD_MUTEXATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_DESTROY])
209 HAVE_PTHREAD_MUTEX_LOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_LOCK])
210 HAVE_PTHREAD_MUTEX_TRYLOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_TRYLOCK])
211 HAVE_PTHREAD_MUTEX_TIMEDLOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_TIMEDLOCK])
212 HAVE_PTHREAD_MUTEX_UNLOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_UNLOCK])
213 HAVE_PTHREAD_MUTEX_DESTROY=1; AC_SUBST([HAVE_PTHREAD_MUTEX_DESTROY])
214 HAVE_PTHREAD_RWLOCK_INIT=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_INIT])
215 HAVE_PTHREAD_RWLOCKATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_RWLOCKATTR_INIT])
216 HAVE_PTHREAD_RWLOCKATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_RWLOCKATTR_DESTROY])
217 HAVE_PTHREAD_RWLOCK_RDLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_RDLOCK])
218 HAVE_PTHREAD_RWLOCK_WRLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_WRLOCK])
219 HAVE_PTHREAD_RWLOCK_TRYRDLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TRYRDLOCK])
220 HAVE_PTHREAD_RWLOCK_TRYWRLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TRYWRLOCK])
221 HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK])
222 HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK])
223 HAVE_PTHREAD_RWLOCK_UNLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_UNLOCK])
224 HAVE_PTHREAD_RWLOCK_DESTROY=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_DESTROY])
225 HAVE_PTHREAD_COND_INIT=1; AC_SUBST([HAVE_PTHREAD_COND_INIT])
226 HAVE_PTHREAD_CONDATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_CONDATTR_INIT])
227 HAVE_PTHREAD_CONDATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_CONDATTR_DESTROY])
228 HAVE_PTHREAD_COND_WAIT=1; AC_SUBST([HAVE_PTHREAD_COND_WAIT])
229 HAVE_PTHREAD_COND_TIMEDWAIT=1; AC_SUBST([HAVE_PTHREAD_COND_TIMEDWAIT])
230 HAVE_PTHREAD_COND_SIGNAL=1; AC_SUBST([HAVE_PTHREAD_COND_SIGNAL])
231 HAVE_PTHREAD_COND_BROADCAST=1; AC_SUBST([HAVE_PTHREAD_COND_BROADCAST])
232 HAVE_PTHREAD_COND_DESTROY=1; AC_SUBST([HAVE_PTHREAD_COND_DESTROY])
233 HAVE_PTHREAD_KEY_CREATE=1; AC_SUBST([HAVE_PTHREAD_KEY_CREATE])
234 HAVE_PTHREAD_SETSPECIFIC=1; AC_SUBST([HAVE_PTHREAD_SETSPECIFIC])
235 HAVE_PTHREAD_GETSPECIFIC=1; AC_SUBST([HAVE_PTHREAD_GETSPECIFIC])
236 HAVE_PTHREAD_KEY_DELETE=1; AC_SUBST([HAVE_PTHREAD_KEY_DELETE])
237 HAVE_PTHREAD_SPIN_INIT=1; AC_SUBST([HAVE_PTHREAD_SPIN_INIT])
238 HAVE_PTHREAD_SPIN_LOCK=1; AC_SUBST([HAVE_PTHREAD_SPIN_LOCK])
239 HAVE_PTHREAD_SPIN_TRYLOCK=1; AC_SUBST([HAVE_PTHREAD_SPIN_TRYLOCK])
240 HAVE_PTHREAD_SPIN_UNLOCK=1; AC_SUBST([HAVE_PTHREAD_SPIN_UNLOCK])
241 HAVE_PTHREAD_SPIN_DESTROY=1; AC_SUBST([HAVE_PTHREAD_SPIN_DESTROY])
242 REPLACE_PTHREAD_CREATE=0; AC_SUBST([REPLACE_PTHREAD_CREATE])
243 REPLACE_PTHREAD_ATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_ATTR_INIT])
244 REPLACE_PTHREAD_ATTR_GETDETACHSTATE=0; AC_SUBST([REPLACE_PTHREAD_ATTR_GETDETACHSTATE])
245 REPLACE_PTHREAD_ATTR_SETDETACHSTATE=0; AC_SUBST([REPLACE_PTHREAD_ATTR_SETDETACHSTATE])
246 REPLACE_PTHREAD_ATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_ATTR_DESTROY])
247 REPLACE_PTHREAD_SELF=0; AC_SUBST([REPLACE_PTHREAD_SELF])
248 REPLACE_PTHREAD_EQUAL=0; AC_SUBST([REPLACE_PTHREAD_EQUAL])
249 REPLACE_PTHREAD_DETACH=0; AC_SUBST([REPLACE_PTHREAD_DETACH])
250 REPLACE_PTHREAD_JOIN=0; AC_SUBST([REPLACE_PTHREAD_JOIN])
251 REPLACE_PTHREAD_EXIT=0; AC_SUBST([REPLACE_PTHREAD_EXIT])
252 REPLACE_PTHREAD_ONCE=0; AC_SUBST([REPLACE_PTHREAD_ONCE])
253 REPLACE_PTHREAD_MUTEX_INIT=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_INIT])
254 REPLACE_PTHREAD_MUTEXATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_INIT])
255 REPLACE_PTHREAD_MUTEXATTR_GETTYPE=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_GETTYPE])
256 REPLACE_PTHREAD_MUTEXATTR_SETTYPE=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_SETTYPE])
257 REPLACE_PTHREAD_MUTEXATTR_GETROBUST=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_GETROBUST])
258 REPLACE_PTHREAD_MUTEXATTR_SETROBUST=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_SETROBUST])
259 REPLACE_PTHREAD_MUTEXATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_DESTROY])
260 REPLACE_PTHREAD_MUTEX_LOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_LOCK])
261 REPLACE_PTHREAD_MUTEX_TRYLOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_TRYLOCK])
262 REPLACE_PTHREAD_MUTEX_TIMEDLOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_TIMEDLOCK])
263 REPLACE_PTHREAD_MUTEX_UNLOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_UNLOCK])
264 REPLACE_PTHREAD_MUTEX_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_DESTROY])
265 REPLACE_PTHREAD_RWLOCK_INIT=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_INIT])
266 REPLACE_PTHREAD_RWLOCKATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_RWLOCKATTR_INIT])
267 REPLACE_PTHREAD_RWLOCKATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_RWLOCKATTR_DESTROY])
268 REPLACE_PTHREAD_RWLOCK_RDLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_RDLOCK])
269 REPLACE_PTHREAD_RWLOCK_WRLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_WRLOCK])
270 REPLACE_PTHREAD_RWLOCK_TRYRDLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TRYRDLOCK])
271 REPLACE_PTHREAD_RWLOCK_TRYWRLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TRYWRLOCK])
272 REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK])
273 REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK])
274 REPLACE_PTHREAD_RWLOCK_UNLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_UNLOCK])
275 REPLACE_PTHREAD_RWLOCK_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_DESTROY])
276 REPLACE_PTHREAD_COND_INIT=0; AC_SUBST([REPLACE_PTHREAD_COND_INIT])
277 REPLACE_PTHREAD_CONDATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_CONDATTR_INIT])
278 REPLACE_PTHREAD_CONDATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_CONDATTR_DESTROY])
279 REPLACE_PTHREAD_COND_WAIT=0; AC_SUBST([REPLACE_PTHREAD_COND_WAIT])
280 REPLACE_PTHREAD_COND_TIMEDWAIT=0; AC_SUBST([REPLACE_PTHREAD_COND_TIMEDWAIT])
281 REPLACE_PTHREAD_COND_SIGNAL=0; AC_SUBST([REPLACE_PTHREAD_COND_SIGNAL])
282 REPLACE_PTHREAD_COND_BROADCAST=0; AC_SUBST([REPLACE_PTHREAD_COND_BROADCAST])
283 REPLACE_PTHREAD_COND_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_COND_DESTROY])
284 REPLACE_PTHREAD_KEY_CREATE=0; AC_SUBST([REPLACE_PTHREAD_KEY_CREATE])
285 REPLACE_PTHREAD_SETSPECIFIC=0; AC_SUBST([REPLACE_PTHREAD_SETSPECIFIC])
286 REPLACE_PTHREAD_GETSPECIFIC=0; AC_SUBST([REPLACE_PTHREAD_GETSPECIFIC])
287 REPLACE_PTHREAD_KEY_DELETE=0; AC_SUBST([REPLACE_PTHREAD_KEY_DELETE])
288 REPLACE_PTHREAD_SPIN_INIT=0; AC_SUBST([REPLACE_PTHREAD_SPIN_INIT])
289 REPLACE_PTHREAD_SPIN_LOCK=0; AC_SUBST([REPLACE_PTHREAD_SPIN_LOCK])
290 REPLACE_PTHREAD_SPIN_TRYLOCK=0; AC_SUBST([REPLACE_PTHREAD_SPIN_TRYLOCK])
291 REPLACE_PTHREAD_SPIN_UNLOCK=0; AC_SUBST([REPLACE_PTHREAD_SPIN_UNLOCK])
292 REPLACE_PTHREAD_SPIN_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_SPIN_DESTROY])
293])
diff --git a/gl/m4/pthread_rwlock_rdlock.m4 b/gl/m4/pthread_rwlock_rdlock.m4
index b8b5b117..c16c781d 100644
--- a/gl/m4/pthread_rwlock_rdlock.m4
+++ b/gl/m4/pthread_rwlock_rdlock.m4
@@ -1,9 +1,10 @@
1# pthread_rwlock_rdlock.m4 1# pthread_rwlock_rdlock.m4
2# serial 8 2# serial 8
3dnl Copyright (C) 2017-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2017-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Bruno Haible. 9dnl From Bruno Haible.
9dnl Inspired by 10dnl Inspired by
@@ -31,7 +32,7 @@ dnl https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_rwlock_rd
31dnl but this test verifies the guarantee regardless of TPS and regardless of 32dnl but this test verifies the guarantee regardless of TPS and regardless of
32dnl scheduling policy. 33dnl scheduling policy.
33dnl Glibc does not provide this guarantee (and never will on Linux), see 34dnl Glibc does not provide this guarantee (and never will on Linux), see
34dnl https://sourceware.org/bugzilla/show_bug.cgi?id=13701 35dnl https://sourceware.org/PR13701
35dnl https://bugzilla.redhat.com/show_bug.cgi?id=1410052 36dnl https://bugzilla.redhat.com/show_bug.cgi?id=1410052
36AC_DEFUN([gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER], 37AC_DEFUN([gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER],
37[ 38[
diff --git a/gl/m4/realloc.m4 b/gl/m4/realloc.m4
index eb90d588..8938db92 100644
--- a/gl/m4/realloc.m4
+++ b/gl/m4/realloc.m4
@@ -1,54 +1,22 @@
1# realloc.m4 1# realloc.m4
2# serial 29 2# serial 40
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# This is adapted with modifications from upstream Autoconf here: 9# An an experimental option, the user can request a sanitized realloc()
9# https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n1455 10# implementation, i.e. one that aborts upon undefined behaviour,
10AC_DEFUN([_AC_FUNC_REALLOC_IF], 11# by setting
12# gl_cv_func_realloc_sanitize=yes
13# at configure time.
14AC_DEFUN([gl_FUNC_REALLOC_SANITIZED],
11[ 15[
12 AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles 16 AC_CACHE_CHECK([whether realloc should abort upon undefined behaviour],
13 AC_CACHE_CHECK([whether realloc (0, 0) returns nonnull], 17 [gl_cv_func_realloc_sanitize],
14 [ac_cv_func_realloc_0_nonnull], 18 [test -n "$gl_cv_func_realloc_sanitize" || gl_cv_func_realloc_sanitize=no])
15 [AC_RUN_IFELSE( 19])
16 [AC_LANG_PROGRAM(
17 [[#include <stdlib.h>
18 ]],
19 [[void *p = realloc (0, 0);
20 void * volatile vp = p;
21 int result = !vp;
22 free (p);
23 return result;]])
24 ],
25 [ac_cv_func_realloc_0_nonnull=yes],
26 [ac_cv_func_realloc_0_nonnull=no],
27 [case "$host_os" in
28 # Guess yes on platforms where we know the result.
29 *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \
30 | gnu* | *-musl* | midipix* | midnightbsd* \
31 | hpux* | solaris* | cygwin* | mingw* | windows* | msys* )
32 ac_cv_func_realloc_0_nonnull="guessing yes" ;;
33 # If we don't know, obey --enable-cross-guesses.
34 *) ac_cv_func_realloc_0_nonnull="$gl_cross_guess_normal" ;;
35 esac
36 ])
37 ])
38 AS_CASE([$ac_cv_func_realloc_0_nonnull], [*yes], [$1], [$2])
39])# AC_FUNC_REALLOC
40
41# gl_FUNC_REALLOC_GNU
42# -------------------
43# Replace realloc if it is not compatible with GNU libc.
44AC_DEFUN([gl_FUNC_REALLOC_GNU],
45[
46 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
47 AC_REQUIRE([gl_FUNC_REALLOC_POSIX])
48 if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 0; then
49 _AC_FUNC_REALLOC_IF([], [REPLACE_REALLOC_FOR_REALLOC_GNU=1])
50 fi
51])# gl_FUNC_REALLOC_GNU
52 20
53# gl_FUNC_REALLOC_POSIX 21# gl_FUNC_REALLOC_POSIX
54# --------------------- 22# ---------------------
@@ -59,7 +27,100 @@ AC_DEFUN([gl_FUNC_REALLOC_POSIX],
59[ 27[
60 AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) 28 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
61 AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) 29 AC_REQUIRE([gl_FUNC_MALLOC_POSIX])
62 if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then 30 AC_REQUIRE([AC_CANONICAL_HOST])
31 AC_CACHE_CHECK([whether realloc sets errno on failure],
32 [gl_cv_func_realloc_posix],
33 [
34 dnl FreeBSD 15.0 realloc() does not set errno when asked for more than
35 dnl 0x7000000000000000 bytes.
36 case "$host_os" in
37 darwin* | freebsd* | dragonfly* | midnightbsd* | netbsd* | openbsd*)
38 AC_RUN_IFELSE(
39 [AC_LANG_SOURCE(
40 [[#include <errno.h>
41 #include <stdlib.h>
42 int main (int argc, char **argv)
43 {
44 void *p;
45 errno = 1729;
46 p = realloc (malloc (1), (size_t)(-1) / 100 * 49);
47 return (!p && errno == 1729);
48 }
49 ]])
50 ],
51 [gl_cv_func_realloc_posix=yes],
52 [gl_cv_func_realloc_posix=no],
53 [case "$host_os" in
54 freebsd*) gl_cv_func_realloc_posix="guessing no" ;;
55 *) gl_cv_func_realloc_posix="guessing yes" ;;
56 esac
57 ])
58 ;;
59 *)
60 gl_cv_func_realloc_posix="$gl_cv_func_malloc_posix"
61 ;;
62 esac
63 ])
64 case "$gl_cv_func_realloc_posix" in
65 *yes)
66 AC_DEFINE([HAVE_REALLOC_POSIX], [1],
67 [Define if realloc sets errno on allocation failure.])
68 ;;
69 *)
70 REPLACE_REALLOC_FOR_REALLOC_POSIX=1
71 ;;
72 esac
73 AC_REQUIRE([gl_FUNC_REALLOC_SANITIZED])
74 if test "$gl_cv_func_realloc_sanitize" != no; then
63 REPLACE_REALLOC_FOR_REALLOC_POSIX=1 75 REPLACE_REALLOC_FOR_REALLOC_POSIX=1
76 AC_DEFINE([NEED_SANITIZED_REALLOC], [1],
77 [Define to 1 if realloc should abort upon undefined behaviour.])
64 fi 78 fi
65]) 79])
80
81# gl_FUNC_REALLOC_0_NONNULL
82# -------------------------
83# Replace realloc if realloc (..., 0) returns null.
84# Modules that use this macro directly or indirectly should depend
85# on extensions-aix, so that _LINUX_SOURCE_COMPAT gets defined
86# before this macro gets invoked. This helps if !(__VEC__ || __AIXVEC),
87# and doesn't hurt otherwise.
88AC_DEFUN([gl_FUNC_REALLOC_0_NONNULL],
89[
90 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
91 AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
92 AC_REQUIRE([gl_FUNC_REALLOC_POSIX])
93 AC_CACHE_CHECK([whether realloc (..., 0) returns nonnull],
94 [gl_cv_func_realloc_0_nonnull],
95 [AC_RUN_IFELSE(
96 [AC_LANG_PROGRAM(
97 [[#include <stdlib.h>
98 /* Use prealloc to test; "volatile" prevents the compiler
99 from optimizing the realloc call away. */
100 void *(*volatile prealloc) (void *, size_t) = realloc;]],
101 [[void *p = prealloc (0, 0);
102 int result = !p;
103 p = prealloc (p, 0);
104 result |= !p;
105 free (p);
106 return result;]])],
107 [gl_cv_func_realloc_0_nonnull=yes],
108 [gl_cv_func_realloc_0_nonnull=no],
109 [AS_CASE([$host_os],
110 [# Guess yes on platforms where we know the result.
111 freebsd* | netbsd* | openbsd* | darwin* | bitrig* \
112 | *-musl* | midipix* | midnightbsd* \
113 | hpux* | solaris* | cygwin*],
114 [gl_cv_func_realloc_0_nonnull="guessing yes"],
115 [# Guess as follows if we don't know.
116 gl_cv_func_realloc_0_nonnull=$gl_cross_guess_normal])])])
117 AS_CASE([$gl_cv_func_realloc_0_nonnull],
118 [*yes],
119 [AC_DEFINE([HAVE_REALLOC_0_NONNULL], [1],
120 [Define to 1 if realloc (..., 0) returns nonnull.])],
121 [AS_CASE([$gl_cv_func_realloc_sanitize,$gl_cv_malloc_ptrdiff,$gl_cv_func_malloc_posix,$host],
122 [yes,*,*,* | *,no,*,* | *,*,*no,* | *,*,*,aarch64c-*-freebsd*],
123 [REPLACE_REALLOC_FOR_REALLOC_POSIX=1],
124 [# Optimize for common case of glibc 2.1.1+ and compatibles.
125 REPLACE_REALLOC_FOR_REALLOC_POSIX=2])])
126])
diff --git a/gl/m4/reallocarray.m4 b/gl/m4/reallocarray.m4
index 958095e1..e789967c 100644
--- a/gl/m4/reallocarray.m4
+++ b/gl/m4/reallocarray.m4
@@ -1,9 +1,10 @@
1# reallocarray.m4 1# reallocarray.m4
2# serial 5 2# serial 7
3dnl Copyright (C) 2017-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2017-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_REALLOCARRAY], 9AC_DEFUN([gl_FUNC_REALLOCARRAY],
9[ 10[
@@ -12,14 +13,21 @@ AC_DEFUN([gl_FUNC_REALLOCARRAY],
12 13
13 AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) 14 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
14 AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) 15 AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF])
16 AC_REQUIRE([gl_FUNC_REALLOC_0_NONNULL])
15 gl_CHECK_FUNCS_ANDROID([reallocarray], [[#include <stdlib.h>]]) 17 gl_CHECK_FUNCS_ANDROID([reallocarray], [[#include <stdlib.h>]])
16 if test "$ac_cv_func_reallocarray" = no; then 18 if test "$ac_cv_func_reallocarray" = no; then
17 HAVE_REALLOCARRAY=0 19 HAVE_REALLOCARRAY=0
18 case "$gl_cv_onwards_func_reallocarray" in 20 case "$gl_cv_onwards_func_reallocarray" in
19 future*) REPLACE_REALLOCARRAY=1 ;; 21 future*) REPLACE_REALLOCARRAY=1 ;;
20 esac 22 esac
21 elif test "$gl_cv_malloc_ptrdiff" = no; then 23 else
22 REPLACE_REALLOCARRAY=1 24 if test "$gl_cv_malloc_ptrdiff" = no; then
25 REPLACE_REALLOCARRAY=1
26 fi
27 case "$gl_cv_func_realloc_0_nonnull" in
28 *yes) ;;
29 *) REPLACE_REALLOCARRAY=1 ;;
30 esac
23 fi 31 fi
24]) 32])
25 33
diff --git a/gl/m4/regex.m4 b/gl/m4/regex.m4
index f0101fe6..45a10490 100644
--- a/gl/m4/regex.m4
+++ b/gl/m4/regex.m4
@@ -1,9 +1,10 @@
1# regex.m4 1# regex.m4
2# serial 75 2# serial 81
3dnl Copyright (C) 1996-2001, 2003-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 1996-2001, 2003-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Initially derived from code in GNU grep. 9dnl Initially derived from code in GNU grep.
9dnl Mostly written by Jim Meyering. 10dnl Mostly written by Jim Meyering.
@@ -39,19 +40,24 @@ AC_DEFUN([gl_REGEX],
39 #include <limits.h> 40 #include <limits.h>
40 #include <string.h> 41 #include <string.h>
41 42
42 #if defined M_CHECK_ACTION || HAVE_DECL_ALARM 43 #if HAVE_MALLOC_H
43 # include <signal.h> 44 # include <malloc.h> /* defines M_CHECK_ACTION on glibc */
44 # include <unistd.h>
45 #endif 45 #endif
46 46
47 #if HAVE_MALLOC_H 47 #if defined __HAIKU__ || defined M_CHECK_ACTION || HAVE_DECL_ALARM
48 # include <malloc.h> 48 # include <signal.h>
49 # include <unistd.h>
49 #endif 50 #endif
50 51
51 #ifdef M_CHECK_ACTION 52 #if defined __HAIKU__ || defined M_CHECK_ACTION
52 /* Exit with distinguishable exit code. */ 53 /* Exit with distinguishable exit code. */
53 static void sigabrt_no_core (int sig) { raise (SIGTERM); } 54 static void sigabrt_no_core (int sig) { raise (SIGTERM); }
54 #endif 55 #endif
56
57 /* There is no need to check whether RE_SYNTAX_EMACS is
58 (RE_CHAR_CLASSES | RE_INTERVALS), corresponding to
59 Emacs 21 (2001) and later, because Gnulib's lib/regex.h
60 is always used and has this value. */
55 ]], 61 ]],
56 [[int result = 0; 62 [[int result = 0;
57 static struct re_pattern_buffer regex; 63 static struct re_pattern_buffer regex;
@@ -67,6 +73,9 @@ AC_DEFUN([gl_REGEX],
67 signal (SIGALRM, SIG_DFL); 73 signal (SIGALRM, SIG_DFL);
68 alarm (2); 74 alarm (2);
69#endif 75#endif
76#ifdef __HAIKU__
77 signal (SIGABRT, sigabrt_no_core);
78#endif
70#ifdef M_CHECK_ACTION 79#ifdef M_CHECK_ACTION
71 signal (SIGABRT, sigabrt_no_core); 80 signal (SIGABRT, sigabrt_no_core);
72 mallopt (M_CHECK_ACTION, 2); 81 mallopt (M_CHECK_ACTION, 2);
@@ -388,7 +397,6 @@ AC_DEFUN([gl_PREREQ_REGEX],
388 AC_REQUIRE([AC_C_INLINE]) 397 AC_REQUIRE([AC_C_INLINE])
389 AC_REQUIRE([AC_C_RESTRICT]) 398 AC_REQUIRE([AC_C_RESTRICT])
390 AC_REQUIRE([AC_TYPE_MBSTATE_T]) 399 AC_REQUIRE([AC_TYPE_MBSTATE_T])
391 AC_REQUIRE([gl_EEMALLOC])
392 AC_CHECK_HEADERS([libintl.h]) 400 AC_CHECK_HEADERS([libintl.h])
393 AC_CHECK_FUNCS_ONCE([isblank iswctype]) 401 AC_CHECK_FUNCS_ONCE([isblank iswctype])
394 AC_CHECK_DECLS([isblank], [], [], [[#include <ctype.h>]]) 402 AC_CHECK_DECLS([isblank], [], [], [[#include <ctype.h>]])
diff --git a/gl/m4/sched_h.m4 b/gl/m4/sched_h.m4
new file mode 100644
index 00000000..92ebe1b7
--- /dev/null
+++ b/gl/m4/sched_h.m4
@@ -0,0 +1,102 @@
1# sched_h.m4
2# serial 16
3dnl Copyright (C) 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl Written by Bruno Haible.
10
11AC_DEFUN_ONCE([gl_SCHED_H],
12[
13 dnl Ensure to expand the default settings once only, before all statements
14 dnl that occur in other macros.
15 AC_REQUIRE([gl_SCHED_H_DEFAULTS])
16
17 AC_REQUIRE([AC_CANONICAL_HOST])
18
19 AC_REQUIRE([gl_CHECK_HEADER_SYS_CDEFS_H])
20
21 AC_CHECK_HEADERS([sched.h], [], [],
22 [[#if HAVE_SYS_CDEFS_H
23 #include <sys/cdefs.h>
24 #endif
25 ]])
26 gl_NEXT_HEADERS([sched.h])
27
28 if test "$ac_cv_header_sched_h" = yes; then
29 HAVE_SCHED_H=1
30 else
31 HAVE_SCHED_H=0
32 fi
33 AC_SUBST([HAVE_SCHED_H])
34
35 if test "$HAVE_SCHED_H" = 1; then
36 AC_CHECK_TYPE([struct sched_param],
37 [HAVE_STRUCT_SCHED_PARAM=1], [HAVE_STRUCT_SCHED_PARAM=0],
38 [[#if HAVE_SYS_CDEFS_H
39 #include <sys/cdefs.h>
40 #endif
41 #include <sched.h>
42 ]])
43 else
44 HAVE_STRUCT_SCHED_PARAM=0
45 case "$host_os" in
46 os2*)
47 dnl On OS/2 kLIBC, struct sched_param is in spawn.h.
48 AC_CHECK_TYPE([struct sched_param],
49 [HAVE_STRUCT_SCHED_PARAM=1], [],
50 [#include <spawn.h>])
51 ;;
52 vms)
53 dnl On OpenVMS 7.2 or newer, struct sched_param is in pthread.h.
54 AC_CHECK_TYPE([struct sched_param],
55 [HAVE_STRUCT_SCHED_PARAM=1], [],
56 [#include <pthread.h>])
57 ;;
58 esac
59 fi
60 AC_SUBST([HAVE_STRUCT_SCHED_PARAM])
61
62 dnl Ensure the type pid_t gets defined.
63 AC_REQUIRE([AC_TYPE_PID_T])
64
65 dnl Check for declarations of anything we want to poison if the
66 dnl corresponding gnulib module is not in use, if it is not common
67 dnl enough to be declared everywhere.
68 gl_WARN_ON_USE_PREPARE([[#include <sched.h>
69 ]], [sched_yield])
70])
71
72# gl_SCHED_MODULE_INDICATOR([modulename])
73# sets the shell variable that indicates the presence of the given module
74# to a C preprocessor expression that will evaluate to 1.
75# This macro invocation must not occur in macros that are AC_REQUIREd.
76AC_DEFUN([gl_SCHED_MODULE_INDICATOR],
77[
78 dnl Ensure to expand the default settings once only.
79 gl_SCHED_H_REQUIRE_DEFAULTS
80 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
81 dnl Define it also as a C macro, for the benefit of the unit tests.
82 gl_MODULE_INDICATOR_FOR_TESTS([$1])
83])
84
85# Initializes the default values for AC_SUBSTed shell variables.
86# This macro must not be AC_REQUIREd. It must only be invoked, and only
87# outside of macros or in macros that are not AC_REQUIREd.
88AC_DEFUN([gl_SCHED_H_REQUIRE_DEFAULTS],
89[
90 m4_defun(GL_MODULE_INDICATOR_PREFIX[_SCHED_H_MODULE_INDICATOR_DEFAULTS], [
91 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCHED_YIELD])
92 ])
93 m4_require(GL_MODULE_INDICATOR_PREFIX[_SCHED_H_MODULE_INDICATOR_DEFAULTS])
94 AC_REQUIRE([gl_SCHED_H_DEFAULTS])
95])
96
97AC_DEFUN([gl_SCHED_H_DEFAULTS],
98[
99 dnl Assume proper GNU behavior unless another module says otherwise.
100 HAVE_SCHED_YIELD=1; AC_SUBST([HAVE_SCHED_YIELD])
101 REPLACE_SCHED_YIELD=0; AC_SUBST([REPLACE_SCHED_YIELD])
102])
diff --git a/gl/m4/servent.m4 b/gl/m4/servent.m4
index 422003b4..97bcad0f 100644
--- a/gl/m4/servent.m4
+++ b/gl/m4/servent.m4
@@ -1,9 +1,10 @@
1# servent.m4 1# servent.m4
2# serial 5 2# serial 5
3dnl Copyright (C) 2008, 2010-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008, 2010-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_SERVENT], 9AC_DEFUN([gl_SERVENT],
9[ 10[
diff --git a/gl/m4/setenv.m4 b/gl/m4/setenv.m4
index e7f00f39..5faf28d2 100644
--- a/gl/m4/setenv.m4
+++ b/gl/m4/setenv.m4
@@ -1,9 +1,10 @@
1# setenv.m4 1# setenv.m4
2# serial 33 2# serial 36
3dnl Copyright (C) 2001-2004, 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2001-2004, 2006-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_SETENV], 9AC_DEFUN([gl_FUNC_SETENV],
9[ 10[
@@ -84,8 +85,6 @@ AC_DEFUN([gl_FUNC_UNSETENV],
84 [AC_COMPILE_IFELSE( 85 [AC_COMPILE_IFELSE(
85 [AC_LANG_PROGRAM( 86 [AC_LANG_PROGRAM(
86 [[ 87 [[
87#undef _BSD
88#define _BSD 1 /* unhide unsetenv declaration in OSF/1 5.1 <stdlib.h> */
89#include <stdlib.h> 88#include <stdlib.h>
90extern 89extern
91#ifdef __cplusplus 90#ifdef __cplusplus
@@ -155,6 +154,7 @@ AC_DEFUN([gl_PREREQ_SETENV],
155 AC_REQUIRE([gl_ENVIRON]) 154 AC_REQUIRE([gl_ENVIRON])
156 AC_CHECK_HEADERS_ONCE([unistd.h]) 155 AC_CHECK_HEADERS_ONCE([unistd.h])
157 AC_CHECK_HEADERS([search.h]) 156 AC_CHECK_HEADERS([search.h])
157 AC_CHECK_DECLS_ONCE([_putenv])
158 gl_CHECK_FUNCS_ANDROID([tsearch], [[#include <search.h>]]) 158 gl_CHECK_FUNCS_ANDROID([tsearch], [[#include <search.h>]])
159]) 159])
160 160
@@ -163,4 +163,5 @@ AC_DEFUN([gl_PREREQ_UNSETENV],
163[ 163[
164 AC_REQUIRE([gl_ENVIRON]) 164 AC_REQUIRE([gl_ENVIRON])
165 AC_CHECK_HEADERS_ONCE([unistd.h]) 165 AC_CHECK_HEADERS_ONCE([unistd.h])
166 AC_CHECK_DECLS_ONCE([_putenv])
166]) 167])
diff --git a/gl/m4/setlocale_null.m4 b/gl/m4/setlocale_null.m4
index e5b7d28b..b6727245 100644
--- a/gl/m4/setlocale_null.m4
+++ b/gl/m4/setlocale_null.m4
@@ -1,11 +1,12 @@
1# setlocale_null.m4 1# setlocale_null.m4
2# serial 9 2# serial 11
3dnl Copyright (C) 2019-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2019-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_SETLOCALE_NULL], 9AC_DEFUN_ONCE([gl_FUNC_SETLOCALE_NULL],
9[ 10[
10 AC_REQUIRE([AC_CANONICAL_HOST]) 11 AC_REQUIRE([AC_CANONICAL_HOST])
11 AC_REQUIRE([gl_PTHREADLIB]) 12 AC_REQUIRE([gl_PTHREADLIB])
@@ -31,8 +32,8 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL],
31 [gl_cv_func_setlocale_null_all_mtsafe=yes], 32 [gl_cv_func_setlocale_null_all_mtsafe=yes],
32 [gl_cv_func_setlocale_null_all_mtsafe=no]) 33 [gl_cv_func_setlocale_null_all_mtsafe=no])
33 ;; 34 ;;
34 # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows. 35 # Guess yes on glibc, HP-UX, Solaris, native Windows.
35 *-gnu* | gnu* | hpux* | irix* | solaris* | mingw* | windows*) 36 *-gnu* | gnu* | hpux* | solaris* | mingw* | windows*)
36 gl_cv_func_setlocale_null_all_mtsafe=yes ;; 37 gl_cv_func_setlocale_null_all_mtsafe=yes ;;
37 # If we don't know, obey --enable-cross-guesses. 38 # If we don't know, obey --enable-cross-guesses.
38 *) 39 *)
@@ -62,8 +63,8 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL],
62 # Guess no on OpenBSD, AIX. 63 # Guess no on OpenBSD, AIX.
63 openbsd* | aix*) 64 openbsd* | aix*)
64 gl_cv_func_setlocale_null_one_mtsafe=no ;; 65 gl_cv_func_setlocale_null_one_mtsafe=no ;;
65 # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, IRIX, Solaris, Haiku, Cygwin, native Windows. 66 # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, Solaris, Haiku, Cygwin, native Windows.
66 *-gnu* | gnu* | *-musl* | midipix* | darwin* | freebsd* | midnightbsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw* | windows*) 67 *-gnu* | gnu* | *-musl* | midipix* | darwin* | freebsd* | midnightbsd* | netbsd* | hpux* | solaris* | haiku* | cygwin* | mingw* | windows*)
67 gl_cv_func_setlocale_null_one_mtsafe=yes ;; 68 gl_cv_func_setlocale_null_one_mtsafe=yes ;;
68 # If we don't know, obey --enable-cross-guesses. 69 # If we don't know, obey --enable-cross-guesses.
69 *) 70 *)
diff --git a/gl/m4/sha256.m4 b/gl/m4/sha256.m4
index ad5596a4..a9bd7857 100644
--- a/gl/m4/sha256.m4
+++ b/gl/m4/sha256.m4
@@ -1,9 +1,10 @@
1# sha256.m4 1# sha256.m4
2# serial 8 2# serial 8
3dnl Copyright (C) 2005, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005, 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_SHA256], 9AC_DEFUN([gl_SHA256],
9[ 10[
diff --git a/gl/m4/size_max.m4 b/gl/m4/size_max.m4
index df91cf06..b7a5153a 100644
--- a/gl/m4/size_max.m4
+++ b/gl/m4/size_max.m4
@@ -1,9 +1,10 @@
1# size_max.m4 1# size_max.m4
2# serial 12 2# serial 12
3dnl Copyright (C) 2003, 2005-2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2005-2006, 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Bruno Haible. 9dnl From Bruno Haible.
9 10
diff --git a/gl/m4/snprintf.m4 b/gl/m4/snprintf.m4
index 6dbe146f..6de225c2 100644
--- a/gl/m4/snprintf.m4
+++ b/gl/m4/snprintf.m4
@@ -1,9 +1,10 @@
1# snprintf.m4 1# snprintf.m4
2# serial 7 2# serial 7
3dnl Copyright (C) 2002-2004, 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2004, 2007-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Libintl 0.17 will replace snprintf only if it does not support %1$s, 9dnl Libintl 0.17 will replace snprintf only if it does not support %1$s,
9dnl but defers to any gnulib snprintf replacements. Therefore, gnulib 10dnl but defers to any gnulib snprintf replacements. Therefore, gnulib
diff --git a/gl/m4/socketlib.m4 b/gl/m4/socketlib.m4
index 09f01161..f62ffcfd 100644
--- a/gl/m4/socketlib.m4
+++ b/gl/m4/socketlib.m4
@@ -1,9 +1,10 @@
1# socketlib.m4 1# socketlib.m4
2# serial 4 2# serial 4
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl gl_SOCKETLIB 9dnl gl_SOCKETLIB
9dnl Determines the library to use for socket functions. 10dnl Determines the library to use for socket functions.
diff --git a/gl/m4/sockets.m4 b/gl/m4/sockets.m4
index a3dfe92f..95800d2e 100644
--- a/gl/m4/sockets.m4
+++ b/gl/m4/sockets.m4
@@ -1,9 +1,10 @@
1# sockets.m4 1# sockets.m4
2# serial 7 2# serial 7
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_SOCKETS], 9AC_DEFUN([gl_SOCKETS],
9[ 10[
diff --git a/gl/m4/socklen.m4 b/gl/m4/socklen.m4
index 9ece0abb..e5156511 100644
--- a/gl/m4/socklen.m4
+++ b/gl/m4/socklen.m4
@@ -1,16 +1,17 @@
1# socklen.m4 1# socklen.m4
2# serial 11 2# serial 13
3dnl Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-2007, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Albert Chin, Windows fixes from Simon Josefsson. 9dnl From Albert Chin, Windows fixes from Simon Josefsson.
9 10
10dnl Check for socklen_t: historically on BSD it is an int, and in 11dnl Check for socklen_t: historically on BSD it is an int, and in
11dnl POSIX 1g it is a type of its own, but some platforms use different 12dnl POSIX 1g it is a type of its own, but some platforms use different
12dnl types for the argument to getsockopt, getpeername, etc.: 13dnl types for the argument to getsockopt, getpeername, etc.:
13dnl HP-UX 10.20, IRIX 6.5, OSF/1 4.0, Interix 3.5, BeOS. 14dnl HP-UX 10.20, Interix 3.5, BeOS.
14dnl So we have to test to find something that will work. 15dnl So we have to test to find something that will work.
15 16
16AC_DEFUN([gl_TYPE_SOCKLEN_T], 17AC_DEFUN([gl_TYPE_SOCKLEN_T],
diff --git a/gl/m4/sockpfaf.m4 b/gl/m4/sockpfaf.m4
index c68b3abb..6379766d 100644
--- a/gl/m4/sockpfaf.m4
+++ b/gl/m4/sockpfaf.m4
@@ -1,9 +1,10 @@
1# sockpfaf.m4 1# sockpfaf.m4
2# serial 10 2# serial 11
3dnl Copyright (C) 2004, 2006, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2004, 2006, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Test for some common socket protocol families (PF_INET, PF_INET6, ...) 9dnl Test for some common socket protocol families (PF_INET, PF_INET6, ...)
9dnl and some common address families (AF_INET, AF_INET6, ...). 10dnl and some common address families (AF_INET, AF_INET6, ...).
@@ -64,6 +65,13 @@ AC_DEFUN([gl_SOCKET_FAMILY_UNIX],
64 AC_REQUIRE([gl_SYS_SOCKET_H]) 65 AC_REQUIRE([gl_SYS_SOCKET_H])
65 AC_CHECK_HEADERS_ONCE([sys/un.h]) 66 AC_CHECK_HEADERS_ONCE([sys/un.h])
66 67
68 dnl Windows versions released after 2017 may have support for AF_UNIX.
69 dnl Including it requires types from <winsock2.h> to be defined.
70 dnl <https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/>.
71 if test "$ac_cv_header_winsock2_h" = yes; then
72 AC_CHECK_HEADERS([afunix.h], [], [], [#include <winsock2.h>])
73 fi
74
67 AC_CACHE_CHECK([for UNIX domain sockets], 75 AC_CACHE_CHECK([for UNIX domain sockets],
68 [gl_cv_socket_unix], 76 [gl_cv_socket_unix],
69 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 77 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
@@ -75,6 +83,9 @@ AC_DEFUN([gl_SOCKET_FAMILY_UNIX],
75#endif 83#endif
76#ifdef HAVE_WINSOCK2_H 84#ifdef HAVE_WINSOCK2_H
77#include <winsock2.h> 85#include <winsock2.h>
86#endif
87#ifdef HAVE_AFUNIX_H
88#include <afunix.h>
78#endif]], 89#endif]],
79[[int x = AF_UNIX; struct sockaddr_un y; 90[[int x = AF_UNIX; struct sockaddr_un y;
80 if (&x && &y) return 0;]])], 91 if (&x && &y) return 0;]])],
diff --git a/gl/m4/ssize_t.m4 b/gl/m4/ssize_t.m4
index c15f948a..8710cb72 100644
--- a/gl/m4/ssize_t.m4
+++ b/gl/m4/ssize_t.m4
@@ -1,9 +1,10 @@
1# ssize_t.m4 1# ssize_t.m4
2# serial 6 2# serial 6
3dnl Copyright (C) 2001-2003, 2006, 2010-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2001-2003, 2006, 2010-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Bruno Haible. 9dnl From Bruno Haible.
9dnl Define ssize_t if it does not already exist. 10dnl Define ssize_t if it does not already exist.
diff --git a/gl/m4/stat-time.m4 b/gl/m4/stat-time.m4
index e8ee7d51..10eb1dfa 100644
--- a/gl/m4/stat-time.m4
+++ b/gl/m4/stat-time.m4
@@ -1,9 +1,11 @@
1# stat-time.m4 1# stat-time.m4
2# serial 1 2# serial 1
3dnl Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2026 Free Software
4dnl Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
7 9
8# Checks for stat-related time functions. 10# Checks for stat-related time functions.
9 11
diff --git a/gl/m4/stat.m4 b/gl/m4/stat.m4
index fabd360c..3764ec0b 100644
--- a/gl/m4/stat.m4
+++ b/gl/m4/stat.m4
@@ -1,9 +1,10 @@
1# stat.m4 1# stat.m4
2# serial 21 2# serial 21
3dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_STAT], 9AC_DEFUN([gl_FUNC_STAT],
9[ 10[
diff --git a/gl/m4/std-gnu11.m4 b/gl/m4/std-gnu11.m4
index 37324c15..0868a43a 100644
--- a/gl/m4/std-gnu11.m4
+++ b/gl/m4/std-gnu11.m4
@@ -1,22 +1,27 @@
1# std-gnu11.m4 1# std-gnu11.m4
2# serial 1 2# serial 3
3 3
4# Prefer GNU C11 and C++11 to earlier versions. -*- coding: utf-8 -*- 4# Prefer GNU C11 and C++11 to earlier versions. -*- coding: utf-8 -*-
5 5
6# The std-gnu23 module, which defines _AC_C_C23_OPTIONS, supersedes us.
7m4_ifndef([_AC_C_C23_OPTIONS], [
8
6# This implementation is taken from GNU Autoconf lib/autoconf/c.m4 9# This implementation is taken from GNU Autoconf lib/autoconf/c.m4
7# commit 017d5ddd82854911f0119691d91ea8a1438824d6 10# commit 017d5ddd82854911f0119691d91ea8a1438824d6
8# dated Sun Apr 3 13:57:17 2016 -0700 11# dated Sun Apr 3 13:57:17 2016 -0700
12# with minor changes to commentary.
9# This implementation will be obsolete once we can assume Autoconf 2.70 13# This implementation will be obsolete once we can assume Autoconf 2.70
10# or later is installed everywhere a Gnulib program might be developed. 14# or later is installed everywhere a Gnulib program might be developed.
11 15
12m4_version_prereq([2.70], [], [ 16m4_version_prereq([2.70], [], [
13 17
14 18
15# Copyright (C) 2001-2024 Free Software Foundation, Inc. 19# Copyright (C) 2001-2026 Free Software Foundation, Inc.
16 20
17# This program is free software; you can redistribute it and/or modify 21# This file is part of Autoconf. This program is free
18# it under the terms of the GNU General Public License as published by 22# software; you can redistribute it and/or modify it under the
19# the Free Software Foundation, either version 3 of the License, or 23# terms of the GNU General Public License as published by the
24# Free Software Foundation, either version 3 of the License, or
20# (at your option) any later version. 25# (at your option) any later version.
21# 26#
22# This program is distributed in the hope that it will be useful, 27# This program is distributed in the hope that it will be useful,
@@ -24,8 +29,15 @@ m4_version_prereq([2.70], [], [
24# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 29# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25# GNU General Public License for more details. 30# GNU General Public License for more details.
26# 31#
32# Under Section 7 of GPL version 3, you are granted additional
33# permissions described in the Autoconf Configure Script Exception,
34# version 3.0, as published by the Free Software Foundation.
35#
27# You should have received a copy of the GNU General Public License 36# You should have received a copy of the GNU General Public License
28# along with this program. If not, see <https://www.gnu.org/licenses/>. 37# and a copy of the Autoconf Configure Script Exception along with
38# this program; see the files COPYINGv3 and COPYING.EXCEPTION
39# respectively. If not, see <https://www.gnu.org/licenses/> and
40# <https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob_plain;f=COPYING.EXCEPTION>.
29 41
30# Written by David MacKenzie, with help from 42# Written by David MacKenzie, with help from
31# Akim Demaille, Paul Eggert, 43# Akim Demaille, Paul Eggert,
@@ -38,7 +50,7 @@ m4_version_prereq([2.70], [], [
38# COMPILER ... is a space separated list of C compilers to search for. 50# COMPILER ... is a space separated list of C compilers to search for.
39# This just gives the user an opportunity to specify an alternative 51# This just gives the user an opportunity to specify an alternative
40# search list for the C compiler. 52# search list for the C compiler.
41AC_DEFUN_ONCE([AC_PROG_CC], 53AC_DEFUN([AC_PROG_CC],
42[AC_LANG_PUSH(C)dnl 54[AC_LANG_PUSH(C)dnl
43AC_ARG_VAR([CC], [C compiler command])dnl 55AC_ARG_VAR([CC], [C compiler command])dnl
44AC_ARG_VAR([CFLAGS], [C compiler flags])dnl 56AC_ARG_VAR([CFLAGS], [C compiler flags])dnl
@@ -765,7 +777,7 @@ AC_DEFUN([_AC_CXX_CXX11_TEST_BODY],
765} 777}
766{ 778{
767 // Unicode literals 779 // Unicode literals
768 char const *utf8 = u8"UTF-8 string \u2500"; 780 auto const *utf8 = u8"UTF-8 string \u2500"; // This is portable to C++20.
769 char16_t const *utf16 = u"UTF-8 string \u2500"; 781 char16_t const *utf16 = u"UTF-8 string \u2500";
770 char32_t const *utf32 = U"UTF-32 string \u2500"; 782 char32_t const *utf32 = U"UTF-32 string \u2500";
771} 783}
@@ -830,3 +842,4 @@ dnl with extended modes being tried first.
830 842
831 843
832])# m4_version_prereq 844])# m4_version_prereq
845])# !_AC_C_C23_OPTIONS
diff --git a/gl/m4/stdalign.m4 b/gl/m4/stdalign.m4
index 2b4762f3..7177d034 100644
--- a/gl/m4/stdalign.m4
+++ b/gl/m4/stdalign.m4
@@ -1,9 +1,10 @@
1# stdalign.m4 1# stdalign.m4
2# serial 1 2# serial 3
3dnl Copyright 2011-2024 Free Software Foundation, Inc. 3dnl Copyright 2011-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Check for alignas and alignof that conform to C23. 9# Check for alignas and alignof that conform to C23.
9 10
@@ -29,7 +30,7 @@ AC_DEFUN([gl_ALIGNASOF],
29 30
30 /* Test that alignof yields a result consistent with offsetof. 31 /* Test that alignof yields a result consistent with offsetof.
31 This catches GCC bug 52023 32 This catches GCC bug 52023
32 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */ 33 <https://gcc.gnu.org/PR52023>. */
33 #ifdef __cplusplus 34 #ifdef __cplusplus
34 template <class t> struct alignof_helper { char a; t b; }; 35 template <class t> struct alignof_helper { char a; t b; };
35 # define ao(type) offsetof (alignof_helper<type>, b) 36 # define ao(type) offsetof (alignof_helper<type>, b)
@@ -81,10 +82,10 @@ AC_DEFUN([gl_ALIGNASOF],
81 82
82 References: 83 References:
83 ISO C23 (latest free draft 84 ISO C23 (latest free draft
84 <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3047.pdf>) 85 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf>)
85 sections 6.5.3.4, 6.7.5, 7.15. 86 sections 6.2.8, 6.7.6.
86 C++11 (latest free draft 87 C++11 (latest free draft
87 <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf>) 88 <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf>)
88 section 18.10. */ 89 section 18.10. */
89 90
90/* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment 91/* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment
@@ -102,12 +103,14 @@ AC_DEFUN([gl_ALIGNASOF],
102 want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */ 103 want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */
103 104
104/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 105/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023
105 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. 106 <https://gcc.gnu.org/PR52023>.
106 clang versions < 8.0.0 have the same bug. */ 107 clang versions < 8.0.0 have the same bug.
108 IBM XL C V16.1.0 cc (non-clang) has the same bug. */
107# if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ 109# if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \
108 || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ 110 || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \
109 && !defined __clang__) \ 111 && !defined __clang__) \
110 || (defined __clang__ && __clang_major__ < 8)) 112 || (defined __clang__ && __clang_major__ < 8) \
113 || defined __xlC__)
111# undef/**/_Alignof 114# undef/**/_Alignof
112# ifdef __cplusplus 115# ifdef __cplusplus
113# if (201103 <= __cplusplus || defined _MSC_VER) 116# if (201103 <= __cplusplus || defined _MSC_VER)
@@ -178,7 +181,8 @@ AC_DEFUN([gl_ALIGNASOF],
178# if ((defined _Alignas \ 181# if ((defined _Alignas \
179 && !(defined __cplusplus \ 182 && !(defined __cplusplus \
180 && (201103 <= __cplusplus || defined _MSC_VER))) \ 183 && (201103 <= __cplusplus || defined _MSC_VER))) \
181 || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) 184 || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__ \
185 && !defined __xlC__))
182# define alignas _Alignas 186# define alignas _Alignas
183# endif 187# endif
184# endif 188# endif
diff --git a/gl/m4/stdckdint_h.m4 b/gl/m4/stdckdint_h.m4
new file mode 100644
index 00000000..eb8c858a
--- /dev/null
+++ b/gl/m4/stdckdint_h.m4
@@ -0,0 +1,136 @@
1# stdckdint_h.m4
2# serial 1
3dnl Copyright 2025-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl Written by Collin Funk.
10
11AC_DEFUN_ONCE([gl_STDCKDINT_H],
12[
13 gl_CHECK_NEXT_HEADERS([stdckdint.h])
14 if test $ac_cv_header_stdckdint_h = yes; then
15 HAVE_STDCKDINT_H=1
16 else
17 HAVE_STDCKDINT_H=0
18 fi
19 AC_SUBST([HAVE_STDCKDINT_H])
20
21 if test $HAVE_STDCKDINT_H = 1; then
22 AC_CACHE_CHECK([whether stdckdint.h can be included in C],
23 [gl_cv_header_c_stdckdint_h],
24 [AC_COMPILE_IFELSE(
25 [AC_LANG_PROGRAM(
26 [[#include <stdckdint.h>
27 ]])],
28 [gl_cv_header_c_stdckdint_h=yes],
29 [gl_cv_header_c_stdckdint_h=no])])
30 if test $gl_cv_header_c_stdckdint_h = yes; then
31 HAVE_C_STDCKDINT_H=1
32 AC_CACHE_CHECK([checking for an ISO C23 compliant stdckdint.h in C],
33 [gl_cv_header_c_stdckdint_h_works],
34 [AC_COMPILE_IFELSE(
35 [AC_LANG_PROGRAM(
36 [[#include <stdckdint.h>
37 ]],
38 [[int r;
39 int a = 1;
40 int b = 1;
41 return !!(ckd_add (&r, a, b) || ckd_sub (&r, a, b)
42 || ckd_mul (&r, a, b));
43 ]])],
44 [gl_cv_header_c_stdckdint_h_works=yes],
45 [gl_cv_header_c_stdckdint_h_works=no])])
46 if test $gl_cv_header_c_stdckdint_h_works = yes; then
47 HAVE_WORKING_C_STDCKDINT_H=1
48 else
49 HAVE_WORKING_C_STDCKDINT_H=0
50 fi
51 else
52 HAVE_C_STDCKDINT_H=0
53 HAVE_WORKING_C_STDCKDINT_H=0
54 fi
55 if test "$CXX" != no; then
56 AC_CACHE_CHECK([whether stdckdint.h can be included in C++],
57 [gl_cv_header_cxx_stdckdint_h],
58 [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to
59 dnl an autoconf bug <https://savannah.gnu.org/support/?110294>.
60 cat > conftest.cpp <<\EOF
61#include <stdckdint.h>
62EOF
63 gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp"
64 if AC_TRY_EVAL([gl_command]); then
65 gl_cv_header_cxx_stdckdint_h=yes
66 else
67 gl_cv_header_cxx_stdckdint_h=no
68 fi
69 rm -fr conftest*
70 ])
71 if test $gl_cv_header_cxx_stdckdint_h = yes; then
72 HAVE_CXX_STDCKDINT_H=1
73 AC_CACHE_CHECK([checking for an ISO C++26 compliant stdckdint.h in C++],
74 [gl_cv_header_cxx_stdckdint_h_works],
75 [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to
76 dnl an autoconf bug <https://savannah.gnu.org/support/?110294>.
77 cat > conftest.cpp <<\EOF
78#include <stdckdint.h>
79int
80main (void)
81{
82 int r;
83 int a = 1;
84 int b = 1;
85 return !!(ckd_add (&r, a, b) || ckd_sub (&r, a, b) || ckd_mul (&r, a, b));
86}
87EOF
88 gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp"
89 if AC_TRY_EVAL([gl_command]); then
90 gl_cv_header_cxx_stdckdint_h_works=yes
91 else
92 gl_cv_header_cxx_stdckdint_h_works=no
93 fi
94 rm -fr conftest*
95 ])
96 if test $gl_cv_header_cxx_stdckdint_h_works = yes; then
97 HAVE_WORKING_CXX_STDCKDINT_H=1
98 else
99 HAVE_WORKING_CXX_STDCKDINT_H=0
100 fi
101 else
102 HAVE_CXX_STDCKDINT_H=0
103 HAVE_WORKING_CXX_STDCKDINT_H=0
104 fi
105 fi
106 else
107 HAVE_C_STDCKDINT_H=0
108 HAVE_WORKING_C_STDCKDINT_H=0
109 HAVE_CXX_STDCKDINT_H=0
110 HAVE_WORKING_CXX_STDCKDINT_H=0
111 fi
112 AC_SUBST([HAVE_C_STDCKDINT_H])
113 AC_SUBST([HAVE_WORKING_C_STDCKDINT_H])
114 AC_SUBST([HAVE_CXX_STDCKDINT_H])
115 AC_SUBST([HAVE_WORKING_CXX_STDCKDINT_H])
116
117 if test "$CXX" != no; then
118 dnl We might need the header for C or C++.
119 if test $HAVE_C_STDCKDINT_H = 1 \
120 && test $HAVE_WORKING_C_STDCKDINT_H = 1 \
121 && test $HAVE_CXX_STDCKDINT_H = 1 \
122 && test $HAVE_WORKING_CXX_STDCKDINT_H = 1; then
123 GL_GENERATE_STDCKDINT_H=false
124 else
125 GL_GENERATE_STDCKDINT_H=true
126 fi
127 else
128 dnl We don't care about C++ here.
129 if test $HAVE_C_STDCKDINT_H = 1 \
130 && test $HAVE_WORKING_C_STDCKDINT_H = 1; then
131 GL_GENERATE_STDCKDINT_H=false
132 else
133 GL_GENERATE_STDCKDINT_H=true
134 fi
135 fi
136])
diff --git a/gl/m4/stddef_h.m4 b/gl/m4/stddef_h.m4
index 84d3bae8..299472b1 100644
--- a/gl/m4/stddef_h.m4
+++ b/gl/m4/stddef_h.m4
@@ -1,16 +1,16 @@
1# stddef_h.m4 1# stddef_h.m4
2# serial 14 2# serial 23
3dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl A placeholder for <stddef.h>, for platforms that have issues. 9dnl A placeholder for <stddef.h>, for platforms that have issues.
9 10
10AC_DEFUN_ONCE([gl_STDDEF_H], 11AC_DEFUN_ONCE([gl_STDDEF_H],
11[ 12[
12 AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) 13 AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
13 AC_REQUIRE([gt_TYPE_WCHAR_T])
14 14
15 dnl Persuade OpenBSD <stddef.h> to declare max_align_t. 15 dnl Persuade OpenBSD <stddef.h> to declare max_align_t.
16 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 16 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
@@ -52,11 +52,6 @@ AC_DEFUN_ONCE([gl_STDDEF_H],
52 GL_GENERATE_STDDEF_H=true 52 GL_GENERATE_STDDEF_H=true
53 fi 53 fi
54 54
55 if test $gt_cv_c_wchar_t = no; then
56 HAVE_WCHAR_T=0
57 GL_GENERATE_STDDEF_H=true
58 fi
59
60 AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions], 55 AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions],
61 [gl_cv_decl_null_works], 56 [gl_cv_decl_null_works],
62 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h> 57 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
@@ -69,21 +64,60 @@ AC_DEFUN_ONCE([gl_STDDEF_H],
69 GL_GENERATE_STDDEF_H=true 64 GL_GENERATE_STDDEF_H=true
70 fi 65 fi
71 66
72 AC_CACHE_CHECK([for unreachable], 67 AC_CACHE_CHECK([for unreachable in C],
73 [gl_cv_func_unreachable], 68 [gl_cv_c_func_unreachable],
74 [AC_LINK_IFELSE( 69 [AC_LINK_IFELSE(
75 [AC_LANG_PROGRAM( 70 [AC_LANG_PROGRAM(
76 [[#include <stddef.h> 71 [[#include <stddef.h>
77 ]], 72 ]],
78 [[unreachable (); 73 [[unreachable ();
79 ]])], 74 ]])],
80 [gl_cv_func_unreachable=yes], 75 [gl_cv_c_func_unreachable=yes],
81 [gl_cv_func_unreachable=no]) 76 [gl_cv_c_func_unreachable=no])
82 ]) 77 ])
83 if test $gl_cv_func_unreachable = no; then 78 if test $gl_cv_c_func_unreachable = no; then
79 GL_GENERATE_STDDEF_H=true
80 HAVE_C_UNREACHABLE=0
81 else
82 HAVE_C_UNREACHABLE=1
83 fi
84 AC_SUBST([HAVE_C_UNREACHABLE])
85 dnl Provide gl_unreachable() unconditionally.
86 GL_GENERATE_STDDEF_H=true
87
88 dnl https://gcc.gnu.org/PR114869
89 AC_CACHE_CHECK([whether nullptr_t needs <stddef.h>],
90 [gl_cv_nullptr_t_needs_stddef],
91 [AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[nullptr_t x;]],
92 [gl_cv_nullptr_t_needs_stddef=no],
93 [gl_cv_nullptr_t_needs_stddef=yes])])
94 if test "$gl_cv_nullptr_t_needs_stddef" = no; then
95 NULLPTR_T_NEEDS_STDDEF=0
84 GL_GENERATE_STDDEF_H=true 96 GL_GENERATE_STDDEF_H=true
85 fi 97 fi
86 98
99 dnl https://gcc.gnu.org/PR114870
100 dnl affects GCC 13.3 and 14.2.
101 AC_CACHE_CHECK([whether <stddef.h> is idempotent],
102 [gl_cv_stddef_idempotent],
103 [AC_COMPILE_IFELSE([AC_LANG_SOURCE(
104 [[
105 #if \
106 ((__GNUC__ == 13 && __GNUC_MINOR__ <= 3) \
107 || (__GNUC__ == 14 && __GNUC_MINOR__ <= 2))
108 #error "bug 114870 is present"
109 #endif
110 ]])],
111 [gl_cv_stddef_idempotent="guessing yes"],
112 [gl_cv_stddef_idempotent="guessing no"])
113 ])
114 case "$gl_cv_stddef_idempotent" in
115 *yes) ;;
116 *) STDDEF_NOT_IDEMPOTENT=1
117 GL_GENERATE_STDDEF_H=true
118 ;;
119 esac
120
87 if $GL_GENERATE_STDDEF_H; then 121 if $GL_GENERATE_STDDEF_H; then
88 gl_NEXT_HEADERS([stddef.h]) 122 gl_NEXT_HEADERS([stddef.h])
89 fi 123 fi
@@ -114,7 +148,8 @@ AC_DEFUN([gl_STDDEF_H_REQUIRE_DEFAULTS],
114AC_DEFUN([gl_STDDEF_H_DEFAULTS], 148AC_DEFUN([gl_STDDEF_H_DEFAULTS],
115[ 149[
116 dnl Assume proper GNU behavior unless another module says otherwise. 150 dnl Assume proper GNU behavior unless another module says otherwise.
151 NULLPTR_T_NEEDS_STDDEF=1; AC_SUBST([NULLPTR_T_NEEDS_STDDEF])
152 STDDEF_NOT_IDEMPOTENT=0; AC_SUBST([STDDEF_NOT_IDEMPOTENT])
117 REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) 153 REPLACE_NULL=0; AC_SUBST([REPLACE_NULL])
118 HAVE_MAX_ALIGN_T=1; AC_SUBST([HAVE_MAX_ALIGN_T]) 154 HAVE_MAX_ALIGN_T=1; AC_SUBST([HAVE_MAX_ALIGN_T])
119 HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T])
120]) 155])
diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4
index 2dea8469..410da153 100644
--- a/gl/m4/stdint.m4
+++ b/gl/m4/stdint.m4
@@ -1,9 +1,10 @@
1# stdint.m4 1# stdint.m4
2# serial 63 2# serial 65
3dnl Copyright (C) 2001-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2001-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Paul Eggert and Bruno Haible. 9dnl From Paul Eggert and Bruno Haible.
9dnl Test whether <stdint.h> is supported or must be substituted. 10dnl Test whether <stdint.h> is supported or must be substituted.
@@ -157,7 +158,7 @@ uintmax_t j = UINTMAX_MAX;
157 || defined __clang__) 158 || defined __clang__)
158int k = _Generic (SIZE_MAX, size_t: 0); 159int k = _Generic (SIZE_MAX, size_t: 0);
159#elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \ 160#elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \
160 || (0x5110 <= __SUNPRO_C && !__STDC__)) 161 || (0x5110 <= __SUNPRO_C && !__STDC__) || 1939 <= _MSC_VER)
161extern size_t k; 162extern size_t k;
162extern __typeof__ (SIZE_MAX) k; 163extern __typeof__ (SIZE_MAX) k;
163#endif 164#endif
@@ -390,9 +391,9 @@ AC_DEFUN([gl_STDINT_BITSIZEOF],
390 ]) 391 ])
391 eval result=\$gl_cv_bitsizeof_${gltype} 392 eval result=\$gl_cv_bitsizeof_${gltype}
392 if test $result = unknown; then 393 if test $result = unknown; then
393 dnl Use a nonempty default, because some compilers, such as IRIX 5 cc, 394 dnl Use a nonempty default, because some old compilers do a syntax check
394 dnl do a syntax check even on unused #if conditions and give an error 395 dnl even on unused #if conditions and give an error on valid C code like
395 dnl on valid C code like this: 396 dnl this:
396 dnl #if 0 397 dnl #if 0
397 dnl # if > 32 398 dnl # if > 32
398 dnl # endif 399 dnl # endif
diff --git a/gl/m4/stdint_h.m4 b/gl/m4/stdint_h.m4
index 29f42160..7f60af20 100644
--- a/gl/m4/stdint_h.m4
+++ b/gl/m4/stdint_h.m4
@@ -1,9 +1,10 @@
1# stdint_h.m4 1# stdint_h.m4
2# serial 9 2# serial 9
3dnl Copyright (C) 1997-2004, 2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 1997-2004, 2006, 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Paul Eggert. 9dnl From Paul Eggert.
9 10
diff --git a/gl/m4/stdio_h.m4 b/gl/m4/stdio_h.m4
index 8eb5816a..9d4126f5 100644
--- a/gl/m4/stdio_h.m4
+++ b/gl/m4/stdio_h.m4
@@ -1,9 +1,10 @@
1# stdio_h.m4 1# stdio_h.m4
2# serial 63 2# serial 75
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_STDIO_H_EARLY], 9AC_DEFUN([gl_STDIO_H_EARLY],
9[ 10[
@@ -133,6 +134,7 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS],
133[ 134[
134 m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS], [ 135 m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS], [
135 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DPRINTF]) 136 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DPRINTF])
137 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DZPRINTF])
136 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCLOSE]) 138 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCLOSE])
137 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDOPEN]) 139 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDOPEN])
138 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFLUSH]) 140 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFLUSH])
@@ -153,12 +155,14 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS],
153 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELL]) 155 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELL])
154 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELLO]) 156 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELLO])
155 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FWRITE]) 157 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FWRITE])
158 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FZPRINTF])
156 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETC]) 159 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETC])
157 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCHAR]) 160 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCHAR])
158 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDELIM]) 161 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDELIM])
159 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLINE]) 162 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLINE])
160 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF]) 163 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF])
161 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF_POSIX]) 164 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF_POSIX])
165 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_ZPRINTF])
162 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PCLOSE]) 166 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PCLOSE])
163 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PERROR]) 167 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PERROR])
164 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POPEN]) 168 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POPEN])
@@ -172,20 +176,29 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS],
172 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAMEAT]) 176 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAMEAT])
173 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCANF]) 177 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCANF])
174 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNPRINTF]) 178 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNPRINTF])
179 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNZPRINTF])
175 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SPRINTF_POSIX]) 180 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SPRINTF_POSIX])
176 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_NONBLOCKING]) 181 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_NONBLOCKING])
177 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_SIGPIPE]) 182 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_SIGPIPE])
183 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SZPRINTF])
178 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TMPFILE]) 184 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TMPFILE])
179 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASPRINTF]) 185 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASPRINTF])
186 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASZPRINTF])
180 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFSCANF]) 187 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFSCANF])
181 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSCANF]) 188 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSCANF])
182 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDPRINTF]) 189 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDPRINTF])
190 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDZPRINTF])
183 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF]) 191 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF])
184 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF_POSIX]) 192 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF_POSIX])
193 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFZPRINTF])
185 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF]) 194 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF])
186 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF_POSIX]) 195 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF_POSIX])
187 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNPRINTF]) 196 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNPRINTF])
197 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNZPRINTF])
188 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSPRINTF_POSIX]) 198 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSPRINTF_POSIX])
199 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSZPRINTF])
200 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VZPRINTF])
201 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ZPRINTF])
189 dnl Support Microsoft deprecated alias function names by default. 202 dnl Support Microsoft deprecated alias function names by default.
190 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCLOSEALL], [1]) 203 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCLOSEALL], [1])
191 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FDOPEN], [1]) 204 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FDOPEN], [1])
diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4
index a4662f29..f35d6611 100644
--- a/gl/m4/stdlib_h.m4
+++ b/gl/m4/stdlib_h.m4
@@ -1,9 +1,10 @@
1# stdlib_h.m4 1# stdlib_h.m4
2# serial 77 2# serial 86
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_STDLIB_H], 9AC_DEFUN_ONCE([gl_STDLIB_H],
9[ 10[
@@ -37,44 +38,51 @@ AC_DEFUN_ONCE([gl_STDLIB_H],
37 dnl On Solaris 10, in UTF-8 locales, its value is 3 but needs to be 4. 38 dnl On Solaris 10, in UTF-8 locales, its value is 3 but needs to be 4.
38 dnl Fortunately, we can do this because on this platform MB_LEN_MAX is 5. 39 dnl Fortunately, we can do this because on this platform MB_LEN_MAX is 5.
39 AC_REQUIRE([AC_CANONICAL_HOST]) 40 AC_REQUIRE([AC_CANONICAL_HOST])
40 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 41 AC_REQUIRE([gt_LOCALE_EN_UTF8])
41 AC_CACHE_CHECK([whether MB_CUR_MAX is correct], 42 AC_CACHE_CHECK([whether MB_CUR_MAX is correct],
42 [gl_cv_macro_MB_CUR_MAX_good], 43 [gl_cv_macro_MB_CUR_MAX_good],
43 [ 44 [AC_LINK_IFELSE(
44 dnl Initial guess, used when cross-compiling or when no suitable locale 45 [AC_LANG_PROGRAM([[#include <stdlib.h>
45 dnl is present. 46 ]],
46changequote(,)dnl 47 [[return !!MB_CUR_MAX;]])
47 case "$host_os" in 48 ],
48 # Guess no on Solaris. 49 [dnl Initial guess, used when cross-compiling or when no suitable locale
49 solaris*) gl_cv_macro_MB_CUR_MAX_good="guessing no" ;; 50 dnl is present.
50 # Guess yes otherwise. 51 # Guess no on Solaris and Haiku, yes otherwise.
51 *) gl_cv_macro_MB_CUR_MAX_good="guessing yes" ;; 52 AS_CASE([$host_os],
52 esac 53 [solaris* | haiku*],
53changequote([,])dnl 54 [gl_cv_macro_MB_CUR_MAX_good="guessing no"],
54 if test $LOCALE_FR_UTF8 != none; then 55 [gl_cv_macro_MB_CUR_MAX_good="guessing yes"])
55 AC_RUN_IFELSE( 56 if test "$LOCALE_EN_UTF8" != none; then
56 [AC_LANG_SOURCE([[ 57 AC_RUN_IFELSE(
58 [AC_LANG_SOURCE([[
57#include <locale.h> 59#include <locale.h>
58#include <stdlib.h> 60#include <stdlib.h>
59int main () 61int main ()
60{ 62{
61 int result = 0; 63 int result = 0;
62 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 64 if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
63 { 65 {
64 if (MB_CUR_MAX < 4) 66 if (MB_CUR_MAX < 4)
65 result |= 1; 67 result |= 1;
66 } 68 }
67 return result; 69 return result;
68}]])], 70}]])],
69 [gl_cv_macro_MB_CUR_MAX_good=yes], 71 [gl_cv_macro_MB_CUR_MAX_good=yes],
70 [gl_cv_macro_MB_CUR_MAX_good=no], 72 [gl_cv_macro_MB_CUR_MAX_good=no],
71 [:]) 73 [:])
72 fi 74 fi
75 ],
76 [gl_cv_macro_MB_CUR_MAX_good="link failed - so no"])
73 ]) 77 ])
74 case "$gl_cv_macro_MB_CUR_MAX_good" in 78 AS_CASE([$gl_cv_macro_MB_CUR_MAX_good],
75 *yes) ;; 79 [*yes],
76 *) REPLACE_MB_CUR_MAX=1 ;; 80 [],
77 esac 81 ["link failed - so no"],
82 [# 4 suffices as a workaround in Android NDK 16,
83 # the only known platform with the bug.
84 REPLACE_MB_CUR_MAX=4],
85 [REPLACE_MB_CUR_MAX="(-1)"])
78 86
79 AC_CHECK_DECLS_ONCE([ecvt]) 87 AC_CHECK_DECLS_ONCE([ecvt])
80 if test $ac_cv_have_decl_ecvt = no; then 88 if test $ac_cv_have_decl_ecvt = no; then
@@ -110,6 +118,7 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS],
110[ 118[
111 m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS], [ 119 m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS], [
112 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB__EXIT]) 120 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB__EXIT])
121 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ABORT_DEBUG])
113 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALIGNED_ALLOC]) 122 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALIGNED_ALLOC])
114 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATOLL]) 123 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATOLL])
115 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_GNU]) 124 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_GNU])
@@ -139,12 +148,12 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS],
139 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM]) 148 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM])
140 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R]) 149 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R])
141 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOCARRAY]) 150 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOCARRAY])
142 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_GNU])
143 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_POSIX]) 151 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_POSIX])
144 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALPATH]) 152 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALPATH])
145 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RPMATCH]) 153 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RPMATCH])
146 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SECURE_GETENV]) 154 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SECURE_GETENV])
147 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETENV]) 155 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETENV])
156 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STACK_TRACE])
148 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOD]) 157 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOD])
149 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOF]) 158 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOF])
150 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL]) 159 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL])
@@ -196,7 +205,6 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
196 HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R]) 205 HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R])
197 HAVE_QSORT_R=1; AC_SUBST([HAVE_QSORT_R]) 206 HAVE_QSORT_R=1; AC_SUBST([HAVE_QSORT_R])
198 HAVE_RANDOM=1; AC_SUBST([HAVE_RANDOM]) 207 HAVE_RANDOM=1; AC_SUBST([HAVE_RANDOM])
199 HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H])
200 HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) 208 HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R])
201 HAVE_REALLOCARRAY=1; AC_SUBST([HAVE_REALLOCARRAY]) 209 HAVE_REALLOCARRAY=1; AC_SUBST([HAVE_REALLOCARRAY])
202 HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH]) 210 HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH])
@@ -215,9 +223,11 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
215 HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL]) 223 HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL])
216 HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA]) 224 HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA])
217 HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) 225 HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H])
226 HAVE_SYS_PROCESS_H=0; AC_SUBST([HAVE_SYS_PROCESS_H])
218 HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) 227 HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT])
219 HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV]) 228 HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV])
220 REPLACE__EXIT=0; AC_SUBST([REPLACE__EXIT]) 229 REPLACE__EXIT=0; AC_SUBST([REPLACE__EXIT])
230 REPLACE_ABORT=0; AC_SUBST([REPLACE_ABORT])
221 REPLACE_ALIGNED_ALLOC=0; AC_SUBST([REPLACE_ALIGNED_ALLOC]) 231 REPLACE_ALIGNED_ALLOC=0; AC_SUBST([REPLACE_ALIGNED_ALLOC])
222 REPLACE_CALLOC_FOR_CALLOC_GNU=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_GNU]) 232 REPLACE_CALLOC_FOR_CALLOC_GNU=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_GNU])
223 REPLACE_CALLOC_FOR_CALLOC_POSIX=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_POSIX]) 233 REPLACE_CALLOC_FOR_CALLOC_POSIX=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_POSIX])
@@ -244,7 +254,6 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
244 REPLACE_RAND=0; AC_SUBST([REPLACE_RAND]) 254 REPLACE_RAND=0; AC_SUBST([REPLACE_RAND])
245 REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM]) 255 REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM])
246 REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) 256 REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R])
247 REPLACE_REALLOC_FOR_REALLOC_GNU=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_GNU])
248 REPLACE_REALLOC_FOR_REALLOC_POSIX=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_POSIX]) 257 REPLACE_REALLOC_FOR_REALLOC_POSIX=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_POSIX])
249 REPLACE_REALLOCARRAY=0; AC_SUBST([REPLACE_REALLOCARRAY]) 258 REPLACE_REALLOCARRAY=0; AC_SUBST([REPLACE_REALLOCARRAY])
250 REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) 259 REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH])
@@ -259,4 +268,5 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
259 REPLACE_STRTOULL=0; AC_SUBST([REPLACE_STRTOULL]) 268 REPLACE_STRTOULL=0; AC_SUBST([REPLACE_STRTOULL])
260 REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) 269 REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV])
261 REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB]) 270 REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB])
271 CAN_PRINT_STACK_TRACE=0; AC_SUBST([CAN_PRINT_STACK_TRACE])
262]) 272])
diff --git a/gl/m4/strcasecmp.m4 b/gl/m4/strcasecmp.m4
new file mode 100644
index 00000000..f9f90928
--- /dev/null
+++ b/gl/m4/strcasecmp.m4
@@ -0,0 +1,67 @@
1# strcasecmp.m4
2# serial 3
3dnl Copyright (C) 2002-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN([gl_FUNC_STRCASECMP],
10[
11 AC_REQUIRE([gl_STRINGS_H_DEFAULTS])
12 AC_CHECK_FUNCS([strcasecmp])
13 if test $ac_cv_func_strcasecmp = yes; then
14 gl_STRCASECMP_WORKS
15 case "$gl_cv_func_strcasecmp_works" in
16 *yes) ;;
17 *) REPLACE_STRCASECMP=1 ;;
18 esac
19 else
20 HAVE_STRCASECMP=0
21 fi
22])
23
24AC_DEFUN([gl_STRCASECMP_WORKS],
25[
26 AC_REQUIRE([AC_CANONICAL_HOST])
27 AC_CACHE_CHECK([whether strcasecmp works],
28 [gl_cv_func_strcasecmp_works],
29 [dnl Prepare a guess, used when cross-compiling or when specific locales
30 dnl are not available.
31 case "$host_os" in
32 solaris* | cygwin*)
33 gl_cv_func_strcasecmp_works="guessing no" ;;
34 *)
35 gl_cv_func_strcasecmp_works="guessing yes" ;;
36 esac
37 AC_RUN_IFELSE(
38 [AC_LANG_SOURCE([[
39#include <stdio.h>
40#include <ctype.h>
41#include <locale.h>
42#include <strings.h>
43int main ()
44{
45 if (setlocale (LC_ALL, "fr_FR.ISO-8859-1") != NULL
46 || setlocale (LC_ALL, "fr_FR.ISO8859-1") != NULL)
47 {
48 int c1 = (unsigned char) '\311';
49 int c2 = (unsigned char) '\351';
50 if (tolower (c1) == c2 && toupper (c2) == c1)
51 return strcasecmp ("Fej\311r", "Fej\351r") != 0;
52 }
53 return 2;
54}]])],
55 [gl_cv_func_strcasecmp_works=yes],
56 [if test $? = 1; then
57 gl_cv_func_strcasecmp_works=no
58 fi
59 ],
60 [:])
61 ])
62])
63
64# Prerequisites of lib/strcasecmp.c.
65AC_DEFUN([gl_PREREQ_STRCASECMP], [
66 :
67])
diff --git a/gl/m4/strcasestr.m4 b/gl/m4/strcasestr.m4
index d2548716..f56eed58 100644
--- a/gl/m4/strcasestr.m4
+++ b/gl/m4/strcasestr.m4
@@ -1,9 +1,10 @@
1# strcasestr.m4 1# strcasestr.m4
2# serial 28 2# serial 29
3dnl Copyright (C) 2005, 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005, 2007-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Check that strcasestr is present and works. 9dnl Check that strcasestr is present and works.
9AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE], 10AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE],
@@ -21,8 +22,8 @@ AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE],
21 if test $REPLACE_MEMCHR = 1; then 22 if test $REPLACE_MEMCHR = 1; then
22 REPLACE_STRCASESTR=1 23 REPLACE_STRCASESTR=1
23 else 24 else
24 dnl Detect https://sourceware.org/bugzilla/show_bug.cgi?id=12092 25 dnl Detect https://sourceware.org/PR12092
25 dnl and https://sourceware.org/bugzilla/show_bug.cgi?id=23637. 26 dnl and https://sourceware.org/PR23637.
26 AC_CACHE_CHECK([whether strcasestr works], 27 AC_CACHE_CHECK([whether strcasestr works],
27 [gl_cv_func_strcasestr_works_always], 28 [gl_cv_func_strcasestr_works_always],
28 [AC_RUN_IFELSE( 29 [AC_RUN_IFELSE(
@@ -98,7 +99,7 @@ static void quit (int sig) { _exit (sig + 128); }
98 char *haystack = (char *) malloc (2 * m + 2); 99 char *haystack = (char *) malloc (2 * m + 2);
99 char *needle = (char *) malloc (m + 2); 100 char *needle = (char *) malloc (m + 2);
100 /* Failure to compile this test due to missing alarm is okay, 101 /* Failure to compile this test due to missing alarm is okay,
101 since all such platforms (mingw) also lack strcasestr. */ 102 since all such platforms (mingw, MSVC) also lack strcasestr. */
102 signal (SIGALRM, quit); 103 signal (SIGALRM, quit);
103 alarm (5); 104 alarm (5);
104 /* Check for quadratic performance. */ 105 /* Check for quadratic performance. */
diff --git a/gl/m4/strerror.m4 b/gl/m4/strerror.m4
index 0272c6f4..9bb60c3f 100644
--- a/gl/m4/strerror.m4
+++ b/gl/m4/strerror.m4
@@ -1,9 +1,10 @@
1# strerror.m4 1# strerror.m4
2# serial 25 2# serial 25
3dnl Copyright (C) 2002, 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002, 2007-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_STRERROR], 9AC_DEFUN([gl_FUNC_STRERROR],
9[ 10[
diff --git a/gl/m4/string_h.m4 b/gl/m4/string_h.m4
index f31264ae..2a6e4db4 100644
--- a/gl/m4/string_h.m4
+++ b/gl/m4/string_h.m4
@@ -1,9 +1,10 @@
1# string_h.m4 1# string_h.m4
2# serial 39 2# serial 46
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Configure a GNU-like replacement for <string.h>. 9# Configure a GNU-like replacement for <string.h>.
9 10
@@ -23,8 +24,9 @@ AC_DEFUN_ONCE([gl_STRING_H],
23 ]], 24 ]],
24 [explicit_bzero ffsl ffsll memmem mempcpy memrchr memset_explicit 25 [explicit_bzero ffsl ffsll memmem mempcpy memrchr memset_explicit
25 rawmemchr stpcpy stpncpy strchrnul 26 rawmemchr stpcpy stpncpy strchrnul
26 strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r 27 strdup strncat strncpy strndup strnlen strpbrk strsep strcasestr strtok_r
27 strerror_r strerrorname_np sigabbrev_np sigdescr_np strsignal strverscmp]) 28 strerror_l strerror_r strerrorname_np
29 sigabbrev_np sigdescr_np strsignal strverscmp])
28 30
29 AC_REQUIRE([AC_C_RESTRICT]) 31 AC_REQUIRE([AC_C_RESTRICT])
30]) 32])
@@ -61,7 +63,9 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
61 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPNCPY]) 63 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPNCPY])
62 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCHRNUL]) 64 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCHRNUL])
63 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRDUP]) 65 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRDUP])
66 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRINGEQ])
64 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT]) 67 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT])
68 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCPY])
65 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP]) 69 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP])
66 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNLEN]) 70 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNLEN])
67 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPBRK]) 71 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPBRK])
@@ -69,6 +73,8 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
69 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR]) 73 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR])
70 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR]) 74 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR])
71 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R]) 75 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R])
76 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STR_STARTSWITH])
77 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STR_ENDSWITH])
72 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN]) 78 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN])
73 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN]) 79 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN])
74 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR]) 80 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR])
@@ -83,8 +89,11 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
83 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN]) 89 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN])
84 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP]) 90 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP])
85 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R]) 91 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R])
92 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBS_STARTSWITH])
93 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBS_ENDSWITH])
86 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR]) 94 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR])
87 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R]) 95 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R])
96 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_L])
88 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP]) 97 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP])
89 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP]) 98 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP])
90 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP]) 99 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP])
@@ -107,6 +116,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
107 HAVE_EXPLICIT_BZERO=1; AC_SUBST([HAVE_EXPLICIT_BZERO]) 116 HAVE_EXPLICIT_BZERO=1; AC_SUBST([HAVE_EXPLICIT_BZERO])
108 HAVE_FFSL=1; AC_SUBST([HAVE_FFSL]) 117 HAVE_FFSL=1; AC_SUBST([HAVE_FFSL])
109 HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL]) 118 HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL])
119 HAVE_DECL_MEMEQ=0; AC_SUBST([HAVE_DECL_MEMEQ])
110 HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) 120 HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
111 HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) 121 HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
112 HAVE_MEMSET_EXPLICIT=1; AC_SUBST([HAVE_MEMSET_EXPLICIT]) 122 HAVE_MEMSET_EXPLICIT=1; AC_SUBST([HAVE_MEMSET_EXPLICIT])
@@ -116,6 +126,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
116 HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY]) 126 HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY])
117 HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL]) 127 HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL])
118 HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP]) 128 HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP])
129 HAVE_DECL_STREQ=0; AC_SUBST([HAVE_DECL_STREQ])
119 HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP]) 130 HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP])
120 HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN]) 131 HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN])
121 HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK]) 132 HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK])
@@ -123,6 +134,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
123 HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) 134 HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR])
124 HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) 135 HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
125 HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R]) 136 HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R])
137 HAVE_STRERROR_L=1; AC_SUBST([HAVE_STRERROR_L])
126 HAVE_STRERRORNAME_NP=1; AC_SUBST([HAVE_STRERRORNAME_NP]) 138 HAVE_STRERRORNAME_NP=1; AC_SUBST([HAVE_STRERRORNAME_NP])
127 HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP]) 139 HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP])
128 HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP]) 140 HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP])
@@ -138,6 +150,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
138 REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL]) 150 REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL])
139 REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) 151 REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP])
140 REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) 152 REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT])
153 REPLACE_STRNCPY=0; AC_SUBST([REPLACE_STRNCPY])
141 REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) 154 REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP])
142 REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN]) 155 REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN])
143 REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) 156 REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR])
@@ -145,6 +158,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
145 REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) 158 REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R])
146 REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) 159 REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
147 REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) 160 REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R])
161 REPLACE_STRERROR_L=0; AC_SUBST([REPLACE_STRERROR_L])
148 REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP]) 162 REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP])
149 REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) 163 REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL])
150 REPLACE_STRVERSCMP=0; AC_SUBST([REPLACE_STRVERSCMP]) 164 REPLACE_STRVERSCMP=0; AC_SUBST([REPLACE_STRVERSCMP])
diff --git a/gl/m4/stringeq.m4 b/gl/m4/stringeq.m4
new file mode 100644
index 00000000..ffea8afc
--- /dev/null
+++ b/gl/m4/stringeq.m4
@@ -0,0 +1,25 @@
1# stringeq.m4
2# serial 1
3dnl Copyright (C) 2025-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN([gl_FUNC_STREQ],
10[
11 AC_REQUIRE([gl_STRING_H_DEFAULTS])
12 AC_CHECK_DECLS_ONCE([streq])
13 if test $ac_cv_have_decl_streq != no; then
14 HAVE_DECL_STREQ=1
15 fi
16])
17
18AC_DEFUN([gl_FUNC_MEMEQ],
19[
20 AC_REQUIRE([gl_STRING_H_DEFAULTS])
21 AC_CHECK_DECLS_ONCE([memeq])
22 if test $ac_cv_have_decl_memeq != no; then
23 HAVE_DECL_MEMEQ=1
24 fi
25])
diff --git a/gl/m4/strings_h.m4 b/gl/m4/strings_h.m4
index aaafb559..aec4f715 100644
--- a/gl/m4/strings_h.m4
+++ b/gl/m4/strings_h.m4
@@ -1,9 +1,10 @@
1# strings_h.m4 1# strings_h.m4
2# serial 9 2# serial 14
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Configure a replacement for <strings.h>. 9# Configure a replacement for <strings.h>.
9 10
@@ -28,7 +29,7 @@ AC_DEFUN_ONCE([gl_STRINGS_H],
28 <strings.h>. */ 29 <strings.h>. */
29 #include <sys/types.h> 30 #include <sys/types.h>
30 #include <strings.h> 31 #include <strings.h>
31 ]], [ffs strcasecmp strncasecmp]) 32 ]], [ffs strcasecmp strcasecmp_l strncasecmp strncasecmp_l])
32]) 33])
33 34
34# gl_STRINGS_MODULE_INDICATOR([modulename]) 35# gl_STRINGS_MODULE_INDICATOR([modulename])
@@ -49,6 +50,10 @@ AC_DEFUN([gl_STRINGS_H_REQUIRE_DEFAULTS],
49[ 50[
50 m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS], [ 51 m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS], [
51 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFS]) 52 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFS])
53 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASECMP])
54 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASECMP_L])
55 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCASECMP])
56 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCASECMP_L])
52 ]) 57 ])
53 m4_require(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS]) 58 m4_require(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS])
54 AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) 59 AC_REQUIRE([gl_STRINGS_H_DEFAULTS])
@@ -59,5 +64,12 @@ AC_DEFUN([gl_STRINGS_H_DEFAULTS],
59 dnl Assume proper GNU behavior unless another module says otherwise. 64 dnl Assume proper GNU behavior unless another module says otherwise.
60 HAVE_FFS=1; AC_SUBST([HAVE_FFS]) 65 HAVE_FFS=1; AC_SUBST([HAVE_FFS])
61 HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP]) 66 HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP])
67 HAVE_STRCASECMP_L=1; AC_SUBST([HAVE_STRCASECMP_L])
68 HAVE_STRNCASECMP=1; AC_SUBST([HAVE_STRNCASECMP])
69 HAVE_STRNCASECMP_L=1; AC_SUBST([HAVE_STRNCASECMP_L])
62 HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP]) 70 HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP])
71 REPLACE_STRCASECMP=0; AC_SUBST([REPLACE_STRCASECMP])
72 REPLACE_STRCASECMP_L=0; AC_SUBST([REPLACE_STRCASECMP_L])
73 REPLACE_STRNCASECMP=0; AC_SUBST([REPLACE_STRNCASECMP])
74 REPLACE_STRNCASECMP_L=0; AC_SUBST([REPLACE_STRNCASECMP_L])
63]) 75])
diff --git a/gl/m4/strcase.m4 b/gl/m4/strncasecmp.m4
index 63021733..4314b603 100644
--- a/gl/m4/strcase.m4
+++ b/gl/m4/strncasecmp.m4
@@ -1,31 +1,22 @@
1# strcase.m4 1# strncasecmp.m4
2# serial 12 2# serial 2
3dnl Copyright (C) 2002, 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7 7dnl This file is offered as-is, without any warranty.
8AC_DEFUN([gl_STRCASE],
9[
10 gl_FUNC_STRCASECMP
11 gl_FUNC_STRNCASECMP
12])
13
14AC_DEFUN([gl_FUNC_STRCASECMP],
15[
16 AC_REQUIRE([gl_STRINGS_H_DEFAULTS])
17 AC_CHECK_FUNCS([strcasecmp])
18 if test $ac_cv_func_strcasecmp = no; then
19 HAVE_STRCASECMP=0
20 fi
21])
22 8
23AC_DEFUN([gl_FUNC_STRNCASECMP], 9AC_DEFUN([gl_FUNC_STRNCASECMP],
24[ 10[
25 AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) 11 AC_REQUIRE([gl_STRINGS_H_DEFAULTS])
26 AC_CHECK_FUNCS([strncasecmp]) 12 AC_CHECK_FUNCS([strncasecmp])
27 if test $ac_cv_func_strncasecmp = yes; then 13 if test $ac_cv_func_strncasecmp = yes; then
28 HAVE_STRNCASECMP=1 14 dnl Assume that strncasecmp and strcasecmp share the same bugs.
15 gl_STRCASECMP_WORKS
16 case "$gl_cv_func_strcasecmp_works" in
17 *yes) ;;
18 *) REPLACE_STRNCASECMP=1 ;;
19 esac
29 else 20 else
30 HAVE_STRNCASECMP=0 21 HAVE_STRNCASECMP=0
31 fi 22 fi
@@ -35,11 +26,6 @@ AC_DEFUN([gl_FUNC_STRNCASECMP],
35 fi 26 fi
36]) 27])
37 28
38# Prerequisites of lib/strcasecmp.c.
39AC_DEFUN([gl_PREREQ_STRCASECMP], [
40 :
41])
42
43# Prerequisites of lib/strncasecmp.c. 29# Prerequisites of lib/strncasecmp.c.
44AC_DEFUN([gl_PREREQ_STRNCASECMP], [ 30AC_DEFUN([gl_PREREQ_STRNCASECMP], [
45 : 31 :
diff --git a/gl/m4/strncpy.m4 b/gl/m4/strncpy.m4
new file mode 100644
index 00000000..b94abede
--- /dev/null
+++ b/gl/m4/strncpy.m4
@@ -0,0 +1,94 @@
1# strncpy.m4
2# serial 1
3dnl Copyright (C) 2002-2004, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN_ONCE([gl_FUNC_STRNCPY],
10[
11 AC_REQUIRE([gl_STRING_H_DEFAULTS])
12 AC_REQUIRE([AC_PROG_CC])
13 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
14
15 dnl Check for prerequisites for memory fence checks.
16 gl_FUNC_MMAP_ANON
17 AC_CHECK_HEADERS_ONCE([sys/mman.h])
18 AC_CHECK_FUNCS_ONCE([mprotect])
19
20 dnl Detect bug in FreeBSD 15.0 on x86_64:
21 dnl strncpy should not dereference more than n bytes, but always dereferences
22 dnl n+1 bytes if the first n bytes don't contain a NUL byte.
23 dnl Assume that strncpy works on platforms that lack mprotect.
24 AC_CACHE_CHECK([whether strncpy works], [gl_cv_func_strncpy_works],
25 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
26#include <string.h>
27#if HAVE_SYS_MMAN_H
28# include <fcntl.h>
29# include <unistd.h>
30# include <sys/types.h>
31# include <sys/mman.h>
32#endif
33]GL_MDA_DEFINES],
34[[
35 char *fence = NULL;
36#if HAVE_SYS_MMAN_H && HAVE_MPROTECT
37 {
38 long int pagesize = sysconf (_SC_PAGESIZE);
39 char *two_pages =
40 (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
41 MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
42 if (two_pages != (char *)(-1)
43 && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
44 fence = two_pages + pagesize;
45 }
46#endif
47 if (fence)
48 {
49 char dest[8];
50
51 dest[0] = 'a';
52 dest[1] = 'b';
53 dest[2] = 'c';
54 dest[3] = 'd';
55 dest[4] = 'e';
56 dest[5] = 'f';
57 dest[6] = 'g';
58
59 *(fence - 3) = '7';
60 *(fence - 2) = '2';
61 *(fence - 1) = '9';
62
63 if (strncpy (dest + 1, fence - 3, 3) != dest + 1)
64 return 1;
65 if (dest[0] != 'a')
66 return 2;
67 if (dest[1] != '7' || dest[2] != '2' || dest[3] != '9')
68 return 3;
69 if (dest[4] != 'e')
70 return 4;
71 }
72 return 0;
73]])], [gl_cv_func_strncpy_works=yes], [gl_cv_func_strncpy_works=no],
74 [
75 case "$host_os" in
76 # Guess no on FreeBSD.
77 freebsd* | dragonfly*) gl_cv_func_strncpy_works="guessing no" ;;
78 # Guess yes on native Windows.
79 mingw* | windows*) gl_cv_func_strncpy_works="guessing yes" ;;
80 # Guess yes otherwise.
81 *) gl_cv_func_strncpy_works="guessing yes" ;;
82 esac
83 ])
84 ])
85 case "$gl_cv_func_strncpy_works" in
86 *yes) ;;
87 *) REPLACE_STRNCPY=1 ;;
88 esac
89])
90
91# Prerequisites of lib/strncpy.c.
92AC_DEFUN([gl_PREREQ_STRNCPY], [
93 :
94])
diff --git a/gl/m4/strsep.m4 b/gl/m4/strsep.m4
index cfde87a5..6afd34a9 100644
--- a/gl/m4/strsep.m4
+++ b/gl/m4/strsep.m4
@@ -1,9 +1,10 @@
1# strsep.m4 1# strsep.m4
2# serial 11 2# serial 11
3dnl Copyright (C) 2002-2004, 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2004, 2007, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_STRSEP], 9AC_DEFUN([gl_FUNC_STRSEP],
9[ 10[
diff --git a/gl/m4/strstr.m4 b/gl/m4/strstr.m4
index 957ed2e3..3a9e9c60 100644
--- a/gl/m4/strstr.m4
+++ b/gl/m4/strstr.m4
@@ -1,9 +1,10 @@
1# strstr.m4 1# strstr.m4
2# serial 24 2# serial 25
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Check that strstr works. 9dnl Check that strstr works.
9AC_DEFUN([gl_FUNC_STRSTR_SIMPLE], 10AC_DEFUN([gl_FUNC_STRSTR_SIMPLE],
@@ -13,8 +14,8 @@ AC_DEFUN([gl_FUNC_STRSTR_SIMPLE],
13 if test $REPLACE_MEMCHR = 1; then 14 if test $REPLACE_MEMCHR = 1; then
14 REPLACE_STRSTR=1 15 REPLACE_STRSTR=1
15 else 16 else
16 dnl Detect https://sourceware.org/bugzilla/show_bug.cgi?id=12092 17 dnl Detect https://sourceware.org/PR12092
17 dnl and https://sourceware.org/bugzilla/show_bug.cgi?id=23637. 18 dnl and https://sourceware.org/PR23637.
18 AC_CACHE_CHECK([whether strstr works], 19 AC_CACHE_CHECK([whether strstr works],
19 [gl_cv_func_strstr_works_always], 20 [gl_cv_func_strstr_works_always],
20 [AC_RUN_IFELSE( 21 [AC_RUN_IFELSE(
@@ -95,7 +96,7 @@ static void quit (int sig) { _exit (sig + 128); }
95 char *haystack = (char *) malloc (2 * m + 2); 96 char *haystack = (char *) malloc (2 * m + 2);
96 char *needle = (char *) malloc (m + 2); 97 char *needle = (char *) malloc (m + 2);
97 /* Failure to compile this test due to missing alarm is okay, 98 /* Failure to compile this test due to missing alarm is okay,
98 since all such platforms (mingw) also have quadratic strstr. */ 99 since all such platforms (mingw, MSVC) also have quadratic strstr. */
99 signal (SIGALRM, quit); 100 signal (SIGALRM, quit);
100 alarm (5); 101 alarm (5);
101 /* Check for quadratic performance. */ 102 /* Check for quadratic performance. */
diff --git a/gl/m4/sys_cdefs_h.m4 b/gl/m4/sys_cdefs_h.m4
new file mode 100644
index 00000000..a1398a29
--- /dev/null
+++ b/gl/m4/sys_cdefs_h.m4
@@ -0,0 +1,26 @@
1# sys_cdefs_h.m4 - Is <sys/cdefs.h> compatible enough with glibc?
2# serial 2
3dnl Copyright 2024-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl Written by Paul Eggert.
10
11AC_DEFUN_ONCE([gl_CHECK_HEADER_SYS_CDEFS_H],
12 [AC_CACHE_CHECK([for glibc-compatible sys/cdefs.h],
13 [gl_cv_header_sys_cdefs_h],
14 [AC_COMPILE_IFELSE(
15 [AC_LANG_DEFINES_PROVIDED
16 [#include <sys/cdefs.h>
17 enum { foo = __GNUC_PREREQ (14, 1) } bar;
18 ]],
19 [gl_cv_header_sys_cdefs_h=yes],
20 [gl_cv_header_sys_cdefs_h=no])])
21 if test "$gl_cv_header_sys_cdefs_h" = yes; then
22 HAVE_SYS_CDEFS_H=1
23 else
24 HAVE_SYS_CDEFS_H=0
25 fi
26 AC_SUBST([HAVE_SYS_CDEFS_H])])
diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4
index 3bf3cb47..cdc374e4 100644
--- a/gl/m4/sys_socket_h.m4
+++ b/gl/m4/sys_socket_h.m4
@@ -1,9 +1,10 @@
1# sys_socket_h.m4 1# sys_socket_h.m4
2# serial 29 2# serial 32
3dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Simon Josefsson. 9dnl From Simon Josefsson.
9 10
@@ -12,17 +13,6 @@ AC_DEFUN_ONCE([gl_SYS_SOCKET_H],
12 AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) 13 AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
13 AC_REQUIRE([AC_CANONICAL_HOST]) 14 AC_REQUIRE([AC_CANONICAL_HOST])
14 15
15 dnl On OSF/1, the functions recv(), send(), recvfrom(), sendto() have
16 dnl old-style declarations (with return type 'int' instead of 'ssize_t')
17 dnl unless _POSIX_PII_SOCKET is defined.
18 case "$host_os" in
19 osf*)
20 AC_DEFINE([_POSIX_PII_SOCKET], [1],
21 [Define to 1 in order to get the POSIX compatible declarations
22 of socket functions.])
23 ;;
24 esac
25
26 GL_GENERATE_SYS_SOCKET_H=false 16 GL_GENERATE_SYS_SOCKET_H=false
27 AC_CACHE_CHECK([whether <sys/socket.h> is self-contained], 17 AC_CACHE_CHECK([whether <sys/socket.h> is self-contained],
28 [gl_cv_header_sys_socket_h_selfcontained], 18 [gl_cv_header_sys_socket_h_selfcontained],
@@ -52,24 +42,10 @@ AC_DEFUN_ONCE([gl_SYS_SOCKET_H],
52 fi 42 fi
53 # We need to check for ws2tcpip.h now. 43 # We need to check for ws2tcpip.h now.
54 gl_PREREQ_SYS_H_SOCKET 44 gl_PREREQ_SYS_H_SOCKET
55 AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[ 45 gl_PREREQ_SYS_SA_FAMILY
56 /* sys/types.h is not needed according to POSIX, but the
57 sys/socket.h in i386-unknown-freebsd4.10 and
58 powerpc-apple-darwin5.5 required it. */
59#include <sys/types.h>
60#ifdef HAVE_SYS_SOCKET_H
61#include <sys/socket.h>
62#endif
63#ifdef HAVE_WS2TCPIP_H
64#include <ws2tcpip.h>
65#endif
66])
67 if test $ac_cv_type_struct_sockaddr_storage = no; then 46 if test $ac_cv_type_struct_sockaddr_storage = no; then
68 HAVE_STRUCT_SOCKADDR_STORAGE=0 47 HAVE_STRUCT_SOCKADDR_STORAGE=0
69 fi 48 fi
70 if test $ac_cv_type_sa_family_t = no; then
71 HAVE_SA_FAMILY_T=0
72 fi
73 if test $ac_cv_type_struct_sockaddr_storage != no; then 49 if test $ac_cv_type_struct_sockaddr_storage != no; then
74 AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], 50 AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family],
75 [], 51 [],
@@ -158,6 +134,32 @@ AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP],
158 AC_SUBST([HAVE_WS2TCPIP_H]) 134 AC_SUBST([HAVE_WS2TCPIP_H])
159]) 135])
160 136
137# Common prerequisites of the <sys/socket.h> replacement and of the <sys/un.h>
138# replacement.
139# Sets and substitutes HAVE_SA_FAMILY_T.
140AC_DEFUN([gl_PREREQ_SYS_SA_FAMILY],
141[
142 AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])
143 AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[
144 /* sys/types.h is not needed according to POSIX, but the
145 sys/socket.h in i386-unknown-freebsd4.10 and
146 powerpc-apple-darwin5.5 required it. */
147#include <sys/types.h>
148#ifdef HAVE_SYS_SOCKET_H
149#include <sys/socket.h>
150#endif
151#ifdef HAVE_WS2TCPIP_H
152#include <ws2tcpip.h>
153#endif
154])
155 if test $ac_cv_type_sa_family_t = yes; then
156 HAVE_SA_FAMILY_T=1
157 else
158 HAVE_SA_FAMILY_T=0
159 fi
160 AC_SUBST([HAVE_SA_FAMILY_T])
161])
162
161# gl_SYS_SOCKET_MODULE_INDICATOR([modulename]) 163# gl_SYS_SOCKET_MODULE_INDICATOR([modulename])
162# sets the shell variable that indicates the presence of the given module 164# sets the shell variable that indicates the presence of the given module
163# to a C preprocessor expression that will evaluate to 1. 165# to a C preprocessor expression that will evaluate to 1.
@@ -202,6 +204,5 @@ AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
202 HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) 204 HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE])
203 HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; 205 HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1;
204 AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) 206 AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY])
205 HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T])
206 HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4]) 207 HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4])
207]) 208])
diff --git a/gl/m4/sys_stat_h.m4 b/gl/m4/sys_stat_h.m4
index 3cc50ce6..04dfce7e 100644
--- a/gl/m4/sys_stat_h.m4
+++ b/gl/m4/sys_stat_h.m4
@@ -1,9 +1,10 @@
1# sys_stat_h.m4 1# sys_stat_h.m4
2# serial 42 -*- Autoconf -*- 2# serial 44 -*- Autoconf -*-
3dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Eric Blake. 9dnl From Eric Blake.
9dnl Provide a GNU-like <sys/stat.h>. 10dnl Provide a GNU-like <sys/stat.h>.
diff --git a/gl/m4/sys_types_h.m4 b/gl/m4/sys_types_h.m4
index 00d2437b..b284e08e 100644
--- a/gl/m4/sys_types_h.m4
+++ b/gl/m4/sys_types_h.m4
@@ -1,9 +1,10 @@
1# sys_types_h.m4 1# sys_types_h.m4
2# serial 13 2# serial 15
3dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2011-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_SYS_TYPES_H], 9AC_DEFUN_ONCE([gl_SYS_TYPES_H],
9[ 10[
@@ -23,6 +24,9 @@ AC_DEFUN_ONCE([gl_SYS_TYPES_H],
23 dnl Whether to override the 'off_t' type. 24 dnl Whether to override the 'off_t' type.
24 AC_REQUIRE([gl_TYPE_OFF_T]) 25 AC_REQUIRE([gl_TYPE_OFF_T])
25 26
27 dnl Whether to define the 'off64_t' type.
28 AC_REQUIRE([gl_TYPE_OFF64_T])
29
26 dnl Whether to override the 'dev_t' and 'ino_t' types. 30 dnl Whether to override the 'dev_t' and 'ino_t' types.
27 m4_ifdef([gl_WINDOWS_STAT_INODES], [ 31 m4_ifdef([gl_WINDOWS_STAT_INODES], [
28 AC_REQUIRE([gl_WINDOWS_STAT_INODES]) 32 AC_REQUIRE([gl_WINDOWS_STAT_INODES])
@@ -30,6 +34,14 @@ AC_DEFUN_ONCE([gl_SYS_TYPES_H],
30 WINDOWS_STAT_INODES=0 34 WINDOWS_STAT_INODES=0
31 ]) 35 ])
32 AC_SUBST([WINDOWS_STAT_INODES]) 36 AC_SUBST([WINDOWS_STAT_INODES])
37
38 dnl Test whether the 'blksize_t' type is defined.
39 AC_CHECK_TYPE([blksize_t], [HAVE_BLKSIZE_T=1], [HAVE_BLKSIZE_T=0])
40 AC_SUBST([HAVE_BLKSIZE_T])
41
42 dnl Test whether the 'blkcnt_t' type is defined.
43 AC_CHECK_TYPE([blkcnt_t], [HAVE_BLKCNT_T=1], [HAVE_BLKCNT_T=0])
44 AC_SUBST([HAVE_BLKCNT_T])
33]) 45])
34 46
35# Initializes the default values for AC_SUBSTed shell variables. 47# Initializes the default values for AC_SUBSTed shell variables.
diff --git a/gl/m4/sys_uio_h.m4 b/gl/m4/sys_uio_h.m4
index a471c720..59496e01 100644
--- a/gl/m4/sys_uio_h.m4
+++ b/gl/m4/sys_uio_h.m4
@@ -1,9 +1,10 @@
1# sys_uio_h.m4 1# sys_uio_h.m4
2# serial 3 2# serial 3
3dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2011-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_SYS_UIO_H], 9AC_DEFUN_ONCE([gl_SYS_UIO_H],
9[ 10[
diff --git a/gl/m4/threadlib.m4 b/gl/m4/threadlib.m4
index f5e81479..bdea4b97 100644
--- a/gl/m4/threadlib.m4
+++ b/gl/m4/threadlib.m4
@@ -1,9 +1,10 @@
1# threadlib.m4 1# threadlib.m4
2# serial 42 2# serial 49
3dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Bruno Haible. 9dnl From Bruno Haible.
9 10
@@ -56,24 +57,12 @@ AC_DEFUN([gl_ANYTHREADLIB_EARLY],
56[ 57[
57 AC_REQUIRE([AC_CANONICAL_HOST]) 58 AC_REQUIRE([AC_CANONICAL_HOST])
58 if test -z "$gl_anythreadlib_early_done"; then 59 if test -z "$gl_anythreadlib_early_done"; then
59 case "$host_os" in
60 osf*)
61 # On OSF/1, the compiler needs the flag -D_REENTRANT so that it
62 # groks <pthread.h>. cc also understands the flag -pthread, but
63 # we don't use it because 1. gcc-2.95 doesn't understand -pthread,
64 # 2. putting a flag into CPPFLAGS that has an effect on the linker
65 # causes the AC_LINK_IFELSE test below to succeed unexpectedly,
66 # leading to wrong values of LIBTHREAD and LTLIBTHREAD.
67 CPPFLAGS="$CPPFLAGS -D_REENTRANT"
68 ;;
69 esac
70 # Some systems optimize for single-threaded programs by default, and 60 # Some systems optimize for single-threaded programs by default, and
71 # need special flags to disable these optimizations. For example, the 61 # need special flags to disable these optimizations. For example, the
72 # definition of 'errno' in <errno.h>. 62 # definition of errno in <errno.h>.
73 case "$host_os" in 63 AS_CASE([$host_os],
74 aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; 64 [aix* | freebsd*], [CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"],
75 solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; 65 [hpux* | solaris*], [CPPFLAGS="$CPPFLAGS -D_REENTRANT"])
76 esac
77 gl_anythreadlib_early_done=done 66 gl_anythreadlib_early_done=done
78 fi 67 fi
79]) 68])
@@ -85,24 +74,26 @@ AC_DEFUN([gl_WEAK_SYMBOLS],
85 AC_REQUIRE([AC_CANONICAL_HOST]) 74 AC_REQUIRE([AC_CANONICAL_HOST])
86 AC_CACHE_CHECK([whether imported symbols can be declared weak], 75 AC_CACHE_CHECK([whether imported symbols can be declared weak],
87 [gl_cv_have_weak], 76 [gl_cv_have_weak],
88 [case "$host_os" in 77 [AS_CASE([$host_os],
89 cygwin* | mingw* | windows*) 78 [cygwin* | mingw* | windows*],
79 [
90 dnl On Cygwin 3.2.0 with gcc 10.2, and likewise on mingw 10.0.0 with 80 dnl On Cygwin 3.2.0 with gcc 10.2, and likewise on mingw 10.0.0 with
91 dnl gcc 11.3, the test below would succeed, but programs that use 81 dnl gcc 11.3, the test below would succeed, but programs that use
92 dnl pthread_in_use() with weak symbol references crash miserably at 82 dnl pthread_in_use() with weak symbol references crash miserably at
93 dnl runtime. 83 dnl runtime.
94 gl_cv_have_weak="guessing no" 84 gl_cv_have_weak="guessing no"
95 ;; 85 ],
96 *) 86 [
97 gl_cv_have_weak=no 87 gl_cv_have_weak=no
98 dnl First, test whether the compiler accepts it syntactically. 88 dnl First, test whether the compiler accepts it syntactically.
99 AC_LINK_IFELSE( 89 AC_LINK_IFELSE(
100 [AC_LANG_PROGRAM( 90 [AC_LANG_PROGRAM(
101 [[extern void xyzzy (); 91 [[extern void xyzzy ();
102#pragma weak xyzzy]], 92#pragma weak xyzzy
93 ]],
103 [[xyzzy();]])], 94 [[xyzzy();]])],
104 [gl_cv_have_weak=maybe]) 95 [gl_cv_have_weak=maybe])
105 if test $gl_cv_have_weak = maybe; then 96 AS_IF([test $gl_cv_have_weak = maybe], [
106 dnl Second, test whether it actually works. On Cygwin 1.7.2, with 97 dnl Second, test whether it actually works. On Cygwin 1.7.2, with
107 dnl gcc 4.3, symbols declared weak always evaluate to the address 0. 98 dnl gcc 4.3, symbols declared weak always evaluate to the address 0.
108 AC_RUN_IFELSE( 99 AC_RUN_IFELSE(
@@ -125,20 +116,19 @@ int main ()
125 [gl_cv_have_weak="guessing yes"], 116 [gl_cv_have_weak="guessing yes"],
126 [gl_cv_have_weak="guessing no"]) 117 [gl_cv_have_weak="guessing no"])
127 ]) 118 ])
128 fi 119 ])
129 ;; 120 ])
130 esac 121 dnl But when linking statically, weak symbols do not work.
131 dnl But when linking statically, weak symbols don't work. 122 AS_CASE([" $LDFLAGS "],
132 case " $LDFLAGS " in 123 [*" -static "*], [gl_cv_have_weak=no])
133 *" -static "*) gl_cv_have_weak=no ;;
134 esac
135 dnl Test for a bug in FreeBSD 11: A link error occurs when using a weak 124 dnl Test for a bug in FreeBSD 11: A link error occurs when using a weak
136 dnl symbol and linking against a shared library that has a dependency on 125 dnl symbol and linking against a shared library that has a dependency on
137 dnl the shared library that defines the symbol. 126 dnl the shared library that defines the symbol.
138 case "$gl_cv_have_weak" in 127 AS_CASE([$gl_cv_have_weak],
139 *yes) 128 [*yes],
140 case "$host_os" in 129 [AS_CASE([$host_os],
141 freebsd* | dragonfly* | midnightbsd*) 130 [freebsd* | dragonfly* | midnightbsd*],
131 [
142 : > conftest1.c 132 : > conftest1.c
143 $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&AS_MESSAGE_LOG_FD 2>&1 133 $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&AS_MESSAGE_LOG_FD 2>&1
144 cat <<EOF > conftest2.c 134 cat <<EOF > conftest2.c
@@ -152,17 +142,15 @@ EOF
152 $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&AS_MESSAGE_LOG_FD 2>&1 \ 142 $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&AS_MESSAGE_LOG_FD 2>&1 \
153 || gl_cv_have_weak=no 143 || gl_cv_have_weak=no
154 rm -f conftest1.c libempty.so conftest2.c conftest 144 rm -f conftest1.c libempty.so conftest2.c conftest
155 ;; 145 ])
156 esac 146 ])
157 ;;
158 esac
159 ]) 147 ])
160 case "$gl_cv_have_weak" in 148 AS_CASE([$gl_cv_have_weak],
161 *yes) 149 [*yes],
150 [
162 AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], 151 AC_DEFINE([HAVE_WEAK_SYMBOLS], [1],
163 [Define to 1 if the compiler and linker support weak declarations of symbols.]) 152 [Define to 1 if the compiler and linker support weak declarations of symbols.])
164 ;; 153 ])
165 esac
166]) 154])
167 155
168dnl ============================================================================ 156dnl ============================================================================
@@ -188,36 +176,30 @@ dnl The guts of gl_PTHREADLIB. Needs to be expanded only once.
188AC_DEFUN([gl_PTHREADLIB_BODY], 176AC_DEFUN([gl_PTHREADLIB_BODY],
189[ 177[
190 AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) 178 AC_REQUIRE([gl_ANYTHREADLIB_EARLY])
191 if test -z "$gl_pthreadlib_body_done"; then 179 AS_IF([test -z "$gl_pthreadlib_body_done"], [
192 gl_pthread_api=no 180 gl_pthread_api=no
193 LIBPTHREAD= 181 LIBPTHREAD=
194 LIBPMULTITHREAD= 182 LIBPMULTITHREAD=
195 # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that
196 # it groks <pthread.h>. It's added above, in gl_ANYTHREADLIB_EARLY.
197 AC_CHECK_HEADER([pthread.h], 183 AC_CHECK_HEADER([pthread.h],
198 [gl_have_pthread_h=yes], [gl_have_pthread_h=no]) 184 [gl_have_pthread_h=yes], [gl_have_pthread_h=no])
199 if test "$gl_have_pthread_h" = yes; then 185 AS_IF([test "$gl_have_pthread_h" = yes], [
200 # Other possible tests: 186 # Other possible tests:
201 # -lpthreads (FSU threads, PCthreads) 187 # -lpthreads (FSU threads, PCthreads)
202 # -lgthreads 188 # -lgthreads
203 # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist 189 # Test whether both pthread_mutex_lock exists in libc.
204 # in libc. IRIX 6.5 has the first one in both libc and libpthread, but
205 # the second one only in libpthread, and lock.c needs it.
206 # 190 #
207 # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 191 # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04
208 # needs -pthread for some reason. See: 192 # needs -pthread for some reason. See:
209 # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html 193 # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html
210 saved_LIBS="$LIBS" 194 saved_LIBS="$LIBS"
211 for gl_pthread in '' '-pthread'; do 195 for gl_pthread in "" "-pthread"; do
212 LIBS="$LIBS $gl_pthread" 196 LIBS="$LIBS $gl_pthread"
213 AC_LINK_IFELSE( 197 AC_LINK_IFELSE(
214 [AC_LANG_PROGRAM( 198 [AC_LANG_PROGRAM(
215 [[#include <pthread.h> 199 [[#include <pthread.h>
216 pthread_mutex_t m; 200 pthread_mutex_t m;
217 pthread_mutexattr_t ma;
218 ]], 201 ]],
219 [[pthread_mutex_lock (&m); 202 [[pthread_mutex_lock (&m);]])],
220 pthread_mutexattr_init (&ma);]])],
221 [gl_pthread_api=yes 203 [gl_pthread_api=yes
222 LIBPTHREAD=$gl_pthread 204 LIBPTHREAD=$gl_pthread
223 LIBPMULTITHREAD=$gl_pthread]) 205 LIBPMULTITHREAD=$gl_pthread])
@@ -230,8 +212,9 @@ AC_DEFUN([gl_PTHREADLIB_BODY],
230 gl_pthread_in_glibc=no 212 gl_pthread_in_glibc=no
231 # On Linux with glibc >= 2.34, libc contains the fully functional 213 # On Linux with glibc >= 2.34, libc contains the fully functional
232 # pthread functions. 214 # pthread functions.
233 case "$host_os" in 215 AS_CASE([$host_os],
234 linux*) 216 [linux*],
217 [
235 AC_EGREP_CPP([Lucky user], 218 AC_EGREP_CPP([Lucky user],
236 [#include <features.h> 219 [#include <features.h>
237 #ifdef __GNU_LIBRARY__ 220 #ifdef __GNU_LIBRARY__
@@ -242,19 +225,17 @@ AC_DEFUN([gl_PTHREADLIB_BODY],
242 ], 225 ],
243 [gl_pthread_in_glibc=yes], 226 [gl_pthread_in_glibc=yes],
244 []) 227 [])
245 ;; 228 ])
246 esac
247 echo "$as_me:__oline__: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&AS_MESSAGE_LOG_FD 229 echo "$as_me:__oline__: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&AS_MESSAGE_LOG_FD
248 230
249 # Test for libpthread by looking for pthread_kill. (Not pthread_self, 231 # Test for libpthread by looking for pthread_kill.
250 # since it is defined as a macro on OSF/1.) 232 AS_IF([test $gl_pthread_api = yes && test -z "$LIBPTHREAD"], [
251 if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then
252 # The program links fine without libpthread. But it may actually 233 # The program links fine without libpthread. But it may actually
253 # need to link with libpthread in order to create multiple threads. 234 # need to link with libpthread in order to create multiple threads.
254 AC_CHECK_LIB([pthread], [pthread_kill], 235 AC_CHECK_LIB([pthread], [pthread_kill],
255 [if test $gl_pthread_in_glibc = yes; then 236 [AS_IF([test $gl_pthread_in_glibc = yes], [
256 LIBPMULTITHREAD= 237 LIBPMULTITHREAD=
257 else 238 ], [
258 LIBPMULTITHREAD=-lpthread 239 LIBPMULTITHREAD=-lpthread
259 # On Solaris and HP-UX, most pthread functions exist also in libc. 240 # On Solaris and HP-UX, most pthread functions exist also in libc.
260 # Therefore pthread_in_use() needs to actually try to create a 241 # Therefore pthread_in_use() needs to actually try to create a
@@ -262,14 +243,13 @@ AC_DEFUN([gl_PTHREADLIB_BODY],
262 # pthread_create will actually create a thread. 243 # pthread_create will actually create a thread.
263 # On Solaris 10 or newer, this test is no longer needed, because 244 # On Solaris 10 or newer, this test is no longer needed, because
264 # libc contains the fully functional pthread functions. 245 # libc contains the fully functional pthread functions.
265 case "$host_os" in 246 AS_CASE([$host_os],
266changequote(,)dnl 247 [[solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*]],
267 solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*) 248 [
268changequote([,])dnl 249 AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1],
269 AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], 250 [Define if the pthread_in_use() detection is hard.])
270 [Define if the pthread_in_use() detection is hard.]) 251 ])
271 esac 252 ])
272 fi
273 ], 253 ],
274 [dnl This is needed on FreeBSD 5.2.1. 254 [dnl This is needed on FreeBSD 5.2.1.
275 AC_CHECK_LIB([thr], [pthread_kill], 255 AC_CHECK_LIB([thr], [pthread_kill],
@@ -280,35 +260,36 @@ changequote([,])dnl
280 fi 260 fi
281 ]) 261 ])
282 ]) 262 ])
283 elif test $gl_pthread_api != yes; then 263 ], [test $gl_pthread_api != yes], [
284 # Some library is needed. Try libpthread and libc_r. 264 # Some library is needed. Try libpthread and libc_r.
285 AC_CHECK_LIB([pthread], [pthread_kill], 265 AC_CHECK_LIB([pthread], [pthread_kill],
286 [gl_pthread_api=yes 266 [gl_pthread_api=yes
287 LIBPTHREAD=-lpthread 267 LIBPTHREAD=-lpthread
288 LIBPMULTITHREAD=-lpthread]) 268 LIBPMULTITHREAD=-lpthread])
289 if test $gl_pthread_api != yes; then 269 AS_IF([test $gl_pthread_api != yes], [
290 # For FreeBSD 4. 270 # For FreeBSD 4.
291 AC_CHECK_LIB([c_r], [pthread_kill], 271 AC_CHECK_LIB([c_r], [pthread_kill],
292 [gl_pthread_api=yes 272 [gl_pthread_api=yes
293 LIBPTHREAD=-lc_r 273 LIBPTHREAD=-lc_r
294 LIBPMULTITHREAD=-lc_r]) 274 LIBPMULTITHREAD=-lc_r])
295 fi 275 ])
296 fi 276 ])
297 echo "$as_me:__oline__: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&AS_MESSAGE_LOG_FD 277 echo "$as_me:__oline__: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&AS_MESSAGE_LOG_FD
298 fi 278 ])
299 AC_MSG_CHECKING([whether POSIX threads API is available]) 279 AC_MSG_CHECKING([whether POSIX threads API is available])
300 AC_MSG_RESULT([$gl_pthread_api]) 280 AC_MSG_RESULT([$gl_pthread_api])
301 AC_SUBST([LIBPTHREAD]) 281 AC_SUBST([LIBPTHREAD])
302 AC_SUBST([LIBPMULTITHREAD]) 282 AC_SUBST([LIBPMULTITHREAD])
303 if test $gl_pthread_api = yes; then 283 AS_IF([test $gl_pthread_api = yes], [
304 AC_DEFINE([HAVE_PTHREAD_API], [1], 284 AC_DEFINE([HAVE_PTHREAD_API], [1],
305 [Define if you have the <pthread.h> header and the POSIX threads API.]) 285 [Define if you have the <pthread.h> header and the POSIX threads API.])
306 fi 286 ])
307 287
308 dnl On some systems, sched_yield is in librt, rather than in libpthread. 288 dnl On some systems, sched_yield is in librt, rather than in libpthread.
309 AC_LINK_IFELSE( 289 AC_LINK_IFELSE(
310 [AC_LANG_PROGRAM( 290 [AC_LANG_PROGRAM(
311 [[#include <sched.h>]], 291 [[#include <sched.h>
292 ]],
312 [[sched_yield ();]])], 293 [[sched_yield ();]])],
313 [SCHED_YIELD_LIB= 294 [SCHED_YIELD_LIB=
314 ], 295 ],
@@ -323,7 +304,7 @@ changequote([,])dnl
323 AC_SUBST([LIB_SCHED_YIELD]) 304 AC_SUBST([LIB_SCHED_YIELD])
324 305
325 gl_pthreadlib_body_done=done 306 gl_pthreadlib_body_done=done
326 fi 307 ])
327]) 308])
328 309
329AC_DEFUN([gl_PTHREADLIB], 310AC_DEFUN([gl_PTHREADLIB],
@@ -350,44 +331,45 @@ AC_DEFUN([gl_STDTHREADLIB_BODY],
350[ 331[
351 AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) 332 AC_REQUIRE([gl_ANYTHREADLIB_EARLY])
352 AC_REQUIRE([AC_CANONICAL_HOST]) 333 AC_REQUIRE([AC_CANONICAL_HOST])
353 if test -z "$gl_stdthreadlib_body_done"; then 334 AS_IF([test -z "$gl_stdthreadlib_body_done"], [
354 AC_CHECK_HEADERS_ONCE([threads.h]) 335 AC_CHECK_HEADERS_ONCE([threads.h])
355 336
356 case "$host_os" in 337 AS_CASE([$host_os],
357 mingw* | windows*) 338 [mingw* | windows*],
339 [
358 LIBSTDTHREAD= 340 LIBSTDTHREAD=
359 ;; 341 ],
360 *) 342 [
361 gl_PTHREADLIB_BODY 343 gl_PTHREADLIB_BODY
362 if test $ac_cv_header_threads_h = yes; then 344 AS_IF([test $ac_cv_header_threads_h = yes], [
363 dnl glibc >= 2.29 has thrd_create in libpthread. 345 dnl glibc >= 2.29 has thrd_create in libpthread.
364 dnl FreeBSD >= 10 has thrd_create in libstdthreads; this library depends 346 dnl FreeBSD >= 10 has thrd_create in libstdthreads; this library depends
365 dnl on libpthread (for the symbol 'pthread_mutexattr_gettype'). 347 dnl on libpthread (for the symbol pthread_mutexattr_gettype).
366 dnl glibc >= 2.34, AIX >= 7.1, and Solaris >= 11.4 have thrd_create in 348 dnl glibc >= 2.34, AIX >= 7.1, and Solaris >= 11.4 have thrd_create in
367 dnl libc. 349 dnl libc.
368 gl_CHECK_FUNCS_ANDROID([thrd_create], [[#include <threads.h>]]) 350 gl_CHECK_FUNCS_ANDROID([thrd_create], [[#include <threads.h>
369 if test $ac_cv_func_thrd_create = yes; then 351 ]])
352 AS_IF([test $ac_cv_func_thrd_create = yes], [
370 LIBSTDTHREAD= 353 LIBSTDTHREAD=
371 else 354 ], [
372 AC_CHECK_LIB([stdthreads], [thrd_create], [ 355 AC_CHECK_LIB([stdthreads], [thrd_create], [
373 LIBSTDTHREAD='-lstdthreads -lpthread' 356 LIBSTDTHREAD="-lstdthreads -lpthread"
374 ], [ 357 ], [
375 dnl Guess that thrd_create is in libpthread. 358 dnl Guess that thrd_create is in libpthread.
376 LIBSTDTHREAD="$LIBPMULTITHREAD" 359 LIBSTDTHREAD="$LIBPMULTITHREAD"
377 ]) 360 ])
378 fi 361 ])
379 else 362 ], [
380 dnl Libraries needed by thrd.c, mtx.c, cnd.c, tss.c. 363 dnl Libraries needed by thrd.c, mtx.c, cnd.c, tss.c.
381 LIBSTDTHREAD="$LIBPMULTITHREAD $SCHED_YIELD_LIB" 364 LIBSTDTHREAD="$LIBPMULTITHREAD $SCHED_YIELD_LIB"
382 fi 365 ])
383 ;; 366 ])
384 esac
385 AC_SUBST([LIBSTDTHREAD]) 367 AC_SUBST([LIBSTDTHREAD])
386 368
387 AC_MSG_CHECKING([whether ISO C threads API is available]) 369 AC_MSG_CHECKING([whether ISO C threads API is available])
388 AC_MSG_RESULT([$ac_cv_header_threads_h]) 370 AC_MSG_RESULT([$ac_cv_header_threads_h])
389 gl_stdthreadlib_body_done=done 371 gl_stdthreadlib_body_done=done
390 fi 372 ])
391]) 373])
392 374
393AC_DEFUN([gl_STDTHREADLIB], 375AC_DEFUN([gl_STDTHREADLIB],
@@ -404,7 +386,7 @@ dnl ------------
404dnl Tests for a multithreading library to be used. 386dnl Tests for a multithreading library to be used.
405dnl If the configure.ac contains a definition of the gl_THREADLIB_DEFAULT_NO 387dnl If the configure.ac contains a definition of the gl_THREADLIB_DEFAULT_NO
406dnl (it must be placed before the invocation of gl_THREADLIB_EARLY!), then the 388dnl (it must be placed before the invocation of gl_THREADLIB_EARLY!), then the
407dnl default is 'no', otherwise it is system dependent. In both cases, the user 389dnl default is "no", otherwise it is system dependent. In both cases, the user
408dnl can change the choice through the options --enable-threads=choice or 390dnl can change the choice through the options --enable-threads=choice or
409dnl --disable-threads. 391dnl --disable-threads.
410dnl Defines at most one of the macros USE_ISOC_THREADS, USE_POSIX_THREADS, 392dnl Defines at most one of the macros USE_ISOC_THREADS, USE_POSIX_THREADS,
@@ -449,51 +431,46 @@ AC_DEFUN([gl_THREADLIB_EARLY_BODY],
449 m4_ifdef([gl_THREADLIB_DEFAULT_NO], 431 m4_ifdef([gl_THREADLIB_DEFAULT_NO],
450 [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])], 432 [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])],
451 [m4_divert_text([DEFAULTS], [gl_use_threads_default=])]) 433 [m4_divert_text([DEFAULTS], [gl_use_threads_default=])])
452 dnl gl_use_winpthreads_default defaults to 'no', because in mingw 10, like 434 dnl gl_use_winpthreads_default defaults to "no", because in mingw 10, like
453 dnl in mingw 5, the use of libwinpthread still makes test-pthread-tss crash. 435 dnl in mingw 5, the use of libwinpthread still makes test-pthread-tss crash.
454 m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=no]) 436 m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=no])
437 dnl Don't display the --disable-threads option
438 dnl - if the package builds one or more libraries, because libraries must
439 dnl always be multithread-safe (as far as possible),
440 dnl - if the package defines gl_THREADLIB_DEFAULT_NO, because the option
441 dnl would then be a no-op.
455 AC_ARG_ENABLE([threads], 442 AC_ARG_ENABLE([threads],
456AS_HELP_STRING([[--enable-threads={isoc|posix|isoc+posix|windows}]], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [ 443AS_HELP_STRING([[--enable-threads={isoc|posix|isoc+posix|windows}]], [specify multithreading API])m4_ifdef([LT_INIT], [], [m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [
457AS_HELP_STRING([[--disable-threads]], [build without multithread safety])]), 444AS_HELP_STRING([[--disable-threads]], [build without multithread safety])])]),
458 [gl_use_threads=$enableval], 445 [gl_use_threads=$enableval],
459 [if test -n "$gl_use_threads_default"; then 446 [if test -n "$gl_use_threads_default"; then
460 gl_use_threads="$gl_use_threads_default" 447 gl_use_threads="$gl_use_threads_default"
461 else 448 else
462changequote(,)dnl 449 AS_CASE([$host_os],
463 case "$host_os" in
464 dnl Disable multithreading by default on OSF/1, because it interferes
465 dnl with fork()/exec(): When msgexec is linked with -lpthread, its
466 dnl child process gets an endless segmentation fault inside execvp().
467 osf*) gl_use_threads=no ;;
468 dnl Disable multithreading by default on Cygwin 1.5.x, because it has 450 dnl Disable multithreading by default on Cygwin 1.5.x, because it has
469 dnl bugs that lead to endless loops or crashes. See 451 dnl bugs that lead to endless loops or crashes. See
470 dnl <https://cygwin.com/ml/cygwin/2009-08/msg00283.html>. 452 dnl <https://cygwin.com/ml/cygwin/2009-08/msg00283.html>.
471 cygwin*) 453 [cygwin*],
472 case `uname -r` in 454 [AS_CASE([$(uname -r)],
473 1.[0-5].*) gl_use_threads=no ;; 455 [[1.[0-5].*]], [gl_use_threads=no],
474 *) gl_use_threads=yes ;; 456 [gl_use_threads=yes])
475 esac 457 ],
476 ;;
477 dnl Obey gl_AVOID_WINPTHREAD on mingw. 458 dnl Obey gl_AVOID_WINPTHREAD on mingw.
478 mingw* | windows*) 459 [mingw* | windows*],
479 case "$gl_use_winpthreads_default" in 460 [AS_CASE([$gl_use_winpthreads_default],
480 yes) gl_use_threads=posix ;; 461 [yes], [gl_use_threads=posix],
481 no) gl_use_threads=windows ;; 462 [no], [gl_use_threads=windows],
482 *) gl_use_threads=yes ;; 463 [gl_use_threads=yes])
483 esac 464 ],
484 ;; 465 [gl_use_threads=yes])
485 *) gl_use_threads=yes ;;
486 esac
487changequote([,])dnl
488 fi 466 fi
489 ]) 467 ])
490 if test "$gl_use_threads" = yes \ 468 AS_CASE([$gl_use_threads],
491 || test "$gl_use_threads" = isoc \ 469 [yes | isoc | posix | isoc+posix],
492 || test "$gl_use_threads" = posix \ 470 [
493 || test "$gl_use_threads" = isoc+posix; then 471 # For using <threads.h> or <pthread.h>:
494 # For using <threads.h> or <pthread.h>: 472 gl_ANYTHREADLIB_EARLY
495 gl_ANYTHREADLIB_EARLY 473 ])
496 fi
497]) 474])
498 475
499dnl The guts of gl_THREADLIB. Needs to be expanded only once. 476dnl The guts of gl_THREADLIB. Needs to be expanded only once.
@@ -506,90 +483,95 @@ AC_DEFUN([gl_THREADLIB_BODY],
506 LTLIBTHREAD= 483 LTLIBTHREAD=
507 LIBMULTITHREAD= 484 LIBMULTITHREAD=
508 LTLIBMULTITHREAD= 485 LTLIBMULTITHREAD=
509 if test "$gl_use_threads" != no; then 486 AS_IF([test "$gl_use_threads" = no],
487 [AC_DEFINE([AVOID_ANY_THREADS], [1],
488 [Define if no multithread safety and no multithreading is desired.])],
489 [
510 dnl Check whether the compiler and linker support weak declarations. 490 dnl Check whether the compiler and linker support weak declarations.
511 gl_WEAK_SYMBOLS 491 gl_WEAK_SYMBOLS
512 if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then 492 AS_CASE([$gl_cv_have_weak],
513 dnl If we use weak symbols to implement pthread_in_use / pth_in_use / 493 [*yes],
514 dnl thread_in_use, we also need to test whether the ISO C 11 thrd_create 494 [
515 dnl facility is in use. 495 dnl If we use weak symbols to implement pthread_in_use / pth_in_use /
516 AC_CHECK_HEADERS_ONCE([threads.h]) 496 dnl thread_in_use, we also need to test whether the ISO C 11 thrd_create
517 : 497 dnl facility is in use.
518 fi 498 AC_CHECK_HEADERS_ONCE([threads.h])
519 if test "$gl_use_threads" = isoc || test "$gl_use_threads" = isoc+posix; then 499 :
520 AC_CHECK_HEADERS_ONCE([threads.h]) 500 ])
521 gl_have_isoc_threads="$ac_cv_header_threads_h" 501 AS_CASE([$gl_use_threads],
522 fi 502 [isoc | isoc+posix],
523 if test "$gl_use_threads" = yes \ 503 [
524 || test "$gl_use_threads" = posix \ 504 AC_CHECK_HEADERS_ONCE([threads.h])
525 || test "$gl_use_threads" = isoc+posix; then 505 gl_have_isoc_threads="$ac_cv_header_threads_h"
526 gl_PTHREADLIB_BODY 506 ])
527 LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD 507 AS_CASE([$gl_use_threads],
528 LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD 508 [yes | posix | isoc+posix],
529 if test $gl_pthread_api = yes; then 509 [
530 if test "$gl_use_threads" = isoc+posix && test "$gl_have_isoc_threads" = yes; then 510 gl_PTHREADLIB_BODY
531 gl_threads_api='isoc+posix' 511 LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD
532 AC_DEFINE([USE_ISOC_AND_POSIX_THREADS], [1], 512 LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD
533 [Define if the combination of the ISO C and POSIX multithreading APIs can be used.]) 513 AS_IF([test $gl_pthread_api = yes], [
534 LIBTHREAD= LTLIBTHREAD= 514 AS_IF([test "$gl_use_threads" = isoc+posix &&
535 else 515 test "$gl_have_isoc_threads" = yes], [
536 gl_threads_api=posix 516 gl_threads_api="isoc+posix"
537 AC_DEFINE([USE_POSIX_THREADS], [1], 517 AC_DEFINE([USE_ISOC_AND_POSIX_THREADS], [1],
538 [Define if the POSIX multithreading library can be used.]) 518 [Define if the combination of the ISO C and POSIX multithreading APIs can be used.])
539 if test -z "$LIBMULTITHREAD" && test -z "$LTLIBMULTITHREAD"; then 519 LIBTHREAD= LTLIBTHREAD=
540 AC_DEFINE([USE_POSIX_THREADS_FROM_LIBC], [1], 520 ], [
541 [Define if references to the POSIX multithreading library are satisfied by libc.]) 521 gl_threads_api=posix
542 else 522 AC_DEFINE([USE_POSIX_THREADS], [1],
543 if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then 523 [Define if the POSIX multithreading library can be used.])
544 AC_DEFINE([USE_POSIX_THREADS_WEAK], [1], 524 AS_IF([test -z "$LIBMULTITHREAD" && test -z "$LTLIBMULTITHREAD"], [
545 [Define if references to the POSIX multithreading library should be made weak.]) 525 AC_DEFINE([USE_POSIX_THREADS_FROM_LIBC], [1],
546 LIBTHREAD= LTLIBTHREAD= 526 [Define if references to the POSIX multithreading library are satisfied by libc.])
547 else 527 ], [
548 case "$host_os" in 528 AS_CASE([$gl_cv_have_weak],
549 freebsd* | dragonfly* | midnightbsd*) 529 [*yes],
550 if test "x$LIBTHREAD" != "x$LIBMULTITHREAD"; then 530 [
551 dnl If weak symbols can't tell whether pthread_create(), pthread_key_create() 531 AC_DEFINE([USE_POSIX_THREADS_WEAK], [1],
552 dnl etc. will succeed, we need a runtime test. 532 [Define if references to the POSIX multithreading library should be made weak.])
553 AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], 533 LIBTHREAD= LTLIBTHREAD=
554 [Define if the pthread_in_use() detection is hard.]) 534 ],
555 fi 535 [AS_CASE([$host_os],
556 ;; 536 [freebsd* | dragonfly* | midnightbsd*],
557 esac 537 [
558 fi 538 AS_IF([test "x$LIBTHREAD" != "x$LIBMULTITHREAD"], [
559 fi 539 dnl If weak symbols cannot tell whether
560 fi 540 dnl pthread_create(), dnl pthread_key_create()
561 fi 541 dnl etc. will succeed, we need a runtime test.
562 fi 542 AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1],
563 if test $gl_threads_api = none; then 543 [Define if the pthread_in_use() detection is hard.])
564 if test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes; then 544 ])
545 ])
546 ])
547 ])
548 ])
549 ])
550 ])
551 AS_IF([test $gl_threads_api = none], [
552 AS_IF([test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes], [
565 gl_STDTHREADLIB_BODY 553 gl_STDTHREADLIB_BODY
566 LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD 554 LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD
567 LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD 555 LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD
568 gl_threads_api=isoc 556 gl_threads_api=isoc
569 AC_DEFINE([USE_ISOC_THREADS], [1], 557 AC_DEFINE([USE_ISOC_THREADS], [1],
570 [Define if the ISO C multithreading library can be used.]) 558 [Define if the ISO C multithreading library can be used.])
571 fi 559 ])
572 fi 560 ])
573 if test $gl_threads_api = none; then 561 AS_IF([test $gl_threads_api = none], [
574 case "$gl_use_threads" in 562 # The "win32" is for backward compatibility.
575 yes | windows | win32) # The 'win32' is for backward compatibility. 563 AS_CASE([$gl_use_threads],
576 if { case "$host_os" in 564 [yes | windows | win32],
577 mingw* | windows*) true;; 565 [AS_CASE([$host_os],
578 *) false;; 566 [mingw* | windows*],
579 esac 567 [
580 }; then 568 gl_threads_api=windows
581 gl_threads_api=windows 569 AC_DEFINE([USE_WINDOWS_THREADS], [1],
582 AC_DEFINE([USE_WINDOWS_THREADS], [1], 570 [Define if the native Windows multithreading API can be used.])
583 [Define if the native Windows multithreading API can be used.]) 571 ])
584 fi 572 ])
585 ;; 573 ])
586 esac 574 ])
587 fi
588 else
589 dnl "$gl_use_threads" is "no".
590 AC_DEFINE([AVOID_ANY_THREADS], [1],
591 [Define if no multithread safety and no multithreading is desired.])
592 fi
593 AC_MSG_CHECKING([for multithread API to use]) 575 AC_MSG_CHECKING([for multithread API to use])
594 AC_MSG_RESULT([$gl_threads_api]) 576 AC_MSG_RESULT([$gl_threads_api])
595 AC_SUBST([LIBTHREAD]) 577 AC_SUBST([LIBTHREAD])
@@ -609,7 +591,7 @@ dnl gl_DISABLE_THREADS
609dnl ------------------ 591dnl ------------------
610dnl Sets the gl_THREADLIB default so that threads are not used by default. 592dnl Sets the gl_THREADLIB default so that threads are not used by default.
611dnl The user can still override it at installation time, by using the 593dnl The user can still override it at installation time, by using the
612dnl configure option '--enable-threads'. 594dnl configure option "--enable-threads".
613 595
614AC_DEFUN([gl_DISABLE_THREADS], [ 596AC_DEFUN([gl_DISABLE_THREADS], [
615 m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no]) 597 m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no])
@@ -621,7 +603,7 @@ dnl -------------------
621dnl Sets the gl_THREADLIB default so that on mingw, a dependency to the 603dnl Sets the gl_THREADLIB default so that on mingw, a dependency to the
622dnl libwinpthread DLL (mingw-w64 winpthreads library) is avoided. 604dnl libwinpthread DLL (mingw-w64 winpthreads library) is avoided.
623dnl The user can still override it at installation time, by using the 605dnl The user can still override it at installation time, by using the
624dnl configure option '--enable-threads=posix'. 606dnl configure option "--enable-threads=posix".
625dnl As of 2023, this is now the default. 607dnl As of 2023, this is now the default.
626 608
627AC_DEFUN([gl_AVOID_WINPTHREAD], [ 609AC_DEFUN([gl_AVOID_WINPTHREAD], [
@@ -667,13 +649,8 @@ dnl
667dnl HP-UX 11 posix -lpthread N (cc) OK 649dnl HP-UX 11 posix -lpthread N (cc) OK
668dnl Y (gcc) 650dnl Y (gcc)
669dnl 651dnl
670dnl IRIX 6.5 posix -lpthread Y 0.5
671dnl
672dnl AIX 4.3,5.1 posix -lpthread N AIX 4: 0.5; AIX 5: OK 652dnl AIX 4.3,5.1 posix -lpthread N AIX 4: 0.5; AIX 5: OK
673dnl 653dnl
674dnl OSF/1 4.0,5.1 posix -pthread (cc) N OK
675dnl -lpthread (gcc) Y
676dnl
677dnl Cygwin posix -lpthread Y OK 654dnl Cygwin posix -lpthread Y OK
678dnl 655dnl
679dnl Mingw windows N OK 656dnl Mingw windows N OK
diff --git a/gl/m4/time_h.m4 b/gl/m4/time_h.m4
index d2f3c970..8d896ea5 100644
--- a/gl/m4/time_h.m4
+++ b/gl/m4/time_h.m4
@@ -1,9 +1,11 @@
1# time_h.m4 1# time_h.m4
2# serial 25 2# serial 27
3dnl Copyright (C) 2000-2001, 2003-2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2000-2001, 2003-2007, 2009-2026 Free Software Foundation,
4dnl Inc.
4dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
7 9
8# Configure a more-standard replacement for <time.h>. 10# Configure a more-standard replacement for <time.h>.
9 11
@@ -145,6 +147,7 @@ AC_DEFUN([gl_TIME_H_REQUIRE_DEFAULTS],
145 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GETRES]) 147 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GETRES])
146 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_R]) 148 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_R])
147 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_RZ]) 149 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_RZ])
150 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZNAME])
148 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZSET]) 151 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZSET])
149 dnl Support Microsoft deprecated alias function names by default. 152 dnl Support Microsoft deprecated alias function names by default.
150 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TZSET], [1]) 153 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TZSET], [1])
@@ -162,13 +165,16 @@ AC_DEFUN([gl_TIME_H_DEFAULTS],
162 HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM]) 165 HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM])
163 HAVE_TIMESPEC_GET=1; AC_SUBST([HAVE_TIMESPEC_GET]) 166 HAVE_TIMESPEC_GET=1; AC_SUBST([HAVE_TIMESPEC_GET])
164 HAVE_TIMESPEC_GETRES=1; AC_SUBST([HAVE_TIMESPEC_GETRES]) 167 HAVE_TIMESPEC_GETRES=1; AC_SUBST([HAVE_TIMESPEC_GETRES])
165 dnl Even GNU libc does not have timezone_t yet. 168 dnl Even GNU libc does not have timezone_t and tzalloc() yet.
166 HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T]) 169 HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T])
170 HAVE_TZALLOC=0; AC_SUBST([HAVE_TZALLOC])
167 REPLACE_CTIME=0; AC_SUBST([REPLACE_CTIME]) 171 REPLACE_CTIME=0; AC_SUBST([REPLACE_CTIME])
168 REPLACE_GMTIME=0; AC_SUBST([REPLACE_GMTIME]) 172 REPLACE_GMTIME=0; AC_SUBST([REPLACE_GMTIME])
169 REPLACE_LOCALTIME=0; AC_SUBST([REPLACE_LOCALTIME]) 173 REPLACE_LOCALTIME=0; AC_SUBST([REPLACE_LOCALTIME])
170 REPLACE_LOCALTIME_R=0; AC_SUBST([REPLACE_LOCALTIME_R]) 174 REPLACE_LOCALTIME_R=0; AC_SUBST([REPLACE_LOCALTIME_R])
175 REPLACE_LOCALTIME_RZ=0; AC_SUBST([REPLACE_LOCALTIME_RZ])
171 REPLACE_MKTIME=0; AC_SUBST([REPLACE_MKTIME]) 176 REPLACE_MKTIME=0; AC_SUBST([REPLACE_MKTIME])
177 REPLACE_MKTIME_Z=0; AC_SUBST([REPLACE_MKTIME_Z])
172 REPLACE_NANOSLEEP=0; AC_SUBST([REPLACE_NANOSLEEP]) 178 REPLACE_NANOSLEEP=0; AC_SUBST([REPLACE_NANOSLEEP])
173 REPLACE_STRFTIME=0; AC_SUBST([REPLACE_STRFTIME]) 179 REPLACE_STRFTIME=0; AC_SUBST([REPLACE_STRFTIME])
174 REPLACE_TIME=0; AC_SUBST([REPLACE_TIME]) 180 REPLACE_TIME=0; AC_SUBST([REPLACE_TIME])
diff --git a/gl/m4/time_r.m4 b/gl/m4/time_r.m4
index 3675390e..59477e3b 100644
--- a/gl/m4/time_r.m4
+++ b/gl/m4/time_r.m4
@@ -1,9 +1,10 @@
1# time_r.m4 1# time_r.m4
2# serial 1 2# serial 1
3dnl Copyright (C) 2003, 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2006-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Reentrant time functions: localtime_r, gmtime_r. 9dnl Reentrant time functions: localtime_r, gmtime_r.
9 10
diff --git a/gl/m4/timegm.m4 b/gl/m4/timegm.m4
index c1ff2677..50a98b25 100644
--- a/gl/m4/timegm.m4
+++ b/gl/m4/timegm.m4
@@ -1,9 +1,10 @@
1# timegm.m4 1# timegm.m4
2# serial 16 2# serial 16
3dnl Copyright (C) 2003, 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2007, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_TIMEGM], 9AC_DEFUN([gl_FUNC_TIMEGM],
9[ 10[
diff --git a/gl/m4/uchar_h.m4 b/gl/m4/uchar_h.m4
new file mode 100644
index 00000000..20b63b6c
--- /dev/null
+++ b/gl/m4/uchar_h.m4
@@ -0,0 +1,279 @@
1# uchar_h.m4
2# serial 32
3dnl Copyright (C) 2019-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl From Bruno Haible.
10dnl Prepare the overridden <uchar.h>.
11
12AC_DEFUN_ONCE([gl_UCHAR_H],
13[
14 AC_REQUIRE([gl_UCHAR_H_DEFAULTS])
15
16 gl_CHECK_NEXT_HEADERS([uchar.h])
17 if test $ac_cv_header_uchar_h = yes; then
18 HAVE_UCHAR_H=1
19 else
20 HAVE_UCHAR_H=0
21 fi
22 AC_SUBST([HAVE_UCHAR_H])
23
24 dnl On macOS 15, in C mode, <uchar.h> does not exist. But in C++ mode,
25 dnl it exists, and we need to #include_next it, otherwise we get an error
26 dnl "<cuchar> tried including <uchar.h> but didn't find libc++'s <uchar.h>
27 dnl header."
28 m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])
29 CXX_HAVE_UCHAR_H=0
30 if test "$CXX" != no; then
31 AC_CACHE_CHECK([whether the C++ compiler has <uchar.h>],
32 [gl_cv_cxx_have_uchar_h],
33 [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to
34 dnl an autoconf bug <https://savannah.gnu.org/support/?110294>.
35 cat > conftest.cpp <<\EOF
36#include <uchar.h>
37EOF
38 gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp"
39 if AC_TRY_EVAL([gl_command]); then
40 gl_cv_cxx_have_uchar_h=yes
41 else
42 gl_cv_cxx_have_uchar_h=no
43 fi
44 rm -fr conftest*
45 ])
46 if test $gl_cv_cxx_have_uchar_h = yes; then
47 CXX_HAVE_UCHAR_H=1
48 fi
49 fi
50 AC_SUBST([CXX_HAVE_UCHAR_H])
51
52 gl_TYPE_CHAR8_T
53 gl_TYPE_CHAR16_T
54 gl_TYPE_CHAR32_T
55
56 dnl In C++ mode, clang defines 'char16_t' and 'char32_t' as built-in types
57 dnl on some platforms (e.g. OpenBSD 6.7), and as types defined by many
58 dnl header files (<limits.h>, <stddef.h>, <stdint.h>, <stdio.h>, <stdlib.h>
59 dnl and others) on some platforms (e.g. Mac OS X 10.13).
60 dnl The same thing may also happen for 'char8_t'; so, be prepared for it.
61 m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])
62 CXX_HAS_UCHAR_TYPES=0
63 if test $HAVE_UCHAR_H = 0; then
64 if test "$CXX" != no; then
65 AC_CACHE_CHECK([whether the C++ compiler predefines the <uchar.h> types],
66 [gl_cv_cxx_has_uchar_types],
67 [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to
68 dnl an autoconf bug <https://savannah.gnu.org/support/?110294>.
69 cat > conftest.cpp <<\EOF
70#include <stddef.h>
71char16_t a;
72char32_t b;
73EOF
74 gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp"
75 if AC_TRY_EVAL([gl_command]); then
76 gl_cv_cxx_has_uchar_types=yes
77 else
78 gl_cv_cxx_has_uchar_types=no
79 fi
80 rm -fr conftest*
81 ])
82 if test $gl_cv_cxx_has_uchar_types = yes; then
83 CXX_HAS_UCHAR_TYPES=1
84 fi
85 fi
86 fi
87 AC_SUBST([CXX_HAS_UCHAR_TYPES])
88 CXX_HAS_CHAR8_TYPE=0
89 if test $HAVE_UCHAR_H = 0; then
90 if test "$CXX" != no; then
91 AC_CACHE_CHECK([whether the C++ compiler predefines the char8_t type],
92 [gl_cv_cxx_has_char8_type],
93 [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to
94 dnl an autoconf bug <https://savannah.gnu.org/support/?110294>.
95 cat > conftest.cpp <<\EOF
96#include <stddef.h>
97char8_t a;
98EOF
99 gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp"
100 if AC_TRY_EVAL([gl_command]); then
101 gl_cv_cxx_has_char8_type=yes
102 else
103 gl_cv_cxx_has_char8_type=no
104 fi
105 rm -fr conftest*
106 ])
107 if test $gl_cv_cxx_has_char8_type = yes; then
108 CXX_HAS_CHAR8_TYPE=1
109 fi
110 fi
111 fi
112 AC_SUBST([CXX_HAS_CHAR8_TYPE])
113
114 dnl Test whether a 'char32_t' can hold more characters than a 'wchar_t'.
115 gl_STDINT_BITSIZEOF([wchar_t], [gl_STDINT_INCLUDES])
116 if test $BITSIZEOF_WCHAR_T -lt 32; then
117 SMALL_WCHAR_T=1
118 else
119 SMALL_WCHAR_T=0
120 fi
121 dnl SMALL_WCHAR_T is expected to be 1 on 32-bit AIX, Cygwin, native Windows.
122 AC_SUBST([SMALL_WCHAR_T])
123
124 dnl Check for declarations of anything we want to poison if the
125 dnl corresponding gnulib module is not in use, and which is not
126 dnl guaranteed by C11.
127 gl_WARN_ON_USE_PREPARE([[
128 #ifdef __HAIKU__
129 #include <stdint.h>
130 #endif
131 #include <uchar.h>
132 ]], [c32rtomb mbrtoc16 mbrtoc32])
133])
134
135AC_DEFUN_ONCE([gl_TYPE_CHAR8_T],
136[
137 dnl Determine whether gnulib's <uchar.h> would, if present, override char8_t.
138 AC_CACHE_CHECK([whether char8_t is correctly defined],
139 [gl_cv_type_char8_t_works],
140 [AC_COMPILE_IFELSE(
141 [AC_LANG_PROGRAM([[
142 #ifdef __HAIKU__
143 #include <stdint.h>
144 #endif
145 #include <uchar.h>
146 int verify[(char8_t)(-1) >= 0 && sizeof (char8_t) == sizeof (unsigned char) ? 1 : -1];
147 ]])
148 ],
149 [gl_cv_type_char8_t_works=yes],
150 [gl_cv_type_char8_t_works=no])
151 ])
152 if test $gl_cv_type_char8_t_works = no; then
153 GNULIBHEADERS_OVERRIDE_CHAR8_T=1
154 else
155 GNULIBHEADERS_OVERRIDE_CHAR8_T=0
156 fi
157 AC_SUBST([GNULIBHEADERS_OVERRIDE_CHAR8_T])
158])
159
160dnl On Haiku 2020, char16_t and char32_t are incorrectly defined.
161dnl See <https://dev.haiku-os.org/ticket/15990>.
162AC_DEFUN_ONCE([gl_TYPE_CHAR16_T],
163[
164 dnl Determine whether gnulib's <uchar.h> would, if present, override char16_t.
165 AC_CACHE_CHECK([whether char16_t is correctly defined],
166 [gl_cv_type_char16_t_works],
167 [AC_COMPILE_IFELSE(
168 [AC_LANG_PROGRAM([[
169 #ifdef __HAIKU__
170 #include <stdint.h>
171 #endif
172 #include <uchar.h>
173 /* For simplicity, assume that uint16_least_t is equivalent to
174 'unsigned short'. */
175 int verify[(char16_t)(-1) >= 0 && sizeof (char16_t) == sizeof (unsigned short) ? 1 : -1];
176 ]])
177 ],
178 [gl_cv_type_char16_t_works=yes],
179 [gl_cv_type_char16_t_works=no])
180 ])
181 if test $gl_cv_type_char16_t_works = no; then
182 GNULIBHEADERS_OVERRIDE_CHAR16_T=1
183 else
184 GNULIBHEADERS_OVERRIDE_CHAR16_T=0
185 fi
186 AC_SUBST([GNULIBHEADERS_OVERRIDE_CHAR16_T])
187])
188AC_DEFUN_ONCE([gl_TYPE_CHAR32_T],
189[
190 dnl Determine whether gnulib's <uchar.h> would, if present, override char32_t.
191 AC_CACHE_CHECK([whether char32_t is correctly defined],
192 [gl_cv_type_char32_t_works],
193 [AC_COMPILE_IFELSE(
194 [AC_LANG_PROGRAM([[
195 #ifdef __HAIKU__
196 #include <stdint.h>
197 #endif
198 #include <uchar.h>
199 /* For simplicity, assume that uint32_least_t is equivalent to
200 'unsigned int'. */
201 int verify[(char32_t)(-1) >= 0 && sizeof (char32_t) == sizeof (unsigned int) ? 1 : -1];
202 ]])
203 ],
204 [gl_cv_type_char32_t_works=yes],
205 [gl_cv_type_char32_t_works=no])
206 ])
207 if test $gl_cv_type_char32_t_works = no; then
208 GNULIBHEADERS_OVERRIDE_CHAR32_T=1
209 else
210 GNULIBHEADERS_OVERRIDE_CHAR32_T=0
211 fi
212 AC_SUBST([GNULIBHEADERS_OVERRIDE_CHAR32_T])
213])
214
215# gl_UCHAR_MODULE_INDICATOR([modulename])
216# sets the shell variable that indicates the presence of the given module
217# to a C preprocessor expression that will evaluate to 1.
218# This macro invocation must not occur in macros that are AC_REQUIREd.
219AC_DEFUN([gl_UCHAR_MODULE_INDICATOR],
220[
221 dnl Ensure to expand the default settings once only.
222 gl_UCHAR_H_REQUIRE_DEFAULTS
223 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
224 dnl Define it also as a C macro, for the benefit of the unit tests.
225 gl_MODULE_INDICATOR_FOR_TESTS([$1])
226])
227
228# Initializes the default values for AC_SUBSTed shell variables.
229# This macro must not be AC_REQUIREd. It must only be invoked, and only
230# outside of macros or in macros that are not AC_REQUIREd.
231AC_DEFUN([gl_UCHAR_H_REQUIRE_DEFAULTS],
232[
233 m4_defun(GL_MODULE_INDICATOR_PREFIX[_UCHAR_H_MODULE_INDICATOR_DEFAULTS], [
234 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BTOC32])
235 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISALNUM])
236 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISALPHA])
237 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISBLANK])
238 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISCNTRL])
239 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISDIGIT])
240 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISGRAPH])
241 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISLOWER])
242 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISPRINT])
243 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISPUNCT])
244 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISSPACE])
245 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISUPPER])
246 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISXDIGIT])
247 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32TOLOWER])
248 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32TOUPPER])
249 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32WIDTH])
250 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32RTOMB])
251 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32SNRTOMBS])
252 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32SRTOMBS])
253 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32STOMBS])
254 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32SWIDTH])
255 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32TOB])
256 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_APPLY_MAPPING])
257 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_APPLY_TYPE_TEST])
258 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_GET_MAPPING])
259 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_GET_TYPE_TEST])
260 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOC16])
261 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOC32])
262 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNRTOC32S])
263 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRTOC32S])
264 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOC32S])
265 ])
266 m4_require(GL_MODULE_INDICATOR_PREFIX[_UCHAR_H_MODULE_INDICATOR_DEFAULTS])
267 AC_REQUIRE([gl_UCHAR_H_DEFAULTS])
268])
269
270AC_DEFUN([gl_UCHAR_H_DEFAULTS],
271[
272 dnl Assume proper GNU behavior unless another module says otherwise.
273 HAVE_C32RTOMB=1; AC_SUBST([HAVE_C32RTOMB])
274 HAVE_MBRTOC16=1; AC_SUBST([HAVE_MBRTOC16])
275 HAVE_MBRTOC32=1; AC_SUBST([HAVE_MBRTOC32])
276 REPLACE_C32RTOMB=0; AC_SUBST([REPLACE_C32RTOMB])
277 REPLACE_MBRTOC16=0; AC_SUBST([REPLACE_MBRTOC16])
278 REPLACE_MBRTOC32=0; AC_SUBST([REPLACE_MBRTOC32])
279])
diff --git a/gl/m4/ungetc.m4 b/gl/m4/ungetc.m4
index 42f7ec32..299c43f2 100644
--- a/gl/m4/ungetc.m4
+++ b/gl/m4/ungetc.m4
@@ -1,9 +1,10 @@
1# ungetc.m4 1# ungetc.m4
2# serial 12 2# serial 12
3dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_FUNC_UNGETC_WORKS], 9AC_DEFUN_ONCE([gl_FUNC_UNGETC_WORKS],
9[ 10[
diff --git a/gl/m4/unicase_h.m4 b/gl/m4/unicase_h.m4
new file mode 100644
index 00000000..71dccf06
--- /dev/null
+++ b/gl/m4/unicase_h.m4
@@ -0,0 +1,45 @@
1# unicase_h.m4
2# serial 1
3dnl Copyright (C) 2023-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN_ONCE([gl_UNICASE_H],
10[
11 dnl Ensure to expand the default settings once only, before all statements
12 dnl that occur in other macros.
13 AC_REQUIRE([gl_UNICASE_H_DEFAULTS])
14])
15
16# gl_UNICASE_MODULE_INDICATOR([modulename])
17# sets the shell variable that indicates the presence of the given module
18# to a C preprocessor expression that will evaluate to 1.
19# This macro invocation must not occur in macros that are AC_REQUIREd.
20AC_DEFUN([gl_UNICASE_MODULE_INDICATOR],
21[
22 dnl Ensure to expand the default settings once only.
23 gl_UNICASE_H_REQUIRE_DEFAULTS
24 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
25 dnl Define it also as a C macro, for the benefit of the unit tests.
26 gl_MODULE_INDICATOR_FOR_TESTS([$1])
27])
28
29# Initializes the default values for AC_SUBSTed shell variables.
30# This macro must not be AC_REQUIREd. It must only be invoked, and only
31# outside of macros or in macros that are not AC_REQUIREd.
32AC_DEFUN([gl_UNICASE_H_REQUIRE_DEFAULTS],
33[
34 m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNICASE_H_MODULE_INDICATOR_DEFAULTS], [
35 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICASE_EMPTY_PREFIX_CONTEXT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
36 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICASE_EMPTY_SUFFIX_CONTEXT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
37 ])
38 m4_require(GL_MODULE_INDICATOR_PREFIX[_UNICASE_H_MODULE_INDICATOR_DEFAULTS])
39 AC_REQUIRE([gl_UNICASE_H_DEFAULTS])
40])
41
42AC_DEFUN([gl_UNICASE_H_DEFAULTS],
43[
44 dnl Assume proper GNU behavior unless another module says otherwise.
45])
diff --git a/gl/m4/unictype_h.m4 b/gl/m4/unictype_h.m4
new file mode 100644
index 00000000..ba5a3688
--- /dev/null
+++ b/gl/m4/unictype_h.m4
@@ -0,0 +1,179 @@
1# unictype_h.m4
2# serial 4
3dnl Copyright (C) 2023-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN_ONCE([gl_UNICTYPE_H],
10[
11 dnl Ensure to expand the default settings once only, before all statements
12 dnl that occur in other macros.
13 AC_REQUIRE([gl_UNICTYPE_H_DEFAULTS])
14])
15
16# gl_UNICTYPE_MODULE_INDICATOR([modulename])
17# sets the shell variable that indicates the presence of the given module
18# to a C preprocessor expression that will evaluate to 1.
19# This macro invocation must not occur in macros that are AC_REQUIREd.
20AC_DEFUN([gl_UNICTYPE_MODULE_INDICATOR],
21[
22 dnl Ensure to expand the default settings once only.
23 gl_UNICTYPE_H_REQUIRE_DEFAULTS
24 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
25 dnl Define it also as a C macro, for the benefit of the unit tests.
26 gl_MODULE_INDICATOR_FOR_TESTS([$1])
27])
28
29# Initializes the default values for AC_SUBSTed shell variables.
30# This macro must not be AC_REQUIREd. It must only be invoked, and only
31# outside of macros or in macros that are not AC_REQUIREd.
32AC_DEFUN([gl_UNICTYPE_H_REQUIRE_DEFAULTS],
33[
34 m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNICTYPE_H_MODULE_INDICATOR_DEFAULTS], [
35 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_L_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
36 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
37 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LU_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
38 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
39 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
40 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LM_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
41 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
42 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_M_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
43 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_MN_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
44 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_MC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
45 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ME_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
46 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_N_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
47 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ND_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
48 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_NL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
49 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_NO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
50 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_P_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
51 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
52 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PD_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
53 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PS_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
54 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
55 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PI_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
56 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PF_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
57 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
58 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_S_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
59 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SM_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
60 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
61 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
62 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
63 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_Z_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
64 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ZS_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
65 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ZL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
66 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ZP_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
67 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_C_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
68 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
69 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CF_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
70 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CS_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
71 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
72 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CN_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
73 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_WHITE_SPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
74 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ALPHABETIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
75 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_ALPHABETIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
76 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_NOT_A_CHARACTER_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
77 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
78 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
79 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DEPRECATED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
80 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LOGICAL_ORDER_EXCEPTION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
81 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_VARIATION_SELECTOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
82 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PRIVATE_USE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
83 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_UNASSIGNED_CODE_VALUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
84 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_UPPERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
85 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_UPPERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
86 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LOWERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
87 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_LOWERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
88 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_TITLECASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
89 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
90 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CASE_IGNORABLE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
91 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_LOWERCASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
92 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_UPPERCASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
93 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_TITLECASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
94 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEFOLDED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
95 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEMAPPED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
96 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_SOFT_DOTTED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
97 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ID_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
98 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_ID_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
99 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ID_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
100 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_ID_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
101 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_XID_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
102 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_XID_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
103 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
104 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
105 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PATTERN_WHITE_SPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
106 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PATTERN_SYNTAX_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
107 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_JOIN_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
108 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_GRAPHEME_BASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
109 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_GRAPHEME_EXTEND_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
110 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_GRAPHEME_EXTEND_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
111 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_GRAPHEME_LINK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
112 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
113 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
114 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_LEFT_TO_RIGHT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
115 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
116 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
117 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EUROPEAN_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
118 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
119 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_TERMINATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
120 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
121 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_COMMON_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
122 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_BLOCK_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
123 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_SEGMENT_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
124 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_WHITESPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
125 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_NON_SPACING_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
126 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_BOUNDARY_NEUTRAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
127 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_PDF_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
128 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
129 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_OTHER_NEUTRAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
130 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_HEX_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
131 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ASCII_HEX_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
132 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDEOGRAPHIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
133 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_UNIFIED_IDEOGRAPH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
134 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_RADICAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
135 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDS_UNARY_OPERATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
136 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDS_BINARY_OPERATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
137 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDS_TRINARY_OPERATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
138 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
139 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_PRESENTATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
140 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
141 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_BASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
142 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_COMPONENT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
143 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EXTENDED_PICTOGRAPHIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
144 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ZERO_WIDTH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
145 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_SPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
146 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_NON_BREAK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
147 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ISO_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
148 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_FORMAT_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
149 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PREPENDED_CONCATENATION_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
150 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DASH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
151 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_HYPHEN_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
152 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PUNCTUATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
153 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LINE_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
154 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PARAGRAPH_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
155 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_QUOTATION_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
156 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_SENTENCE_TERMINAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
157 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_TERMINAL_PUNCTUATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
158 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CURRENCY_SYMBOL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
159 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_MATH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
160 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_MATH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
161 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PAIRED_PUNCTUATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
162 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LEFT_OF_PAIR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
163 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_COMBINING_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
164 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_COMPOSITE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
165 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DECIMAL_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
166 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_NUMERIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
167 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DIACRITIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
168 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EXTENDER_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
169 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IGNORABLE_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
170 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_REGIONAL_INDICATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
171 ])
172 m4_require(GL_MODULE_INDICATOR_PREFIX[_UNICTYPE_H_MODULE_INDICATOR_DEFAULTS])
173 AC_REQUIRE([gl_UNICTYPE_H_DEFAULTS])
174])
175
176AC_DEFUN([gl_UNICTYPE_H_DEFAULTS],
177[
178 dnl Assume proper GNU behavior unless another module says otherwise.
179])
diff --git a/gl/m4/uninorm_h.m4 b/gl/m4/uninorm_h.m4
new file mode 100644
index 00000000..5ec9ea67
--- /dev/null
+++ b/gl/m4/uninorm_h.m4
@@ -0,0 +1,47 @@
1# uninorm_h.m4
2# serial 1
3dnl Copyright (C) 2023-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN_ONCE([gl_UNINORM_H],
10[
11 dnl Ensure to expand the default settings once only, before all statements
12 dnl that occur in other macros.
13 AC_REQUIRE([gl_UNINORM_H_DEFAULTS])
14])
15
16# gl_UNINORM_MODULE_INDICATOR([modulename])
17# sets the shell variable that indicates the presence of the given module
18# to a C preprocessor expression that will evaluate to 1.
19# This macro invocation must not occur in macros that are AC_REQUIREd.
20AC_DEFUN([gl_UNINORM_MODULE_INDICATOR],
21[
22 dnl Ensure to expand the default settings once only.
23 gl_UNINORM_H_REQUIRE_DEFAULTS
24 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
25 dnl Define it also as a C macro, for the benefit of the unit tests.
26 gl_MODULE_INDICATOR_FOR_TESTS([$1])
27])
28
29# Initializes the default values for AC_SUBSTed shell variables.
30# This macro must not be AC_REQUIREd. It must only be invoked, and only
31# outside of macros or in macros that are not AC_REQUIREd.
32AC_DEFUN([gl_UNINORM_H_REQUIRE_DEFAULTS],
33[
34 m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNINORM_H_MODULE_INDICATOR_DEFAULTS], [
35 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFD_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
36 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
37 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFKD_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
38 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFKC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
39 ])
40 m4_require(GL_MODULE_INDICATOR_PREFIX[_UNINORM_H_MODULE_INDICATOR_DEFAULTS])
41 AC_REQUIRE([gl_UNINORM_H_DEFAULTS])
42])
43
44AC_DEFUN([gl_UNINORM_H_DEFAULTS],
45[
46 dnl Assume proper GNU behavior unless another module says otherwise.
47])
diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4
index 81d1b9f6..8000e888 100644
--- a/gl/m4/unistd_h.m4
+++ b/gl/m4/unistd_h.m4
@@ -1,9 +1,10 @@
1# unistd_h.m4 1# unistd_h.m4
2# serial 95 2# serial 97
3dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Written by Simon Josefsson, Bruno Haible. 9dnl Written by Simon Josefsson, Bruno Haible.
9 10
@@ -243,11 +244,13 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
243 REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME]) 244 REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME])
244 REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE]) 245 REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE])
245 REPLACE_GETENTROPY=0; AC_SUBST([REPLACE_GETENTROPY]) 246 REPLACE_GETENTROPY=0; AC_SUBST([REPLACE_GETENTROPY])
247 REPLACE_GETLOGIN=0; AC_SUBST([REPLACE_GETLOGIN])
246 REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R]) 248 REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R])
247 REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) 249 REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS])
248 REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) 250 REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE])
249 REPLACE_GETPASS=0; AC_SUBST([REPLACE_GETPASS]) 251 REPLACE_GETPASS=0; AC_SUBST([REPLACE_GETPASS])
250 REPLACE_GETPASS_FOR_GETPASS_GNU=0; AC_SUBST([REPLACE_GETPASS_FOR_GETPASS_GNU]) 252 REPLACE_GETPASS_FOR_GETPASS_GNU=0; AC_SUBST([REPLACE_GETPASS_FOR_GETPASS_GNU])
253 REPLACE_GETUSERSHELL=0; AC_SUBST([REPLACE_GETUSERSHELL])
251 REPLACE_ISATTY=0; AC_SUBST([REPLACE_ISATTY]) 254 REPLACE_ISATTY=0; AC_SUBST([REPLACE_ISATTY])
252 REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) 255 REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN])
253 REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) 256 REPLACE_LINK=0; AC_SUBST([REPLACE_LINK])
diff --git a/gl/m4/unitypes_h.m4 b/gl/m4/unitypes_h.m4
new file mode 100644
index 00000000..733b9ee2
--- /dev/null
+++ b/gl/m4/unitypes_h.m4
@@ -0,0 +1,26 @@
1# unitypes_h.m4
2# serial 1
3dnl Copyright (C) 2021-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN_ONCE([gl_UNITYPES_H],
10[
11 AH_VERBATIM([unitypes_restrict], [
12/* This definition is a duplicate of the one in unitypes.h.
13 It is here so that we can cope with an older version of unitypes.h
14 that does not contain this definition and that is pre-installed among
15 the public header files. */
16# if defined __restrict \
17 || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \
18 || __clang_major__ >= 3
19# define _UC_RESTRICT __restrict
20# elif 199901L <= __STDC_VERSION__ || defined restrict
21# define _UC_RESTRICT restrict
22# else
23# define _UC_RESTRICT
24# endif
25])
26])
diff --git a/gl/m4/unlocked-io.m4 b/gl/m4/unlocked-io.m4
index e96cf5f8..16ab6e9a 100644
--- a/gl/m4/unlocked-io.m4
+++ b/gl/m4/unlocked-io.m4
@@ -1,9 +1,10 @@
1# unlocked-io.m4 1# unlocked-io.m4
2# serial 16 2# serial 17
3dnl Copyright (C) 1998-2006, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 1998-2006, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Jim Meyering. 9dnl From Jim Meyering.
9dnl 10dnl
@@ -24,6 +25,7 @@ AC_DEFUN([gl_FUNC_GLIBC_UNLOCKED_IO],
24 AC_CHECK_DECLS_ONCE([ferror_unlocked]) 25 AC_CHECK_DECLS_ONCE([ferror_unlocked])
25 AC_CHECK_DECLS_ONCE([fflush_unlocked]) 26 AC_CHECK_DECLS_ONCE([fflush_unlocked])
26 AC_CHECK_DECLS_ONCE([fgets_unlocked]) 27 AC_CHECK_DECLS_ONCE([fgets_unlocked])
28 AC_CHECK_DECLS_ONCE([fileno_unlocked])
27 AC_CHECK_DECLS_ONCE([fputc_unlocked]) 29 AC_CHECK_DECLS_ONCE([fputc_unlocked])
28 AC_CHECK_DECLS_ONCE([fputs_unlocked]) 30 AC_CHECK_DECLS_ONCE([fputs_unlocked])
29 AC_CHECK_DECLS_ONCE([fread_unlocked]) 31 AC_CHECK_DECLS_ONCE([fread_unlocked])
diff --git a/gl/m4/vararrays.m4 b/gl/m4/vararrays.m4
index 9211f69d..3dd8e68f 100644
--- a/gl/m4/vararrays.m4
+++ b/gl/m4/vararrays.m4
@@ -1,9 +1,10 @@
1# vararrays.m4 1# vararrays.m4
2# serial 6 2# serial 6
3dnl Copyright (C) 2001, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2001, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Check for variable-length arrays. 9# Check for variable-length arrays.
9 10
diff --git a/gl/m4/vasnprintf.m4 b/gl/m4/vasnprintf.m4
index 1ea2055e..4e01fbc9 100644
--- a/gl/m4/vasnprintf.m4
+++ b/gl/m4/vasnprintf.m4
@@ -1,14 +1,47 @@
1# vasnprintf.m4 1# vasnprintf.m4
2# serial 52 2# serial 56
3dnl Copyright (C) 2002-2004, 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2004, 2006-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_VASNPRINTF], 9AC_DEFUN([gl_FUNC_VASNPRINTF],
9[ 10[
11 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
10 AC_CHECK_FUNCS_ONCE([vasnprintf]) 12 AC_CHECK_FUNCS_ONCE([vasnprintf])
11 if test $ac_cv_func_vasnprintf = no; then 13 if test $ac_cv_func_vasnprintf = yes; then
14 dnl On Cygwin, in directives with a huge width, the width is ignored, and
15 dnl the function returns a wrong result.
16 AC_CACHE_CHECK([whether vasnprintf works],
17 [gl_cv_func_vasnprintf_works],
18 [AC_RUN_IFELSE(
19 [AC_LANG_SOURCE(
20 [[#include <stdio.h>
21 ]],
22 [[size_t len;
23 char *res = vasnprintf (NULL, &len, "x%03000000000dy\n", -17);
24 /* On Cygwin 3.4.6, res is "x-17y\n" and len == 6: wrong. */
25 return (res != NULL && len < 10);
26 ]])
27 ],
28 [gl_cv_func_vasnprintf_works=yes],
29 [gl_cv_func_vasnprintf_works=no],
30 [case "$host_os" in
31 # Guess no on Cygwin.
32 cygwin*) gl_cv_func_vasnprintf_works="guessing no";;
33 # If we don't know, obey --enable-cross-guesses.
34 *) gl_cv_func_vasnprintf_works="$gl_cross_guess_normal";;
35 esac
36 ])
37 ])
38 fi
39 if test $ac_cv_func_vasnprintf != yes \
40 || case "$gl_cv_func_vasnprintf_works" in
41 *yes) false;;
42 *) true;;
43 esac
44 then
12 gl_REPLACE_VASNPRINTF 45 gl_REPLACE_VASNPRINTF
13 fi 46 fi
14]) 47])
@@ -42,7 +75,6 @@ AC_DEFUN([gl_FUNC_VASNWPRINTF],
42# Prerequisites of lib/printf-args.h, lib/printf-args.c. 75# Prerequisites of lib/printf-args.h, lib/printf-args.c.
43AC_DEFUN([gl_PREREQ_PRINTF_ARGS], 76AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
44[ 77[
45 AC_REQUIRE([gt_TYPE_WCHAR_T])
46 AC_REQUIRE([gt_TYPE_WINT_T]) 78 AC_REQUIRE([gt_TYPE_WINT_T])
47]) 79])
48 80
@@ -51,7 +83,6 @@ AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
51AC_DEFUN([gl_PREREQ_PRINTF_PARSE], 83AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
52[ 84[
53 AC_REQUIRE([gl_FEATURES_H]) 85 AC_REQUIRE([gl_FEATURES_H])
54 AC_REQUIRE([gt_TYPE_WCHAR_T])
55 AC_REQUIRE([gt_TYPE_WINT_T]) 86 AC_REQUIRE([gt_TYPE_WINT_T])
56 AC_REQUIRE([AC_TYPE_SIZE_T]) 87 AC_REQUIRE([AC_TYPE_SIZE_T])
57 AC_CHECK_TYPE([ptrdiff_t], , 88 AC_CHECK_TYPE([ptrdiff_t], ,
@@ -185,7 +216,6 @@ int main()
185AC_DEFUN_ONCE([gl_PREREQ_VASNXPRINTF], 216AC_DEFUN_ONCE([gl_PREREQ_VASNXPRINTF],
186[ 217[
187 AC_REQUIRE([AC_FUNC_ALLOCA]) 218 AC_REQUIRE([AC_FUNC_ALLOCA])
188 AC_REQUIRE([gt_TYPE_WCHAR_T])
189 AC_REQUIRE([gt_TYPE_WINT_T]) 219 AC_REQUIRE([gt_TYPE_WINT_T])
190 AC_CHECK_FUNCS([wcslen]) 220 AC_CHECK_FUNCS([wcslen])
191 dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization 221 dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization
@@ -327,15 +357,39 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LC],
327# Extra prerequisites of lib/vasnprintf.c for supporting the ' flag. 357# Extra prerequisites of lib/vasnprintf.c for supporting the ' flag.
328AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING], 358AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
329[ 359[
360 AC_REQUIRE([AC_CANONICAL_HOST])
330 AC_REQUIRE([gl_PRINTF_FLAG_GROUPING]) 361 AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
331 case "$gl_cv_func_printf_flag_grouping" in 362 AC_REQUIRE([gl_PRINTF_FLAG_GROUPING_INT_PRECISION])
332 *yes) 363 AC_REQUIRE([gl_PRINTF_FLAG_GROUPING_MULTIBYTE])
333 ;; 364 case "$host_os" in
334 *) 365 mingw* | windows*)
366 dnl MSVC does not support the ' flag at all.
367 dnl mingw does not support it, unless __USE_MINGW_ANSI_STDIO is defined.
368 dnl mingw also has other bugs regarding the ' flag.
335 AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1], 369 AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1],
336 [Define if the vasnprintf implementation needs special code for the 370 [Define if the vasnprintf implementation needs special code for the
337 ' flag.]) 371 ' flag.])
338 ;; 372 ;;
373 *)
374 case "$gl_cv_func_printf_flag_grouping,$gl_cv_func_printf_flag_grouping_multibyte" in
375 *yes,*yes)
376 case "$gl_cv_func_printf_flag_grouping_int_precision" in
377 *yes)
378 ;;
379 *)
380 AC_DEFINE([NEED_PRINTF_FLAG_GROUPING_INT], [1],
381 [Define if the vasnprintf implementation needs special code for the
382 ' flag, for integer directives only.])
383 ;;
384 esac
385 ;;
386 *)
387 AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1],
388 [Define if the vasnprintf implementation needs special code for the
389 ' flag.])
390 ;;
391 esac
392 ;;
339 esac 393 esac
340]) 394])
341 395
diff --git a/gl/m4/vasprintf.m4 b/gl/m4/vasprintf.m4
index 73f7b807..3e6913e2 100644
--- a/gl/m4/vasprintf.m4
+++ b/gl/m4/vasprintf.m4
@@ -1,10 +1,11 @@
1# vasprintf.m4 1# vasprintf.m4
2# serial 6 2# serial 6
3dnl Copyright (C) 2002-2003, 2006-2007, 2009-2024 Free Software Foundation, 3dnl Copyright (C) 2002-2003, 2006-2007, 2009-2026 Free Software Foundation,
4dnl Inc. 4dnl Inc.
5dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
6dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
7dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
8 9
9AC_DEFUN([gl_FUNC_VASPRINTF], 10AC_DEFUN([gl_FUNC_VASPRINTF],
10[ 11[
diff --git a/gl/m4/visibility.m4 b/gl/m4/visibility.m4
index ecf09686..55ceb672 100644
--- a/gl/m4/visibility.m4
+++ b/gl/m4/visibility.m4
@@ -1,9 +1,10 @@
1# visibility.m4 1# visibility.m4
2# serial 9 2# serial 9
3dnl Copyright (C) 2005, 2008, 2010-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005, 2008, 2010-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Bruno Haible. 9dnl From Bruno Haible.
9 10
diff --git a/gl/m4/vsnprintf.m4 b/gl/m4/vsnprintf.m4
index 9f321f3f..df767486 100644
--- a/gl/m4/vsnprintf.m4
+++ b/gl/m4/vsnprintf.m4
@@ -1,9 +1,10 @@
1# vsnprintf.m4 1# vsnprintf.m4
2# serial 7 2# serial 7
3dnl Copyright (C) 2002-2004, 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2004, 2007-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Libintl 0.17 will replace vsnprintf only if it does not support %1$s, 9dnl Libintl 0.17 will replace vsnprintf only if it does not support %1$s,
9dnl but defers to any gnulib vsnprintf replacements. Therefore, gnulib 10dnl but defers to any gnulib vsnprintf replacements. Therefore, gnulib
diff --git a/gl/m4/warn-on-use.m4 b/gl/m4/warn-on-use.m4
index 6c8c76b8..3765368c 100644
--- a/gl/m4/warn-on-use.m4
+++ b/gl/m4/warn-on-use.m4
@@ -1,9 +1,10 @@
1# warn-on-use.m4 1# warn-on-use.m4
2# serial 11 2# serial 11
3dnl Copyright (C) 2010-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2010-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES) 9# gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES)
9# --------------------------------------- 10# ---------------------------------------
diff --git a/gl/m4/wchar_h.m4 b/gl/m4/wchar_h.m4
index 995bdc65..42338a00 100644
--- a/gl/m4/wchar_h.m4
+++ b/gl/m4/wchar_h.m4
@@ -1,9 +1,10 @@
1# wchar_h.m4 1# wchar_h.m4
2# serial 64 2# serial 66
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues. 9dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
9 10
@@ -64,8 +65,8 @@ dnl Check whether <wchar.h> is usable at all.
64AC_DEFUN([gl_WCHAR_H_INLINE_OK], 65AC_DEFUN([gl_WCHAR_H_INLINE_OK],
65[ 66[
66 dnl Test whether <wchar.h> suffers due to the transition from '__inline' to 67 dnl Test whether <wchar.h> suffers due to the transition from '__inline' to
67 dnl 'gnu_inline'. See <https://sourceware.org/bugzilla/show_bug.cgi?id=4022> 68 dnl 'gnu_inline'. See <https://sourceware.org/PR4022>
68 dnl and <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. In summary, 69 dnl and <https://gcc.gnu.org/PR42440>. In summary,
69 dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and 70 dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and
70 dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>. 71 dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>.
71 AC_REQUIRE([AC_CANONICAL_HOST]) 72 AC_REQUIRE([AC_CANONICAL_HOST])
@@ -238,7 +239,7 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
238 HAVE_WCSTOK=1; AC_SUBST([HAVE_WCSTOK]) 239 HAVE_WCSTOK=1; AC_SUBST([HAVE_WCSTOK])
239 HAVE_WCSWIDTH=1; AC_SUBST([HAVE_WCSWIDTH]) 240 HAVE_WCSWIDTH=1; AC_SUBST([HAVE_WCSWIDTH])
240 HAVE_WCSFTIME=1; AC_SUBST([HAVE_WCSFTIME]) 241 HAVE_WCSFTIME=1; AC_SUBST([HAVE_WCSFTIME])
241 HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB]) 242 HAVE_WCTOB=1; AC_SUBST([HAVE_WCTOB])
242 HAVE_DECL_WCSDUP=1; AC_SUBST([HAVE_DECL_WCSDUP]) 243 HAVE_DECL_WCSDUP=1; AC_SUBST([HAVE_DECL_WCSDUP])
243 HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) 244 HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
244 REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T]) 245 REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T])
@@ -256,6 +257,7 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
256 REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH]) 257 REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH])
257 REPLACE_WCSFTIME=0; AC_SUBST([REPLACE_WCSFTIME]) 258 REPLACE_WCSFTIME=0; AC_SUBST([REPLACE_WCSFTIME])
258 REPLACE_WCSCMP=0; AC_SUBST([REPLACE_WCSCMP]) 259 REPLACE_WCSCMP=0; AC_SUBST([REPLACE_WCSCMP])
260 REPLACE_WCSNCAT=0; AC_SUBST([REPLACE_WCSNCAT])
259 REPLACE_WCSNCMP=0; AC_SUBST([REPLACE_WCSNCMP]) 261 REPLACE_WCSNCMP=0; AC_SUBST([REPLACE_WCSNCMP])
260 REPLACE_WCSSTR=0; AC_SUBST([REPLACE_WCSSTR]) 262 REPLACE_WCSSTR=0; AC_SUBST([REPLACE_WCSSTR])
261 REPLACE_WCSTOK=0; AC_SUBST([REPLACE_WCSTOK]) 263 REPLACE_WCSTOK=0; AC_SUBST([REPLACE_WCSTOK])
diff --git a/gl/m4/wchar_t.m4 b/gl/m4/wchar_t.m4
deleted file mode 100644
index 968832cb..00000000
--- a/gl/m4/wchar_t.m4
+++ /dev/null
@@ -1,25 +0,0 @@
1# wchar_t.m4
2# serial 4 (gettext-0.18.2)
3dnl Copyright (C) 2002-2003, 2008-2024 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl From Bruno Haible.
9dnl Test whether <stddef.h> has the 'wchar_t' type.
10dnl Prerequisite: AC_PROG_CC
11
12AC_DEFUN([gt_TYPE_WCHAR_T],
13[
14 AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t],
15 [AC_COMPILE_IFELSE(
16 [AC_LANG_PROGRAM(
17 [[#include <stddef.h>
18 wchar_t foo = (wchar_t)'\0';]],
19 [[]])],
20 [gt_cv_c_wchar_t=yes],
21 [gt_cv_c_wchar_t=no])])
22 if test $gt_cv_c_wchar_t = yes; then
23 AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.])
24 fi
25])
diff --git a/gl/m4/wcrtomb.m4 b/gl/m4/wcrtomb.m4
index 35dff6f0..a69f17c4 100644
--- a/gl/m4/wcrtomb.m4
+++ b/gl/m4/wcrtomb.m4
@@ -1,9 +1,10 @@
1# wcrtomb.m4 1# wcrtomb.m4
2# serial 19 2# serial 22
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_WCRTOMB], 9AC_DEFUN([gl_FUNC_WCRTOMB],
9[ 10[
@@ -32,11 +33,11 @@ AC_DEFUN([gl_FUNC_WCRTOMB],
32 dnl fi 33 dnl fi
33 if test $REPLACE_WCRTOMB = 0; then 34 if test $REPLACE_WCRTOMB = 0; then
34 dnl On Android 4.3, wcrtomb produces wrong characters in the C locale. 35 dnl On Android 4.3, wcrtomb produces wrong characters in the C locale.
35 dnl On AIX 4.3, OSF/1 5.1 and Solaris <= 11.3, wcrtomb (NULL, 0, NULL) 36 dnl On AIX 4.3 and Solaris <= 11.3, wcrtomb (NULL, 0, NULL)
36 dnl sometimes returns 0 instead of 1. 37 dnl sometimes returns 0 instead of 1.
37 AC_REQUIRE([AC_PROG_CC]) 38 AC_REQUIRE([AC_PROG_CC])
38 AC_REQUIRE([gt_LOCALE_FR]) 39 AC_REQUIRE([gt_LOCALE_FR])
39 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 40 AC_REQUIRE([gt_LOCALE_EN_UTF8])
40 AC_REQUIRE([gt_LOCALE_JA]) 41 AC_REQUIRE([gt_LOCALE_JA])
41 AC_REQUIRE([gt_LOCALE_ZH_CN]) 42 AC_REQUIRE([gt_LOCALE_ZH_CN])
42 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 43 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
@@ -82,15 +83,15 @@ int main ()
82 dnl is present. 83 dnl is present.
83changequote(,)dnl 84changequote(,)dnl
84 case "$host_os" in 85 case "$host_os" in
85 # Guess no on AIX 4, OSF/1, Solaris, native Windows. 86 # Guess no on AIX 4, Solaris, native Windows.
86 aix4* | osf* | solaris* | mingw* | windows*) 87 aix4* | solaris* | mingw* | windows*)
87 gl_cv_func_wcrtomb_retval="guessing no" ;; 88 gl_cv_func_wcrtomb_retval="guessing no" ;;
88 # Guess yes otherwise. 89 # Guess yes otherwise.
89 *) 90 *)
90 gl_cv_func_wcrtomb_retval="guessing yes" ;; 91 gl_cv_func_wcrtomb_retval="guessing yes" ;;
91 esac 92 esac
92changequote([,])dnl 93changequote([,])dnl
93 if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then 94 if test $LOCALE_FR != none || test "$LOCALE_EN_UTF8" != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then
94 AC_RUN_IFELSE( 95 AC_RUN_IFELSE(
95 [AC_LANG_SOURCE([[ 96 [AC_LANG_SOURCE([[
96#include <locale.h> 97#include <locale.h>
@@ -106,8 +107,8 @@ int main ()
106 if (wcrtomb (NULL, 0, NULL) != 1) 107 if (wcrtomb (NULL, 0, NULL) != 1)
107 result |= 1; 108 result |= 1;
108 } 109 }
109 if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 110 if (strcmp ("$LOCALE_EN_UTF8", "none") != 0
110 && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 111 && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
111 { 112 {
112 if (wcrtomb (NULL, 0, NULL) != 1) 113 if (wcrtomb (NULL, 0, NULL) != 1)
113 result |= 2; 114 result |= 2;
diff --git a/gl/m4/wctype.m4 b/gl/m4/wctype.m4
index e5d70740..6a6cb3a4 100644
--- a/gl/m4/wctype.m4
+++ b/gl/m4/wctype.m4
@@ -1,9 +1,10 @@
1# wctype.m4 1# wctype.m4
2# serial 6 2# serial 6
3dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2011-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_FUNC_WCTYPE], 9AC_DEFUN_ONCE([gl_FUNC_WCTYPE],
9[ 10[
diff --git a/gl/m4/wctype_h.m4 b/gl/m4/wctype_h.m4
index a3b07c2a..12b4c618 100644
--- a/gl/m4/wctype_h.m4
+++ b/gl/m4/wctype_h.m4
@@ -3,10 +3,11 @@
3 3
4dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it. 4dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
5 5
6dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. 6dnl Copyright (C) 2006-2026 Free Software Foundation, Inc.
7dnl This file is free software; the Free Software Foundation 7dnl This file is free software; the Free Software Foundation
8dnl gives unlimited permission to copy and/or distribute it, 8dnl gives unlimited permission to copy and/or distribute it,
9dnl with or without modifications, as long as this notice is preserved. 9dnl with or without modifications, as long as this notice is preserved.
10dnl This file is offered as-is, without any warranty.
10 11
11dnl Written by Paul Eggert. 12dnl Written by Paul Eggert.
12 13
diff --git a/gl/m4/wcwidth.m4 b/gl/m4/wcwidth.m4
new file mode 100644
index 00000000..515076ba
--- /dev/null
+++ b/gl/m4/wcwidth.m4
@@ -0,0 +1,116 @@
1# wcwidth.m4
2# serial 39
3dnl Copyright (C) 2006-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN([gl_FUNC_WCWIDTH],
10[
11 AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
12 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13
14 dnl Persuade glibc <wchar.h> to declare wcwidth().
15 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
16
17 AC_REQUIRE([gt_TYPE_WINT_T])
18
19 AC_CHECK_HEADERS_ONCE([wchar.h])
20 AC_CHECK_FUNCS_ONCE([wcwidth])
21
22 AC_CHECK_DECLS([wcwidth], [], [], [[
23 #include <wchar.h>
24 ]])
25 if test $ac_cv_have_decl_wcwidth != yes; then
26 HAVE_DECL_WCWIDTH=0
27 fi
28
29 if test $ac_cv_func_wcwidth != yes; then
30 AC_CACHE_CHECK([whether wcwidth is a macro],
31 [gl_cv_func_wcwidth_macro],
32 [AC_EGREP_CPP([wchar_header_defines_wcwidth], [
33#include <wchar.h>
34#ifdef wcwidth
35 wchar_header_defines_wcwidth
36#endif],
37 [gl_cv_func_wcwidth_macro=yes],
38 [gl_cv_func_wcwidth_macro=no])
39 ])
40 fi
41
42 if test $ac_cv_func_wcwidth = yes || test $gl_cv_func_wcwidth_macro = yes; then
43 HAVE_WCWIDTH=1
44 dnl On Mac OS X 10.3, wcwidth(0x0301) (COMBINING ACUTE ACCENT) returns 1.
45 dnl On macOS 12.5, NetBSD 9.3, OpenBSD 5.0, MidnightBSD 1.1,
46 dnl wcwidth(0x05B0) (HEBREW POINT SHEVA) returns 1.
47 dnl On macOS 12.5, NetBSD 9.3, MidnightBSD 1.1,
48 dnl wcwidth(0x200B) (ZERO WIDTH SPACE) returns 1.
49 dnl On OpenBSD 5.8, wcwidth(0xFF1A) (FULLWIDTH COLON) returns 0.
50 dnl This leads to bugs in 'ls' (coreutils).
51 dnl On Solaris 11.4, wcwidth(0x2202) (PARTIAL DIFFERENTIAL) returns 2,
52 dnl even in Western locales.
53 AC_CACHE_CHECK([whether wcwidth works reasonably in UTF-8 locales],
54 [gl_cv_func_wcwidth_works],
55 [
56 AC_RUN_IFELSE(
57 [AC_LANG_SOURCE([[
58#include <locale.h>
59#include <wchar.h>
60#if !HAVE_DECL_WCWIDTH
61extern
62# ifdef __cplusplus
63"C"
64# endif
65int wcwidth (int);
66#endif
67int main ()
68{
69 int result = 0;
70 if (setlocale (LC_ALL, "en_US.UTF-8") != NULL)
71 {
72 if (wcwidth (0x0301) > 0)
73 result |= 1;
74 if (wcwidth (0x05B0) > 0)
75 result |= 2;
76 if (wcwidth (0x200B) > 0)
77 result |= 4;
78 if (wcwidth (0xFF1A) == 0)
79 result |= 8;
80 if (wcwidth (0x2202) > 1)
81 result |= 16;
82 }
83 return result;
84}]])],
85 [gl_cv_func_wcwidth_works=yes],
86 [gl_cv_func_wcwidth_works=no],
87 [
88changequote(,)dnl
89 case "$host_os" in
90 # Guess yes on glibc systems.
91 *-gnu* | gnu*) gl_cv_func_wcwidth_works="guessing yes";;
92 # Guess yes on musl systems.
93 *-musl* | midipix*) gl_cv_func_wcwidth_works="guessing yes";;
94 # Guess yes on AIX 7 systems.
95 aix[7-9]*) gl_cv_func_wcwidth_works="guessing yes";;
96 *) gl_cv_func_wcwidth_works="$gl_cross_guess_normal";;
97 esac
98changequote([,])dnl
99 ])
100 ])
101 case "$gl_cv_func_wcwidth_works" in
102 *yes) ;;
103 *no) REPLACE_WCWIDTH=1 ;;
104 esac
105 else
106 HAVE_WCWIDTH=0
107 fi
108 dnl We don't substitute HAVE_WCWIDTH. We assume that if the system does not
109 dnl have the wcwidth function, then it does not declare it.
110])
111
112# Prerequisites of lib/wcwidth.c.
113AC_DEFUN([gl_PREREQ_WCWIDTH], [
114 AC_REQUIRE([AC_C_INLINE])
115 :
116])
diff --git a/gl/m4/wint_t.m4 b/gl/m4/wint_t.m4
index 883fac28..384462d2 100644
--- a/gl/m4/wint_t.m4
+++ b/gl/m4/wint_t.m4
@@ -1,9 +1,10 @@
1# wint_t.m4 1# wint_t.m4
2# serial 11 2# serial 11
3dnl Copyright (C) 2003, 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2007-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Bruno Haible. 9dnl From Bruno Haible.
9dnl Test whether <wchar.h> has the 'wint_t' type and whether gnulib's 10dnl Test whether <wchar.h> has the 'wint_t' type and whether gnulib's
diff --git a/gl/m4/xalloc.m4 b/gl/m4/xalloc.m4
index d44d0f08..a0d0f060 100644
--- a/gl/m4/xalloc.m4
+++ b/gl/m4/xalloc.m4
@@ -1,8 +1,9 @@
1# xalloc.m4 1# xalloc.m4
2# serial 18 2# serial 18
3dnl Copyright (C) 2002-2006, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2006, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_XALLOC], [:]) 9AC_DEFUN([gl_XALLOC], [:])
diff --git a/gl/m4/xsize.m4 b/gl/m4/xsize.m4
index e5784973..4e35a5fe 100644
--- a/gl/m4/xsize.m4
+++ b/gl/m4/xsize.m4
@@ -1,9 +1,10 @@
1# xsize.m4 1# xsize.m4
2# serial 5 2# serial 5
3dnl Copyright (C) 2003-2004, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003-2004, 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_XSIZE], 9AC_DEFUN([gl_XSIZE],
9[ 10[
diff --git a/gl/m4/zzgnulib.m4 b/gl/m4/zzgnulib.m4
index 710fba4e..fed091ca 100644
--- a/gl/m4/zzgnulib.m4
+++ b/gl/m4/zzgnulib.m4
@@ -1,9 +1,10 @@
1# zzgnulib.m4 1# zzgnulib.m4
2# serial 1 2# serial 1
3dnl Copyright (C) 2020-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2020-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl This file must be named something that sorts after all other 9dnl This file must be named something that sorts after all other
9dnl package- or gnulib-provided .m4 files - at least for those packages 10dnl package- or gnulib-provided .m4 files - at least for those packages
diff --git a/gl/malloc.c b/gl/malloc.c
index 2a7867a1..f7d11921 100644
--- a/gl/malloc.c
+++ b/gl/malloc.c
@@ -1,6 +1,6 @@
1/* malloc() function that is glibc compatible. 1/* malloc() function that is glibc compatible.
2 2
3 Copyright (C) 1997-1998, 2006-2007, 2009-2024 Free Software Foundation, Inc. 3 Copyright (C) 1997-1998, 2006-2007, 2009-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -17,28 +17,33 @@
17 17
18/* written by Jim Meyering and Bruno Haible */ 18/* written by Jim Meyering and Bruno Haible */
19 19
20/* Ensure that we call the system's malloc() below. */
20#define _GL_USE_STDLIB_ALLOC 1 21#define _GL_USE_STDLIB_ALLOC 1
21#include <config.h> 22#include <config.h>
22 23
23#include <stdlib.h> 24#include <stdlib.h>
24 25
25#include <errno.h> 26#include <errno.h>
26 27#include <stdckdint.h>
27#include "xalloc-oversized.h"
28 28
29/* Allocate an N-byte block of memory from the heap, even if N is 0. */ 29/* Allocate an N-byte block of memory from the heap, even if N is 0. */
30 30
31void * 31void *
32rpl_malloc (size_t n) 32rpl_malloc (size_t n)
33{ 33{
34#if !HAVE_MALLOC_0_NONNULL
34 if (n == 0) 35 if (n == 0)
35 n = 1; 36 n = 1;
37#endif
36 38
37 if (xalloc_oversized (n, 1)) 39#if !HAVE_MALLOC_PTRDIFF
40 ptrdiff_t signed_n;
41 if (ckd_add (&signed_n, n, 0))
38 { 42 {
39 errno = ENOMEM; 43 errno = ENOMEM;
40 return NULL; 44 return NULL;
41 } 45 }
46#endif
42 47
43 void *result = malloc (n); 48 void *result = malloc (n);
44 49
diff --git a/gl/malloc/dynarray-skeleton.c b/gl/malloc/dynarray-skeleton.c
index a95241ab..9d83658e 100644
--- a/gl/malloc/dynarray-skeleton.c
+++ b/gl/malloc/dynarray-skeleton.c
@@ -1,5 +1,5 @@
1/* Type-safe arrays which grow dynamically. 1/* Type-safe arrays which grow dynamically.
2 Copyright (C) 2017-2024 Free Software Foundation, Inc. 2 Copyright (C) 2017-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 4
5 The GNU C Library is free software; you can redistribute it and/or 5 The GNU C Library is free software; you can redistribute it and/or
diff --git a/gl/malloc/dynarray.h b/gl/malloc/dynarray.h
index 3163e278..e6a998d3 100644
--- a/gl/malloc/dynarray.h
+++ b/gl/malloc/dynarray.h
@@ -1,5 +1,5 @@
1/* Type-safe arrays which grow dynamically. Shared definitions. 1/* Type-safe arrays which grow dynamically. Shared definitions.
2 Copyright (C) 2017-2024 Free Software Foundation, Inc. 2 Copyright (C) 2017-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 4
5 The GNU C Library is free software; you can redistribute it and/or 5 The GNU C Library is free software; you can redistribute it and/or
diff --git a/gl/malloc/dynarray_at_failure.c b/gl/malloc/dynarray_at_failure.c
index 95e34e7a..c05807f0 100644
--- a/gl/malloc/dynarray_at_failure.c
+++ b/gl/malloc/dynarray_at_failure.c
@@ -1,5 +1,5 @@
1/* Report an dynamic array index out of bounds condition. 1/* Report an dynamic array index out of bounds condition.
2 Copyright (C) 2017-2024 Free Software Foundation, Inc. 2 Copyright (C) 2017-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 4
5 The GNU C Library is free software; you can redistribute it and/or 5 The GNU C Library is free software; you can redistribute it and/or
diff --git a/gl/malloc/dynarray_emplace_enlarge.c b/gl/malloc/dynarray_emplace_enlarge.c
index 7bdba159..d3bb0447 100644
--- a/gl/malloc/dynarray_emplace_enlarge.c
+++ b/gl/malloc/dynarray_emplace_enlarge.c
@@ -1,5 +1,5 @@
1/* Increase the size of a dynamic array in preparation of an emplace operation. 1/* Increase the size of a dynamic array in preparation of an emplace operation.
2 Copyright (C) 2017-2024 Free Software Foundation, Inc. 2 Copyright (C) 2017-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 4
5 The GNU C Library is free software; you can redistribute it and/or 5 The GNU C Library is free software; you can redistribute it and/or
diff --git a/gl/malloc/dynarray_finalize.c b/gl/malloc/dynarray_finalize.c
index 52764f73..b2e37837 100644
--- a/gl/malloc/dynarray_finalize.c
+++ b/gl/malloc/dynarray_finalize.c
@@ -1,5 +1,5 @@
1/* Copy the dynamically-allocated area to an explicitly-sized heap allocation. 1/* Copy the dynamically-allocated area to an explicitly-sized heap allocation.
2 Copyright (C) 2017-2024 Free Software Foundation, Inc. 2 Copyright (C) 2017-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 4
5 The GNU C Library is free software; you can redistribute it and/or 5 The GNU C Library is free software; you can redistribute it and/or
diff --git a/gl/malloc/dynarray_resize.c b/gl/malloc/dynarray_resize.c
index 7323f8ee..d890b253 100644
--- a/gl/malloc/dynarray_resize.c
+++ b/gl/malloc/dynarray_resize.c
@@ -1,5 +1,5 @@
1/* Increase the size of a dynamic array. 1/* Increase the size of a dynamic array.
2 Copyright (C) 2017-2024 Free Software Foundation, Inc. 2 Copyright (C) 2017-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 4
5 The GNU C Library is free software; you can redistribute it and/or 5 The GNU C Library is free software; you can redistribute it and/or
diff --git a/gl/malloc/dynarray_resize_clear.c b/gl/malloc/dynarray_resize_clear.c
index aa17f740..34d01062 100644
--- a/gl/malloc/dynarray_resize_clear.c
+++ b/gl/malloc/dynarray_resize_clear.c
@@ -1,5 +1,5 @@
1/* Increase the size of a dynamic array and clear the new part. 1/* Increase the size of a dynamic array and clear the new part.
2 Copyright (C) 2017-2024 Free Software Foundation, Inc. 2 Copyright (C) 2017-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 4
5 The GNU C Library is free software; you can redistribute it and/or 5 The GNU C Library is free software; you can redistribute it and/or
diff --git a/gl/malloca.c b/gl/malloca.c
index e75c72df..943140c8 100644
--- a/gl/malloca.c
+++ b/gl/malloca.c
@@ -1,5 +1,5 @@
1/* Safe automatic memory allocation. 1/* Safe automatic memory allocation.
2 Copyright (C) 2003, 2006-2007, 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 2003, 2006-2007, 2009-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2003, 2018. 3 Written by Bruno Haible <bruno@clisp.org>, 2003, 2018.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
@@ -93,7 +93,7 @@ mmalloca (size_t n)
93 /* Out of memory. */ 93 /* Out of memory. */
94 return NULL; 94 return NULL;
95#else 95#else
96# if !MALLOC_0_IS_NONNULL 96# if !HAVE_MALLOC_0_NONNULL
97 if (n == 0) 97 if (n == 0)
98 n = 1; 98 n = 1;
99# endif 99# endif
@@ -118,7 +118,7 @@ freea (void *p)
118 char *cp = p; 118 char *cp = p;
119 small_t *sp = p; 119 small_t *sp = p;
120# if defined __CHERI_PURE_CAPABILITY__ 120# if defined __CHERI_PURE_CAPABILITY__
121 void *mem = sp[-1]; 121 void *mem = (void *) sp[-1];
122# else 122# else
123 void *mem = cp - sp[-1]; 123 void *mem = cp - sp[-1];
124# endif 124# endif
diff --git a/gl/malloca.h b/gl/malloca.h
index c5208421..1ebe6916 100644
--- a/gl/malloca.h
+++ b/gl/malloca.h
@@ -1,5 +1,5 @@
1/* Safe automatic memory allocation. 1/* Safe automatic memory allocation.
2 Copyright (C) 2003-2007, 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 2003-2007, 2009-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2003. 3 Written by Bruno Haible <bruno@clisp.org>, 2003.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
diff --git a/gl/math.c b/gl/math.c
index 78da4d4a..8f0c9d78 100644
--- a/gl/math.c
+++ b/gl/math.c
@@ -1,6 +1,6 @@
1/* Inline functions for <math.h>. 1/* Inline functions for <math.h>.
2 2
3 Copyright (C) 2012-2024 Free Software Foundation, Inc. 3 Copyright (C) 2012-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -15,8 +15,8 @@
15 You should have received a copy of the GNU Lesser General Public License 15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 17
18#define _GL_MATH_INLINE _GL_EXTERN_INLINE
18#include <config.h> 19#include <config.h>
19 20
20#define _GL_MATH_INLINE _GL_EXTERN_INLINE
21#include <math.h> 21#include <math.h>
22typedef int dummy; 22typedef int dummy;
diff --git a/gl/math.in.h b/gl/math.in.h
index 96d0da44..14218ea0 100644
--- a/gl/math.in.h
+++ b/gl/math.in.h
@@ -1,6 +1,6 @@
1/* A GNU-like <math.h>. 1/* A GNU-like <math.h>.
2 2
3 Copyright (C) 2002-2003, 2007-2024 Free Software Foundation, Inc. 3 Copyright (C) 2002-2003, 2007-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -160,12 +160,23 @@ static void (*_gl_math_fix_itold) (long double *, int) = _Qp_itoq;
160#endif 160#endif
161 161
162 162
163/* Ensure that INFINITY is a constant expression, of type 'float'. */
164#if !defined INFINITY || (defined __FreeBSD__ && __FreeBSD__ < 8) || defined _AIX || defined __MINGW32__
165# undef INFINITY
166# if defined __GNUC__ || defined __clang__
167# define INFINITY (__builtin_inff ())
168# else
169# define INFINITY (1.0f / 0.0f)
170# endif
171#endif
172
163/* POSIX allows platforms that don't support NAN. But all major 173/* POSIX allows platforms that don't support NAN. But all major
164 machines in the past 15 years have supported something close to 174 machines in the past 15 years have supported something close to
165 IEEE NaN, so we define this unconditionally. We also must define 175 IEEE NaN, so we define this unconditionally. We also must define
166 it on platforms like Solaris 10, where NAN is present but defined 176 it on platforms like Solaris 10, where NAN is present but defined
167 as a function pointer rather than a floating point constant. */ 177 as a function pointer rather than a floating point constant.
168#if !defined NAN || @REPLACE_NAN@ 178 Also ensure that it is a constant expression, of type 'float'. */
179#if !defined NAN || @REPLACE_NAN@ || (defined __FreeBSD__ && __FreeBSD__ < 8) || defined _AIX || defined __MINGW32__
169# if !GNULIB_defined_NAN 180# if !GNULIB_defined_NAN
170# undef NAN 181# undef NAN
171 /* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler 182 /* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler
@@ -178,6 +189,8 @@ _NaN ()
178 return zero / zero; 189 return zero / zero;
179} 190}
180# define NAN (_NaN()) 191# define NAN (_NaN())
192# elif defined __GNUC__ || defined __clang__
193# define NAN (__builtin_nanf (""))
181# else 194# else
182# define NAN (0.0f / 0.0f) 195# define NAN (0.0f / 0.0f)
183# endif 196# endif
@@ -197,49 +210,49 @@ _NaN ()
197#endif 210#endif
198 211
199/* HUGE_VALF is a 'float' Infinity. */ 212/* HUGE_VALF is a 'float' Infinity. */
200#ifndef HUGE_VALF 213#if !defined HUGE_VALF || (defined __FreeBSD__ && __FreeBSD__ < 6)
214# undef HUGE_VALF
201# if defined _MSC_VER 215# if defined _MSC_VER
202/* The Microsoft MSVC 9 compiler chokes on the expression 1.0f / 0.0f. */ 216/* The Microsoft MSVC 9 compiler chokes on the expression 1.0f / 0.0f. */
203# define HUGE_VALF (1e25f * 1e25f) 217# define HUGE_VALF (1e25f * 1e25f)
218# elif defined __GNUC__ || defined __clang__
219# define HUGE_VALF (__builtin_inff ())
204# else 220# else
205# define HUGE_VALF (1.0f / 0.0f) 221# define HUGE_VALF (1.0f / 0.0f)
206# endif 222# endif
207#endif 223#endif
208 224
209/* HUGE_VAL is a 'double' Infinity. */ 225/* HUGE_VAL is a 'double' Infinity. */
210#ifndef HUGE_VAL 226#if !defined HUGE_VAL || (defined __FreeBSD__ && __FreeBSD__ < 6) || defined _AIX
227# undef HUGE_VAL
211# if defined _MSC_VER 228# if defined _MSC_VER
212/* The Microsoft MSVC 9 compiler chokes on the expression 1.0 / 0.0. */ 229/* The Microsoft MSVC 9 compiler chokes on the expression 1.0 / 0.0. */
213# define HUGE_VAL (1e250 * 1e250) 230# define HUGE_VAL (1e250 * 1e250)
231# elif defined __GNUC__ || defined __clang__
232# define HUGE_VAL (__builtin_inf ())
214# else 233# else
215# define HUGE_VAL (1.0 / 0.0) 234# define HUGE_VAL (1.0 / 0.0)
216# endif 235# endif
217#endif 236#endif
218 237
219/* HUGE_VALL is a 'long double' Infinity. */ 238/* HUGE_VALL is a 'long double' Infinity. */
220#ifndef HUGE_VALL 239#if !defined HUGE_VALL || (defined __FreeBSD__ && __FreeBSD__ < 6) || defined _AIX
240# undef HUGE_VALL
221# if defined _MSC_VER 241# if defined _MSC_VER
222/* The Microsoft MSVC 9 compiler chokes on the expression 1.0L / 0.0L. */ 242/* The Microsoft MSVC 9 compiler chokes on the expression 1.0L / 0.0L. */
223# define HUGE_VALL (1e250L * 1e250L) 243# define HUGE_VALL (1e250L * 1e250L)
244# elif defined __GNUC__ || defined __clang__
245# define HUGE_VALL (__builtin_infl ())
224# else 246# else
225# define HUGE_VALL (1.0L / 0.0L) 247# define HUGE_VALL (1.0L / 0.0L)
226# endif 248# endif
227#endif 249#endif
228 250
229 251
230#if defined FP_ILOGB0 && defined FP_ILOGBNAN 252#if !(defined FP_ILOGB0 && defined FP_ILOGBNAN)
231 /* Ensure FP_ILOGB0 and FP_ILOGBNAN are correct. */
232# if defined __HAIKU__
233 /* Haiku: match what ilogb() does */
234# undef FP_ILOGB0
235# undef FP_ILOGBNAN
236# define FP_ILOGB0 (- 2147483647 - 1) /* INT_MIN */
237# define FP_ILOGBNAN (- 2147483647 - 1) /* INT_MIN */
238# endif
239#else
240 /* Ensure FP_ILOGB0 and FP_ILOGBNAN are defined. */ 253 /* Ensure FP_ILOGB0 and FP_ILOGBNAN are defined. */
241# if defined __NetBSD__ || defined __sgi 254# if defined __NetBSD__
242 /* NetBSD, IRIX 6.5: match what ilogb() does */ 255 /* NetBSD: match what ilogb() does */
243# define FP_ILOGB0 (- 2147483647 - 1) /* INT_MIN */ 256# define FP_ILOGB0 (- 2147483647 - 1) /* INT_MIN */
244# define FP_ILOGBNAN (- 2147483647 - 1) /* INT_MIN */ 257# define FP_ILOGBNAN (- 2147483647 - 1) /* INT_MIN */
245# elif defined _AIX 258# elif defined _AIX
@@ -264,18 +277,17 @@ _NaN ()
264# undef acosf 277# undef acosf
265# define acosf rpl_acosf 278# define acosf rpl_acosf
266# endif 279# endif
267_GL_FUNCDECL_RPL (acosf, float, (float x)); 280_GL_FUNCDECL_RPL (acosf, float, (float x), );
268_GL_CXXALIAS_RPL (acosf, float, (float x)); 281_GL_CXXALIAS_RPL (acosf, float, (float x));
269# else 282# else
270# if !@HAVE_ACOSF@ 283# if !@HAVE_ACOSF@
271# undef acosf 284# undef acosf
272_GL_FUNCDECL_SYS (acosf, float, (float x)); 285_GL_FUNCDECL_SYS (acosf, float, (float x), );
273# endif 286# endif
274_GL_CXXALIAS_SYS (acosf, float, (float x)); 287_GL_CXXALIAS_SYS (acosf, float, (float x));
275# endif 288# endif
276_GL_CXXALIASWARN (acosf); 289_GL_CXXALIASWARN (acosf);
277#elif defined GNULIB_POSIXCHECK 290#elif defined GNULIB_POSIXCHECK
278# undef acosf
279# if HAVE_RAW_DECL_ACOSF 291# if HAVE_RAW_DECL_ACOSF
280_GL_WARN_ON_USE (acosf, "acosf is unportable - " 292_GL_WARN_ON_USE (acosf, "acosf is unportable - "
281 "use gnulib module acosf for portability"); 293 "use gnulib module acosf for portability");
@@ -285,14 +297,13 @@ _GL_WARN_ON_USE (acosf, "acosf is unportable - "
285#if @GNULIB_ACOSL@ 297#if @GNULIB_ACOSL@
286# if !@HAVE_ACOSL@ || !@HAVE_DECL_ACOSL@ 298# if !@HAVE_ACOSL@ || !@HAVE_DECL_ACOSL@
287# undef acosl 299# undef acosl
288_GL_FUNCDECL_SYS (acosl, long double, (long double x)); 300_GL_FUNCDECL_SYS (acosl, long double, (long double x), );
289# endif 301# endif
290_GL_CXXALIAS_SYS (acosl, long double, (long double x)); 302_GL_CXXALIAS_SYS (acosl, long double, (long double x));
291# if __GLIBC__ >= 2 303# if __GLIBC__ >= 2
292_GL_CXXALIASWARN (acosl); 304_GL_CXXALIASWARN (acosl);
293# endif 305# endif
294#elif defined GNULIB_POSIXCHECK 306#elif defined GNULIB_POSIXCHECK
295# undef acosl
296# if HAVE_RAW_DECL_ACOSL 307# if HAVE_RAW_DECL_ACOSL
297_GL_WARN_ON_USE (acosl, "acosl is unportable - " 308_GL_WARN_ON_USE (acosl, "acosl is unportable - "
298 "use gnulib module acosl for portability"); 309 "use gnulib module acosl for portability");
@@ -306,18 +317,17 @@ _GL_WARN_ON_USE (acosl, "acosl is unportable - "
306# undef asinf 317# undef asinf
307# define asinf rpl_asinf 318# define asinf rpl_asinf
308# endif 319# endif
309_GL_FUNCDECL_RPL (asinf, float, (float x)); 320_GL_FUNCDECL_RPL (asinf, float, (float x), );
310_GL_CXXALIAS_RPL (asinf, float, (float x)); 321_GL_CXXALIAS_RPL (asinf, float, (float x));
311# else 322# else
312# if !@HAVE_ASINF@ 323# if !@HAVE_ASINF@
313# undef asinf 324# undef asinf
314_GL_FUNCDECL_SYS (asinf, float, (float x)); 325_GL_FUNCDECL_SYS (asinf, float, (float x), );
315# endif 326# endif
316_GL_CXXALIAS_SYS (asinf, float, (float x)); 327_GL_CXXALIAS_SYS (asinf, float, (float x));
317# endif 328# endif
318_GL_CXXALIASWARN (asinf); 329_GL_CXXALIASWARN (asinf);
319#elif defined GNULIB_POSIXCHECK 330#elif defined GNULIB_POSIXCHECK
320# undef asinf
321# if HAVE_RAW_DECL_ASINF 331# if HAVE_RAW_DECL_ASINF
322_GL_WARN_ON_USE (asinf, "asinf is unportable - " 332_GL_WARN_ON_USE (asinf, "asinf is unportable - "
323 "use gnulib module asinf for portability"); 333 "use gnulib module asinf for portability");
@@ -327,14 +337,13 @@ _GL_WARN_ON_USE (asinf, "asinf is unportable - "
327#if @GNULIB_ASINL@ 337#if @GNULIB_ASINL@
328# if !@HAVE_ASINL@ || !@HAVE_DECL_ASINL@ 338# if !@HAVE_ASINL@ || !@HAVE_DECL_ASINL@
329# undef asinl 339# undef asinl
330_GL_FUNCDECL_SYS (asinl, long double, (long double x)); 340_GL_FUNCDECL_SYS (asinl, long double, (long double x), );
331# endif 341# endif
332_GL_CXXALIAS_SYS (asinl, long double, (long double x)); 342_GL_CXXALIAS_SYS (asinl, long double, (long double x));
333# if __GLIBC__ >= 2 343# if __GLIBC__ >= 2
334_GL_CXXALIASWARN (asinl); 344_GL_CXXALIASWARN (asinl);
335# endif 345# endif
336#elif defined GNULIB_POSIXCHECK 346#elif defined GNULIB_POSIXCHECK
337# undef asinl
338# if HAVE_RAW_DECL_ASINL 347# if HAVE_RAW_DECL_ASINL
339_GL_WARN_ON_USE (asinl, "asinl is unportable - " 348_GL_WARN_ON_USE (asinl, "asinl is unportable - "
340 "use gnulib module asinl for portability"); 349 "use gnulib module asinl for portability");
@@ -348,18 +357,17 @@ _GL_WARN_ON_USE (asinl, "asinl is unportable - "
348# undef atanf 357# undef atanf
349# define atanf rpl_atanf 358# define atanf rpl_atanf
350# endif 359# endif
351_GL_FUNCDECL_RPL (atanf, float, (float x)); 360_GL_FUNCDECL_RPL (atanf, float, (float x), );
352_GL_CXXALIAS_RPL (atanf, float, (float x)); 361_GL_CXXALIAS_RPL (atanf, float, (float x));
353# else 362# else
354# if !@HAVE_ATANF@ 363# if !@HAVE_ATANF@
355# undef atanf 364# undef atanf
356_GL_FUNCDECL_SYS (atanf, float, (float x)); 365_GL_FUNCDECL_SYS (atanf, float, (float x), );
357# endif 366# endif
358_GL_CXXALIAS_SYS (atanf, float, (float x)); 367_GL_CXXALIAS_SYS (atanf, float, (float x));
359# endif 368# endif
360_GL_CXXALIASWARN (atanf); 369_GL_CXXALIASWARN (atanf);
361#elif defined GNULIB_POSIXCHECK 370#elif defined GNULIB_POSIXCHECK
362# undef atanf
363# if HAVE_RAW_DECL_ATANF 371# if HAVE_RAW_DECL_ATANF
364_GL_WARN_ON_USE (atanf, "atanf is unportable - " 372_GL_WARN_ON_USE (atanf, "atanf is unportable - "
365 "use gnulib module atanf for portability"); 373 "use gnulib module atanf for portability");
@@ -369,14 +377,13 @@ _GL_WARN_ON_USE (atanf, "atanf is unportable - "
369#if @GNULIB_ATANL@ 377#if @GNULIB_ATANL@
370# if !@HAVE_ATANL@ || !@HAVE_DECL_ATANL@ 378# if !@HAVE_ATANL@ || !@HAVE_DECL_ATANL@
371# undef atanl 379# undef atanl
372_GL_FUNCDECL_SYS (atanl, long double, (long double x)); 380_GL_FUNCDECL_SYS (atanl, long double, (long double x), );
373# endif 381# endif
374_GL_CXXALIAS_SYS (atanl, long double, (long double x)); 382_GL_CXXALIAS_SYS (atanl, long double, (long double x));
375# if __GLIBC__ >= 2 383# if __GLIBC__ >= 2
376_GL_CXXALIASWARN (atanl); 384_GL_CXXALIASWARN (atanl);
377# endif 385# endif
378#elif defined GNULIB_POSIXCHECK 386#elif defined GNULIB_POSIXCHECK
379# undef atanl
380# if HAVE_RAW_DECL_ATANL 387# if HAVE_RAW_DECL_ATANL
381_GL_WARN_ON_USE (atanl, "atanl is unportable - " 388_GL_WARN_ON_USE (atanl, "atanl is unportable - "
382 "use gnulib module atanl for portability"); 389 "use gnulib module atanl for portability");
@@ -390,18 +397,17 @@ _GL_WARN_ON_USE (atanl, "atanl is unportable - "
390# undef atan2f 397# undef atan2f
391# define atan2f rpl_atan2f 398# define atan2f rpl_atan2f
392# endif 399# endif
393_GL_FUNCDECL_RPL (atan2f, float, (float y, float x)); 400_GL_FUNCDECL_RPL (atan2f, float, (float y, float x), );
394_GL_CXXALIAS_RPL (atan2f, float, (float y, float x)); 401_GL_CXXALIAS_RPL (atan2f, float, (float y, float x));
395# else 402# else
396# if !@HAVE_ATAN2F@ 403# if !@HAVE_ATAN2F@
397# undef atan2f 404# undef atan2f
398_GL_FUNCDECL_SYS (atan2f, float, (float y, float x)); 405_GL_FUNCDECL_SYS (atan2f, float, (float y, float x), );
399# endif 406# endif
400_GL_CXXALIAS_SYS (atan2f, float, (float y, float x)); 407_GL_CXXALIAS_SYS (atan2f, float, (float y, float x));
401# endif 408# endif
402_GL_CXXALIASWARN (atan2f); 409_GL_CXXALIASWARN (atan2f);
403#elif defined GNULIB_POSIXCHECK 410#elif defined GNULIB_POSIXCHECK
404# undef atan2f
405# if HAVE_RAW_DECL_ATAN2F 411# if HAVE_RAW_DECL_ATAN2F
406_GL_WARN_ON_USE (atan2f, "atan2f is unportable - " 412_GL_WARN_ON_USE (atan2f, "atan2f is unportable - "
407 "use gnulib module atan2f for portability"); 413 "use gnulib module atan2f for portability");
@@ -415,17 +421,16 @@ _GL_WARN_ON_USE (atan2f, "atan2f is unportable - "
415# undef cbrtf 421# undef cbrtf
416# define cbrtf rpl_cbrtf 422# define cbrtf rpl_cbrtf
417# endif 423# endif
418_GL_FUNCDECL_RPL (cbrtf, float, (float x)); 424_GL_FUNCDECL_RPL (cbrtf, float, (float x), );
419_GL_CXXALIAS_RPL (cbrtf, float, (float x)); 425_GL_CXXALIAS_RPL (cbrtf, float, (float x));
420# else 426# else
421# if !@HAVE_DECL_CBRTF@ 427# if !@HAVE_CBRTF@
422_GL_FUNCDECL_SYS (cbrtf, float, (float x)); 428_GL_FUNCDECL_SYS (cbrtf, float, (float x), );
423# endif 429# endif
424_GL_CXXALIAS_SYS (cbrtf, float, (float x)); 430_GL_CXXALIAS_SYS (cbrtf, float, (float x));
425# endif 431# endif
426_GL_CXXALIASWARN (cbrtf); 432_GL_CXXALIASWARN (cbrtf);
427#elif defined GNULIB_POSIXCHECK 433#elif defined GNULIB_POSIXCHECK
428# undef cbrtf
429# if HAVE_RAW_DECL_CBRTF 434# if HAVE_RAW_DECL_CBRTF
430_GL_WARN_ON_USE (cbrtf, "cbrtf is unportable - " 435_GL_WARN_ON_USE (cbrtf, "cbrtf is unportable - "
431 "use gnulib module cbrtf for portability"); 436 "use gnulib module cbrtf for portability");
@@ -434,14 +439,13 @@ _GL_WARN_ON_USE (cbrtf, "cbrtf is unportable - "
434 439
435#if @GNULIB_CBRT@ 440#if @GNULIB_CBRT@
436# if !@HAVE_CBRT@ 441# if !@HAVE_CBRT@
437_GL_FUNCDECL_SYS (cbrt, double, (double x)); 442_GL_FUNCDECL_SYS (cbrt, double, (double x), );
438# endif 443# endif
439_GL_CXXALIAS_SYS (cbrt, double, (double x)); 444_GL_CXXALIAS_SYS (cbrt, double, (double x));
440# if __GLIBC__ >= 2 445# if __GLIBC__ >= 2
441_GL_CXXALIASWARN1 (cbrt, double, (double x)); 446_GL_CXXALIASWARN1 (cbrt, double, (double x));
442# endif 447# endif
443#elif defined GNULIB_POSIXCHECK 448#elif defined GNULIB_POSIXCHECK
444# undef cbrt
445# if HAVE_RAW_DECL_CBRT 449# if HAVE_RAW_DECL_CBRT
446_GL_WARN_ON_USE (cbrt, "cbrt is unportable - " 450_GL_WARN_ON_USE (cbrt, "cbrt is unportable - "
447 "use gnulib module cbrt for portability"); 451 "use gnulib module cbrt for portability");
@@ -454,11 +458,11 @@ _GL_WARN_ON_USE (cbrt, "cbrt is unportable - "
454# undef cbrtl 458# undef cbrtl
455# define cbrtl rpl_cbrtl 459# define cbrtl rpl_cbrtl
456# endif 460# endif
457_GL_FUNCDECL_RPL (cbrtl, long double, (long double x)); 461_GL_FUNCDECL_RPL (cbrtl, long double, (long double x), );
458_GL_CXXALIAS_RPL (cbrtl, long double, (long double x)); 462_GL_CXXALIAS_RPL (cbrtl, long double, (long double x));
459# else 463# else
460# if !@HAVE_DECL_CBRTL@ 464# if !@HAVE_CBRTL@
461_GL_FUNCDECL_SYS (cbrtl, long double, (long double x)); 465_GL_FUNCDECL_SYS (cbrtl, long double, (long double x), );
462# endif 466# endif
463_GL_CXXALIAS_SYS (cbrtl, long double, (long double x)); 467_GL_CXXALIAS_SYS (cbrtl, long double, (long double x));
464# endif 468# endif
@@ -466,7 +470,6 @@ _GL_CXXALIAS_SYS (cbrtl, long double, (long double x));
466_GL_CXXALIASWARN (cbrtl); 470_GL_CXXALIASWARN (cbrtl);
467# endif 471# endif
468#elif defined GNULIB_POSIXCHECK 472#elif defined GNULIB_POSIXCHECK
469# undef cbrtl
470# if HAVE_RAW_DECL_CBRTL 473# if HAVE_RAW_DECL_CBRTL
471_GL_WARN_ON_USE (cbrtl, "cbrtl is unportable - " 474_GL_WARN_ON_USE (cbrtl, "cbrtl is unportable - "
472 "use gnulib module cbrtl for portability"); 475 "use gnulib module cbrtl for portability");
@@ -480,18 +483,17 @@ _GL_WARN_ON_USE (cbrtl, "cbrtl is unportable - "
480# undef ceilf 483# undef ceilf
481# define ceilf rpl_ceilf 484# define ceilf rpl_ceilf
482# endif 485# endif
483_GL_FUNCDECL_RPL (ceilf, float, (float x)); 486_GL_FUNCDECL_RPL (ceilf, float, (float x), );
484_GL_CXXALIAS_RPL (ceilf, float, (float x)); 487_GL_CXXALIAS_RPL (ceilf, float, (float x));
485# else 488# else
486# if !@HAVE_DECL_CEILF@ 489# if !@HAVE_DECL_CEILF@
487# undef ceilf 490# undef ceilf
488_GL_FUNCDECL_SYS (ceilf, float, (float x)); 491_GL_FUNCDECL_SYS (ceilf, float, (float x), );
489# endif 492# endif
490_GL_CXXALIAS_SYS (ceilf, float, (float x)); 493_GL_CXXALIAS_SYS (ceilf, float, (float x));
491# endif 494# endif
492_GL_CXXALIASWARN (ceilf); 495_GL_CXXALIASWARN (ceilf);
493#elif defined GNULIB_POSIXCHECK 496#elif defined GNULIB_POSIXCHECK
494# undef ceilf
495# if HAVE_RAW_DECL_CEILF 497# if HAVE_RAW_DECL_CEILF
496_GL_WARN_ON_USE (ceilf, "ceilf is unportable - " 498_GL_WARN_ON_USE (ceilf, "ceilf is unportable - "
497 "use gnulib module ceilf for portability"); 499 "use gnulib module ceilf for portability");
@@ -504,7 +506,7 @@ _GL_WARN_ON_USE (ceilf, "ceilf is unportable - "
504# undef ceil 506# undef ceil
505# define ceil rpl_ceil 507# define ceil rpl_ceil
506# endif 508# endif
507_GL_FUNCDECL_RPL (ceil, double, (double x)); 509_GL_FUNCDECL_RPL (ceil, double, (double x), );
508_GL_CXXALIAS_RPL (ceil, double, (double x)); 510_GL_CXXALIAS_RPL (ceil, double, (double x));
509# else 511# else
510_GL_CXXALIAS_SYS (ceil, double, (double x)); 512_GL_CXXALIAS_SYS (ceil, double, (double x));
@@ -520,12 +522,12 @@ _GL_CXXALIASWARN1 (ceil, double, (double x));
520# undef ceill 522# undef ceill
521# define ceill rpl_ceill 523# define ceill rpl_ceill
522# endif 524# endif
523_GL_FUNCDECL_RPL (ceill, long double, (long double x)); 525_GL_FUNCDECL_RPL (ceill, long double, (long double x), );
524_GL_CXXALIAS_RPL (ceill, long double, (long double x)); 526_GL_CXXALIAS_RPL (ceill, long double, (long double x));
525# else 527# else
526# if !@HAVE_DECL_CEILL@ 528# if !@HAVE_DECL_CEILL@
527# undef ceill 529# undef ceill
528_GL_FUNCDECL_SYS (ceill, long double, (long double x)); 530_GL_FUNCDECL_SYS (ceill, long double, (long double x), );
529# endif 531# endif
530_GL_CXXALIAS_SYS (ceill, long double, (long double x)); 532_GL_CXXALIAS_SYS (ceill, long double, (long double x));
531# endif 533# endif
@@ -533,7 +535,6 @@ _GL_CXXALIAS_SYS (ceill, long double, (long double x));
533_GL_CXXALIASWARN (ceill); 535_GL_CXXALIASWARN (ceill);
534# endif 536# endif
535#elif defined GNULIB_POSIXCHECK 537#elif defined GNULIB_POSIXCHECK
536# undef ceill
537# if HAVE_RAW_DECL_CEILL 538# if HAVE_RAW_DECL_CEILL
538_GL_WARN_ON_USE (ceill, "ceill is unportable - " 539_GL_WARN_ON_USE (ceill, "ceill is unportable - "
539 "use gnulib module ceill for portability"); 540 "use gnulib module ceill for portability");
@@ -542,14 +543,13 @@ _GL_WARN_ON_USE (ceill, "ceill is unportable - "
542 543
543 544
544#if @GNULIB_COPYSIGNF@ 545#if @GNULIB_COPYSIGNF@
545# if !@HAVE_DECL_COPYSIGNF@ 546# if !@HAVE_COPYSIGNF@
546# undef copysignf 547# undef copysignf
547_GL_FUNCDECL_SYS (copysignf, float, (float x, float y)); 548_GL_FUNCDECL_SYS (copysignf, float, (float x, float y), );
548# endif 549# endif
549_GL_CXXALIAS_SYS (copysignf, float, (float x, float y)); 550_GL_CXXALIAS_SYS (copysignf, float, (float x, float y));
550_GL_CXXALIASWARN (copysignf); 551_GL_CXXALIASWARN (copysignf);
551#elif defined GNULIB_POSIXCHECK 552#elif defined GNULIB_POSIXCHECK
552# undef copysignf
553# if HAVE_RAW_DECL_COPYSIGNF 553# if HAVE_RAW_DECL_COPYSIGNF
554_GL_WARN_ON_USE (copysignf, "copysignf is unportable - " 554_GL_WARN_ON_USE (copysignf, "copysignf is unportable - "
555 "use gnulib module copysignf for portability"); 555 "use gnulib module copysignf for portability");
@@ -558,14 +558,13 @@ _GL_WARN_ON_USE (copysignf, "copysignf is unportable - "
558 558
559#if @GNULIB_COPYSIGN@ 559#if @GNULIB_COPYSIGN@
560# if !@HAVE_COPYSIGN@ 560# if !@HAVE_COPYSIGN@
561_GL_FUNCDECL_SYS (copysign, double, (double x, double y)); 561_GL_FUNCDECL_SYS (copysign, double, (double x, double y), );
562# endif 562# endif
563_GL_CXXALIAS_SYS (copysign, double, (double x, double y)); 563_GL_CXXALIAS_SYS (copysign, double, (double x, double y));
564# if __GLIBC__ >= 2 564# if __GLIBC__ >= 2
565_GL_CXXALIASWARN1 (copysign, double, (double x, double y)); 565_GL_CXXALIASWARN1 (copysign, double, (double x, double y));
566# endif 566# endif
567#elif defined GNULIB_POSIXCHECK 567#elif defined GNULIB_POSIXCHECK
568# undef copysign
569# if HAVE_RAW_DECL_COPYSIGN 568# if HAVE_RAW_DECL_COPYSIGN
570_GL_WARN_ON_USE (copysign, "copysign is unportable - " 569_GL_WARN_ON_USE (copysign, "copysign is unportable - "
571 "use gnulib module copysign for portability"); 570 "use gnulib module copysign for portability");
@@ -574,14 +573,13 @@ _GL_WARN_ON_USE (copysign, "copysign is unportable - "
574 573
575#if @GNULIB_COPYSIGNL@ 574#if @GNULIB_COPYSIGNL@
576# if !@HAVE_COPYSIGNL@ 575# if !@HAVE_COPYSIGNL@
577_GL_FUNCDECL_SYS (copysignl, long double, (long double x, long double y)); 576_GL_FUNCDECL_SYS (copysignl, long double, (long double x, long double y), );
578# endif 577# endif
579_GL_CXXALIAS_SYS (copysignl, long double, (long double x, long double y)); 578_GL_CXXALIAS_SYS (copysignl, long double, (long double x, long double y));
580# if __GLIBC__ >= 2 579# if __GLIBC__ >= 2
581_GL_CXXALIASWARN (copysignl); 580_GL_CXXALIASWARN (copysignl);
582# endif 581# endif
583#elif defined GNULIB_POSIXCHECK 582#elif defined GNULIB_POSIXCHECK
584# undef copysignl
585# if HAVE_RAW_DECL_COPYSIGNL 583# if HAVE_RAW_DECL_COPYSIGNL
586_GL_WARN_ON_USE (copysign, "copysignl is unportable - " 584_GL_WARN_ON_USE (copysign, "copysignl is unportable - "
587 "use gnulib module copysignl for portability"); 585 "use gnulib module copysignl for portability");
@@ -595,18 +593,17 @@ _GL_WARN_ON_USE (copysign, "copysignl is unportable - "
595# undef cosf 593# undef cosf
596# define cosf rpl_cosf 594# define cosf rpl_cosf
597# endif 595# endif
598_GL_FUNCDECL_RPL (cosf, float, (float x)); 596_GL_FUNCDECL_RPL (cosf, float, (float x), );
599_GL_CXXALIAS_RPL (cosf, float, (float x)); 597_GL_CXXALIAS_RPL (cosf, float, (float x));
600# else 598# else
601# if !@HAVE_COSF@ 599# if !@HAVE_COSF@
602# undef cosf 600# undef cosf
603_GL_FUNCDECL_SYS (cosf, float, (float x)); 601_GL_FUNCDECL_SYS (cosf, float, (float x), );
604# endif 602# endif
605_GL_CXXALIAS_SYS (cosf, float, (float x)); 603_GL_CXXALIAS_SYS (cosf, float, (float x));
606# endif 604# endif
607_GL_CXXALIASWARN (cosf); 605_GL_CXXALIASWARN (cosf);
608#elif defined GNULIB_POSIXCHECK 606#elif defined GNULIB_POSIXCHECK
609# undef cosf
610# if HAVE_RAW_DECL_COSF 607# if HAVE_RAW_DECL_COSF
611_GL_WARN_ON_USE (cosf, "cosf is unportable - " 608_GL_WARN_ON_USE (cosf, "cosf is unportable - "
612 "use gnulib module cosf for portability"); 609 "use gnulib module cosf for portability");
@@ -616,14 +613,13 @@ _GL_WARN_ON_USE (cosf, "cosf is unportable - "
616#if @GNULIB_COSL@ 613#if @GNULIB_COSL@
617# if !@HAVE_COSL@ || !@HAVE_DECL_COSL@ 614# if !@HAVE_COSL@ || !@HAVE_DECL_COSL@
618# undef cosl 615# undef cosl
619_GL_FUNCDECL_SYS (cosl, long double, (long double x)); 616_GL_FUNCDECL_SYS (cosl, long double, (long double x), );
620# endif 617# endif
621_GL_CXXALIAS_SYS (cosl, long double, (long double x)); 618_GL_CXXALIAS_SYS (cosl, long double, (long double x));
622# if __GLIBC__ >= 2 619# if __GLIBC__ >= 2
623_GL_CXXALIASWARN (cosl); 620_GL_CXXALIASWARN (cosl);
624# endif 621# endif
625#elif defined GNULIB_POSIXCHECK 622#elif defined GNULIB_POSIXCHECK
626# undef cosl
627# if HAVE_RAW_DECL_COSL 623# if HAVE_RAW_DECL_COSL
628_GL_WARN_ON_USE (cosl, "cosl is unportable - " 624_GL_WARN_ON_USE (cosl, "cosl is unportable - "
629 "use gnulib module cosl for portability"); 625 "use gnulib module cosl for portability");
@@ -637,18 +633,17 @@ _GL_WARN_ON_USE (cosl, "cosl is unportable - "
637# undef coshf 633# undef coshf
638# define coshf rpl_coshf 634# define coshf rpl_coshf
639# endif 635# endif
640_GL_FUNCDECL_RPL (coshf, float, (float x)); 636_GL_FUNCDECL_RPL (coshf, float, (float x), );
641_GL_CXXALIAS_RPL (coshf, float, (float x)); 637_GL_CXXALIAS_RPL (coshf, float, (float x));
642# else 638# else
643# if !@HAVE_COSHF@ 639# if !@HAVE_COSHF@
644# undef coshf 640# undef coshf
645_GL_FUNCDECL_SYS (coshf, float, (float x)); 641_GL_FUNCDECL_SYS (coshf, float, (float x), );
646# endif 642# endif
647_GL_CXXALIAS_SYS (coshf, float, (float x)); 643_GL_CXXALIAS_SYS (coshf, float, (float x));
648# endif 644# endif
649_GL_CXXALIASWARN (coshf); 645_GL_CXXALIASWARN (coshf);
650#elif defined GNULIB_POSIXCHECK 646#elif defined GNULIB_POSIXCHECK
651# undef coshf
652# if HAVE_RAW_DECL_COSHF 647# if HAVE_RAW_DECL_COSHF
653_GL_WARN_ON_USE (coshf, "coshf is unportable - " 648_GL_WARN_ON_USE (coshf, "coshf is unportable - "
654 "use gnulib module coshf for portability"); 649 "use gnulib module coshf for portability");
@@ -662,18 +657,17 @@ _GL_WARN_ON_USE (coshf, "coshf is unportable - "
662# undef expf 657# undef expf
663# define expf rpl_expf 658# define expf rpl_expf
664# endif 659# endif
665_GL_FUNCDECL_RPL (expf, float, (float x)); 660_GL_FUNCDECL_RPL (expf, float, (float x), );
666_GL_CXXALIAS_RPL (expf, float, (float x)); 661_GL_CXXALIAS_RPL (expf, float, (float x));
667# else 662# else
668# if !@HAVE_EXPF@ 663# if !@HAVE_EXPF@
669# undef expf 664# undef expf
670_GL_FUNCDECL_SYS (expf, float, (float x)); 665_GL_FUNCDECL_SYS (expf, float, (float x), );
671# endif 666# endif
672_GL_CXXALIAS_SYS (expf, float, (float x)); 667_GL_CXXALIAS_SYS (expf, float, (float x));
673# endif 668# endif
674_GL_CXXALIASWARN (expf); 669_GL_CXXALIASWARN (expf);
675#elif defined GNULIB_POSIXCHECK 670#elif defined GNULIB_POSIXCHECK
676# undef expf
677# if HAVE_RAW_DECL_EXPF 671# if HAVE_RAW_DECL_EXPF
678_GL_WARN_ON_USE (expf, "expf is unportable - " 672_GL_WARN_ON_USE (expf, "expf is unportable - "
679 "use gnulib module expf for portability"); 673 "use gnulib module expf for portability");
@@ -686,12 +680,12 @@ _GL_WARN_ON_USE (expf, "expf is unportable - "
686# undef expl 680# undef expl
687# define expl rpl_expl 681# define expl rpl_expl
688# endif 682# endif
689_GL_FUNCDECL_RPL (expl, long double, (long double x)); 683_GL_FUNCDECL_RPL (expl, long double, (long double x), );
690_GL_CXXALIAS_RPL (expl, long double, (long double x)); 684_GL_CXXALIAS_RPL (expl, long double, (long double x));
691# else 685# else
692# if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@ 686# if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@
693# undef expl 687# undef expl
694_GL_FUNCDECL_SYS (expl, long double, (long double x)); 688_GL_FUNCDECL_SYS (expl, long double, (long double x), );
695# endif 689# endif
696_GL_CXXALIAS_SYS (expl, long double, (long double x)); 690_GL_CXXALIAS_SYS (expl, long double, (long double x));
697# endif 691# endif
@@ -699,7 +693,6 @@ _GL_CXXALIAS_SYS (expl, long double, (long double x));
699_GL_CXXALIASWARN (expl); 693_GL_CXXALIASWARN (expl);
700# endif 694# endif
701#elif defined GNULIB_POSIXCHECK 695#elif defined GNULIB_POSIXCHECK
702# undef expl
703# if HAVE_RAW_DECL_EXPL 696# if HAVE_RAW_DECL_EXPL
704_GL_WARN_ON_USE (expl, "expl is unportable - " 697_GL_WARN_ON_USE (expl, "expl is unportable - "
705 "use gnulib module expl for portability"); 698 "use gnulib module expl for portability");
@@ -708,13 +701,12 @@ _GL_WARN_ON_USE (expl, "expl is unportable - "
708 701
709 702
710#if @GNULIB_EXP2F@ 703#if @GNULIB_EXP2F@
711# if !@HAVE_DECL_EXP2F@ 704# if !@HAVE_EXP2F@
712_GL_FUNCDECL_SYS (exp2f, float, (float x)); 705_GL_FUNCDECL_SYS (exp2f, float, (float x), );
713# endif 706# endif
714_GL_CXXALIAS_SYS (exp2f, float, (float x)); 707_GL_CXXALIAS_SYS (exp2f, float, (float x));
715_GL_CXXALIASWARN (exp2f); 708_GL_CXXALIASWARN (exp2f);
716#elif defined GNULIB_POSIXCHECK 709#elif defined GNULIB_POSIXCHECK
717# undef exp2f
718# if HAVE_RAW_DECL_EXP2F 710# if HAVE_RAW_DECL_EXP2F
719_GL_WARN_ON_USE (exp2f, "exp2f is unportable - " 711_GL_WARN_ON_USE (exp2f, "exp2f is unportable - "
720 "use gnulib module exp2f for portability"); 712 "use gnulib module exp2f for portability");
@@ -727,11 +719,11 @@ _GL_WARN_ON_USE (exp2f, "exp2f is unportable - "
727# undef exp2 719# undef exp2
728# define exp2 rpl_exp2 720# define exp2 rpl_exp2
729# endif 721# endif
730_GL_FUNCDECL_RPL (exp2, double, (double x)); 722_GL_FUNCDECL_RPL (exp2, double, (double x), );
731_GL_CXXALIAS_RPL (exp2, double, (double x)); 723_GL_CXXALIAS_RPL (exp2, double, (double x));
732# else 724# else
733# if !@HAVE_DECL_EXP2@ 725# if !@HAVE_EXP2@
734_GL_FUNCDECL_SYS (exp2, double, (double x)); 726_GL_FUNCDECL_SYS (exp2, double, (double x), );
735# endif 727# endif
736_GL_CXXALIAS_SYS (exp2, double, (double x)); 728_GL_CXXALIAS_SYS (exp2, double, (double x));
737# endif 729# endif
@@ -739,7 +731,6 @@ _GL_CXXALIAS_SYS (exp2, double, (double x));
739_GL_CXXALIASWARN1 (exp2, double, (double x)); 731_GL_CXXALIASWARN1 (exp2, double, (double x));
740# endif 732# endif
741#elif defined GNULIB_POSIXCHECK 733#elif defined GNULIB_POSIXCHECK
742# undef exp2
743# if HAVE_RAW_DECL_EXP2 734# if HAVE_RAW_DECL_EXP2
744_GL_WARN_ON_USE (exp2, "exp2 is unportable - " 735_GL_WARN_ON_USE (exp2, "exp2 is unportable - "
745 "use gnulib module exp2 for portability"); 736 "use gnulib module exp2 for portability");
@@ -752,12 +743,12 @@ _GL_WARN_ON_USE (exp2, "exp2 is unportable - "
752# undef exp2l 743# undef exp2l
753# define exp2l rpl_exp2l 744# define exp2l rpl_exp2l
754# endif 745# endif
755_GL_FUNCDECL_RPL (exp2l, long double, (long double x)); 746_GL_FUNCDECL_RPL (exp2l, long double, (long double x), );
756_GL_CXXALIAS_RPL (exp2l, long double, (long double x)); 747_GL_CXXALIAS_RPL (exp2l, long double, (long double x));
757# else 748# else
758# if !@HAVE_DECL_EXP2L@ 749# if !@HAVE_EXP2L@
759# undef exp2l 750# undef exp2l
760_GL_FUNCDECL_SYS (exp2l, long double, (long double x)); 751_GL_FUNCDECL_SYS (exp2l, long double, (long double x), );
761# endif 752# endif
762_GL_CXXALIAS_SYS (exp2l, long double, (long double x)); 753_GL_CXXALIAS_SYS (exp2l, long double, (long double x));
763# endif 754# endif
@@ -765,7 +756,6 @@ _GL_CXXALIAS_SYS (exp2l, long double, (long double x));
765_GL_CXXALIASWARN (exp2l); 756_GL_CXXALIASWARN (exp2l);
766# endif 757# endif
767#elif defined GNULIB_POSIXCHECK 758#elif defined GNULIB_POSIXCHECK
768# undef exp2l
769# if HAVE_RAW_DECL_EXP2L 759# if HAVE_RAW_DECL_EXP2L
770_GL_WARN_ON_USE (exp2l, "exp2l is unportable - " 760_GL_WARN_ON_USE (exp2l, "exp2l is unportable - "
771 "use gnulib module exp2l for portability"); 761 "use gnulib module exp2l for portability");
@@ -779,17 +769,16 @@ _GL_WARN_ON_USE (exp2l, "exp2l is unportable - "
779# undef expm1f 769# undef expm1f
780# define expm1f rpl_expm1f 770# define expm1f rpl_expm1f
781# endif 771# endif
782_GL_FUNCDECL_RPL (expm1f, float, (float x)); 772_GL_FUNCDECL_RPL (expm1f, float, (float x), );
783_GL_CXXALIAS_RPL (expm1f, float, (float x)); 773_GL_CXXALIAS_RPL (expm1f, float, (float x));
784# else 774# else
785# if !@HAVE_EXPM1F@ 775# if !@HAVE_EXPM1F@
786_GL_FUNCDECL_SYS (expm1f, float, (float x)); 776_GL_FUNCDECL_SYS (expm1f, float, (float x), );
787# endif 777# endif
788_GL_CXXALIAS_SYS (expm1f, float, (float x)); 778_GL_CXXALIAS_SYS (expm1f, float, (float x));
789# endif 779# endif
790_GL_CXXALIASWARN (expm1f); 780_GL_CXXALIASWARN (expm1f);
791#elif defined GNULIB_POSIXCHECK 781#elif defined GNULIB_POSIXCHECK
792# undef expm1f
793# if HAVE_RAW_DECL_EXPM1F 782# if HAVE_RAW_DECL_EXPM1F
794_GL_WARN_ON_USE (expm1f, "expm1f is unportable - " 783_GL_WARN_ON_USE (expm1f, "expm1f is unportable - "
795 "use gnulib module expm1f for portability"); 784 "use gnulib module expm1f for portability");
@@ -802,11 +791,11 @@ _GL_WARN_ON_USE (expm1f, "expm1f is unportable - "
802# undef expm1 791# undef expm1
803# define expm1 rpl_expm1 792# define expm1 rpl_expm1
804# endif 793# endif
805_GL_FUNCDECL_RPL (expm1, double, (double x)); 794_GL_FUNCDECL_RPL (expm1, double, (double x), );
806_GL_CXXALIAS_RPL (expm1, double, (double x)); 795_GL_CXXALIAS_RPL (expm1, double, (double x));
807# else 796# else
808# if !@HAVE_EXPM1@ 797# if !@HAVE_EXPM1@
809_GL_FUNCDECL_SYS (expm1, double, (double x)); 798_GL_FUNCDECL_SYS (expm1, double, (double x), );
810# endif 799# endif
811_GL_CXXALIAS_SYS (expm1, double, (double x)); 800_GL_CXXALIAS_SYS (expm1, double, (double x));
812# endif 801# endif
@@ -814,7 +803,6 @@ _GL_CXXALIAS_SYS (expm1, double, (double x));
814_GL_CXXALIASWARN1 (expm1, double, (double x)); 803_GL_CXXALIASWARN1 (expm1, double, (double x));
815# endif 804# endif
816#elif defined GNULIB_POSIXCHECK 805#elif defined GNULIB_POSIXCHECK
817# undef expm1
818# if HAVE_RAW_DECL_EXPM1 806# if HAVE_RAW_DECL_EXPM1
819_GL_WARN_ON_USE (expm1, "expm1 is unportable - " 807_GL_WARN_ON_USE (expm1, "expm1 is unportable - "
820 "use gnulib module expm1 for portability"); 808 "use gnulib module expm1 for portability");
@@ -827,13 +815,13 @@ _GL_WARN_ON_USE (expm1, "expm1 is unportable - "
827# undef expm1l 815# undef expm1l
828# define expm1l rpl_expm1l 816# define expm1l rpl_expm1l
829# endif 817# endif
830_GL_FUNCDECL_RPL (expm1l, long double, (long double x)); 818_GL_FUNCDECL_RPL (expm1l, long double, (long double x), );
831_GL_CXXALIAS_RPL (expm1l, long double, (long double x)); 819_GL_CXXALIAS_RPL (expm1l, long double, (long double x));
832# else 820# else
833# if !@HAVE_DECL_EXPM1L@ 821# if !@HAVE_EXPM1L@
834# undef expm1l 822# undef expm1l
835# if !(defined __cplusplus && defined _AIX) 823# if !(defined __cplusplus && defined _AIX)
836_GL_FUNCDECL_SYS (expm1l, long double, (long double x)); 824_GL_FUNCDECL_SYS (expm1l, long double, (long double x), );
837# endif 825# endif
838# endif 826# endif
839_GL_CXXALIAS_SYS (expm1l, long double, (long double x)); 827_GL_CXXALIAS_SYS (expm1l, long double, (long double x));
@@ -842,7 +830,6 @@ _GL_CXXALIAS_SYS (expm1l, long double, (long double x));
842_GL_CXXALIASWARN (expm1l); 830_GL_CXXALIASWARN (expm1l);
843# endif 831# endif
844#elif defined GNULIB_POSIXCHECK 832#elif defined GNULIB_POSIXCHECK
845# undef expm1l
846# if HAVE_RAW_DECL_EXPM1L 833# if HAVE_RAW_DECL_EXPM1L
847_GL_WARN_ON_USE (expm1l, "expm1l is unportable - " 834_GL_WARN_ON_USE (expm1l, "expm1l is unportable - "
848 "use gnulib module expm1l for portability"); 835 "use gnulib module expm1l for portability");
@@ -853,14 +840,13 @@ _GL_WARN_ON_USE (expm1l, "expm1l is unportable - "
853#if @GNULIB_FABSF@ 840#if @GNULIB_FABSF@
854# if !@HAVE_FABSF@ 841# if !@HAVE_FABSF@
855# undef fabsf 842# undef fabsf
856_GL_FUNCDECL_SYS (fabsf, float, (float x)); 843_GL_FUNCDECL_SYS (fabsf, float, (float x), );
857# endif 844# endif
858_GL_CXXALIAS_SYS (fabsf, float, (float x)); 845_GL_CXXALIAS_SYS (fabsf, float, (float x));
859# if __GLIBC__ >= 2 846# if __GLIBC__ >= 2
860_GL_CXXALIASWARN (fabsf); 847_GL_CXXALIASWARN (fabsf);
861# endif 848# endif
862#elif defined GNULIB_POSIXCHECK 849#elif defined GNULIB_POSIXCHECK
863# undef fabsf
864# if HAVE_RAW_DECL_FABSF 850# if HAVE_RAW_DECL_FABSF
865_GL_WARN_ON_USE (fabsf, "fabsf is unportable - " 851_GL_WARN_ON_USE (fabsf, "fabsf is unportable - "
866 "use gnulib module fabsf for portability"); 852 "use gnulib module fabsf for portability");
@@ -873,12 +859,12 @@ _GL_WARN_ON_USE (fabsf, "fabsf is unportable - "
873# undef fabsl 859# undef fabsl
874# define fabsl rpl_fabsl 860# define fabsl rpl_fabsl
875# endif 861# endif
876_GL_FUNCDECL_RPL (fabsl, long double, (long double x)); 862_GL_FUNCDECL_RPL (fabsl, long double, (long double x), );
877_GL_CXXALIAS_RPL (fabsl, long double, (long double x)); 863_GL_CXXALIAS_RPL (fabsl, long double, (long double x));
878# else 864# else
879# if !@HAVE_FABSL@ 865# if !@HAVE_FABSL@
880# undef fabsl 866# undef fabsl
881_GL_FUNCDECL_SYS (fabsl, long double, (long double x)); 867_GL_FUNCDECL_SYS (fabsl, long double, (long double x), );
882# endif 868# endif
883_GL_CXXALIAS_SYS (fabsl, long double, (long double x)); 869_GL_CXXALIAS_SYS (fabsl, long double, (long double x));
884# endif 870# endif
@@ -886,7 +872,6 @@ _GL_CXXALIAS_SYS (fabsl, long double, (long double x));
886_GL_CXXALIASWARN (fabsl); 872_GL_CXXALIASWARN (fabsl);
887# endif 873# endif
888#elif defined GNULIB_POSIXCHECK 874#elif defined GNULIB_POSIXCHECK
889# undef fabsl
890# if HAVE_RAW_DECL_FABSL 875# if HAVE_RAW_DECL_FABSL
891_GL_WARN_ON_USE (fabsl, "fabsl is unportable - " 876_GL_WARN_ON_USE (fabsl, "fabsl is unportable - "
892 "use gnulib module fabsl for portability"); 877 "use gnulib module fabsl for portability");
@@ -900,18 +885,17 @@ _GL_WARN_ON_USE (fabsl, "fabsl is unportable - "
900# undef floorf 885# undef floorf
901# define floorf rpl_floorf 886# define floorf rpl_floorf
902# endif 887# endif
903_GL_FUNCDECL_RPL (floorf, float, (float x)); 888_GL_FUNCDECL_RPL (floorf, float, (float x), );
904_GL_CXXALIAS_RPL (floorf, float, (float x)); 889_GL_CXXALIAS_RPL (floorf, float, (float x));
905# else 890# else
906# if !@HAVE_DECL_FLOORF@ 891# if !@HAVE_DECL_FLOORF@
907# undef floorf 892# undef floorf
908_GL_FUNCDECL_SYS (floorf, float, (float x)); 893_GL_FUNCDECL_SYS (floorf, float, (float x), );
909# endif 894# endif
910_GL_CXXALIAS_SYS (floorf, float, (float x)); 895_GL_CXXALIAS_SYS (floorf, float, (float x));
911# endif 896# endif
912_GL_CXXALIASWARN (floorf); 897_GL_CXXALIASWARN (floorf);
913#elif defined GNULIB_POSIXCHECK 898#elif defined GNULIB_POSIXCHECK
914# undef floorf
915# if HAVE_RAW_DECL_FLOORF 899# if HAVE_RAW_DECL_FLOORF
916_GL_WARN_ON_USE (floorf, "floorf is unportable - " 900_GL_WARN_ON_USE (floorf, "floorf is unportable - "
917 "use gnulib module floorf for portability"); 901 "use gnulib module floorf for portability");
@@ -924,7 +908,7 @@ _GL_WARN_ON_USE (floorf, "floorf is unportable - "
924# undef floor 908# undef floor
925# define floor rpl_floor 909# define floor rpl_floor
926# endif 910# endif
927_GL_FUNCDECL_RPL (floor, double, (double x)); 911_GL_FUNCDECL_RPL (floor, double, (double x), );
928_GL_CXXALIAS_RPL (floor, double, (double x)); 912_GL_CXXALIAS_RPL (floor, double, (double x));
929# else 913# else
930_GL_CXXALIAS_SYS (floor, double, (double x)); 914_GL_CXXALIAS_SYS (floor, double, (double x));
@@ -940,12 +924,12 @@ _GL_CXXALIASWARN1 (floor, double, (double x));
940# undef floorl 924# undef floorl
941# define floorl rpl_floorl 925# define floorl rpl_floorl
942# endif 926# endif
943_GL_FUNCDECL_RPL (floorl, long double, (long double x)); 927_GL_FUNCDECL_RPL (floorl, long double, (long double x), );
944_GL_CXXALIAS_RPL (floorl, long double, (long double x)); 928_GL_CXXALIAS_RPL (floorl, long double, (long double x));
945# else 929# else
946# if !@HAVE_DECL_FLOORL@ 930# if !@HAVE_DECL_FLOORL@
947# undef floorl 931# undef floorl
948_GL_FUNCDECL_SYS (floorl, long double, (long double x)); 932_GL_FUNCDECL_SYS (floorl, long double, (long double x), );
949# endif 933# endif
950_GL_CXXALIAS_SYS (floorl, long double, (long double x)); 934_GL_CXXALIAS_SYS (floorl, long double, (long double x));
951# endif 935# endif
@@ -953,7 +937,6 @@ _GL_CXXALIAS_SYS (floorl, long double, (long double x));
953_GL_CXXALIASWARN (floorl); 937_GL_CXXALIASWARN (floorl);
954# endif 938# endif
955#elif defined GNULIB_POSIXCHECK 939#elif defined GNULIB_POSIXCHECK
956# undef floorl
957# if HAVE_RAW_DECL_FLOORL 940# if HAVE_RAW_DECL_FLOORL
958_GL_WARN_ON_USE (floorl, "floorl is unportable - " 941_GL_WARN_ON_USE (floorl, "floorl is unportable - "
959 "use gnulib module floorl for portability"); 942 "use gnulib module floorl for portability");
@@ -967,18 +950,17 @@ _GL_WARN_ON_USE (floorl, "floorl is unportable - "
967# undef fmaf 950# undef fmaf
968# define fmaf rpl_fmaf 951# define fmaf rpl_fmaf
969# endif 952# endif
970_GL_FUNCDECL_RPL (fmaf, float, (float x, float y, float z)); 953_GL_FUNCDECL_RPL (fmaf, float, (float x, float y, float z), );
971_GL_CXXALIAS_RPL (fmaf, float, (float x, float y, float z)); 954_GL_CXXALIAS_RPL (fmaf, float, (float x, float y, float z));
972# else 955# else
973# if !@HAVE_FMAF@ 956# if !@HAVE_FMAF@
974# undef fmaf 957# undef fmaf
975_GL_FUNCDECL_SYS (fmaf, float, (float x, float y, float z)); 958_GL_FUNCDECL_SYS (fmaf, float, (float x, float y, float z), );
976# endif 959# endif
977_GL_CXXALIAS_SYS (fmaf, float, (float x, float y, float z)); 960_GL_CXXALIAS_SYS (fmaf, float, (float x, float y, float z));
978# endif 961# endif
979_GL_CXXALIASWARN (fmaf); 962_GL_CXXALIASWARN (fmaf);
980#elif defined GNULIB_POSIXCHECK 963#elif defined GNULIB_POSIXCHECK
981# undef fmaf
982# if HAVE_RAW_DECL_FMAF 964# if HAVE_RAW_DECL_FMAF
983_GL_WARN_ON_USE (fmaf, "fmaf is unportable - " 965_GL_WARN_ON_USE (fmaf, "fmaf is unportable - "
984 "use gnulib module fmaf for portability"); 966 "use gnulib module fmaf for portability");
@@ -991,12 +973,12 @@ _GL_WARN_ON_USE (fmaf, "fmaf is unportable - "
991# undef fma 973# undef fma
992# define fma rpl_fma 974# define fma rpl_fma
993# endif 975# endif
994_GL_FUNCDECL_RPL (fma, double, (double x, double y, double z)); 976_GL_FUNCDECL_RPL (fma, double, (double x, double y, double z), );
995_GL_CXXALIAS_RPL (fma, double, (double x, double y, double z)); 977_GL_CXXALIAS_RPL (fma, double, (double x, double y, double z));
996# else 978# else
997# if !@HAVE_FMA@ 979# if !@HAVE_FMA@
998# undef fma 980# undef fma
999_GL_FUNCDECL_SYS (fma, double, (double x, double y, double z)); 981_GL_FUNCDECL_SYS (fma, double, (double x, double y, double z), );
1000# endif 982# endif
1001_GL_CXXALIAS_SYS (fma, double, (double x, double y, double z)); 983_GL_CXXALIAS_SYS (fma, double, (double x, double y, double z));
1002# endif 984# endif
@@ -1004,7 +986,6 @@ _GL_CXXALIAS_SYS (fma, double, (double x, double y, double z));
1004_GL_CXXALIASWARN1 (fma, double, (double x, double y, double z)); 986_GL_CXXALIASWARN1 (fma, double, (double x, double y, double z));
1005# endif 987# endif
1006#elif defined GNULIB_POSIXCHECK 988#elif defined GNULIB_POSIXCHECK
1007# undef fma
1008# if HAVE_RAW_DECL_FMA 989# if HAVE_RAW_DECL_FMA
1009_GL_WARN_ON_USE (fma, "fma is unportable - " 990_GL_WARN_ON_USE (fma, "fma is unportable - "
1010 "use gnulib module fma for portability"); 991 "use gnulib module fma for portability");
@@ -1018,7 +999,7 @@ _GL_WARN_ON_USE (fma, "fma is unportable - "
1018# define fmal rpl_fmal 999# define fmal rpl_fmal
1019# endif 1000# endif
1020_GL_FUNCDECL_RPL (fmal, long double, 1001_GL_FUNCDECL_RPL (fmal, long double,
1021 (long double x, long double y, long double z)); 1002 (long double x, long double y, long double z), );
1022_GL_CXXALIAS_RPL (fmal, long double, 1003_GL_CXXALIAS_RPL (fmal, long double,
1023 (long double x, long double y, long double z)); 1004 (long double x, long double y, long double z));
1024# else 1005# else
@@ -1026,7 +1007,7 @@ _GL_CXXALIAS_RPL (fmal, long double,
1026# undef fmal 1007# undef fmal
1027# if !(defined __cplusplus && defined _AIX) 1008# if !(defined __cplusplus && defined _AIX)
1028_GL_FUNCDECL_SYS (fmal, long double, 1009_GL_FUNCDECL_SYS (fmal, long double,
1029 (long double x, long double y, long double z)); 1010 (long double x, long double y, long double z), );
1030# endif 1011# endif
1031# endif 1012# endif
1032_GL_CXXALIAS_SYS (fmal, long double, 1013_GL_CXXALIAS_SYS (fmal, long double,
@@ -1036,7 +1017,6 @@ _GL_CXXALIAS_SYS (fmal, long double,
1036_GL_CXXALIASWARN (fmal); 1017_GL_CXXALIASWARN (fmal);
1037# endif 1018# endif
1038#elif defined GNULIB_POSIXCHECK 1019#elif defined GNULIB_POSIXCHECK
1039# undef fmal
1040# if HAVE_RAW_DECL_FMAL 1020# if HAVE_RAW_DECL_FMAL
1041_GL_WARN_ON_USE (fmal, "fmal is unportable - " 1021_GL_WARN_ON_USE (fmal, "fmal is unportable - "
1042 "use gnulib module fmal for portability"); 1022 "use gnulib module fmal for portability");
@@ -1050,18 +1030,17 @@ _GL_WARN_ON_USE (fmal, "fmal is unportable - "
1050# undef fmodf 1030# undef fmodf
1051# define fmodf rpl_fmodf 1031# define fmodf rpl_fmodf
1052# endif 1032# endif
1053_GL_FUNCDECL_RPL (fmodf, float, (float x, float y)); 1033_GL_FUNCDECL_RPL (fmodf, float, (float x, float y), );
1054_GL_CXXALIAS_RPL (fmodf, float, (float x, float y)); 1034_GL_CXXALIAS_RPL (fmodf, float, (float x, float y));
1055# else 1035# else
1056# if !@HAVE_FMODF@ 1036# if !@HAVE_FMODF@
1057# undef fmodf 1037# undef fmodf
1058_GL_FUNCDECL_SYS (fmodf, float, (float x, float y)); 1038_GL_FUNCDECL_SYS (fmodf, float, (float x, float y), );
1059# endif 1039# endif
1060_GL_CXXALIAS_SYS (fmodf, float, (float x, float y)); 1040_GL_CXXALIAS_SYS (fmodf, float, (float x, float y));
1061# endif 1041# endif
1062_GL_CXXALIASWARN (fmodf); 1042_GL_CXXALIASWARN (fmodf);
1063#elif defined GNULIB_POSIXCHECK 1043#elif defined GNULIB_POSIXCHECK
1064# undef fmodf
1065# if HAVE_RAW_DECL_FMODF 1044# if HAVE_RAW_DECL_FMODF
1066_GL_WARN_ON_USE (fmodf, "fmodf is unportable - " 1045_GL_WARN_ON_USE (fmodf, "fmodf is unportable - "
1067 "use gnulib module fmodf for portability"); 1046 "use gnulib module fmodf for portability");
@@ -1074,7 +1053,7 @@ _GL_WARN_ON_USE (fmodf, "fmodf is unportable - "
1074# undef fmod 1053# undef fmod
1075# define fmod rpl_fmod 1054# define fmod rpl_fmod
1076# endif 1055# endif
1077_GL_FUNCDECL_RPL (fmod, double, (double x, double y)); 1056_GL_FUNCDECL_RPL (fmod, double, (double x, double y), );
1078_GL_CXXALIAS_RPL (fmod, double, (double x, double y)); 1057_GL_CXXALIAS_RPL (fmod, double, (double x, double y));
1079# else 1058# else
1080_GL_CXXALIAS_SYS (fmod, double, (double x, double y)); 1059_GL_CXXALIAS_SYS (fmod, double, (double x, double y));
@@ -1083,7 +1062,6 @@ _GL_CXXALIAS_SYS (fmod, double, (double x, double y));
1083_GL_CXXALIASWARN1 (fmod, double, (double x, double y)); 1062_GL_CXXALIASWARN1 (fmod, double, (double x, double y));
1084# endif 1063# endif
1085#elif defined GNULIB_POSIXCHECK 1064#elif defined GNULIB_POSIXCHECK
1086# undef fmod
1087# if HAVE_RAW_DECL_FMOD 1065# if HAVE_RAW_DECL_FMOD
1088_GL_WARN_ON_USE (fmod, "fmod has portability problems - " 1066_GL_WARN_ON_USE (fmod, "fmod has portability problems - "
1089 "use gnulib module fmod for portability"); 1067 "use gnulib module fmod for portability");
@@ -1096,12 +1074,12 @@ _GL_WARN_ON_USE (fmod, "fmod has portability problems - "
1096# undef fmodl 1074# undef fmodl
1097# define fmodl rpl_fmodl 1075# define fmodl rpl_fmodl
1098# endif 1076# endif
1099_GL_FUNCDECL_RPL (fmodl, long double, (long double x, long double y)); 1077_GL_FUNCDECL_RPL (fmodl, long double, (long double x, long double y), );
1100_GL_CXXALIAS_RPL (fmodl, long double, (long double x, long double y)); 1078_GL_CXXALIAS_RPL (fmodl, long double, (long double x, long double y));
1101# else 1079# else
1102# if !@HAVE_FMODL@ 1080# if !@HAVE_FMODL@
1103# undef fmodl 1081# undef fmodl
1104_GL_FUNCDECL_SYS (fmodl, long double, (long double x, long double y)); 1082_GL_FUNCDECL_SYS (fmodl, long double, (long double x, long double y), );
1105# endif 1083# endif
1106_GL_CXXALIAS_SYS (fmodl, long double, (long double x, long double y)); 1084_GL_CXXALIAS_SYS (fmodl, long double, (long double x, long double y));
1107# endif 1085# endif
@@ -1109,7 +1087,6 @@ _GL_CXXALIAS_SYS (fmodl, long double, (long double x, long double y));
1109_GL_CXXALIASWARN (fmodl); 1087_GL_CXXALIASWARN (fmodl);
1110# endif 1088# endif
1111#elif defined GNULIB_POSIXCHECK 1089#elif defined GNULIB_POSIXCHECK
1112# undef fmodl
1113# if HAVE_RAW_DECL_FMODL 1090# if HAVE_RAW_DECL_FMODL
1114_GL_WARN_ON_USE (fmodl, "fmodl is unportable - " 1091_GL_WARN_ON_USE (fmodl, "fmodl is unportable - "
1115 "use gnulib module fmodl for portability"); 1092 "use gnulib module fmodl for portability");
@@ -1130,12 +1107,12 @@ _GL_WARN_ON_USE (fmodl, "fmodl is unportable - "
1130# undef frexpf 1107# undef frexpf
1131# define frexpf rpl_frexpf 1108# define frexpf rpl_frexpf
1132# endif 1109# endif
1133_GL_FUNCDECL_RPL (frexpf, float, (float x, int *expptr) _GL_ARG_NONNULL ((2))); 1110_GL_FUNCDECL_RPL (frexpf, float, (float x, int *expptr), _GL_ARG_NONNULL ((2)));
1134_GL_CXXALIAS_RPL (frexpf, float, (float x, int *expptr)); 1111_GL_CXXALIAS_RPL (frexpf, float, (float x, int *expptr));
1135# else 1112# else
1136# if !@HAVE_FREXPF@ 1113# if !@HAVE_FREXPF@
1137# undef frexpf 1114# undef frexpf
1138_GL_FUNCDECL_SYS (frexpf, float, (float x, int *expptr) _GL_ARG_NONNULL ((2))); 1115_GL_FUNCDECL_SYS (frexpf, float, (float x, int *expptr), _GL_ARG_NONNULL ((2)));
1139# endif 1116# endif
1140_GL_CXXALIAS_SYS (frexpf, float, (float x, int *expptr)); 1117_GL_CXXALIAS_SYS (frexpf, float, (float x, int *expptr));
1141# endif 1118# endif
@@ -1143,7 +1120,6 @@ _GL_CXXALIAS_SYS (frexpf, float, (float x, int *expptr));
1143_GL_CXXALIASWARN (frexpf); 1120_GL_CXXALIASWARN (frexpf);
1144# endif 1121# endif
1145#elif defined GNULIB_POSIXCHECK 1122#elif defined GNULIB_POSIXCHECK
1146# undef frexpf
1147# if HAVE_RAW_DECL_FREXPF 1123# if HAVE_RAW_DECL_FREXPF
1148_GL_WARN_ON_USE (frexpf, "frexpf is unportable - " 1124_GL_WARN_ON_USE (frexpf, "frexpf is unportable - "
1149 "use gnulib module frexpf for portability"); 1125 "use gnulib module frexpf for portability");
@@ -1163,7 +1139,8 @@ _GL_WARN_ON_USE (frexpf, "frexpf is unportable - "
1163# undef frexp 1139# undef frexp
1164# define frexp rpl_frexp 1140# define frexp rpl_frexp
1165# endif 1141# endif
1166_GL_FUNCDECL_RPL (frexp, double, (double x, int *expptr) _GL_ARG_NONNULL ((2))); 1142_GL_FUNCDECL_RPL (frexp, double, (double x, int *expptr),
1143 _GL_ARG_NONNULL ((2)));
1167_GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr)); 1144_GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr));
1168# else 1145# else
1169_GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr)); 1146_GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr));
@@ -1174,8 +1151,10 @@ _GL_CXXALIASWARN1 (frexp, double, (double x, int *expptr));
1174#elif defined GNULIB_POSIXCHECK 1151#elif defined GNULIB_POSIXCHECK
1175# undef frexp 1152# undef frexp
1176/* Assume frexp is always declared. */ 1153/* Assume frexp is always declared. */
1177_GL_WARN_ON_USE (frexp, "frexp is unportable - " 1154_GL_WARN_ON_USE_CXX (frexp,
1178 "use gnulib module frexp for portability"); 1155 double, double, (double, int *),
1156 "frexp is unportable - "
1157 "use gnulib module frexp for portability");
1179#endif 1158#endif
1180 1159
1181/* Write x as 1160/* Write x as
@@ -1191,12 +1170,12 @@ _GL_WARN_ON_USE (frexp, "frexp is unportable - "
1191# define frexpl rpl_frexpl 1170# define frexpl rpl_frexpl
1192# endif 1171# endif
1193_GL_FUNCDECL_RPL (frexpl, long double, 1172_GL_FUNCDECL_RPL (frexpl, long double,
1194 (long double x, int *expptr) _GL_ARG_NONNULL ((2))); 1173 (long double x, int *expptr), _GL_ARG_NONNULL ((2)));
1195_GL_CXXALIAS_RPL (frexpl, long double, (long double x, int *expptr)); 1174_GL_CXXALIAS_RPL (frexpl, long double, (long double x, int *expptr));
1196#else 1175#else
1197# if !@HAVE_DECL_FREXPL@ 1176# if !@HAVE_DECL_FREXPL@
1198_GL_FUNCDECL_SYS (frexpl, long double, 1177_GL_FUNCDECL_SYS (frexpl, long double,
1199 (long double x, int *expptr) _GL_ARG_NONNULL ((2))); 1178 (long double x, int *expptr), _GL_ARG_NONNULL ((2)));
1200# endif 1179# endif
1201# if @GNULIB_FREXPL@ 1180# if @GNULIB_FREXPL@
1202_GL_CXXALIAS_SYS (frexpl, long double, (long double x, int *expptr)); 1181_GL_CXXALIAS_SYS (frexpl, long double, (long double x, int *expptr));
@@ -1208,7 +1187,6 @@ _GL_CXXALIASWARN (frexpl);
1208# endif 1187# endif
1209#endif 1188#endif
1210#if !@GNULIB_FREXPL@ && defined GNULIB_POSIXCHECK 1189#if !@GNULIB_FREXPL@ && defined GNULIB_POSIXCHECK
1211# undef frexpl
1212# if HAVE_RAW_DECL_FREXPL 1190# if HAVE_RAW_DECL_FREXPL
1213_GL_WARN_ON_USE (frexpl, "frexpl is unportable - " 1191_GL_WARN_ON_USE (frexpl, "frexpl is unportable - "
1214 "use gnulib module frexpl for portability"); 1192 "use gnulib module frexpl for portability");
@@ -1223,11 +1201,11 @@ _GL_WARN_ON_USE (frexpl, "frexpl is unportable - "
1223# undef hypotf 1201# undef hypotf
1224# define hypotf rpl_hypotf 1202# define hypotf rpl_hypotf
1225# endif 1203# endif
1226_GL_FUNCDECL_RPL (hypotf, float, (float x, float y)); 1204_GL_FUNCDECL_RPL (hypotf, float, (float x, float y), );
1227_GL_CXXALIAS_RPL (hypotf, float, (float x, float y)); 1205_GL_CXXALIAS_RPL (hypotf, float, (float x, float y));
1228# else 1206# else
1229# if !@HAVE_HYPOTF@ 1207# if !@HAVE_HYPOTF@
1230_GL_FUNCDECL_SYS (hypotf, float, (float x, float y)); 1208_GL_FUNCDECL_SYS (hypotf, float, (float x, float y), );
1231# endif 1209# endif
1232_GL_CXXALIAS_SYS (hypotf, float, (float x, float y)); 1210_GL_CXXALIAS_SYS (hypotf, float, (float x, float y));
1233# endif 1211# endif
@@ -1235,7 +1213,6 @@ _GL_CXXALIAS_SYS (hypotf, float, (float x, float y));
1235_GL_CXXALIASWARN (hypotf); 1213_GL_CXXALIASWARN (hypotf);
1236# endif 1214# endif
1237#elif defined GNULIB_POSIXCHECK 1215#elif defined GNULIB_POSIXCHECK
1238# undef hypotf
1239# if HAVE_RAW_DECL_HYPOTF 1216# if HAVE_RAW_DECL_HYPOTF
1240_GL_WARN_ON_USE (hypotf, "hypotf is unportable - " 1217_GL_WARN_ON_USE (hypotf, "hypotf is unportable - "
1241 "use gnulib module hypotf for portability"); 1218 "use gnulib module hypotf for portability");
@@ -1249,7 +1226,7 @@ _GL_WARN_ON_USE (hypotf, "hypotf is unportable - "
1249# undef hypot 1226# undef hypot
1250# define hypot rpl_hypot 1227# define hypot rpl_hypot
1251# endif 1228# endif
1252_GL_FUNCDECL_RPL (hypot, double, (double x, double y)); 1229_GL_FUNCDECL_RPL (hypot, double, (double x, double y), );
1253_GL_CXXALIAS_RPL (hypot, double, (double x, double y)); 1230_GL_CXXALIAS_RPL (hypot, double, (double x, double y));
1254# else 1231# else
1255_GL_CXXALIAS_SYS (hypot, double, (double x, double y)); 1232_GL_CXXALIAS_SYS (hypot, double, (double x, double y));
@@ -1258,7 +1235,6 @@ _GL_CXXALIAS_SYS (hypot, double, (double x, double y));
1258_GL_CXXALIASWARN1 (hypot, double, (double x, double y)); 1235_GL_CXXALIASWARN1 (hypot, double, (double x, double y));
1259# endif 1236# endif
1260#elif defined GNULIB_POSIXCHECK 1237#elif defined GNULIB_POSIXCHECK
1261# undef hypot
1262# if HAVE_RAW_DECL_HYPOT 1238# if HAVE_RAW_DECL_HYPOT
1263_GL_WARN_ON_USE (hypotf, "hypot has portability problems - " 1239_GL_WARN_ON_USE (hypotf, "hypot has portability problems - "
1264 "use gnulib module hypot for portability"); 1240 "use gnulib module hypot for portability");
@@ -1272,11 +1248,11 @@ _GL_WARN_ON_USE (hypotf, "hypot has portability problems - "
1272# undef hypotl 1248# undef hypotl
1273# define hypotl rpl_hypotl 1249# define hypotl rpl_hypotl
1274# endif 1250# endif
1275_GL_FUNCDECL_RPL (hypotl, long double, (long double x, long double y)); 1251_GL_FUNCDECL_RPL (hypotl, long double, (long double x, long double y), );
1276_GL_CXXALIAS_RPL (hypotl, long double, (long double x, long double y)); 1252_GL_CXXALIAS_RPL (hypotl, long double, (long double x, long double y));
1277# else 1253# else
1278# if !@HAVE_HYPOTL@ 1254# if !@HAVE_HYPOTL@
1279_GL_FUNCDECL_SYS (hypotl, long double, (long double x, long double y)); 1255_GL_FUNCDECL_SYS (hypotl, long double, (long double x, long double y), );
1280# endif 1256# endif
1281_GL_CXXALIAS_SYS (hypotl, long double, (long double x, long double y)); 1257_GL_CXXALIAS_SYS (hypotl, long double, (long double x, long double y));
1282# endif 1258# endif
@@ -1284,7 +1260,6 @@ _GL_CXXALIAS_SYS (hypotl, long double, (long double x, long double y));
1284_GL_CXXALIASWARN (hypotl); 1260_GL_CXXALIASWARN (hypotl);
1285# endif 1261# endif
1286#elif defined GNULIB_POSIXCHECK 1262#elif defined GNULIB_POSIXCHECK
1287# undef hypotl
1288# if HAVE_RAW_DECL_HYPOTL 1263# if HAVE_RAW_DECL_HYPOTL
1289_GL_WARN_ON_USE (hypotl, "hypotl is unportable - " 1264_GL_WARN_ON_USE (hypotl, "hypotl is unportable - "
1290 "use gnulib module hypotl for portability"); 1265 "use gnulib module hypotl for portability");
@@ -1298,17 +1273,16 @@ _GL_WARN_ON_USE (hypotl, "hypotl is unportable - "
1298# undef ilogbf 1273# undef ilogbf
1299# define ilogbf rpl_ilogbf 1274# define ilogbf rpl_ilogbf
1300# endif 1275# endif
1301_GL_FUNCDECL_RPL (ilogbf, int, (float x)); 1276_GL_FUNCDECL_RPL (ilogbf, int, (float x), );
1302_GL_CXXALIAS_RPL (ilogbf, int, (float x)); 1277_GL_CXXALIAS_RPL (ilogbf, int, (float x));
1303# else 1278# else
1304# if !@HAVE_ILOGBF@ 1279# if !@HAVE_ILOGBF@
1305_GL_FUNCDECL_SYS (ilogbf, int, (float x)); 1280_GL_FUNCDECL_SYS (ilogbf, int, (float x), );
1306# endif 1281# endif
1307_GL_CXXALIAS_SYS (ilogbf, int, (float x)); 1282_GL_CXXALIAS_SYS (ilogbf, int, (float x));
1308# endif 1283# endif
1309_GL_CXXALIASWARN (ilogbf); 1284_GL_CXXALIASWARN (ilogbf);
1310#elif defined GNULIB_POSIXCHECK 1285#elif defined GNULIB_POSIXCHECK
1311# undef ilogbf
1312# if HAVE_RAW_DECL_ILOGBF 1286# if HAVE_RAW_DECL_ILOGBF
1313_GL_WARN_ON_USE (ilogbf, "ilogbf is unportable - " 1287_GL_WARN_ON_USE (ilogbf, "ilogbf is unportable - "
1314 "use gnulib module ilogbf for portability"); 1288 "use gnulib module ilogbf for portability");
@@ -1321,11 +1295,11 @@ _GL_WARN_ON_USE (ilogbf, "ilogbf is unportable - "
1321# undef ilogb 1295# undef ilogb
1322# define ilogb rpl_ilogb 1296# define ilogb rpl_ilogb
1323# endif 1297# endif
1324_GL_FUNCDECL_RPL (ilogb, int, (double x)); 1298_GL_FUNCDECL_RPL (ilogb, int, (double x), );
1325_GL_CXXALIAS_RPL (ilogb, int, (double x)); 1299_GL_CXXALIAS_RPL (ilogb, int, (double x));
1326# else 1300# else
1327# if !@HAVE_ILOGB@ 1301# if !@HAVE_ILOGB@
1328_GL_FUNCDECL_SYS (ilogb, int, (double x)); 1302_GL_FUNCDECL_SYS (ilogb, int, (double x), );
1329# endif 1303# endif
1330_GL_CXXALIAS_SYS (ilogb, int, (double x)); 1304_GL_CXXALIAS_SYS (ilogb, int, (double x));
1331# endif 1305# endif
@@ -1333,7 +1307,6 @@ _GL_CXXALIAS_SYS (ilogb, int, (double x));
1333_GL_CXXALIASWARN1 (ilogb, int, (double x)); 1307_GL_CXXALIASWARN1 (ilogb, int, (double x));
1334# endif 1308# endif
1335#elif defined GNULIB_POSIXCHECK 1309#elif defined GNULIB_POSIXCHECK
1336# undef ilogb
1337# if HAVE_RAW_DECL_ILOGB 1310# if HAVE_RAW_DECL_ILOGB
1338_GL_WARN_ON_USE (ilogb, "ilogb is unportable - " 1311_GL_WARN_ON_USE (ilogb, "ilogb is unportable - "
1339 "use gnulib module ilogb for portability"); 1312 "use gnulib module ilogb for portability");
@@ -1346,12 +1319,12 @@ _GL_WARN_ON_USE (ilogb, "ilogb is unportable - "
1346# undef ilogbl 1319# undef ilogbl
1347# define ilogbl rpl_ilogbl 1320# define ilogbl rpl_ilogbl
1348# endif 1321# endif
1349_GL_FUNCDECL_RPL (ilogbl, int, (long double x)); 1322_GL_FUNCDECL_RPL (ilogbl, int, (long double x), );
1350_GL_CXXALIAS_RPL (ilogbl, int, (long double x)); 1323_GL_CXXALIAS_RPL (ilogbl, int, (long double x));
1351# else 1324# else
1352# if !@HAVE_ILOGBL@ 1325# if !@HAVE_ILOGBL@
1353# undef ilogbl 1326# undef ilogbl
1354_GL_FUNCDECL_SYS (ilogbl, int, (long double x)); 1327_GL_FUNCDECL_SYS (ilogbl, int, (long double x), );
1355# endif 1328# endif
1356_GL_CXXALIAS_SYS (ilogbl, int, (long double x)); 1329_GL_CXXALIAS_SYS (ilogbl, int, (long double x));
1357# endif 1330# endif
@@ -1359,7 +1332,6 @@ _GL_CXXALIAS_SYS (ilogbl, int, (long double x));
1359_GL_CXXALIASWARN (ilogbl); 1332_GL_CXXALIASWARN (ilogbl);
1360# endif 1333# endif
1361#elif defined GNULIB_POSIXCHECK 1334#elif defined GNULIB_POSIXCHECK
1362# undef ilogbl
1363# if HAVE_RAW_DECL_ILOGBL 1335# if HAVE_RAW_DECL_ILOGBL
1364_GL_WARN_ON_USE (ilogbl, "ilogbl is unportable - " 1336_GL_WARN_ON_USE (ilogbl, "ilogbl is unportable - "
1365 "use gnulib module ilogbl for portability"); 1337 "use gnulib module ilogbl for portability");
@@ -1420,14 +1392,13 @@ _GL_CXXALIASWARN (jn);
1420#if @GNULIB_LDEXPF@ 1392#if @GNULIB_LDEXPF@
1421# if !@HAVE_LDEXPF@ 1393# if !@HAVE_LDEXPF@
1422# undef ldexpf 1394# undef ldexpf
1423_GL_FUNCDECL_SYS (ldexpf, float, (float x, int exp)); 1395_GL_FUNCDECL_SYS (ldexpf, float, (float x, int exp), );
1424# endif 1396# endif
1425_GL_CXXALIAS_SYS (ldexpf, float, (float x, int exp)); 1397_GL_CXXALIAS_SYS (ldexpf, float, (float x, int exp));
1426# if __GLIBC__ >= 2 1398# if __GLIBC__ >= 2
1427_GL_CXXALIASWARN (ldexpf); 1399_GL_CXXALIASWARN (ldexpf);
1428# endif 1400# endif
1429#elif defined GNULIB_POSIXCHECK 1401#elif defined GNULIB_POSIXCHECK
1430# undef ldexpf
1431# if HAVE_RAW_DECL_LDEXPF 1402# if HAVE_RAW_DECL_LDEXPF
1432_GL_WARN_ON_USE (ldexpf, "ldexpf is unportable - " 1403_GL_WARN_ON_USE (ldexpf, "ldexpf is unportable - "
1433 "use gnulib module ldexpf for portability"); 1404 "use gnulib module ldexpf for portability");
@@ -1441,7 +1412,7 @@ _GL_WARN_ON_USE (ldexpf, "ldexpf is unportable - "
1441# undef ldexp 1412# undef ldexp
1442# define ldexp rpl_ldexp 1413# define ldexp rpl_ldexp
1443# endif 1414# endif
1444_GL_FUNCDECL_RPL (ldexp, double, (double x, int exp)); 1415_GL_FUNCDECL_RPL (ldexp, double, (double x, int exp), );
1445_GL_CXXALIAS_RPL (ldexp, double, (double x, int exp)); 1416_GL_CXXALIAS_RPL (ldexp, double, (double x, int exp));
1446# else 1417# else
1447/* Assume ldexp is always declared. */ 1418/* Assume ldexp is always declared. */
@@ -1453,8 +1424,10 @@ _GL_CXXALIASWARN1 (ldexp, double, (double x, int exp));
1453#elif defined GNULIB_POSIXCHECK 1424#elif defined GNULIB_POSIXCHECK
1454# undef ldexp 1425# undef ldexp
1455/* Assume ldexp is always declared. */ 1426/* Assume ldexp is always declared. */
1456_GL_WARN_ON_USE (ldexp, "ldexp is unportable - " 1427_GL_WARN_ON_USE_CXX (ldexp,
1457 "use gnulib module ldexp for portability"); 1428 double, double, (double, int),
1429 "ldexp is unportable - "
1430 "use gnulib module ldexp for portability");
1458#endif 1431#endif
1459 1432
1460/* Return x * 2^exp. */ 1433/* Return x * 2^exp. */
@@ -1463,11 +1436,11 @@ _GL_WARN_ON_USE (ldexp, "ldexp is unportable - "
1463# undef ldexpl 1436# undef ldexpl
1464# define ldexpl rpl_ldexpl 1437# define ldexpl rpl_ldexpl
1465# endif 1438# endif
1466_GL_FUNCDECL_RPL (ldexpl, long double, (long double x, int exp)); 1439_GL_FUNCDECL_RPL (ldexpl, long double, (long double x, int exp), );
1467_GL_CXXALIAS_RPL (ldexpl, long double, (long double x, int exp)); 1440_GL_CXXALIAS_RPL (ldexpl, long double, (long double x, int exp));
1468#else 1441#else
1469# if !@HAVE_DECL_LDEXPL@ 1442# if !@HAVE_DECL_LDEXPL@
1470_GL_FUNCDECL_SYS (ldexpl, long double, (long double x, int exp)); 1443_GL_FUNCDECL_SYS (ldexpl, long double, (long double x, int exp), );
1471# endif 1444# endif
1472# if @GNULIB_LDEXPL@ 1445# if @GNULIB_LDEXPL@
1473_GL_CXXALIAS_SYS (ldexpl, long double, (long double x, int exp)); 1446_GL_CXXALIAS_SYS (ldexpl, long double, (long double x, int exp));
@@ -1479,7 +1452,6 @@ _GL_CXXALIASWARN (ldexpl);
1479# endif 1452# endif
1480#endif 1453#endif
1481#if !@GNULIB_LDEXPL@ && defined GNULIB_POSIXCHECK 1454#if !@GNULIB_LDEXPL@ && defined GNULIB_POSIXCHECK
1482# undef ldexpl
1483# if HAVE_RAW_DECL_LDEXPL 1455# if HAVE_RAW_DECL_LDEXPL
1484_GL_WARN_ON_USE (ldexpl, "ldexpl is unportable - " 1456_GL_WARN_ON_USE (ldexpl, "ldexpl is unportable - "
1485 "use gnulib module ldexpl for portability"); 1457 "use gnulib module ldexpl for portability");
@@ -1493,18 +1465,17 @@ _GL_WARN_ON_USE (ldexpl, "ldexpl is unportable - "
1493# undef logf 1465# undef logf
1494# define logf rpl_logf 1466# define logf rpl_logf
1495# endif 1467# endif
1496_GL_FUNCDECL_RPL (logf, float, (float x)); 1468_GL_FUNCDECL_RPL (logf, float, (float x), );
1497_GL_CXXALIAS_RPL (logf, float, (float x)); 1469_GL_CXXALIAS_RPL (logf, float, (float x));
1498# else 1470# else
1499# if !@HAVE_LOGF@ 1471# if !@HAVE_LOGF@
1500# undef logf 1472# undef logf
1501_GL_FUNCDECL_SYS (logf, float, (float x)); 1473_GL_FUNCDECL_SYS (logf, float, (float x), );
1502# endif 1474# endif
1503_GL_CXXALIAS_SYS (logf, float, (float x)); 1475_GL_CXXALIAS_SYS (logf, float, (float x));
1504# endif 1476# endif
1505_GL_CXXALIASWARN (logf); 1477_GL_CXXALIASWARN (logf);
1506#elif defined GNULIB_POSIXCHECK 1478#elif defined GNULIB_POSIXCHECK
1507# undef logf
1508# if HAVE_RAW_DECL_LOGF 1479# if HAVE_RAW_DECL_LOGF
1509_GL_WARN_ON_USE (logf, "logf is unportable - " 1480_GL_WARN_ON_USE (logf, "logf is unportable - "
1510 "use gnulib module logf for portability"); 1481 "use gnulib module logf for portability");
@@ -1517,7 +1488,7 @@ _GL_WARN_ON_USE (logf, "logf is unportable - "
1517# undef log 1488# undef log
1518# define log rpl_log 1489# define log rpl_log
1519# endif 1490# endif
1520_GL_FUNCDECL_RPL (log, double, (double x)); 1491_GL_FUNCDECL_RPL (log, double, (double x), );
1521_GL_CXXALIAS_RPL (log, double, (double x)); 1492_GL_CXXALIAS_RPL (log, double, (double x));
1522# else 1493# else
1523_GL_CXXALIAS_SYS (log, double, (double x)); 1494_GL_CXXALIAS_SYS (log, double, (double x));
@@ -1526,7 +1497,6 @@ _GL_CXXALIAS_SYS (log, double, (double x));
1526_GL_CXXALIASWARN1 (log, double, (double x)); 1497_GL_CXXALIASWARN1 (log, double, (double x));
1527# endif 1498# endif
1528#elif defined GNULIB_POSIXCHECK 1499#elif defined GNULIB_POSIXCHECK
1529# undef log
1530# if HAVE_RAW_DECL_LOG 1500# if HAVE_RAW_DECL_LOG
1531_GL_WARN_ON_USE (log, "log has portability problems - " 1501_GL_WARN_ON_USE (log, "log has portability problems - "
1532 "use gnulib module log for portability"); 1502 "use gnulib module log for portability");
@@ -1539,12 +1509,12 @@ _GL_WARN_ON_USE (log, "log has portability problems - "
1539# undef logl 1509# undef logl
1540# define logl rpl_logl 1510# define logl rpl_logl
1541# endif 1511# endif
1542_GL_FUNCDECL_RPL (logl, long double, (long double x)); 1512_GL_FUNCDECL_RPL (logl, long double, (long double x), );
1543_GL_CXXALIAS_RPL (logl, long double, (long double x)); 1513_GL_CXXALIAS_RPL (logl, long double, (long double x));
1544# else 1514# else
1545# if !@HAVE_LOGL@ || !@HAVE_DECL_LOGL@ 1515# if !@HAVE_LOGL@ || !@HAVE_DECL_LOGL@
1546# undef logl 1516# undef logl
1547_GL_FUNCDECL_SYS (logl, long double, (long double x)); 1517_GL_FUNCDECL_SYS (logl, long double, (long double x), );
1548# endif 1518# endif
1549_GL_CXXALIAS_SYS (logl, long double, (long double x)); 1519_GL_CXXALIAS_SYS (logl, long double, (long double x));
1550# endif 1520# endif
@@ -1552,7 +1522,6 @@ _GL_CXXALIAS_SYS (logl, long double, (long double x));
1552_GL_CXXALIASWARN (logl); 1522_GL_CXXALIASWARN (logl);
1553# endif 1523# endif
1554#elif defined GNULIB_POSIXCHECK 1524#elif defined GNULIB_POSIXCHECK
1555# undef logl
1556# if HAVE_RAW_DECL_LOGL 1525# if HAVE_RAW_DECL_LOGL
1557_GL_WARN_ON_USE (logl, "logl is unportable - " 1526_GL_WARN_ON_USE (logl, "logl is unportable - "
1558 "use gnulib module logl for portability"); 1527 "use gnulib module logl for portability");
@@ -1566,18 +1535,17 @@ _GL_WARN_ON_USE (logl, "logl is unportable - "
1566# undef log10f 1535# undef log10f
1567# define log10f rpl_log10f 1536# define log10f rpl_log10f
1568# endif 1537# endif
1569_GL_FUNCDECL_RPL (log10f, float, (float x)); 1538_GL_FUNCDECL_RPL (log10f, float, (float x), );
1570_GL_CXXALIAS_RPL (log10f, float, (float x)); 1539_GL_CXXALIAS_RPL (log10f, float, (float x));
1571# else 1540# else
1572# if !@HAVE_LOG10F@ 1541# if !@HAVE_LOG10F@
1573# undef log10f 1542# undef log10f
1574_GL_FUNCDECL_SYS (log10f, float, (float x)); 1543_GL_FUNCDECL_SYS (log10f, float, (float x), );
1575# endif 1544# endif
1576_GL_CXXALIAS_SYS (log10f, float, (float x)); 1545_GL_CXXALIAS_SYS (log10f, float, (float x));
1577# endif 1546# endif
1578_GL_CXXALIASWARN (log10f); 1547_GL_CXXALIASWARN (log10f);
1579#elif defined GNULIB_POSIXCHECK 1548#elif defined GNULIB_POSIXCHECK
1580# undef log10f
1581# if HAVE_RAW_DECL_LOG10F 1549# if HAVE_RAW_DECL_LOG10F
1582_GL_WARN_ON_USE (log10f, "log10f is unportable - " 1550_GL_WARN_ON_USE (log10f, "log10f is unportable - "
1583 "use gnulib module log10f for portability"); 1551 "use gnulib module log10f for portability");
@@ -1590,7 +1558,7 @@ _GL_WARN_ON_USE (log10f, "log10f is unportable - "
1590# undef log10 1558# undef log10
1591# define log10 rpl_log10 1559# define log10 rpl_log10
1592# endif 1560# endif
1593_GL_FUNCDECL_RPL (log10, double, (double x)); 1561_GL_FUNCDECL_RPL (log10, double, (double x), );
1594_GL_CXXALIAS_RPL (log10, double, (double x)); 1562_GL_CXXALIAS_RPL (log10, double, (double x));
1595# else 1563# else
1596_GL_CXXALIAS_SYS (log10, double, (double x)); 1564_GL_CXXALIAS_SYS (log10, double, (double x));
@@ -1599,7 +1567,6 @@ _GL_CXXALIAS_SYS (log10, double, (double x));
1599_GL_CXXALIASWARN1 (log10, double, (double x)); 1567_GL_CXXALIASWARN1 (log10, double, (double x));
1600# endif 1568# endif
1601#elif defined GNULIB_POSIXCHECK 1569#elif defined GNULIB_POSIXCHECK
1602# undef log10
1603# if HAVE_RAW_DECL_LOG10 1570# if HAVE_RAW_DECL_LOG10
1604_GL_WARN_ON_USE (log10, "log10 has portability problems - " 1571_GL_WARN_ON_USE (log10, "log10 has portability problems - "
1605 "use gnulib module log10 for portability"); 1572 "use gnulib module log10 for portability");
@@ -1612,12 +1579,12 @@ _GL_WARN_ON_USE (log10, "log10 has portability problems - "
1612# undef log10l 1579# undef log10l
1613# define log10l rpl_log10l 1580# define log10l rpl_log10l
1614# endif 1581# endif
1615_GL_FUNCDECL_RPL (log10l, long double, (long double x)); 1582_GL_FUNCDECL_RPL (log10l, long double, (long double x), );
1616_GL_CXXALIAS_RPL (log10l, long double, (long double x)); 1583_GL_CXXALIAS_RPL (log10l, long double, (long double x));
1617# else 1584# else
1618# if !@HAVE_LOG10L@ || !@HAVE_DECL_LOG10L@ 1585# if !@HAVE_LOG10L@ || !@HAVE_DECL_LOG10L@
1619# undef log10l 1586# undef log10l
1620_GL_FUNCDECL_SYS (log10l, long double, (long double x)); 1587_GL_FUNCDECL_SYS (log10l, long double, (long double x), );
1621# endif 1588# endif
1622_GL_CXXALIAS_SYS (log10l, long double, (long double x)); 1589_GL_CXXALIAS_SYS (log10l, long double, (long double x));
1623# endif 1590# endif
@@ -1625,7 +1592,6 @@ _GL_CXXALIAS_SYS (log10l, long double, (long double x));
1625_GL_CXXALIASWARN (log10l); 1592_GL_CXXALIASWARN (log10l);
1626# endif 1593# endif
1627#elif defined GNULIB_POSIXCHECK 1594#elif defined GNULIB_POSIXCHECK
1628# undef log10l
1629# if HAVE_RAW_DECL_LOG10L 1595# if HAVE_RAW_DECL_LOG10L
1630_GL_WARN_ON_USE (log10l, "log10l is unportable - " 1596_GL_WARN_ON_USE (log10l, "log10l is unportable - "
1631 "use gnulib module log10l for portability"); 1597 "use gnulib module log10l for portability");
@@ -1639,17 +1605,16 @@ _GL_WARN_ON_USE (log10l, "log10l is unportable - "
1639# undef log1pf 1605# undef log1pf
1640# define log1pf rpl_log1pf 1606# define log1pf rpl_log1pf
1641# endif 1607# endif
1642_GL_FUNCDECL_RPL (log1pf, float, (float x)); 1608_GL_FUNCDECL_RPL (log1pf, float, (float x), );
1643_GL_CXXALIAS_RPL (log1pf, float, (float x)); 1609_GL_CXXALIAS_RPL (log1pf, float, (float x));
1644# else 1610# else
1645# if !@HAVE_LOG1PF@ 1611# if !@HAVE_LOG1PF@
1646_GL_FUNCDECL_SYS (log1pf, float, (float x)); 1612_GL_FUNCDECL_SYS (log1pf, float, (float x), );
1647# endif 1613# endif
1648_GL_CXXALIAS_SYS (log1pf, float, (float x)); 1614_GL_CXXALIAS_SYS (log1pf, float, (float x));
1649# endif 1615# endif
1650_GL_CXXALIASWARN (log1pf); 1616_GL_CXXALIASWARN (log1pf);
1651#elif defined GNULIB_POSIXCHECK 1617#elif defined GNULIB_POSIXCHECK
1652# undef log1pf
1653# if HAVE_RAW_DECL_LOG1PF 1618# if HAVE_RAW_DECL_LOG1PF
1654_GL_WARN_ON_USE (log1pf, "log1pf is unportable - " 1619_GL_WARN_ON_USE (log1pf, "log1pf is unportable - "
1655 "use gnulib module log1pf for portability"); 1620 "use gnulib module log1pf for portability");
@@ -1662,11 +1627,11 @@ _GL_WARN_ON_USE (log1pf, "log1pf is unportable - "
1662# undef log1p 1627# undef log1p
1663# define log1p rpl_log1p 1628# define log1p rpl_log1p
1664# endif 1629# endif
1665_GL_FUNCDECL_RPL (log1p, double, (double x)); 1630_GL_FUNCDECL_RPL (log1p, double, (double x), );
1666_GL_CXXALIAS_RPL (log1p, double, (double x)); 1631_GL_CXXALIAS_RPL (log1p, double, (double x));
1667# else 1632# else
1668# if !@HAVE_LOG1P@ 1633# if !@HAVE_LOG1P@
1669_GL_FUNCDECL_SYS (log1p, double, (double x)); 1634_GL_FUNCDECL_SYS (log1p, double, (double x), );
1670# endif 1635# endif
1671_GL_CXXALIAS_SYS (log1p, double, (double x)); 1636_GL_CXXALIAS_SYS (log1p, double, (double x));
1672# endif 1637# endif
@@ -1674,7 +1639,6 @@ _GL_CXXALIAS_SYS (log1p, double, (double x));
1674_GL_CXXALIASWARN1 (log1p, double, (double x)); 1639_GL_CXXALIASWARN1 (log1p, double, (double x));
1675# endif 1640# endif
1676#elif defined GNULIB_POSIXCHECK 1641#elif defined GNULIB_POSIXCHECK
1677# undef log1p
1678# if HAVE_RAW_DECL_LOG1P 1642# if HAVE_RAW_DECL_LOG1P
1679_GL_WARN_ON_USE (log1p, "log1p has portability problems - " 1643_GL_WARN_ON_USE (log1p, "log1p has portability problems - "
1680 "use gnulib module log1p for portability"); 1644 "use gnulib module log1p for portability");
@@ -1687,11 +1651,11 @@ _GL_WARN_ON_USE (log1p, "log1p has portability problems - "
1687# undef log1pl 1651# undef log1pl
1688# define log1pl rpl_log1pl 1652# define log1pl rpl_log1pl
1689# endif 1653# endif
1690_GL_FUNCDECL_RPL (log1pl, long double, (long double x)); 1654_GL_FUNCDECL_RPL (log1pl, long double, (long double x), );
1691_GL_CXXALIAS_RPL (log1pl, long double, (long double x)); 1655_GL_CXXALIAS_RPL (log1pl, long double, (long double x));
1692# else 1656# else
1693# if !@HAVE_LOG1PL@ 1657# if !@HAVE_LOG1PL@
1694_GL_FUNCDECL_SYS (log1pl, long double, (long double x)); 1658_GL_FUNCDECL_SYS (log1pl, long double, (long double x), );
1695# endif 1659# endif
1696_GL_CXXALIAS_SYS (log1pl, long double, (long double x)); 1660_GL_CXXALIAS_SYS (log1pl, long double, (long double x));
1697# endif 1661# endif
@@ -1699,7 +1663,6 @@ _GL_CXXALIAS_SYS (log1pl, long double, (long double x));
1699_GL_CXXALIASWARN (log1pl); 1663_GL_CXXALIASWARN (log1pl);
1700# endif 1664# endif
1701#elif defined GNULIB_POSIXCHECK 1665#elif defined GNULIB_POSIXCHECK
1702# undef log1pl
1703# if HAVE_RAW_DECL_LOG1PL 1666# if HAVE_RAW_DECL_LOG1PL
1704_GL_WARN_ON_USE (log1pl, "log1pl has portability problems - " 1667_GL_WARN_ON_USE (log1pl, "log1pl has portability problems - "
1705 "use gnulib module log1pl for portability"); 1668 "use gnulib module log1pl for portability");
@@ -1713,12 +1676,12 @@ _GL_WARN_ON_USE (log1pl, "log1pl has portability problems - "
1713# undef log2f 1676# undef log2f
1714# define log2f rpl_log2f 1677# define log2f rpl_log2f
1715# endif 1678# endif
1716_GL_FUNCDECL_RPL (log2f, float, (float x)); 1679_GL_FUNCDECL_RPL (log2f, float, (float x), );
1717_GL_CXXALIAS_RPL (log2f, float, (float x)); 1680_GL_CXXALIAS_RPL (log2f, float, (float x));
1718# else 1681# else
1719# if !@HAVE_DECL_LOG2F@ 1682# if !@HAVE_LOG2F@
1720# undef log2f 1683# undef log2f
1721_GL_FUNCDECL_SYS (log2f, float, (float x)); 1684_GL_FUNCDECL_SYS (log2f, float, (float x), );
1722# endif 1685# endif
1723_GL_CXXALIAS_SYS (log2f, float, (float x)); 1686_GL_CXXALIAS_SYS (log2f, float, (float x));
1724# endif 1687# endif
@@ -1726,7 +1689,6 @@ _GL_CXXALIAS_SYS (log2f, float, (float x));
1726_GL_CXXALIASWARN (log2f); 1689_GL_CXXALIASWARN (log2f);
1727# endif 1690# endif
1728#elif defined GNULIB_POSIXCHECK 1691#elif defined GNULIB_POSIXCHECK
1729# undef log2f
1730# if HAVE_RAW_DECL_LOG2F 1692# if HAVE_RAW_DECL_LOG2F
1731_GL_WARN_ON_USE (log2f, "log2f is unportable - " 1693_GL_WARN_ON_USE (log2f, "log2f is unportable - "
1732 "use gnulib module log2f for portability"); 1694 "use gnulib module log2f for portability");
@@ -1739,12 +1701,12 @@ _GL_WARN_ON_USE (log2f, "log2f is unportable - "
1739# undef log2 1701# undef log2
1740# define log2 rpl_log2 1702# define log2 rpl_log2
1741# endif 1703# endif
1742_GL_FUNCDECL_RPL (log2, double, (double x)); 1704_GL_FUNCDECL_RPL (log2, double, (double x), );
1743_GL_CXXALIAS_RPL (log2, double, (double x)); 1705_GL_CXXALIAS_RPL (log2, double, (double x));
1744# else 1706# else
1745# if !@HAVE_DECL_LOG2@ 1707# if !@HAVE_LOG2@
1746# undef log2 1708# undef log2
1747_GL_FUNCDECL_SYS (log2, double, (double x)); 1709_GL_FUNCDECL_SYS (log2, double, (double x), );
1748# endif 1710# endif
1749_GL_CXXALIAS_SYS (log2, double, (double x)); 1711_GL_CXXALIAS_SYS (log2, double, (double x));
1750# endif 1712# endif
@@ -1752,7 +1714,6 @@ _GL_CXXALIAS_SYS (log2, double, (double x));
1752_GL_CXXALIASWARN1 (log2, double, (double x)); 1714_GL_CXXALIASWARN1 (log2, double, (double x));
1753# endif 1715# endif
1754#elif defined GNULIB_POSIXCHECK 1716#elif defined GNULIB_POSIXCHECK
1755# undef log2
1756# if HAVE_RAW_DECL_LOG2 1717# if HAVE_RAW_DECL_LOG2
1757_GL_WARN_ON_USE (log2, "log2 is unportable - " 1718_GL_WARN_ON_USE (log2, "log2 is unportable - "
1758 "use gnulib module log2 for portability"); 1719 "use gnulib module log2 for portability");
@@ -1765,11 +1726,11 @@ _GL_WARN_ON_USE (log2, "log2 is unportable - "
1765# undef log2l 1726# undef log2l
1766# define log2l rpl_log2l 1727# define log2l rpl_log2l
1767# endif 1728# endif
1768_GL_FUNCDECL_RPL (log2l, long double, (long double x)); 1729_GL_FUNCDECL_RPL (log2l, long double, (long double x), );
1769_GL_CXXALIAS_RPL (log2l, long double, (long double x)); 1730_GL_CXXALIAS_RPL (log2l, long double, (long double x));
1770# else 1731# else
1771# if !@HAVE_DECL_LOG2L@ 1732# if !@HAVE_LOG2L@
1772_GL_FUNCDECL_SYS (log2l, long double, (long double x)); 1733_GL_FUNCDECL_SYS (log2l, long double, (long double x), );
1773# endif 1734# endif
1774_GL_CXXALIAS_SYS (log2l, long double, (long double x)); 1735_GL_CXXALIAS_SYS (log2l, long double, (long double x));
1775# endif 1736# endif
@@ -1777,7 +1738,6 @@ _GL_CXXALIAS_SYS (log2l, long double, (long double x));
1777_GL_CXXALIASWARN (log2l); 1738_GL_CXXALIASWARN (log2l);
1778# endif 1739# endif
1779#elif defined GNULIB_POSIXCHECK 1740#elif defined GNULIB_POSIXCHECK
1780# undef log2l
1781# if HAVE_RAW_DECL_LOG2L 1741# if HAVE_RAW_DECL_LOG2L
1782_GL_WARN_ON_USE (log2l, "log2l is unportable - " 1742_GL_WARN_ON_USE (log2l, "log2l is unportable - "
1783 "use gnulib module log2l for portability"); 1743 "use gnulib module log2l for portability");
@@ -1791,17 +1751,16 @@ _GL_WARN_ON_USE (log2l, "log2l is unportable - "
1791# undef logbf 1751# undef logbf
1792# define logbf rpl_logbf 1752# define logbf rpl_logbf
1793# endif 1753# endif
1794_GL_FUNCDECL_RPL (logbf, float, (float x)); 1754_GL_FUNCDECL_RPL (logbf, float, (float x), );
1795_GL_CXXALIAS_RPL (logbf, float, (float x)); 1755_GL_CXXALIAS_RPL (logbf, float, (float x));
1796# else 1756# else
1797# if !@HAVE_LOGBF@ 1757# if !@HAVE_LOGBF@
1798_GL_FUNCDECL_SYS (logbf, float, (float x)); 1758_GL_FUNCDECL_SYS (logbf, float, (float x), );
1799# endif 1759# endif
1800_GL_CXXALIAS_SYS (logbf, float, (float x)); 1760_GL_CXXALIAS_SYS (logbf, float, (float x));
1801# endif 1761# endif
1802_GL_CXXALIASWARN (logbf); 1762_GL_CXXALIASWARN (logbf);
1803#elif defined GNULIB_POSIXCHECK 1763#elif defined GNULIB_POSIXCHECK
1804# undef logbf
1805# if HAVE_RAW_DECL_LOGBF 1764# if HAVE_RAW_DECL_LOGBF
1806_GL_WARN_ON_USE (logbf, "logbf is unportable - " 1765_GL_WARN_ON_USE (logbf, "logbf is unportable - "
1807 "use gnulib module logbf for portability"); 1766 "use gnulib module logbf for portability");
@@ -1814,11 +1773,11 @@ _GL_WARN_ON_USE (logbf, "logbf is unportable - "
1814# undef logb 1773# undef logb
1815# define logb rpl_logb 1774# define logb rpl_logb
1816# endif 1775# endif
1817_GL_FUNCDECL_RPL (logb, double, (double x)); 1776_GL_FUNCDECL_RPL (logb, double, (double x), );
1818_GL_CXXALIAS_RPL (logb, double, (double x)); 1777_GL_CXXALIAS_RPL (logb, double, (double x));
1819# else 1778# else
1820# if !@HAVE_DECL_LOGB@ 1779# if !@HAVE_DECL_LOGB@
1821_GL_FUNCDECL_SYS (logb, double, (double x)); 1780_GL_FUNCDECL_SYS (logb, double, (double x), );
1822# endif 1781# endif
1823_GL_CXXALIAS_SYS (logb, double, (double x)); 1782_GL_CXXALIAS_SYS (logb, double, (double x));
1824# endif 1783# endif
@@ -1826,7 +1785,6 @@ _GL_CXXALIAS_SYS (logb, double, (double x));
1826_GL_CXXALIASWARN1 (logb, double, (double x)); 1785_GL_CXXALIASWARN1 (logb, double, (double x));
1827# endif 1786# endif
1828#elif defined GNULIB_POSIXCHECK 1787#elif defined GNULIB_POSIXCHECK
1829# undef logb
1830# if HAVE_RAW_DECL_LOGB 1788# if HAVE_RAW_DECL_LOGB
1831_GL_WARN_ON_USE (logb, "logb is unportable - " 1789_GL_WARN_ON_USE (logb, "logb is unportable - "
1832 "use gnulib module logb for portability"); 1790 "use gnulib module logb for portability");
@@ -1839,11 +1797,11 @@ _GL_WARN_ON_USE (logb, "logb is unportable - "
1839# undef logbl 1797# undef logbl
1840# define logbl rpl_logbl 1798# define logbl rpl_logbl
1841# endif 1799# endif
1842_GL_FUNCDECL_RPL (logbl, long double, (long double x)); 1800_GL_FUNCDECL_RPL (logbl, long double, (long double x), );
1843_GL_CXXALIAS_RPL (logbl, long double, (long double x)); 1801_GL_CXXALIAS_RPL (logbl, long double, (long double x));
1844# else 1802# else
1845# if !@HAVE_LOGBL@ 1803# if !@HAVE_LOGBL@
1846_GL_FUNCDECL_SYS (logbl, long double, (long double x)); 1804_GL_FUNCDECL_SYS (logbl, long double, (long double x), );
1847# endif 1805# endif
1848_GL_CXXALIAS_SYS (logbl, long double, (long double x)); 1806_GL_CXXALIAS_SYS (logbl, long double, (long double x));
1849# endif 1807# endif
@@ -1851,7 +1809,6 @@ _GL_CXXALIAS_SYS (logbl, long double, (long double x));
1851_GL_CXXALIASWARN (logbl); 1809_GL_CXXALIASWARN (logbl);
1852# endif 1810# endif
1853#elif defined GNULIB_POSIXCHECK 1811#elif defined GNULIB_POSIXCHECK
1854# undef logbl
1855# if HAVE_RAW_DECL_LOGBL 1812# if HAVE_RAW_DECL_LOGBL
1856_GL_WARN_ON_USE (logbl, "logbl is unportable - " 1813_GL_WARN_ON_USE (logbl, "logbl is unportable - "
1857 "use gnulib module logbl for portability"); 1814 "use gnulib module logbl for portability");
@@ -1859,24 +1816,69 @@ _GL_WARN_ON_USE (logbl, "logbl is unportable - "
1859#endif 1816#endif
1860 1817
1861 1818
1819#if @GNULIB_LOGP1F@
1820# if !@HAVE_LOGP1F@
1821_GL_FUNCDECL_SYS (logp1f, float, (float x), );
1822# endif
1823_GL_CXXALIAS_SYS (logp1f, float, (float x));
1824# if __GLIBC__ >= 2
1825_GL_CXXALIASWARN1 (logp1f, float, (float x));
1826# endif
1827#elif defined GNULIB_POSIXCHECK
1828# if HAVE_RAW_DECL_LOGP1F
1829_GL_WARN_ON_USE (logp1f, "logp1f is unportable - "
1830 "use gnulib module logp1f for portability");
1831# endif
1832#endif
1833
1834#if @GNULIB_LOGP1@
1835# if !@HAVE_LOGP1@
1836_GL_FUNCDECL_SYS (logp1, double, (double x), );
1837# endif
1838_GL_CXXALIAS_SYS (logp1, double, (double x));
1839# if __GLIBC__ >= 2
1840_GL_CXXALIASWARN1 (logp1, double, (double x));
1841# endif
1842#elif defined GNULIB_POSIXCHECK
1843# if HAVE_RAW_DECL_LOGP1
1844_GL_WARN_ON_USE (logp1, "logp1 is unportable - "
1845 "use gnulib module logp1 for portability");
1846# endif
1847#endif
1848
1849#if @GNULIB_LOGP1L@
1850# if !@HAVE_LOGP1L@
1851_GL_FUNCDECL_SYS (logp1l, long double, (long double x), );
1852# endif
1853_GL_CXXALIAS_SYS (logp1l, long double, (long double x));
1854# if __GLIBC__ >= 2
1855_GL_CXXALIASWARN1 (logp1l, long double, (long double x));
1856# endif
1857#elif defined GNULIB_POSIXCHECK
1858# if HAVE_RAW_DECL_LOGP1L
1859_GL_WARN_ON_USE (logp1l, "logp1l is unportable - "
1860 "use gnulib module logp1l for portability");
1861# endif
1862#endif
1863
1864
1862#if @GNULIB_MODFF@ 1865#if @GNULIB_MODFF@
1863# if @REPLACE_MODFF@ 1866# if @REPLACE_MODFF@
1864# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1867# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1865# undef modff 1868# undef modff
1866# define modff rpl_modff 1869# define modff rpl_modff
1867# endif 1870# endif
1868_GL_FUNCDECL_RPL (modff, float, (float x, float *iptr) _GL_ARG_NONNULL ((2))); 1871_GL_FUNCDECL_RPL (modff, float, (float x, float *iptr), _GL_ARG_NONNULL ((2)));
1869_GL_CXXALIAS_RPL (modff, float, (float x, float *iptr)); 1872_GL_CXXALIAS_RPL (modff, float, (float x, float *iptr));
1870# else 1873# else
1871# if !@HAVE_MODFF@ 1874# if !@HAVE_MODFF@
1872# undef modff 1875# undef modff
1873_GL_FUNCDECL_SYS (modff, float, (float x, float *iptr) _GL_ARG_NONNULL ((2))); 1876_GL_FUNCDECL_SYS (modff, float, (float x, float *iptr), _GL_ARG_NONNULL ((2)));
1874# endif 1877# endif
1875_GL_CXXALIAS_SYS (modff, float, (float x, float *iptr)); 1878_GL_CXXALIAS_SYS (modff, float, (float x, float *iptr));
1876# endif 1879# endif
1877_GL_CXXALIASWARN (modff); 1880_GL_CXXALIASWARN (modff);
1878#elif defined GNULIB_POSIXCHECK 1881#elif defined GNULIB_POSIXCHECK
1879# undef modff
1880# if HAVE_RAW_DECL_MODFF 1882# if HAVE_RAW_DECL_MODFF
1881_GL_WARN_ON_USE (modff, "modff is unportable - " 1883_GL_WARN_ON_USE (modff, "modff is unportable - "
1882 "use gnulib module modff for portability"); 1884 "use gnulib module modff for portability");
@@ -1889,7 +1891,8 @@ _GL_WARN_ON_USE (modff, "modff is unportable - "
1889# undef modf 1891# undef modf
1890# define modf rpl_modf 1892# define modf rpl_modf
1891# endif 1893# endif
1892_GL_FUNCDECL_RPL (modf, double, (double x, double *iptr) _GL_ARG_NONNULL ((2))); 1894_GL_FUNCDECL_RPL (modf, double, (double x, double *iptr),
1895 _GL_ARG_NONNULL ((2)));
1893_GL_CXXALIAS_RPL (modf, double, (double x, double *iptr)); 1896_GL_CXXALIAS_RPL (modf, double, (double x, double *iptr));
1894# else 1897# else
1895_GL_CXXALIAS_SYS (modf, double, (double x, double *iptr)); 1898_GL_CXXALIAS_SYS (modf, double, (double x, double *iptr));
@@ -1898,7 +1901,6 @@ _GL_CXXALIAS_SYS (modf, double, (double x, double *iptr));
1898_GL_CXXALIASWARN1 (modf, double, (double x, double *iptr)); 1901_GL_CXXALIASWARN1 (modf, double, (double x, double *iptr));
1899# endif 1902# endif
1900#elif defined GNULIB_POSIXCHECK 1903#elif defined GNULIB_POSIXCHECK
1901# undef modf
1902# if HAVE_RAW_DECL_MODF 1904# if HAVE_RAW_DECL_MODF
1903_GL_WARN_ON_USE (modf, "modf has portability problems - " 1905_GL_WARN_ON_USE (modf, "modf has portability problems - "
1904 "use gnulib module modf for portability"); 1906 "use gnulib module modf for portability");
@@ -1911,13 +1913,13 @@ _GL_WARN_ON_USE (modf, "modf has portability problems - "
1911# undef modfl 1913# undef modfl
1912# define modfl rpl_modfl 1914# define modfl rpl_modfl
1913# endif 1915# endif
1914_GL_FUNCDECL_RPL (modfl, long double, (long double x, long double *iptr) 1916_GL_FUNCDECL_RPL (modfl, long double, (long double x, long double *iptr),
1915 _GL_ARG_NONNULL ((2))); 1917 _GL_ARG_NONNULL ((2)));
1916_GL_CXXALIAS_RPL (modfl, long double, (long double x, long double *iptr)); 1918_GL_CXXALIAS_RPL (modfl, long double, (long double x, long double *iptr));
1917# else 1919# else
1918# if !@HAVE_MODFL@ 1920# if !@HAVE_MODFL@
1919# undef modfl 1921# undef modfl
1920_GL_FUNCDECL_SYS (modfl, long double, (long double x, long double *iptr) 1922_GL_FUNCDECL_SYS (modfl, long double, (long double x, long double *iptr),
1921 _GL_ARG_NONNULL ((2))); 1923 _GL_ARG_NONNULL ((2)));
1922# endif 1924# endif
1923_GL_CXXALIAS_SYS (modfl, long double, (long double x, long double *iptr)); 1925_GL_CXXALIAS_SYS (modfl, long double, (long double x, long double *iptr));
@@ -1926,7 +1928,6 @@ _GL_CXXALIAS_SYS (modfl, long double, (long double x, long double *iptr));
1926_GL_CXXALIASWARN (modfl); 1928_GL_CXXALIASWARN (modfl);
1927# endif 1929# endif
1928#elif defined GNULIB_POSIXCHECK 1930#elif defined GNULIB_POSIXCHECK
1929# undef modfl
1930# if HAVE_RAW_DECL_MODFL 1931# if HAVE_RAW_DECL_MODFL
1931_GL_WARN_ON_USE (modfl, "modfl is unportable - " 1932_GL_WARN_ON_USE (modfl, "modfl is unportable - "
1932 "use gnulib module modfl for portability"); 1933 "use gnulib module modfl for portability");
@@ -1937,12 +1938,11 @@ _GL_WARN_ON_USE (modfl, "modfl is unportable - "
1937#if @GNULIB_POWF@ 1938#if @GNULIB_POWF@
1938# if !@HAVE_POWF@ 1939# if !@HAVE_POWF@
1939# undef powf 1940# undef powf
1940_GL_FUNCDECL_SYS (powf, float, (float x, float y)); 1941_GL_FUNCDECL_SYS (powf, float, (float x, float y), );
1941# endif 1942# endif
1942_GL_CXXALIAS_SYS (powf, float, (float x, float y)); 1943_GL_CXXALIAS_SYS (powf, float, (float x, float y));
1943_GL_CXXALIASWARN (powf); 1944_GL_CXXALIASWARN (powf);
1944#elif defined GNULIB_POSIXCHECK 1945#elif defined GNULIB_POSIXCHECK
1945# undef powf
1946# if HAVE_RAW_DECL_POWF 1946# if HAVE_RAW_DECL_POWF
1947_GL_WARN_ON_USE (powf, "powf is unportable - " 1947_GL_WARN_ON_USE (powf, "powf is unportable - "
1948 "use gnulib module powf for portability"); 1948 "use gnulib module powf for portability");
@@ -1956,17 +1956,16 @@ _GL_WARN_ON_USE (powf, "powf is unportable - "
1956# undef remainderf 1956# undef remainderf
1957# define remainderf rpl_remainderf 1957# define remainderf rpl_remainderf
1958# endif 1958# endif
1959_GL_FUNCDECL_RPL (remainderf, float, (float x, float y)); 1959_GL_FUNCDECL_RPL (remainderf, float, (float x, float y), );
1960_GL_CXXALIAS_RPL (remainderf, float, (float x, float y)); 1960_GL_CXXALIAS_RPL (remainderf, float, (float x, float y));
1961# else 1961# else
1962# if !@HAVE_REMAINDERF@ 1962# if !@HAVE_REMAINDERF@
1963_GL_FUNCDECL_SYS (remainderf, float, (float x, float y)); 1963_GL_FUNCDECL_SYS (remainderf, float, (float x, float y), );
1964# endif 1964# endif
1965_GL_CXXALIAS_SYS (remainderf, float, (float x, float y)); 1965_GL_CXXALIAS_SYS (remainderf, float, (float x, float y));
1966# endif 1966# endif
1967_GL_CXXALIASWARN (remainderf); 1967_GL_CXXALIASWARN (remainderf);
1968#elif defined GNULIB_POSIXCHECK 1968#elif defined GNULIB_POSIXCHECK
1969# undef remainderf
1970# if HAVE_RAW_DECL_REMAINDERF 1969# if HAVE_RAW_DECL_REMAINDERF
1971_GL_WARN_ON_USE (remainderf, "remainderf is unportable - " 1970_GL_WARN_ON_USE (remainderf, "remainderf is unportable - "
1972 "use gnulib module remainderf for portability"); 1971 "use gnulib module remainderf for portability");
@@ -1979,11 +1978,11 @@ _GL_WARN_ON_USE (remainderf, "remainderf is unportable - "
1979# undef remainder 1978# undef remainder
1980# define remainder rpl_remainder 1979# define remainder rpl_remainder
1981# endif 1980# endif
1982_GL_FUNCDECL_RPL (remainder, double, (double x, double y)); 1981_GL_FUNCDECL_RPL (remainder, double, (double x, double y), );
1983_GL_CXXALIAS_RPL (remainder, double, (double x, double y)); 1982_GL_CXXALIAS_RPL (remainder, double, (double x, double y));
1984# else 1983# else
1985# if !@HAVE_REMAINDER@ || !@HAVE_DECL_REMAINDER@ 1984# if !@HAVE_REMAINDER@
1986_GL_FUNCDECL_SYS (remainder, double, (double x, double y)); 1985_GL_FUNCDECL_SYS (remainder, double, (double x, double y), );
1987# endif 1986# endif
1988_GL_CXXALIAS_SYS (remainder, double, (double x, double y)); 1987_GL_CXXALIAS_SYS (remainder, double, (double x, double y));
1989# endif 1988# endif
@@ -1991,7 +1990,6 @@ _GL_CXXALIAS_SYS (remainder, double, (double x, double y));
1991_GL_CXXALIASWARN1 (remainder, double, (double x, double y)); 1990_GL_CXXALIASWARN1 (remainder, double, (double x, double y));
1992# endif 1991# endif
1993#elif defined GNULIB_POSIXCHECK 1992#elif defined GNULIB_POSIXCHECK
1994# undef remainder
1995# if HAVE_RAW_DECL_REMAINDER 1993# if HAVE_RAW_DECL_REMAINDER
1996_GL_WARN_ON_USE (remainder, "remainder is unportable - " 1994_GL_WARN_ON_USE (remainder, "remainder is unportable - "
1997 "use gnulib module remainder for portability"); 1995 "use gnulib module remainder for portability");
@@ -2004,13 +2002,13 @@ _GL_WARN_ON_USE (remainder, "remainder is unportable - "
2004# undef remainderl 2002# undef remainderl
2005# define remainderl rpl_remainderl 2003# define remainderl rpl_remainderl
2006# endif 2004# endif
2007_GL_FUNCDECL_RPL (remainderl, long double, (long double x, long double y)); 2005_GL_FUNCDECL_RPL (remainderl, long double, (long double x, long double y), );
2008_GL_CXXALIAS_RPL (remainderl, long double, (long double x, long double y)); 2006_GL_CXXALIAS_RPL (remainderl, long double, (long double x, long double y));
2009# else 2007# else
2010# if !@HAVE_DECL_REMAINDERL@ 2008# if !@HAVE_REMAINDERL@
2011# undef remainderl 2009# undef remainderl
2012# if !(defined __cplusplus && defined _AIX) 2010# if !(defined __cplusplus && defined _AIX)
2013_GL_FUNCDECL_SYS (remainderl, long double, (long double x, long double y)); 2011_GL_FUNCDECL_SYS (remainderl, long double, (long double x, long double y), );
2014# endif 2012# endif
2015# endif 2013# endif
2016_GL_CXXALIAS_SYS (remainderl, long double, (long double x, long double y)); 2014_GL_CXXALIAS_SYS (remainderl, long double, (long double x, long double y));
@@ -2019,7 +2017,6 @@ _GL_CXXALIAS_SYS (remainderl, long double, (long double x, long double y));
2019_GL_CXXALIASWARN (remainderl); 2017_GL_CXXALIASWARN (remainderl);
2020# endif 2018# endif
2021#elif defined GNULIB_POSIXCHECK 2019#elif defined GNULIB_POSIXCHECK
2022# undef remainderl
2023# if HAVE_RAW_DECL_REMAINDERL 2020# if HAVE_RAW_DECL_REMAINDERL
2024_GL_WARN_ON_USE (remainderl, "remainderl is unportable - " 2021_GL_WARN_ON_USE (remainderl, "remainderl is unportable - "
2025 "use gnulib module remainderl for portability"); 2022 "use gnulib module remainderl for portability");
@@ -2028,13 +2025,12 @@ _GL_WARN_ON_USE (remainderl, "remainderl is unportable - "
2028 2025
2029 2026
2030#if @GNULIB_RINTF@ 2027#if @GNULIB_RINTF@
2031# if !@HAVE_DECL_RINTF@ 2028# if !@HAVE_RINTF@
2032_GL_FUNCDECL_SYS (rintf, float, (float x)); 2029_GL_FUNCDECL_SYS (rintf, float, (float x), );
2033# endif 2030# endif
2034_GL_CXXALIAS_SYS (rintf, float, (float x)); 2031_GL_CXXALIAS_SYS (rintf, float, (float x));
2035_GL_CXXALIASWARN (rintf); 2032_GL_CXXALIASWARN (rintf);
2036#elif defined GNULIB_POSIXCHECK 2033#elif defined GNULIB_POSIXCHECK
2037# undef rintf
2038# if HAVE_RAW_DECL_RINTF 2034# if HAVE_RAW_DECL_RINTF
2039_GL_WARN_ON_USE (rintf, "rintf is unportable - " 2035_GL_WARN_ON_USE (rintf, "rintf is unportable - "
2040 "use gnulib module rintf for portability"); 2036 "use gnulib module rintf for portability");
@@ -2043,14 +2039,13 @@ _GL_WARN_ON_USE (rintf, "rintf is unportable - "
2043 2039
2044#if @GNULIB_RINT@ 2040#if @GNULIB_RINT@
2045# if !@HAVE_RINT@ 2041# if !@HAVE_RINT@
2046_GL_FUNCDECL_SYS (rint, double, (double x)); 2042_GL_FUNCDECL_SYS (rint, double, (double x), );
2047# endif 2043# endif
2048_GL_CXXALIAS_SYS (rint, double, (double x)); 2044_GL_CXXALIAS_SYS (rint, double, (double x));
2049# if __GLIBC__ >= 2 2045# if __GLIBC__ >= 2
2050_GL_CXXALIASWARN1 (rint, double, (double x)); 2046_GL_CXXALIASWARN1 (rint, double, (double x));
2051# endif 2047# endif
2052#elif defined GNULIB_POSIXCHECK 2048#elif defined GNULIB_POSIXCHECK
2053# undef rint
2054# if HAVE_RAW_DECL_RINT 2049# if HAVE_RAW_DECL_RINT
2055_GL_WARN_ON_USE (rint, "rint is unportable - " 2050_GL_WARN_ON_USE (rint, "rint is unportable - "
2056 "use gnulib module rint for portability"); 2051 "use gnulib module rint for portability");
@@ -2063,11 +2058,11 @@ _GL_WARN_ON_USE (rint, "rint is unportable - "
2063# undef rintl 2058# undef rintl
2064# define rintl rpl_rintl 2059# define rintl rpl_rintl
2065# endif 2060# endif
2066_GL_FUNCDECL_RPL (rintl, long double, (long double x)); 2061_GL_FUNCDECL_RPL (rintl, long double, (long double x), );
2067_GL_CXXALIAS_RPL (rintl, long double, (long double x)); 2062_GL_CXXALIAS_RPL (rintl, long double, (long double x));
2068# else 2063# else
2069# if !@HAVE_RINTL@ 2064# if !@HAVE_RINTL@
2070_GL_FUNCDECL_SYS (rintl, long double, (long double x)); 2065_GL_FUNCDECL_SYS (rintl, long double, (long double x), );
2071# endif 2066# endif
2072_GL_CXXALIAS_SYS (rintl, long double, (long double x)); 2067_GL_CXXALIAS_SYS (rintl, long double, (long double x));
2073# endif 2068# endif
@@ -2075,7 +2070,6 @@ _GL_CXXALIAS_SYS (rintl, long double, (long double x));
2075_GL_CXXALIASWARN (rintl); 2070_GL_CXXALIASWARN (rintl);
2076# endif 2071# endif
2077#elif defined GNULIB_POSIXCHECK 2072#elif defined GNULIB_POSIXCHECK
2078# undef rintl
2079# if HAVE_RAW_DECL_RINTL 2073# if HAVE_RAW_DECL_RINTL
2080_GL_WARN_ON_USE (rintl, "rintl is unportable - " 2074_GL_WARN_ON_USE (rintl, "rintl is unportable - "
2081 "use gnulib module rintl for portability"); 2075 "use gnulib module rintl for portability");
@@ -2089,17 +2083,16 @@ _GL_WARN_ON_USE (rintl, "rintl is unportable - "
2089# undef roundf 2083# undef roundf
2090# define roundf rpl_roundf 2084# define roundf rpl_roundf
2091# endif 2085# endif
2092_GL_FUNCDECL_RPL (roundf, float, (float x)); 2086_GL_FUNCDECL_RPL (roundf, float, (float x), );
2093_GL_CXXALIAS_RPL (roundf, float, (float x)); 2087_GL_CXXALIAS_RPL (roundf, float, (float x));
2094# else 2088# else
2095# if !@HAVE_DECL_ROUNDF@ 2089# if !@HAVE_ROUNDF@
2096_GL_FUNCDECL_SYS (roundf, float, (float x)); 2090_GL_FUNCDECL_SYS (roundf, float, (float x), );
2097# endif 2091# endif
2098_GL_CXXALIAS_SYS (roundf, float, (float x)); 2092_GL_CXXALIAS_SYS (roundf, float, (float x));
2099# endif 2093# endif
2100_GL_CXXALIASWARN (roundf); 2094_GL_CXXALIASWARN (roundf);
2101#elif defined GNULIB_POSIXCHECK 2095#elif defined GNULIB_POSIXCHECK
2102# undef roundf
2103# if HAVE_RAW_DECL_ROUNDF 2096# if HAVE_RAW_DECL_ROUNDF
2104_GL_WARN_ON_USE (roundf, "roundf is unportable - " 2097_GL_WARN_ON_USE (roundf, "roundf is unportable - "
2105 "use gnulib module roundf for portability"); 2098 "use gnulib module roundf for portability");
@@ -2112,11 +2105,11 @@ _GL_WARN_ON_USE (roundf, "roundf is unportable - "
2112# undef round 2105# undef round
2113# define round rpl_round 2106# define round rpl_round
2114# endif 2107# endif
2115_GL_FUNCDECL_RPL (round, double, (double x)); 2108_GL_FUNCDECL_RPL (round, double, (double x), );
2116_GL_CXXALIAS_RPL (round, double, (double x)); 2109_GL_CXXALIAS_RPL (round, double, (double x));
2117# else 2110# else
2118# if !@HAVE_DECL_ROUND@ 2111# if !@HAVE_ROUND@
2119_GL_FUNCDECL_SYS (round, double, (double x)); 2112_GL_FUNCDECL_SYS (round, double, (double x), );
2120# endif 2113# endif
2121_GL_CXXALIAS_SYS (round, double, (double x)); 2114_GL_CXXALIAS_SYS (round, double, (double x));
2122# endif 2115# endif
@@ -2124,7 +2117,6 @@ _GL_CXXALIAS_SYS (round, double, (double x));
2124_GL_CXXALIASWARN1 (round, double, (double x)); 2117_GL_CXXALIASWARN1 (round, double, (double x));
2125# endif 2118# endif
2126#elif defined GNULIB_POSIXCHECK 2119#elif defined GNULIB_POSIXCHECK
2127# undef round
2128# if HAVE_RAW_DECL_ROUND 2120# if HAVE_RAW_DECL_ROUND
2129_GL_WARN_ON_USE (round, "round is unportable - " 2121_GL_WARN_ON_USE (round, "round is unportable - "
2130 "use gnulib module round for portability"); 2122 "use gnulib module round for portability");
@@ -2137,13 +2129,13 @@ _GL_WARN_ON_USE (round, "round is unportable - "
2137# undef roundl 2129# undef roundl
2138# define roundl rpl_roundl 2130# define roundl rpl_roundl
2139# endif 2131# endif
2140_GL_FUNCDECL_RPL (roundl, long double, (long double x)); 2132_GL_FUNCDECL_RPL (roundl, long double, (long double x), );
2141_GL_CXXALIAS_RPL (roundl, long double, (long double x)); 2133_GL_CXXALIAS_RPL (roundl, long double, (long double x));
2142# else 2134# else
2143# if !@HAVE_DECL_ROUNDL@ 2135# if !@HAVE_ROUNDL@
2144# undef roundl 2136# undef roundl
2145# if !(defined __cplusplus && defined _AIX) 2137# if !(defined __cplusplus && defined _AIX)
2146_GL_FUNCDECL_SYS (roundl, long double, (long double x)); 2138_GL_FUNCDECL_SYS (roundl, long double, (long double x), );
2147# endif 2139# endif
2148# endif 2140# endif
2149_GL_CXXALIAS_SYS (roundl, long double, (long double x)); 2141_GL_CXXALIAS_SYS (roundl, long double, (long double x));
@@ -2152,7 +2144,6 @@ _GL_CXXALIAS_SYS (roundl, long double, (long double x));
2152_GL_CXXALIASWARN (roundl); 2144_GL_CXXALIASWARN (roundl);
2153# endif 2145# endif
2154#elif defined GNULIB_POSIXCHECK 2146#elif defined GNULIB_POSIXCHECK
2155# undef roundl
2156# if HAVE_RAW_DECL_ROUNDL 2147# if HAVE_RAW_DECL_ROUNDL
2157_GL_WARN_ON_USE (roundl, "roundl is unportable - " 2148_GL_WARN_ON_USE (roundl, "roundl is unportable - "
2158 "use gnulib module roundl for portability"); 2149 "use gnulib module roundl for portability");
@@ -2166,18 +2157,17 @@ _GL_WARN_ON_USE (roundl, "roundl is unportable - "
2166# undef sinf 2157# undef sinf
2167# define sinf rpl_sinf 2158# define sinf rpl_sinf
2168# endif 2159# endif
2169_GL_FUNCDECL_RPL (sinf, float, (float x)); 2160_GL_FUNCDECL_RPL (sinf, float, (float x), );
2170_GL_CXXALIAS_RPL (sinf, float, (float x)); 2161_GL_CXXALIAS_RPL (sinf, float, (float x));
2171# else 2162# else
2172# if !@HAVE_SINF@ 2163# if !@HAVE_SINF@
2173# undef sinf 2164# undef sinf
2174_GL_FUNCDECL_SYS (sinf, float, (float x)); 2165_GL_FUNCDECL_SYS (sinf, float, (float x), );
2175# endif 2166# endif
2176_GL_CXXALIAS_SYS (sinf, float, (float x)); 2167_GL_CXXALIAS_SYS (sinf, float, (float x));
2177# endif 2168# endif
2178_GL_CXXALIASWARN (sinf); 2169_GL_CXXALIASWARN (sinf);
2179#elif defined GNULIB_POSIXCHECK 2170#elif defined GNULIB_POSIXCHECK
2180# undef sinf
2181# if HAVE_RAW_DECL_SINF 2171# if HAVE_RAW_DECL_SINF
2182_GL_WARN_ON_USE (sinf, "sinf is unportable - " 2172_GL_WARN_ON_USE (sinf, "sinf is unportable - "
2183 "use gnulib module sinf for portability"); 2173 "use gnulib module sinf for portability");
@@ -2185,16 +2175,24 @@ _GL_WARN_ON_USE (sinf, "sinf is unportable - "
2185#endif 2175#endif
2186 2176
2187#if @GNULIB_SINL@ 2177#if @GNULIB_SINL@
2188# if !@HAVE_SINL@ || !@HAVE_DECL_SINL@ 2178# if @REPLACE_SINL@
2189# undef sinl 2179# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2190_GL_FUNCDECL_SYS (sinl, long double, (long double x)); 2180# undef sinl
2191# endif 2181# define sinl rpl_sinl
2182# endif
2183_GL_FUNCDECL_RPL (sinl, long double, (long double x), );
2184_GL_CXXALIAS_RPL (sinl, long double, (long double x));
2185# else
2186# if !@HAVE_SINL@ || !@HAVE_DECL_SINL@
2187# undef sinl
2188_GL_FUNCDECL_SYS (sinl, long double, (long double x), );
2189# endif
2192_GL_CXXALIAS_SYS (sinl, long double, (long double x)); 2190_GL_CXXALIAS_SYS (sinl, long double, (long double x));
2191# endif
2193# if __GLIBC__ >= 2 2192# if __GLIBC__ >= 2
2194_GL_CXXALIASWARN (sinl); 2193_GL_CXXALIASWARN (sinl);
2195# endif 2194# endif
2196#elif defined GNULIB_POSIXCHECK 2195#elif defined GNULIB_POSIXCHECK
2197# undef sinl
2198# if HAVE_RAW_DECL_SINL 2196# if HAVE_RAW_DECL_SINL
2199_GL_WARN_ON_USE (sinl, "sinl is unportable - " 2197_GL_WARN_ON_USE (sinl, "sinl is unportable - "
2200 "use gnulib module sinl for portability"); 2198 "use gnulib module sinl for portability");
@@ -2208,18 +2206,17 @@ _GL_WARN_ON_USE (sinl, "sinl is unportable - "
2208# undef sinhf 2206# undef sinhf
2209# define sinhf rpl_sinhf 2207# define sinhf rpl_sinhf
2210# endif 2208# endif
2211_GL_FUNCDECL_RPL (sinhf, float, (float x)); 2209_GL_FUNCDECL_RPL (sinhf, float, (float x), );
2212_GL_CXXALIAS_RPL (sinhf, float, (float x)); 2210_GL_CXXALIAS_RPL (sinhf, float, (float x));
2213# else 2211# else
2214# if !@HAVE_SINHF@ 2212# if !@HAVE_SINHF@
2215# undef sinhf 2213# undef sinhf
2216_GL_FUNCDECL_SYS (sinhf, float, (float x)); 2214_GL_FUNCDECL_SYS (sinhf, float, (float x), );
2217# endif 2215# endif
2218_GL_CXXALIAS_SYS (sinhf, float, (float x)); 2216_GL_CXXALIAS_SYS (sinhf, float, (float x));
2219# endif 2217# endif
2220_GL_CXXALIASWARN (sinhf); 2218_GL_CXXALIASWARN (sinhf);
2221#elif defined GNULIB_POSIXCHECK 2219#elif defined GNULIB_POSIXCHECK
2222# undef sinhf
2223# if HAVE_RAW_DECL_SINHF 2220# if HAVE_RAW_DECL_SINHF
2224_GL_WARN_ON_USE (sinhf, "sinhf is unportable - " 2221_GL_WARN_ON_USE (sinhf, "sinhf is unportable - "
2225 "use gnulib module sinhf for portability"); 2222 "use gnulib module sinhf for portability");
@@ -2233,18 +2230,17 @@ _GL_WARN_ON_USE (sinhf, "sinhf is unportable - "
2233# undef sqrtf 2230# undef sqrtf
2234# define sqrtf rpl_sqrtf 2231# define sqrtf rpl_sqrtf
2235# endif 2232# endif
2236_GL_FUNCDECL_RPL (sqrtf, float, (float x)); 2233_GL_FUNCDECL_RPL (sqrtf, float, (float x), );
2237_GL_CXXALIAS_RPL (sqrtf, float, (float x)); 2234_GL_CXXALIAS_RPL (sqrtf, float, (float x));
2238# else 2235# else
2239# if !@HAVE_SQRTF@ 2236# if !@HAVE_SQRTF@
2240# undef sqrtf 2237# undef sqrtf
2241_GL_FUNCDECL_SYS (sqrtf, float, (float x)); 2238_GL_FUNCDECL_SYS (sqrtf, float, (float x), );
2242# endif 2239# endif
2243_GL_CXXALIAS_SYS (sqrtf, float, (float x)); 2240_GL_CXXALIAS_SYS (sqrtf, float, (float x));
2244# endif 2241# endif
2245_GL_CXXALIASWARN (sqrtf); 2242_GL_CXXALIASWARN (sqrtf);
2246#elif defined GNULIB_POSIXCHECK 2243#elif defined GNULIB_POSIXCHECK
2247# undef sqrtf
2248# if HAVE_RAW_DECL_SQRTF 2244# if HAVE_RAW_DECL_SQRTF
2249_GL_WARN_ON_USE (sqrtf, "sqrtf is unportable - " 2245_GL_WARN_ON_USE (sqrtf, "sqrtf is unportable - "
2250 "use gnulib module sqrtf for portability"); 2246 "use gnulib module sqrtf for portability");
@@ -2257,12 +2253,12 @@ _GL_WARN_ON_USE (sqrtf, "sqrtf is unportable - "
2257# undef sqrtl 2253# undef sqrtl
2258# define sqrtl rpl_sqrtl 2254# define sqrtl rpl_sqrtl
2259# endif 2255# endif
2260_GL_FUNCDECL_RPL (sqrtl, long double, (long double x)); 2256_GL_FUNCDECL_RPL (sqrtl, long double, (long double x), );
2261_GL_CXXALIAS_RPL (sqrtl, long double, (long double x)); 2257_GL_CXXALIAS_RPL (sqrtl, long double, (long double x));
2262# else 2258# else
2263# if !@HAVE_SQRTL@ || !@HAVE_DECL_SQRTL@ 2259# if !@HAVE_SQRTL@ || !@HAVE_DECL_SQRTL@
2264# undef sqrtl 2260# undef sqrtl
2265_GL_FUNCDECL_SYS (sqrtl, long double, (long double x)); 2261_GL_FUNCDECL_SYS (sqrtl, long double, (long double x), );
2266# endif 2262# endif
2267_GL_CXXALIAS_SYS (sqrtl, long double, (long double x)); 2263_GL_CXXALIAS_SYS (sqrtl, long double, (long double x));
2268# endif 2264# endif
@@ -2270,7 +2266,6 @@ _GL_CXXALIAS_SYS (sqrtl, long double, (long double x));
2270_GL_CXXALIASWARN (sqrtl); 2266_GL_CXXALIASWARN (sqrtl);
2271# endif 2267# endif
2272#elif defined GNULIB_POSIXCHECK 2268#elif defined GNULIB_POSIXCHECK
2273# undef sqrtl
2274# if HAVE_RAW_DECL_SQRTL 2269# if HAVE_RAW_DECL_SQRTL
2275_GL_WARN_ON_USE (sqrtl, "sqrtl is unportable - " 2270_GL_WARN_ON_USE (sqrtl, "sqrtl is unportable - "
2276 "use gnulib module sqrtl for portability"); 2271 "use gnulib module sqrtl for portability");
@@ -2284,18 +2279,17 @@ _GL_WARN_ON_USE (sqrtl, "sqrtl is unportable - "
2284# undef tanf 2279# undef tanf
2285# define tanf rpl_tanf 2280# define tanf rpl_tanf
2286# endif 2281# endif
2287_GL_FUNCDECL_RPL (tanf, float, (float x)); 2282_GL_FUNCDECL_RPL (tanf, float, (float x), );
2288_GL_CXXALIAS_RPL (tanf, float, (float x)); 2283_GL_CXXALIAS_RPL (tanf, float, (float x));
2289# else 2284# else
2290# if !@HAVE_TANF@ 2285# if !@HAVE_TANF@
2291# undef tanf 2286# undef tanf
2292_GL_FUNCDECL_SYS (tanf, float, (float x)); 2287_GL_FUNCDECL_SYS (tanf, float, (float x), );
2293# endif 2288# endif
2294_GL_CXXALIAS_SYS (tanf, float, (float x)); 2289_GL_CXXALIAS_SYS (tanf, float, (float x));
2295# endif 2290# endif
2296_GL_CXXALIASWARN (tanf); 2291_GL_CXXALIASWARN (tanf);
2297#elif defined GNULIB_POSIXCHECK 2292#elif defined GNULIB_POSIXCHECK
2298# undef tanf
2299# if HAVE_RAW_DECL_TANF 2293# if HAVE_RAW_DECL_TANF
2300_GL_WARN_ON_USE (tanf, "tanf is unportable - " 2294_GL_WARN_ON_USE (tanf, "tanf is unportable - "
2301 "use gnulib module tanf for portability"); 2295 "use gnulib module tanf for portability");
@@ -2305,14 +2299,13 @@ _GL_WARN_ON_USE (tanf, "tanf is unportable - "
2305#if @GNULIB_TANL@ 2299#if @GNULIB_TANL@
2306# if !@HAVE_TANL@ || !@HAVE_DECL_TANL@ 2300# if !@HAVE_TANL@ || !@HAVE_DECL_TANL@
2307# undef tanl 2301# undef tanl
2308_GL_FUNCDECL_SYS (tanl, long double, (long double x)); 2302_GL_FUNCDECL_SYS (tanl, long double, (long double x), );
2309# endif 2303# endif
2310_GL_CXXALIAS_SYS (tanl, long double, (long double x)); 2304_GL_CXXALIAS_SYS (tanl, long double, (long double x));
2311# if __GLIBC__ >= 2 2305# if __GLIBC__ >= 2
2312_GL_CXXALIASWARN (tanl); 2306_GL_CXXALIASWARN (tanl);
2313# endif 2307# endif
2314#elif defined GNULIB_POSIXCHECK 2308#elif defined GNULIB_POSIXCHECK
2315# undef tanl
2316# if HAVE_RAW_DECL_TANL 2309# if HAVE_RAW_DECL_TANL
2317_GL_WARN_ON_USE (tanl, "tanl is unportable - " 2310_GL_WARN_ON_USE (tanl, "tanl is unportable - "
2318 "use gnulib module tanl for portability"); 2311 "use gnulib module tanl for portability");
@@ -2326,18 +2319,17 @@ _GL_WARN_ON_USE (tanl, "tanl is unportable - "
2326# undef tanhf 2319# undef tanhf
2327# define tanhf rpl_tanhf 2320# define tanhf rpl_tanhf
2328# endif 2321# endif
2329_GL_FUNCDECL_RPL (tanhf, float, (float x)); 2322_GL_FUNCDECL_RPL (tanhf, float, (float x), );
2330_GL_CXXALIAS_RPL (tanhf, float, (float x)); 2323_GL_CXXALIAS_RPL (tanhf, float, (float x));
2331# else 2324# else
2332# if !@HAVE_TANHF@ 2325# if !@HAVE_TANHF@
2333# undef tanhf 2326# undef tanhf
2334_GL_FUNCDECL_SYS (tanhf, float, (float x)); 2327_GL_FUNCDECL_SYS (tanhf, float, (float x), );
2335# endif 2328# endif
2336_GL_CXXALIAS_SYS (tanhf, float, (float x)); 2329_GL_CXXALIAS_SYS (tanhf, float, (float x));
2337# endif 2330# endif
2338_GL_CXXALIASWARN (tanhf); 2331_GL_CXXALIASWARN (tanhf);
2339#elif defined GNULIB_POSIXCHECK 2332#elif defined GNULIB_POSIXCHECK
2340# undef tanhf
2341# if HAVE_RAW_DECL_TANHF 2333# if HAVE_RAW_DECL_TANHF
2342_GL_WARN_ON_USE (tanhf, "tanhf is unportable - " 2334_GL_WARN_ON_USE (tanhf, "tanhf is unportable - "
2343 "use gnulib module tanhf for portability"); 2335 "use gnulib module tanhf for portability");
@@ -2351,17 +2343,16 @@ _GL_WARN_ON_USE (tanhf, "tanhf is unportable - "
2351# undef truncf 2343# undef truncf
2352# define truncf rpl_truncf 2344# define truncf rpl_truncf
2353# endif 2345# endif
2354_GL_FUNCDECL_RPL (truncf, float, (float x)); 2346_GL_FUNCDECL_RPL (truncf, float, (float x), );
2355_GL_CXXALIAS_RPL (truncf, float, (float x)); 2347_GL_CXXALIAS_RPL (truncf, float, (float x));
2356# else 2348# else
2357# if !@HAVE_DECL_TRUNCF@ 2349# if !@HAVE_DECL_TRUNCF@
2358_GL_FUNCDECL_SYS (truncf, float, (float x)); 2350_GL_FUNCDECL_SYS (truncf, float, (float x), );
2359# endif 2351# endif
2360_GL_CXXALIAS_SYS (truncf, float, (float x)); 2352_GL_CXXALIAS_SYS (truncf, float, (float x));
2361# endif 2353# endif
2362_GL_CXXALIASWARN (truncf); 2354_GL_CXXALIASWARN (truncf);
2363#elif defined GNULIB_POSIXCHECK 2355#elif defined GNULIB_POSIXCHECK
2364# undef truncf
2365# if HAVE_RAW_DECL_TRUNCF 2356# if HAVE_RAW_DECL_TRUNCF
2366_GL_WARN_ON_USE (truncf, "truncf is unportable - " 2357_GL_WARN_ON_USE (truncf, "truncf is unportable - "
2367 "use gnulib module truncf for portability"); 2358 "use gnulib module truncf for portability");
@@ -2374,11 +2365,11 @@ _GL_WARN_ON_USE (truncf, "truncf is unportable - "
2374# undef trunc 2365# undef trunc
2375# define trunc rpl_trunc 2366# define trunc rpl_trunc
2376# endif 2367# endif
2377_GL_FUNCDECL_RPL (trunc, double, (double x)); 2368_GL_FUNCDECL_RPL (trunc, double, (double x), );
2378_GL_CXXALIAS_RPL (trunc, double, (double x)); 2369_GL_CXXALIAS_RPL (trunc, double, (double x));
2379# else 2370# else
2380# if !@HAVE_DECL_TRUNC@ 2371# if !@HAVE_DECL_TRUNC@
2381_GL_FUNCDECL_SYS (trunc, double, (double x)); 2372_GL_FUNCDECL_SYS (trunc, double, (double x), );
2382# endif 2373# endif
2383_GL_CXXALIAS_SYS (trunc, double, (double x)); 2374_GL_CXXALIAS_SYS (trunc, double, (double x));
2384# endif 2375# endif
@@ -2386,7 +2377,6 @@ _GL_CXXALIAS_SYS (trunc, double, (double x));
2386_GL_CXXALIASWARN1 (trunc, double, (double x)); 2377_GL_CXXALIASWARN1 (trunc, double, (double x));
2387# endif 2378# endif
2388#elif defined GNULIB_POSIXCHECK 2379#elif defined GNULIB_POSIXCHECK
2389# undef trunc
2390# if HAVE_RAW_DECL_TRUNC 2380# if HAVE_RAW_DECL_TRUNC
2391_GL_WARN_ON_USE (trunc, "trunc is unportable - " 2381_GL_WARN_ON_USE (trunc, "trunc is unportable - "
2392 "use gnulib module trunc for portability"); 2382 "use gnulib module trunc for portability");
@@ -2399,11 +2389,11 @@ _GL_WARN_ON_USE (trunc, "trunc is unportable - "
2399# undef truncl 2389# undef truncl
2400# define truncl rpl_truncl 2390# define truncl rpl_truncl
2401# endif 2391# endif
2402_GL_FUNCDECL_RPL (truncl, long double, (long double x)); 2392_GL_FUNCDECL_RPL (truncl, long double, (long double x), );
2403_GL_CXXALIAS_RPL (truncl, long double, (long double x)); 2393_GL_CXXALIAS_RPL (truncl, long double, (long double x));
2404# else 2394# else
2405# if !@HAVE_DECL_TRUNCL@ 2395# if !@HAVE_DECL_TRUNCL@
2406_GL_FUNCDECL_SYS (truncl, long double, (long double x)); 2396_GL_FUNCDECL_SYS (truncl, long double, (long double x), );
2407# endif 2397# endif
2408_GL_CXXALIAS_SYS (truncl, long double, (long double x)); 2398_GL_CXXALIAS_SYS (truncl, long double, (long double x));
2409# endif 2399# endif
@@ -2411,7 +2401,6 @@ _GL_CXXALIAS_SYS (truncl, long double, (long double x));
2411_GL_CXXALIASWARN (truncl); 2401_GL_CXXALIASWARN (truncl);
2412# endif 2402# endif
2413#elif defined GNULIB_POSIXCHECK 2403#elif defined GNULIB_POSIXCHECK
2414# undef truncl
2415# if HAVE_RAW_DECL_TRUNCL 2404# if HAVE_RAW_DECL_TRUNCL
2416_GL_WARN_ON_USE (truncl, "truncl is unportable - " 2405_GL_WARN_ON_USE (truncl, "truncl is unportable - "
2417 "use gnulib module truncl for portability"); 2406 "use gnulib module truncl for portability");
@@ -2472,22 +2461,29 @@ _GL_CXXALIASWARN (yn);
2472 declarations. */ 2461 declarations. */
2473 2462
2474 2463
2475#if @GNULIB_ISFINITE@ 2464#if @GNULIB_ISFINITE@ || @GNULIB_ISFINITE_NO_CXX@
2476# if @REPLACE_ISFINITE@ 2465# if @REPLACE_ISFINITE@
2477_GL_EXTERN_C int gl_isfinitef (float x); 2466_GL_EXTERN_C int gl_isfinitef (float x);
2478_GL_EXTERN_C int gl_isfinited (double x); 2467_GL_EXTERN_C int gl_isfinited (double x);
2479_GL_EXTERN_C int gl_isfinitel (long double x); 2468_GL_EXTERN_C int gl_isfinitel (long double x);
2480# undef isfinite 2469# ifdef __cplusplus
2481# define isfinite(x) \ 2470template <typename T> int isfinite (T);
2482 (sizeof (x) == sizeof (long double) ? gl_isfinitel (x) : \ 2471template <> inline int isfinite<float> (float x) { return gl_isfinitef (x); }
2483 sizeof (x) == sizeof (double) ? gl_isfinited (x) : \ 2472template <> inline int isfinite<double> (double x) { return gl_isfinited (x); }
2484 gl_isfinitef (x)) 2473template <> inline int isfinite<long double> (long double x) { return gl_isfinitel (x); }
2474# else
2475# undef isfinite
2476# define isfinite(x) \
2477 (sizeof (x) == sizeof (long double) ? gl_isfinitel (x) : \
2478 sizeof (x) == sizeof (double) ? gl_isfinited (x) : \
2479 gl_isfinitef (x))
2480# endif
2485# endif 2481# endif
2486# ifdef __cplusplus 2482# if @GNULIB_ISFINITE@ && defined __cplusplus
2487# if defined isfinite || defined GNULIB_NAMESPACE 2483# if defined isfinite || defined GNULIB_NAMESPACE
2488_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isfinite) 2484_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isfinite)
2489# undef isfinite 2485# undef isfinite
2490# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || defined _AIX || (defined _WIN32 && !defined __CYGWIN__))) 2486# if __GNUC__ >= 6 || (defined __clang__ && (__clang_major__ >= 19 || !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || defined _AIX || (defined _WIN32 && !defined __CYGWIN__))))
2491 /* This platform's <cmath> possibly defines isfinite through a set of inline 2487 /* This platform's <cmath> possibly defines isfinite through a set of inline
2492 functions. */ 2488 functions. */
2493_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite, rpl_isfinite, bool) 2489_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite, rpl_isfinite, bool)
@@ -2507,18 +2503,25 @@ _GL_WARN_REAL_FLOATING_DECL (isfinite);
2507#endif 2503#endif
2508 2504
2509 2505
2510#if @GNULIB_ISINF@ 2506#if @GNULIB_ISINF@ || @GNULIB_ISINF_NO_CXX@
2511# if @REPLACE_ISINF@ 2507# if @REPLACE_ISINF@
2512_GL_EXTERN_C int gl_isinff (float x); 2508_GL_EXTERN_C int gl_isinff (float x);
2513_GL_EXTERN_C int gl_isinfd (double x); 2509_GL_EXTERN_C int gl_isinfd (double x);
2514_GL_EXTERN_C int gl_isinfl (long double x); 2510_GL_EXTERN_C int gl_isinfl (long double x);
2515# undef isinf 2511# ifdef __cplusplus
2516# define isinf(x) \ 2512template <typename T> int isinf (T);
2517 (sizeof (x) == sizeof (long double) ? gl_isinfl (x) : \ 2513template <> inline int isinf<float> (float x) { return gl_isinff (x); }
2518 sizeof (x) == sizeof (double) ? gl_isinfd (x) : \ 2514template <> inline int isinf<double> (double x) { return gl_isinfd (x); }
2519 gl_isinff (x)) 2515template <> inline int isinf<long double> (long double x) { return gl_isinfl (x); }
2516# else
2517# undef isinf
2518# define isinf(x) \
2519 (sizeof (x) == sizeof (long double) ? gl_isinfl (x) : \
2520 sizeof (x) == sizeof (double) ? gl_isinfd (x) : \
2521 gl_isinff (x))
2522# endif
2520# endif 2523# endif
2521# ifdef __cplusplus 2524# if @GNULIB_ISINF@ && defined __cplusplus
2522# if defined isinf || defined GNULIB_NAMESPACE 2525# if defined isinf || defined GNULIB_NAMESPACE
2523_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isinf) 2526_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isinf)
2524# undef isinf 2527# undef isinf
@@ -2545,9 +2548,9 @@ _GL_WARN_REAL_FLOATING_DECL (isinf);
2545#if @GNULIB_ISNANF@ 2548#if @GNULIB_ISNANF@
2546/* Test for NaN for 'float' numbers. */ 2549/* Test for NaN for 'float' numbers. */
2547# if @HAVE_ISNANF@ 2550# if @HAVE_ISNANF@
2548# if defined __sun || defined __sgi 2551# if defined __sun
2549/* Solaris and IRIX have isnanf() and declare it in <ieeefp.h>. We cannot 2552/* Solaris has isnanf() and declares it in <ieeefp.h>. We cannot define isnanf
2550 define isnanf as a macro, because that would conflict with <ieeefp.h>. */ 2553 as a macro, because that would conflict with <ieeefp.h>. */
2551_GL_EXTERN_C int isnanf (float x); 2554_GL_EXTERN_C int isnanf (float x);
2552# else 2555# else
2553/* The original <math.h> included above provides a declaration of isnan macro 2556/* The original <math.h> included above provides a declaration of isnan macro
@@ -2557,7 +2560,7 @@ _GL_EXTERN_C int isnanf (float x);
2557 GCC >= 4.0 also provides __builtin_isnanf, but clang doesn't. */ 2560 GCC >= 4.0 also provides __builtin_isnanf, but clang doesn't. */
2558# undef isnanf 2561# undef isnanf
2559# define isnanf(x) __builtin_isnan ((float)(x)) 2562# define isnanf(x) __builtin_isnan ((float)(x))
2560# elif defined isnan 2563# elif defined isnan && !defined HAVE_ISNANF_NOLIBM
2561# undef isnanf 2564# undef isnanf
2562# define isnanf(x) isnan ((float)(x)) 2565# define isnanf(x) isnan ((float)(x))
2563# endif 2566# endif
@@ -2575,9 +2578,9 @@ _GL_EXTERN_C int isnanf (float x);
2575 This function is a gnulib extension, unlike isnan() which applied only 2578 This function is a gnulib extension, unlike isnan() which applied only
2576 to 'double' numbers earlier but now is a type-generic macro. */ 2579 to 'double' numbers earlier but now is a type-generic macro. */
2577# if @HAVE_ISNAND@ 2580# if @HAVE_ISNAND@
2578# if defined __sun || defined __sgi 2581# if defined __sun
2579/* Solaris and IRIX have isnand() and declare it in <ieeefp.h>. We cannot 2582/* Solaris has isnand() and declares it in <ieeefp.h>. We cannot define isnand
2580 define isnand as a macro, because that would conflict with <ieeefp.h>. */ 2583 as a macro, because that would conflict with <ieeefp.h>. */
2581_GL_EXTERN_C int isnand (double x); 2584_GL_EXTERN_C int isnand (double x);
2582# else 2585# else
2583/* The original <math.h> included above provides a declaration of isnan 2586/* The original <math.h> included above provides a declaration of isnan
@@ -2586,7 +2589,7 @@ _GL_EXTERN_C int isnand (double x);
2586 /* GCC >= 4.0 and clang provide a type-generic built-in for isnan. */ 2589 /* GCC >= 4.0 and clang provide a type-generic built-in for isnan. */
2587# undef isnand 2590# undef isnand
2588# define isnand(x) __builtin_isnan ((double)(x)) 2591# define isnand(x) __builtin_isnan ((double)(x))
2589# else 2592# elif !defined HAVE_ISNAND_NOLIBM
2590# undef isnand 2593# undef isnand
2591# define isnand(x) isnan ((double)(x)) 2594# define isnand(x) isnan ((double)(x))
2592# endif 2595# endif
@@ -2609,7 +2612,7 @@ _GL_EXTERN_C int isnand (double x);
2609 GCC >= 4.0 also provides __builtin_isnanl, but clang doesn't. */ 2612 GCC >= 4.0 also provides __builtin_isnanl, but clang doesn't. */
2610# undef isnanl 2613# undef isnanl
2611# define isnanl(x) __builtin_isnan ((long double)(x)) 2614# define isnanl(x) __builtin_isnan ((long double)(x))
2612# elif defined isnan 2615# elif defined isnan && !defined HAVE_ISNANL_NOLIBM
2613# undef isnanl 2616# undef isnanl
2614# define isnanl(x) isnan ((long double)(x)) 2617# define isnanl(x) isnan ((long double)(x))
2615# endif 2618# endif
@@ -2622,7 +2625,7 @@ _GL_EXTERN_C int isnanl (long double x) _GL_ATTRIBUTE_CONST;
2622#endif 2625#endif
2623 2626
2624/* This must come *after* the snippets for GNULIB_ISNANF and GNULIB_ISNANL! */ 2627/* This must come *after* the snippets for GNULIB_ISNANF and GNULIB_ISNANL! */
2625#if @GNULIB_ISNAN@ 2628#if @GNULIB_ISNAN@ || @GNULIB_ISNAN_NO_CXX@
2626# if @REPLACE_ISNAN@ 2629# if @REPLACE_ISNAN@
2627/* We can't just use the isnanf macro (e.g.) as exposed by 2630/* We can't just use the isnanf macro (e.g.) as exposed by
2628 isnanf.h (e.g.) here, because those may end up being macros 2631 isnanf.h (e.g.) here, because those may end up being macros
@@ -2646,19 +2649,35 @@ _GL_EXTERN_C int rpl_isnand (double x);
2646_GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST; 2649_GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
2647# define gl_isnan_l(x) rpl_isnanl (x) 2650# define gl_isnan_l(x) rpl_isnanl (x)
2648# endif 2651# endif
2649# undef isnan 2652# ifdef __cplusplus
2650# define isnan(x) \ 2653# undef isnan
2651 (sizeof (x) == sizeof (long double) ? gl_isnan_l (x) : \ 2654template <typename T> int isnan (T);
2652 sizeof (x) == sizeof (double) ? gl_isnan_d (x) : \ 2655template <> inline int isnan<float> (float x) { return gl_isnan_f (x); }
2653 gl_isnan_f (x)) 2656template <> inline int isnan<double> (double x) { return gl_isnan_d (x); }
2657template <> inline int isnan<long double> (long double x) { return gl_isnan_l (x); }
2658# else
2659# undef isnan
2660# define isnan(x) \
2661 (sizeof (x) == sizeof (long double) ? gl_isnan_l (x) : \
2662 sizeof (x) == sizeof (double) ? gl_isnan_d (x) : \
2663 gl_isnan_f (x))
2664# endif
2654# elif (__GNUC__ >= 4) || (__clang_major__ >= 4) 2665# elif (__GNUC__ >= 4) || (__clang_major__ >= 4)
2655# undef isnan 2666# ifdef __cplusplus
2656# define isnan(x) \ 2667# undef isnan
2657 (sizeof (x) == sizeof (long double) ? __builtin_isnan ((long double)(x)) : \ 2668template <typename T> int isnan (T);
2658 sizeof (x) == sizeof (double) ? __builtin_isnan ((double)(x)) : \ 2669template <> inline int isnan<float> (float x) { return __builtin_isnan (x); }
2659 __builtin_isnan ((float)(x))) 2670template <> inline int isnan<double> (double x) { return __builtin_isnan (x); }
2671template <> inline int isnan<long double> (long double x) { return __builtin_isnan (x); }
2672# else
2673# undef isnan
2674# define isnan(x) \
2675 (sizeof (x) == sizeof (long double) ? __builtin_isnan ((long double)(x)) : \
2676 sizeof (x) == sizeof (double) ? __builtin_isnan ((double)(x)) : \
2677 __builtin_isnan ((float)(x)))
2678# endif
2660# endif 2679# endif
2661# ifdef __cplusplus 2680# if @GNULIB_ISNAN@ && defined __cplusplus
2662# if defined isnan || defined GNULIB_NAMESPACE 2681# if defined isnan || defined GNULIB_NAMESPACE
2663_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan) 2682_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan)
2664# undef isnan 2683# undef isnan
@@ -2692,15 +2711,22 @@ _GL_WARN_REAL_FLOATING_DECL (isnan);
2692#endif 2711#endif
2693 2712
2694 2713
2695#if @GNULIB_SIGNBIT@ 2714#if @GNULIB_SIGNBIT@ || @GNULIB_SIGNBIT_NO_CXX@
2696# if (@REPLACE_SIGNBIT_USING_BUILTINS@ \ 2715# if (@REPLACE_SIGNBIT_USING_BUILTINS@ \
2697 && (!defined __cplusplus || __cplusplus < 201103)) 2716 && (!defined __cplusplus || __cplusplus < 201103))
2698# undef signbit 2717# undef signbit
2699 /* GCC >= 4.0 and clang provide three built-ins for signbit. */ 2718 /* GCC >= 4.0 and clang provide three built-ins for signbit. */
2700# define signbit(x) \ 2719# if defined __cplusplus && !defined __clang__
2701 (sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \ 2720template <typename T> int signbit (T);
2702 sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \ 2721template <> inline int signbit<float> (float x) { return __builtin_signbitf (x); }
2703 __builtin_signbitf (x)) 2722template <> inline int signbit<double> (double x) { return __builtin_signbit (x); }
2723template <> inline int signbit<long double> (long double x) { return __builtin_signbitl (x); }
2724# else
2725# define signbit(x) \
2726 (sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \
2727 sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \
2728 __builtin_signbitf (x))
2729# endif
2704# endif 2730# endif
2705# if @REPLACE_SIGNBIT@ && !GNULIB_defined_signbit 2731# if @REPLACE_SIGNBIT@ && !GNULIB_defined_signbit
2706# undef signbit 2732# undef signbit
@@ -2744,17 +2770,24 @@ _GL_EXTERN_C int gl_signbitl (long double arg);
2744 }) 2770 })
2745# endif 2771# endif
2746# endif 2772# endif
2747# define signbit(x) \ 2773# if defined __cplusplus && !defined __clang__
2748 (sizeof (x) == sizeof (long double) ? gl_signbitl (x) : \ 2774template <typename T> int signbit (T);
2749 sizeof (x) == sizeof (double) ? gl_signbitd (x) : \ 2775template <> inline int signbit<float> (float x) { return gl_signbitf (x); }
2750 gl_signbitf (x)) 2776template <> inline int signbit<double> (double x) { return gl_signbitd (x); }
2777template <> inline int signbit<long double> (long double x) { return gl_signbitl (x); }
2778# else
2779# define signbit(x) \
2780 (sizeof (x) == sizeof (long double) ? gl_signbitl (x) : \
2781 sizeof (x) == sizeof (double) ? gl_signbitd (x) : \
2782 gl_signbitf (x))
2783# endif
2751# define GNULIB_defined_signbit 1 2784# define GNULIB_defined_signbit 1
2752# endif 2785# endif
2753# ifdef __cplusplus 2786# if @GNULIB_SIGNBIT@ && defined __cplusplus
2754# if defined signbit || defined GNULIB_NAMESPACE 2787# if defined signbit || defined GNULIB_NAMESPACE
2755_GL_MATH_CXX_REAL_FLOATING_DECL_1 (signbit) 2788_GL_MATH_CXX_REAL_FLOATING_DECL_1 (signbit)
2756# undef signbit 2789# undef signbit
2757# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || defined _AIX || (defined _WIN32 && !defined __CYGWIN__))) 2790# if __cplusplus >= 201103L || __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || defined _AIX || (defined _WIN32 && !defined __CYGWIN__)))
2758 /* This platform's <cmath> possibly defines signbit through a set of inline 2791 /* This platform's <cmath> possibly defines signbit through a set of inline
2759 functions. */ 2792 functions. */
2760_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit, rpl_signbit, bool) 2793_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit, rpl_signbit, bool)
@@ -2780,17 +2813,16 @@ _GL_WARN_REAL_FLOATING_DECL (signbit);
2780# undef getpayloadf 2813# undef getpayloadf
2781# define getpayloadf rpl_getpayloadf 2814# define getpayloadf rpl_getpayloadf
2782# endif 2815# endif
2783_GL_FUNCDECL_RPL (getpayloadf, float, (const float *)); 2816_GL_FUNCDECL_RPL (getpayloadf, float, (const float *), );
2784_GL_CXXALIAS_RPL (getpayloadf, float, (const float *)); 2817_GL_CXXALIAS_RPL (getpayloadf, float, (const float *));
2785# else 2818# else
2786# if !@HAVE_GETPAYLOADF@ 2819# if !@HAVE_GETPAYLOADF@
2787_GL_FUNCDECL_SYS (getpayloadf, float, (const float *)); 2820_GL_FUNCDECL_SYS (getpayloadf, float, (const float *), );
2788# endif 2821# endif
2789_GL_CXXALIAS_SYS (getpayloadf, float, (const float *)); 2822_GL_CXXALIAS_SYS (getpayloadf, float, (const float *));
2790# endif 2823# endif
2791_GL_CXXALIASWARN (getpayloadf); 2824_GL_CXXALIASWARN (getpayloadf);
2792#elif defined GNULIB_POSIXCHECK 2825#elif defined GNULIB_POSIXCHECK
2793# undef getpayloadf
2794# if HAVE_RAW_DECL_GETPAYLOADF 2826# if HAVE_RAW_DECL_GETPAYLOADF
2795_GL_WARN_ON_USE (getpayloadf, "getpayloadf is unportable - " 2827_GL_WARN_ON_USE (getpayloadf, "getpayloadf is unportable - "
2796 "use gnulib module getpayloadf for portability"); 2828 "use gnulib module getpayloadf for portability");
@@ -2803,17 +2835,16 @@ _GL_WARN_ON_USE (getpayloadf, "getpayloadf is unportable - "
2803# undef getpayload 2835# undef getpayload
2804# define getpayload rpl_getpayload 2836# define getpayload rpl_getpayload
2805# endif 2837# endif
2806_GL_FUNCDECL_RPL (getpayload, double, (const double *)); 2838_GL_FUNCDECL_RPL (getpayload, double, (const double *), );
2807_GL_CXXALIAS_RPL (getpayload, double, (const double *)); 2839_GL_CXXALIAS_RPL (getpayload, double, (const double *));
2808# else 2840# else
2809# if !@HAVE_GETPAYLOAD@ 2841# if !@HAVE_GETPAYLOAD@
2810_GL_FUNCDECL_SYS (getpayload, double, (const double *)); 2842_GL_FUNCDECL_SYS (getpayload, double, (const double *), );
2811# endif 2843# endif
2812_GL_CXXALIAS_SYS (getpayload, double, (const double *)); 2844_GL_CXXALIAS_SYS (getpayload, double, (const double *));
2813# endif 2845# endif
2814_GL_CXXALIASWARN (getpayload); 2846_GL_CXXALIASWARN (getpayload);
2815#elif defined GNULIB_POSIXCHECK 2847#elif defined GNULIB_POSIXCHECK
2816# undef getpayload
2817# if HAVE_RAW_DECL_GETPAYLOAD 2848# if HAVE_RAW_DECL_GETPAYLOAD
2818_GL_WARN_ON_USE (getpayload, "getpayload is unportable - " 2849_GL_WARN_ON_USE (getpayload, "getpayload is unportable - "
2819 "use gnulib module getpayload for portability"); 2850 "use gnulib module getpayload for portability");
@@ -2826,17 +2857,16 @@ _GL_WARN_ON_USE (getpayload, "getpayload is unportable - "
2826# undef getpayloadl 2857# undef getpayloadl
2827# define getpayloadl rpl_getpayloadl 2858# define getpayloadl rpl_getpayloadl
2828# endif 2859# endif
2829_GL_FUNCDECL_RPL (getpayloadl, long double, (const long double *)); 2860_GL_FUNCDECL_RPL (getpayloadl, long double, (const long double *), );
2830_GL_CXXALIAS_RPL (getpayloadl, long double, (const long double *)); 2861_GL_CXXALIAS_RPL (getpayloadl, long double, (const long double *));
2831# else 2862# else
2832# if !@HAVE_GETPAYLOADL@ 2863# if !@HAVE_GETPAYLOADL@
2833_GL_FUNCDECL_SYS (getpayloadl, long double, (const long double *)); 2864_GL_FUNCDECL_SYS (getpayloadl, long double, (const long double *), );
2834# endif 2865# endif
2835_GL_CXXALIAS_SYS (getpayloadl, long double, (const long double *)); 2866_GL_CXXALIAS_SYS (getpayloadl, long double, (const long double *));
2836# endif 2867# endif
2837_GL_CXXALIASWARN (getpayloadl); 2868_GL_CXXALIASWARN (getpayloadl);
2838#elif defined GNULIB_POSIXCHECK 2869#elif defined GNULIB_POSIXCHECK
2839# undef getpayloadl
2840# if HAVE_RAW_DECL_GETPAYLOADL 2870# if HAVE_RAW_DECL_GETPAYLOADL
2841_GL_WARN_ON_USE (getpayloadl, "getpayloadl is unportable - " 2871_GL_WARN_ON_USE (getpayloadl, "getpayloadl is unportable - "
2842 "use gnulib module getpayloadl for portability"); 2872 "use gnulib module getpayloadl for portability");
@@ -2846,12 +2876,11 @@ _GL_WARN_ON_USE (getpayloadl, "getpayloadl is unportable - "
2846 2876
2847#if @GNULIB_SETPAYLOADF@ 2877#if @GNULIB_SETPAYLOADF@
2848# if !@HAVE_SETPAYLOADF@ 2878# if !@HAVE_SETPAYLOADF@
2849_GL_FUNCDECL_SYS (setpayloadf, int, (float *, float)); 2879_GL_FUNCDECL_SYS (setpayloadf, int, (float *, float), );
2850# endif 2880# endif
2851_GL_CXXALIAS_SYS (setpayloadf, int, (float *, float)); 2881_GL_CXXALIAS_SYS (setpayloadf, int, (float *, float));
2852_GL_CXXALIASWARN (setpayloadf); 2882_GL_CXXALIASWARN (setpayloadf);
2853#elif defined GNULIB_POSIXCHECK 2883#elif defined GNULIB_POSIXCHECK
2854# undef setpayloadf
2855# if HAVE_RAW_DECL_SETPAYLOADF 2884# if HAVE_RAW_DECL_SETPAYLOADF
2856_GL_WARN_ON_USE (setpayloadf, "setpayloadf is unportable - " 2885_GL_WARN_ON_USE (setpayloadf, "setpayloadf is unportable - "
2857 "use gnulib module setpayloadf for portability"); 2886 "use gnulib module setpayloadf for portability");
@@ -2860,12 +2889,11 @@ _GL_WARN_ON_USE (setpayloadf, "setpayloadf is unportable - "
2860 2889
2861#if @GNULIB_SETPAYLOAD@ 2890#if @GNULIB_SETPAYLOAD@
2862# if !@HAVE_SETPAYLOAD@ 2891# if !@HAVE_SETPAYLOAD@
2863_GL_FUNCDECL_SYS (setpayload, int, (double *, double)); 2892_GL_FUNCDECL_SYS (setpayload, int, (double *, double), );
2864# endif 2893# endif
2865_GL_CXXALIAS_SYS (setpayload, int, (double *, double)); 2894_GL_CXXALIAS_SYS (setpayload, int, (double *, double));
2866_GL_CXXALIASWARN (setpayload); 2895_GL_CXXALIASWARN (setpayload);
2867#elif defined GNULIB_POSIXCHECK 2896#elif defined GNULIB_POSIXCHECK
2868# undef setpayload
2869# if HAVE_RAW_DECL_SETPAYLOAD 2897# if HAVE_RAW_DECL_SETPAYLOAD
2870_GL_WARN_ON_USE (setpayload, "setpayload is unportable - " 2898_GL_WARN_ON_USE (setpayload, "setpayload is unportable - "
2871 "use gnulib module setpayload for portability"); 2899 "use gnulib module setpayload for portability");
@@ -2874,12 +2902,11 @@ _GL_WARN_ON_USE (setpayload, "setpayload is unportable - "
2874 2902
2875#if @GNULIB_SETPAYLOADL@ 2903#if @GNULIB_SETPAYLOADL@
2876# if !@HAVE_SETPAYLOADL@ 2904# if !@HAVE_SETPAYLOADL@
2877_GL_FUNCDECL_SYS (setpayloadl, int, (long double *, long double)); 2905_GL_FUNCDECL_SYS (setpayloadl, int, (long double *, long double), );
2878# endif 2906# endif
2879_GL_CXXALIAS_SYS (setpayloadl, int, (long double *, long double)); 2907_GL_CXXALIAS_SYS (setpayloadl, int, (long double *, long double));
2880_GL_CXXALIASWARN (setpayloadl); 2908_GL_CXXALIASWARN (setpayloadl);
2881#elif defined GNULIB_POSIXCHECK 2909#elif defined GNULIB_POSIXCHECK
2882# undef setpayloadl
2883# if HAVE_RAW_DECL_SETPAYLOADL 2910# if HAVE_RAW_DECL_SETPAYLOADL
2884_GL_WARN_ON_USE (setpayloadl, "setpayloadl is unportable - " 2911_GL_WARN_ON_USE (setpayloadl, "setpayloadl is unportable - "
2885 "use gnulib module setpayloadl for portability"); 2912 "use gnulib module setpayloadl for portability");
@@ -2889,12 +2916,11 @@ _GL_WARN_ON_USE (setpayloadl, "setpayloadl is unportable - "
2889 2916
2890#if @GNULIB_SETPAYLOADSIGF@ 2917#if @GNULIB_SETPAYLOADSIGF@
2891# if !@HAVE_SETPAYLOADSIGF@ 2918# if !@HAVE_SETPAYLOADSIGF@
2892_GL_FUNCDECL_SYS (setpayloadsigf, int, (float *, float)); 2919_GL_FUNCDECL_SYS (setpayloadsigf, int, (float *, float), );
2893# endif 2920# endif
2894_GL_CXXALIAS_SYS (setpayloadsigf, int, (float *, float)); 2921_GL_CXXALIAS_SYS (setpayloadsigf, int, (float *, float));
2895_GL_CXXALIASWARN (setpayloadsigf); 2922_GL_CXXALIASWARN (setpayloadsigf);
2896#elif defined GNULIB_POSIXCHECK 2923#elif defined GNULIB_POSIXCHECK
2897# undef setpayloadsigf
2898# if HAVE_RAW_DECL_SETPAYLOADSIGF 2924# if HAVE_RAW_DECL_SETPAYLOADSIGF
2899_GL_WARN_ON_USE (setpayloadsigf, "setpayloadsigf is unportable - " 2925_GL_WARN_ON_USE (setpayloadsigf, "setpayloadsigf is unportable - "
2900 "use gnulib module setpayloadsigf for portability"); 2926 "use gnulib module setpayloadsigf for portability");
@@ -2903,12 +2929,11 @@ _GL_WARN_ON_USE (setpayloadsigf, "setpayloadsigf is unportable - "
2903 2929
2904#if @GNULIB_SETPAYLOADSIG@ 2930#if @GNULIB_SETPAYLOADSIG@
2905# if !@HAVE_SETPAYLOADSIG@ 2931# if !@HAVE_SETPAYLOADSIG@
2906_GL_FUNCDECL_SYS (setpayloadsig, int, (double *, double)); 2932_GL_FUNCDECL_SYS (setpayloadsig, int, (double *, double), );
2907# endif 2933# endif
2908_GL_CXXALIAS_SYS (setpayloadsig, int, (double *, double)); 2934_GL_CXXALIAS_SYS (setpayloadsig, int, (double *, double));
2909_GL_CXXALIASWARN (setpayloadsig); 2935_GL_CXXALIASWARN (setpayloadsig);
2910#elif defined GNULIB_POSIXCHECK 2936#elif defined GNULIB_POSIXCHECK
2911# undef setpayloadsig
2912# if HAVE_RAW_DECL_SETPAYLOADSIG 2937# if HAVE_RAW_DECL_SETPAYLOADSIG
2913_GL_WARN_ON_USE (setpayloadsig, "setpayloadsig is unportable - " 2938_GL_WARN_ON_USE (setpayloadsig, "setpayloadsig is unportable - "
2914 "use gnulib module setpayloadsig for portability"); 2939 "use gnulib module setpayloadsig for portability");
@@ -2917,12 +2942,11 @@ _GL_WARN_ON_USE (setpayloadsig, "setpayloadsig is unportable - "
2917 2942
2918#if @GNULIB_SETPAYLOADSIGL@ 2943#if @GNULIB_SETPAYLOADSIGL@
2919# if !@HAVE_SETPAYLOADSIGL@ 2944# if !@HAVE_SETPAYLOADSIGL@
2920_GL_FUNCDECL_SYS (setpayloadsigl, int, (long double *, long double)); 2945_GL_FUNCDECL_SYS (setpayloadsigl, int, (long double *, long double), );
2921# endif 2946# endif
2922_GL_CXXALIAS_SYS (setpayloadsigl, int, (long double *, long double)); 2947_GL_CXXALIAS_SYS (setpayloadsigl, int, (long double *, long double));
2923_GL_CXXALIASWARN (setpayloadsigl); 2948_GL_CXXALIASWARN (setpayloadsigl);
2924#elif defined GNULIB_POSIXCHECK 2949#elif defined GNULIB_POSIXCHECK
2925# undef setpayloadsigl
2926# if HAVE_RAW_DECL_SETPAYLOADSIGL 2950# if HAVE_RAW_DECL_SETPAYLOADSIGL
2927_GL_WARN_ON_USE (setpayloadsigl, "setpayloadsigl is unportable - " 2951_GL_WARN_ON_USE (setpayloadsigl, "setpayloadsigl is unportable - "
2928 "use gnulib module setpayloadsigl for portability"); 2952 "use gnulib module setpayloadsigl for portability");
@@ -2936,17 +2960,16 @@ _GL_WARN_ON_USE (setpayloadsigl, "setpayloadsigl is unportable - "
2936# undef totalorderf 2960# undef totalorderf
2937# define totalorderf rpl_totalorderf 2961# define totalorderf rpl_totalorderf
2938# endif 2962# endif
2939_GL_FUNCDECL_RPL (totalorderf, int, (float const *, float const *)); 2963_GL_FUNCDECL_RPL (totalorderf, int, (float const *, float const *), );
2940_GL_CXXALIAS_RPL (totalorderf, int, (float const *, float const *)); 2964_GL_CXXALIAS_RPL (totalorderf, int, (float const *, float const *));
2941# else 2965# else
2942# if !@HAVE_TOTALORDERF@ 2966# if !@HAVE_TOTALORDERF@
2943_GL_FUNCDECL_SYS (totalorderf, int, (float const *, float const *)); 2967_GL_FUNCDECL_SYS (totalorderf, int, (float const *, float const *), );
2944# endif 2968# endif
2945_GL_CXXALIAS_SYS (totalorderf, int, (float const *, float const *)); 2969_GL_CXXALIAS_SYS (totalorderf, int, (float const *, float const *));
2946# endif 2970# endif
2947_GL_CXXALIASWARN (totalorderf); 2971_GL_CXXALIASWARN (totalorderf);
2948#elif defined GNULIB_POSIXCHECK 2972#elif defined GNULIB_POSIXCHECK
2949# undef totalorderf
2950# if HAVE_RAW_DECL_TOTALORDERF 2973# if HAVE_RAW_DECL_TOTALORDERF
2951_GL_WARN_ON_USE (totalorderf, "totalorderf is unportable - " 2974_GL_WARN_ON_USE (totalorderf, "totalorderf is unportable - "
2952 "use gnulib module totalorderf for portability"); 2975 "use gnulib module totalorderf for portability");
@@ -2959,11 +2982,11 @@ _GL_WARN_ON_USE (totalorderf, "totalorderf is unportable - "
2959# undef totalorder 2982# undef totalorder
2960# define totalorder rpl_totalorder 2983# define totalorder rpl_totalorder
2961# endif 2984# endif
2962_GL_FUNCDECL_RPL (totalorder, int, (double const *, double const *)); 2985_GL_FUNCDECL_RPL (totalorder, int, (double const *, double const *), );
2963_GL_CXXALIAS_RPL (totalorder, int, (double const *, double const *)); 2986_GL_CXXALIAS_RPL (totalorder, int, (double const *, double const *));
2964# else 2987# else
2965# if !@HAVE_TOTALORDER@ 2988# if !@HAVE_TOTALORDER@
2966_GL_FUNCDECL_SYS (totalorder, int, (double const *, double const *)); 2989_GL_FUNCDECL_SYS (totalorder, int, (double const *, double const *), );
2967# endif 2990# endif
2968_GL_CXXALIAS_SYS (totalorder, int, (double const *, double const *)); 2991_GL_CXXALIAS_SYS (totalorder, int, (double const *, double const *));
2969# endif 2992# endif
@@ -2971,7 +2994,6 @@ _GL_CXXALIAS_SYS (totalorder, int, (double const *, double const *));
2971_GL_CXXALIASWARN1 (totalorder, int, (double const *, double const *)); 2994_GL_CXXALIASWARN1 (totalorder, int, (double const *, double const *));
2972# endif 2995# endif
2973#elif defined GNULIB_POSIXCHECK 2996#elif defined GNULIB_POSIXCHECK
2974# undef totalorder
2975# if HAVE_RAW_DECL_TOTALORDER 2997# if HAVE_RAW_DECL_TOTALORDER
2976_GL_WARN_ON_USE (totalorder, "totalorder is unportable - " 2998_GL_WARN_ON_USE (totalorder, "totalorder is unportable - "
2977 "use gnulib module totalorder for portability"); 2999 "use gnulib module totalorder for portability");
@@ -2985,20 +3007,19 @@ _GL_WARN_ON_USE (totalorder, "totalorder is unportable - "
2985# define totalorderl rpl_totalorderl 3007# define totalorderl rpl_totalorderl
2986# endif 3008# endif
2987_GL_FUNCDECL_RPL (totalorderl, int, 3009_GL_FUNCDECL_RPL (totalorderl, int,
2988 (long double const *, long double const *)); 3010 (long double const *, long double const *), );
2989_GL_CXXALIAS_RPL (totalorderl, int, 3011_GL_CXXALIAS_RPL (totalorderl, int,
2990 (long double const *, long double const *)); 3012 (long double const *, long double const *));
2991# else 3013# else
2992# if !@HAVE_TOTALORDERL@ 3014# if !@HAVE_TOTALORDERL@
2993_GL_FUNCDECL_SYS (totalorderl, int, 3015_GL_FUNCDECL_SYS (totalorderl, int,
2994 (long double const *, long double const *)); 3016 (long double const *, long double const *), );
2995# endif 3017# endif
2996_GL_CXXALIAS_SYS (totalorderl, int, 3018_GL_CXXALIAS_SYS (totalorderl, int,
2997 (long double const *, long double const *)); 3019 (long double const *, long double const *));
2998# endif 3020# endif
2999_GL_CXXALIASWARN (totalorderl); 3021_GL_CXXALIASWARN (totalorderl);
3000#elif defined GNULIB_POSIXCHECK 3022#elif defined GNULIB_POSIXCHECK
3001# undef totalorderl
3002# if HAVE_RAW_DECL_TOTALORDERL 3023# if HAVE_RAW_DECL_TOTALORDERL
3003_GL_WARN_ON_USE (totalorderl, "totalorderl is unportable - " 3024_GL_WARN_ON_USE (totalorderl, "totalorderl is unportable - "
3004 "use gnulib module totalorderl for portability"); 3025 "use gnulib module totalorderl for portability");
@@ -3012,11 +3033,11 @@ _GL_WARN_ON_USE (totalorderl, "totalorderl is unportable - "
3012# undef totalordermagf 3033# undef totalordermagf
3013# define totalordermagf rpl_totalordermagf 3034# define totalordermagf rpl_totalordermagf
3014# endif 3035# endif
3015_GL_FUNCDECL_RPL (totalordermagf, int, (float const *, float const *)); 3036_GL_FUNCDECL_RPL (totalordermagf, int, (float const *, float const *), );
3016_GL_CXXALIAS_RPL (totalordermagf, int, (float const *, float const *)); 3037_GL_CXXALIAS_RPL (totalordermagf, int, (float const *, float const *));
3017# else 3038# else
3018# if !@HAVE_TOTALORDERMAGF@ 3039# if !@HAVE_TOTALORDERMAGF@
3019_GL_FUNCDECL_SYS (totalordermagf, int, (float const *, float const *)); 3040_GL_FUNCDECL_SYS (totalordermagf, int, (float const *, float const *), );
3020# endif 3041# endif
3021_GL_CXXALIAS_SYS (totalordermagf, int, (float const *, float const *)); 3042_GL_CXXALIAS_SYS (totalordermagf, int, (float const *, float const *));
3022# endif 3043# endif
@@ -3024,7 +3045,6 @@ _GL_CXXALIAS_SYS (totalordermagf, int, (float const *, float const *));
3024_GL_CXXALIASWARN1 (totalordermagf, int, (float const *, float const *)); 3045_GL_CXXALIASWARN1 (totalordermagf, int, (float const *, float const *));
3025# endif 3046# endif
3026#elif defined GNULIB_POSIXCHECK 3047#elif defined GNULIB_POSIXCHECK
3027# undef totalordermagf
3028# if HAVE_RAW_DECL_TOTALORDERMAGF 3048# if HAVE_RAW_DECL_TOTALORDERMAGF
3029_GL_WARN_ON_USE (totalordermagf, "totalordermagf is unportable - " 3049_GL_WARN_ON_USE (totalordermagf, "totalordermagf is unportable - "
3030 "use gnulib module totalordermagf for portability"); 3050 "use gnulib module totalordermagf for portability");
@@ -3037,11 +3057,11 @@ _GL_WARN_ON_USE (totalordermagf, "totalordermagf is unportable - "
3037# undef totalordermag 3057# undef totalordermag
3038# define totalordermag rpl_totalordermag 3058# define totalordermag rpl_totalordermag
3039# endif 3059# endif
3040_GL_FUNCDECL_RPL (totalordermag, int, (double const *, double const *)); 3060_GL_FUNCDECL_RPL (totalordermag, int, (double const *, double const *), );
3041_GL_CXXALIAS_RPL (totalordermag, int, (double const *, double const *)); 3061_GL_CXXALIAS_RPL (totalordermag, int, (double const *, double const *));
3042# else 3062# else
3043# if !@HAVE_TOTALORDERMAG@ 3063# if !@HAVE_TOTALORDERMAG@
3044_GL_FUNCDECL_SYS (totalordermag, int, (double const *, double const *)); 3064_GL_FUNCDECL_SYS (totalordermag, int, (double const *, double const *), );
3045# endif 3065# endif
3046_GL_CXXALIAS_SYS (totalordermag, int, (double const *, double const *)); 3066_GL_CXXALIAS_SYS (totalordermag, int, (double const *, double const *));
3047# endif 3067# endif
@@ -3049,7 +3069,6 @@ _GL_CXXALIAS_SYS (totalordermag, int, (double const *, double const *));
3049_GL_CXXALIASWARN1 (totalordermag, int, (double const *, double const *)); 3069_GL_CXXALIASWARN1 (totalordermag, int, (double const *, double const *));
3050# endif 3070# endif
3051#elif defined GNULIB_POSIXCHECK 3071#elif defined GNULIB_POSIXCHECK
3052# undef totalordermag
3053# if HAVE_RAW_DECL_TOTALORDERMAG 3072# if HAVE_RAW_DECL_TOTALORDERMAG
3054_GL_WARN_ON_USE (totalordermag, "totalordermag is unportable - " 3073_GL_WARN_ON_USE (totalordermag, "totalordermag is unportable - "
3055 "use gnulib module totalordermag for portability"); 3074 "use gnulib module totalordermag for portability");
@@ -3063,13 +3082,13 @@ _GL_WARN_ON_USE (totalordermag, "totalordermag is unportable - "
3063# define totalordermagl rpl_totalordermagl 3082# define totalordermagl rpl_totalordermagl
3064# endif 3083# endif
3065_GL_FUNCDECL_RPL (totalordermagl, int, 3084_GL_FUNCDECL_RPL (totalordermagl, int,
3066 (long double const *, long double const *)); 3085 (long double const *, long double const *), );
3067_GL_CXXALIAS_RPL (totalordermagl, int, 3086_GL_CXXALIAS_RPL (totalordermagl, int,
3068 (long double const *, long double const *)); 3087 (long double const *, long double const *));
3069# else 3088# else
3070# if !@HAVE_TOTALORDERMAGL@ 3089# if !@HAVE_TOTALORDERMAGL@
3071_GL_FUNCDECL_SYS (totalordermagl, int, 3090_GL_FUNCDECL_SYS (totalordermagl, int,
3072 (long double const *, long double const *)); 3091 (long double const *, long double const *), );
3073# endif 3092# endif
3074_GL_CXXALIAS_SYS (totalordermagl, int, 3093_GL_CXXALIAS_SYS (totalordermagl, int,
3075 (long double const *, long double const *)); 3094 (long double const *, long double const *));
@@ -3079,7 +3098,6 @@ _GL_CXXALIASWARN1 (totalordermagl, int,
3079 (long double const *, long double const *)); 3098 (long double const *, long double const *));
3080# endif 3099# endif
3081#elif defined GNULIB_POSIXCHECK 3100#elif defined GNULIB_POSIXCHECK
3082# undef totalordermagl
3083# if HAVE_RAW_DECL_TOTALORDERMAGL 3101# if HAVE_RAW_DECL_TOTALORDERMAGL
3084_GL_WARN_ON_USE (totalordermagl, "totalordermagl is unportable - " 3102_GL_WARN_ON_USE (totalordermagl, "totalordermagl is unportable - "
3085 "use gnulib module totalordermagl for portability"); 3103 "use gnulib module totalordermagl for portability");
diff --git a/gl/mbchar.c b/gl/mbchar.c
new file mode 100644
index 00000000..db9e2718
--- /dev/null
+++ b/gl/mbchar.c
@@ -0,0 +1,22 @@
1/* Copyright (C) 2001, 2006, 2009-2026 Free Software Foundation, Inc.
2
3 This file is free software: you can redistribute it and/or modify
4 it under the terms of the GNU Lesser General Public License as
5 published by the Free Software Foundation; either version 2.1 of the
6 License, or (at your option) any later version.
7
8 This file is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU Lesser General Public License for more details.
12
13 You should have received a copy of the GNU Lesser General Public License
14 along with this program. If not, see <https://www.gnu.org/licenses/>. */
15
16
17#define MBCHAR_INLINE _GL_EXTERN_INLINE
18#include <config.h>
19
20#include <limits.h>
21
22#include "mbchar.h"
diff --git a/gl/mbchar.h b/gl/mbchar.h
new file mode 100644
index 00000000..20e28e5f
--- /dev/null
+++ b/gl/mbchar.h
@@ -0,0 +1,388 @@
1/* Multibyte character data type.
2 Copyright (C) 2001, 2005-2007, 2009-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17/* Written by Bruno Haible <bruno@clisp.org>. */
18
19/* A multibyte character is a short subsequence of a char* string,
20 representing a single 32-bit wide character.
21
22 We use multibyte characters instead of 32-bit wide characters because
23 of the following goals:
24 1) correct multibyte handling, i.e. operate according to the LC_CTYPE
25 locale,
26 2) ease of maintenance, i.e. the maintainer needs not know all details
27 of the ISO C 99 standard,
28 3) don't fail grossly if the input is not in the encoding set by the
29 locale, because often different encodings are in use in the same
30 countries (ISO-8859-1/UTF-8, EUC-JP/Shift_JIS, ...),
31 4) fast in the case of ASCII characters.
32
33 Multibyte characters are only accessed through the mb* macros.
34
35 mb_ptr (mbc)
36 return a pointer to the beginning of the multibyte sequence.
37
38 mb_len (mbc)
39 returns the number of bytes occupied by the multibyte sequence.
40 Always > 0.
41
42 mb_iseq (mbc, sc)
43 returns true if mbc is the standard ASCII character sc.
44
45 mb_isnul (mbc)
46 returns true if mbc is the nul character.
47
48 mb_cmp (mbc1, mbc2)
49 returns a positive, zero, or negative value depending on whether mbc1
50 sorts after, same or before mbc2.
51
52 mb_casecmp (mbc1, mbc2)
53 returns a positive, zero, or negative value depending on whether mbc1
54 sorts after, same or before mbc2, modulo upper/lowercase conversion.
55
56 mb_equal (mbc1, mbc2)
57 returns true if mbc1 and mbc2 are equal.
58
59 mb_caseequal (mbc1, mbc2)
60 returns true if mbc1 and mbc2 are equal modulo upper/lowercase conversion.
61
62 mb_isalnum (mbc)
63 returns true if mbc is alphanumeric.
64
65 mb_isalpha (mbc)
66 returns true if mbc is alphabetic.
67
68 mb_isascii(mbc)
69 returns true if mbc is plain ASCII.
70
71 mb_isblank (mbc)
72 returns true if mbc is a blank.
73
74 mb_iscntrl (mbc)
75 returns true if mbc is a control character.
76
77 mb_isdigit (mbc)
78 returns true if mbc is a decimal digit.
79
80 mb_isgraph (mbc)
81 returns true if mbc is a graphic character.
82
83 mb_islower (mbc)
84 returns true if mbc is lowercase.
85
86 mb_isprint (mbc)
87 returns true if mbc is a printable character.
88
89 mb_ispunct (mbc)
90 returns true if mbc is a punctuation character.
91
92 mb_isspace (mbc)
93 returns true if mbc is a space character.
94
95 mb_isupper (mbc)
96 returns true if mbc is uppercase.
97
98 mb_isxdigit (mbc)
99 returns true if mbc is a hexadecimal digit.
100
101 mb_width (mbc)
102 returns the number of columns on the output device occupied by mbc.
103 Always >= 0.
104
105 mb_putc (mbc, stream)
106 outputs mbc on stream, a byte oriented FILE stream opened for output.
107
108 mb_setascii (&mbc, sc)
109 assigns the standard ASCII character sc to mbc.
110 (Only available if the 'mbfile' module is in use.)
111
112 mb_copy (&destmbc, &srcmbc)
113 copies srcmbc to destmbc.
114
115 Here are the function prototypes of the macros.
116
117 extern const char * mb_ptr (const mbchar_t mbc);
118 extern size_t mb_len (const mbchar_t mbc);
119 extern bool mb_iseq (const mbchar_t mbc, char sc);
120 extern bool mb_isnul (const mbchar_t mbc);
121 extern int mb_cmp (const mbchar_t mbc1, const mbchar_t mbc2);
122 extern int mb_casecmp (const mbchar_t mbc1, const mbchar_t mbc2);
123 extern bool mb_equal (const mbchar_t mbc1, const mbchar_t mbc2);
124 extern bool mb_caseequal (const mbchar_t mbc1, const mbchar_t mbc2);
125 extern bool mb_isalnum (const mbchar_t mbc);
126 extern bool mb_isalpha (const mbchar_t mbc);
127 extern bool mb_isascii (const mbchar_t mbc);
128 extern bool mb_isblank (const mbchar_t mbc);
129 extern bool mb_iscntrl (const mbchar_t mbc);
130 extern bool mb_isdigit (const mbchar_t mbc);
131 extern bool mb_isgraph (const mbchar_t mbc);
132 extern bool mb_islower (const mbchar_t mbc);
133 extern bool mb_isprint (const mbchar_t mbc);
134 extern bool mb_ispunct (const mbchar_t mbc);
135 extern bool mb_isspace (const mbchar_t mbc);
136 extern bool mb_isupper (const mbchar_t mbc);
137 extern bool mb_isxdigit (const mbchar_t mbc);
138 extern int mb_width (const mbchar_t mbc);
139 extern void mb_putc (const mbchar_t mbc, FILE *stream);
140 extern void mb_setascii (mbchar_t *new, char sc);
141 extern void mb_copy (mbchar_t *new, const mbchar_t *old);
142 */
143
144#ifndef _MBCHAR_H
145#define _MBCHAR_H 1
146
147/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE. */
148#if !_GL_CONFIG_H_INCLUDED
149 #error "Please include config.h first."
150#endif
151
152#include <string.h>
153#include <uchar.h>
154
155_GL_INLINE_HEADER_BEGIN
156#ifndef MBCHAR_INLINE
157# define MBCHAR_INLINE _GL_INLINE
158#endif
159
160#ifdef __cplusplus
161extern "C" {
162#endif
163
164
165/* The longest multibyte characters, nowadays, are 4 bytes long.
166 Regardless of the values of MB_CUR_MAX and MB_LEN_MAX. */
167#define MBCHAR_BUF_SIZE 4
168
169struct mbchar
170{
171 const char *ptr; /* pointer to current character */
172 size_t bytes; /* number of bytes of current character, > 0 */
173 bool wc_valid; /* true if wc is a valid 32-bit wide character */
174 char32_t wc; /* if wc_valid: the current character */
175#if defined GNULIB_MBFILE
176 char buf[MBCHAR_BUF_SIZE]; /* room for the bytes, used for file input only */
177#endif
178};
179
180/* EOF (not a real character) is represented with bytes = 0 and
181 wc_valid = false. */
182
183typedef struct mbchar mbchar_t;
184
185/* Access the current character. */
186#define mb_ptr(mbc) ((mbc).ptr)
187#define mb_len(mbc) ((mbc).bytes)
188
189/* Comparison of characters. */
190#define mb_iseq(mbc, sc) ((mbc).wc_valid && (mbc).wc == (sc))
191#define mb_isnul(mbc) ((mbc).wc_valid && (mbc).wc == 0)
192#define mb_cmp(mbc1, mbc2) \
193 ((mbc1).wc_valid \
194 ? ((mbc2).wc_valid \
195 ? _GL_CMP ((mbc1).wc, (mbc2).wc) \
196 : -1) \
197 : ((mbc2).wc_valid \
198 ? 1 \
199 : (mbc1).bytes == (mbc2).bytes \
200 ? memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) \
201 : (mbc1).bytes < (mbc2).bytes \
202 ? (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) > 0 ? 1 : -1) \
203 : (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc2).bytes) >= 0 ? 1 : -1)))
204#define mb_casecmp(mbc1, mbc2) \
205 ((mbc1).wc_valid \
206 ? ((mbc2).wc_valid \
207 ? _GL_CMP (c32tolower ((mbc1).wc), c32tolower ((mbc2).wc)) \
208 : -1) \
209 : ((mbc2).wc_valid \
210 ? 1 \
211 : (mbc1).bytes == (mbc2).bytes \
212 ? memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) \
213 : (mbc1).bytes < (mbc2).bytes \
214 ? (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) > 0 ? 1 : -1) \
215 : (memcmp ((mbc1).ptr, (mbc2).ptr, (mbc2).bytes) >= 0 ? 1 : -1)))
216#define mb_equal(mbc1, mbc2) \
217 ((mbc1).wc_valid && (mbc2).wc_valid \
218 ? (mbc1).wc == (mbc2).wc \
219 : (mbc1).bytes == (mbc2).bytes \
220 && memeq ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes))
221#define mb_caseequal(mbc1, mbc2) \
222 ((mbc1).wc_valid && (mbc2).wc_valid \
223 ? c32tolower ((mbc1).wc) == c32tolower ((mbc2).wc) \
224 : (mbc1).bytes == (mbc2).bytes \
225 && memeq ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes))
226
227/* <ctype.h>, <wctype.h> classification. */
228#define mb_isascii(mbc) \
229 ((mbc).wc_valid && (mbc).wc >= 0 && (mbc).wc <= 127)
230#define mb_isalnum(mbc) ((mbc).wc_valid && c32isalnum ((mbc).wc))
231#define mb_isalpha(mbc) ((mbc).wc_valid && c32isalpha ((mbc).wc))
232#define mb_isblank(mbc) ((mbc).wc_valid && c32isblank ((mbc).wc))
233#define mb_iscntrl(mbc) ((mbc).wc_valid && c32iscntrl ((mbc).wc))
234#define mb_isdigit(mbc) ((mbc).wc_valid && c32isdigit ((mbc).wc))
235#define mb_isgraph(mbc) ((mbc).wc_valid && c32isgraph ((mbc).wc))
236#define mb_islower(mbc) ((mbc).wc_valid && c32islower ((mbc).wc))
237#define mb_isprint(mbc) ((mbc).wc_valid && c32isprint ((mbc).wc))
238#define mb_ispunct(mbc) ((mbc).wc_valid && c32ispunct ((mbc).wc))
239#define mb_isspace(mbc) ((mbc).wc_valid && c32isspace ((mbc).wc))
240#define mb_isupper(mbc) ((mbc).wc_valid && c32isupper ((mbc).wc))
241#define mb_isxdigit(mbc) ((mbc).wc_valid && c32isxdigit ((mbc).wc))
242
243/* Extra <wchar.h> function. */
244
245/* Unprintable characters appear as a small box of width 1. */
246#define MB_UNPRINTABLE_WIDTH 1
247
248MBCHAR_INLINE int
249mb_width_aux (char32_t wc)
250{
251 int w = c32width (wc);
252 /* For unprintable characters, arbitrarily return 0 for control characters
253 and MB_UNPRINTABLE_WIDTH otherwise. */
254 return (w >= 0 ? w : c32iscntrl (wc) ? 0 : MB_UNPRINTABLE_WIDTH);
255}
256
257#define mb_width(mbc) \
258 ((mbc).wc_valid ? mb_width_aux ((mbc).wc) : MB_UNPRINTABLE_WIDTH)
259
260/* Output. */
261#define mb_putc(mbc, stream) fwrite ((mbc).ptr, 1, (mbc).bytes, (stream))
262
263#if defined GNULIB_MBFILE
264/* Assignment. */
265MBCHAR_INLINE void
266mb_setascii (mbchar_t *mbc, char sc)
267{
268 mbc->ptr = mbc->buf;
269 mbc->bytes = 1;
270 mbc->wc_valid = true;
271 mbc->wc = mbc->buf[0] = sc;
272}
273#endif
274
275/* Copying a character. */
276MBCHAR_INLINE void
277mb_copy (mbchar_t *new_mbc, const mbchar_t *old_mbc)
278{
279#if defined GNULIB_MBFILE
280 if (old_mbc->ptr == &old_mbc->buf[0])
281 {
282 memcpy (&new_mbc->buf[0], &old_mbc->buf[0], old_mbc->bytes);
283 new_mbc->ptr = &new_mbc->buf[0];
284 }
285 else
286#endif
287 new_mbc->ptr = old_mbc->ptr;
288 new_mbc->bytes = old_mbc->bytes;
289 if ((new_mbc->wc_valid = old_mbc->wc_valid))
290 new_mbc->wc = old_mbc->wc;
291}
292
293
294/* is_basic(c) tests whether the single-byte character c is
295 - in the ISO C "basic character set" or is one of '@', '$', and '`'
296 which ISO C 23 § 5.2.1.1.(1) guarantees to be single-byte and in
297 practice are safe to treat as basic in the execution character set,
298 or
299 - in the POSIX "portable character set", which
300 <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap06.html>
301 equally guarantees to be single-byte.
302 This is a convenience function, and is in this file only to share code
303 between mbiter.h, mbuiter.h, and mbfile.h. */
304#if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
305 && ('$' == 36) && ('%' == 37) && ('&' == 38) && ('\'' == 39) \
306 && ('(' == 40) && (')' == 41) && ('*' == 42) && ('+' == 43) \
307 && (',' == 44) && ('-' == 45) && ('.' == 46) && ('/' == 47) \
308 && ('0' == 48) && ('1' == 49) && ('2' == 50) && ('3' == 51) \
309 && ('4' == 52) && ('5' == 53) && ('6' == 54) && ('7' == 55) \
310 && ('8' == 56) && ('9' == 57) && (':' == 58) && (';' == 59) \
311 && ('<' == 60) && ('=' == 61) && ('>' == 62) && ('?' == 63) \
312 && ('@' == 64) && ('A' == 65) && ('B' == 66) && ('C' == 67) \
313 && ('D' == 68) && ('E' == 69) && ('F' == 70) && ('G' == 71) \
314 && ('H' == 72) && ('I' == 73) && ('J' == 74) && ('K' == 75) \
315 && ('L' == 76) && ('M' == 77) && ('N' == 78) && ('O' == 79) \
316 && ('P' == 80) && ('Q' == 81) && ('R' == 82) && ('S' == 83) \
317 && ('T' == 84) && ('U' == 85) && ('V' == 86) && ('W' == 87) \
318 && ('X' == 88) && ('Y' == 89) && ('Z' == 90) && ('[' == 91) \
319 && ('\\' == 92) && (']' == 93) && ('^' == 94) && ('_' == 95) \
320 && ('`' == 96) && ('a' == 97) && ('b' == 98) && ('c' == 99) \
321 && ('d' == 100) && ('e' == 101) && ('f' == 102) && ('g' == 103) \
322 && ('h' == 104) && ('i' == 105) && ('j' == 106) && ('k' == 107) \
323 && ('l' == 108) && ('m' == 109) && ('n' == 110) && ('o' == 111) \
324 && ('p' == 112) && ('q' == 113) && ('r' == 114) && ('s' == 115) \
325 && ('t' == 116) && ('u' == 117) && ('v' == 118) && ('w' == 119) \
326 && ('x' == 120) && ('y' == 121) && ('z' == 122) && ('{' == 123) \
327 && ('|' == 124) && ('}' == 125) && ('~' == 126)
328/* The character set is ISO-646, not EBCDIC. */
329# define IS_BASIC_ASCII 1
330
331/* All locale encodings (see localcharset.h) map the characters 0x00..0x7F
332 to U+0000..U+007F, like ASCII, except for
333 CP864 different mapping of '%'
334 SHIFT_JIS different mappings of 0x5C, 0x7E
335 JOHAB different mapping of 0x5C
336 However, these characters in the range 0x20..0x7E are in the ISO C
337 "basic character set" and in the POSIX "portable character set", which
338 ISO C and POSIX guarantee to be single-byte. Thus, locales with these
339 encodings are not POSIX compliant. And they are most likely not in use
340 any more (as of 2023). */
341# define is_basic(c) ((unsigned char) (c) < 0x80)
342
343#else
344
345MBCHAR_INLINE bool
346is_basic (char c)
347{
348 switch (c)
349 {
350 case '\0':
351 case '\007': case '\010':
352 case '\t': case '\n': case '\v': case '\f': case '\r':
353 case ' ': case '!': case '"': case '#': case '$': case '%':
354 case '&': case '\'': case '(': case ')': case '*':
355 case '+': case ',': case '-': case '.': case '/':
356 case '0': case '1': case '2': case '3': case '4':
357 case '5': case '6': case '7': case '8': case '9':
358 case ':': case ';': case '<': case '=': case '>':
359 case '?': case '@':
360 case 'A': case 'B': case 'C': case 'D': case 'E':
361 case 'F': case 'G': case 'H': case 'I': case 'J':
362 case 'K': case 'L': case 'M': case 'N': case 'O':
363 case 'P': case 'Q': case 'R': case 'S': case 'T':
364 case 'U': case 'V': case 'W': case 'X': case 'Y':
365 case 'Z':
366 case '[': case '\\': case ']': case '^': case '_': case '`':
367 case 'a': case 'b': case 'c': case 'd': case 'e':
368 case 'f': case 'g': case 'h': case 'i': case 'j':
369 case 'k': case 'l': case 'm': case 'n': case 'o':
370 case 'p': case 'q': case 'r': case 's': case 't':
371 case 'u': case 'v': case 'w': case 'x': case 'y':
372 case 'z': case '{': case '|': case '}': case '~':
373 return 1;
374 default:
375 return 0;
376 }
377}
378
379#endif
380
381
382#ifdef __cplusplus
383}
384#endif
385
386_GL_INLINE_HEADER_END
387
388#endif /* _MBCHAR_H */
diff --git a/gl/mbiterf.c b/gl/mbiterf.c
new file mode 100644
index 00000000..bb0a5cc3
--- /dev/null
+++ b/gl/mbiterf.c
@@ -0,0 +1,20 @@
1/* Iterating through multibyte strings: macros for multi-byte encodings.
2
3 Copyright (C) 2023-2026 Free Software Foundation, Inc.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#define MBITERF_INLINE _GL_EXTERN_INLINE
19#include <config.h>
20#include "mbiterf.h"
diff --git a/gl/mbiterf.h b/gl/mbiterf.h
new file mode 100644
index 00000000..50a39c0f
--- /dev/null
+++ b/gl/mbiterf.h
@@ -0,0 +1,214 @@
1/* Iterating through multibyte strings, faster: macros for multi-byte encodings.
2 Copyright (C) 2001, 2005, 2007, 2009-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17/* Written by Bruno Haible <bruno@clisp.org>,
18 with insights from Paul Eggert. */
19
20/* The macros in this file implement forward iteration through a
21 multi-byte string.
22
23 With these macros, an iteration loop that looks like
24
25 char *iter;
26 for (iter = buf; iter < buf + buflen; iter++)
27 {
28 do_something (*iter);
29 }
30
31 becomes
32
33 const char *buf_end = buf + buflen;
34 mbif_state_t state;
35 [const] char *iter;
36 for (mbif_init (state), iter = buf; mbif_avail (state, iter, buf_end); )
37 {
38 mbchar_t cur = mbif_next (state, iter, buf_end);
39 // Note: Here always mb_ptr (cur) == iter.
40 do_something (iter, mb_len (cur));
41 iter += mb_len (cur);
42 }
43
44 The benefit of these macros over plain use of mbrtowc or mbrtoc32 is:
45 - Handling of invalid multibyte sequences is possible without
46 making the code more complicated, while still preserving the
47 invalid multibyte sequences.
48
49 The benefit of these macros over those from mbiter.h is that it
50 produces faster code with today's optimizing compilers (because mbif_next
51 returns its result by value).
52
53 mbif_state_t
54 is a type usable for variable declarations.
55
56 mbif_init (state)
57 initializes the state.
58
59 mbif_avail (state, iter, endptr)
60 returns true if another loop round is needed.
61
62 mbif_next (state, iter, endptr)
63 returns the next multibyte character.
64 It assumes that the state is initialized and that iter < endptr.
65
66 Here are the function prototypes of the macros.
67
68 extern void mbif_init (mbif_state_t state);
69 extern bool mbif_avail (mbif_state_t state, const char *iter, const char *endptr);
70 extern mbchar_t mbif_next (mbif_state_t state, const char *iter, const char *endptr);
71 */
72
73#ifndef _MBITERF_H
74#define _MBITERF_H 1
75
76/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE,
77 _GL_ATTRIBUTE_ALWAYS_INLINE. */
78#if !_GL_CONFIG_H_INCLUDED
79 #error "Please include config.h first."
80#endif
81
82#include <assert.h>
83#include <stddef.h>
84#include <string.h>
85#include <uchar.h>
86#include <wchar.h>
87
88#include "mbchar.h"
89
90_GL_INLINE_HEADER_BEGIN
91#ifndef MBITERF_INLINE
92# define MBITERF_INLINE _GL_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE
93#endif
94
95#ifdef __cplusplus
96extern "C" {
97#endif
98
99
100struct mbif_state
101{
102 #if !GNULIB_MBRTOC32_REGULAR
103 bool in_shift; /* true if next byte may not be interpreted as ASCII */
104 /* If GNULIB_MBRTOC32_REGULAR, it is always false,
105 so optimize it away. */
106 #endif
107 mbstate_t state; /* if in_shift: current shift state */
108 /* If GNULIB_MBRTOC32_REGULAR, it is in an initial state
109 before and after every mbiterf_next invocation.
110 */
111};
112
113MBITERF_INLINE mbchar_t
114mbiterf_next (struct mbif_state *ps, const char *iter, const char *endptr)
115{
116 #if !GNULIB_MBRTOC32_REGULAR
117 if (ps->in_shift)
118 goto with_shift;
119 #endif
120 /* Handle most ASCII characters quickly, without calling mbrtowc(). */
121 if (is_basic (*iter))
122 {
123 /* These characters are part of the POSIX portable character set.
124 For most of them, namely those in the ISO C basic character set,
125 ISO C 99 guarantees that their wide character code is identical to
126 their char code. For the few other ones, this is the case as well,
127 in all locale encodings that are in use. The 32-bit wide character
128 code is the same as well. */
129 return (mbchar_t) { .ptr = iter, .bytes = 1, .wc_valid = true, .wc = *iter };
130 }
131 else
132 {
133 assert (mbsinit (&ps->state));
134 #if !GNULIB_MBRTOC32_REGULAR
135 ps->in_shift = true;
136 with_shift:;
137 #endif
138 size_t bytes;
139 char32_t wc;
140 bytes = mbrtoc32 (&wc, iter, endptr - iter, &ps->state);
141 if (bytes == (size_t) -1)
142 {
143 /* An invalid multibyte sequence was encountered. */
144 /* Allow the next invocation to continue from a sane state. */
145 #if !GNULIB_MBRTOC32_REGULAR
146 ps->in_shift = false;
147 #endif
148 mbszero (&ps->state);
149 return (mbchar_t) { .ptr = iter, .bytes = 1, .wc_valid = false };
150 }
151 else if (bytes == (size_t) -2)
152 {
153 /* An incomplete multibyte character at the end. */
154 #if !GNULIB_MBRTOC32_REGULAR
155 ps->in_shift = false;
156 #endif
157 /* Whether to reset ps->state or not is not important; the string end
158 is reached anyway. */
159 return (mbchar_t) { .ptr = iter, .bytes = endptr - iter, .wc_valid = false };
160 }
161 else
162 {
163 if (bytes == 0)
164 {
165 /* A null wide character was encountered. */
166 bytes = 1;
167 assert (*iter == '\0');
168 assert (wc == 0);
169 }
170 #if !GNULIB_MBRTOC32_REGULAR
171 else if (bytes == (size_t) -3)
172 /* The previous multibyte sequence produced an additional 32-bit
173 wide character. */
174 bytes = 0;
175 #endif
176
177 /* When in an initial state, we can go back treating ASCII
178 characters more quickly. */
179 #if !GNULIB_MBRTOC32_REGULAR
180 if (mbsinit (&ps->state))
181 ps->in_shift = false;
182 #endif
183 return (mbchar_t) { .ptr = iter, .bytes = bytes, .wc_valid = true, .wc = wc };
184 }
185 }
186}
187
188/* Iteration macros. */
189typedef struct mbif_state mbif_state_t;
190#if !GNULIB_MBRTOC32_REGULAR
191#define mbif_init(st) \
192 ((st).in_shift = false, mbszero (&(st).state))
193#else
194/* Optimized: no in_shift. */
195#define mbif_init(st) \
196 (mbszero (&(st).state))
197#endif
198#if !GNULIB_MBRTOC32_REGULAR
199#define mbif_avail(st, iter, endptr) ((st).in_shift || ((iter) < (endptr)))
200#else
201/* Optimized: no in_shift. */
202#define mbif_avail(st, iter, endptr) ((iter) < (endptr))
203#endif
204#define mbif_next(st, iter, endptr) \
205 mbiterf_next (&(st), (iter), (endptr))
206
207
208#ifdef __cplusplus
209}
210#endif
211
212_GL_INLINE_HEADER_END
213
214#endif /* _MBITERF_H */
diff --git a/gl/mbrtoc32.c b/gl/mbrtoc32.c
new file mode 100644
index 00000000..4c8f5267
--- /dev/null
+++ b/gl/mbrtoc32.c
@@ -0,0 +1,288 @@
1/* Convert multibyte character to 32-bit wide character.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17/* Written by Bruno Haible <bruno@clisp.org>, 2020. */
18
19#include <config.h>
20
21/* Specification. */
22#include <uchar.h>
23
24#include "attribute.h"
25
26#include <errno.h>
27#include <stdlib.h>
28
29#if GL_CHAR32_T_IS_UNICODE
30# include "lc-charset-unicode.h"
31#endif
32
33#if GNULIB_defined_mbstate_t /* AIX */
34/* Implement mbrtoc32() on top of mbtowc() for the non-UTF-8 locales
35 and directly for the UTF-8 locales. */
36
37/* Note: On AIX (64-bit) we can implement mbrtoc32 in two equivalent ways:
38 - in a way that parallels the override of mbrtowc; this is the code branch
39 here;
40 - in a way that invokes the overridden mbrtowc; this would be the #else
41 branch below.
42 They are equivalent. */
43
44# if AVOID_ANY_THREADS
45
46/* The option '--disable-threads' explicitly requests no locking. */
47
48# elif defined _WIN32 && !defined __CYGWIN__
49
50# define WIN32_LEAN_AND_MEAN /* avoid including junk */
51# include <windows.h>
52
53# elif HAVE_PTHREAD_API
54
55# include <pthread.h>
56# if HAVE_THREADS_H && HAVE_WEAK_SYMBOLS
57# include <threads.h>
58# pragma weak thrd_exit
59# define c11_threads_in_use() (thrd_exit != NULL)
60# else
61# define c11_threads_in_use() 0
62# endif
63
64# elif HAVE_THREADS_H
65
66# include <threads.h>
67
68# endif
69
70# include "lc-charset-dispatch.h"
71# include "mbtowc-lock.h"
72
73static_assert (sizeof (mbstate_t) >= 4);
74static char internal_state[4];
75
76size_t
77mbrtoc32 (char32_t *pwc, const char *s, size_t n, mbstate_t *ps)
78{
79# define FITS_IN_CHAR_TYPE(wc) 1
80# include "mbrtowc-impl.h"
81}
82
83#else /* glibc, macOS, FreeBSD, NetBSD, OpenBSD, HP-UX, Solaris, Cygwin, mingw, MSVC, Minix, Android */
84
85/* Implement mbrtoc32() based on the original mbrtoc32() or on mbrtowc(). */
86
87# include <wchar.h>
88
89# include "localcharset.h"
90# include "streq.h"
91
92# if MBRTOC32_IN_C_LOCALE_MAYBE_EILSEQ
93# include "hard-locale.h"
94# include <locale.h>
95# endif
96
97static mbstate_t internal_state;
98
99size_t
100mbrtoc32 (char32_t *pwc, const char *s, size_t n, mbstate_t *ps)
101# undef mbrtoc32
102{
103 /* It's simpler to handle the case s == NULL upfront, than to worry about
104 this case later, before every test of pwc and n. */
105 if (s == NULL)
106 {
107 pwc = NULL;
108 s = "";
109 n = 1;
110 }
111
112# if MBRTOC32_EMPTY_INPUT_BUG || _GL_SMALL_WCHAR_T
113 if (n == 0)
114 return (size_t) -2;
115# endif
116
117 if (ps == NULL)
118 ps = &internal_state;
119
120# if HAVE_WORKING_MBRTOC32 && HAVE_WORKING_C32RTOMB && !MBRTOC32_MULTIBYTE_LOCALE_BUG
121 /* mbrtoc32() may produce different values for wc than mbrtowc(). Therefore
122 use mbrtoc32(). */
123
124# if defined _WIN32 && !defined __CYGWIN__
125 char32_t wc;
126 size_t ret = mbrtoc32 (&wc, s, n, ps);
127 if (ret < (size_t) -2 && pwc != NULL)
128 *pwc = wc;
129# else
130 size_t ret = mbrtoc32 (pwc, s, n, ps);
131# endif
132
133# if GNULIB_MBRTOC32_REGULAR
134 /* Verify that mbrtoc32 is regular. */
135 if (ret < (size_t) -3 && ! mbsinit (ps))
136 /* This occurs on glibc 2.36. */
137 mbszero (ps);
138 if (ret == (size_t) -3)
139 abort ();
140# endif
141
142# if MBRTOC32_IN_C_LOCALE_MAYBE_EILSEQ
143 if ((size_t) -2 <= ret && n != 0 && ! hard_locale (LC_CTYPE))
144 {
145 if (pwc != NULL)
146 *pwc = (unsigned char) *s;
147 return 1;
148 }
149# endif
150
151 return ret;
152
153# elif _GL_SMALL_WCHAR_T
154
155 /* Special-case all encodings that may produce wide character values
156 > WCHAR_MAX. */
157 const char *encoding = locale_charset ();
158 if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
159 {
160 /* Special-case the UTF-8 encoding. Assume that the wide-character
161 encoding in a UTF-8 locale is UCS-2 or, equivalently, UTF-16. */
162 /* Here n > 0. */
163 char *pstate = (char *)ps;
164 size_t nstate = pstate[0];
165 char buf[4];
166 const char *p;
167 size_t m;
168
169 switch (nstate)
170 {
171 case 0:
172 p = s;
173 m = n;
174 break;
175 case 3:
176 buf[2] = pstate[3];
177 FALLTHROUGH;
178 case 2:
179 buf[1] = pstate[2];
180 FALLTHROUGH;
181 case 1:
182 buf[0] = pstate[1];
183 p = buf;
184 m = nstate;
185 buf[m++] = s[0];
186 if (n >= 2 && m < 4)
187 {
188 buf[m++] = s[1];
189 if (n >= 3 && m < 4)
190 buf[m++] = s[2];
191 }
192 break;
193 default:
194 errno = EINVAL;
195 return (size_t)(-1);
196 }
197
198 /* Here m > 0. */
199
200 int res;
201 {
202# define FITS_IN_CHAR_TYPE(wc) 1
203# include "mbrtowc-impl-utf8.h"
204 }
205
206 success:
207 if (nstate >= (res > 0 ? res : 1))
208 abort ();
209 res -= nstate;
210 /* Set *ps to an initial state. */
211# if defined _WIN32 && !defined __CYGWIN__
212 /* Native Windows. */
213 /* MSVC defines 'mbstate_t' as an 8-byte struct; the first 4 bytes matter.
214 On mingw, 'mbstate_t' is sometimes defined as 'int', sometimes defined
215 as an 8-byte struct, of which the first 4 bytes matter. */
216 *(unsigned int *)pstate = 0;
217# elif defined __CYGWIN__
218 /* Cygwin defines 'mbstate_t' as an 8-byte struct; the first 4 bytes
219 matter. */
220 ps->__count = 0;
221# else
222 pstate[0] = 0;
223# endif
224 return res;
225
226 incomplete:
227 {
228 size_t k = nstate;
229 /* Here 0 <= k < m < 4. */
230 pstate[++k] = s[0];
231 if (k < m)
232 {
233 pstate[++k] = s[1];
234 if (k < m)
235 pstate[++k] = s[2];
236 }
237 if (k != m)
238 abort ();
239 }
240 pstate[0] = m;
241 return (size_t)(-2);
242
243 invalid:
244 errno = EILSEQ;
245 /* The conversion state is undefined, says POSIX. */
246 return (size_t)(-1);
247 }
248 else
249 {
250 wchar_t wc;
251 size_t ret = mbrtowc (&wc, s, n, ps);
252 if (ret < (size_t) -2 && pwc != NULL)
253 *pwc = wc;
254 return ret;
255 }
256
257# else
258
259 /* char32_t and wchar_t are equivalent. Use mbrtowc(). */
260 wchar_t wc;
261 size_t ret = mbrtowc (&wc, s, n, ps);
262
263# if GNULIB_MBRTOC32_REGULAR
264 /* Ensure that mbrtoc32 is regular. */
265 if (ret < (size_t) -2 && ! mbsinit (ps))
266 /* This occurs on glibc 2.12. */
267 mbszero (ps);
268# endif
269
270# if GL_CHAR32_T_IS_UNICODE && GL_CHAR32_T_VS_WCHAR_T_NEEDS_CONVERSION
271 if (ret < (size_t) -2 && wc != 0)
272 {
273 wc = locale_encoding_to_unicode (wc);
274 if (wc == 0)
275 {
276 ret = (size_t) -1;
277 errno = EILSEQ;
278 }
279 }
280# endif
281 if (ret < (size_t) -2 && pwc != NULL)
282 *pwc = wc;
283 return ret;
284
285# endif
286}
287
288#endif
diff --git a/gl/mbrtowc-impl-utf8.h b/gl/mbrtowc-impl-utf8.h
index 3a3ba13c..ad96ca84 100644
--- a/gl/mbrtowc-impl-utf8.h
+++ b/gl/mbrtowc-impl-utf8.h
@@ -1,5 +1,5 @@
1/* Convert multibyte character to wide character. 1/* Convert multibyte character to wide character.
2 Copyright (C) 1999-2002, 2005-2024 Free Software Foundation, Inc. 2 Copyright (C) 1999-2002, 2005-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/mbrtowc-impl.h b/gl/mbrtowc-impl.h
index 963631ca..21a3998c 100644
--- a/gl/mbrtowc-impl.h
+++ b/gl/mbrtowc-impl.h
@@ -1,5 +1,5 @@
1/* Convert multibyte character to wide character. 1/* Convert multibyte character to wide character.
2 Copyright (C) 1999-2002, 2005-2024 Free Software Foundation, Inc. 2 Copyright (C) 1999-2002, 2005-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -41,8 +41,6 @@
41 char buf[4]; 41 char buf[4];
42 const char *p; 42 const char *p;
43 size_t m; 43 size_t m;
44 enc_t enc;
45 int res;
46 44
47 switch (nstate) 45 switch (nstate)
48 { 46 {
@@ -75,7 +73,8 @@
75 73
76 /* Here m > 0. */ 74 /* Here m > 0. */
77 75
78 enc = locale_encoding_classification (); 76 enc_t enc = locale_encoding_classification ();
77 int res;
79 78
80 if (enc == enc_utf8) /* UTF-8 */ 79 if (enc == enc_utf8) /* UTF-8 */
81 { 80 {
@@ -89,17 +88,19 @@
89 { 88 {
90 /* The hidden internal state of mbtowc would make this function not 89 /* The hidden internal state of mbtowc would make this function not
91 multi-thread safe. Achieve multi-thread safety through a lock. */ 90 multi-thread safe. Achieve multi-thread safety through a lock. */
92 wchar_t wc; 91 {
93 res = mbtowc_with_lock (&wc, p, m); 92 wchar_t wc;
93 res = mbtowc_with_lock (&wc, p, m);
94 94
95 if (res >= 0) 95 if (res >= 0)
96 { 96 {
97 if ((wc == 0) != (res == 0)) 97 if ((wc == 0) != (res == 0))
98 abort (); 98 abort ();
99 if (pwc != NULL) 99 if (pwc != NULL)
100 *pwc = wc; 100 *pwc = wc;
101 goto success; 101 goto success;
102 } 102 }
103 }
103 104
104 /* mbtowc does not distinguish between invalid and incomplete multibyte 105 /* mbtowc does not distinguish between invalid and incomplete multibyte
105 sequences. But mbrtowc needs to make this distinction. 106 sequences. But mbrtowc needs to make this distinction.
diff --git a/gl/mbrtowc.c b/gl/mbrtowc.c
index 8a1646d2..49831706 100644
--- a/gl/mbrtowc.c
+++ b/gl/mbrtowc.c
@@ -1,5 +1,5 @@
1/* Convert multibyte character to wide character. 1/* Convert multibyte character to wide character.
2 Copyright (C) 1999-2002, 2005-2024 Free Software Foundation, Inc. 2 Copyright (C) 1999-2002, 2005-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2008. 3 Written by Bruno Haible <bruno@clisp.org>, 2008.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
@@ -81,10 +81,7 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
81size_t 81size_t
82rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) 82rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
83{ 83{
84 size_t ret; 84# if MBRTOWC_RETVAL_BUG || MBRTOWC_EMPTY_INPUT_BUG
85 wchar_t wc;
86
87# if MBRTOWC_NULL_ARG2_BUG || MBRTOWC_RETVAL_BUG || MBRTOWC_EMPTY_INPUT_BUG
88 if (s == NULL) 85 if (s == NULL)
89 { 86 {
90 pwc = NULL; 87 pwc = NULL;
@@ -98,6 +95,7 @@ rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
98 return (size_t) -2; 95 return (size_t) -2;
99# endif 96# endif
100 97
98 wchar_t wc;
101 if (! pwc) 99 if (! pwc)
102 pwc = &wc; 100 pwc = &wc;
103 101
@@ -116,7 +114,7 @@ rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
116 size_t count = 0; 114 size_t count = 0;
117 for (; n > 0; s++, n--) 115 for (; n > 0; s++, n--)
118 { 116 {
119 ret = mbrtowc (&wc, s, 1, ps); 117 size_t ret = mbrtowc (&wc, s, 1, ps);
120 118
121 if (ret == (size_t)(-1)) 119 if (ret == (size_t)(-1))
122 return (size_t)(-1); 120 return (size_t)(-1);
@@ -133,6 +131,7 @@ rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
133 } 131 }
134# endif 132# endif
135 133
134 size_t ret;
136# if MBRTOWC_STORES_INCOMPLETE_BUG 135# if MBRTOWC_STORES_INCOMPLETE_BUG
137 ret = mbrtowc (&wc, s, n, ps); 136 ret = mbrtowc (&wc, s, n, ps);
138 if (ret < (size_t) -2 && pwc != NULL) 137 if (ret < (size_t) -2 && pwc != NULL)
diff --git a/gl/mbsinit.c b/gl/mbsinit.c
index d1b8475c..6252aa7a 100644
--- a/gl/mbsinit.c
+++ b/gl/mbsinit.c
@@ -1,5 +1,5 @@
1/* Test for initial conversion state. 1/* Test for initial conversion state.
2 Copyright (C) 2008-2024 Free Software Foundation, Inc. 2 Copyright (C) 2008-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2008. 3 Written by Bruno Haible <bruno@clisp.org>, 2008.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
diff --git a/gl/mbsnlen.c b/gl/mbsnlen.c
new file mode 100644
index 00000000..bcca569b
--- /dev/null
+++ b/gl/mbsnlen.c
@@ -0,0 +1,60 @@
1/* Counting the multibyte characters in a string.
2 Copyright (C) 2007-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2007.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#include <config.h>
19
20/* Specification. */
21#include <string.h>
22
23#include <stdlib.h>
24
25#if GNULIB_MCEL_PREFER
26# include "mcel.h"
27#else
28# include "mbiterf.h"
29#endif
30
31/* Return the number of multibyte characters in the character string starting
32 at STRING and ending at STRING + LEN. */
33size_t
34mbsnlen (const char *string, size_t len)
35{
36 if (MB_CUR_MAX > 1)
37 {
38 size_t count = 0;
39
40 const char *string_end = string + len;
41
42#if GNULIB_MCEL_PREFER
43 for (; string < string_end; string += mcel_scan (string, string_end).len)
44 count++;
45#else
46 mbif_state_t state;
47 const char *iter;
48 for (mbif_init (state), iter = string; mbif_avail (state, iter, string_end); )
49 {
50 mbchar_t cur = mbif_next (state, iter, string_end);
51 count++;
52 iter += mb_len (cur);
53 }
54#endif
55
56 return count;
57 }
58 else
59 return len;
60}
diff --git a/gl/mbszero.c b/gl/mbszero.c
index 25af2848..b63b2c04 100644
--- a/gl/mbszero.c
+++ b/gl/mbszero.c
@@ -1,5 +1,5 @@
1/* Put an mbstate_t into an initial conversion state. 1/* Put an mbstate_t into an initial conversion state.
2 Copyright (C) 2023-2024 Free Software Foundation, Inc. 2 Copyright (C) 2023-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/mbtowc-impl.h b/gl/mbtowc-impl.h
index 92efb4a7..c6d61968 100644
--- a/gl/mbtowc-impl.h
+++ b/gl/mbtowc-impl.h
@@ -1,5 +1,5 @@
1/* Convert multibyte character to wide character. 1/* Convert multibyte character to wide character.
2 Copyright (C) 2011-2024 Free Software Foundation, Inc. 2 Copyright (C) 2011-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2011. 3 Written by Bruno Haible <bruno@clisp.org>, 2011.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
@@ -27,11 +27,10 @@ mbtowc (wchar_t *pwc, const char *s, size_t n)
27 else 27 else
28 { 28 {
29 mbstate_t state; 29 mbstate_t state;
30 wchar_t wc;
31 size_t result;
32
33 mbszero (&state); 30 mbszero (&state);
34 result = mbrtowc (&wc, s, n, &state); 31
32 wchar_t wc;
33 size_t result = mbrtowc (&wc, s, n, &state);
35 if (result == (size_t)-1 || result == (size_t)-2) 34 if (result == (size_t)-1 || result == (size_t)-2)
36 { 35 {
37 errno = EILSEQ; 36 errno = EILSEQ;
diff --git a/gl/mbtowc-lock.c b/gl/mbtowc-lock.c
index 9001c5af..14106188 100644
--- a/gl/mbtowc-lock.c
+++ b/gl/mbtowc-lock.c
@@ -1,5 +1,5 @@
1/* Return the internal lock used by mbrtowc and mbrtoc32. 1/* Return the internal lock used by mbrtowc and mbrtoc32.
2 Copyright (C) 2019-2024 Free Software Foundation, Inc. 2 Copyright (C) 2019-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/mbtowc-lock.h b/gl/mbtowc-lock.h
index 10f7dc7c..b3e4e28e 100644
--- a/gl/mbtowc-lock.h
+++ b/gl/mbtowc-lock.h
@@ -1,5 +1,5 @@
1/* Use the internal lock used by mbrtowc and mbrtoc32. 1/* Use the internal lock used by mbrtowc and mbrtoc32.
2 Copyright (C) 2019-2024 Free Software Foundation, Inc. 2 Copyright (C) 2019-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -23,7 +23,7 @@ mbtowc_unlocked (wchar_t *pwc, const char *p, size_t m)
23{ 23{
24 /* Put the hidden internal state of mbtowc into an initial state. 24 /* Put the hidden internal state of mbtowc into an initial state.
25 This is needed at least with glibc, uClibc, and MSVC CRT. 25 This is needed at least with glibc, uClibc, and MSVC CRT.
26 See <https://sourceware.org/bugzilla/show_bug.cgi?id=9674>. */ 26 See <https://sourceware.org/PR9674>. */
27 mbtowc (NULL, NULL, 0); 27 mbtowc (NULL, NULL, 0);
28 28
29 return mbtowc (pwc, p, m); 29 return mbtowc (pwc, p, m);
@@ -50,16 +50,15 @@ static int
50mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m) 50mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m)
51{ 51{
52 CRITICAL_SECTION *lock = gl_get_mbtowc_lock (); 52 CRITICAL_SECTION *lock = gl_get_mbtowc_lock ();
53 int ret;
54 53
55 EnterCriticalSection (lock); 54 EnterCriticalSection (lock);
56 ret = mbtowc_unlocked (pwc, p, m); 55 int ret = mbtowc_unlocked (pwc, p, m);
57 LeaveCriticalSection (lock); 56 LeaveCriticalSection (lock);
58 57
59 return ret; 58 return ret;
60} 59}
61 60
62#elif HAVE_PTHREAD_API /* AIX, IRIX, Cygwin */ 61#elif HAVE_PTHREAD_API /* AIX, Cygwin */
63 62
64extern 63extern
65# if defined _WIN32 || defined __CYGWIN__ 64# if defined _WIN32 || defined __CYGWIN__
@@ -67,7 +66,7 @@ extern
67# endif 66# endif
68 pthread_mutex_t *gl_get_mbtowc_lock (void); 67 pthread_mutex_t *gl_get_mbtowc_lock (void);
69 68
70# if HAVE_WEAK_SYMBOLS /* IRIX */ 69# if HAVE_WEAK_SYMBOLS
71 70
72 /* Avoid the need to link with '-lpthread'. */ 71 /* Avoid the need to link with '-lpthread'. */
73# pragma weak pthread_mutex_lock 72# pragma weak pthread_mutex_lock
@@ -89,11 +88,10 @@ mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m)
89 if (pthread_in_use()) 88 if (pthread_in_use())
90 { 89 {
91 pthread_mutex_t *lock = gl_get_mbtowc_lock (); 90 pthread_mutex_t *lock = gl_get_mbtowc_lock ();
92 int ret;
93 91
94 if (pthread_mutex_lock (lock)) 92 if (pthread_mutex_lock (lock))
95 abort (); 93 abort ();
96 ret = mbtowc_unlocked (pwc, p, m); 94 int ret = mbtowc_unlocked (pwc, p, m);
97 if (pthread_mutex_unlock (lock)) 95 if (pthread_mutex_unlock (lock))
98 abort (); 96 abort ();
99 97
@@ -111,11 +109,10 @@ static int
111mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m) 109mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m)
112{ 110{
113 mtx_t *lock = gl_get_mbtowc_lock (); 111 mtx_t *lock = gl_get_mbtowc_lock ();
114 int ret;
115 112
116 if (mtx_lock (lock) != thrd_success) 113 if (mtx_lock (lock) != thrd_success)
117 abort (); 114 abort ();
118 ret = mbtowc_unlocked (pwc, p, m); 115 int ret = mbtowc_unlocked (pwc, p, m);
119 if (mtx_unlock (lock) != thrd_success) 116 if (mtx_unlock (lock) != thrd_success)
120 abort (); 117 abort ();
121 118
diff --git a/gl/mbtowc.c b/gl/mbtowc.c
index 31a2d635..2f30b9fb 100644
--- a/gl/mbtowc.c
+++ b/gl/mbtowc.c
@@ -1,5 +1,5 @@
1/* Convert multibyte character to wide character. 1/* Convert multibyte character to wide character.
2 Copyright (C) 2011-2024 Free Software Foundation, Inc. 2 Copyright (C) 2011-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2011. 3 Written by Bruno Haible <bruno@clisp.org>, 2011.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
diff --git a/gl/memchr.c b/gl/memchr.c
index 67687a8f..6adac7e1 100644
--- a/gl/memchr.c
+++ b/gl/memchr.c
@@ -1,4 +1,4 @@
1/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2024 1/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2026
2 Free Software Foundation, Inc. 2 Free Software Foundation, Inc.
3 3
4 Based on strlen implementation by Torbjorn Granlund (tege@sics.se), 4 Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
@@ -65,105 +65,103 @@ __memchr (void const *s, int c_in, size_t n)
65 performance. */ 65 performance. */
66 typedef unsigned long int longword; 66 typedef unsigned long int longword;
67 67
68 const unsigned char *char_ptr; 68 unsigned reg_char c = (unsigned char) c_in;
69 const longword *longword_ptr;
70 longword repeated_one;
71 longword repeated_c;
72 unsigned reg_char c;
73 69
74 c = (unsigned char) c_in; 70 const longword *longword_ptr;
75 71
76 /* Handle the first few bytes by reading one byte at a time. 72 /* Handle the first few bytes by reading one byte at a time.
77 Do this until CHAR_PTR is aligned on a longword boundary. */ 73 Do this until CHAR_PTR is aligned on a longword boundary. */
78 for (char_ptr = (const unsigned char *) s; 74 {
79 n > 0 && (size_t) char_ptr % sizeof (longword) != 0; 75 const unsigned char *char_ptr;
80 --n, ++char_ptr) 76 for (char_ptr = (const unsigned char *) s;
81 if (*char_ptr == c) 77 n > 0 && (size_t) char_ptr % sizeof (longword) != 0;
82 return (void *) char_ptr; 78 --n, ++char_ptr)
79 if (*char_ptr == c)
80 return (void *) char_ptr;
83 81
84 longword_ptr = (const longword *) char_ptr; 82 longword_ptr = (const longword *) char_ptr;
83 }
85 84
86 /* All these elucidatory comments refer to 4-byte longwords, 85 /* All these elucidatory comments refer to 4-byte longwords,
87 but the theory applies equally well to any size longwords. */ 86 but the theory applies equally well to any size longwords. */
88 87 {
89 /* Compute auxiliary longword values: 88 /* Compute auxiliary longword values:
90 repeated_one is a value which has a 1 in every byte. 89 repeated_one is a value which has a 1 in every byte.
91 repeated_c has c in every byte. */ 90 repeated_c has c in every byte. */
92 repeated_one = 0x01010101; 91 longword repeated_one = 0x01010101;
93 repeated_c = c | (c << 8); 92 longword repeated_c = c | (c << 8);
94 repeated_c |= repeated_c << 16; 93 repeated_c |= repeated_c << 16;
95 if (0xffffffffU < (longword) -1) 94 if (0xffffffffU < (longword) -1)
96 { 95 {
97 repeated_one |= repeated_one << 31 << 1; 96 repeated_one |= repeated_one << 31 << 1;
98 repeated_c |= repeated_c << 31 << 1; 97 repeated_c |= repeated_c << 31 << 1;
99 if (8 < sizeof (longword)) 98 if (8 < sizeof (longword))
100 { 99 for (size_t i = 64; i < sizeof (longword) * 8; i *= 2)
101 size_t i;
102
103 for (i = 64; i < sizeof (longword) * 8; i *= 2)
104 { 100 {
105 repeated_one |= repeated_one << i; 101 repeated_one |= repeated_one << i;
106 repeated_c |= repeated_c << i; 102 repeated_c |= repeated_c << i;
107 } 103 }
108 } 104 }
109 } 105
110 106 /* Instead of the traditional loop which tests each byte, we will test a
111 /* Instead of the traditional loop which tests each byte, we will test a 107 longword at a time. The tricky part is testing if *any of the four*
112 longword at a time. The tricky part is testing if *any of the four* 108 bytes in the longword in question are equal to c. We first use an xor
113 bytes in the longword in question are equal to c. We first use an xor 109 with repeated_c. This reduces the task to testing whether *any of the
114 with repeated_c. This reduces the task to testing whether *any of the 110 four* bytes in longword1 is zero.
115 four* bytes in longword1 is zero. 111
116 112 We compute tmp =
117 We compute tmp = 113 ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7).
118 ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7). 114 That is, we perform the following operations:
119 That is, we perform the following operations: 115 1. Subtract repeated_one.
120 1. Subtract repeated_one. 116 2. & ~longword1.
121 2. & ~longword1. 117 3. & a mask consisting of 0x80 in every byte.
122 3. & a mask consisting of 0x80 in every byte. 118 Consider what happens in each byte:
123 Consider what happens in each byte: 119 - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff,
124 - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff, 120 and step 3 transforms it into 0x80. A carry can also be propagated
125 and step 3 transforms it into 0x80. A carry can also be propagated 121 to more significant bytes.
126 to more significant bytes. 122 - If a byte of longword1 is nonzero, let its lowest 1 bit be at
127 - If a byte of longword1 is nonzero, let its lowest 1 bit be at 123 position k (0 <= k <= 7); so the lowest k bits are 0. After step 1,
128 position k (0 <= k <= 7); so the lowest k bits are 0. After step 1, 124 the byte ends in a single bit of value 0 and k bits of value 1.
129 the byte ends in a single bit of value 0 and k bits of value 1. 125 After step 2, the result is just k bits of value 1: 2^k - 1. After
130 After step 2, the result is just k bits of value 1: 2^k - 1. After 126 step 3, the result is 0. And no carry is produced.
131 step 3, the result is 0. And no carry is produced. 127 So, if longword1 has only non-zero bytes, tmp is zero.
132 So, if longword1 has only non-zero bytes, tmp is zero. 128 Whereas if longword1 has a zero byte, call j the position of the least
133 Whereas if longword1 has a zero byte, call j the position of the least 129 significant zero byte. Then the result has a zero at positions 0, ...,
134 significant zero byte. Then the result has a zero at positions 0, ..., 130 j-1 and a 0x80 at position j. We cannot predict the result at the more
135 j-1 and a 0x80 at position j. We cannot predict the result at the more 131 significant bytes (positions j+1..3), but it does not matter since we
136 significant bytes (positions j+1..3), but it does not matter since we 132 already have a non-zero bit at position 8*j+7.
137 already have a non-zero bit at position 8*j+7. 133
138 134 So, the test whether any byte in longword1 is zero is equivalent to
139 So, the test whether any byte in longword1 is zero is equivalent to 135 testing whether tmp is nonzero. */
140 testing whether tmp is nonzero. */ 136
141 137 while (n >= sizeof (longword))
142 while (n >= sizeof (longword)) 138 {
143 { 139 longword longword1 = *longword_ptr ^ repeated_c;
144 longword longword1 = *longword_ptr ^ repeated_c; 140
145 141 if ((((longword1 - repeated_one) & ~longword1)
146 if ((((longword1 - repeated_one) & ~longword1) 142 & (repeated_one << 7)) != 0)
147 & (repeated_one << 7)) != 0) 143 break;
148 break; 144 longword_ptr++;
149 longword_ptr++; 145 n -= sizeof (longword);
150 n -= sizeof (longword); 146 }
151 } 147 }
152 148
153 char_ptr = (const unsigned char *) longword_ptr; 149 {
154 150 const unsigned char *char_ptr = (const unsigned char *) longword_ptr;
155 /* At this point, we know that either n < sizeof (longword), or one of the 151
156 sizeof (longword) bytes starting at char_ptr is == c. On little-endian 152 /* At this point, we know that either n < sizeof (longword), or one of the
157 machines, we could determine the first such byte without any further 153 sizeof (longword) bytes starting at char_ptr is == c. On little-endian
158 memory accesses, just by looking at the tmp result from the last loop 154 machines, we could determine the first such byte without any further
159 iteration. But this does not work on big-endian machines. Choose code 155 memory accesses, just by looking at the tmp result from the last loop
160 that works in both cases. */ 156 iteration. But this does not work on big-endian machines. Choose code
161 157 that works in both cases. */
162 for (; n > 0; --n, ++char_ptr) 158
163 { 159 for (; n > 0; --n, ++char_ptr)
164 if (*char_ptr == c) 160 {
165 return (void *) char_ptr; 161 if (*char_ptr == c)
166 } 162 return (void *) char_ptr;
163 }
164 }
167 165
168 return NULL; 166 return NULL;
169} 167}
diff --git a/gl/memchr.valgrind b/gl/memchr.valgrind
index 0295d7e6..7ab1f6ff 100644
--- a/gl/memchr.valgrind
+++ b/gl/memchr.valgrind
@@ -1,6 +1,6 @@
1# Suppress a valgrind message about use of uninitialized memory in memchr(). 1# Suppress a valgrind message about use of uninitialized memory in memchr().
2 2
3# Copyright (C) 2009-2024 Free Software Foundation, Inc. 3# Copyright (C) 2009-2026 Free Software Foundation, Inc.
4# 4#
5# This file is free software: you can redistribute it and/or modify 5# This file is free software: you can redistribute it and/or modify
6# it under the terms of the GNU Lesser General Public License as 6# it under the terms of the GNU Lesser General Public License as
diff --git a/gl/minmax.h b/gl/minmax.h
index f3df58b0..fd731fb7 100644
--- a/gl/minmax.h
+++ b/gl/minmax.h
@@ -1,5 +1,5 @@
1/* MIN, MAX macros. 1/* MIN, MAX macros.
2 Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2024 Free Software 2 Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2026 Free Software
3 Foundation, Inc. 3 Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
@@ -19,8 +19,8 @@
19#define _MINMAX_H 19#define _MINMAX_H
20 20
21/* Note: MIN, MAX are also defined in <sys/param.h> on some systems 21/* Note: MIN, MAX are also defined in <sys/param.h> on some systems
22 (glibc, IRIX, HP-UX, OSF/1). Therefore you might get warnings about 22 (glibc, HP-UX). Therefore you might get warnings about MIN, MAX
23 MIN, MAX macro redefinitions on some systems; the workaround is to 23 macro redefinitions on some systems; the workaround is to
24 #include this file as the last one among the #include list. */ 24 #include this file as the last one among the #include list. */
25 25
26/* This file uses HAVE_MINMAX_IN_LIMITS_H, HAVE_MINMAX_IN_SYS_PARAM_H. */ 26/* This file uses HAVE_MINMAX_IN_LIMITS_H, HAVE_MINMAX_IN_SYS_PARAM_H. */
diff --git a/gl/mktime-internal.h b/gl/mktime-internal.h
index 0693aaf1..6ccf651c 100644
--- a/gl/mktime-internal.h
+++ b/gl/mktime-internal.h
@@ -1,5 +1,5 @@
1/* Internals of mktime and related functions 1/* Internals of mktime and related functions
2 Copyright 2016-2024 Free Software Foundation, Inc. 2 Copyright 2016-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 Contributed by Paul Eggert <eggert@cs.ucla.edu>. 4 Contributed by Paul Eggert <eggert@cs.ucla.edu>.
5 5
@@ -19,6 +19,9 @@
19 19
20#ifndef _LIBC 20#ifndef _LIBC
21# include <time.h> 21# include <time.h>
22# define __libc_lock_lock(lock) ((void) 0)
23# define __libc_lock_unlock(lock) ((void) 0)
24# define __tzset_unlocked() tzset ()
22#endif 25#endif
23 26
24/* mktime_offset_t is a signed type wide enough to hold a UTC offset 27/* mktime_offset_t is a signed type wide enough to hold a UTC offset
@@ -71,9 +74,10 @@ typedef int mktime_offset_t;
71#endif 74#endif
72 75
73/* Subroutine of mktime. Return the time_t representation of TP and 76/* Subroutine of mktime. Return the time_t representation of TP and
74 normalize TP, given that a struct tm * maps to a time_t as performed 77 normalize TP, given that a struct tm * maps to a time_t. If
75 by FUNC. Record next guess for localtime-gmtime offset in *OFFSET. */ 78 LOCAL, the mapping is performed by localtime_r, otherwise by gmtime_r.
76extern __time64_t __mktime_internal (struct tm *tp, 79 Record next guess for localtime-gmtime offset in *OFFSET.
77 struct tm *(*func) (__time64_t const *, 80
78 struct tm *), 81 If _LIBC, the caller must lock __tzset_lock. */
82extern __time64_t __mktime_internal (struct tm *tp, bool local,
79 mktime_offset_t *offset) attribute_hidden; 83 mktime_offset_t *offset) attribute_hidden;
diff --git a/gl/mktime.c b/gl/mktime.c
index c704f415..c56c6f9a 100644
--- a/gl/mktime.c
+++ b/gl/mktime.c
@@ -1,5 +1,5 @@
1/* Convert a 'struct tm' to a time_t value. 1/* Convert a 'struct tm' to a time_t value.
2 Copyright (C) 1993-2024 Free Software Foundation, Inc. 2 Copyright (C) 1993-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 Contributed by Paul Eggert <eggert@twinsun.com>. 4 Contributed by Paul Eggert <eggert@twinsun.com>.
5 5
@@ -51,7 +51,6 @@
51#include <string.h> 51#include <string.h>
52 52
53#include <intprops.h> 53#include <intprops.h>
54#include <verify.h>
55 54
56#ifndef NEED_MKTIME_INTERNAL 55#ifndef NEED_MKTIME_INTERNAL
57# define NEED_MKTIME_INTERNAL 0 56# define NEED_MKTIME_INTERNAL 0
@@ -63,6 +62,9 @@
63# define NEED_MKTIME_WORKING 0 62# define NEED_MKTIME_WORKING 0
64#endif 63#endif
65 64
65#ifdef _LIBC
66# include <tzset.h>
67#endif
66#include "mktime-internal.h" 68#include "mktime-internal.h"
67 69
68#if !defined _LIBC && (NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS) 70#if !defined _LIBC && (NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS)
@@ -99,8 +101,8 @@ my_tzset (void)
99 tzset (); 101 tzset ();
100# endif 102# endif
101} 103}
102# undef __tzset 104# undef tzset
103# define __tzset() my_tzset () 105# define tzset() my_tzset ()
104#endif 106#endif
105 107
106#if defined _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_INTERNAL 108#if defined _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_INTERNAL
@@ -119,12 +121,12 @@ my_tzset (void)
119 __time64_t values that mktime can generate even on platforms where 121 __time64_t values that mktime can generate even on platforms where
120 __time64_t is wider than the int components of struct tm. */ 122 __time64_t is wider than the int components of struct tm. */
121 123
122#if INT_MAX <= LONG_MAX / 4 / 366 / 24 / 60 / 60 124# if INT_MAX <= LONG_MAX / 4 / 366 / 24 / 60 / 60
123typedef long int long_int; 125typedef long int long_int;
124#else 126# else
125typedef long long int long_int; 127typedef long long int long_int;
126#endif 128# endif
127verify (INT_MAX <= TYPE_MAXIMUM (long_int) / 4 / 366 / 24 / 60 / 60); 129static_assert (INT_MAX <= TYPE_MAXIMUM (long_int) / 4 / 366 / 24 / 60 / 60);
128 130
129/* Shift A right by B bits portably, by dividing A by 2**B and 131/* Shift A right by B bits portably, by dividing A by 2**B and
130 truncating towards minus infinity. B should be in the range 0 <= B 132 truncating towards minus infinity. B should be in the range 0 <= B
@@ -155,9 +157,9 @@ static long_int const mktime_max
155 = (TYPE_MAXIMUM (long_int) < TYPE_MAXIMUM (__time64_t) 157 = (TYPE_MAXIMUM (long_int) < TYPE_MAXIMUM (__time64_t)
156 ? TYPE_MAXIMUM (long_int) : TYPE_MAXIMUM (__time64_t)); 158 ? TYPE_MAXIMUM (long_int) : TYPE_MAXIMUM (__time64_t));
157 159
158#define EPOCH_YEAR 1970 160# define EPOCH_YEAR 1970
159#define TM_YEAR_BASE 1900 161# define TM_YEAR_BASE 1900
160verify (TM_YEAR_BASE % 100 == 0); 162static_assert (TM_YEAR_BASE % 100 == 0);
161 163
162/* Is YEAR + TM_YEAR_BASE a leap year? */ 164/* Is YEAR + TM_YEAR_BASE a leap year? */
163static bool 165static bool
@@ -172,9 +174,9 @@ leapyear (long_int year)
172} 174}
173 175
174/* How many days come before each month (0-12). */ 176/* How many days come before each month (0-12). */
175#ifndef _LIBC 177# ifndef _LIBC
176static 178static
177#endif 179# endif
178const unsigned short int __mon_yday[2][13] = 180const unsigned short int __mon_yday[2][13] =
179 { 181 {
180 /* Normal years. */ 182 /* Normal years. */
@@ -206,7 +208,7 @@ static long_int
206ydhms_diff (long_int year1, long_int yday1, int hour1, int min1, int sec1, 208ydhms_diff (long_int year1, long_int yday1, int hour1, int min1, int sec1,
207 int year0, int yday0, int hour0, int min0, int sec0) 209 int year0, int yday0, int hour0, int min0, int sec0)
208{ 210{
209 verify (-1 / 2 == 0); 211 static_assert (-1 / 2 == 0);
210 212
211 /* Compute intervening leap days correctly even if year is negative. 213 /* Compute intervening leap days correctly even if year is negative.
212 Take care to avoid integer overflow here. */ 214 Take care to avoid integer overflow here. */
@@ -251,29 +253,34 @@ tm_diff (long_int year, long_int yday, int hour, int min, int sec,
251 tp->tm_hour, tp->tm_min, tp->tm_sec); 253 tp->tm_hour, tp->tm_min, tp->tm_sec);
252} 254}
253 255
254/* Use CONVERT to convert T to a struct tm value in *TM. T must be in 256#ifndef _LIBC
255 range for __time64_t. Return TM if successful, NULL (setting errno) on 257/* Convert T to a struct tm value in *TM. Use localtime64_r if LOCAL,
256 failure. */ 258 otherwise gmtime64_r. T must be in range for __time64_t. Return
259 TM if successful, NULL (setting errno) on failure. */
257static struct tm * 260static struct tm *
258convert_time (struct tm *(*convert) (const __time64_t *, struct tm *), 261convert_time (long_int t, bool local, struct tm *tm)
259 long_int t, struct tm *tm)
260{ 262{
261 __time64_t x = t; 263 __time64_t x = t;
262 return convert (&x, tm); 264 if (local)
265 return __localtime64_r (&x, tm);
266 else
267 return __gmtime64_r (&x, tm);
263} 268}
269# define __tz_convert convert_time
270#endif
264 271
265/* Use CONVERT to convert *T to a broken down time in *TP. 272/* Convert *T to a broken down time in *TP (as if by localtime if
266 If *T is out of range for conversion, adjust it so that 273 LOCAL, otherwise as if by gmtime). If *T is out of range for
267 it is the nearest in-range value and then convert that. 274 conversion, adjust it so that it is the nearest in-range value and
268 A value is in range if it fits in both __time64_t and long_int. 275 then convert that. A value is in range if it fits in both
269 Return TP on success, NULL (setting errno) on failure. */ 276 __time64_t and long_int. Return TP on success, NULL (setting
277 errno) on failure. */
270static struct tm * 278static struct tm *
271ranged_convert (struct tm *(*convert) (const __time64_t *, struct tm *), 279ranged_convert (bool local, long_int *t, struct tm *tp)
272 long_int *t, struct tm *tp)
273{ 280{
274 long_int t1 = (*t < mktime_min ? mktime_min 281 long_int t1 = (*t < mktime_min ? mktime_min
275 : *t <= mktime_max ? *t : mktime_max); 282 : *t <= mktime_max ? *t : mktime_max);
276 struct tm *r = convert_time (convert, t1, tp); 283 struct tm *r = __tz_convert (t1, local, tp);
277 if (r) 284 if (r)
278 { 285 {
279 *t = t1; 286 *t = t1;
@@ -294,7 +301,7 @@ ranged_convert (struct tm *(*convert) (const __time64_t *, struct tm *),
294 long_int mid = long_int_avg (ok, bad); 301 long_int mid = long_int_avg (ok, bad);
295 if (mid == ok || mid == bad) 302 if (mid == ok || mid == bad)
296 break; 303 break;
297 if (convert_time (convert, mid, tp)) 304 if (__tz_convert (mid, local, tp))
298 ok = mid, oktm = *tp; 305 ok = mid, oktm = *tp;
299 else if (errno != EOVERFLOW) 306 else if (errno != EOVERFLOW)
300 return NULL; 307 return NULL;
@@ -310,29 +317,38 @@ ranged_convert (struct tm *(*convert) (const __time64_t *, struct tm *),
310} 317}
311 318
312 319
313/* Convert *TP to a __time64_t value, inverting 320/* Convert *TP to a __time64_t value. If LOCAL, the reverse mapping
314 the monotonic and mostly-unit-linear conversion function CONVERT. 321 is performed as if localtime, otherwise as if by gmtime. Use
315 Use *OFFSET to keep track of a guess at the offset of the result, 322 *OFFSET to keep track of a guess at the offset of the result,
316 compared to what the result would be for UTC without leap seconds. 323 compared to what the result would be for UTC without leap seconds.
317 If *OFFSET's guess is correct, only one CONVERT call is needed. 324 If *OFFSET's guess is correct, only one reverse mapping call is
318 If successful, set *TP to the canonicalized struct tm; 325 needed. If successful, set *TP to the canonicalized struct tm;
319 otherwise leave *TP alone, return ((time_t) -1) and set errno. 326 otherwise leave *TP alone, return ((time_t) -1) and set errno.
320 This function is external because it is used also by timegm.c. */ 327 This function is external because it is used also by timegm.c.
328
329 If _LIBC, the caller must lock __tzset_lock. */
321__time64_t 330__time64_t
322__mktime_internal (struct tm *tp, 331__mktime_internal (struct tm *tp, bool local, mktime_offset_t *offset)
323 struct tm *(*convert) (const __time64_t *, struct tm *),
324 mktime_offset_t *offset)
325{ 332{
326 struct tm tm; 333 struct tm tm;
327 334
328 /* The maximum number of probes (calls to CONVERT) should be enough 335 /* The maximum number of probes should be enough to handle any
329 to handle any combinations of time zone rule changes, solar time, 336 combinations of time zone rule changes, solar time, leap seconds,
330 leap seconds, and oscillations around a spring-forward gap. 337 and oscillations around a spring-forward gap. POSIX.1 prohibits
331 POSIX.1 prohibits leap seconds, but some hosts have them anyway. */ 338 leap seconds, but some hosts have them anyway. */
332 int remaining_probes = 6; 339 int remaining_probes = 6;
333 340
334 /* Time requested. Copy it in case CONVERT modifies *TP; this can 341#ifndef _LIBC
335 occur if TP is localtime's returned value and CONVERT is localtime. */ 342 /* Gnulib mktime doesn't lock the tz state, so it may need to probe
343 more often if some other thread changes local time while
344 __mktime_internal is probing. Double the number of probes; this
345 should suffice for practical cases that are at all likely. */
346 remaining_probes *= 2;
347#endif
348
349 /* Time requested. Copy it in case gmtime/localtime modify *TP;
350 this can occur if TP is localtime's returned value and CONVERT is
351 localtime. */
336 int sec = tp->tm_sec; 352 int sec = tp->tm_sec;
337 int min = tp->tm_min; 353 int min = tp->tm_min;
338 int hour = tp->tm_hour; 354 int hour = tp->tm_hour;
@@ -341,8 +357,8 @@ __mktime_internal (struct tm *tp,
341 int year_requested = tp->tm_year; 357 int year_requested = tp->tm_year;
342 int isdst = tp->tm_isdst; 358 int isdst = tp->tm_isdst;
343 359
344 /* 1 if the previous probe was DST. */ 360 /* True if the previous probe was DST. */
345 int dst2 = 0; 361 bool dst2 = false;
346 362
347 /* Ensure that mon is in range, and set year accordingly. */ 363 /* Ensure that mon is in range, and set year accordingly. */
348 int mon_remainder = mon % 12; 364 int mon_remainder = mon % 12;
@@ -390,7 +406,7 @@ __mktime_internal (struct tm *tp,
390 406
391 while (true) 407 while (true)
392 { 408 {
393 if (! ranged_convert (convert, &t, &tm)) 409 if (! ranged_convert (local, &t, &tm))
394 return -1; 410 return -1;
395 long_int dt = tm_diff (year, yday, hour, min, sec, &tm); 411 long_int dt = tm_diff (year, yday, hour, min, sec, &tm);
396 if (dt == 0) 412 if (dt == 0)
@@ -431,13 +447,10 @@ __mktime_internal (struct tm *tp,
431 447
432 Heuristic: probe the adjacent timestamps in both directions, 448 Heuristic: probe the adjacent timestamps in both directions,
433 looking for the desired isdst. If none is found within a 449 looking for the desired isdst. If none is found within a
434 reasonable duration bound, assume a one-hour DST difference. 450 reasonable duration bound, ignore the disagreement.
435 This should work for all real time zone histories in the tz 451 This should work for all real time zone histories in the tz
436 database. */ 452 database. */
437 453
438 /* +1 if we wanted standard time but got DST, -1 if the reverse. */
439 int dst_difference = (isdst == 0) - (tm.tm_isdst == 0);
440
441 /* Distance between probes when looking for a DST boundary. In 454 /* Distance between probes when looking for a DST boundary. In
442 tzdata2003a, the shortest period of DST is 601200 seconds 455 tzdata2003a, the shortest period of DST is 601200 seconds
443 (e.g., America/Recife starting 2000-10-08 01:00), and the 456 (e.g., America/Recife starting 2000-10-08 01:00), and the
@@ -447,29 +460,23 @@ __mktime_internal (struct tm *tp,
447 periods when probing. */ 460 periods when probing. */
448 int stride = 601200; 461 int stride = 601200;
449 462
450 /* In TZDB 2021e, the longest period of DST (or of non-DST), in 463 /* Do not probe too far away from the requested time,
451 which the DST (or adjacent DST) difference is not one hour, 464 by striding until at least a year has passed, but then giving up.
452 is 457243209 seconds: e.g., America/Cambridge_Bay with leap 465 This helps avoid unexpected results in (for example) Asia/Kolkata,
453 seconds, starting 1965-10-31 00:00 in a switch from 466 for which today's users expect to see no DST even though it
454 double-daylight time (-05) to standard time (-07), and 467 did observe DST long ago. */
455 continuing to 1980-04-27 02:00 in a switch from standard time 468 int year_seconds_bound = 366 * 24 * 60 * 60 + 1;
456 (-07) to daylight time (-06). */ 469 int delta_bound = year_seconds_bound + stride;
457 int duration_max = 457243209; 470
458 471 /* Search in both directions, closest first. */
459 /* Search in both directions, so the maximum distance is half 472 for (int delta = stride; delta < delta_bound; delta += stride)
460 the duration; add the stride to avoid off-by-1 problems. */ 473 for (int direction = -1; direction <= 1; direction += 2)
461 int delta_bound = duration_max / 2 + stride;
462
463 int delta, direction;
464
465 for (delta = stride; delta < delta_bound; delta += stride)
466 for (direction = -1; direction <= 1; direction += 2)
467 { 474 {
468 long_int ot; 475 long_int ot;
469 if (! ckd_add (&ot, t, delta * direction)) 476 if (! ckd_add (&ot, t, delta * direction))
470 { 477 {
471 struct tm otm; 478 struct tm otm;
472 if (! ranged_convert (convert, &ot, &otm)) 479 if (! ranged_convert (local, &ot, &otm))
473 return -1; 480 return -1;
474 if (! isdst_differ (isdst, otm.tm_isdst)) 481 if (! isdst_differ (isdst, otm.tm_isdst))
475 { 482 {
@@ -479,7 +486,7 @@ __mktime_internal (struct tm *tp,
479 &otm); 486 &otm);
480 if (mktime_min <= gt && gt <= mktime_max) 487 if (mktime_min <= gt && gt <= mktime_max)
481 { 488 {
482 if (convert_time (convert, gt, &tm)) 489 if (__tz_convert (gt, local, &tm))
483 { 490 {
484 t = gt; 491 t = gt;
485 goto offset_found; 492 goto offset_found;
@@ -491,13 +498,8 @@ __mktime_internal (struct tm *tp,
491 } 498 }
492 } 499 }
493 500
494 /* No unusual DST offset was found nearby. Assume one-hour DST. */ 501 /* No probe with the requested tm_isdst was found nearby.
495 t += 60 * 60 * dst_difference; 502 Ignore the requested tm_isdst. */
496 if (mktime_min <= t && t <= mktime_max && convert_time (convert, t, &tm))
497 goto offset_found;
498
499 __set_errno (EOVERFLOW);
500 return -1;
501 } 503 }
502 504
503 offset_found: 505 offset_found:
@@ -520,7 +522,7 @@ __mktime_internal (struct tm *tp,
520 __set_errno (EOVERFLOW); 522 __set_errno (EOVERFLOW);
521 return -1; 523 return -1;
522 } 524 }
523 if (! convert_time (convert, t, &tm)) 525 if (! __tz_convert (t, local, &tm))
524 return -1; 526 return -1;
525 } 527 }
526 528
@@ -536,18 +538,19 @@ __mktime_internal (struct tm *tp,
536__time64_t 538__time64_t
537__mktime64 (struct tm *tp) 539__mktime64 (struct tm *tp)
538{ 540{
539 /* POSIX.1 8.1.1 requires that whenever mktime() is called, the 541 __libc_lock_lock (__tzset_lock);
540 time zone names contained in the external variable 'tzname' shall 542 __tzset_unlocked ();
541 be set as if the tzset() function had been called. */
542 __tzset ();
543 543
544# if defined _LIBC || NEED_MKTIME_WORKING 544# if defined _LIBC || NEED_MKTIME_WORKING
545 static mktime_offset_t localtime_offset; 545 static mktime_offset_t localtime_offset;
546 return __mktime_internal (tp, __localtime64_r, &localtime_offset); 546 __time64_t result = __mktime_internal (tp, true, &localtime_offset);
547# else 547# else
548# undef mktime 548# undef mktime
549 return mktime (tp); 549 __time64_t result = mktime (tp);
550# endif 550# endif
551
552 __libc_lock_unlock (__tzset_lock);
553 return result;
551} 554}
552#endif /* _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS */ 555#endif /* _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS */
553 556
diff --git a/gl/mountlist.c b/gl/mountlist.c
index 06300d6b..66b3f3d5 100644
--- a/gl/mountlist.c
+++ b/gl/mountlist.c
@@ -1,6 +1,6 @@
1/* mountlist.c -- return a list of mounted file systems 1/* mountlist.c -- return a list of mounted file systems
2 2
3 Copyright (C) 1991-1992, 1997-2024 Free Software Foundation, Inc. 3 Copyright (C) 1991-1992, 1997-2026 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
@@ -19,20 +19,18 @@
19 19
20#include "mountlist.h" 20#include "mountlist.h"
21 21
22#include <errno.h>
23#include <fcntl.h>
22#include <limits.h> 24#include <limits.h>
23#include <stdio.h> 25#include <stdio.h>
24#include <stdlib.h> 26#include <stdlib.h>
25#include <string.h> 27#include <string.h>
26#include <stdint.h> 28#include <stdint.h>
29#include <unistd.h>
27 30
31#include "c-ctype.h"
28#include "xalloc.h" 32#include "xalloc.h"
29 33
30#include <errno.h>
31
32#include <fcntl.h>
33
34#include <unistd.h>
35
36#if HAVE_SYS_PARAM_H 34#if HAVE_SYS_PARAM_H
37# include <sys/param.h> 35# include <sys/param.h>
38#endif 36#endif
@@ -43,7 +41,7 @@
43# include <sys/sysmacros.h> 41# include <sys/sysmacros.h>
44#endif 42#endif
45 43
46#if defined MOUNTED_GETFSSTAT /* OSF/1, also (obsolete) Apple Darwin 1.3 */ 44#if defined MOUNTED_GETFSSTAT /* (obsolete) Apple Darwin 1.3 */
47# if HAVE_SYS_UCRED_H 45# if HAVE_SYS_UCRED_H
48# include <grp.h> /* needed on OSF V4.0 for definition of NGROUPS, 46# include <grp.h> /* needed on OSF V4.0 for definition of NGROUPS,
49 NGROUPS is used as an array dimension in ucred.h */ 47 NGROUPS is used as an array dimension in ucred.h */
@@ -62,7 +60,7 @@
62# endif 60# endif
63#endif /* MOUNTED_GETFSSTAT */ 61#endif /* MOUNTED_GETFSSTAT */
64 62
65#ifdef MOUNTED_GETMNTENT1 /* glibc, HP-UX, IRIX, Cygwin, Android, 63#ifdef MOUNTED_GETMNTENT1 /* glibc, HP-UX, Cygwin, Android,
66 also (obsolete) 4.3BSD, SunOS */ 64 also (obsolete) 4.3BSD, SunOS */
67# include <mntent.h> 65# include <mntent.h>
68# include <sys/types.h> 66# include <sys/types.h>
@@ -132,6 +130,10 @@
132# endif 130# endif
133#endif 131#endif
134 132
133#if defined _WIN32 && !defined __CYGWIN__
134# include <windows.h>
135#endif
136
135#ifndef HAVE_HASMNTOPT 137#ifndef HAVE_HASMNTOPT
136# define hasmntopt(mnt, opt) ((char *) 0) 138# define hasmntopt(mnt, opt) ((char *) 0)
137#endif 139#endif
@@ -169,23 +171,21 @@
169#endif 171#endif
170 172
171#define ME_DUMMY_0(Fs_name, Fs_type) \ 173#define ME_DUMMY_0(Fs_name, Fs_type) \
172 (strcmp (Fs_type, "autofs") == 0 \ 174 (streq (Fs_type, "autofs") \
173 || strcmp (Fs_type, "proc") == 0 \ 175 || streq (Fs_type, "proc") \
174 || strcmp (Fs_type, "subfs") == 0 \ 176 || streq (Fs_type, "subfs") \
175 /* for Linux 2.6/3.x */ \ 177 /* for Linux 2.6/3.x */ \
176 || strcmp (Fs_type, "debugfs") == 0 \ 178 || streq (Fs_type, "debugfs") \
177 || strcmp (Fs_type, "devpts") == 0 \ 179 || streq (Fs_type, "devpts") \
178 || strcmp (Fs_type, "fusectl") == 0 \ 180 || streq (Fs_type, "fusectl") \
179 || strcmp (Fs_type, "fuse.portal") == 0 \ 181 || streq (Fs_type, "fuse.portal") \
180 || strcmp (Fs_type, "mqueue") == 0 \ 182 || streq (Fs_type, "mqueue") \
181 || strcmp (Fs_type, "rpc_pipefs") == 0 \ 183 || streq (Fs_type, "rpc_pipefs") \
182 || strcmp (Fs_type, "sysfs") == 0 \ 184 || streq (Fs_type, "sysfs") \
183 /* FreeBSD, Linux 2.4 */ \ 185 /* FreeBSD, Linux 2.4 */ \
184 || strcmp (Fs_type, "devfs") == 0 \ 186 || streq (Fs_type, "devfs") \
185 /* for NetBSD 3.0 */ \ 187 /* for NetBSD 3.0 */ \
186 || strcmp (Fs_type, "kernfs") == 0 \ 188 || streq (Fs_type, "kernfs"))
187 /* for Irix 6.5 */ \
188 || strcmp (Fs_type, "ignore") == 0)
189 189
190/* Historically, we have marked as "dummy" any file system of type "none", 190/* Historically, we have marked as "dummy" any file system of type "none",
191 but now that programs like du need to know about bind-mounted directories, 191 but now that programs like du need to know about bind-mounted directories,
@@ -194,10 +194,10 @@
194#ifdef MOUNTED_GETMNTENT1 194#ifdef MOUNTED_GETMNTENT1
195# define ME_DUMMY(Fs_name, Fs_type, Bind) \ 195# define ME_DUMMY(Fs_name, Fs_type, Bind) \
196 (ME_DUMMY_0 (Fs_name, Fs_type) \ 196 (ME_DUMMY_0 (Fs_name, Fs_type) \
197 || (strcmp (Fs_type, "none") == 0 && !Bind)) 197 || (streq (Fs_type, "none") && !Bind))
198#else 198#else
199# define ME_DUMMY(Fs_name, Fs_type) \ 199# define ME_DUMMY(Fs_name, Fs_type) \
200 (ME_DUMMY_0 (Fs_name, Fs_type) || strcmp (Fs_type, "none") == 0) 200 (ME_DUMMY_0 (Fs_name, Fs_type) || streq (Fs_type, "none"))
201#endif 201#endif
202 202
203#ifdef __CYGWIN__ 203#ifdef __CYGWIN__
@@ -238,19 +238,19 @@ me_remote (char const *fs_name, _GL_UNUSED char const *fs_type)
238 (strchr (Fs_name, ':') != NULL \ 238 (strchr (Fs_name, ':') != NULL \
239 || ((Fs_name)[0] == '/' \ 239 || ((Fs_name)[0] == '/' \
240 && (Fs_name)[1] == '/' \ 240 && (Fs_name)[1] == '/' \
241 && (strcmp (Fs_type, "smbfs") == 0 \ 241 && (streq (Fs_type, "smbfs") \
242 || strcmp (Fs_type, "smb3") == 0 \ 242 || streq (Fs_type, "smb3") \
243 || strcmp (Fs_type, "cifs") == 0)) \ 243 || streq (Fs_type, "cifs"))) \
244 || strcmp (Fs_type, "acfs") == 0 \ 244 || streq (Fs_type, "acfs") \
245 || strcmp (Fs_type, "afs") == 0 \ 245 || streq (Fs_type, "afs") \
246 || strcmp (Fs_type, "coda") == 0 \ 246 || streq (Fs_type, "coda") \
247 || strcmp (Fs_type, "auristorfs") == 0 \ 247 || streq (Fs_type, "auristorfs") \
248 || strcmp (Fs_type, "fhgfs") == 0 \ 248 || streq (Fs_type, "fhgfs") \
249 || strcmp (Fs_type, "gpfs") == 0 \ 249 || streq (Fs_type, "gpfs") \
250 || strcmp (Fs_type, "ibrix") == 0 \ 250 || streq (Fs_type, "ibrix") \
251 || strcmp (Fs_type, "ocfs2") == 0 \ 251 || streq (Fs_type, "ocfs2") \
252 || strcmp (Fs_type, "vxfs") == 0 \ 252 || streq (Fs_type, "vxfs") \
253 || strcmp ("-hosts", Fs_name) == 0) 253 || streq ("-hosts", Fs_name))
254#endif 254#endif
255 255
256#if MOUNTED_GETMNTINFO /* Mac OS X, FreeBSD, OpenBSD, also (obsolete) 4.4BSD */ 256#if MOUNTED_GETMNTINFO /* Mac OS X, FreeBSD, OpenBSD, also (obsolete) 4.4BSD */
@@ -367,9 +367,7 @@ fsp_to_string (const struct statfs *fsp)
367static char * 367static char *
368fstype_to_string (int t) 368fstype_to_string (int t)
369{ 369{
370 struct vfs_ent *e; 370 struct vfs_ent *e = getvfsbytype (t);
371
372 e = getvfsbytype (t);
373 if (!e || !e->vfsent_name) 371 if (!e || !e->vfsent_name)
374 return "none"; 372 return "none";
375 else 373 else
@@ -396,15 +394,17 @@ dev_from_mount_options (char const *mount_options)
396 if (devopt) 394 if (devopt)
397 { 395 {
398 char const *optval = devopt + sizeof dev_pattern - 1; 396 char const *optval = devopt + sizeof dev_pattern - 1;
399 char *optvalend; 397 if (c_isxdigit (*optval))
400 unsigned long int dev; 398 {
401 errno = 0; 399 errno = 0;
402 dev = strtoul (optval, &optvalend, 16); 400 char *optvalend;
403 if (optval != optvalend 401 unsigned long int dev = strtoul (optval, &optvalend, 16);
404 && (*optvalend == '\0' || *optvalend == ',') 402 if (optval != optvalend
405 && ! (dev == ULONG_MAX && errno == ERANGE) 403 && (*optvalend == '\0' || *optvalend == ',')
406 && dev == (dev_t) dev) 404 && ! (dev == ULONG_MAX && errno == ERANGE)
407 return dev; 405 && dev == (dev_t) dev)
406 return dev;
407 }
408 } 408 }
409 409
410# endif 410# endif
@@ -422,9 +422,9 @@ dev_from_mount_options (char const *mount_options)
422static void 422static void
423unescape_tab (char *str) 423unescape_tab (char *str)
424{ 424{
425 size_t i, j = 0; 425 size_t j = 0;
426 size_t len = strlen (str) + 1; 426 size_t len = strlen (str) + 1;
427 for (i = 0; i < len; i++) 427 for (size_t i = 0; i < len; i++)
428 { 428 {
429 if (str[i] == '\\' && (i + 4 < len) 429 if (str[i] == '\\' && (i + 4 < len)
430 && str[i + 1] >= '0' && str[i + 1] <= '3' 430 && str[i + 1] >= '0' && str[i + 1] <= '3'
@@ -452,12 +452,8 @@ terminate_at_blank (char *str)
452 *s = '\0'; 452 *s = '\0';
453 return s; 453 return s;
454} 454}
455#endif
456 455
457/* Return a list of the currently mounted file systems, or NULL on error. 456#endif
458 Add each entry to the tail of the list so that they stay in order.
459 If NEED_FS_TYPE is true, ensure that the file system type fields in
460 the returned list are valid. Otherwise, they might not be. */
461 457
462struct mount_entry * 458struct mount_entry *
463read_file_system_list (bool need_fs_type) 459read_file_system_list (bool need_fs_type)
@@ -467,18 +463,16 @@ read_file_system_list (bool need_fs_type)
467 struct mount_entry **mtail = &mount_list; 463 struct mount_entry **mtail = &mount_list;
468 (void) need_fs_type; 464 (void) need_fs_type;
469 465
470#ifdef MOUNTED_GETMNTENT1 /* glibc, HP-UX, IRIX, Cygwin, Android, 466#ifdef MOUNTED_GETMNTENT1 /* glibc, HP-UX, Cygwin, Android,
471 also (obsolete) 4.3BSD, SunOS */ 467 also (obsolete) 4.3BSD, SunOS */
472 { 468 {
473 FILE *fp;
474
475# if defined __linux__ || defined __ANDROID__ 469# if defined __linux__ || defined __ANDROID__
476 /* Try parsing mountinfo first, as that make device IDs available. 470 /* Try parsing mountinfo first, as that make device IDs available.
477 Note we could use libmount routines to simplify this parsing a little 471 Note we could use libmount routines to simplify this parsing a little
478 (and that code is in previous versions of this function), however 472 (and that code is in previous versions of this function), however
479 libmount depends on libselinux which pulls in many dependencies. */ 473 libmount depends on libselinux which pulls in many dependencies. */
480 char const *mountinfo = "/proc/self/mountinfo"; 474 char const *mountinfo = "/proc/self/mountinfo";
481 fp = fopen (mountinfo, "re"); 475 FILE *fp = fopen (mountinfo, "re");
482 if (fp != NULL) 476 if (fp != NULL)
483 { 477 {
484 char *line = NULL; 478 char *line = NULL;
@@ -496,61 +490,61 @@ read_file_system_list (bool need_fs_type)
496 &devmaj, &devmin, 490 &devmaj, &devmin,
497 &mntroot_s); 491 &mntroot_s);
498 492
499 if (rc != 2 && rc != 3) /* 3 if %n included in count. */ 493 if (rc == 2 || rc == 3) /* 3 if %n included in count. */
500 continue; 494 {
501 495 /* find end of MNTROOT. */
502 /* find end of MNTROOT. */ 496 char *mntroot = line + mntroot_s;
503 char *mntroot = line + mntroot_s; 497 char *blank = terminate_at_blank (mntroot);
504 char *blank = terminate_at_blank (mntroot); 498 if (blank)
505 if (! blank) 499 {
506 continue; 500 /* find end of TARGET. */
507 501 char *target = blank + 1;
508 /* find end of TARGET. */ 502 blank = terminate_at_blank (target);
509 char *target = blank + 1; 503 if (blank)
510 blank = terminate_at_blank (target); 504 {
511 if (! blank) 505 /* skip optional fields, terminated by " - " */
512 continue; 506 char *dash = strstr (blank + 1, " - ");
513 507 if (dash)
514 /* skip optional fields, terminated by " - " */ 508 {
515 char *dash = strstr (blank + 1, " - "); 509 /* advance past the " - " separator. */
516 if (! dash) 510 char *fstype = dash + 3;
517 continue; 511 blank = terminate_at_blank (fstype);
518 512 if (blank)
519 /* advance past the " - " separator. */ 513 {
520 char *fstype = dash + 3; 514 /* find end of SOURCE. */
521 blank = terminate_at_blank (fstype); 515 char *source = blank + 1;
522 if (! blank) 516 if (terminate_at_blank (source))
523 continue; 517 {
524 518 /* manipulate the sub-strings in place. */
525 /* find end of SOURCE. */ 519 unescape_tab (source);
526 char *source = blank + 1; 520 unescape_tab (target);
527 if (! terminate_at_blank (source)) 521 unescape_tab (mntroot);
528 continue; 522 unescape_tab (fstype);
529 523
530 /* manipulate the sub-strings in place. */ 524 me = xmalloc (sizeof *me);
531 unescape_tab (source); 525
532 unescape_tab (target); 526 me->me_devname = xstrdup (source);
533 unescape_tab (mntroot); 527 me->me_mountdir = xstrdup (target);
534 unescape_tab (fstype); 528 me->me_mntroot = xstrdup (mntroot);
535 529 me->me_type = xstrdup (fstype);
536 me = xmalloc (sizeof *me); 530 me->me_type_malloced = 1;
537 531 me->me_dev = makedev (devmaj, devmin);
538 me->me_devname = xstrdup (source); 532 /* we pass "false" for the "Bind" option as that's only
539 me->me_mountdir = xstrdup (target); 533 significant when the Fs_type is "none" which will not be
540 me->me_mntroot = xstrdup (mntroot); 534 the case when parsing "/proc/self/mountinfo", and only
541 me->me_type = xstrdup (fstype); 535 applies for static /etc/mtab files. */
542 me->me_type_malloced = 1; 536 me->me_dummy = ME_DUMMY (me->me_devname, me->me_type, false);
543 me->me_dev = makedev (devmaj, devmin); 537 me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
544 /* we pass "false" for the "Bind" option as that's only 538
545 significant when the Fs_type is "none" which will not be 539 /* Add to the linked list. */
546 the case when parsing "/proc/self/mountinfo", and only 540 *mtail = me;
547 applies for static /etc/mtab files. */ 541 mtail = &me->me_next;
548 me->me_dummy = ME_DUMMY (me->me_devname, me->me_type, false); 542 }
549 me->me_remote = ME_REMOTE (me->me_devname, me->me_type); 543 }
550 544 }
551 /* Add to the linked list. */ 545 }
552 *mtail = me; 546 }
553 mtail = &me->me_next; 547 }
554 } 548 }
555 549
556 free (line); 550 free (line);
@@ -567,16 +561,16 @@ read_file_system_list (bool need_fs_type)
567 goto free_then_fail; 561 goto free_then_fail;
568 } 562 }
569 else /* fallback to /proc/self/mounts (/etc/mtab). */ 563 else /* fallback to /proc/self/mounts (/etc/mtab). */
570# endif /* __linux __ || __ANDROID__ */ 564# endif /* __linux__ || __ANDROID__ */
571 { 565 {
572 struct mntent *mnt;
573 char const *table = MOUNTED; 566 char const *table = MOUNTED;
574 567
575 fp = setmntent (table, "r"); 568 FILE *mfp = setmntent (table, "r");
576 if (fp == NULL) 569 if (mfp == NULL)
577 return NULL; 570 return NULL;
578 571
579 while ((mnt = getmntent (fp))) 572 struct mntent *mnt;
573 while ((mnt = getmntent (mfp)))
580 { 574 {
581 bool bind = hasmntopt (mnt, "bind"); 575 bool bind = hasmntopt (mnt, "bind");
582 576
@@ -595,7 +589,7 @@ read_file_system_list (bool need_fs_type)
595 mtail = &me->me_next; 589 mtail = &me->me_next;
596 } 590 }
597 591
598 if (endmntent (fp) == 0) 592 if (endmntent (mfp) == 0)
599 goto free_then_fail; 593 goto free_then_fail;
600 } 594 }
601 } 595 }
@@ -604,9 +598,7 @@ read_file_system_list (bool need_fs_type)
604#ifdef MOUNTED_GETMNTINFO /* Mac OS X, FreeBSD, OpenBSD, also (obsolete) 4.4BSD */ 598#ifdef MOUNTED_GETMNTINFO /* Mac OS X, FreeBSD, OpenBSD, also (obsolete) 4.4BSD */
605 { 599 {
606 struct statfs *fsp; 600 struct statfs *fsp;
607 int entries; 601 int entries = getmntinfo (&fsp, MNT_NOWAIT);
608
609 entries = getmntinfo (&fsp, MNT_NOWAIT);
610 if (entries < 0) 602 if (entries < 0)
611 return NULL; 603 return NULL;
612 for (; entries-- > 0; fsp++) 604 for (; entries-- > 0; fsp++)
@@ -633,9 +625,7 @@ read_file_system_list (bool need_fs_type)
633#ifdef MOUNTED_GETMNTINFO2 /* NetBSD, Minix */ 625#ifdef MOUNTED_GETMNTINFO2 /* NetBSD, Minix */
634 { 626 {
635 struct statvfs *fsp; 627 struct statvfs *fsp;
636 int entries; 628 int entries = getmntinfo (&fsp, MNT_NOWAIT);
637
638 entries = getmntinfo (&fsp, MNT_NOWAIT);
639 if (entries < 0) 629 if (entries < 0)
640 return NULL; 630 return NULL;
641 for (; entries-- > 0; fsp++) 631 for (; entries-- > 0; fsp++)
@@ -669,7 +659,6 @@ read_file_system_list (bool need_fs_type)
669 We therefore get the list of subdirectories of /, and the list 659 We therefore get the list of subdirectories of /, and the list
670 of all file systems, and match the two lists. */ 660 of all file systems, and match the two lists. */
671 661
672 DIR *dirp;
673 struct rootdir_entry 662 struct rootdir_entry
674 { 663 {
675 char *name; 664 char *name;
@@ -677,16 +666,11 @@ read_file_system_list (bool need_fs_type)
677 ino_t ino; 666 ino_t ino;
678 struct rootdir_entry *next; 667 struct rootdir_entry *next;
679 }; 668 };
680 struct rootdir_entry *rootdir_list;
681 struct rootdir_entry **rootdir_tail;
682 int32 pos;
683 dev_t dev;
684 fs_info fi;
685 669
686 /* All volumes are mounted in the rootfs, directly under /. */ 670 /* All volumes are mounted in the rootfs, directly under /. */
687 rootdir_list = NULL; 671 struct rootdir_entry *rootdir_list = NULL;
688 rootdir_tail = &rootdir_list; 672 struct rootdir_entry **rootdir_tail = &rootdir_list;
689 dirp = opendir ("/"); 673 DIR *dirp = opendir ("/");
690 if (dirp) 674 if (dirp)
691 { 675 {
692 struct dirent *d; 676 struct dirent *d;
@@ -696,61 +680,64 @@ read_file_system_list (bool need_fs_type)
696 char *name; 680 char *name;
697 struct stat statbuf; 681 struct stat statbuf;
698 682
699 if (strcmp (d->d_name, "..") == 0) 683 if (! streq (d->d_name, ".."))
700 continue;
701
702 if (strcmp (d->d_name, ".") == 0)
703 name = xstrdup ("/");
704 else
705 {
706 name = xmalloc (1 + strlen (d->d_name) + 1);
707 name[0] = '/';
708 strcpy (name + 1, d->d_name);
709 }
710
711 if (lstat (name, &statbuf) >= 0 && S_ISDIR (statbuf.st_mode))
712 { 684 {
713 struct rootdir_entry *re = xmalloc (sizeof *re); 685 if (streq (d->d_name, "."))
714 re->name = name; 686 name = xstrdup ("/");
715 re->dev = statbuf.st_dev; 687 else
716 re->ino = statbuf.st_ino; 688 {
717 689 name = xmalloc (1 + strlen (d->d_name) + 1);
718 /* Add to the linked list. */ 690 name[0] = '/';
719 *rootdir_tail = re; 691 strcpy (name + 1, d->d_name);
720 rootdir_tail = &re->next; 692 }
693
694 if (lstat (name, &statbuf) >= 0 && S_ISDIR (statbuf.st_mode))
695 {
696 struct rootdir_entry *re = xmalloc (sizeof *re);
697 re->name = name;
698 re->dev = statbuf.st_dev;
699 re->ino = statbuf.st_ino;
700
701 /* Add to the linked list. */
702 *rootdir_tail = re;
703 rootdir_tail = &re->next;
704 }
705 else
706 free (name);
721 } 707 }
722 else
723 free (name);
724 } 708 }
725 closedir (dirp); 709 closedir (dirp);
726 } 710 }
727 *rootdir_tail = NULL; 711 *rootdir_tail = NULL;
728 712
729 for (pos = 0; (dev = next_dev (&pos)) >= 0; ) 713 dev_t dev;
730 if (fs_stat_dev (dev, &fi) >= 0) 714 for (int32 pos = 0; (dev = next_dev (&pos)) >= 0; )
731 { 715 {
732 /* Note: fi.dev == dev. */ 716 fs_info fi;
733 struct rootdir_entry *re; 717 if (fs_stat_dev (dev, &fi) >= 0)
734 718 {
735 for (re = rootdir_list; re; re = re->next) 719 /* Note: fi.dev == dev. */
736 if (re->dev == fi.dev && re->ino == fi.root) 720 struct rootdir_entry *re;
737 break; 721 for (re = rootdir_list; re; re = re->next)
738 722 if (re->dev == fi.dev && re->ino == fi.root)
739 me = xmalloc (sizeof *me); 723 break;
740 me->me_devname = xstrdup (fi.device_name[0] != '\0' 724
741 ? fi.device_name : fi.fsh_name); 725 me = xmalloc (sizeof *me);
742 me->me_mountdir = xstrdup (re != NULL ? re->name : fi.fsh_name); 726 me->me_devname = xstrdup (fi.device_name[0] != '\0'
743 me->me_mntroot = NULL; 727 ? fi.device_name : fi.fsh_name);
744 me->me_type = xstrdup (fi.fsh_name); 728 me->me_mountdir = xstrdup (re != NULL ? re->name : fi.fsh_name);
745 me->me_type_malloced = 1; 729 me->me_mntroot = NULL;
746 me->me_dev = fi.dev; 730 me->me_type = xstrdup (fi.fsh_name);
747 me->me_dummy = 0; 731 me->me_type_malloced = 1;
748 me->me_remote = (fi.flags & B_FS_IS_SHARED) != 0; 732 me->me_dev = fi.dev;
749 733 me->me_dummy = 0;
750 /* Add to the linked list. */ 734 me->me_remote = (fi.flags & B_FS_IS_SHARED) != 0;
751 *mtail = me; 735
752 mtail = &me->me_next; 736 /* Add to the linked list. */
753 } 737 *mtail = me;
738 mtail = &me->me_next;
739 }
740 }
754 *mtail = NULL; 741 *mtail = NULL;
755 742
756 while (rootdir_list != NULL) 743 while (rootdir_list != NULL)
@@ -763,19 +750,17 @@ read_file_system_list (bool need_fs_type)
763 } 750 }
764#endif /* MOUNTED_FS_STAT_DEV */ 751#endif /* MOUNTED_FS_STAT_DEV */
765 752
766#if defined MOUNTED_GETFSSTAT /* OSF/1, also (obsolete) Apple Darwin 1.3 */ 753#if defined MOUNTED_GETFSSTAT /* (obsolete) Apple Darwin 1.3 */
767 { 754 {
768 int numsys, counter;
769 size_t bufsize;
770 struct statfs *stats;
771 755
772 numsys = getfsstat (NULL, 0L, MNT_NOWAIT); 756 int numsys = getfsstat (NULL, 0L, MNT_NOWAIT);
773 if (numsys < 0) 757 if (numsys < 0)
774 return NULL; 758 return NULL;
759
760 struct statfs *stats;
775 if (SIZE_MAX / sizeof *stats <= numsys) 761 if (SIZE_MAX / sizeof *stats <= numsys)
776 xalloc_die (); 762 xalloc_die ();
777 763 size_t bufsize = (1 + numsys) * sizeof *stats;
778 bufsize = (1 + numsys) * sizeof *stats;
779 stats = xmalloc (bufsize); 764 stats = xmalloc (bufsize);
780 numsys = getfsstat (stats, bufsize, MNT_NOWAIT); 765 numsys = getfsstat (stats, bufsize, MNT_NOWAIT);
781 766
@@ -785,7 +770,7 @@ read_file_system_list (bool need_fs_type)
785 return NULL; 770 return NULL;
786 } 771 }
787 772
788 for (counter = 0; counter < numsys; counter++) 773 for (int counter = 0; counter < numsys; counter++)
789 { 774 {
790 me = xmalloc (sizeof *me); 775 me = xmalloc (sizeof *me);
791 me->me_devname = xstrdup (stats[counter].f_mntfromname); 776 me->me_devname = xstrdup (stats[counter].f_mntfromname);
@@ -808,14 +793,13 @@ read_file_system_list (bool need_fs_type)
808 793
809#if defined MOUNTED_FREAD_FSTYP /* (obsolete) SVR3 */ 794#if defined MOUNTED_FREAD_FSTYP /* (obsolete) SVR3 */
810 { 795 {
811 struct mnttab mnt;
812 char *table = "/etc/mnttab"; 796 char *table = "/etc/mnttab";
813 FILE *fp;
814 797
815 fp = fopen (table, "re"); 798 FILE *fp = fopen (table, "re");
816 if (fp == NULL) 799 if (fp == NULL)
817 return NULL; 800 return NULL;
818 801
802 struct mnttab mnt;
819 while (fread (&mnt, sizeof mnt, 1, fp) > 0) 803 while (fread (&mnt, sizeof mnt, 1, fp) > 0)
820 { 804 {
821 me = xmalloc (sizeof *me); 805 me = xmalloc (sizeof *me);
@@ -861,20 +845,19 @@ read_file_system_list (bool need_fs_type)
861 845
862#ifdef MOUNTED_GETEXTMNTENT /* Solaris >= 8 */ 846#ifdef MOUNTED_GETEXTMNTENT /* Solaris >= 8 */
863 { 847 {
864 struct extmnttab mnt;
865 const char *table = MNTTAB; 848 const char *table = MNTTAB;
866 FILE *fp;
867 int ret;
868 849
869 /* No locking is needed, because the contents of /etc/mnttab is generated 850 /* No locking is needed, because the contents of /etc/mnttab is generated
870 by the kernel. */ 851 by the kernel. */
871 852
872 errno = 0; 853 errno = 0;
873 fp = fopen (table, "re"); 854 FILE *fp = fopen (table, "re");
855 int ret;
874 if (fp == NULL) 856 if (fp == NULL)
875 ret = errno; 857 ret = errno;
876 else 858 else
877 { 859 {
860 struct extmnttab mnt;
878 while ((ret = getextmntent (fp, &mnt, 1)) == 0) 861 while ((ret = getextmntent (fp, &mnt, 1)) == 0)
879 { 862 {
880 me = xmalloc (sizeof *me); 863 me = xmalloc (sizeof *me);
@@ -883,7 +866,9 @@ read_file_system_list (bool need_fs_type)
883 me->me_mntroot = NULL; 866 me->me_mntroot = NULL;
884 me->me_type = xstrdup (mnt.mnt_fstype); 867 me->me_type = xstrdup (mnt.mnt_fstype);
885 me->me_type_malloced = 1; 868 me->me_type_malloced = 1;
886 me->me_dummy = MNT_IGNORE (&mnt) != 0; 869 /* The cast from 'struct extmnttab *' to 'struct mnttab *' is OK
870 because 'struct extmnttab' extends 'struct mnttab'. */
871 me->me_dummy = MNT_IGNORE ((struct mnttab *) &mnt) != 0;
887 me->me_remote = ME_REMOTE (me->me_devname, me->me_type); 872 me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
888 me->me_dev = makedev (mnt.mnt_major, mnt.mnt_minor); 873 me->me_dev = makedev (mnt.mnt_major, mnt.mnt_minor);
889 874
@@ -906,10 +891,7 @@ read_file_system_list (bool need_fs_type)
906 891
907#ifdef MOUNTED_GETMNTENT2 /* Solaris < 8, also (obsolete) SVR4 */ 892#ifdef MOUNTED_GETMNTENT2 /* Solaris < 8, also (obsolete) SVR4 */
908 { 893 {
909 struct mnttab mnt;
910 const char *table = MNTTAB; 894 const char *table = MNTTAB;
911 FILE *fp;
912 int ret;
913 int lockfd = -1; 895 int lockfd = -1;
914 896
915# if defined F_RDLCK && defined F_SETLKW 897# if defined F_RDLCK && defined F_SETLKW
@@ -942,11 +924,13 @@ read_file_system_list (bool need_fs_type)
942# endif 924# endif
943 925
944 errno = 0; 926 errno = 0;
945 fp = fopen (table, "re"); 927 FILE *fp = fopen (table, "re");
928 int ret;
946 if (fp == NULL) 929 if (fp == NULL)
947 ret = errno; 930 ret = errno;
948 else 931 else
949 { 932 {
933 struct mnttab mnt;
950 while ((ret = getmntent (fp, &mnt)) == 0) 934 while ((ret = getmntent (fp, &mnt)) == 0)
951 { 935 {
952 me = xmalloc (sizeof *me); 936 me = xmalloc (sizeof *me);
@@ -981,34 +965,24 @@ read_file_system_list (bool need_fs_type)
981 965
982#ifdef MOUNTED_VMOUNT /* AIX */ 966#ifdef MOUNTED_VMOUNT /* AIX */
983 { 967 {
984 int bufsize;
985 void *entries;
986 char *thisent;
987 struct vmount *vmp;
988 int n_entries;
989 int i;
990
991 /* Ask how many bytes to allocate for the mounted file system info. */ 968 /* Ask how many bytes to allocate for the mounted file system info. */
992 entries = &bufsize; 969 int bufsize;
993 if (mntctl (MCTL_QUERY, sizeof bufsize, entries) != 0) 970 if (mntctl (MCTL_QUERY, sizeof bufsize, &bufsize) != 0)
994 return NULL; 971 return NULL;
995 entries = xmalloc (bufsize); 972 void *entries = xmalloc (bufsize);
996 973
997 /* Get the list of mounted file systems. */ 974 /* Get the list of mounted file systems. */
998 n_entries = mntctl (MCTL_QUERY, bufsize, entries); 975 int n_entries = mntctl (MCTL_QUERY, bufsize, entries);
999 if (n_entries < 0) 976 if (n_entries < 0)
1000 { 977 {
1001 free (entries); 978 free (entries);
1002 return NULL; 979 return NULL;
1003 } 980 }
1004 981
1005 for (i = 0, thisent = entries; 982 char *thisent = entries;
1006 i < n_entries; 983 for (int i = 0; i < n_entries; i++)
1007 i++, thisent += vmp->vmt_length)
1008 { 984 {
1009 char *options, *ignore; 985 struct vmount *vmp = (struct vmount *) thisent;
1010
1011 vmp = (struct vmount *) thisent;
1012 me = xmalloc (sizeof *me); 986 me = xmalloc (sizeof *me);
1013 if (vmp->vmt_flags & MNT_REMOTE) 987 if (vmp->vmt_flags & MNT_REMOTE)
1014 { 988 {
@@ -1033,8 +1007,8 @@ read_file_system_list (bool need_fs_type)
1033 me->me_mntroot = NULL; 1007 me->me_mntroot = NULL;
1034 me->me_type = xstrdup (fstype_to_string (vmp->vmt_gfstype)); 1008 me->me_type = xstrdup (fstype_to_string (vmp->vmt_gfstype));
1035 me->me_type_malloced = 1; 1009 me->me_type_malloced = 1;
1036 options = thisent + vmp->vmt_data[VMT_ARGS].vmt_off; 1010 char *options = thisent + vmp->vmt_data[VMT_ARGS].vmt_off;
1037 ignore = strstr (options, "ignore"); 1011 char *ignore = strstr (options, "ignore");
1038 me->me_dummy = (ignore 1012 me->me_dummy = (ignore
1039 && (ignore == options || ignore[-1] == ',') 1013 && (ignore == options || ignore[-1] == ',')
1040 && (ignore[sizeof "ignore" - 1] == ',' 1014 && (ignore[sizeof "ignore" - 1] == ','
@@ -1044,6 +1018,8 @@ read_file_system_list (bool need_fs_type)
1044 /* Add to the linked list. */ 1018 /* Add to the linked list. */
1045 *mtail = me; 1019 *mtail = me;
1046 mtail = &me->me_next; 1020 mtail = &me->me_next;
1021
1022 thisent += vmp->vmt_length;
1047 } 1023 }
1048 free (entries); 1024 free (entries);
1049 } 1025 }
@@ -1052,25 +1028,23 @@ read_file_system_list (bool need_fs_type)
1052#ifdef MOUNTED_INTERIX_STATVFS /* Interix */ 1028#ifdef MOUNTED_INTERIX_STATVFS /* Interix */
1053 { 1029 {
1054 DIR *dirp = opendir ("/dev/fs"); 1030 DIR *dirp = opendir ("/dev/fs");
1055 char node[9 + NAME_MAX];
1056
1057 if (!dirp) 1031 if (!dirp)
1058 goto free_then_fail; 1032 goto free_then_fail;
1059 1033
1060 while (1) 1034 while (1)
1061 { 1035 {
1062 struct statvfs dev;
1063 struct dirent entry;
1064 struct dirent *result;
1065
1066 /* FIXME: readdir_r is planned to be withdrawn from POSIX and 1036 /* FIXME: readdir_r is planned to be withdrawn from POSIX and
1067 marked obsolescent in glibc. Use readdir instead. */ 1037 marked obsolescent in glibc. Use readdir instead. */
1038 struct dirent entry;
1039 struct dirent *result;
1068 if (readdir_r (dirp, &entry, &result) || result == NULL) 1040 if (readdir_r (dirp, &entry, &result) || result == NULL)
1069 break; 1041 break;
1070 1042
1043 char node[9 + NAME_MAX];
1071 strcpy (node, "/dev/fs/"); 1044 strcpy (node, "/dev/fs/");
1072 strcat (node, entry.d_name); 1045 strcat (node, entry.d_name);
1073 1046
1047 struct statvfs dev;
1074 if (statvfs (node, &dev) == 0) 1048 if (statvfs (node, &dev) == 0)
1075 { 1049 {
1076 me = xmalloc (sizeof *me); 1050 me = xmalloc (sizeof *me);
@@ -1092,6 +1066,201 @@ read_file_system_list (bool need_fs_type)
1092 } 1066 }
1093#endif /* MOUNTED_INTERIX_STATVFS */ 1067#endif /* MOUNTED_INTERIX_STATVFS */
1094 1068
1069#if defined _WIN32 && !defined __CYGWIN__ /* native Windows */
1070/* Don't assume that UNICODE is not defined. */
1071# undef GetDriveType
1072# define GetDriveType GetDriveTypeA
1073# undef GetVolumeInformation
1074# define GetVolumeInformation GetVolumeInformationA
1075 {
1076 /* Windows has drive prefixes which are similar to mount points.
1077 GetLogicalDrives returns a bitmask where the i-th bit is set
1078 if ASCII 'A' + i is an available drive. See:
1079 <https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getlogicaldrives>. */
1080 DWORD value = GetLogicalDrives ();
1081
1082 for (unsigned int i = 0; i < 26; ++i)
1083 {
1084 if (value & (1U << i))
1085 {
1086 char mountdir[4];
1087 mountdir[0] = 'A' + i;
1088 mountdir[1] = ':';
1089 mountdir[2] = '\\';
1090 mountdir[3] = '\0';
1091
1092 char fs_name[MAX_PATH + 1];
1093 /* Test whether the drive actually exists, and
1094 get the name of the file system. See:
1095 <https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getvolumeinformationa>. */
1096 if (GetVolumeInformation (mountdir, NULL, 0, NULL, NULL, NULL,
1097 fs_name, sizeof fs_name))
1098 {
1099 me = xmalloc (sizeof *me);
1100 me->me_mountdir = xstrdup (mountdir);
1101 /* Check if drive is remote. See:
1102 <https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getdrivetypea>. */
1103 me->me_remote = GetDriveType (mountdir) == DRIVE_REMOTE;
1104 /* Here we could use
1105 QueryDosDeviceW -> returns something like '\Device\HarddiskVolume2'
1106 GetVolumeNameForVolumeMountPointW -> return something like '\\?\Volume{...}'
1107 */
1108 me->me_devname = NULL;
1109 {
1110 /* Find the SUBST or NET USE mapping of the given drive.
1111 <https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-querydosdevicew>
1112 For testing of SUBST: <https://ss64.com/nt/subst.html>
1113 For testing of NET USE: <https://ss64.com/nt/net-use.html> */
1114 wchar_t drive[3];
1115 drive[0] = L'A' + i;
1116 drive[1] = L':';
1117 drive[2] = L'\0';
1118 wchar_t mapping[MAX_PATH + 1];
1119 DWORD mapping_len = QueryDosDeviceW (drive, mapping, sizeof (mapping) / sizeof (mapping[0]));
1120 if (mapping_len > 4 && wcsncmp (mapping, L"\\??\\", 4) == 0)
1121 {
1122 /* It's a SUBSTed drive. */
1123 char subst_dir[MAX_PATH + 1];
1124 size_t subst_dir_len = wcstombs (subst_dir, mapping + 4, sizeof (subst_dir));
1125 if (subst_dir_len > 0 && subst_dir_len <= MAX_PATH)
1126 me->me_mntroot = xstrdup (subst_dir);
1127 else
1128 /* mapping is too long or not convertible to the
1129 locale encoding. */
1130 me->me_mntroot = NULL;
1131 }
1132 else if (mapping_len > 26
1133 && wcsncmp (mapping, L"\\Device\\LanmanRedirector\\;", 26) == 0)
1134 {
1135 wchar_t *next_backslash = wcschr (mapping + 26, L'\\');
1136 if (next_backslash != NULL)
1137 {
1138 *--next_backslash = L'\\';
1139 char share_dir[MAX_PATH + 1];
1140 size_t share_dir_len = wcstombs (share_dir, next_backslash, sizeof (share_dir));
1141 if (share_dir_len > 0 && share_dir_len <= MAX_PATH)
1142 me->me_mntroot = xstrdup (share_dir);
1143 else
1144 /* mapping is too long or not convertible to the
1145 locale encoding. */
1146 me->me_mntroot = NULL;
1147 }
1148 else
1149 /* mapping does not have the expected form. */
1150 me->me_mntroot = NULL;
1151 }
1152 else
1153 /* It's neither a SUBSTed nor a NET USEd drive. */
1154 me->me_mntroot = NULL;
1155 }
1156 me->me_dev = (dev_t) -1;
1157 me->me_dummy = 0;
1158 me->me_type = xstrdup (fs_name);
1159 me->me_type_malloced = 1;
1160
1161 /* Add to the linked list. */
1162 *mtail = me;
1163 mtail = &me->me_next;
1164 }
1165 }
1166 }
1167 }
1168 {
1169 /* Windows also has true mount points, called "mounted folders". See
1170 <https://learn.microsoft.com/en-us/windows/win32/fileio/volume-mount-points>
1171 For testing: <https://learn.microsoft.com/en-us/windows-server/storage/disk-management/assign-a-mount-point-folder-path-to-a-drive> */
1172 /* Enumerate the volumes. See
1173 <https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findfirstvolumew>
1174 <https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findnextvolumew>
1175 <https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findvolumeclose> */
1176 wchar_t vol_name[MAX_PATH + 1];
1177 HANDLE h = FindFirstVolumeW (vol_name, sizeof (vol_name) / sizeof (vol_name[0]));
1178 if (h != INVALID_HANDLE_VALUE)
1179 {
1180 do
1181 {
1182 /* Look where the volume vol_name is mounted.
1183 There are two APIs for doing this:
1184 - FindFirstVolumeMountPointW, FindNextVolumeMountPointW,
1185 FindVolumeMountPointClose. This API always fails with
1186 error code ERROR_ACCESS_DENIED.
1187 - GetVolumePathNamesForVolumeNameW. This API works but
1188 may require a significantly larger buffer.
1189 <https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getvolumepathnamesforvolumenamew> */
1190 wchar_t stack_buf[MAX_PATH + 2];
1191 wchar_t *malloced_buf = NULL;
1192 wchar_t *buf = stack_buf;
1193 DWORD bufsize = sizeof (stack_buf) / sizeof (wchar_t);
1194 BOOL success;
1195 for (;;)
1196 {
1197 success = GetVolumePathNamesForVolumeNameW (vol_name, buf, bufsize, &bufsize);
1198 if (!success && GetLastError () == ERROR_MORE_DATA)
1199 {
1200 free (malloced_buf);
1201 malloced_buf = (wchar_t *) xmalloc (bufsize * sizeof (wchar_t));
1202 buf = malloced_buf;
1203 }
1204 else
1205 break;
1206 }
1207 if (success)
1208 {
1209 wchar_t *mount_dir = buf;
1210 while (*mount_dir != L'\0')
1211 {
1212 /* Drive mounts are already handled above. */
1213 if (!(mount_dir[0] >= L'A' && mount_dir[0] <= L'Z'
1214 && mount_dir[1] == L':' && mount_dir[2] == L'\\'
1215 && mount_dir[3] == L'\0'))
1216 {
1217 char mountdir[MAX_PATH + 1];
1218 size_t mountdir_len = wcstombs (mountdir, mount_dir, sizeof (mountdir));
1219 if (mountdir_len > 0 && mountdir_len <= MAX_PATH)
1220 {
1221 char fs_name[MAX_PATH + 1];
1222 /* Get the name of the file system. See:
1223 <https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getvolumeinformationa>. */
1224 if (GetVolumeInformation (mountdir, NULL, 0, NULL, NULL, NULL,
1225 fs_name, sizeof fs_name))
1226 {
1227 me = xmalloc (sizeof *me);
1228 me->me_mountdir = xstrdup (mountdir);
1229 me->me_remote = false;
1230 /* Here we could use vol_name, something like '\\?\Volume{...}'. */
1231 me->me_devname = NULL;
1232 me->me_mntroot = NULL;
1233 me->me_dev = (dev_t) -1;
1234 me->me_dummy = 0;
1235 me->me_type = xstrdup (fs_name);
1236 me->me_type_malloced = 1;
1237
1238 /* Add to the linked list. */
1239 *mtail = me;
1240 mtail = &me->me_next;
1241 }
1242 }
1243 else
1244 {
1245 /* mount_dir is too long or not convertible to the
1246 locale encoding. */
1247 }
1248 }
1249 mount_dir += wcslen (mount_dir) + 1;
1250 }
1251 }
1252 free (malloced_buf);
1253 }
1254 while (FindNextVolumeW (h, vol_name, sizeof (vol_name) / sizeof (vol_name[0])));
1255 FindVolumeClose (h);
1256 }
1257 }
1258#endif
1259
1260#if MOUNTED_NOT_PORTED
1261# error "Please port gnulib mountlist.c to your platform!"
1262#endif
1263
1095 *mtail = NULL; 1264 *mtail = NULL;
1096 return mount_list; 1265 return mount_list;
1097 1266
diff --git a/gl/mountlist.h b/gl/mountlist.h
index 9728e38b..de1ff712 100644
--- a/gl/mountlist.h
+++ b/gl/mountlist.h
@@ -1,6 +1,6 @@
1/* mountlist.h -- declarations for list of mounted file systems 1/* mountlist.h -- declarations for list of mounted file systems
2 2
3 Copyright (C) 1991-1992, 1998, 2000-2005, 2009-2024 Free Software 3 Copyright (C) 1991-1992, 1998, 2000-2005, 2009-2026 Free Software
4 Foundation, Inc. 4 Foundation, Inc.
5 5
6 This program is free software: you can redistribute it and/or modify 6 This program is free software: you can redistribute it and/or modify
@@ -46,8 +46,13 @@ struct mount_entry
46 struct mount_entry *me_next; 46 struct mount_entry *me_next;
47}; 47};
48 48
49/* Return a list of the currently mounted file systems, or NULL on error.
50 Add each entry to the tail of the list so that they stay in order.
51 If NEED_FS_TYPE is true, ensure that the file system type fields in
52 the returned list are valid. Otherwise, they might not be. */
49struct mount_entry *read_file_system_list (bool need_fs_type) 53struct mount_entry *read_file_system_list (bool need_fs_type)
50 _GL_ATTRIBUTE_MALLOC; 54 _GL_ATTRIBUTE_MALLOC;
55
51void free_mount_entry (struct mount_entry *entry); 56void free_mount_entry (struct mount_entry *entry);
52 57
53 58
diff --git a/gl/msvc-inval.c b/gl/msvc-inval.c
index da3fc86a..774447b6 100644
--- a/gl/msvc-inval.c
+++ b/gl/msvc-inval.c
@@ -1,5 +1,5 @@
1/* Invalid parameter handler for MSVC runtime libraries. 1/* Invalid parameter handler for MSVC runtime libraries.
2 Copyright (C) 2011-2024 Free Software Foundation, Inc. 2 Copyright (C) 2011-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/msvc-inval.h b/gl/msvc-inval.h
index 7aee6e5d..25bb6a3a 100644
--- a/gl/msvc-inval.h
+++ b/gl/msvc-inval.h
@@ -1,5 +1,5 @@
1/* Invalid parameter handler for MSVC runtime libraries. 1/* Invalid parameter handler for MSVC runtime libraries.
2 Copyright (C) 2011-2024 Free Software Foundation, Inc. 2 Copyright (C) 2011-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -179,9 +179,9 @@ extern struct gl_msvc_inval_per_thread *gl_msvc_inval_current (void);
179# define TRY_MSVC_INVAL \ 179# define TRY_MSVC_INVAL \
180 do \ 180 do \
181 { \ 181 { \
182 struct gl_msvc_inval_per_thread *msvc_inval_current; \
183 gl_msvc_inval_ensure_handler (); \ 182 gl_msvc_inval_ensure_handler (); \
184 msvc_inval_current = gl_msvc_inval_current (); \ 183 struct gl_msvc_inval_per_thread *msvc_inval_current = \
184 gl_msvc_inval_current (); \
185 /* First, initialize gl_msvc_inval_restart. */ \ 185 /* First, initialize gl_msvc_inval_restart. */ \
186 if (setjmp (msvc_inval_current->restart) == 0) \ 186 if (setjmp (msvc_inval_current->restart) == 0) \
187 { \ 187 { \
diff --git a/gl/msvc-nothrow.c b/gl/msvc-nothrow.c
index 06b35a61..dea273d5 100644
--- a/gl/msvc-nothrow.c
+++ b/gl/msvc-nothrow.c
@@ -1,6 +1,6 @@
1/* Wrappers that don't throw invalid parameter notifications 1/* Wrappers that don't throw invalid parameter notifications
2 with MSVC runtime libraries. 2 with MSVC runtime libraries.
3 Copyright (C) 2011-2024 Free Software Foundation, Inc. 3 Copyright (C) 2011-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/msvc-nothrow.h b/gl/msvc-nothrow.h
index 121773d1..f059d2d9 100644
--- a/gl/msvc-nothrow.h
+++ b/gl/msvc-nothrow.h
@@ -1,6 +1,6 @@
1/* Wrappers that don't throw invalid parameter notifications 1/* Wrappers that don't throw invalid parameter notifications
2 with MSVC runtime libraries. 2 with MSVC runtime libraries.
3 Copyright (C) 2011-2024 Free Software Foundation, Inc. 3 Copyright (C) 2011-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/netdb.in.h b/gl/netdb.in.h
index 43409b2f..92f1220c 100644
--- a/gl/netdb.in.h
+++ b/gl/netdb.in.h
@@ -1,5 +1,5 @@
1/* Provide a netdb.h header file for systems lacking it (read: MinGW). 1/* Provide a netdb.h header file for systems lacking it (read: MinGW).
2 Copyright (C) 2008-2024 Free Software Foundation, Inc. 2 Copyright (C) 2008-2026 Free Software Foundation, Inc.
3 Written by Simon Josefsson. 3 Written by Simon Josefsson.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
@@ -41,8 +41,8 @@
41 #error "Please include config.h first." 41 #error "Please include config.h first."
42#endif 42#endif
43 43
44/* Get <netdb.h> definitions such as 'socklen_t' on IRIX 6.5 and OSF/1 4.0 and 44/* Get <netdb.h> definitions such as 'socklen_t' and 'struct hostent'
45 'struct hostent' on MinGW. */ 45 on MinGW. */
46#include <sys/socket.h> 46#include <sys/socket.h>
47 47
48/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 48/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -54,6 +54,14 @@
54/* Declarations for a platform that lacks <netdb.h>, or where it is 54/* Declarations for a platform that lacks <netdb.h>, or where it is
55 incomplete. */ 55 incomplete. */
56 56
57/* Maximum length of a fully-qualified domain name. */
58#undef NI_MAXHOST
59#define NI_MAXHOST 1025
60
61/* Maximum length of a service. */
62#undef NI_MAXSERV
63#define NI_MAXSERV 32
64
57#if @GNULIB_GETADDRINFO@ 65#if @GNULIB_GETADDRINFO@
58 66
59# if !@HAVE_STRUCT_ADDRINFO@ 67# if !@HAVE_STRUCT_ADDRINFO@
@@ -91,12 +99,11 @@ struct addrinfo
91# ifndef AI_CANONNAME 99# ifndef AI_CANONNAME
92# define AI_CANONNAME 0x0002 /* Request for canonical name. */ 100# define AI_CANONNAME 0x0002 /* Request for canonical name. */
93# endif 101# endif
94# ifndef AI_NUMERICSERV 102# ifndef AI_NUMERICHOST
95# define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */ 103# define AI_NUMERICHOST 0x0004 /* Return numeric host address as name. */
96# endif 104# endif
97 105# ifndef AI_NUMERICSERV
98# if 0 106# define AI_NUMERICSERV 0x0400 /* Return service number as service name. */
99# define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */
100# endif 107# endif
101 108
102/* These symbolic constants are required to be present by POSIX, but 109/* These symbolic constants are required to be present by POSIX, but
@@ -176,7 +183,7 @@ _GL_FUNCDECL_RPL (getaddrinfo, int,
176 (const char *restrict nodename, 183 (const char *restrict nodename,
177 const char *restrict servname, 184 const char *restrict servname,
178 const struct addrinfo *restrict hints, 185 const struct addrinfo *restrict hints,
179 struct addrinfo **restrict res) 186 struct addrinfo **restrict res),
180 _GL_ARG_NONNULL ((4))); 187 _GL_ARG_NONNULL ((4)));
181_GL_CXXALIAS_RPL (getaddrinfo, int, 188_GL_CXXALIAS_RPL (getaddrinfo, int,
182 (const char *restrict nodename, 189 (const char *restrict nodename,
@@ -189,7 +196,7 @@ _GL_FUNCDECL_SYS (getaddrinfo, int,
189 (const char *restrict nodename, 196 (const char *restrict nodename,
190 const char *restrict servname, 197 const char *restrict servname,
191 const struct addrinfo *restrict hints, 198 const struct addrinfo *restrict hints,
192 struct addrinfo **restrict res) 199 struct addrinfo **restrict res),
193 _GL_ARG_NONNULL ((4))); 200 _GL_ARG_NONNULL ((4)));
194# endif 201# endif
195_GL_CXXALIAS_SYS (getaddrinfo, int, 202_GL_CXXALIAS_SYS (getaddrinfo, int,
@@ -208,12 +215,12 @@ _GL_CXXALIASWARN (getaddrinfo);
208# undef freeaddrinfo 215# undef freeaddrinfo
209# define freeaddrinfo rpl_freeaddrinfo 216# define freeaddrinfo rpl_freeaddrinfo
210# endif 217# endif
211_GL_FUNCDECL_RPL (freeaddrinfo, void, (struct addrinfo *ai) 218_GL_FUNCDECL_RPL (freeaddrinfo, void, (struct addrinfo *ai),
212 _GL_ARG_NONNULL ((1))); 219 _GL_ARG_NONNULL ((1)));
213_GL_CXXALIAS_RPL (freeaddrinfo, void, (struct addrinfo *ai)); 220_GL_CXXALIAS_RPL (freeaddrinfo, void, (struct addrinfo *ai));
214# else 221# else
215# if !@HAVE_DECL_FREEADDRINFO@ 222# if !@HAVE_DECL_FREEADDRINFO@
216_GL_FUNCDECL_SYS (freeaddrinfo, void, (struct addrinfo *ai) 223_GL_FUNCDECL_SYS (freeaddrinfo, void, (struct addrinfo *ai),
217 _GL_ARG_NONNULL ((1))); 224 _GL_ARG_NONNULL ((1)));
218# endif 225# endif
219_GL_CXXALIAS_SYS (freeaddrinfo, void, (struct addrinfo *ai)); 226_GL_CXXALIAS_SYS (freeaddrinfo, void, (struct addrinfo *ai));
@@ -225,14 +232,14 @@ _GL_CXXALIASWARN (freeaddrinfo);
225# undef gai_strerror 232# undef gai_strerror
226# define gai_strerror rpl_gai_strerror 233# define gai_strerror rpl_gai_strerror
227# endif 234# endif
228_GL_FUNCDECL_RPL (gai_strerror, const char *, (int ecode)); 235_GL_FUNCDECL_RPL (gai_strerror, const char *, (int ecode), );
229_GL_CXXALIAS_RPL (gai_strerror, const char *, (int ecode)); 236_GL_CXXALIAS_RPL (gai_strerror, const char *, (int ecode));
230# else 237# else
231# if !@HAVE_DECL_GAI_STRERROR@ 238# if !@HAVE_DECL_GAI_STRERROR@
232/* Convert error return from getaddrinfo() to a string. 239/* Convert error return from getaddrinfo() to a string.
233 For more details, see the POSIX:2008 specification 240 For more details, see the POSIX:2008 specification
234 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/gai_strerror.html>. */ 241 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/gai_strerror.html>. */
235_GL_FUNCDECL_SYS (gai_strerror, const char *, (int ecode)); 242_GL_FUNCDECL_SYS (gai_strerror, const char *, (int ecode), );
236# endif 243# endif
237_GL_CXXALIAS_SYS (gai_strerror, const char *, (int ecode)); 244_GL_CXXALIAS_SYS (gai_strerror, const char *, (int ecode));
238# endif 245# endif
@@ -248,7 +255,7 @@ _GL_FUNCDECL_SYS (getnameinfo, int,
248 (const struct sockaddr *restrict sa, socklen_t salen, 255 (const struct sockaddr *restrict sa, socklen_t salen,
249 char *restrict node, socklen_t nodelen, 256 char *restrict node, socklen_t nodelen,
250 char *restrict service, socklen_t servicelen, 257 char *restrict service, socklen_t servicelen,
251 int flags) 258 int flags),
252 _GL_ARG_NONNULL ((1))); 259 _GL_ARG_NONNULL ((1)));
253# endif 260# endif
254/* Need to cast, because on glibc systems, the seventh parameter is 261/* Need to cast, because on glibc systems, the seventh parameter is
@@ -270,25 +277,21 @@ _GL_CXXALIASWARN (getnameinfo);
270 277
271#elif defined GNULIB_POSIXCHECK 278#elif defined GNULIB_POSIXCHECK
272 279
273# undef getaddrinfo
274# if HAVE_RAW_DECL_GETADDRINFO 280# if HAVE_RAW_DECL_GETADDRINFO
275_GL_WARN_ON_USE (getaddrinfo, "getaddrinfo is unportable - " 281_GL_WARN_ON_USE (getaddrinfo, "getaddrinfo is unportable - "
276 "use gnulib module getaddrinfo for portability"); 282 "use gnulib module getaddrinfo for portability");
277# endif 283# endif
278 284
279# undef freeaddrinfo
280# if HAVE_RAW_DECL_FREEADDRINFO 285# if HAVE_RAW_DECL_FREEADDRINFO
281_GL_WARN_ON_USE (freeaddrinfo, "freeaddrinfo is unportable - " 286_GL_WARN_ON_USE (freeaddrinfo, "freeaddrinfo is unportable - "
282 "use gnulib module getaddrinfo for portability"); 287 "use gnulib module getaddrinfo for portability");
283# endif 288# endif
284 289
285# undef gai_strerror
286# if HAVE_RAW_DECL_GAI_STRERROR 290# if HAVE_RAW_DECL_GAI_STRERROR
287_GL_WARN_ON_USE (gai_strerror, "gai_strerror is unportable - " 291_GL_WARN_ON_USE (gai_strerror, "gai_strerror is unportable - "
288 "use gnulib module getaddrinfo for portability"); 292 "use gnulib module getaddrinfo for portability");
289# endif 293# endif
290 294
291# undef getnameinfo
292# if HAVE_RAW_DECL_GETNAMEINFO 295# if HAVE_RAW_DECL_GETNAMEINFO
293_GL_WARN_ON_USE (getnameinfo, "getnameinfo is unportable - " 296_GL_WARN_ON_USE (getnameinfo, "getnameinfo is unportable - "
294 "use gnulib module getaddrinfo for portability"); 297 "use gnulib module getaddrinfo for portability");
diff --git a/gl/netinet_in.in.h b/gl/netinet_in.in.h
index 4e9f6f2d..933f5823 100644
--- a/gl/netinet_in.in.h
+++ b/gl/netinet_in.in.h
@@ -1,5 +1,5 @@
1/* Substitute for <netinet/in.h>. 1/* Substitute for <netinet/in.h>.
2 Copyright (C) 2007-2024 Free Software Foundation, Inc. 2 Copyright (C) 2007-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/nl_langinfo-lock.c b/gl/nl_langinfo-lock.c
index 5a248ed8..810a510d 100644
--- a/gl/nl_langinfo-lock.c
+++ b/gl/nl_langinfo-lock.c
@@ -1,5 +1,5 @@
1/* Return the internal lock used by nl_langinfo. 1/* Return the internal lock used by nl_langinfo.
2 Copyright (C) 2019-2024 Free Software Foundation, Inc. 2 Copyright (C) 2019-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/nl_langinfo.c b/gl/nl_langinfo.c
index 64ff93b0..ff8fd89e 100644
--- a/gl/nl_langinfo.c
+++ b/gl/nl_langinfo.c
@@ -1,6 +1,6 @@
1/* nl_langinfo() replacement: query locale dependent information. 1/* nl_langinfo() replacement: query locale dependent information.
2 2
3 Copyright (C) 2007-2024 Free Software Foundation, Inc. 3 Copyright (C) 2007-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -79,15 +79,13 @@ ctype_codeset (void)
79 /* This function is only used on platforms which don't have uselocale(). 79 /* This function is only used on platforms which don't have uselocale().
80 Therefore we don't need to look at the per-thread locale first, here. */ 80 Therefore we don't need to look at the per-thread locale first, here. */
81 static char result[2 + 10 + 1]; 81 static char result[2 + 10 + 1];
82 char buf[2 + 10 + 1];
83 char locale[SETLOCALE_NULL_MAX];
84 char *codeset;
85 size_t codesetlen;
86 82
83 char locale[SETLOCALE_NULL_MAX];
87 if (setlocale_null_r (LC_CTYPE, locale, sizeof (locale))) 84 if (setlocale_null_r (LC_CTYPE, locale, sizeof (locale)))
88 locale[0] = '\0'; 85 locale[0] = '\0';
89 86
90 codeset = buf; 87 char buf[2 + 10 + 1];
88 char *codeset = buf;
91 codeset[0] = '\0'; 89 codeset[0] = '\0';
92 90
93 if (locale[0]) 91 if (locale[0])
@@ -105,7 +103,7 @@ ctype_codeset (void)
105 codeset = codeset_start; 103 codeset = codeset_start;
106 else 104 else
107 { 105 {
108 codesetlen = modifier - codeset_start; 106 size_t codesetlen = modifier - codeset_start;
109 if (codesetlen < sizeof buf) 107 if (codesetlen < sizeof buf)
110 { 108 {
111 codeset = memcpy (buf, codeset_start, codesetlen); 109 codeset = memcpy (buf, codeset_start, codesetlen);
@@ -121,14 +119,14 @@ ctype_codeset (void)
121 GetACP, which returns the locale's codepage as a number (although 119 GetACP, which returns the locale's codepage as a number (although
122 this doesn't change according to what the 'setlocale' call specified). 120 this doesn't change according to what the 'setlocale' call specified).
123 Either way, prepend "CP" to make it a valid codeset name. */ 121 Either way, prepend "CP" to make it a valid codeset name. */
124 codesetlen = strlen (codeset); 122 size_t codesetlen = strlen (codeset);
125 if (0 < codesetlen && codesetlen < sizeof buf - 2) 123 if (0 < codesetlen && codesetlen < sizeof buf - 2)
126 memmove (buf + 2, codeset, codesetlen + 1); 124 memmove (buf + 2, codeset, codesetlen + 1);
127 else 125 else
128 sprintf (buf + 2, "%u", GetACP ()); 126 sprintf (buf + 2, "%u", GetACP ());
129 /* For a locale name such as "French_France.65001", in Windows 10, 127 /* For a locale name such as "French_France.65001", in Windows 10,
130 setlocale now returns "French_France.utf8" instead. */ 128 setlocale now returns "French_France.utf8" instead. */
131 if (strcmp (buf + 2, "65001") == 0 || strcmp (buf + 2, "utf8") == 0) 129 if (streq (buf + 2, "65001") || streq (buf + 2, "utf8"))
132 return (char *) "UTF-8"; 130 return (char *) "UTF-8";
133 else 131 else
134 { 132 {
@@ -154,11 +152,15 @@ ctype_codeset (void)
154 "thread5 disturbed by threadN!", even when threadN invokes only 152 "thread5 disturbed by threadN!", even when threadN invokes only
155 nl_langinfo (CODESET); 153 nl_langinfo (CODESET);
156 nl_langinfo (CRNCYSTR); 154 nl_langinfo (CRNCYSTR);
157 Similarly on Solaris 10. */ 155 Similarly on Solaris 10 and macOS 26. */
158 156
159# if !NL_LANGINFO_MTSAFE /* Solaris */ 157# if !NL_LANGINFO_MTSAFE /* macOS, Solaris */
160 158
161# define ITEMS (MAXSTRMSG + 1) 159# ifdef __sun /* Solaris */
160# define ITEMS (MAXSTRMSG + 1)
161# else /* macOS */
162# define ITEMS (CRNCYSTR + 20)
163# endif
162# define MAX_RESULT_LEN 80 164# define MAX_RESULT_LEN 80
163 165
164static char * 166static char *
@@ -205,10 +207,9 @@ static char *
205nl_langinfo_with_lock (nl_item item) 207nl_langinfo_with_lock (nl_item item)
206{ 208{
207 CRITICAL_SECTION *lock = gl_get_nl_langinfo_lock (); 209 CRITICAL_SECTION *lock = gl_get_nl_langinfo_lock ();
208 char *ret;
209 210
210 EnterCriticalSection (lock); 211 EnterCriticalSection (lock);
211 ret = nl_langinfo_unlocked (item); 212 char *ret = nl_langinfo_unlocked (item);
212 LeaveCriticalSection (lock); 213 LeaveCriticalSection (lock);
213 214
214 return ret; 215 return ret;
@@ -244,11 +245,10 @@ nl_langinfo_with_lock (nl_item item)
244 if (pthread_in_use()) 245 if (pthread_in_use())
245 { 246 {
246 pthread_mutex_t *lock = gl_get_nl_langinfo_lock (); 247 pthread_mutex_t *lock = gl_get_nl_langinfo_lock ();
247 char *ret;
248 248
249 if (pthread_mutex_lock (lock)) 249 if (pthread_mutex_lock (lock))
250 abort (); 250 abort ();
251 ret = nl_langinfo_unlocked (item); 251 char *ret = nl_langinfo_unlocked (item);
252 if (pthread_mutex_unlock (lock)) 252 if (pthread_mutex_unlock (lock))
253 abort (); 253 abort ();
254 254
@@ -266,11 +266,10 @@ static char *
266nl_langinfo_with_lock (nl_item item) 266nl_langinfo_with_lock (nl_item item)
267{ 267{
268 mtx_t *lock = gl_get_nl_langinfo_lock (); 268 mtx_t *lock = gl_get_nl_langinfo_lock ();
269 char *ret;
270 269
271 if (mtx_lock (lock) != thrd_success) 270 if (mtx_lock (lock) != thrd_success)
272 abort (); 271 abort ();
273 ret = nl_langinfo_unlocked (item); 272 char *ret = nl_langinfo_unlocked (item);
274 if (mtx_unlock (lock) != thrd_success) 273 if (mtx_unlock (lock) != thrd_success)
275 abort (); 274 abort ();
276 275
@@ -295,10 +294,6 @@ rpl_nl_langinfo (nl_item item)
295 case CODESET: 294 case CODESET:
296 return ctype_codeset (); 295 return ctype_codeset ();
297# endif 296# endif
298# if GNULIB_defined_T_FMT_AMPM
299 case T_FMT_AMPM:
300 return (char *) "%I:%M:%S %p";
301# endif
302# if GNULIB_defined_ALTMON 297# if GNULIB_defined_ALTMON
303 case ALTMON_1: 298 case ALTMON_1:
304 case ALTMON_2: 299 case ALTMON_2:
@@ -317,6 +312,24 @@ rpl_nl_langinfo (nl_item item)
317 item = item - ALTMON_1 + MON_1; 312 item = item - ALTMON_1 + MON_1;
318 break; 313 break;
319# endif 314# endif
315# if GNULIB_defined_ABALTMON
316 case ABALTMON_1:
317 case ABALTMON_2:
318 case ABALTMON_3:
319 case ABALTMON_4:
320 case ABALTMON_5:
321 case ABALTMON_6:
322 case ABALTMON_7:
323 case ABALTMON_8:
324 case ABALTMON_9:
325 case ABALTMON_10:
326 case ABALTMON_11:
327 case ABALTMON_12:
328 /* We don't ship the appropriate localizations with gnulib. Therefore,
329 treat ABALTMON_i like ABMON_i. */
330 item = item - ABALTMON_1 + ABMON_1;
331 break;
332# endif
320# if GNULIB_defined_ERA 333# if GNULIB_defined_ERA
321 case ERA: 334 case ERA:
322 /* The format is not standardized. In glibc it is a sequence of strings 335 /* The format is not standardized. In glibc it is a sequence of strings
@@ -343,12 +356,6 @@ rpl_nl_langinfo (nl_item item)
343 strings, appended in memory. */ 356 strings, appended in memory. */
344 return (char *) "\0\0\0\0\0\0\0\0\0\0"; 357 return (char *) "\0\0\0\0\0\0\0\0\0\0";
345# endif 358# endif
346# if GNULIB_defined_YESEXPR || !FUNC_NL_LANGINFO_YESEXPR_WORKS
347 case YESEXPR:
348 return (char *) "^[yY]";
349 case NOEXPR:
350 return (char *) "^[nN]";
351# endif
352 default: 359 default:
353 break; 360 break;
354 } 361 }
@@ -510,30 +517,57 @@ nl_langinfo (nl_item item)
510 return result[item - ALTMON_1]; 517 return result[item - ALTMON_1];
511 } 518 }
512 } 519 }
513 case ABMON_1: 520 {
514 case ABMON_2: 521 static char const abmonths[][sizeof "Jan"] = {
515 case ABMON_3: 522 "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
516 case ABMON_4: 523 "Aug", "Sep", "Oct", "Nov", "Dec"
517 case ABMON_5: 524 };
518 case ABMON_6: 525 case ABMON_1:
519 case ABMON_7: 526 case ABMON_2:
520 case ABMON_8: 527 case ABMON_3:
521 case ABMON_9: 528 case ABMON_4:
522 case ABMON_10: 529 case ABMON_5:
523 case ABMON_11: 530 case ABMON_6:
524 case ABMON_12: 531 case ABMON_7:
525 { 532 case ABMON_8:
526 static char result[12][30]; 533 case ABMON_9:
527 static char const abmonths[][sizeof "Jan"] = { 534 case ABMON_10:
528 "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", 535 case ABMON_11:
529 "Aug", "Sep", "Oct", "Nov", "Dec" 536 case ABMON_12:
530 }; 537 {
531 tmm.tm_mon = item - ABMON_1; 538 static char result[12][30];
532 if (!strftime (buf, sizeof result[0], "%b", &tmm)) 539 tmm.tm_mon = item - ABMON_1;
533 return (char *) abmonths[item - ABMON_1]; 540 if (!strftime (buf, sizeof result[0], "%b", &tmm))
534 strcpy (result[item - ABMON_1], buf); 541 return (char *) abmonths[item - ABMON_1];
535 return result[item - ABMON_1]; 542 strcpy (result[item - ABMON_1], buf);
536 } 543 return result[item - ABMON_1];
544 }
545 case ABALTMON_1:
546 case ABALTMON_2:
547 case ABALTMON_3:
548 case ABALTMON_4:
549 case ABALTMON_5:
550 case ABALTMON_6:
551 case ABALTMON_7:
552 case ABALTMON_8:
553 case ABALTMON_9:
554 case ABALTMON_10:
555 case ABALTMON_11:
556 case ABALTMON_12:
557 {
558 static char result[12][50];
559 tmm.tm_mon = item - ABALTMON_1;
560 /* The platforms without nl_langinfo() don't support strftime with
561 %Ob. We don't even need to try. */
562 #if 0
563 if (!strftime (buf, sizeof result[0], "%Ob", &tmm))
564 #endif
565 if (!strftime (buf, sizeof result[0], "%b", &tmm))
566 return (char *) abmonths[item - ABALTMON_1];
567 strcpy (result[item - ABALTMON_1], buf);
568 return result[item - ABALTMON_1];
569 }
570 }
537 case ERA: 571 case ERA:
538 return (char *) ""; 572 return (char *) "";
539 case ALT_DIGITS: 573 case ALT_DIGITS:
diff --git a/gl/open.c b/gl/open.c
index e690c9ea..c3b5648e 100644
--- a/gl/open.c
+++ b/gl/open.c
@@ -1,5 +1,5 @@
1/* Open a descriptor to a file. 1/* Open a descriptor to a file.
2 Copyright (C) 2007-2024 Free Software Foundation, Inc. 2 Copyright (C) 2007-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -38,13 +38,7 @@ orig_open (const char *filename, int flags, mode_t mode)
38} 38}
39 39
40/* Specification. */ 40/* Specification. */
41#ifdef __osf__ 41#include <fcntl.h>
42/* Write "fcntl.h" here, not <fcntl.h>, otherwise OSF/1 5.1 DTK cc eliminates
43 this include because of the preliminary #include <fcntl.h> above. */
44# include "fcntl.h"
45#else
46# include <fcntl.h>
47#endif
48 42
49#include "cloexec.h" 43#include "cloexec.h"
50 44
@@ -55,24 +49,29 @@ orig_open (const char *filename, int flags, mode_t mode)
55#include <sys/stat.h> 49#include <sys/stat.h>
56#include <unistd.h> 50#include <unistd.h>
57 51
52#ifndef HAVE_WORKING_O_DIRECTORY
53# define HAVE_WORKING_O_DIRECTORY false
54#endif
55
56#ifndef OPEN_TRAILING_SLASH_BUG
57# define OPEN_TRAILING_SLASH_BUG false
58#endif
59
58#ifndef REPLACE_OPEN_DIRECTORY 60#ifndef REPLACE_OPEN_DIRECTORY
59# define REPLACE_OPEN_DIRECTORY 0 61# define REPLACE_OPEN_DIRECTORY false
60#endif 62#endif
61 63
64static int
65lstatif (char const *filename, struct stat *st, int flags)
66{
67 return flags & O_NOFOLLOW ? lstat (filename, st) : stat (filename, st);
68}
69
62int 70int
63open (const char *filename, int flags, ...) 71open (const char *filename, int flags, ...)
64{ 72{
65 /* 0 = unknown, 1 = yes, -1 = no. */ 73 mode_t mode = 0;
66#if GNULIB_defined_O_CLOEXEC
67 int have_cloexec = -1;
68#else
69 static int have_cloexec;
70#endif
71
72 mode_t mode;
73 int fd;
74 74
75 mode = 0;
76 if (flags & O_CREAT) 75 if (flags & O_CREAT)
77 { 76 {
78 va_list arg; 77 va_list arg;
@@ -95,11 +94,10 @@ open (const char *filename, int flags, ...)
95#endif 94#endif
96 95
97#if defined _WIN32 && ! defined __CYGWIN__ 96#if defined _WIN32 && ! defined __CYGWIN__
98 if (strcmp (filename, "/dev/null") == 0) 97 if (streq (filename, "/dev/null"))
99 filename = "NUL"; 98 filename = "NUL";
100#endif 99#endif
101 100
102#if OPEN_TRAILING_SLASH_BUG
103 /* Fail if one of O_CREAT, O_WRONLY, O_RDWR is specified and the filename 101 /* Fail if one of O_CREAT, O_WRONLY, O_RDWR is specified and the filename
104 ends in a slash, as POSIX says such a filename must name a directory 102 ends in a slash, as POSIX says such a filename must name a directory
105 <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>: 103 <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>:
@@ -118,21 +116,55 @@ open (const char *filename, int flags, ...)
118 directories, 116 directories,
119 - if O_WRONLY or O_RDWR is specified, open() must fail because the 117 - if O_WRONLY or O_RDWR is specified, open() must fail because the
120 file does not contain a '.' directory. */ 118 file does not contain a '.' directory. */
121 if ((flags & O_CREAT) 119 bool check_for_slash_bug;
122 || (flags & O_ACCMODE) == O_RDWR 120 if (OPEN_TRAILING_SLASH_BUG)
123 || (flags & O_ACCMODE) == O_WRONLY)
124 { 121 {
125 size_t len = strlen (filename); 122 size_t len = strlen (filename);
126 if (len > 0 && filename[len - 1] == '/') 123 check_for_slash_bug = len && filename[len - 1] == '/';
124 }
125 else
126 check_for_slash_bug = false;
127
128 if (check_for_slash_bug
129 && (flags & O_CREAT
130 || (flags & O_ACCMODE) == O_RDWR
131 || (flags & O_ACCMODE) == O_WRONLY))
132 {
133 errno = EISDIR;
134 return -1;
135 }
136
137 /* With the trailing slash bug or without working O_DIRECTORY, check with
138 stat first lest we hang trying to open a fifo. Although there is
139 a race between this and opening the file, we can do no better.
140 After opening the file we will check again with fstat. */
141 bool check_directory =
142 (check_for_slash_bug
143 || (!HAVE_WORKING_O_DIRECTORY && flags & O_DIRECTORY));
144 if (check_directory)
145 {
146 struct stat statbuf;
147 if (lstatif (filename, &statbuf, flags) < 0)
127 { 148 {
128 errno = EISDIR; 149 if (! (flags & O_CREAT && errno == ENOENT))
150 return -1;
151 }
152 else if (!S_ISDIR (statbuf.st_mode))
153 {
154 errno = ENOTDIR;
129 return -1; 155 return -1;
130 } 156 }
131 } 157 }
158
159 /* 0 = unknown, 1 = yes, -1 = no. */
160#if GNULIB_defined_O_CLOEXEC
161 int have_cloexec = -1;
162#else
163 static int have_cloexec;
132#endif 164#endif
133 165
134 fd = orig_open (filename, 166 int fd = orig_open (filename,
135 flags & ~(have_cloexec < 0 ? O_CLOEXEC : 0), mode); 167 flags & ~(have_cloexec < 0 ? O_CLOEXEC : 0), mode);
136 168
137 if (flags & O_CLOEXEC) 169 if (flags & O_CLOEXEC)
138 { 170 {
@@ -154,19 +186,21 @@ open (const char *filename, int flags, ...)
154#if REPLACE_FCHDIR 186#if REPLACE_FCHDIR
155 /* Implementing fchdir and fdopendir requires the ability to open a 187 /* Implementing fchdir and fdopendir requires the ability to open a
156 directory file descriptor. If open doesn't support that (as on 188 directory file descriptor. If open doesn't support that (as on
157 mingw), we use a dummy file that behaves the same as directories 189 mingw), use a dummy file that behaves the same as directories
158 on Linux (ie. always reports EOF on attempts to read()), and 190 on Linux (ie. always reports EOF on attempts to read()), and
159 override fstat() in fchdir.c to hide the fact that we have a 191 override fstat in fchdir.c to hide the dummy. */
160 dummy. */
161 if (REPLACE_OPEN_DIRECTORY && fd < 0 && errno == EACCES 192 if (REPLACE_OPEN_DIRECTORY && fd < 0 && errno == EACCES
162 && ((flags & O_ACCMODE) == O_RDONLY 193 && ((flags & (O_ACCMODE | O_CREAT)) == O_RDONLY
163 || (O_SEARCH != O_RDONLY && (flags & O_ACCMODE) == O_SEARCH))) 194 || (O_SEARCH != O_RDONLY
195 && (flags & (O_ACCMODE | O_CREAT)) == O_SEARCH)))
164 { 196 {
165 struct stat statbuf; 197 struct stat statbuf;
166 if (stat (filename, &statbuf) == 0 && S_ISDIR (statbuf.st_mode)) 198 if (check_directory
199 || (lstatif (filename, &statbuf, flags) == 0
200 && S_ISDIR (statbuf.st_mode)))
167 { 201 {
168 /* Maximum recursion depth of 1. */ 202 /* Maximum recursion depth of 1. */
169 fd = open ("/dev/null", flags, mode); 203 fd = open ("/dev/null", flags & ~O_DIRECTORY, mode);
170 if (0 <= fd) 204 if (0 <= fd)
171 fd = _gl_register_fd (fd, filename); 205 fd = _gl_register_fd (fd, filename);
172 } 206 }
@@ -175,10 +209,8 @@ open (const char *filename, int flags, ...)
175 } 209 }
176#endif 210#endif
177 211
178#if OPEN_TRAILING_SLASH_BUG 212 /* If checking for directories, fail if fd does not refer to a directory.
179 /* If the filename ends in a slash and fd does not refer to a directory, 213 Rationale: A filename ending in slash cannot name a non-directory
180 then fail.
181 Rationale: POSIX says such a filename must name a directory
182 <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>: 214 <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>:
183 "A pathname that contains at least one non-<slash> character and that 215 "A pathname that contains at least one non-<slash> character and that
184 ends with one or more trailing <slash> characters shall not be resolved 216 ends with one or more trailing <slash> characters shall not be resolved
@@ -186,23 +218,18 @@ open (const char *filename, int flags, ...)
186 <slash> characters names an existing directory" 218 <slash> characters names an existing directory"
187 If the named file without the slash is not a directory, open() must fail 219 If the named file without the slash is not a directory, open() must fail
188 with ENOTDIR. */ 220 with ENOTDIR. */
189 if (fd >= 0) 221 if (check_directory && 0 <= fd)
190 { 222 {
191 /* We know len is positive, since open did not fail with ENOENT. */ 223 struct stat statbuf;
192 size_t len = strlen (filename); 224 int r = fstat (fd, &statbuf);
193 if (filename[len - 1] == '/') 225 if (r < 0 || !S_ISDIR (statbuf.st_mode))
194 { 226 {
195 struct stat statbuf; 227 int err = r < 0 ? errno : ENOTDIR;
196 228 close (fd);
197 if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode)) 229 errno = err;
198 { 230 return -1;
199 close (fd);
200 errno = ENOTDIR;
201 return -1;
202 }
203 } 231 }
204 } 232 }
205#endif
206 233
207#if REPLACE_FCHDIR 234#if REPLACE_FCHDIR
208 if (!REPLACE_OPEN_DIRECTORY && 0 <= fd) 235 if (!REPLACE_OPEN_DIRECTORY && 0 <= fd)
diff --git a/gl/pathmax.h b/gl/pathmax.h
index d6512c6f..11c13592 100644
--- a/gl/pathmax.h
+++ b/gl/pathmax.h
@@ -1,5 +1,5 @@
1/* Define PATH_MAX somehow. Requires sys/types.h. 1/* Define PATH_MAX somehow. Requires sys/types.h.
2 Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2024 Free Software 2 Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2026 Free Software
3 Foundation, Inc. 3 Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
diff --git a/gl/printf-args.c b/gl/printf-args.c
index eb0d2cdc..2f7bf3da 100644
--- a/gl/printf-args.c
+++ b/gl/printf-args.c
@@ -1,5 +1,5 @@
1/* Decomposed printf argument list. 1/* Decomposed printf argument list.
2 Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2024 Free Software 2 Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2026 Free Software
3 Foundation, Inc. 3 Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
@@ -32,6 +32,9 @@
32/* Get INT_WIDTH. */ 32/* Get INT_WIDTH. */
33#include <limits.h> 33#include <limits.h>
34 34
35/* Get abort(). */
36#include <stdlib.h>
37
35#ifdef STATIC 38#ifdef STATIC
36STATIC 39STATIC
37#endif 40#endif
@@ -198,7 +201,6 @@ PRINTF_FETCHARGS (va_list args, arguments *a)
198 if (ap->a.a_string == NULL) 201 if (ap->a.a_string == NULL)
199 ap->a.a_string = "(NULL)"; 202 ap->a.a_string = "(NULL)";
200 break; 203 break;
201#if HAVE_WCHAR_T
202 case TYPE_WIDE_STRING: 204 case TYPE_WIDE_STRING:
203 ap->a.a_wide_string = va_arg (args, const wchar_t *); 205 ap->a.a_wide_string = va_arg (args, const wchar_t *);
204 /* A null pointer is an invalid argument for "%ls", but in practice 206 /* A null pointer is an invalid argument for "%ls", but in practice
@@ -216,7 +218,6 @@ PRINTF_FETCHARGS (va_list args, arguments *a)
216 ap->a.a_wide_string = wide_null_string; 218 ap->a.a_wide_string = wide_null_string;
217 } 219 }
218 break; 220 break;
219#endif
220 case TYPE_POINTER: 221 case TYPE_POINTER:
221 ap->a.a_pointer = va_arg (args, void *); 222 ap->a.a_pointer = va_arg (args, void *);
222 break; 223 break;
@@ -298,9 +299,19 @@ PRINTF_FETCHARGS (va_list args, arguments *a)
298 } 299 }
299 break; 300 break;
300#endif 301#endif
301 default: 302 case TYPE_NONE:
302 /* Unknown type. */ 303 /* Argument i is not used by any directive, but some argument with
304 number > i is used by a format directive. POSIX says that this
305 is invalid:
306 "When numbered argument specifications are used, specifying the
307 Nth argument requires that all the leading arguments, from the
308 first to the (N-1)th, are specified in the format string."
309 The reason is that we cannot know how many bytes to skip in the
310 va_arg sequence. */
303 return -1; 311 return -1;
312 default:
313 /* Unknown type. Should not happen. */
314 abort ();
304 } 315 }
305 return 0; 316 return 0;
306} 317}
diff --git a/gl/printf-args.h b/gl/printf-args.h
index 9b80bb39..e72863ef 100644
--- a/gl/printf-args.h
+++ b/gl/printf-args.h
@@ -1,5 +1,5 @@
1/* Decomposed printf argument list. 1/* Decomposed printf argument list.
2 Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2024 Free Software 2 Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2026 Free Software
3 Foundation, Inc. 3 Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
@@ -28,14 +28,9 @@
28# define PRINTF_FETCHARGS printf_fetchargs 28# define PRINTF_FETCHARGS printf_fetchargs
29#endif 29#endif
30 30
31/* Get size_t. */ 31/* Get size_t, wchar_t. */
32#include <stddef.h> 32#include <stddef.h>
33 33
34/* Get wchar_t. */
35#if HAVE_WCHAR_T
36# include <stddef.h>
37#endif
38
39/* Get wint_t. */ 34/* Get wint_t. */
40#if HAVE_WINT_T 35#if HAVE_WINT_T
41# include <wchar.h> 36# include <wchar.h>
@@ -89,9 +84,7 @@ typedef enum
89 TYPE_WIDE_CHAR, 84 TYPE_WIDE_CHAR,
90#endif 85#endif
91 TYPE_STRING, 86 TYPE_STRING,
92#if HAVE_WCHAR_T
93 TYPE_WIDE_STRING, 87 TYPE_WIDE_STRING,
94#endif
95 TYPE_POINTER, 88 TYPE_POINTER,
96 TYPE_COUNT_SCHAR_POINTER, 89 TYPE_COUNT_SCHAR_POINTER,
97 TYPE_COUNT_SHORT_POINTER, 90 TYPE_COUNT_SHORT_POINTER,
@@ -154,9 +147,7 @@ typedef struct
154 wint_t a_wide_char; 147 wint_t a_wide_char;
155#endif 148#endif
156 const char* a_string; 149 const char* a_string;
157#if HAVE_WCHAR_T
158 const wchar_t* a_wide_string; 150 const wchar_t* a_wide_string;
159#endif
160 void* a_pointer; 151 void* a_pointer;
161 signed char * a_count_schar_pointer; 152 signed char * a_count_schar_pointer;
162 short * a_count_short_pointer; 153 short * a_count_short_pointer;
diff --git a/gl/printf-parse.c b/gl/printf-parse.c
index a33e27a0..34d241a6 100644
--- a/gl/printf-parse.c
+++ b/gl/printf-parse.c
@@ -1,5 +1,5 @@
1/* Formatted output to strings. 1/* Formatted output to strings.
2 Copyright (C) 1999-2000, 2002-2003, 2006-2024 Free Software Foundation, Inc. 2 Copyright (C) 1999-2000, 2002-2003, 2006-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -323,8 +323,6 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
323 } 323 }
324 324
325 { 325 {
326 arg_type type;
327
328 /* Parse argument type/size specifiers. */ 326 /* Parse argument type/size specifiers. */
329 /* Relevant for the conversion characters d, i. */ 327 /* Relevant for the conversion characters d, i. */
330 arg_type signed_type = TYPE_INT; 328 arg_type signed_type = TYPE_INT;
@@ -561,6 +559,7 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
561 (void) pointer_type; 559 (void) pointer_type;
562 560
563 /* Read the conversion character. */ 561 /* Read the conversion character. */
562 arg_type type;
564 c = *cp++; 563 c = *cp++;
565 switch (c) 564 switch (c)
566 { 565 {
@@ -600,20 +599,14 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
600 if (signed_type == TYPE_LONGINT 599 if (signed_type == TYPE_LONGINT
601 /* For backward compatibility only. */ 600 /* For backward compatibility only. */
602 || signed_type == TYPE_LONGLONGINT) 601 || signed_type == TYPE_LONGLONGINT)
603#if HAVE_WCHAR_T
604 type = TYPE_WIDE_STRING; 602 type = TYPE_WIDE_STRING;
605#else
606 goto error;
607#endif
608 else 603 else
609 type = TYPE_STRING; 604 type = TYPE_STRING;
610 break; 605 break;
611#if HAVE_WCHAR_T
612 case 'S': 606 case 'S':
613 type = TYPE_WIDE_STRING; 607 type = TYPE_WIDE_STRING;
614 c = 's'; 608 c = 's';
615 break; 609 break;
616#endif
617 case 'p': 610 case 'p':
618 type = TYPE_POINTER; 611 type = TYPE_POINTER;
619 break; 612 break;
@@ -660,17 +653,14 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
660 d->count++; 653 d->count++;
661 if (d->count >= d_allocated) 654 if (d->count >= d_allocated)
662 { 655 {
663 size_t memory_size;
664 DIRECTIVE *memory;
665
666 d_allocated = xtimes (d_allocated, 2); 656 d_allocated = xtimes (d_allocated, 2);
667 memory_size = xtimes (d_allocated, sizeof (DIRECTIVE)); 657 size_t memory_size = xtimes (d_allocated, sizeof (DIRECTIVE));
668 if (size_overflow_p (memory_size)) 658 if (size_overflow_p (memory_size))
669 /* Overflow, would lead to out of memory. */ 659 /* Overflow, would lead to out of memory. */
670 goto out_of_memory; 660 goto out_of_memory;
671 memory = (DIRECTIVE *) (d->dir != d->direct_alloc_dir 661 DIRECTIVE *memory = (DIRECTIVE *) (d->dir != d->direct_alloc_dir
672 ? realloc (d->dir, memory_size) 662 ? realloc (d->dir, memory_size)
673 : malloc (memory_size)); 663 : malloc (memory_size));
674 if (memory == NULL) 664 if (memory == NULL)
675 /* Out of memory. */ 665 /* Out of memory. */
676 goto out_of_memory; 666 goto out_of_memory;
diff --git a/gl/printf-parse.h b/gl/printf-parse.h
index 949b8754..17164f0e 100644
--- a/gl/printf-parse.h
+++ b/gl/printf-parse.h
@@ -1,5 +1,5 @@
1/* Parse printf format string. 1/* Parse printf format string.
2 Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2024 Free Software 2 Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2026 Free Software
3 Foundation, Inc. 3 Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
diff --git a/gl/pthread-once.c b/gl/pthread-once.c
new file mode 100644
index 00000000..823f0639
--- /dev/null
+++ b/gl/pthread-once.c
@@ -0,0 +1,148 @@
1/* POSIX once-only control.
2 Copyright (C) 2019-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17/* Written by Bruno Haible <bruno@clisp.org>, 2019. */
18
19#include <config.h>
20
21/* Specification. */
22#include <pthread.h>
23
24#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
25# include "windows-once.h"
26#endif
27
28#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
29/* Use Windows threads. */
30
31int
32pthread_once (pthread_once_t *once_control, void (*initfunction) (void))
33{
34 glwthread_once (once_control, initfunction);
35 return 0;
36}
37
38#elif HAVE_PTHREAD_H
39/* Provide workarounds for POSIX threads. */
40
41# if defined __CYGWIN__
42
43# include <stdlib.h>
44
45int
46pthread_once (pthread_once_t *once_control, void (*initfunction) (void))
47{
48 /* In this implementation, we reuse the type
49 typedef struct { pthread_mutex_t mutex; int state; } pthread_once_t;
50 #define PTHREAD_ONCE_INIT { PTHREAD_MUTEX_INITIALIZER, 0 }
51 while assigning the following meaning to the state:
52 state = (<number of waiting threads> << 16) + <1 if done>
53 In other words:
54 state = { unsigned int num_threads : 16; unsigned int done : 16; }
55 */
56 struct actual_state
57 {
58 _Atomic unsigned short num_threads;
59 /* done == 0: initial state
60 done == 1: initfunction executed, lock still active
61 done == 2: initfunction executed, lock no longer usable */
62 _Atomic unsigned short done;
63 };
64 struct actual_state *state_p = (struct actual_state *) &once_control->state;
65 /* This test is not necessary. It's only an optimization, to establish
66 a fast path for the common case that the 'done' word is already > 0. */
67 if (state_p->done == 0)
68 {
69 /* Increment num_threads (atomically), to indicate that this thread will
70 possibly take the lock. */
71 state_p->num_threads += 1;
72 /* Test the 'done' word. */
73 if (state_p->done == 0)
74 {
75 /* The 'done' word is still zero. Now take the lock. */
76 pthread_mutex_lock (&once_control->mutex);
77 /* Test the 'done' word again. */
78 if (state_p->done == 0)
79 {
80 /* Execute the initfunction. */
81 (*initfunction) ();
82 /* Set the 'done' word to 1 (atomically). */
83 state_p->done = 1;
84 }
85 /* Now the 'done' word is 1. Release the lock. */
86 pthread_mutex_unlock (&once_control->mutex);
87 }
88 /* Here, done is > 0. */
89 /* Decrement num_threads (atomically). */
90 if ((state_p->num_threads -= 1) == 0)
91 {
92 /* num_threads is now zero, and done is > 0.
93 No other thread will need to use the lock.
94 We can therefore destroy the lock, to free resources. */
95 if (__sync_bool_compare_and_swap (&state_p->done, 1, 2))
96 pthread_mutex_destroy (&once_control->mutex);
97 }
98 }
99 /* Proof of correctness:
100 * num_threads is incremented and then decremented by some threads.
101 Therefore, num_threads always stays >= 0, and is == 0 at the end.
102 * The 'done' word, once > 0, stays > 0 (since it is never assigned 0).
103 * The 'done' word is changed from == 0 to > 0 only while the lock
104 is taken. Therefore, only the first thread that succeeds in taking
105 the lock executes the initfunction and sets the 'done' word to a
106 value > 0; the other threads that take the lock do no side effects
107 between taking and releasing the lock.
108 * The 'done' word does not change any more once it is 2.
109 Therefore, it can be changed from 1 to 2 only once.
110 * pthread_mutex_destroy gets invoked right after 'done' has been changed
111 from 1 to 2. Therefore, pthread_mutex_destroy gets invoked only once.
112 * After a moment where num_threads was 0 and done was > 0, no thread can
113 reach the pthread_mutex_lock invocation. Proof:
114 - At such a moment, no thread is in the code range between
115 state_p->num_threads += 1
116 and
117 state_p->num_threads -= 1
118 - After such a moment, some thread can increment num_threads, but from
119 there they cannot reach the pthread_mutex_lock invocation, because the
120 if (state_p->done == 0)
121 test prevents that.
122 * From this it follows that:
123 - pthread_mutex_destroy cannot be executed while the lock is taken
124 (because pthread_mutex_destroy is only executed after a moment where
125 num_threads was 0 and done was > 0).
126 - Once pthread_mutex_destroy has been executed, the lock is not used any
127 more.
128 */
129 return 0;
130}
131
132# endif
133
134#else
135/* Provide a dummy implementation for single-threaded applications. */
136
137int
138pthread_once (pthread_once_t *once_control, void (*initfunction) (void))
139{
140 if (*once_control == 0)
141 {
142 *once_control = ~ 0;
143 initfunction ();
144 }
145 return 0;
146}
147
148#endif
diff --git a/gl/pthread.in.h b/gl/pthread.in.h
new file mode 100644
index 00000000..37deab82
--- /dev/null
+++ b/gl/pthread.in.h
@@ -0,0 +1,1981 @@
1/* Implement the most essential subset of POSIX pthread.h.
2
3 Copyright (C) 2009-2026 Free Software Foundation, Inc.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18/* Written by Paul Eggert, Glen Lenker, and Bruno Haible. */
19
20#if __GNUC__ >= 3
21@PRAGMA_SYSTEM_HEADER@
22#endif
23@PRAGMA_COLUMNS@
24
25#if defined _@GUARD_PREFIX@_ALREADY_INCLUDING_PTHREAD_H
26/* Special invocation convention:
27 On Android, we have a sequence of nested includes
28 <pthread.h> -> <time.h> -> <sys/time.h> -> <sys/select.h> ->
29 <signal.h> -> <pthread.h>.
30 In this situation, PTHREAD_COND_INITIALIZER is not yet defined,
31 therefore we should not attempt to define PTHREAD_MUTEX_NORMAL etc. */
32
33#@INCLUDE_NEXT@ @NEXT_PTHREAD_H@
34
35#else
36/* Normal invocation convention. */
37
38#ifndef _@GUARD_PREFIX@_PTHREAD_H_
39
40#if @HAVE_PTHREAD_H@
41
42# define _@GUARD_PREFIX@_ALREADY_INCLUDING_PTHREAD_H
43
44/* The include_next requires a split double-inclusion guard. */
45# @INCLUDE_NEXT@ @NEXT_PTHREAD_H@
46
47# undef _@GUARD_PREFIX@_ALREADY_INCLUDING_PTHREAD_H
48
49#endif
50
51#ifndef _@GUARD_PREFIX@_PTHREAD_H_
52#define _@GUARD_PREFIX@_PTHREAD_H_
53
54/* This file uses _Noreturn, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK,
55 HAVE_RAW_DECL_*. */
56#if !_GL_CONFIG_H_INCLUDED
57 #error "Please include config.h first."
58#endif
59
60#define __need_system_stdlib_h
61#include <stdlib.h>
62#undef __need_system_stdlib_h
63
64
65/* The pthreads-win32 <pthread.h> defines a couple of broken macros. */
66#undef asctime_r
67#undef ctime_r
68#undef gmtime_r
69#undef localtime_r
70#undef rand_r
71#undef strtok_r
72
73#include <errno.h>
74#include <sched.h>
75#include <sys/types.h>
76#include <time.h>
77
78/* The __attribute__ feature is available in gcc versions 2.5 and later.
79 The attribute __pure__ was added in gcc 2.96. */
80#ifndef _GL_ATTRIBUTE_PURE
81# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
82# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
83# else
84# define _GL_ATTRIBUTE_PURE /* empty */
85# endif
86#endif
87
88/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
89
90/* The definition of _Noreturn is copied here. */
91
92/* The definition of _GL_ARG_NONNULL is copied here. */
93
94/* The definition of _GL_WARN_ON_USE is copied here. */
95
96/* =========== Thread types and macros =========== */
97
98#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
99# if @GNULIB_PTHREAD_THREAD@
100# include "windows-thread.h"
101# if @HAVE_PTHREAD_T@
102# define pthread_t rpl_pthread_t
103# define pthread_attr_t rpl_pthread_attr_t
104# endif
105# if !GNULIB_defined_pthread_thread_types
106typedef glwthread_thread_t pthread_t;
107typedef unsigned int pthread_attr_t;
108# define GNULIB_defined_pthread_thread_types 1
109# endif
110# else
111# if @HAVE_PTHREAD_T@
112# define pthread_t rpl_pthread_t
113# define pthread_attr_t rpl_pthread_attr_t
114# endif
115# if !GNULIB_defined_pthread_thread_types
116typedef int pthread_t;
117typedef unsigned int pthread_attr_t;
118# define GNULIB_defined_pthread_thread_types 1
119# endif
120# endif
121# undef PTHREAD_CREATE_JOINABLE
122# undef PTHREAD_CREATE_DETACHED
123# define PTHREAD_CREATE_JOINABLE 0
124# define PTHREAD_CREATE_DETACHED 1
125#else
126# if !@HAVE_PTHREAD_T@
127# if !GNULIB_defined_pthread_thread_types
128typedef int pthread_t;
129typedef unsigned int pthread_attr_t;
130# define GNULIB_defined_pthread_thread_types 1
131# endif
132# endif
133# if !@HAVE_PTHREAD_CREATE_DETACHED@
134# define PTHREAD_CREATE_JOINABLE 0
135# define PTHREAD_CREATE_DETACHED 1
136# endif
137#endif
138
139/* =========== Once-only control (initialization) types and macros ========== */
140
141#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
142# if @GNULIB_PTHREAD_ONCE@
143# include "windows-once.h"
144# if @HAVE_PTHREAD_T@
145# define pthread_once_t rpl_pthread_once_t
146# endif
147# if !GNULIB_defined_pthread_once_types
148typedef glwthread_once_t pthread_once_t;
149# define GNULIB_defined_pthread_once_types 1
150# endif
151# undef PTHREAD_ONCE_INIT
152# define PTHREAD_ONCE_INIT GLWTHREAD_ONCE_INIT
153# else
154# if @HAVE_PTHREAD_T@
155# define pthread_once_t rpl_pthread_once_t
156# endif
157# if !GNULIB_defined_pthread_once_types
158typedef int pthread_once_t;
159# define GNULIB_defined_pthread_once_types 1
160# endif
161# undef PTHREAD_ONCE_INIT
162# define PTHREAD_ONCE_INIT { 0 }
163# endif
164#else
165# if !@HAVE_PTHREAD_T@
166# if !GNULIB_defined_pthread_once_types
167typedef int pthread_once_t;
168# define GNULIB_defined_pthread_once_types 1
169# endif
170# undef PTHREAD_ONCE_INIT
171# define PTHREAD_ONCE_INIT { 0 }
172# endif
173#endif
174
175/* =========== Mutex types and macros =========== */
176
177#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
178# if @GNULIB_PTHREAD_MUTEX@
179# include "windows-timedmutex.h"
180# include "windows-timedrecmutex.h"
181# if @HAVE_PTHREAD_T@
182# define pthread_mutex_t rpl_pthread_mutex_t
183# define pthread_mutexattr_t rpl_pthread_mutexattr_t
184# endif
185# if !GNULIB_defined_pthread_mutex_types
186typedef struct
187 {
188 int type;
189 union
190 {
191 glwthread_timedmutex_t u_timedmutex;
192 glwthread_timedrecmutex_t u_timedrecmutex;
193 }
194 u;
195 }
196 pthread_mutex_t;
197typedef unsigned int pthread_mutexattr_t;
198# define GNULIB_defined_pthread_mutex_types 1
199# endif
200# undef PTHREAD_MUTEX_INITIALIZER
201# define PTHREAD_MUTEX_INITIALIZER { 1, { GLWTHREAD_TIMEDMUTEX_INIT } }
202# else
203# if @HAVE_PTHREAD_T@
204# define pthread_mutex_t rpl_pthread_mutex_t
205# define pthread_mutexattr_t rpl_pthread_mutexattr_t
206# endif
207# if !GNULIB_defined_pthread_mutex_types
208typedef int pthread_mutex_t;
209typedef unsigned int pthread_mutexattr_t;
210# define GNULIB_defined_pthread_mutex_types 1
211# endif
212# undef PTHREAD_MUTEX_INITIALIZER
213# define PTHREAD_MUTEX_INITIALIZER { 0 }
214# endif
215# undef PTHREAD_MUTEX_DEFAULT
216# undef PTHREAD_MUTEX_NORMAL
217# undef PTHREAD_MUTEX_ERRORCHECK
218# undef PTHREAD_MUTEX_RECURSIVE
219# define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
220# define PTHREAD_MUTEX_NORMAL 0
221# define PTHREAD_MUTEX_ERRORCHECK 1
222# define PTHREAD_MUTEX_RECURSIVE 2
223# undef PTHREAD_MUTEX_STALLED
224# undef PTHREAD_MUTEX_ROBUST
225# define PTHREAD_MUTEX_STALLED 0
226# define PTHREAD_MUTEX_ROBUST 1
227#else
228# if !@HAVE_PTHREAD_T@
229# if !GNULIB_defined_pthread_mutex_types
230typedef int pthread_mutex_t;
231typedef unsigned int pthread_mutexattr_t;
232# define GNULIB_defined_pthread_mutex_types 1
233# endif
234# undef PTHREAD_MUTEX_INITIALIZER
235# define PTHREAD_MUTEX_INITIALIZER { 0 }
236# endif
237# if !@HAVE_PTHREAD_MUTEX_RECURSIVE@
238# define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
239# define PTHREAD_MUTEX_NORMAL 0
240# define PTHREAD_MUTEX_ERRORCHECK 1
241# define PTHREAD_MUTEX_RECURSIVE 2
242# endif
243# if !@HAVE_PTHREAD_MUTEX_ROBUST@
244# define PTHREAD_MUTEX_STALLED 0
245# define PTHREAD_MUTEX_ROBUST 1
246# endif
247#endif
248
249/* =========== Read-write lock types and macros =========== */
250
251#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
252# if @GNULIB_PTHREAD_RWLOCK@
253# include "windows-timedrwlock.h"
254# if @HAVE_PTHREAD_T@
255# define pthread_rwlock_t rpl_pthread_rwlock_t
256# define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
257# endif
258# if !GNULIB_defined_pthread_rwlock_types
259typedef glwthread_timedrwlock_t pthread_rwlock_t;
260typedef unsigned int pthread_rwlockattr_t;
261# define GNULIB_defined_pthread_rwlock_types 1
262# endif
263# undef PTHREAD_RWLOCK_INITIALIZER
264# define PTHREAD_RWLOCK_INITIALIZER GLWTHREAD_TIMEDRWLOCK_INIT
265# else
266# if @HAVE_PTHREAD_T@
267# define pthread_rwlock_t rpl_pthread_rwlock_t
268# define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
269# endif
270# if !GNULIB_defined_pthread_rwlock_types
271typedef int pthread_rwlock_t;
272typedef unsigned int pthread_rwlockattr_t;
273# define GNULIB_defined_pthread_rwlock_types 1
274# endif
275# undef PTHREAD_RWLOCK_INITIALIZER
276# define PTHREAD_RWLOCK_INITIALIZER { 0 }
277# endif
278#elif @GNULIB_PTHREAD_RWLOCK@ && @REPLACE_PTHREAD_RWLOCK_DESTROY@ /* i.e. PTHREAD_RWLOCK_UNIMPLEMENTED */
279# if @HAVE_PTHREAD_T@
280# define pthread_rwlock_t rpl_pthread_rwlock_t
281# define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
282# endif
283# if !GNULIB_defined_pthread_rwlock_types
284typedef struct
285 {
286 pthread_mutex_t lock; /* protects the remaining fields */
287 pthread_cond_t waiting_readers; /* waiting readers */
288 pthread_cond_t waiting_writers; /* waiting writers */
289 unsigned int waiting_writers_count; /* number of waiting writers */
290 int runcount; /* number of readers running, or -1 when a writer runs */
291 }
292 pthread_rwlock_t;
293typedef unsigned int pthread_rwlockattr_t;
294# define GNULIB_defined_pthread_rwlock_types 1
295# endif
296# undef PTHREAD_RWLOCK_INITIALIZER
297# define PTHREAD_RWLOCK_INITIALIZER \
298 { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 }
299#elif @GNULIB_PTHREAD_RWLOCK@ && @REPLACE_PTHREAD_RWLOCK_INIT@ /* i.e. PTHREAD_RWLOCK_BAD_WAITQUEUE */
300/* Use rwlocks of kind PREFER_WRITER or PREFER_WRITER_NONRECURSIVE instead of
301 the DEFAULT. */
302# undef PTHREAD_RWLOCK_INITIALIZER
303# define PTHREAD_RWLOCK_INITIALIZER PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
304#else
305# if @HAVE_PTHREAD_T@
306# if !defined PTHREAD_RWLOCK_INITIALIZER && defined PTHREAD_RWLOCK_INITIALIZER_NP /* z/OS */
307# define PTHREAD_RWLOCK_INITIALIZER PTHREAD_RWLOCK_INITIALIZER_NP
308# endif
309# else
310# if !GNULIB_defined_pthread_rwlock_types
311typedef int pthread_rwlock_t;
312typedef unsigned int pthread_rwlockattr_t;
313# define GNULIB_defined_pthread_rwlock_types 1
314# endif
315# undef PTHREAD_RWLOCK_INITIALIZER
316# define PTHREAD_RWLOCK_INITIALIZER { 0 }
317# endif
318#endif
319
320/* =========== Condition variable types and macros =========== */
321
322#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
323# if @GNULIB_PTHREAD_COND@
324# include "windows-cond.h"
325# if @HAVE_PTHREAD_T@
326# define pthread_cond_t rpl_pthread_cond_t
327# define pthread_condattr_t rpl_pthread_condattr_t
328# endif
329# if !GNULIB_defined_pthread_cond_types
330typedef glwthread_cond_t pthread_cond_t;
331typedef unsigned int pthread_condattr_t;
332# define GNULIB_defined_pthread_cond_types 1
333# endif
334# undef PTHREAD_COND_INITIALIZER
335# define PTHREAD_COND_INITIALIZER GLWTHREAD_COND_INIT
336# else
337# if @HAVE_PTHREAD_T@
338# define pthread_cond_t rpl_pthread_cond_t
339# define pthread_condattr_t rpl_pthread_condattr_t
340# endif
341# if !GNULIB_defined_pthread_cond_types
342typedef int pthread_cond_t;
343typedef unsigned int pthread_condattr_t;
344# define GNULIB_defined_pthread_cond_types 1
345# endif
346# undef PTHREAD_COND_INITIALIZER
347# define PTHREAD_COND_INITIALIZER { 0 }
348# endif
349#else
350# if !@HAVE_PTHREAD_T@
351# if !GNULIB_defined_pthread_cond_types
352typedef int pthread_cond_t;
353typedef unsigned int pthread_condattr_t;
354# define GNULIB_defined_pthread_cond_types 1
355# endif
356# undef PTHREAD_COND_INITIALIZER
357# define PTHREAD_COND_INITIALIZER { 0 }
358# endif
359#endif
360
361/* =========== Thread-specific storage types and macros =========== */
362
363#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
364# if @GNULIB_PTHREAD_TSS@
365# include "windows-tls.h"
366# if @HAVE_PTHREAD_T@
367# define pthread_key_t rpl_pthread_key_t
368# endif
369# if !GNULIB_defined_pthread_tss_types
370typedef glwthread_tls_key_t pthread_key_t;
371# define GNULIB_defined_pthread_tss_types 1
372# endif
373# undef PTHREAD_DESTRUCTOR_ITERATIONS
374# define PTHREAD_DESTRUCTOR_ITERATIONS GLWTHREAD_DESTRUCTOR_ITERATIONS
375# else
376# if @HAVE_PTHREAD_T@
377# define pthread_key_t rpl_pthread_key_t
378# endif
379# if !GNULIB_defined_pthread_tss_types
380typedef void ** pthread_key_t;
381# define GNULIB_defined_pthread_tss_types 1
382# endif
383# undef PTHREAD_DESTRUCTOR_ITERATIONS
384# define PTHREAD_DESTRUCTOR_ITERATIONS 0
385# endif
386#else
387# if !@HAVE_PTHREAD_T@
388# if !GNULIB_defined_pthread_tss_types
389typedef void ** pthread_key_t;
390# define GNULIB_defined_pthread_tss_types 1
391# endif
392# undef PTHREAD_DESTRUCTOR_ITERATIONS
393# define PTHREAD_DESTRUCTOR_ITERATIONS 0
394# endif
395#endif
396
397/* =========== Spinlock types and macros =========== */
398
399#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
400# if @GNULIB_PTHREAD_SPIN@
401# include "windows-spin.h"
402# if @HAVE_PTHREAD_T@
403# define pthread_spinlock_t rpl_pthread_spinlock_t
404# endif
405# if !GNULIB_defined_pthread_spin_types
406typedef glwthread_spinlock_t pthread_spinlock_t;
407# define GNULIB_defined_pthread_spin_types 1
408# endif
409# else
410# if @HAVE_PTHREAD_T@
411# define pthread_spinlock_t rpl_pthread_spinlock_t
412# endif
413# if !GNULIB_defined_pthread_spin_types
414typedef pthread_mutex_t pthread_spinlock_t;
415# define GNULIB_defined_pthread_spin_types 1
416# endif
417# endif
418# undef PTHREAD_PROCESS_PRIVATE
419# undef PTHREAD_PROCESS_SHARED
420# define PTHREAD_PROCESS_PRIVATE 0
421# define PTHREAD_PROCESS_SHARED 1
422#else
423# if @HAVE_PTHREAD_SPINLOCK_T@
424/* <pthread.h> exists and defines pthread_spinlock_t. */
425# if !@HAVE_PTHREAD_SPIN_INIT@ || @REPLACE_PTHREAD_SPIN_INIT@
426/* If the 'pthread-spin' module is in use, it defines all the pthread_spin*
427 functions. Prepare for it by overriding pthread_spinlock_t if that might
428 be needed. */
429# if !(((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) \
430 || __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 1)) \
431 || (((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) \
432 && !defined __ANDROID__) \
433 || __clang_major__ >= 3)) \
434 && !defined __ibmxl__)
435/* We can't use GCC built-ins. Approximate spinlocks with mutexes. */
436# if !GNULIB_defined_pthread_spin_types
437# define pthread_spinlock_t pthread_mutex_t
438# define GNULIB_defined_pthread_spin_types 1
439# endif
440# endif
441# endif
442# else
443/* Approximate spinlocks with mutexes. */
444# if !GNULIB_defined_pthread_spin_types
445typedef pthread_mutex_t pthread_spinlock_t;
446# define GNULIB_defined_pthread_spin_types 1
447# endif
448# endif
449# if !@HAVE_PTHREAD_PROCESS_SHARED@
450# define PTHREAD_PROCESS_PRIVATE 0
451# define PTHREAD_PROCESS_SHARED 1
452# endif
453#endif
454
455/* =========== Other types and macros =========== */
456
457#if !@HAVE_PTHREAD_T@
458# if !GNULIB_defined_other_pthread_types
459typedef int pthread_barrier_t;
460typedef unsigned int pthread_barrierattr_t;
461# define GNULIB_defined_other_pthread_types 1
462# endif
463#endif
464
465#if !defined PTHREAD_CANCELED
466
467# define PTHREAD_BARRIER_SERIAL_THREAD (-1)
468
469# define PTHREAD_CANCEL_DEFERRED 0
470# define PTHREAD_CANCEL_ASYNCHRONOUS 1
471
472# define PTHREAD_CANCEL_ENABLE 0
473# define PTHREAD_CANCEL_DISABLE 1
474
475# define PTHREAD_CANCELED ((void *) -1)
476
477# define PTHREAD_INHERIT_SCHED 0
478# define PTHREAD_EXPLICIT_SCHED 1
479
480# define PTHREAD_PRIO_NONE 0
481# define PTHREAD_PRIO_INHERIT 1
482# define PTHREAD_PRIO_PROTECT 2
483
484# define PTHREAD_SCOPE_SYSTEM 0
485# define PTHREAD_SCOPE_PROCESS 1
486
487#endif
488
489/* =========== Thread functions =========== */
490
491#if @GNULIB_PTHREAD_THREAD@
492/* The 'restrict' qualifier on ARG is nonsense, but POSIX specifies it this way.
493 Sigh. */
494# if @REPLACE_PTHREAD_CREATE@
495# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
496# undef pthread_create
497# define pthread_create rpl_pthread_create
498# endif
499_GL_FUNCDECL_RPL (pthread_create, int,
500 (pthread_t *restrict threadp,
501 const pthread_attr_t *restrict attr,
502 void * (*mainfunc) (void *), void *restrict arg),
503 _GL_ARG_NONNULL ((1, 3)));
504_GL_CXXALIAS_RPL (pthread_create, int,
505 (pthread_t *restrict threadp,
506 const pthread_attr_t *restrict attr,
507 void * (*mainfunc) (void *), void *restrict arg));
508# else
509# if !@HAVE_PTHREAD_CREATE@
510_GL_FUNCDECL_SYS (pthread_create, int,
511 (pthread_t *restrict threadp,
512 const pthread_attr_t *restrict attr,
513 void * (*mainfunc) (void *), void *restrict arg),
514 _GL_ARG_NONNULL ((1, 3)));
515# endif
516_GL_CXXALIAS_SYS_CAST (pthread_create, int,
517 (pthread_t *restrict threadp,
518 const pthread_attr_t *restrict attr,
519 void * (*mainfunc) (void *), void *restrict arg));
520# endif
521# if __GLIBC__ >= 2
522_GL_CXXALIASWARN (pthread_create);
523# endif
524#elif defined GNULIB_POSIXCHECK
525# if HAVE_RAW_DECL_PTHREAD_CREATE
526_GL_WARN_ON_USE (pthread_create, "pthread_create is not portable - "
527 "use gnulib module pthread-thread for portability");
528# endif
529#endif
530
531#if @GNULIB_PTHREAD_THREAD@
532# if @REPLACE_PTHREAD_ATTR_INIT@
533# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
534# undef pthread_attr_init
535# define pthread_attr_init rpl_pthread_attr_init
536# endif
537_GL_FUNCDECL_RPL (pthread_attr_init, int, (pthread_attr_t *attr),
538 _GL_ARG_NONNULL ((1)));
539_GL_CXXALIAS_RPL (pthread_attr_init, int, (pthread_attr_t *attr));
540# else
541# if !@HAVE_PTHREAD_ATTR_INIT@
542_GL_FUNCDECL_SYS (pthread_attr_init, int, (pthread_attr_t *attr),
543 _GL_ARG_NONNULL ((1)));
544# endif
545_GL_CXXALIAS_SYS (pthread_attr_init, int, (pthread_attr_t *attr));
546# endif
547# if __GLIBC__ >= 2
548_GL_CXXALIASWARN (pthread_attr_init);
549# endif
550#elif defined GNULIB_POSIXCHECK
551# if HAVE_RAW_DECL_PTHREAD_ATTR_INIT
552_GL_WARN_ON_USE (pthread_attr_init, "pthread_attr_init is not portable - "
553 "use gnulib module pthread-thread for portability");
554# endif
555#endif
556
557#if @GNULIB_PTHREAD_THREAD@
558# if @REPLACE_PTHREAD_ATTR_GETDETACHSTATE@
559# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
560# undef pthread_attr_getdetachstate
561# define pthread_attr_getdetachstate rpl_pthread_attr_getdetachstate
562# endif
563_GL_FUNCDECL_RPL (pthread_attr_getdetachstate, int,
564 (const pthread_attr_t *attr, int *detachstatep),
565 _GL_ARG_NONNULL ((1, 2)));
566_GL_CXXALIAS_RPL (pthread_attr_getdetachstate, int,
567 (const pthread_attr_t *attr, int *detachstatep));
568# else
569# if !@HAVE_PTHREAD_ATTR_GETDETACHSTATE@
570_GL_FUNCDECL_SYS (pthread_attr_getdetachstate, int,
571 (const pthread_attr_t *attr, int *detachstatep),
572 _GL_ARG_NONNULL ((1, 2)));
573# endif
574_GL_CXXALIAS_SYS (pthread_attr_getdetachstate, int,
575 (const pthread_attr_t *attr, int *detachstatep));
576# endif
577# if __GLIBC__ >= 2
578_GL_CXXALIASWARN (pthread_attr_getdetachstate);
579# endif
580#elif defined GNULIB_POSIXCHECK
581# if HAVE_RAW_DECL_PTHREAD_ATTR_GETDETACHSTATE
582_GL_WARN_ON_USE (pthread_attr_getdetachstate, "pthread_attr_getdetachstate is not portable - "
583 "use gnulib module pthread-thread for portability");
584# endif
585#endif
586
587#if @GNULIB_PTHREAD_THREAD@
588# if @REPLACE_PTHREAD_ATTR_SETDETACHSTATE@
589# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
590# undef pthread_attr_setdetachstate
591# define pthread_attr_setdetachstate rpl_pthread_attr_setdetachstate
592# endif
593_GL_FUNCDECL_RPL (pthread_attr_setdetachstate, int,
594 (pthread_attr_t *attr, int detachstate),
595 _GL_ARG_NONNULL ((1)));
596_GL_CXXALIAS_RPL (pthread_attr_setdetachstate, int,
597 (pthread_attr_t *attr, int detachstate));
598# else
599# if !@HAVE_PTHREAD_ATTR_SETDETACHSTATE@
600_GL_FUNCDECL_SYS (pthread_attr_setdetachstate, int,
601 (pthread_attr_t *attr, int detachstate),
602 _GL_ARG_NONNULL ((1)));
603# endif
604_GL_CXXALIAS_SYS (pthread_attr_setdetachstate, int,
605 (pthread_attr_t *attr, int detachstate));
606# endif
607# if __GLIBC__ >= 2
608_GL_CXXALIASWARN (pthread_attr_setdetachstate);
609# endif
610#elif defined GNULIB_POSIXCHECK
611# if HAVE_RAW_DECL_PTHREAD_ATTR_SETDETACHSTATE
612_GL_WARN_ON_USE (pthread_attr_setdetachstate, "pthread_attr_setdetachstate is not portable - "
613 "use gnulib module pthread-thread for portability");
614# endif
615#endif
616
617#if @GNULIB_PTHREAD_THREAD@
618# if @REPLACE_PTHREAD_ATTR_DESTROY@
619# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
620# undef pthread_attr_destroy
621# define pthread_attr_destroy rpl_pthread_attr_destroy
622# endif
623_GL_FUNCDECL_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr),
624 _GL_ARG_NONNULL ((1)));
625_GL_CXXALIAS_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr));
626# else
627# if !@HAVE_PTHREAD_ATTR_DESTROY@
628_GL_FUNCDECL_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr),
629 _GL_ARG_NONNULL ((1)));
630# endif
631_GL_CXXALIAS_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr));
632# endif
633# if __GLIBC__ >= 2
634_GL_CXXALIASWARN (pthread_attr_destroy);
635# endif
636#elif defined GNULIB_POSIXCHECK
637# if HAVE_RAW_DECL_PTHREAD_ATTR_DESTROY
638_GL_WARN_ON_USE (pthread_attr_destroy, "pthread_attr_destroy is not portable - "
639 "use gnulib module pthread-thread for portability");
640# endif
641#endif
642
643#if @GNULIB_PTHREAD_THREAD@
644# if @REPLACE_PTHREAD_SELF@
645# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
646# undef pthread_self
647# define pthread_self rpl_pthread_self
648# endif
649_GL_FUNCDECL_RPL (pthread_self, pthread_t, (void), _GL_ATTRIBUTE_PURE);
650_GL_CXXALIAS_RPL (pthread_self, pthread_t, (void));
651# else
652# if !@HAVE_PTHREAD_SELF@
653_GL_FUNCDECL_SYS (pthread_self, pthread_t, (void), _GL_ATTRIBUTE_PURE);
654# endif
655_GL_CXXALIAS_SYS (pthread_self, pthread_t, (void));
656# endif
657# if __GLIBC__ >= 2
658_GL_CXXALIASWARN (pthread_self);
659# endif
660#elif defined GNULIB_POSIXCHECK
661# if HAVE_RAW_DECL_PTHREAD_SELF
662_GL_WARN_ON_USE (pthread_self, "pthread_self is not portable - "
663 "use gnulib module pthread-thread for portability");
664# endif
665#endif
666
667#if @GNULIB_PTHREAD_THREAD@
668# if @REPLACE_PTHREAD_EQUAL@
669# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
670# undef pthread_equal
671# define pthread_equal rpl_pthread_equal
672# endif
673_GL_FUNCDECL_RPL (pthread_equal, int, (pthread_t thread1, pthread_t thread2), );
674_GL_CXXALIAS_RPL (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
675# else
676# if !@HAVE_PTHREAD_EQUAL@
677_GL_FUNCDECL_SYS (pthread_equal, int, (pthread_t thread1, pthread_t thread2), );
678# endif
679_GL_CXXALIAS_SYS (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
680# endif
681# if __GLIBC__ >= 2
682_GL_CXXALIASWARN (pthread_equal);
683# endif
684#elif defined GNULIB_POSIXCHECK
685# if HAVE_RAW_DECL_PTHREAD_EQUAL
686_GL_WARN_ON_USE (pthread_equal, "pthread_equal is not portable - "
687 "use gnulib module pthread-thread for portability");
688# endif
689#endif
690
691#if @GNULIB_PTHREAD_THREAD@
692# if @REPLACE_PTHREAD_DETACH@
693# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
694# undef pthread_detach
695# define pthread_detach rpl_pthread_detach
696# endif
697_GL_FUNCDECL_RPL (pthread_detach, int, (pthread_t thread), );
698_GL_CXXALIAS_RPL (pthread_detach, int, (pthread_t thread));
699# else
700# if !@HAVE_PTHREAD_DETACH@
701_GL_FUNCDECL_SYS (pthread_detach, int, (pthread_t thread), );
702# endif
703_GL_CXXALIAS_SYS (pthread_detach, int, (pthread_t thread));
704# endif
705# if __GLIBC__ >= 2
706_GL_CXXALIASWARN (pthread_detach);
707# endif
708#elif defined GNULIB_POSIXCHECK
709# if HAVE_RAW_DECL_PTHREAD_DETACH
710_GL_WARN_ON_USE (pthread_detach, "pthread_detach is not portable - "
711 "use gnulib module pthread-thread for portability");
712# endif
713#endif
714
715#if @GNULIB_PTHREAD_THREAD@
716# if @REPLACE_PTHREAD_JOIN@
717# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
718# undef pthread_join
719# define pthread_join rpl_pthread_join
720# endif
721_GL_FUNCDECL_RPL (pthread_join, int, (pthread_t thread, void **valuep), );
722_GL_CXXALIAS_RPL (pthread_join, int, (pthread_t thread, void **valuep));
723# else
724# if !@HAVE_PTHREAD_JOIN@
725_GL_FUNCDECL_SYS (pthread_join, int, (pthread_t thread, void **valuep), );
726# endif
727_GL_CXXALIAS_SYS (pthread_join, int, (pthread_t thread, void **valuep));
728# endif
729# if __GLIBC__ >= 2
730_GL_CXXALIASWARN (pthread_join);
731# endif
732#elif defined GNULIB_POSIXCHECK
733# if HAVE_RAW_DECL_PTHREAD_JOIN
734_GL_WARN_ON_USE (pthread_join, "pthread_join is not portable - "
735 "use gnulib module pthread-thread for portability");
736# endif
737#endif
738
739#if @GNULIB_PTHREAD_THREAD@
740# if @REPLACE_PTHREAD_EXIT@
741# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
742# undef pthread_exit
743# define pthread_exit rpl_pthread_exit
744# endif
745_GL_FUNCDECL_RPL (pthread_exit, _Noreturn void, (void *value), );
746_GL_CXXALIAS_RPL (pthread_exit, void, (void *value));
747# else
748# if !@HAVE_PTHREAD_EXIT@
749_GL_FUNCDECL_SYS (pthread_exit, _Noreturn void, (void *value), );
750# endif
751/* Need to cast because of AIX with xlclang++. */
752_GL_CXXALIAS_SYS_CAST (pthread_exit, void, (void *value));
753# endif
754# if __GLIBC__ >= 2
755_GL_CXXALIASWARN (pthread_exit);
756# endif
757#elif defined GNULIB_POSIXCHECK
758# if HAVE_RAW_DECL_PTHREAD_EXIT
759_GL_WARN_ON_USE (pthread_exit, "pthread_exit is not portable - "
760 "use gnulib module pthread-thread for portability");
761# endif
762#endif
763
764/* =========== Once-only control (initialization) functions =========== */
765
766#if @GNULIB_PTHREAD_ONCE@
767# if @REPLACE_PTHREAD_ONCE@
768# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
769# undef pthread_once
770# define pthread_once rpl_pthread_once
771# endif
772_GL_FUNCDECL_RPL (pthread_once, int,
773 (pthread_once_t *once_control, void (*initfunction) (void)),
774 _GL_ARG_NONNULL ((1, 2)));
775_GL_CXXALIAS_RPL (pthread_once, int,
776 (pthread_once_t *once_control, void (*initfunction) (void)));
777# else
778# if !@HAVE_PTHREAD_ONCE@
779_GL_FUNCDECL_SYS (pthread_once, int,
780 (pthread_once_t *once_control, void (*initfunction) (void)),
781 _GL_ARG_NONNULL ((1, 2)));
782# endif
783_GL_CXXALIAS_SYS_CAST (pthread_once, int,
784 (pthread_once_t *once_control,
785 void (*initfunction) (void)));
786# endif
787# if __GLIBC__ >= 2
788_GL_CXXALIASWARN (pthread_once);
789# endif
790#elif defined GNULIB_POSIXCHECK
791# if HAVE_RAW_DECL_PTHREAD_ONCE
792_GL_WARN_ON_USE (pthread_once, "pthread_once is not portable - "
793 "use gnulib module pthread-once for portability");
794# endif
795#endif
796
797/* =========== Mutex functions =========== */
798
799#if @GNULIB_PTHREAD_MUTEX@
800# if @REPLACE_PTHREAD_MUTEX_INIT@
801# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
802# undef pthread_mutex_init
803# define pthread_mutex_init rpl_pthread_mutex_init
804# endif
805_GL_FUNCDECL_RPL (pthread_mutex_init, int,
806 (pthread_mutex_t *restrict mutex,
807 const pthread_mutexattr_t *restrict attr),
808 _GL_ARG_NONNULL ((1)));
809_GL_CXXALIAS_RPL (pthread_mutex_init, int,
810 (pthread_mutex_t *restrict mutex,
811 const pthread_mutexattr_t *restrict attr));
812# else
813# if !@HAVE_PTHREAD_MUTEX_INIT@
814_GL_FUNCDECL_SYS (pthread_mutex_init, int,
815 (pthread_mutex_t *restrict mutex,
816 const pthread_mutexattr_t *restrict attr),
817 _GL_ARG_NONNULL ((1)));
818# endif
819_GL_CXXALIAS_SYS (pthread_mutex_init, int,
820 (pthread_mutex_t *restrict mutex,
821 const pthread_mutexattr_t *restrict attr));
822# endif
823# if __GLIBC__ >= 2
824_GL_CXXALIASWARN (pthread_mutex_init);
825# endif
826#elif defined GNULIB_POSIXCHECK
827# if HAVE_RAW_DECL_PTHREAD_MUTEX_INIT
828_GL_WARN_ON_USE (pthread_mutex_init, "pthread_mutex_init is not portable - "
829 "use gnulib module pthread-mutex for portability");
830# endif
831#endif
832
833#if @GNULIB_PTHREAD_MUTEX@
834# if @REPLACE_PTHREAD_MUTEXATTR_INIT@
835# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
836# undef pthread_mutexattr_init
837# define pthread_mutexattr_init rpl_pthread_mutexattr_init
838# endif
839_GL_FUNCDECL_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr),
840 _GL_ARG_NONNULL ((1)));
841_GL_CXXALIAS_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr));
842# else
843# if !@HAVE_PTHREAD_MUTEXATTR_INIT@
844_GL_FUNCDECL_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr),
845 _GL_ARG_NONNULL ((1)));
846# endif
847_GL_CXXALIAS_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr));
848# endif
849# if __GLIBC__ >= 2
850_GL_CXXALIASWARN (pthread_mutexattr_init);
851# endif
852#elif defined GNULIB_POSIXCHECK
853# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_INIT
854_GL_WARN_ON_USE (pthread_mutexattr_init, "pthread_mutexattr_init is not portable - "
855 "use gnulib module pthread-mutex for portability");
856# endif
857#endif
858
859#if @GNULIB_PTHREAD_MUTEX@
860# if @REPLACE_PTHREAD_MUTEXATTR_GETTYPE@
861# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
862# undef pthread_mutexattr_gettype
863# define pthread_mutexattr_gettype rpl_pthread_mutexattr_gettype
864# endif
865_GL_FUNCDECL_RPL (pthread_mutexattr_gettype, int,
866 (const pthread_mutexattr_t *restrict attr,
867 int *restrict typep),
868 _GL_ARG_NONNULL ((1, 2)));
869_GL_CXXALIAS_RPL (pthread_mutexattr_gettype, int,
870 (const pthread_mutexattr_t *restrict attr,
871 int *restrict typep));
872# else
873# if !@HAVE_PTHREAD_MUTEXATTR_GETTYPE@
874_GL_FUNCDECL_SYS (pthread_mutexattr_gettype, int,
875 (const pthread_mutexattr_t *restrict attr,
876 int *restrict typep),
877 _GL_ARG_NONNULL ((1, 2)));
878# endif
879/* Need to cast, because on FreeBSD the first parameter is
880 pthread_mutexattr_t *attr. */
881_GL_CXXALIAS_SYS_CAST (pthread_mutexattr_gettype, int,
882 (const pthread_mutexattr_t *restrict attr,
883 int *restrict typep));
884# endif
885# if __GLIBC__ >= 2
886_GL_CXXALIASWARN (pthread_mutexattr_gettype);
887# endif
888#elif defined GNULIB_POSIXCHECK
889# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETTYPE
890_GL_WARN_ON_USE (pthread_mutexattr_gettype, "pthread_mutexattr_gettype is not portable - "
891 "use gnulib module pthread-mutex for portability");
892# endif
893#endif
894
895#if @GNULIB_PTHREAD_MUTEX@
896# if @REPLACE_PTHREAD_MUTEXATTR_SETTYPE@
897# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
898# undef pthread_mutexattr_settype
899# define pthread_mutexattr_settype rpl_pthread_mutexattr_settype
900# endif
901_GL_FUNCDECL_RPL (pthread_mutexattr_settype, int,
902 (pthread_mutexattr_t *attr, int type), _GL_ARG_NONNULL ((1)));
903_GL_CXXALIAS_RPL (pthread_mutexattr_settype, int,
904 (pthread_mutexattr_t *attr, int type));
905# else
906# if !@HAVE_PTHREAD_MUTEXATTR_SETTYPE@
907_GL_FUNCDECL_SYS (pthread_mutexattr_settype, int,
908 (pthread_mutexattr_t *attr, int type), _GL_ARG_NONNULL ((1)));
909# endif
910_GL_CXXALIAS_SYS (pthread_mutexattr_settype, int,
911 (pthread_mutexattr_t *attr, int type));
912# endif
913# if __GLIBC__ >= 2
914_GL_CXXALIASWARN (pthread_mutexattr_settype);
915# endif
916#elif defined GNULIB_POSIXCHECK
917# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETTYPE
918_GL_WARN_ON_USE (pthread_mutexattr_settype, "pthread_mutexattr_settype is not portable - "
919 "use gnulib module pthread-mutex for portability");
920# endif
921#endif
922
923#if @GNULIB_PTHREAD_MUTEX@
924# if @REPLACE_PTHREAD_MUTEXATTR_GETROBUST@
925# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
926# undef pthread_mutexattr_getrobust
927# define pthread_mutexattr_getrobust rpl_pthread_mutexattr_getrobust
928# endif
929_GL_FUNCDECL_RPL (pthread_mutexattr_getrobust, int,
930 (const pthread_mutexattr_t *restrict attr,
931 int *restrict robustp),
932 _GL_ARG_NONNULL ((1, 2)));
933_GL_CXXALIAS_RPL (pthread_mutexattr_getrobust, int,
934 (const pthread_mutexattr_t *restrict attr,
935 int *restrict robustp));
936# else
937# if !@HAVE_PTHREAD_MUTEXATTR_GETROBUST@
938_GL_FUNCDECL_SYS (pthread_mutexattr_getrobust, int,
939 (const pthread_mutexattr_t *restrict attr,
940 int *restrict robustp),
941 _GL_ARG_NONNULL ((1, 2)));
942# endif
943/* Need to cast, because on FreeBSD the first parameter is
944 pthread_mutexattr_t *attr. */
945_GL_CXXALIAS_SYS_CAST (pthread_mutexattr_getrobust, int,
946 (const pthread_mutexattr_t *restrict attr,
947 int *restrict robustp));
948# endif
949# if __GLIBC__ >= 2
950_GL_CXXALIASWARN (pthread_mutexattr_getrobust);
951# endif
952#elif defined GNULIB_POSIXCHECK
953# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETROBUST
954_GL_WARN_ON_USE (pthread_mutexattr_getrobust, "pthread_mutexattr_getrobust is not portable - "
955 "use gnulib module pthread-mutex for portability");
956# endif
957#endif
958
959#if @GNULIB_PTHREAD_MUTEX@
960# if @REPLACE_PTHREAD_MUTEXATTR_SETROBUST@
961# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
962# undef pthread_mutexattr_setrobust
963# define pthread_mutexattr_setrobust rpl_pthread_mutexattr_setrobust
964# endif
965_GL_FUNCDECL_RPL (pthread_mutexattr_setrobust, int,
966 (pthread_mutexattr_t *attr, int robust),
967 _GL_ARG_NONNULL ((1)));
968_GL_CXXALIAS_RPL (pthread_mutexattr_setrobust, int,
969 (pthread_mutexattr_t *attr, int robust));
970# else
971# if !@HAVE_PTHREAD_MUTEXATTR_SETROBUST@
972_GL_FUNCDECL_SYS (pthread_mutexattr_setrobust, int,
973 (pthread_mutexattr_t *attr, int robust),
974 _GL_ARG_NONNULL ((1)));
975# endif
976_GL_CXXALIAS_SYS (pthread_mutexattr_setrobust, int,
977 (pthread_mutexattr_t *attr, int robust));
978# endif
979# if __GLIBC__ >= 2
980_GL_CXXALIASWARN (pthread_mutexattr_setrobust);
981# endif
982#elif defined GNULIB_POSIXCHECK
983# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETROBUST
984_GL_WARN_ON_USE (pthread_mutexattr_setrobust, "pthread_mutexattr_setrobust is not portable - "
985 "use gnulib module pthread-mutex for portability");
986# endif
987#endif
988
989#if @GNULIB_PTHREAD_MUTEX@
990# if @REPLACE_PTHREAD_MUTEXATTR_DESTROY@
991# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
992# undef pthread_mutexattr_destroy
993# define pthread_mutexattr_destroy rpl_pthread_mutexattr_destroy
994# endif
995_GL_FUNCDECL_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr),
996 _GL_ARG_NONNULL ((1)));
997_GL_CXXALIAS_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr));
998# else
999# if !@HAVE_PTHREAD_MUTEXATTR_DESTROY@
1000_GL_FUNCDECL_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr),
1001 _GL_ARG_NONNULL ((1)));
1002# endif
1003_GL_CXXALIAS_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr));
1004# endif
1005# if __GLIBC__ >= 2
1006_GL_CXXALIASWARN (pthread_mutexattr_destroy);
1007# endif
1008#elif defined GNULIB_POSIXCHECK
1009# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_DESTROY
1010_GL_WARN_ON_USE (pthread_mutexattr_destroy, "pthread_mutexattr_destroy is not portable - "
1011 "use gnulib module pthread-mutex for portability");
1012# endif
1013#endif
1014
1015#if @GNULIB_PTHREAD_MUTEX@
1016# if @REPLACE_PTHREAD_MUTEX_LOCK@
1017# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1018# undef pthread_mutex_lock
1019# define pthread_mutex_lock rpl_pthread_mutex_lock
1020# endif
1021_GL_FUNCDECL_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex),
1022 _GL_ARG_NONNULL ((1)));
1023_GL_CXXALIAS_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex));
1024# else
1025# if !@HAVE_PTHREAD_MUTEX_LOCK@
1026_GL_FUNCDECL_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex),
1027 _GL_ARG_NONNULL ((1)));
1028# endif
1029_GL_CXXALIAS_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex));
1030# endif
1031# if __GLIBC__ >= 2
1032_GL_CXXALIASWARN (pthread_mutex_lock);
1033# endif
1034#elif defined GNULIB_POSIXCHECK
1035# if HAVE_RAW_DECL_PTHREAD_MUTEX_LOCK
1036_GL_WARN_ON_USE (pthread_mutex_lock, "pthread_mutex_lock is not portable - "
1037 "use gnulib module pthread-mutex for portability");
1038# endif
1039#endif
1040
1041#if @GNULIB_PTHREAD_MUTEX@
1042# if @REPLACE_PTHREAD_MUTEX_TRYLOCK@
1043# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1044# undef pthread_mutex_trylock
1045# define pthread_mutex_trylock rpl_pthread_mutex_trylock
1046# endif
1047_GL_FUNCDECL_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex),
1048 _GL_ARG_NONNULL ((1)));
1049_GL_CXXALIAS_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex));
1050# else
1051# if !@HAVE_PTHREAD_MUTEX_TRYLOCK@
1052_GL_FUNCDECL_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex),
1053 _GL_ARG_NONNULL ((1)));
1054# endif
1055_GL_CXXALIAS_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex));
1056# endif
1057# if __GLIBC__ >= 2
1058_GL_CXXALIASWARN (pthread_mutex_trylock);
1059# endif
1060#elif defined GNULIB_POSIXCHECK
1061# if HAVE_RAW_DECL_PTHREAD_MUTEX_TRYLOCK
1062_GL_WARN_ON_USE (pthread_mutex_trylock, "pthread_mutex_trylock is not portable - "
1063 "use gnulib module pthread-mutex for portability");
1064# endif
1065#endif
1066
1067#if @GNULIB_PTHREAD_MUTEX_TIMEDLOCK@
1068# if @REPLACE_PTHREAD_MUTEX_TIMEDLOCK@
1069# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1070# undef pthread_mutex_timedlock
1071# define pthread_mutex_timedlock rpl_pthread_mutex_timedlock
1072# endif
1073_GL_FUNCDECL_RPL (pthread_mutex_timedlock, int,
1074 (pthread_mutex_t *restrict mutex,
1075 const struct timespec *restrict abstime),
1076 _GL_ARG_NONNULL ((1, 2)));
1077_GL_CXXALIAS_RPL (pthread_mutex_timedlock, int,
1078 (pthread_mutex_t *restrict mutex,
1079 const struct timespec *restrict abstime));
1080# else
1081# if !@HAVE_PTHREAD_MUTEX_TIMEDLOCK@
1082_GL_FUNCDECL_SYS (pthread_mutex_timedlock, int,
1083 (pthread_mutex_t *restrict mutex,
1084 const struct timespec *restrict abstime),
1085 _GL_ARG_NONNULL ((1, 2)));
1086# endif
1087_GL_CXXALIAS_SYS (pthread_mutex_timedlock, int,
1088 (pthread_mutex_t *restrict mutex,
1089 const struct timespec *restrict abstime));
1090# endif
1091# if __GLIBC__ >= 2
1092_GL_CXXALIASWARN (pthread_mutex_timedlock);
1093# endif
1094#elif defined GNULIB_POSIXCHECK
1095# if HAVE_RAW_DECL_PTHREAD_MUTEX_TIMEDLOCK
1096_GL_WARN_ON_USE (pthread_mutex_timedlock, "pthread_mutex_timedlock is not portable - "
1097 "use gnulib module pthread_mutex_timedlock for portability");
1098# endif
1099#endif
1100
1101#if @GNULIB_PTHREAD_MUTEX@
1102# if @REPLACE_PTHREAD_MUTEX_UNLOCK@
1103# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1104# undef pthread_mutex_unlock
1105# define pthread_mutex_unlock rpl_pthread_mutex_unlock
1106# endif
1107_GL_FUNCDECL_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex),
1108 _GL_ARG_NONNULL ((1)));
1109_GL_CXXALIAS_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex));
1110# else
1111# if !@HAVE_PTHREAD_MUTEX_UNLOCK@
1112_GL_FUNCDECL_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex),
1113 _GL_ARG_NONNULL ((1)));
1114# endif
1115_GL_CXXALIAS_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex));
1116# endif
1117# if __GLIBC__ >= 2
1118_GL_CXXALIASWARN (pthread_mutex_unlock);
1119# endif
1120#elif defined GNULIB_POSIXCHECK
1121# if HAVE_RAW_DECL_PTHREAD_MUTEX_UNLOCK
1122_GL_WARN_ON_USE (pthread_mutex_unlock, "pthread_mutex_unlock is not portable - "
1123 "use gnulib module pthread-mutex for portability");
1124# endif
1125#endif
1126
1127#if @GNULIB_PTHREAD_MUTEX@
1128# if @REPLACE_PTHREAD_MUTEX_DESTROY@
1129# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1130# undef pthread_mutex_destroy
1131# define pthread_mutex_destroy rpl_pthread_mutex_destroy
1132# endif
1133_GL_FUNCDECL_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex),
1134 _GL_ARG_NONNULL ((1)));
1135_GL_CXXALIAS_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex));
1136# else
1137# if !@HAVE_PTHREAD_MUTEX_DESTROY@
1138_GL_FUNCDECL_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex),
1139 _GL_ARG_NONNULL ((1)));
1140# endif
1141_GL_CXXALIAS_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex));
1142# endif
1143# if __GLIBC__ >= 2
1144_GL_CXXALIASWARN (pthread_mutex_destroy);
1145# endif
1146#elif defined GNULIB_POSIXCHECK
1147# if HAVE_RAW_DECL_PTHREAD_MUTEX_DESTROY
1148_GL_WARN_ON_USE (pthread_mutex_destroy, "pthread_mutex_destroy is not portable - "
1149 "use gnulib module pthread-mutex for portability");
1150# endif
1151#endif
1152
1153/* =========== Read-write lock functions =========== */
1154
1155#if @GNULIB_PTHREAD_RWLOCK@
1156# if @REPLACE_PTHREAD_RWLOCK_INIT@
1157# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1158# undef pthread_rwlock_init
1159# define pthread_rwlock_init rpl_pthread_rwlock_init
1160# endif
1161_GL_FUNCDECL_RPL (pthread_rwlock_init, int,
1162 (pthread_rwlock_t *restrict lock,
1163 const pthread_rwlockattr_t *restrict attr),
1164 _GL_ARG_NONNULL ((1)));
1165_GL_CXXALIAS_RPL (pthread_rwlock_init, int,
1166 (pthread_rwlock_t *restrict lock,
1167 const pthread_rwlockattr_t *restrict attr));
1168# else
1169# if !@HAVE_PTHREAD_RWLOCK_INIT@
1170_GL_FUNCDECL_SYS (pthread_rwlock_init, int,
1171 (pthread_rwlock_t *restrict lock,
1172 const pthread_rwlockattr_t *restrict attr),
1173 _GL_ARG_NONNULL ((1)));
1174# endif
1175_GL_CXXALIAS_SYS (pthread_rwlock_init, int,
1176 (pthread_rwlock_t *restrict lock,
1177 const pthread_rwlockattr_t *restrict attr));
1178# endif
1179# if __GLIBC__ >= 2
1180_GL_CXXALIASWARN (pthread_rwlock_init);
1181# endif
1182#elif defined GNULIB_POSIXCHECK
1183# if HAVE_RAW_DECL_PTHREAD_RWLOCK_INIT
1184_GL_WARN_ON_USE (pthread_rwlock_init, "pthread_rwlock_init is not portable - "
1185 "use gnulib module pthread-rwlock for portability");
1186# endif
1187#endif
1188
1189#if @GNULIB_PTHREAD_RWLOCK@
1190# if @REPLACE_PTHREAD_RWLOCKATTR_INIT@
1191# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1192# undef pthread_rwlockattr_init
1193# define pthread_rwlockattr_init rpl_pthread_rwlockattr_init
1194# endif
1195_GL_FUNCDECL_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr),
1196 _GL_ARG_NONNULL ((1)));
1197_GL_CXXALIAS_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr));
1198# else
1199# if !@HAVE_PTHREAD_RWLOCKATTR_INIT@
1200_GL_FUNCDECL_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr),
1201 _GL_ARG_NONNULL ((1)));
1202# endif
1203_GL_CXXALIAS_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr));
1204# endif
1205# if __GLIBC__ >= 2
1206_GL_CXXALIASWARN (pthread_rwlockattr_init);
1207# endif
1208#elif defined GNULIB_POSIXCHECK
1209# if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_INIT
1210_GL_WARN_ON_USE (pthread_rwlockattr_init, "pthread_rwlockattr_init is not portable - "
1211 "use gnulib module pthread-rwlock for portability");
1212# endif
1213#endif
1214
1215#if @GNULIB_PTHREAD_RWLOCK@
1216# if @REPLACE_PTHREAD_RWLOCKATTR_DESTROY@
1217# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1218# undef pthread_rwlockattr_destroy
1219# define pthread_rwlockattr_destroy rpl_pthread_rwlockattr_destroy
1220# endif
1221_GL_FUNCDECL_RPL (pthread_rwlockattr_destroy, int,
1222 (pthread_rwlockattr_t *attr), _GL_ARG_NONNULL ((1)));
1223_GL_CXXALIAS_RPL (pthread_rwlockattr_destroy, int,
1224 (pthread_rwlockattr_t *attr));
1225# else
1226# if !@HAVE_PTHREAD_RWLOCKATTR_DESTROY@
1227_GL_FUNCDECL_SYS (pthread_rwlockattr_destroy, int,
1228 (pthread_rwlockattr_t *attr), _GL_ARG_NONNULL ((1)));
1229# endif
1230_GL_CXXALIAS_SYS (pthread_rwlockattr_destroy, int,
1231 (pthread_rwlockattr_t *attr));
1232# endif
1233# if __GLIBC__ >= 2
1234_GL_CXXALIASWARN (pthread_rwlockattr_destroy);
1235# endif
1236#elif defined GNULIB_POSIXCHECK
1237# if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_DESTROY
1238_GL_WARN_ON_USE (pthread_rwlockattr_destroy, "pthread_rwlockattr_destroy is not portable - "
1239 "use gnulib module pthread-rwlock for portability");
1240# endif
1241#endif
1242
1243#if @GNULIB_PTHREAD_RWLOCK@
1244# if @REPLACE_PTHREAD_RWLOCK_RDLOCK@
1245# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1246# undef pthread_rwlock_rdlock
1247# define pthread_rwlock_rdlock rpl_pthread_rwlock_rdlock
1248# endif
1249_GL_FUNCDECL_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock),
1250 _GL_ARG_NONNULL ((1)));
1251_GL_CXXALIAS_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock));
1252# else
1253# if !@HAVE_PTHREAD_RWLOCK_RDLOCK@
1254_GL_FUNCDECL_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock),
1255 _GL_ARG_NONNULL ((1)));
1256# endif
1257_GL_CXXALIAS_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock));
1258# endif
1259# if __GLIBC__ >= 2
1260_GL_CXXALIASWARN (pthread_rwlock_rdlock);
1261# endif
1262#elif defined GNULIB_POSIXCHECK
1263# if HAVE_RAW_DECL_PTHREAD_RWLOCK_RDLOCK
1264_GL_WARN_ON_USE (pthread_rwlock_rdlock, "pthread_rwlock_rdlock is not portable - "
1265 "use gnulib module pthread-rwlock for portability");
1266# endif
1267#endif
1268
1269#if @GNULIB_PTHREAD_RWLOCK@
1270# if @REPLACE_PTHREAD_RWLOCK_WRLOCK@
1271# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1272# undef pthread_rwlock_wrlock
1273# define pthread_rwlock_wrlock rpl_pthread_rwlock_wrlock
1274# endif
1275_GL_FUNCDECL_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock),
1276 _GL_ARG_NONNULL ((1)));
1277_GL_CXXALIAS_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock));
1278# else
1279# if !@HAVE_PTHREAD_RWLOCK_WRLOCK@
1280_GL_FUNCDECL_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock),
1281 _GL_ARG_NONNULL ((1)));
1282# endif
1283_GL_CXXALIAS_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock));
1284# endif
1285# if __GLIBC__ >= 2
1286_GL_CXXALIASWARN (pthread_rwlock_wrlock);
1287# endif
1288#elif defined GNULIB_POSIXCHECK
1289# if HAVE_RAW_DECL_PTHREAD_RWLOCK_WRLOCK
1290_GL_WARN_ON_USE (pthread_rwlock_wrlock, "pthread_rwlock_wrlock is not portable - "
1291 "use gnulib module pthread-rwlock for portability");
1292# endif
1293#endif
1294
1295#if @GNULIB_PTHREAD_RWLOCK@
1296# if @REPLACE_PTHREAD_RWLOCK_TRYRDLOCK@
1297# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1298# undef pthread_rwlock_tryrdlock
1299# define pthread_rwlock_tryrdlock rpl_pthread_rwlock_tryrdlock
1300# endif
1301_GL_FUNCDECL_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock),
1302 _GL_ARG_NONNULL ((1)));
1303_GL_CXXALIAS_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock));
1304# else
1305# if !@HAVE_PTHREAD_RWLOCK_TRYRDLOCK@
1306_GL_FUNCDECL_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock),
1307 _GL_ARG_NONNULL ((1)));
1308# endif
1309_GL_CXXALIAS_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock));
1310# endif
1311# if __GLIBC__ >= 2
1312_GL_CXXALIASWARN (pthread_rwlock_tryrdlock);
1313# endif
1314#elif defined GNULIB_POSIXCHECK
1315# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYRDLOCK
1316_GL_WARN_ON_USE (pthread_rwlock_tryrdlock, "pthread_rwlock_tryrdlock is not portable - "
1317 "use gnulib module pthread-rwlock for portability");
1318# endif
1319#endif
1320
1321#if @GNULIB_PTHREAD_RWLOCK@
1322# if @REPLACE_PTHREAD_RWLOCK_TRYWRLOCK@
1323# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1324# undef pthread_rwlock_trywrlock
1325# define pthread_rwlock_trywrlock rpl_pthread_rwlock_trywrlock
1326# endif
1327_GL_FUNCDECL_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock),
1328 _GL_ARG_NONNULL ((1)));
1329_GL_CXXALIAS_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock));
1330# else
1331# if !@HAVE_PTHREAD_RWLOCK_TRYWRLOCK@
1332_GL_FUNCDECL_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock),
1333 _GL_ARG_NONNULL ((1)));
1334# endif
1335_GL_CXXALIAS_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock));
1336# endif
1337# if __GLIBC__ >= 2
1338_GL_CXXALIASWARN (pthread_rwlock_trywrlock);
1339# endif
1340#elif defined GNULIB_POSIXCHECK
1341# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYWRLOCK
1342_GL_WARN_ON_USE (pthread_rwlock_trywrlock, "pthread_rwlock_trywrlock is not portable - "
1343 "use gnulib module pthread-rwlock for portability");
1344# endif
1345#endif
1346
1347#if @GNULIB_PTHREAD_RWLOCK@
1348# if @REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK@
1349# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1350# undef pthread_rwlock_timedrdlock
1351# define pthread_rwlock_timedrdlock rpl_pthread_rwlock_timedrdlock
1352# endif
1353_GL_FUNCDECL_RPL (pthread_rwlock_timedrdlock, int,
1354 (pthread_rwlock_t *restrict lock,
1355 const struct timespec *restrict abstime),
1356 _GL_ARG_NONNULL ((1, 2)));
1357_GL_CXXALIAS_RPL (pthread_rwlock_timedrdlock, int,
1358 (pthread_rwlock_t *restrict lock,
1359 const struct timespec *restrict abstime));
1360# else
1361# if !@HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK@
1362_GL_FUNCDECL_SYS (pthread_rwlock_timedrdlock, int,
1363 (pthread_rwlock_t *restrict lock,
1364 const struct timespec *restrict abstime),
1365 _GL_ARG_NONNULL ((1, 2)));
1366# endif
1367_GL_CXXALIAS_SYS (pthread_rwlock_timedrdlock, int,
1368 (pthread_rwlock_t *restrict lock,
1369 const struct timespec *restrict abstime));
1370# endif
1371# if __GLIBC__ >= 2
1372_GL_CXXALIASWARN (pthread_rwlock_timedrdlock);
1373# endif
1374#elif defined GNULIB_POSIXCHECK
1375# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDRDLOCK
1376_GL_WARN_ON_USE (pthread_rwlock_timedrdlock, "pthread_rwlock_timedrdlock is not portable - "
1377 "use gnulib module pthread-rwlock for portability");
1378# endif
1379#endif
1380
1381#if @GNULIB_PTHREAD_RWLOCK@
1382# if @REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK@
1383# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1384# undef pthread_rwlock_timedwrlock
1385# define pthread_rwlock_timedwrlock rpl_pthread_rwlock_timedwrlock
1386# endif
1387_GL_FUNCDECL_RPL (pthread_rwlock_timedwrlock, int,
1388 (pthread_rwlock_t *restrict lock,
1389 const struct timespec *restrict abstime),
1390 _GL_ARG_NONNULL ((1, 2)));
1391_GL_CXXALIAS_RPL (pthread_rwlock_timedwrlock, int,
1392 (pthread_rwlock_t *restrict lock,
1393 const struct timespec *restrict abstime));
1394# else
1395# if !@HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK@
1396_GL_FUNCDECL_SYS (pthread_rwlock_timedwrlock, int,
1397 (pthread_rwlock_t *restrict lock,
1398 const struct timespec *restrict abstime),
1399 _GL_ARG_NONNULL ((1, 2)));
1400# endif
1401_GL_CXXALIAS_SYS (pthread_rwlock_timedwrlock, int,
1402 (pthread_rwlock_t *restrict lock,
1403 const struct timespec *restrict abstime));
1404# endif
1405# if __GLIBC__ >= 2
1406_GL_CXXALIASWARN (pthread_rwlock_timedwrlock);
1407# endif
1408#elif defined GNULIB_POSIXCHECK
1409# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDWRLOCK
1410_GL_WARN_ON_USE (pthread_rwlock_timedwrlock, "pthread_rwlock_timedwrlock is not portable - "
1411 "use gnulib module pthread-rwlock for portability");
1412# endif
1413#endif
1414
1415#if @GNULIB_PTHREAD_RWLOCK@
1416# if @REPLACE_PTHREAD_RWLOCK_UNLOCK@
1417# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1418# undef pthread_rwlock_unlock
1419# define pthread_rwlock_unlock rpl_pthread_rwlock_unlock
1420# endif
1421_GL_FUNCDECL_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock),
1422 _GL_ARG_NONNULL ((1)));
1423_GL_CXXALIAS_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock));
1424# else
1425# if !@HAVE_PTHREAD_RWLOCK_UNLOCK@
1426_GL_FUNCDECL_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock),
1427 _GL_ARG_NONNULL ((1)));
1428# endif
1429_GL_CXXALIAS_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock));
1430# endif
1431# if __GLIBC__ >= 2
1432_GL_CXXALIASWARN (pthread_rwlock_unlock);
1433# endif
1434#elif defined GNULIB_POSIXCHECK
1435# if HAVE_RAW_DECL_PTHREAD_RWLOCK_UNLOCK
1436_GL_WARN_ON_USE (pthread_rwlock_unlock, "pthread_rwlock_unlock is not portable - "
1437 "use gnulib module pthread-rwlock for portability");
1438# endif
1439#endif
1440
1441#if @GNULIB_PTHREAD_RWLOCK@
1442# if @REPLACE_PTHREAD_RWLOCK_DESTROY@
1443# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1444# undef pthread_rwlock_destroy
1445# define pthread_rwlock_destroy rpl_pthread_rwlock_destroy
1446# endif
1447_GL_FUNCDECL_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock),
1448 _GL_ARG_NONNULL ((1)));
1449_GL_CXXALIAS_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock));
1450# else
1451# if !@HAVE_PTHREAD_RWLOCK_DESTROY@
1452_GL_FUNCDECL_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock),
1453 _GL_ARG_NONNULL ((1)));
1454# endif
1455_GL_CXXALIAS_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock));
1456# endif
1457# if __GLIBC__ >= 2
1458_GL_CXXALIASWARN (pthread_rwlock_destroy);
1459# endif
1460#elif defined GNULIB_POSIXCHECK
1461# if HAVE_RAW_DECL_PTHREAD_RWLOCK_DESTROY
1462_GL_WARN_ON_USE (pthread_rwlock_destroy, "pthread_rwlock_destroy is not portable - "
1463 "use gnulib module pthread-rwlock for portability");
1464# endif
1465#endif
1466
1467/* =========== Condition variable functions =========== */
1468
1469#if @GNULIB_PTHREAD_COND@
1470# if @REPLACE_PTHREAD_COND_INIT@
1471# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1472# undef pthread_cond_init
1473# define pthread_cond_init rpl_pthread_cond_init
1474# endif
1475_GL_FUNCDECL_RPL (pthread_cond_init, int,
1476 (pthread_cond_t *restrict cond,
1477 const pthread_condattr_t *restrict attr),
1478 _GL_ARG_NONNULL ((1)));
1479_GL_CXXALIAS_RPL (pthread_cond_init, int,
1480 (pthread_cond_t *restrict cond,
1481 const pthread_condattr_t *restrict attr));
1482# else
1483# if !@HAVE_PTHREAD_COND_INIT@
1484_GL_FUNCDECL_SYS (pthread_cond_init, int,
1485 (pthread_cond_t *restrict cond,
1486 const pthread_condattr_t *restrict attr),
1487 _GL_ARG_NONNULL ((1)));
1488# endif
1489_GL_CXXALIAS_SYS (pthread_cond_init, int,
1490 (pthread_cond_t *restrict cond,
1491 const pthread_condattr_t *restrict attr));
1492# endif
1493# if __GLIBC__ >= 2
1494_GL_CXXALIASWARN (pthread_cond_init);
1495# endif
1496#elif defined GNULIB_POSIXCHECK
1497# if HAVE_RAW_DECL_PTHREAD_COND_INIT
1498_GL_WARN_ON_USE (pthread_cond_init, "pthread_cond_init is not portable - "
1499 "use gnulib module pthread-cond for portability");
1500# endif
1501#endif
1502
1503#if @GNULIB_PTHREAD_COND@
1504# if @REPLACE_PTHREAD_CONDATTR_INIT@
1505# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1506# undef pthread_condattr_init
1507# define pthread_condattr_init rpl_pthread_condattr_init
1508# endif
1509_GL_FUNCDECL_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr),
1510 _GL_ARG_NONNULL ((1)));
1511_GL_CXXALIAS_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr));
1512# else
1513# if !@HAVE_PTHREAD_CONDATTR_INIT@
1514_GL_FUNCDECL_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr),
1515 _GL_ARG_NONNULL ((1)));
1516# endif
1517_GL_CXXALIAS_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr));
1518# endif
1519# if __GLIBC__ >= 2
1520_GL_CXXALIASWARN (pthread_condattr_init);
1521# endif
1522#elif defined GNULIB_POSIXCHECK
1523# if HAVE_RAW_DECL_PTHREAD_CONDATTR_INIT
1524_GL_WARN_ON_USE (pthread_condattr_init, "pthread_condattr_init is not portable - "
1525 "use gnulib module pthread-cond for portability");
1526# endif
1527#endif
1528
1529#if @GNULIB_PTHREAD_COND@
1530# if @REPLACE_PTHREAD_CONDATTR_DESTROY@
1531# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1532# undef pthread_condattr_destroy
1533# define pthread_condattr_destroy rpl_pthread_condattr_destroy
1534# endif
1535_GL_FUNCDECL_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr),
1536 _GL_ARG_NONNULL ((1)));
1537_GL_CXXALIAS_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr));
1538# else
1539# if !@HAVE_PTHREAD_CONDATTR_DESTROY@
1540_GL_FUNCDECL_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr),
1541 _GL_ARG_NONNULL ((1)));
1542# endif
1543_GL_CXXALIAS_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr));
1544# endif
1545# if __GLIBC__ >= 2
1546_GL_CXXALIASWARN (pthread_condattr_destroy);
1547# endif
1548#elif defined GNULIB_POSIXCHECK
1549# if HAVE_RAW_DECL_PTHREAD_CONDATTR_DESTROY
1550_GL_WARN_ON_USE (pthread_condattr_destroy, "pthread_condattr_destroy is not portable - "
1551 "use gnulib module pthread-cond for portability");
1552# endif
1553#endif
1554
1555#if @GNULIB_PTHREAD_COND@
1556# if @REPLACE_PTHREAD_COND_WAIT@
1557# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1558# undef pthread_cond_wait
1559# define pthread_cond_wait rpl_pthread_cond_wait
1560# endif
1561_GL_FUNCDECL_RPL (pthread_cond_wait, int,
1562 (pthread_cond_t *restrict cond,
1563 pthread_mutex_t *restrict mutex),
1564 _GL_ARG_NONNULL ((1, 2)));
1565_GL_CXXALIAS_RPL (pthread_cond_wait, int,
1566 (pthread_cond_t *restrict cond,
1567 pthread_mutex_t *restrict mutex));
1568# else
1569# if !@HAVE_PTHREAD_COND_WAIT@
1570_GL_FUNCDECL_SYS (pthread_cond_wait, int,
1571 (pthread_cond_t *restrict cond,
1572 pthread_mutex_t *restrict mutex),
1573 _GL_ARG_NONNULL ((1, 2)));
1574# endif
1575_GL_CXXALIAS_SYS (pthread_cond_wait, int,
1576 (pthread_cond_t *restrict cond,
1577 pthread_mutex_t *restrict mutex));
1578# endif
1579# if __GLIBC__ >= 2
1580_GL_CXXALIASWARN (pthread_cond_wait);
1581# endif
1582#elif defined GNULIB_POSIXCHECK
1583# if HAVE_RAW_DECL_PTHREAD_COND_WAIT
1584_GL_WARN_ON_USE (pthread_cond_wait, "pthread_cond_wait is not portable - "
1585 "use gnulib module pthread-cond for portability");
1586# endif
1587#endif
1588
1589#if @GNULIB_PTHREAD_COND@
1590# if @REPLACE_PTHREAD_COND_TIMEDWAIT@
1591# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1592# undef pthread_cond_timedwait
1593# define pthread_cond_timedwait rpl_pthread_cond_timedwait
1594# endif
1595_GL_FUNCDECL_RPL (pthread_cond_timedwait, int,
1596 (pthread_cond_t *restrict cond,
1597 pthread_mutex_t *restrict mutex,
1598 const struct timespec *restrict abstime),
1599 _GL_ARG_NONNULL ((1, 2, 3)));
1600_GL_CXXALIAS_RPL (pthread_cond_timedwait, int,
1601 (pthread_cond_t *restrict cond,
1602 pthread_mutex_t *restrict mutex,
1603 const struct timespec *restrict abstime));
1604# else
1605# if !@HAVE_PTHREAD_COND_TIMEDWAIT@
1606_GL_FUNCDECL_SYS (pthread_cond_timedwait, int,
1607 (pthread_cond_t *restrict cond,
1608 pthread_mutex_t *restrict mutex,
1609 const struct timespec *restrict abstime),
1610 _GL_ARG_NONNULL ((1, 2, 3)));
1611# endif
1612_GL_CXXALIAS_SYS (pthread_cond_timedwait, int,
1613 (pthread_cond_t *restrict cond,
1614 pthread_mutex_t *restrict mutex,
1615 const struct timespec *restrict abstime));
1616# endif
1617# if __GLIBC__ >= 2
1618_GL_CXXALIASWARN (pthread_cond_timedwait);
1619# endif
1620#elif defined GNULIB_POSIXCHECK
1621# if HAVE_RAW_DECL_PTHREAD_COND_TIMEDWAIT
1622_GL_WARN_ON_USE (pthread_cond_timedwait, "pthread_cond_timedwait is not portable - "
1623 "use gnulib module pthread-cond for portability");
1624# endif
1625#endif
1626
1627#if @GNULIB_PTHREAD_COND@
1628# if @REPLACE_PTHREAD_COND_SIGNAL@
1629# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1630# undef pthread_cond_signal
1631# define pthread_cond_signal rpl_pthread_cond_signal
1632# endif
1633_GL_FUNCDECL_RPL (pthread_cond_signal, int, (pthread_cond_t *cond),
1634 _GL_ARG_NONNULL ((1)));
1635_GL_CXXALIAS_RPL (pthread_cond_signal, int, (pthread_cond_t *cond));
1636# else
1637# if !@HAVE_PTHREAD_COND_SIGNAL@
1638_GL_FUNCDECL_SYS (pthread_cond_signal, int, (pthread_cond_t *cond),
1639 _GL_ARG_NONNULL ((1)));
1640# endif
1641_GL_CXXALIAS_SYS (pthread_cond_signal, int, (pthread_cond_t *cond));
1642# endif
1643# if __GLIBC__ >= 2
1644_GL_CXXALIASWARN (pthread_cond_signal);
1645# endif
1646#elif defined GNULIB_POSIXCHECK
1647# if HAVE_RAW_DECL_PTHREAD_COND_SIGNAL
1648_GL_WARN_ON_USE (pthread_cond_signal, "pthread_cond_signal is not portable - "
1649 "use gnulib module pthread-cond for portability");
1650# endif
1651#endif
1652
1653#if @GNULIB_PTHREAD_COND@
1654# if @REPLACE_PTHREAD_COND_BROADCAST@
1655# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1656# undef pthread_cond_broadcast
1657# define pthread_cond_broadcast rpl_pthread_cond_broadcast
1658# endif
1659_GL_FUNCDECL_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond),
1660 _GL_ARG_NONNULL ((1)));
1661_GL_CXXALIAS_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond));
1662# else
1663# if !@HAVE_PTHREAD_COND_BROADCAST@
1664_GL_FUNCDECL_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond),
1665 _GL_ARG_NONNULL ((1)));
1666# endif
1667_GL_CXXALIAS_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond));
1668# endif
1669# if __GLIBC__ >= 2
1670_GL_CXXALIASWARN (pthread_cond_broadcast);
1671# endif
1672#elif defined GNULIB_POSIXCHECK
1673# if HAVE_RAW_DECL_PTHREAD_COND_BROADCAST
1674_GL_WARN_ON_USE (pthread_cond_broadcast, "pthread_cond_broadcast is not portable - "
1675 "use gnulib module pthread-cond for portability");
1676# endif
1677#endif
1678
1679#if @GNULIB_PTHREAD_COND@
1680# if @REPLACE_PTHREAD_COND_DESTROY@
1681# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1682# undef pthread_cond_destroy
1683# define pthread_cond_destroy rpl_pthread_cond_destroy
1684# endif
1685_GL_FUNCDECL_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond),
1686 _GL_ARG_NONNULL ((1)));
1687_GL_CXXALIAS_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond));
1688# else
1689# if !@HAVE_PTHREAD_COND_DESTROY@
1690_GL_FUNCDECL_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond),
1691 _GL_ARG_NONNULL ((1)));
1692# endif
1693_GL_CXXALIAS_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond));
1694# endif
1695# if __GLIBC__ >= 2
1696_GL_CXXALIASWARN (pthread_cond_destroy);
1697# endif
1698#elif defined GNULIB_POSIXCHECK
1699# if HAVE_RAW_DECL_PTHREAD_COND_DESTROY
1700_GL_WARN_ON_USE (pthread_cond_destroy, "pthread_cond_destroy is not portable - "
1701 "use gnulib module pthread-cond for portability");
1702# endif
1703#endif
1704
1705/* =========== Thread-specific storage functions =========== */
1706
1707#if @GNULIB_PTHREAD_TSS@
1708# if @REPLACE_PTHREAD_KEY_CREATE@
1709# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1710# undef pthread_key_create
1711# define pthread_key_create rpl_pthread_key_create
1712# endif
1713_GL_FUNCDECL_RPL (pthread_key_create, int,
1714 (pthread_key_t *keyp, void (*destructor) (void *)),
1715 _GL_ARG_NONNULL ((1)));
1716_GL_CXXALIAS_RPL (pthread_key_create, int,
1717 (pthread_key_t *keyp, void (*destructor) (void *)));
1718# else
1719# if !@HAVE_PTHREAD_KEY_CREATE@
1720_GL_FUNCDECL_SYS (pthread_key_create, int,
1721 (pthread_key_t *keyp, void (*destructor) (void *)),
1722 _GL_ARG_NONNULL ((1)));
1723# endif
1724_GL_CXXALIAS_SYS_CAST (pthread_key_create, int,
1725 (pthread_key_t *keyp, void (*destructor) (void *)));
1726# endif
1727# if __GLIBC__ >= 2
1728_GL_CXXALIASWARN (pthread_key_create);
1729# endif
1730#elif defined GNULIB_POSIXCHECK
1731# if HAVE_RAW_DECL_PTHREAD_KEY_CREATE
1732_GL_WARN_ON_USE (pthread_key_create, "pthread_key_create is not portable - "
1733 "use gnulib module pthread-tss for portability");
1734# endif
1735#endif
1736
1737#if @GNULIB_PTHREAD_TSS@
1738# if @REPLACE_PTHREAD_SETSPECIFIC@
1739# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1740# undef pthread_setspecific
1741# define pthread_setspecific rpl_pthread_setspecific
1742# endif
1743_GL_FUNCDECL_RPL (pthread_setspecific, int,
1744 (pthread_key_t key, const void *value), );
1745_GL_CXXALIAS_RPL (pthread_setspecific, int,
1746 (pthread_key_t key, const void *value));
1747# else
1748# if !@HAVE_PTHREAD_SETSPECIFIC@
1749_GL_FUNCDECL_SYS (pthread_setspecific, int,
1750 (pthread_key_t key, const void *value), );
1751# endif
1752_GL_CXXALIAS_SYS (pthread_setspecific, int,
1753 (pthread_key_t key, const void *value));
1754# endif
1755# if __GLIBC__ >= 2
1756_GL_CXXALIASWARN (pthread_setspecific);
1757# endif
1758#elif defined GNULIB_POSIXCHECK
1759# if HAVE_RAW_DECL_PTHREAD_SETSPECIFIC
1760_GL_WARN_ON_USE (pthread_setspecific, "pthread_setspecific is not portable - "
1761 "use gnulib module pthread-tss for portability");
1762# endif
1763#endif
1764
1765#if @GNULIB_PTHREAD_TSS@
1766# if @REPLACE_PTHREAD_GETSPECIFIC@
1767# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1768# undef pthread_getspecific
1769# define pthread_getspecific rpl_pthread_getspecific
1770# endif
1771_GL_FUNCDECL_RPL (pthread_getspecific, void *, (pthread_key_t key), );
1772_GL_CXXALIAS_RPL (pthread_getspecific, void *, (pthread_key_t key));
1773# else
1774# if !@HAVE_PTHREAD_GETSPECIFIC@
1775_GL_FUNCDECL_SYS (pthread_getspecific, void *, (pthread_key_t key), );
1776# endif
1777_GL_CXXALIAS_SYS (pthread_getspecific, void *, (pthread_key_t key));
1778# endif
1779# if __GLIBC__ >= 2
1780_GL_CXXALIASWARN (pthread_getspecific);
1781# endif
1782#elif defined GNULIB_POSIXCHECK
1783# if HAVE_RAW_DECL_PTHREAD_GETSPECIFIC
1784_GL_WARN_ON_USE (pthread_getspecific, "pthread_getspecific is not portable - "
1785 "use gnulib module pthread-tss for portability");
1786# endif
1787#endif
1788
1789#if @GNULIB_PTHREAD_TSS@
1790# if @REPLACE_PTHREAD_KEY_DELETE@
1791# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1792# undef pthread_key_delete
1793# define pthread_key_delete rpl_pthread_key_delete
1794# endif
1795_GL_FUNCDECL_RPL (pthread_key_delete, int, (pthread_key_t key), );
1796_GL_CXXALIAS_RPL (pthread_key_delete, int, (pthread_key_t key));
1797# else
1798# if !@HAVE_PTHREAD_KEY_DELETE@
1799_GL_FUNCDECL_SYS (pthread_key_delete, int, (pthread_key_t key), );
1800# endif
1801_GL_CXXALIAS_SYS (pthread_key_delete, int, (pthread_key_t key));
1802# endif
1803# if __GLIBC__ >= 2
1804_GL_CXXALIASWARN (pthread_key_delete);
1805# endif
1806#elif defined GNULIB_POSIXCHECK
1807# if HAVE_RAW_DECL_PTHREAD_KEY_DELETE
1808_GL_WARN_ON_USE (pthread_key_delete, "pthread_key_delete is not portable - "
1809 "use gnulib module pthread-tss for portability");
1810# endif
1811#endif
1812
1813/* =========== Spinlock functions =========== */
1814
1815#if @GNULIB_PTHREAD_SPIN@
1816# if @REPLACE_PTHREAD_SPIN_INIT@
1817# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1818# undef pthread_spin_init
1819# define pthread_spin_init rpl_pthread_spin_init
1820# endif
1821_GL_FUNCDECL_RPL (pthread_spin_init, int,
1822 (pthread_spinlock_t *lock, int shared_across_processes),
1823 _GL_ARG_NONNULL ((1)));
1824_GL_CXXALIAS_RPL (pthread_spin_init, int,
1825 (pthread_spinlock_t *lock, int shared_across_processes));
1826# else
1827# if !@HAVE_PTHREAD_SPIN_INIT@
1828_GL_FUNCDECL_SYS (pthread_spin_init, int,
1829 (pthread_spinlock_t *lock, int shared_across_processes),
1830 _GL_ARG_NONNULL ((1)));
1831# endif
1832_GL_CXXALIAS_SYS (pthread_spin_init, int,
1833 (pthread_spinlock_t *lock, int shared_across_processes));
1834# endif
1835# if __GLIBC__ >= 2
1836_GL_CXXALIASWARN (pthread_spin_init);
1837# endif
1838#elif defined GNULIB_POSIXCHECK
1839# if HAVE_RAW_DECL_PTHREAD_SPIN_INIT
1840_GL_WARN_ON_USE (pthread_spin_init, "pthread_spin_init is not portable - "
1841 "use gnulib module pthread-spin for portability");
1842# endif
1843#endif
1844
1845#if @GNULIB_PTHREAD_SPIN@
1846# if @REPLACE_PTHREAD_SPIN_LOCK@
1847# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1848# undef pthread_spin_lock
1849# define pthread_spin_lock rpl_pthread_spin_lock
1850# endif
1851_GL_FUNCDECL_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock),
1852 _GL_ARG_NONNULL ((1)));
1853_GL_CXXALIAS_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock));
1854# else
1855# if !@HAVE_PTHREAD_SPIN_LOCK@
1856_GL_FUNCDECL_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock),
1857 _GL_ARG_NONNULL ((1)));
1858# endif
1859_GL_CXXALIAS_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock));
1860# endif
1861# if __GLIBC__ >= 2
1862_GL_CXXALIASWARN (pthread_spin_lock);
1863# endif
1864#elif defined GNULIB_POSIXCHECK
1865# if HAVE_RAW_DECL_PTHREAD_SPIN_LOCK
1866_GL_WARN_ON_USE (pthread_spin_lock, "pthread_spin_lock is not portable - "
1867 "use gnulib module pthread-spin for portability");
1868# endif
1869#endif
1870
1871#if @GNULIB_PTHREAD_SPIN@
1872# if @REPLACE_PTHREAD_SPIN_TRYLOCK@
1873# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1874# undef pthread_spin_trylock
1875# define pthread_spin_trylock rpl_pthread_spin_trylock
1876# endif
1877_GL_FUNCDECL_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock),
1878 _GL_ARG_NONNULL ((1)));
1879_GL_CXXALIAS_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock));
1880# else
1881# if !@HAVE_PTHREAD_SPIN_TRYLOCK@
1882_GL_FUNCDECL_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock),
1883 _GL_ARG_NONNULL ((1)));
1884# endif
1885_GL_CXXALIAS_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock));
1886# endif
1887# if __GLIBC__ >= 2
1888_GL_CXXALIASWARN (pthread_spin_trylock);
1889# endif
1890#elif defined GNULIB_POSIXCHECK
1891# if HAVE_RAW_DECL_PTHREAD_SPIN_TRYLOCK
1892_GL_WARN_ON_USE (pthread_spin_trylock, "pthread_spin_trylock is not portable - "
1893 "use gnulib module pthread-spin for portability");
1894# endif
1895#endif
1896
1897#if @GNULIB_PTHREAD_SPIN@
1898# if @REPLACE_PTHREAD_SPIN_UNLOCK@
1899# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1900# undef pthread_spin_unlock
1901# define pthread_spin_unlock rpl_pthread_spin_unlock
1902# endif
1903_GL_FUNCDECL_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock),
1904 _GL_ARG_NONNULL ((1)));
1905_GL_CXXALIAS_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock));
1906# else
1907# if !@HAVE_PTHREAD_SPIN_UNLOCK@
1908_GL_FUNCDECL_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock),
1909 _GL_ARG_NONNULL ((1)));
1910# endif
1911_GL_CXXALIAS_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock));
1912# endif
1913# if __GLIBC__ >= 2
1914_GL_CXXALIASWARN (pthread_spin_unlock);
1915# endif
1916#elif defined GNULIB_POSIXCHECK
1917# if HAVE_RAW_DECL_PTHREAD_SPIN_UNLOCK
1918_GL_WARN_ON_USE (pthread_spin_unlock, "pthread_spin_unlock is not portable - "
1919 "use gnulib module pthread-spin for portability");
1920# endif
1921#endif
1922
1923#if @GNULIB_PTHREAD_SPIN@
1924# if @REPLACE_PTHREAD_SPIN_DESTROY@
1925# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1926# undef pthread_spin_destroy
1927# define pthread_spin_destroy rpl_pthread_spin_destroy
1928# endif
1929_GL_FUNCDECL_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock),
1930 _GL_ARG_NONNULL ((1)));
1931_GL_CXXALIAS_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock));
1932# else
1933# if !@HAVE_PTHREAD_SPIN_DESTROY@
1934_GL_FUNCDECL_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock),
1935 _GL_ARG_NONNULL ((1)));
1936# endif
1937_GL_CXXALIAS_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock));
1938# endif
1939# if __GLIBC__ >= 2
1940_GL_CXXALIASWARN (pthread_spin_destroy);
1941# endif
1942#elif defined GNULIB_POSIXCHECK
1943# if HAVE_RAW_DECL_PTHREAD_SPIN_DESTROY
1944_GL_WARN_ON_USE (pthread_spin_destroy, "pthread_spin_destroy is not portable - "
1945 "use gnulib module pthread-spin for portability");
1946# endif
1947#endif
1948
1949
1950#if defined __cplusplus && defined GNULIB_NAMESPACE && !@HAVE_PTHREAD_H@ && defined __MINGW32__
1951/* Provide the symbols required by mingw's <bits/gthr-default.h>. */
1952using GNULIB_NAMESPACE::pthread_create;
1953using GNULIB_NAMESPACE::pthread_self;
1954using GNULIB_NAMESPACE::pthread_equal;
1955using GNULIB_NAMESPACE::pthread_detach;
1956using GNULIB_NAMESPACE::pthread_join;
1957using GNULIB_NAMESPACE::pthread_once;
1958using GNULIB_NAMESPACE::pthread_mutex_init;
1959using GNULIB_NAMESPACE::pthread_mutexattr_init;
1960using GNULIB_NAMESPACE::pthread_mutexattr_settype;
1961using GNULIB_NAMESPACE::pthread_mutexattr_destroy;
1962using GNULIB_NAMESPACE::pthread_mutex_lock;
1963using GNULIB_NAMESPACE::pthread_mutex_trylock;
1964using GNULIB_NAMESPACE::pthread_mutex_timedlock;
1965using GNULIB_NAMESPACE::pthread_mutex_unlock;
1966using GNULIB_NAMESPACE::pthread_mutex_destroy;
1967using GNULIB_NAMESPACE::pthread_cond_wait;
1968using GNULIB_NAMESPACE::pthread_cond_timedwait;
1969using GNULIB_NAMESPACE::pthread_cond_signal;
1970using GNULIB_NAMESPACE::pthread_cond_broadcast;
1971using GNULIB_NAMESPACE::pthread_cond_destroy;
1972using GNULIB_NAMESPACE::pthread_key_create;
1973using GNULIB_NAMESPACE::pthread_setspecific;
1974using GNULIB_NAMESPACE::pthread_getspecific;
1975using GNULIB_NAMESPACE::pthread_key_delete;
1976#endif
1977
1978
1979#endif /* _@GUARD_PREFIX@_PTHREAD_H_ */
1980#endif /* _@GUARD_PREFIX@_PTHREAD_H_ */
1981#endif
diff --git a/gl/realloc.c b/gl/realloc.c
index 05731396..9b35c235 100644
--- a/gl/realloc.c
+++ b/gl/realloc.c
@@ -1,6 +1,6 @@
1/* realloc() function that is glibc compatible. 1/* realloc() function that is glibc compatible.
2 2
3 Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2024 Free Software 3 Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2026 Free Software
4 Foundation, Inc. 4 Foundation, Inc.
5 5
6 This file is free software: you can redistribute it and/or modify 6 This file is free software: you can redistribute it and/or modify
@@ -18,17 +18,21 @@
18 18
19/* written by Jim Meyering and Bruno Haible */ 19/* written by Jim Meyering and Bruno Haible */
20 20
21#include <config.h> 21/* Ensure that we call the system's realloc() below. */
22#define _GL_USE_STDLIB_ALLOC 1
22 23
24#define _GL_REALLOC_INLINE _GL_EXTERN_INLINE
25#include <config.h>
23#include <stdlib.h> 26#include <stdlib.h>
24 27
25#include <errno.h> 28#include <errno.h>
29#include <stdckdint.h>
26 30
27#include "xalloc-oversized.h" 31#ifdef __CHERI_PURE_CAPABILITY__
32# include <cheri.h>
33#endif
28 34
29/* Call the system's realloc below. This file does not define 35#ifndef _GL_INLINE_RPL_REALLOC
30 _GL_USE_STDLIB_ALLOC because it needs Gnulib's malloc if present. */
31#undef realloc
32 36
33/* Change the size of an allocated block of memory P to N bytes, 37/* Change the size of an allocated block of memory P to N bytes,
34 with error checking. If P is NULL, use malloc. Otherwise if N is zero, 38 with error checking. If P is NULL, use malloc. Otherwise if N is zero,
@@ -37,27 +41,70 @@
37void * 41void *
38rpl_realloc (void *p, size_t n) 42rpl_realloc (void *p, size_t n)
39{ 43{
40 if (p == NULL) 44 size_t n1 = n;
41 return malloc (n);
42 45
43 if (n == 0) 46 if (n == 0)
44 { 47 {
45 free (p); 48# if NEED_SANITIZED_REALLOC
46 return NULL; 49 /* When P is non-null, ISO C23 §7.24.3.7.(3) says realloc (P, 0) has
50 undefined behavior even though C17 and earlier partially defined
51 the behavior. Let the programmer know.
52 When the undefined-behaviour sanitizers report this case, i.e. when
53 <https://gcc.gnu.org/PR117233> and
54 <https://github.com/llvm/llvm-project/issues/113065>
55 have been closed and new releases of GCC and clang have been made,
56 we can revisit this code. */
57 if (p != NULL)
58 abort ();
59# endif
60
61 /* realloc (NULL, 0) acts like glibc malloc (0), i.e., like malloc (1)
62 except the caller cannot dereference any non-null return.
63
64 realloc (P, 0) with non-null P is a messier situation.
65 As mentioned above, C23 says behavior is undefined.
66 POSIX.1-2024 extends C17 to say realloc (P, 0)
67 either fails by setting errno and returning a null pointer,
68 or succeeds by freeing P and then either:
69 (a) setting errno=EINVAL and returning a null pointer; or
70 (b) acting like a successful malloc (0).
71 glibc 1 through 2.1 realloc acted like (b),
72 which conforms to C17, to C23 and to POSIX.1-2024.
73 glibc 2.1.1+ realloc acts like (a) except it does not set errno;
74 this conforms to C17 and to C23 but not to POSIX.1-2024.
75 Quite possibly future versions of POSIX will change,
76 due either to C23 or to (a)'s semantics being messy.
77 Act like (b), as that's easy, matches GNU, BSD and V7 malloc,
78 matches BSD and V7 realloc, and requires no extra code at
79 caller sites. */
80
81# if !HAVE_REALLOC_0_NONNULL
82 n1 = 1;
83# endif
47 } 84 }
48 85
49 if (xalloc_oversized (n, 1)) 86# if !HAVE_MALLOC_PTRDIFF
87 ptrdiff_t signed_n;
88 if (ckd_add (&signed_n, n, 0))
50 { 89 {
51 errno = ENOMEM; 90 errno = ENOMEM;
52 return NULL; 91 return NULL;
53 } 92 }
93# endif
54 94
55 void *result = realloc (p, n); 95 void *result = realloc (p, n1);
56 96
57#if !HAVE_MALLOC_POSIX 97# if !HAVE_REALLOC_POSIX
58 if (result == NULL) 98 if (result == NULL)
59 errno = ENOMEM; 99 errno = ENOMEM;
60#endif 100# endif
101
102# ifdef __CHERI_PURE_CAPABILITY__
103 if (result != NULL)
104 result = cheri_bounds_set (result, n);
105# endif
61 106
62 return result; 107 return result;
63} 108}
109
110#endif
diff --git a/gl/reallocarray.c b/gl/reallocarray.c
index 09711a0e..60573fef 100644
--- a/gl/reallocarray.c
+++ b/gl/reallocarray.c
@@ -1,6 +1,6 @@
1/* reallocarray function that is glibc compatible. 1/* reallocarray function that is glibc compatible.
2 2
3 Copyright (C) 2017-2024 Free Software Foundation, Inc. 3 Copyright (C) 2017-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -33,6 +33,6 @@ reallocarray (void *ptr, size_t nmemb, size_t size)
33 return NULL; 33 return NULL;
34 } 34 }
35 35
36 /* Rely on the semantics of GNU realloc. */ 36 /* Call realloc, setting errno to ENOMEM on failure. */
37 return realloc (ptr, nbytes); 37 return realloc (ptr, nbytes);
38} 38}
diff --git a/gl/regcomp.c b/gl/regcomp.c
index 696cf813..aa2f6800 100644
--- a/gl/regcomp.c
+++ b/gl/regcomp.c
@@ -1,5 +1,5 @@
1/* Extended regular expression matching and search library. 1/* Extended regular expression matching and search library.
2 Copyright (C) 2002-2024 Free Software Foundation, Inc. 2 Copyright (C) 2002-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. 4 Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
5 5
@@ -831,7 +831,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
831 if (table_size > pat_len) 831 if (table_size > pat_len)
832 break; 832 break;
833 833
834 dfa->state_table = calloc (sizeof (struct re_state_table_entry), table_size); 834 dfa->state_table = calloc (table_size, sizeof (struct re_state_table_entry));
835 dfa->state_hash_mask = table_size - 1; 835 dfa->state_hash_mask = table_size - 1;
836 836
837 dfa->mb_cur_max = MB_CUR_MAX; 837 dfa->mb_cur_max = MB_CUR_MAX;
@@ -862,7 +862,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
862 { 862 {
863 int i, j, ch; 863 int i, j, ch;
864 864
865 dfa->sb_char = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); 865 dfa->sb_char = (re_bitset_ptr_t) calloc (1, sizeof (bitset_t));
866 if (__glibc_unlikely (dfa->sb_char == NULL)) 866 if (__glibc_unlikely (dfa->sb_char == NULL))
867 return REG_ESPACE; 867 return REG_ESPACE;
868 868
@@ -1001,21 +1001,25 @@ create_initial_state (re_dfa_t *dfa)
1001 Idx dest_idx = dfa->edests[node_idx].elems[0]; 1001 Idx dest_idx = dfa->edests[node_idx].elems[0];
1002 if (!re_node_set_contains (&init_nodes, dest_idx)) 1002 if (!re_node_set_contains (&init_nodes, dest_idx))
1003 { 1003 {
1004 reg_errcode_t merge_err 1004 err
1005 = re_node_set_merge (&init_nodes, dfa->eclosures + dest_idx); 1005 = re_node_set_merge (&init_nodes, dfa->eclosures + dest_idx);
1006 if (merge_err != REG_NOERROR) 1006 if (err != REG_NOERROR)
1007 return merge_err; 1007 break;
1008 i = 0; 1008 i = 0;
1009 } 1009 }
1010 } 1010 }
1011 } 1011 }
1012 1012
1013 /* It must be the first time to invoke acquire_state. */ 1013 /* It must be the first time to invoke acquire_state. */
1014 dfa->init_state = re_acquire_state_context (&err, dfa, &init_nodes, 0); 1014 dfa->init_state
1015 /* We don't check ERR here, since the initial state must not be NULL. */ 1015 = (err == REG_NOERROR
1016 ? re_acquire_state_context (&err, dfa, &init_nodes, 0)
1017 : NULL);
1016 if (__glibc_unlikely (dfa->init_state == NULL)) 1018 if (__glibc_unlikely (dfa->init_state == NULL))
1017 return err; 1019 {
1018 if (dfa->init_state->has_constraint) 1020 /* Don't check ERR here, as the initial state must not be null. */
1021 }
1022 else if (dfa->init_state->has_constraint)
1019 { 1023 {
1020 dfa->init_state_word = re_acquire_state_context (&err, dfa, &init_nodes, 1024 dfa->init_state_word = re_acquire_state_context (&err, dfa, &init_nodes,
1021 CONTEXT_WORD); 1025 CONTEXT_WORD);
@@ -1025,17 +1029,13 @@ create_initial_state (re_dfa_t *dfa)
1025 &init_nodes, 1029 &init_nodes,
1026 CONTEXT_NEWLINE 1030 CONTEXT_NEWLINE
1027 | CONTEXT_BEGBUF); 1031 | CONTEXT_BEGBUF);
1028 if (__glibc_unlikely (dfa->init_state_word == NULL
1029 || dfa->init_state_nl == NULL
1030 || dfa->init_state_begbuf == NULL))
1031 return err;
1032 } 1032 }
1033 else 1033 else
1034 dfa->init_state_word = dfa->init_state_nl 1034 dfa->init_state_word = dfa->init_state_nl
1035 = dfa->init_state_begbuf = dfa->init_state; 1035 = dfa->init_state_begbuf = dfa->init_state;
1036 1036
1037 re_node_set_free (&init_nodes); 1037 re_node_set_free (&init_nodes);
1038 return REG_NOERROR; 1038 return err;
1039} 1039}
1040 1040
1041/* If it is possible to do searching in single byte encoding instead of UTF-8 1041/* If it is possible to do searching in single byte encoding instead of UTF-8
@@ -1677,12 +1677,11 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root)
1677 { 1677 {
1678 err = duplicate_node_closure (dfa, node, node, node, 1678 err = duplicate_node_closure (dfa, node, node, node,
1679 dfa->nodes[node].constraint); 1679 dfa->nodes[node].constraint);
1680 if (__glibc_unlikely (err != REG_NOERROR))
1681 return err;
1682 } 1680 }
1683 1681
1684 /* Expand each epsilon destination nodes. */ 1682 /* Expand each epsilon destination nodes. */
1685 if (IS_EPSILON_NODE(dfa->nodes[node].type)) 1683 if (__glibc_likely (err == REG_NOERROR)
1684 && IS_EPSILON_NODE (dfa->nodes[node].type))
1686 for (i = 0; i < dfa->edests[node].nelem; ++i) 1685 for (i = 0; i < dfa->edests[node].nelem; ++i)
1687 { 1686 {
1688 re_node_set eclosure_elem; 1687 re_node_set eclosure_elem;
@@ -1700,14 +1699,14 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root)
1700 { 1699 {
1701 err = calc_eclosure_iter (&eclosure_elem, dfa, edest, false); 1700 err = calc_eclosure_iter (&eclosure_elem, dfa, edest, false);
1702 if (__glibc_unlikely (err != REG_NOERROR)) 1701 if (__glibc_unlikely (err != REG_NOERROR))
1703 return err; 1702 break;
1704 } 1703 }
1705 else 1704 else
1706 eclosure_elem = dfa->eclosures[edest]; 1705 eclosure_elem = dfa->eclosures[edest];
1707 /* Merge the epsilon closure of 'edest'. */ 1706 /* Merge the epsilon closure of 'edest'. */
1708 err = re_node_set_merge (&eclosure, &eclosure_elem); 1707 err = re_node_set_merge (&eclosure, &eclosure_elem);
1709 if (__glibc_unlikely (err != REG_NOERROR)) 1708 if (__glibc_unlikely (err != REG_NOERROR))
1710 return err; 1709 break;
1711 /* If the epsilon closure of 'edest' is incomplete, 1710 /* If the epsilon closure of 'edest' is incomplete,
1712 the epsilon closure of this node is also incomplete. */ 1711 the epsilon closure of this node is also incomplete. */
1713 if (dfa->eclosures[edest].nelem == 0) 1712 if (dfa->eclosures[edest].nelem == 0)
@@ -1717,12 +1716,18 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, Idx node, bool root)
1717 } 1716 }
1718 } 1717 }
1719 1718
1720 if (incomplete && !root) 1719 if (err != REG_NOERROR)
1721 dfa->eclosures[node].nelem = 0; 1720 re_node_set_free (&eclosure);
1722 else 1721 else
1723 dfa->eclosures[node] = eclosure; 1722 {
1724 *new_set = eclosure; 1723 if (incomplete && !root)
1725 return REG_NOERROR; 1724 dfa->eclosures[node].nelem = 0;
1725 else
1726 dfa->eclosures[node] = eclosure;
1727 *new_set = eclosure;
1728 }
1729
1730 return err;
1726} 1731}
1727 1732
1728/* Functions for token which are used in the parser. */ 1733/* Functions for token which are used in the parser. */
@@ -3055,8 +3060,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
3055 _NL_COLLATE_SYMB_EXTRAMB); 3060 _NL_COLLATE_SYMB_EXTRAMB);
3056 } 3061 }
3057#endif 3062#endif
3058 sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); 3063 sbcset = (re_bitset_ptr_t) calloc (1, sizeof (bitset_t));
3059 mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1); 3064 mbcset = (re_charset_t *) calloc (1, sizeof (re_charset_t));
3060 if (__glibc_unlikely (sbcset == NULL || mbcset == NULL)) 3065 if (__glibc_unlikely (sbcset == NULL || mbcset == NULL))
3061 { 3066 {
3062 re_free (sbcset); 3067 re_free (sbcset);
@@ -3275,6 +3280,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
3275 else 3280 else
3276 { 3281 {
3277 free_charset (mbcset); 3282 free_charset (mbcset);
3283 mbcset = NULL;
3278 /* Build a tree for simple bracket. */ 3284 /* Build a tree for simple bracket. */
3279 br_token.type = SIMPLE_BRACKET; 3285 br_token.type = SIMPLE_BRACKET;
3280 br_token.opr.sbcset = sbcset; 3286 br_token.opr.sbcset = sbcset;
@@ -3288,7 +3294,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
3288 *err = REG_ESPACE; 3294 *err = REG_ESPACE;
3289 parse_bracket_exp_free_return: 3295 parse_bracket_exp_free_return:
3290 re_free (sbcset); 3296 re_free (sbcset);
3291 free_charset (mbcset); 3297 if (__glibc_likely (mbcset != NULL))
3298 free_charset (mbcset);
3292 return NULL; 3299 return NULL;
3293} 3300}
3294 3301
@@ -3548,13 +3555,13 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
3548 reg_errcode_t ret; 3555 reg_errcode_t ret;
3549 bin_tree_t *tree; 3556 bin_tree_t *tree;
3550 3557
3551 sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); 3558 sbcset = (re_bitset_ptr_t) calloc (1, sizeof (bitset_t));
3552 if (__glibc_unlikely (sbcset == NULL)) 3559 if (__glibc_unlikely (sbcset == NULL))
3553 { 3560 {
3554 *err = REG_ESPACE; 3561 *err = REG_ESPACE;
3555 return NULL; 3562 return NULL;
3556 } 3563 }
3557 mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1); 3564 mbcset = (re_charset_t *) calloc (1, sizeof (re_charset_t));
3558 if (__glibc_unlikely (mbcset == NULL)) 3565 if (__glibc_unlikely (mbcset == NULL))
3559 { 3566 {
3560 re_free (sbcset); 3567 re_free (sbcset);
diff --git a/gl/regex.c b/gl/regex.c
index 4b1a6ed6..f9f333d2 100644
--- a/gl/regex.c
+++ b/gl/regex.c
@@ -1,5 +1,5 @@
1/* Extended regular expression matching and search library. 1/* Extended regular expression matching and search library.
2 Copyright (C) 2002-2024 Free Software Foundation, Inc. 2 Copyright (C) 2002-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. 4 Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
5 5
@@ -24,6 +24,7 @@
24 24
25# if __GNUC_PREREQ (4, 6) 25# if __GNUC_PREREQ (4, 6)
26# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" 26# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
27# pragma GCC diagnostic ignored "-Wswitch-enum"
27# pragma GCC diagnostic ignored "-Wvla" 28# pragma GCC diagnostic ignored "-Wvla"
28# endif 29# endif
29#endif 30#endif
diff --git a/gl/regex.h b/gl/regex.h
index ccf40ceb..df35c93e 100644
--- a/gl/regex.h
+++ b/gl/regex.h
@@ -1,6 +1,6 @@
1/* Definitions for data structures and routines for the regular 1/* Definitions for data structures and routines for the regular
2 expression library. 2 expression library.
3 Copyright (C) 1985, 1989-2024 Free Software Foundation, Inc. 3 Copyright (C) 1985, 1989-2026 Free Software Foundation, Inc.
4 This file is part of the GNU C Library. 4 This file is part of the GNU C Library.
5 5
6 The GNU C Library is free software; you can redistribute it and/or 6 The GNU C Library is free software; you can redistribute it and/or
@@ -66,15 +66,14 @@ typedef unsigned long int active_reg_t;
66 66
67/* The following bits are used to determine the regexp syntax we 67/* The following bits are used to determine the regexp syntax we
68 recognize. The set/not-set meanings are chosen so that Emacs syntax 68 recognize. The set/not-set meanings are chosen so that Emacs syntax
69 remains the value 0. The bits are given in alphabetical order, and 69 is the value 0 for Emacs 20 (2000) and earlier, and the value
70 the definitions shifted by one from the previous bit; thus, when we 70 RE_SYNTAX_EMACS for Emacs 21 (2001) and later. */
71 add or remove a bit, only one other definition need change. */
72typedef unsigned long int reg_syntax_t; 71typedef unsigned long int reg_syntax_t;
73 72
74#ifdef __USE_GNU 73#ifdef __USE_GNU
75/* If this bit is not set, then \ inside a bracket expression is literal. 74/* If this bit is not set, then \ inside a bracket expression is literal.
76 If set, then such a \ quotes the following character. */ 75 If set, then such a \ quotes the following character. */
77# define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1) 76# define RE_BACKSLASH_ESCAPE_IN_LISTS 1ul
78 77
79/* If this bit is not set, then + and ? are operators, and \+ and \? are 78/* If this bit is not set, then + and ? are operators, and \+ and \? are
80 literals. 79 literals.
@@ -215,7 +214,8 @@ extern reg_syntax_t re_syntax_options;
215 (The [[[ comments delimit what gets put into the Texinfo file, so 214 (The [[[ comments delimit what gets put into the Texinfo file, so
216 don't delete them!) */ 215 don't delete them!) */
217/* [[[begin syntaxes]]] */ 216/* [[[begin syntaxes]]] */
218# define RE_SYNTAX_EMACS 0 217# define RE_SYNTAX_EMACS \
218 (RE_CHAR_CLASSES | RE_INTERVALS)
219 219
220# define RE_SYNTAX_AWK \ 220# define RE_SYNTAX_AWK \
221 (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \ 221 (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
@@ -522,20 +522,6 @@ typedef struct
522 522
523/* Declarations for routines. */ 523/* Declarations for routines. */
524 524
525#ifndef _REGEX_NELTS
526# if (defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__ \
527 && !defined __STDC_NO_VLA__)
528# define _REGEX_NELTS(n) n
529# else
530# define _REGEX_NELTS(n)
531# endif
532#endif
533
534#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
535# pragma GCC diagnostic push
536# pragma GCC diagnostic ignored "-Wvla"
537#endif
538
539#ifndef _Attr_access_ 525#ifndef _Attr_access_
540# ifdef __attr_access 526# ifdef __attr_access
541# define _Attr_access_(arg) __attr_access (arg) 527# define _Attr_access_(arg) __attr_access (arg)
@@ -647,10 +633,12 @@ extern int re_exec (const char *);
647 || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ 633 || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \
648 || __clang_major__ >= 3 634 || __clang_major__ >= 3
649# define _Restrict_ __restrict 635# define _Restrict_ __restrict
650# elif 199901L <= __STDC_VERSION__ || defined restrict
651# define _Restrict_ restrict
652# else 636# else
653# define _Restrict_ 637# if 199901L <= __STDC_VERSION__ || defined restrict
638# define _Restrict_ restrict
639# else
640# define _Restrict_
641# endif
654# endif 642# endif
655#endif 643#endif
656/* For the ISO C99 syntax 644/* For the ISO C99 syntax
@@ -661,13 +649,15 @@ extern int re_exec (const char *);
661#ifndef _Restrict_arr_ 649#ifndef _Restrict_arr_
662# ifdef __restrict_arr 650# ifdef __restrict_arr
663# define _Restrict_arr_ __restrict_arr 651# define _Restrict_arr_ __restrict_arr
664# elif ((199901L <= __STDC_VERSION__ \ 652# else
653# if ((199901L <= __STDC_VERSION__ \
665 || 3 < __GNUC__ + (1 <= __GNUC_MINOR__) \ 654 || 3 < __GNUC__ + (1 <= __GNUC_MINOR__) \
666 || __clang_major__ >= 3) \ 655 || __clang_major__ >= 3) \
667 && !defined __cplusplus) 656 && !defined __cplusplus)
668# define _Restrict_arr_ _Restrict_ 657# define _Restrict_arr_ _Restrict_
669# else 658# else
670# define _Restrict_arr_ 659# define _Restrict_arr_
660# endif
671# endif 661# endif
672#endif 662#endif
673 663
@@ -678,8 +668,7 @@ extern int regcomp (regex_t *_Restrict_ __preg,
678 668
679extern int regexec (const regex_t *_Restrict_ __preg, 669extern int regexec (const regex_t *_Restrict_ __preg,
680 const char *_Restrict_ __String, size_t __nmatch, 670 const char *_Restrict_ __String, size_t __nmatch,
681 regmatch_t __pmatch[_Restrict_arr_ 671 regmatch_t __pmatch[_Restrict_arr_],
682 _REGEX_NELTS (__nmatch)],
683 int __eflags); 672 int __eflags);
684 673
685extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg, 674extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg,
@@ -688,10 +677,6 @@ extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg,
688 677
689extern void regfree (regex_t *__preg); 678extern void regfree (regex_t *__preg);
690 679
691#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
692# pragma GCC diagnostic pop
693#endif
694
695#ifdef __cplusplus 680#ifdef __cplusplus
696} 681}
697#endif /* C++ */ 682#endif /* C++ */
diff --git a/gl/regex_internal.c b/gl/regex_internal.c
index 8cd096eb..4b9b80f6 100644
--- a/gl/regex_internal.c
+++ b/gl/regex_internal.c
@@ -1,5 +1,5 @@
1/* Extended regular expression matching and search library. 1/* Extended regular expression matching and search library.
2 Copyright (C) 2002-2024 Free Software Foundation, Inc. 2 Copyright (C) 2002-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. 4 Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
5 5
@@ -937,8 +937,7 @@ re_node_set_alloc (re_node_set *set, Idx size)
937 set->alloc = size; 937 set->alloc = size;
938 set->nelem = 0; 938 set->nelem = 0;
939 set->elems = re_malloc (Idx, size); 939 set->elems = re_malloc (Idx, size);
940 if (__glibc_unlikely (set->elems == NULL) 940 if (__glibc_unlikely (set->elems == NULL))
941 && (MALLOC_0_IS_NONNULL || size != 0))
942 return REG_ESPACE; 941 return REG_ESPACE;
943 return REG_NOERROR; 942 return REG_NOERROR;
944} 943}
@@ -1596,7 +1595,7 @@ create_ci_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
1596 reg_errcode_t err; 1595 reg_errcode_t err;
1597 re_dfastate_t *newstate; 1596 re_dfastate_t *newstate;
1598 1597
1599 newstate = (re_dfastate_t *) calloc (sizeof (re_dfastate_t), 1); 1598 newstate = (re_dfastate_t *) calloc (1, sizeof (re_dfastate_t));
1600 if (__glibc_unlikely (newstate == NULL)) 1599 if (__glibc_unlikely (newstate == NULL))
1601 return NULL; 1600 return NULL;
1602 err = re_node_set_init_copy (&newstate->nodes, nodes); 1601 err = re_node_set_init_copy (&newstate->nodes, nodes);
@@ -1644,7 +1643,7 @@ create_cd_newstate (const re_dfa_t *dfa, const re_node_set *nodes,
1644 reg_errcode_t err; 1643 reg_errcode_t err;
1645 re_dfastate_t *newstate; 1644 re_dfastate_t *newstate;
1646 1645
1647 newstate = (re_dfastate_t *) calloc (sizeof (re_dfastate_t), 1); 1646 newstate = (re_dfastate_t *) calloc (1, sizeof (re_dfastate_t));
1648 if (__glibc_unlikely (newstate == NULL)) 1647 if (__glibc_unlikely (newstate == NULL))
1649 return NULL; 1648 return NULL;
1650 err = re_node_set_init_copy (&newstate->nodes, nodes); 1649 err = re_node_set_init_copy (&newstate->nodes, nodes);
diff --git a/gl/regex_internal.h b/gl/regex_internal.h
index 6165cb17..11b745ef 100644
--- a/gl/regex_internal.h
+++ b/gl/regex_internal.h
@@ -1,5 +1,5 @@
1/* Extended regular expression matching and search library. 1/* Extended regular expression matching and search library.
2 Copyright (C) 2002-2024 Free Software Foundation, Inc. 2 Copyright (C) 2002-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. 4 Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
5 5
@@ -98,22 +98,14 @@
98#endif 98#endif
99 99
100/* This is for other GNU distributions with internationalized messages. */ 100/* This is for other GNU distributions with internationalized messages. */
101#if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC 101#ifdef _LIBC
102# include <libintl.h> 102# include <libintl.h>
103# ifdef _LIBC
104# undef gettext
105# define gettext(msgid) \
106 __dcgettext (_libc_intl_domainname, msgid, LC_MESSAGES)
107# endif
108#else
109# undef gettext 103# undef gettext
110# define gettext(msgid) (msgid) 104# define gettext(msgid) \
111#endif 105 __dcgettext (_libc_intl_domainname, msgid, LC_MESSAGES)
112
113#ifndef gettext_noop
114/* This define is so xgettext can find the internationalizable
115 strings. */
116# define gettext_noop(String) String 106# define gettext_noop(String) String
107#else
108# include "gettext.h"
117#endif 109#endif
118 110
119/* Number of ASCII characters. */ 111/* Number of ASCII characters. */
@@ -436,12 +428,6 @@ typedef struct re_dfa_t re_dfa_t;
436#define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx)) 428#define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx))
437#define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx)) 429#define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx))
438 430
439#ifdef _LIBC
440# define MALLOC_0_IS_NONNULL 1
441#elif !defined MALLOC_0_IS_NONNULL
442# define MALLOC_0_IS_NONNULL 0
443#endif
444
445#ifndef MAX 431#ifndef MAX
446# define MAX(a,b) ((a) < (b) ? (b) : (a)) 432# define MAX(a,b) ((a) < (b) ? (b) : (a))
447#endif 433#endif
diff --git a/gl/regexec.c b/gl/regexec.c
index 9f065dfa..c84ce1ef 100644
--- a/gl/regexec.c
+++ b/gl/regexec.c
@@ -1,5 +1,5 @@
1/* Extended regular expression matching and search library. 1/* Extended regular expression matching and search library.
2 Copyright (C) 2002-2024 Free Software Foundation, Inc. 2 Copyright (C) 2002-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. 4 Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
5 5
@@ -185,7 +185,7 @@ static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len);
185 185
186int 186int
187regexec (const regex_t *__restrict preg, const char *__restrict string, 187regexec (const regex_t *__restrict preg, const char *__restrict string,
188 size_t nmatch, regmatch_t pmatch[_REGEX_NELTS (nmatch)], int eflags) 188 size_t nmatch, regmatch_t pmatch[], int eflags)
189{ 189{
190 reg_errcode_t err; 190 reg_errcode_t err;
191 Idx start, length; 191 Idx start, length;
@@ -229,7 +229,7 @@ int
229attribute_compat_text_section 229attribute_compat_text_section
230__compat_regexec (const regex_t *__restrict preg, 230__compat_regexec (const regex_t *__restrict preg,
231 const char *__restrict string, size_t nmatch, 231 const char *__restrict string, size_t nmatch,
232 regmatch_t pmatch[_REGEX_NELTS (nmatch)], int eflags) 232 regmatch_t pmatch[], int eflags)
233{ 233{
234 return regexec (preg, string, nmatch, pmatch, 234 return regexec (preg, string, nmatch, pmatch,
235 eflags & (REG_NOTBOL | REG_NOTEOL)); 235 eflags & (REG_NOTBOL | REG_NOTEOL));
@@ -2271,7 +2271,7 @@ merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx,
2271 these destinations and the results of the transition table. */ 2271 these destinations and the results of the transition table. */
2272 pstate = mctx->state_log[cur_idx]; 2272 pstate = mctx->state_log[cur_idx];
2273 log_nodes = pstate->entrance_nodes; 2273 log_nodes = pstate->entrance_nodes;
2274 if (next_state != NULL) 2274 if (next_state != NULL && next_state->entrance_nodes != NULL)
2275 { 2275 {
2276 table_nodes = next_state->entrance_nodes; 2276 table_nodes = next_state->entrance_nodes;
2277 *err = re_node_set_init_union (&next_nodes, table_nodes, 2277 *err = re_node_set_init_union (&next_nodes, table_nodes,
@@ -2721,8 +2721,8 @@ get_subexp (re_match_context_t *mctx, Idx bkref_node, Idx bkref_str_idx)
2721 continue; /* No. */ 2721 continue; /* No. */
2722 if (sub_top->path == NULL) 2722 if (sub_top->path == NULL)
2723 { 2723 {
2724 sub_top->path = calloc (sizeof (state_array_t), 2724 sub_top->path = calloc (sl_str - sub_top->str_idx + 1,
2725 sl_str - sub_top->str_idx + 1); 2725 sizeof (state_array_t));
2726 if (sub_top->path == NULL) 2726 if (sub_top->path == NULL)
2727 return REG_ESPACE; 2727 return REG_ESPACE;
2728 } 2728 }
@@ -3266,7 +3266,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
3266 if (ndests == 0) 3266 if (ndests == 0)
3267 { 3267 {
3268 state->trtable = (re_dfastate_t **) 3268 state->trtable = (re_dfastate_t **)
3269 calloc (sizeof (re_dfastate_t *), SBC_MAX); 3269 calloc (SBC_MAX, sizeof (re_dfastate_t *));
3270 if (__glibc_unlikely (state->trtable == NULL)) 3270 if (__glibc_unlikely (state->trtable == NULL))
3271 return false; 3271 return false;
3272 return true; 3272 return true;
@@ -3338,7 +3338,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
3338 discern by looking at the character code: allocate a 3338 discern by looking at the character code: allocate a
3339 256-entry transition table. */ 3339 256-entry transition table. */
3340 trtable = state->trtable = 3340 trtable = state->trtable =
3341 (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), SBC_MAX); 3341 (re_dfastate_t **) calloc (SBC_MAX, sizeof (re_dfastate_t *));
3342 if (__glibc_unlikely (trtable == NULL)) 3342 if (__glibc_unlikely (trtable == NULL))
3343 goto out_free; 3343 goto out_free;
3344 3344
@@ -3369,7 +3369,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
3369 transition tables, one starting at trtable[0] and one 3369 transition tables, one starting at trtable[0] and one
3370 starting at trtable[SBC_MAX]. */ 3370 starting at trtable[SBC_MAX]. */
3371 trtable = state->word_trtable = 3371 trtable = state->word_trtable =
3372 (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), 2 * SBC_MAX); 3372 (re_dfastate_t **) calloc (2 * SBC_MAX, sizeof (re_dfastate_t *));
3373 if (__glibc_unlikely (trtable == NULL)) 3373 if (__glibc_unlikely (trtable == NULL))
3374 goto out_free; 3374 goto out_free;
3375 3375
diff --git a/gl/sched.in.h b/gl/sched.in.h
new file mode 100644
index 00000000..cb8ceca0
--- /dev/null
+++ b/gl/sched.in.h
@@ -0,0 +1,110 @@
1/* A GNU-like <sched.h>.
2 Copyright (C) 2008-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#ifndef _@GUARD_PREFIX@_SCHED_H
18
19#if __GNUC__ >= 3
20@PRAGMA_SYSTEM_HEADER@
21#endif
22@PRAGMA_COLUMNS@
23
24/* This file uses #include_next of a system file that defines time_t.
25 For the 'year2038' module to work right, <config.h> needs to have been
26 included before. */
27#if !_GL_CONFIG_H_INCLUDED
28 #error "Please include config.h first."
29#endif
30
31/* The include_next requires a split double-inclusion guard. */
32#if @HAVE_SCHED_H@
33# if @HAVE_SYS_CDEFS_H@
34# include <sys/cdefs.h>
35# endif
36# @INCLUDE_NEXT@ @NEXT_SCHED_H@
37#endif
38
39#ifndef _@GUARD_PREFIX@_SCHED_H
40#define _@GUARD_PREFIX@_SCHED_H
41
42/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
43#if !_GL_CONFIG_H_INCLUDED
44 #error "Please include config.h first."
45#endif
46
47/* Get pid_t.
48 This is needed on glibc 2.11 (see
49 glibc bug <https://sourceware.org/PR13198>)
50 and Mac OS X 10.5. */
51#include <sys/types.h>
52
53#ifdef __KLIBC__
54/* On OS/2 kLIBC, struct sched_param is in spawn.h. */
55# include <spawn.h>
56#endif
57
58#ifdef __VMS
59/* On OpenVMS, struct sched_param is in <pthread.h>. */
60# include <pthread.h>
61#endif
62
63/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
64
65/* The definition of _GL_WARN_ON_USE is copied here. */
66
67#if !@HAVE_STRUCT_SCHED_PARAM@
68
69# if !GNULIB_defined_struct_sched_param
70struct sched_param
71{
72 int sched_priority;
73};
74# define GNULIB_defined_struct_sched_param 1
75# endif
76
77#endif
78
79#if !(defined SCHED_FIFO && defined SCHED_RR && defined SCHED_OTHER)
80# define SCHED_FIFO 1
81# define SCHED_RR 2
82# define SCHED_OTHER 0
83#endif
84
85#if @GNULIB_SCHED_YIELD@
86# if @REPLACE_SCHED_YIELD@
87# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
88# undef sched_yield
89# define sched_yield rpl_sched_yield
90# endif
91_GL_FUNCDECL_RPL (sched_yield, int, (void), );
92_GL_CXXALIAS_RPL (sched_yield, int, (void));
93# else
94# if !@HAVE_SCHED_YIELD@
95_GL_FUNCDECL_SYS (sched_yield, int, (void), );
96# endif
97_GL_CXXALIAS_SYS (sched_yield, int, (void));
98# endif
99# if __GLIBC__ >= 2
100_GL_CXXALIASWARN (sched_yield);
101# endif
102#elif defined GNULIB_POSIXCHECK
103# if HAVE_RAW_DECL_SCHED_YIELD
104_GL_WARN_ON_USE (sched_yield, "sched_yield is not portable - "
105 "use gnulib module sched_yield for portability");
106# endif
107#endif
108
109#endif /* _@GUARD_PREFIX@_SCHED_H */
110#endif /* _@GUARD_PREFIX@_SCHED_H */
diff --git a/gl/setenv.c b/gl/setenv.c
index 9e2e9e2f..ae53146f 100644
--- a/gl/setenv.c
+++ b/gl/setenv.c
@@ -1,4 +1,4 @@
1/* Copyright (C) 1992, 1995-2003, 2005-2024 Free Software Foundation, Inc. 1/* Copyright (C) 1992, 1995-2003, 2005-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library. 2 This file is part of the GNU C Library.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
@@ -38,11 +38,23 @@
38# include <unistd.h> 38# include <unistd.h>
39#endif 39#endif
40 40
41#if defined _WIN32 && ! defined __CYGWIN__
42# define WIN32_LEAN_AND_MEAN
43# include <windows.h>
44#endif
45
41#if !_LIBC 46#if !_LIBC
42# include "malloca.h" 47# include "malloca.h"
43#endif 48#endif
44 49
50#if defined _WIN32 && ! defined __CYGWIN__
51/* Don't assume that UNICODE is not defined. */
52# undef SetEnvironmentVariable
53# define SetEnvironmentVariable SetEnvironmentVariableA
54#endif
55
45#if _LIBC || !HAVE_SETENV 56#if _LIBC || !HAVE_SETENV
57#if !HAVE_DECL__PUTENV
46 58
47#if !_LIBC 59#if !_LIBC
48# define __environ environ 60# define __environ environ
@@ -114,8 +126,6 @@ int
114__add_to_environ (const char *name, const char *value, const char *combined, 126__add_to_environ (const char *name, const char *value, const char *combined,
115 int replace) 127 int replace)
116{ 128{
117 char **ep;
118 size_t size;
119 const size_t namelen = strlen (name); 129 const size_t namelen = strlen (name);
120 const size_t vallen = value != NULL ? strlen (value) + 1 : 0; 130 const size_t vallen = value != NULL ? strlen (value) + 1 : 0;
121 131
@@ -123,9 +133,9 @@ __add_to_environ (const char *name, const char *value, const char *combined,
123 133
124 /* We have to get the pointer now that we have the lock and not earlier 134 /* We have to get the pointer now that we have the lock and not earlier
125 since another thread might have created a new environment. */ 135 since another thread might have created a new environment. */
126 ep = __environ; 136 char **ep = __environ;
127 137
128 size = 0; 138 size_t size = 0;
129 if (ep != NULL) 139 if (ep != NULL)
130 { 140 {
131 for (; *ep != NULL; ++ep) 141 for (; *ep != NULL; ++ep)
@@ -137,13 +147,8 @@ __add_to_environ (const char *name, const char *value, const char *combined,
137 147
138 if (ep == NULL || *ep == NULL) 148 if (ep == NULL || *ep == NULL)
139 { 149 {
140 char **new_environ;
141#ifdef USE_TSEARCH
142 char *new_value;
143#endif
144
145 /* We allocated this space; we can extend it. */ 150 /* We allocated this space; we can extend it. */
146 new_environ = 151 char **new_environ =
147 (char **) (last_environ == NULL 152 (char **) (last_environ == NULL
148 ? malloc ((size + 2) * sizeof (char *)) 153 ? malloc ((size + 2) * sizeof (char *))
149 : realloc (last_environ, (size + 2) * sizeof (char *))); 154 : realloc (last_environ, (size + 2) * sizeof (char *)));
@@ -165,6 +170,7 @@ __add_to_environ (const char *name, const char *value, const char *combined,
165 { 170 {
166 /* See whether the value is already known. */ 171 /* See whether the value is already known. */
167#ifdef USE_TSEARCH 172#ifdef USE_TSEARCH
173 char *new_value;
168# ifdef _LIBC 174# ifdef _LIBC
169 new_value = (char *) alloca (namelen + 1 + vallen); 175 new_value = (char *) alloca (namelen + 1 + vallen);
170 __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1), 176 __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
@@ -215,8 +221,7 @@ __add_to_environ (const char *name, const char *value, const char *combined,
215 } 221 }
216 222
217 if (__environ != last_environ) 223 if (__environ != last_environ)
218 memcpy ((char *) new_environ, (char *) __environ, 224 memcpy (new_environ, __environ, size * sizeof (char *));
219 size * sizeof (char *));
220 225
221 new_environ[size + 1] = NULL; 226 new_environ[size + 1] = NULL;
222 227
@@ -343,6 +348,84 @@ weak_alias (__setenv, setenv)
343weak_alias (__clearenv, clearenv) 348weak_alias (__clearenv, clearenv)
344#endif 349#endif
345 350
351#else /* HAVE_DECL__PUTENV */
352/* Native Windows */
353
354int
355setenv (const char *name, const char *value, int replace)
356{
357 if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
358 {
359 errno = EINVAL;
360 return -1;
361 }
362
363 /* The Microsoft documentation
364 <https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/putenv-wputenv>
365 says:
366 "Don't change an environment entry directly: instead,
367 use _putenv or _wputenv to change it."
368 Note: Microsoft's _putenv updates not only the contents of _environ but
369 also the contents of _wenviron, so that both are in kept in sync. */
370 const char *existing_value = getenv (name);
371 if (existing_value != NULL)
372 {
373 if (replace)
374 {
375 if (strcmp (existing_value, value) == 0)
376 /* No need to allocate memory. */
377 return 0;
378 }
379 else
380 /* Keep the existing value. */
381 return 0;
382 }
383 /* Allocate a new environment entry in the heap. */
384 /* _putenv ("NAME=") unsets NAME, so if VALUE is the empty string, invoke
385 _putenv ("NAME= ") and fix up the result afterwards. */
386 const char *value_ = (value[0] == '\0' ? " " : value);
387 size_t name_len = strlen (name);
388 size_t value_len = strlen (value_);
389 char *string = (char *) malloc (name_len + 1 + value_len + 1);
390 if (string == NULL)
391 return -1;
392 memcpy (string, name, name_len);
393 string[name_len] = '=';
394 memcpy (&string[name_len + 1], value_, value_len + 1);
395 /* Use _putenv. */
396 if (_putenv (string) < 0)
397 return -1;
398 if (value[0] == '\0')
399 {
400 /* Fix up the result. */
401 char *new_value = getenv (name);
402 if (new_value != NULL && new_value[0] == ' ' && new_value[1] == '\0')
403 new_value[0] = '\0';
404# if defined _WIN32 && ! defined __CYGWIN__
405 /* _putenv propagated "NAME= " into the subprocess environment;
406 fix that by calling SetEnvironmentVariable directly. */
407 /* Documentation:
408 <https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setenvironmentvariable> */
409 if (!SetEnvironmentVariable (name, ""))
410 {
411 switch (GetLastError ())
412 {
413 case ERROR_NOT_ENOUGH_MEMORY:
414 case ERROR_OUTOFMEMORY:
415 errno = ENOMEM;
416 break;
417 default:
418 errno = EINVAL;
419 break;
420 }
421 return -1;
422 }
423# endif
424 }
425 return 0;
426}
427
428#endif /* HAVE_DECL__PUTENV */
346#endif /* _LIBC || !HAVE_SETENV */ 429#endif /* _LIBC || !HAVE_SETENV */
347 430
348/* The rest of this file is called into use when replacing an existing 431/* The rest of this file is called into use when replacing an existing
@@ -359,21 +442,19 @@ extern int setenv (const char *, const char *, int);
359int 442int
360rpl_setenv (const char *name, const char *value, int replace) 443rpl_setenv (const char *name, const char *value, int replace)
361{ 444{
362 int result; 445 if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
363 if (!name || !*name || strchr (name, '='))
364 { 446 {
365 errno = EINVAL; 447 errno = EINVAL;
366 return -1; 448 return -1;
367 } 449 }
368 /* Call the real setenv even if replace is 0, in case implementation 450 /* Call the real setenv even if replace is 0, in case implementation
369 has underlying data to update, such as when environ changes. */ 451 has underlying data to update, such as when environ changes. */
370 result = setenv (name, value, replace); 452 int result = setenv (name, value, replace);
371 if (result == 0 && replace && *value == '=') 453 if (result == 0 && replace && *value == '=')
372 { 454 {
373 char *tmp = getenv (name); 455 char *tmp = getenv (name);
374 if (!STREQ (tmp, value)) 456 if (!STREQ (tmp, value))
375 { 457 {
376 int saved_errno;
377 size_t len = strlen (value); 458 size_t len = strlen (value);
378 tmp = malloca (len + 2); 459 tmp = malloca (len + 2);
379 if (tmp == NULL) 460 if (tmp == NULL)
@@ -385,7 +466,7 @@ rpl_setenv (const char *name, const char *value, int replace)
385 *tmp = '='; 466 *tmp = '=';
386 memcpy (tmp + 1, value, len + 1); 467 memcpy (tmp + 1, value, len + 1);
387 result = setenv (name, tmp, replace); 468 result = setenv (name, tmp, replace);
388 saved_errno = errno; 469 int saved_errno = errno;
389 freea (tmp); 470 freea (tmp);
390 errno = saved_errno; 471 errno = saved_errno;
391 } 472 }
diff --git a/gl/setlocale-lock.c b/gl/setlocale-lock.c
index 192489c4..afbcc046 100644
--- a/gl/setlocale-lock.c
+++ b/gl/setlocale-lock.c
@@ -1,5 +1,5 @@
1/* Return the internal lock used by setlocale_null_r. 1/* Return the internal lock used by setlocale_null_r.
2 Copyright (C) 2019-2024 Free Software Foundation, Inc. 2 Copyright (C) 2019-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/setlocale_null-unlocked.c b/gl/setlocale_null-unlocked.c
index 0a86f0df..e7f155c7 100644
--- a/gl/setlocale_null-unlocked.c
+++ b/gl/setlocale_null-unlocked.c
@@ -1,5 +1,5 @@
1/* Query the name of the current global locale, without locking. 1/* Query the name of the current global locale, without locking.
2 Copyright (C) 2019-2024 Free Software Foundation, Inc. 2 Copyright (C) 2019-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -86,10 +86,8 @@ setlocale_null_r_unlocked (int category, char *buf, size_t bufsize)
86 size_t length = wcslen (result); 86 size_t length = wcslen (result);
87 if (length < bufsize) 87 if (length < bufsize)
88 { 88 {
89 size_t i;
90
91 /* Convert wchar_t[] -> char[], assuming plain ASCII. */ 89 /* Convert wchar_t[] -> char[], assuming plain ASCII. */
92 for (i = 0; i <= length; i++) 90 for (size_t i = 0; i <= length; i++)
93 buf[i] = result[i]; 91 buf[i] = result[i];
94 92
95 return 0; 93 return 0;
@@ -101,10 +99,8 @@ setlocale_null_r_unlocked (int category, char *buf, size_t bufsize)
101 /* Return a truncated result in BUF. 99 /* Return a truncated result in BUF.
102 This is a convenience for callers that don't want to write 100 This is a convenience for callers that don't want to write
103 explicit code for handling ERANGE. */ 101 explicit code for handling ERANGE. */
104 size_t i;
105
106 /* Convert wchar_t[] -> char[], assuming plain ASCII. */ 102 /* Convert wchar_t[] -> char[], assuming plain ASCII. */
107 for (i = 0; i < bufsize; i++) 103 for (size_t i = 0; i < bufsize; i++)
108 buf[i] = result[i]; 104 buf[i] = result[i];
109 buf[bufsize - 1] = '\0'; 105 buf[bufsize - 1] = '\0';
110 } 106 }
diff --git a/gl/setlocale_null.c b/gl/setlocale_null.c
index 5ecf413d..39b6766c 100644
--- a/gl/setlocale_null.c
+++ b/gl/setlocale_null.c
@@ -1,5 +1,5 @@
1/* Query the name of the current global locale. 1/* Query the name of the current global locale.
2 Copyright (C) 2019-2024 Free Software Foundation, Inc. 2 Copyright (C) 2019-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -77,10 +77,9 @@ static int
77setlocale_null_r_with_lock (int category, char *buf, size_t bufsize) 77setlocale_null_r_with_lock (int category, char *buf, size_t bufsize)
78{ 78{
79 CRITICAL_SECTION *lock = gl_get_setlocale_null_lock (); 79 CRITICAL_SECTION *lock = gl_get_setlocale_null_lock ();
80 int ret;
81 80
82 EnterCriticalSection (lock); 81 EnterCriticalSection (lock);
83 ret = setlocale_null_r_unlocked (category, buf, bufsize); 82 int ret = setlocale_null_r_unlocked (category, buf, bufsize);
84 LeaveCriticalSection (lock); 83 LeaveCriticalSection (lock);
85 84
86 return ret; 85 return ret;
@@ -116,11 +115,10 @@ setlocale_null_r_with_lock (int category, char *buf, size_t bufsize)
116 if (pthread_in_use()) 115 if (pthread_in_use())
117 { 116 {
118 pthread_mutex_t *lock = gl_get_setlocale_null_lock (); 117 pthread_mutex_t *lock = gl_get_setlocale_null_lock ();
119 int ret;
120 118
121 if (pthread_mutex_lock (lock)) 119 if (pthread_mutex_lock (lock))
122 abort (); 120 abort ();
123 ret = setlocale_null_r_unlocked (category, buf, bufsize); 121 int ret = setlocale_null_r_unlocked (category, buf, bufsize);
124 if (pthread_mutex_unlock (lock)) 122 if (pthread_mutex_unlock (lock))
125 abort (); 123 abort ();
126 124
@@ -138,11 +136,10 @@ static int
138setlocale_null_r_with_lock (int category, char *buf, size_t bufsize) 136setlocale_null_r_with_lock (int category, char *buf, size_t bufsize)
139{ 137{
140 mtx_t *lock = gl_get_setlocale_null_lock (); 138 mtx_t *lock = gl_get_setlocale_null_lock ();
141 int ret;
142 139
143 if (mtx_lock (lock) != thrd_success) 140 if (mtx_lock (lock) != thrd_success)
144 abort (); 141 abort ();
145 ret = setlocale_null_r_unlocked (category, buf, bufsize); 142 int ret = setlocale_null_r_unlocked (category, buf, bufsize);
146 if (mtx_unlock (lock) != thrd_success) 143 if (mtx_unlock (lock) != thrd_success)
147 abort (); 144 abort ();
148 145
@@ -252,9 +249,7 @@ setlocale_null (int category)
252 i; 249 i;
253 char buf[SETLOCALE_NULL_MAX]; 250 char buf[SETLOCALE_NULL_MAX];
254 static char resultbuf[LC_INDICES_COUNT][SETLOCALE_NULL_MAX]; 251 static char resultbuf[LC_INDICES_COUNT][SETLOCALE_NULL_MAX];
255 int err; 252 int err = setlocale_null_r (category, buf, sizeof (buf));
256
257 err = setlocale_null_r (category, buf, sizeof (buf));
258 if (err == EINVAL) 253 if (err == EINVAL)
259 return NULL; 254 return NULL;
260 if (err) 255 if (err)
diff --git a/gl/setlocale_null.h b/gl/setlocale_null.h
index 966c53cf..dbd646b3 100644
--- a/gl/setlocale_null.h
+++ b/gl/setlocale_null.h
@@ -1,5 +1,5 @@
1/* Query the name of the current global locale. 1/* Query the name of the current global locale.
2 Copyright (C) 2019-2024 Free Software Foundation, Inc. 2 Copyright (C) 2019-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/sha256-stream.c b/gl/sha256-stream.c
index 08d24b7b..011b36e2 100644
--- a/gl/sha256-stream.c
+++ b/gl/sha256-stream.c
@@ -1,7 +1,7 @@
1/* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or 1/* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or
2 memory blocks according to the NIST specification FIPS-180-2. 2 memory blocks according to the NIST specification FIPS-180-2.
3 3
4 Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. 4 Copyright (C) 2005-2006, 2008-2026 Free Software Foundation, Inc.
5 5
6 This file is free software: you can redistribute it and/or modify 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 7 it under the terms of the GNU Lesser General Public License as
@@ -23,9 +23,6 @@
23#include <config.h> 23#include <config.h>
24 24
25/* Specification. */ 25/* Specification. */
26#if HAVE_OPENSSL_SHA256
27# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE
28#endif
29#include "sha256.h" 26#include "sha256.h"
30 27
31#include <stdlib.h> 28#include <stdlib.h>
@@ -70,7 +67,6 @@ shaxxx_stream (FILE *stream, char const *alg, void *resblock,
70 /* We read the file in blocks of BLOCKSIZE bytes. One call of the 67 /* We read the file in blocks of BLOCKSIZE bytes. One call of the
71 computation function processes the whole buffer so that with the 68 computation function processes the whole buffer so that with the
72 next round of the loop another block can be read. */ 69 next round of the loop another block can be read. */
73 size_t n;
74 sum = 0; 70 sum = 0;
75 71
76 /* Read block. Take care for partial reads. */ 72 /* Read block. Take care for partial reads. */
@@ -80,11 +76,11 @@ shaxxx_stream (FILE *stream, char const *alg, void *resblock,
80 or the fread() in afalg_stream may have gotten EOF. 76 or the fread() in afalg_stream may have gotten EOF.
81 We need to avoid a subsequent fread() as EOF may 77 We need to avoid a subsequent fread() as EOF may
82 not be sticky. For details of such systems, see: 78 not be sticky. For details of such systems, see:
83 https://sourceware.org/bugzilla/show_bug.cgi?id=1190 */ 79 https://sourceware.org/PR1190 */
84 if (feof (stream)) 80 if (feof (stream))
85 goto process_partial_block; 81 goto process_partial_block;
86 82
87 n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); 83 size_t n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
88 84
89 sum += n; 85 sum += n;
90 86
@@ -136,10 +132,3 @@ sha224_stream (FILE *stream, void *resblock)
136 return shaxxx_stream (stream, "sha224", resblock, SHA224_DIGEST_SIZE, 132 return shaxxx_stream (stream, "sha224", resblock, SHA224_DIGEST_SIZE,
137 sha224_init_ctx, sha224_finish_ctx); 133 sha224_init_ctx, sha224_finish_ctx);
138} 134}
139
140/*
141 * Hey Emacs!
142 * Local Variables:
143 * coding: utf-8
144 * End:
145 */
diff --git a/gl/sha256.c b/gl/sha256.c
index fe7c5446..bada2d07 100644
--- a/gl/sha256.c
+++ b/gl/sha256.c
@@ -1,7 +1,7 @@
1/* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or 1/* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or
2 memory blocks according to the NIST specification FIPS-180-2. 2 memory blocks according to the NIST specification FIPS-180-2.
3 3
4 Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. 4 Copyright (C) 2005-2006, 2008-2026 Free Software Foundation, Inc.
5 5
6 This file is free software: you can redistribute it and/or modify 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 7 it under the terms of the GNU Lesser General Public License as
@@ -96,10 +96,9 @@ set_uint32 (char *cp, uint32_t v)
96void * 96void *
97sha256_read_ctx (const struct sha256_ctx *ctx, void *resbuf) 97sha256_read_ctx (const struct sha256_ctx *ctx, void *resbuf)
98{ 98{
99 int i;
100 char *r = resbuf; 99 char *r = resbuf;
101 100
102 for (i = 0; i < 8; i++) 101 for (int i = 0; i < 8; i++)
103 set_uint32 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i])); 102 set_uint32 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
104 103
105 return resbuf; 104 return resbuf;
@@ -108,10 +107,9 @@ sha256_read_ctx (const struct sha256_ctx *ctx, void *resbuf)
108void * 107void *
109sha224_read_ctx (const struct sha256_ctx *ctx, void *resbuf) 108sha224_read_ctx (const struct sha256_ctx *ctx, void *resbuf)
110{ 109{
111 int i;
112 char *r = resbuf; 110 char *r = resbuf;
113 111
114 for (i = 0; i < 7; i++) 112 for (int i = 0; i < 7; i++)
115 set_uint32 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i])); 113 set_uint32 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
116 114
117 return resbuf; 115 return resbuf;
@@ -326,8 +324,8 @@ sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx)
326 + S0(x[(I-15)&0x0f]) + x[I&0x0f] \ 324 + S0(x[(I-15)&0x0f]) + x[I&0x0f] \
327 , x[I&0x0f] = tm ) 325 , x[I&0x0f] = tm )
328 326
329#define R(A,B,C,D,E,F,G,H,K,M) do { t0 = SS0(A) + F2(A,B,C); \ 327#define R(A,B,C,D,E,F,G,H,K,M) do { uint32_t t0 = SS0(A) + F2(A,B,C); \
330 t1 = H + SS1(E) \ 328 uint32_t t1 = H + SS1(E) \
331 + F1(E,F,G) \ 329 + F1(E,F,G) \
332 + K \ 330 + K \
333 + M; \ 331 + M; \
@@ -336,16 +334,15 @@ sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx)
336 334
337 while (words < endp) 335 while (words < endp)
338 { 336 {
339 uint32_t tm;
340 uint32_t t0, t1;
341 int t;
342 /* FIXME: see sha1.c for a better implementation. */ 337 /* FIXME: see sha1.c for a better implementation. */
343 for (t = 0; t < 16; t++) 338 for (int t = 0; t < 16; t++)
344 { 339 {
345 x[t] = SWAP (*words); 340 x[t] = SWAP (*words);
346 words++; 341 words++;
347 } 342 }
348 343
344 uint32_t tm;
345
349 R( a, b, c, d, e, f, g, h, K( 0), x[ 0] ); 346 R( a, b, c, d, e, f, g, h, K( 0), x[ 0] );
350 R( h, a, b, c, d, e, f, g, K( 1), x[ 1] ); 347 R( h, a, b, c, d, e, f, g, K( 1), x[ 1] );
351 R( g, h, a, b, c, d, e, f, K( 2), x[ 2] ); 348 R( g, h, a, b, c, d, e, f, K( 2), x[ 2] );
diff --git a/gl/sha256.h b/gl/sha256.h
index a9d7abb8..db80ea5e 100644
--- a/gl/sha256.h
+++ b/gl/sha256.h
@@ -1,6 +1,6 @@
1/* Declarations of functions and data types used for SHA256 and SHA224 sum 1/* Declarations of functions and data types used for SHA256 and SHA224 sum
2 library functions. 2 library functions.
3 Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. 3 Copyright (C) 2005-2006, 2008-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/size_max.h b/gl/size_max.h
index bd2eb43e..b627e5ff 100644
--- a/gl/size_max.h
+++ b/gl/size_max.h
@@ -1,5 +1,5 @@
1/* size_max.h -- declare SIZE_MAX through system headers 1/* size_max.h -- declare SIZE_MAX through system headers
2 Copyright (C) 2005-2006, 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 2005-2006, 2009-2026 Free Software Foundation, Inc.
3 Written by Simon Josefsson. 3 Written by Simon Josefsson.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
diff --git a/gl/snprintf.c b/gl/snprintf.c
index c1b93562..58ad5d7a 100644
--- a/gl/snprintf.c
+++ b/gl/snprintf.c
@@ -1,6 +1,5 @@
1/* Formatted output to strings. 1/* Formatted output to strings.
2 Copyright (C) 2004, 2006-2024 Free Software Foundation, Inc. 2 Copyright (C) 2004, 2006-2026 Free Software Foundation, Inc.
3 Written by Simon Josefsson and Paul Eggert.
4 3
5 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -23,49 +22,23 @@
23#include <errno.h> 22#include <errno.h>
24#include <limits.h> 23#include <limits.h>
25#include <stdarg.h> 24#include <stdarg.h>
26#include <stdlib.h> 25#include <stdint.h>
27#include <string.h>
28 26
29#include "vasnprintf.h"
30
31/* Print formatted output to string STR. Similar to sprintf, but
32 additional length SIZE limit how much is written into STR. Returns
33 string length of formatted string (which may be larger than SIZE).
34 STR may be NULL, in which case nothing will be written. On error,
35 return a negative value. */
36int 27int
37snprintf (char *str, size_t size, const char *format, ...) 28snprintf (char *str, size_t size, const char *format, ...)
38{ 29{
39 char *output;
40 size_t len;
41 size_t lenbuf = size;
42 va_list args; 30 va_list args;
43
44 va_start (args, format); 31 va_start (args, format);
45 output = vasnprintf (str, &lenbuf, format, args); 32 ptrdiff_t ret = vsnzprintf (str, size, format, args);
46 len = lenbuf;
47 va_end (args); 33 va_end (args);
48 34
49 if (!output) 35#if PTRDIFF_MAX > INT_MAX
50 return -1; 36 if (ret > INT_MAX)
51
52 if (output != str)
53 {
54 if (size)
55 {
56 size_t pruned_len = (len < size ? len : size - 1);
57 memcpy (str, output, pruned_len);
58 str[pruned_len] = '\0';
59 }
60
61 free (output);
62 }
63
64 if (INT_MAX < len)
65 { 37 {
66 errno = EOVERFLOW; 38 errno = EOVERFLOW;
67 return -1; 39 return -1;
68 } 40 }
41#endif
69 42
70 return len; 43 return ret;
71} 44}
diff --git a/gl/sockets.c b/gl/sockets.c
index 92beb7d3..ce98698d 100644
--- a/gl/sockets.c
+++ b/gl/sockets.c
@@ -1,6 +1,6 @@
1/* sockets.c --- wrappers for Windows socket functions 1/* sockets.c --- wrappers for Windows socket functions
2 2
3 Copyright (C) 2008-2024 Free Software Foundation, Inc. 3 Copyright (C) 2008-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -46,11 +46,10 @@ close_fd_maybe_socket (const struct fd_hook *remaining_list,
46 our calls to closesocket() and the primary close(), some other thread 46 our calls to closesocket() and the primary close(), some other thread
47 could make system calls that allocate precisely the same HANDLE value 47 could make system calls that allocate precisely the same HANDLE value
48 as sock; then the primary close() would call CloseHandle() on it. */ 48 as sock; then the primary close() would call CloseHandle() on it. */
49 SOCKET sock;
50 WSANETWORKEVENTS ev;
51 49
52 /* Test whether fd refers to a socket. */ 50 /* Test whether fd refers to a socket. */
53 sock = FD_TO_SOCKET (fd); 51 SOCKET sock = FD_TO_SOCKET (fd);
52 WSANETWORKEVENTS ev;
54 ev.lNetworkEvents = 0xDEADBEEF; 53 ev.lNetworkEvents = 0xDEADBEEF;
55 WSAEnumNetworkEvents (sock, NULL, &ev); 54 WSAEnumNetworkEvents (sock, NULL, &ev);
56 if (ev.lNetworkEvents != 0xDEADBEEF) 55 if (ev.lNetworkEvents != 0xDEADBEEF)
@@ -83,11 +82,9 @@ ioctl_fd_maybe_socket (const struct fd_hook *remaining_list,
83 gl_ioctl_fn primary, 82 gl_ioctl_fn primary,
84 int fd, int request, void *arg) 83 int fd, int request, void *arg)
85{ 84{
86 SOCKET sock;
87 WSANETWORKEVENTS ev;
88
89 /* Test whether fd refers to a socket. */ 85 /* Test whether fd refers to a socket. */
90 sock = FD_TO_SOCKET (fd); 86 SOCKET sock = FD_TO_SOCKET (fd);
87 WSANETWORKEVENTS ev;
91 ev.lNetworkEvents = 0xDEADBEEF; 88 ev.lNetworkEvents = 0xDEADBEEF;
92 WSAEnumNetworkEvents (sock, NULL, &ev); 89 WSAEnumNetworkEvents (sock, NULL, &ev);
93 if (ev.lNetworkEvents != 0xDEADBEEF) 90 if (ev.lNetworkEvents != 0xDEADBEEF)
@@ -119,9 +116,7 @@ gl_sockets_startup (_GL_UNUSED int version)
119 if (version > initialized_sockets_version) 116 if (version > initialized_sockets_version)
120 { 117 {
121 WSADATA data; 118 WSADATA data;
122 int err; 119 int err = WSAStartup (version, &data);
123
124 err = WSAStartup (version, &data);
125 if (err != 0) 120 if (err != 0)
126 return 1; 121 return 1;
127 122
@@ -146,13 +141,11 @@ int
146gl_sockets_cleanup (void) 141gl_sockets_cleanup (void)
147{ 142{
148#if WINDOWS_SOCKETS 143#if WINDOWS_SOCKETS
149 int err;
150
151 initialized_sockets_version = 0; 144 initialized_sockets_version = 0;
152 145
153 unregister_fd_hook (&fd_sockets_hook); 146 unregister_fd_hook (&fd_sockets_hook);
154 147
155 err = WSACleanup (); 148 int err = WSACleanup ();
156 if (err != 0) 149 if (err != 0)
157 return 1; 150 return 1;
158#endif 151#endif
diff --git a/gl/sockets.h b/gl/sockets.h
index 55077ae9..ed12cf9a 100644
--- a/gl/sockets.h
+++ b/gl/sockets.h
@@ -1,6 +1,6 @@
1/* sockets.h - wrappers for Windows socket functions 1/* sockets.h - wrappers for Windows socket functions
2 2
3 Copyright (C) 2008-2024 Free Software Foundation, Inc. 3 Copyright (C) 2008-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -52,7 +52,7 @@ int gl_sockets_cleanup (void)
52#endif 52#endif
53 53
54 54
55/* This function is useful it you create a socket using gnulib's 55/* This function is useful if you create a socket using gnulib's
56 Winsock wrappers but needs to pass on the socket handle to some 56 Winsock wrappers but needs to pass on the socket handle to some
57 other library that only accepts sockets. */ 57 other library that only accepts sockets. */
58#ifdef WINDOWS_SOCKETS 58#ifdef WINDOWS_SOCKETS
diff --git a/gl/stat-time.c b/gl/stat-time.c
index 1ab01f53..9dcdc377 100644
--- a/gl/stat-time.c
+++ b/gl/stat-time.c
@@ -1,6 +1,6 @@
1/* stat-related time functions. 1/* stat-related time functions.
2 2
3 Copyright (C) 2012-2024 Free Software Foundation, Inc. 3 Copyright (C) 2012-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -15,7 +15,6 @@
15 You should have received a copy of the GNU Lesser General Public License 15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 17
18#include <config.h>
19
20#define _GL_STAT_TIME_INLINE _GL_EXTERN_INLINE 18#define _GL_STAT_TIME_INLINE _GL_EXTERN_INLINE
19#include <config.h>
21#include "stat-time.h" 20#include "stat-time.h"
diff --git a/gl/stat-time.h b/gl/stat-time.h
index 3cd8478f..45364316 100644
--- a/gl/stat-time.h
+++ b/gl/stat-time.h
@@ -1,6 +1,6 @@
1/* stat-related time functions. 1/* stat-related time functions.
2 2
3 Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc. 3 Copyright (C) 2005, 2007, 2009-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -117,6 +117,31 @@ get_stat_birthtime_ns (_GL_UNUSED struct stat const *st)
117# endif 117# endif
118} 118}
119 119
120/* Constructs a 'struct timespec' with the given contents.
121 This macro / function is private to stat-time.h. */
122#if !defined __cplusplus
123/* Use a C99 compound literal.
124 This is guaranteed to initialize also the padding bits, for example on
125 platforms where tv_sec is 64 bits and tv_nsec is 32 bits, thus avoiding
126 gcc -Wuse-of-uninitialized-value warnings. */
127# define _gl_make_timespec(sec,nsec) \
128 (struct timespec) { .tv_sec = (sec), .tv_nsec = (nsec) }
129#else
130/* C++ does not have C99 compound literals.
131 A constructor invocation
132 timespec { (sec), (nsec) }
133 would make assumptions about the order of the fields of 'struct timespec',
134 which are not guaranteed by POSIX. So, use an inline function. */
135static inline struct timespec
136_gl_make_timespec (time_t sec, long nsec)
137{
138 struct timespec ts;
139 ts.tv_sec = sec;
140 ts.tv_nsec = nsec;
141 return ts;
142}
143#endif
144
120/* Return *ST's access time. */ 145/* Return *ST's access time. */
121_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE 146_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE
122get_stat_atime (struct stat const *st) 147get_stat_atime (struct stat const *st)
@@ -124,8 +149,7 @@ get_stat_atime (struct stat const *st)
124#ifdef STAT_TIMESPEC 149#ifdef STAT_TIMESPEC
125 return STAT_TIMESPEC (st, st_atim); 150 return STAT_TIMESPEC (st, st_atim);
126#else 151#else
127 return (struct timespec) { .tv_sec = st->st_atime, 152 return _gl_make_timespec (st->st_atime, get_stat_atime_ns (st));
128 .tv_nsec = get_stat_atime_ns (st) };
129#endif 153#endif
130} 154}
131 155
@@ -136,8 +160,7 @@ get_stat_ctime (struct stat const *st)
136#ifdef STAT_TIMESPEC 160#ifdef STAT_TIMESPEC
137 return STAT_TIMESPEC (st, st_ctim); 161 return STAT_TIMESPEC (st, st_ctim);
138#else 162#else
139 return (struct timespec) { .tv_sec = st->st_ctime, 163 return _gl_make_timespec (st->st_ctime, get_stat_ctime_ns (st));
140 .tv_nsec = get_stat_ctime_ns (st) };
141#endif 164#endif
142} 165}
143 166
@@ -148,8 +171,7 @@ get_stat_mtime (struct stat const *st)
148#ifdef STAT_TIMESPEC 171#ifdef STAT_TIMESPEC
149 return STAT_TIMESPEC (st, st_mtim); 172 return STAT_TIMESPEC (st, st_mtim);
150#else 173#else
151 return (struct timespec) { .tv_sec = st->st_mtime, 174 return _gl_make_timespec (st->st_mtime, get_stat_mtime_ns (st));
152 .tv_nsec = get_stat_mtime_ns (st) };
153#endif 175#endif
154} 176}
155 177
@@ -164,8 +186,7 @@ get_stat_birthtime (_GL_UNUSED struct stat const *st)
164 || defined HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC) 186 || defined HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC)
165 t = STAT_TIMESPEC (st, st_birthtim); 187 t = STAT_TIMESPEC (st, st_birthtim);
166#elif defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC 188#elif defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC
167 t = (struct timespec) { .tv_sec = st->st_birthtime, 189 t = _gl_make_timespec (st->st_birthtime, st->st_birthtimensec);
168 .tv_nsec = st->st_birthtimensec };
169#elif defined _WIN32 && ! defined __CYGWIN__ 190#elif defined _WIN32 && ! defined __CYGWIN__
170 /* Native Windows platforms (but not Cygwin) put the "file creation 191 /* Native Windows platforms (but not Cygwin) put the "file creation
171 time" in st_ctime (!). See 192 time" in st_ctime (!). See
@@ -173,11 +194,11 @@ get_stat_birthtime (_GL_UNUSED struct stat const *st)
173# if _GL_WINDOWS_STAT_TIMESPEC 194# if _GL_WINDOWS_STAT_TIMESPEC
174 t = st->st_ctim; 195 t = st->st_ctim;
175# else 196# else
176 t = (struct timespec) { .tv_sec = st->st_ctime }; 197 t = _gl_make_timespec (st->st_ctime, 0);
177# endif 198# endif
178#else 199#else
179 /* Birth time is not supported. */ 200 /* Birth time is not supported. */
180 t = (struct timespec) { .tv_sec = -1, .tv_nsec = -1 }; 201 t = _gl_make_timespec (-1, -1);
181#endif 202#endif
182 203
183#if (defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC \ 204#if (defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC \
@@ -189,7 +210,7 @@ get_stat_birthtime (_GL_UNUSED struct stat const *st)
189 sometimes returns junk in the birth time fields; work around this 210 sometimes returns junk in the birth time fields; work around this
190 bug if it is detected. */ 211 bug if it is detected. */
191 if (! (t.tv_sec && 0 <= t.tv_nsec && t.tv_nsec < 1000000000)) 212 if (! (t.tv_sec && 0 <= t.tv_nsec && t.tv_nsec < 1000000000))
192 t = (struct timespec) { .tv_sec = -1, .tv_nsec = -1 }; 213 t = _gl_make_timespec (-1, -1);
193#endif 214#endif
194 215
195 return t; 216 return t;
@@ -211,8 +232,7 @@ stat_time_normalize (int result, _GL_UNUSED struct stat *st)
211 short int const ts_off[] = { STAT_TIMESPEC_OFFSETOF (st_atim), 232 short int const ts_off[] = { STAT_TIMESPEC_OFFSETOF (st_atim),
212 STAT_TIMESPEC_OFFSETOF (st_mtim), 233 STAT_TIMESPEC_OFFSETOF (st_mtim),
213 STAT_TIMESPEC_OFFSETOF (st_ctim) }; 234 STAT_TIMESPEC_OFFSETOF (st_ctim) };
214 int i; 235 for (int i = 0; i < sizeof ts_off / sizeof *ts_off; i++)
215 for (i = 0; i < sizeof ts_off / sizeof *ts_off; i++)
216 { 236 {
217 struct timespec *ts = (struct timespec *) ((char *) st + ts_off[i]); 237 struct timespec *ts = (struct timespec *) ((char *) st + ts_off[i]);
218 long int q = ts->tv_nsec / timespec_hz; 238 long int q = ts->tv_nsec / timespec_hz;
diff --git a/gl/stat-w32.c b/gl/stat-w32.c
index ddd6f598..583ef09b 100644
--- a/gl/stat-w32.c
+++ b/gl/stat-w32.c
@@ -1,5 +1,5 @@
1/* Core of implementation of fstat and stat for native Windows. 1/* Core of implementation of fstat and stat for native Windows.
2 Copyright (C) 2017-2024 Free Software Foundation, Inc. 2 Copyright (C) 2017-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -112,11 +112,11 @@ initialize (void)
112struct timespec 112struct timespec
113_gl_convert_FILETIME_to_timespec (const FILETIME *ft) 113_gl_convert_FILETIME_to_timespec (const FILETIME *ft)
114{ 114{
115 struct timespec result;
116 /* FILETIME: <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-filetime> */ 115 /* FILETIME: <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-filetime> */
117 unsigned long long since_1601 = 116 unsigned long long since_1601 =
118 ((unsigned long long) ft->dwHighDateTime << 32) 117 ((unsigned long long) ft->dwHighDateTime << 32)
119 | (unsigned long long) ft->dwLowDateTime; 118 | (unsigned long long) ft->dwLowDateTime;
119 struct timespec result;
120 if (since_1601 == 0) 120 if (since_1601 == 0)
121 { 121 {
122 result.tv_sec = 0; 122 result.tv_sec = 0;
@@ -289,8 +289,7 @@ _gl_fstat_by_handle (HANDLE h, const char *path, struct stat *buf)
289 && (path = fpath, 1))) 289 && (path = fpath, 1)))
290 { 290 {
291 const char *last_dot = NULL; 291 const char *last_dot = NULL;
292 const char *p; 292 for (const char *p = path; *p != '\0'; p++)
293 for (p = path; *p != '\0'; p++)
294 if (*p == '.') 293 if (*p == '.')
295 last_dot = p; 294 last_dot = p;
296 if (last_dot != NULL) 295 if (last_dot != NULL)
diff --git a/gl/stat-w32.h b/gl/stat-w32.h
index 392faed1..f5cc82f4 100644
--- a/gl/stat-w32.h
+++ b/gl/stat-w32.h
@@ -1,5 +1,5 @@
1/* Core of implementation of fstat and stat for native Windows. 1/* Core of implementation of fstat and stat for native Windows.
2 Copyright (C) 2017-2024 Free Software Foundation, Inc. 2 Copyright (C) 2017-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/stat.c b/gl/stat.c
index ecf9f9bb..da6a9862 100644
--- a/gl/stat.c
+++ b/gl/stat.c
@@ -1,5 +1,5 @@
1/* Work around platform bugs in stat. 1/* Work around platform bugs in stat.
2 Copyright (C) 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 2009-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -42,14 +42,7 @@ orig_stat (const char *filename, struct stat *buf)
42#endif 42#endif
43 43
44/* Specification. */ 44/* Specification. */
45#ifdef __osf__ 45#include <sys/stat.h>
46/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
47 eliminates this include because of the preliminary #include <sys/stat.h>
48 above. */
49# include "sys/stat.h"
50#else
51# include <sys/stat.h>
52#endif
53 46
54#include "stat-time.h" 47#include "stat-time.h"
55 48
@@ -118,6 +111,10 @@ rpl_stat (char const *name, struct stat *buf)
118 around length limitations 111 around length limitations
119 <https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file> ? */ 112 <https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file> ? */
120 113
114 /* To ease portability. Like in open.c. */
115 if (streq (name, "/dev/null"))
116 name = "NUL";
117
121 /* POSIX <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13> 118 /* POSIX <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>
122 specifies: "More than two leading <slash> characters shall be treated as 119 specifies: "More than two leading <slash> characters shall be treated as
123 a single <slash> character." */ 120 a single <slash> character." */
@@ -290,8 +287,7 @@ rpl_stat (char const *name, struct stat *buf)
290 if (info.nFileSizeHigh > 0 || info.nFileSizeLow > 0) 287 if (info.nFileSizeHigh > 0 || info.nFileSizeLow > 0)
291 { 288 {
292 const char *last_dot = NULL; 289 const char *last_dot = NULL;
293 const char *p; 290 for (const char *p = info.cFileName; *p != '\0'; p++)
294 for (p = info.cFileName; *p != '\0'; p++)
295 if (*p == '.') 291 if (*p == '.')
296 last_dot = p; 292 last_dot = p;
297 if (last_dot != NULL) 293 if (last_dot != NULL)
diff --git a/gl/stdckdint.in.h b/gl/stdckdint.in.h
index 91848806..ac12fd6c 100644
--- a/gl/stdckdint.in.h
+++ b/gl/stdckdint.in.h
@@ -1,6 +1,6 @@
1/* stdckdint.h -- checked integer arithmetic 1/* stdckdint.h -- checked integer arithmetic
2 2
3 Copyright 2022-2024 Free Software Foundation, Inc. 3 Copyright 2022-2026 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify it 5 This program is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Lesser General Public License as published 6 under the terms of the GNU Lesser General Public License as published
@@ -15,10 +15,30 @@
15 You should have received a copy of the GNU Lesser General Public License 15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 17
18#ifndef _GL_STDCKDINT_H 18#if __GNUC__ >= 3
19#define _GL_STDCKDINT_H 19@PRAGMA_SYSTEM_HEADER@
20#endif
21@PRAGMA_COLUMNS@
20 22
21#include "intprops-internal.h" 23#ifndef _@GUARD_PREFIX@_STDCKDINT_H
24
25/* The include_next requires a split double-inclusion guard. */
26#if defined __cplusplus ? @HAVE_CXX_STDCKDINT_H@ : @HAVE_C_STDCKDINT_H@
27# @INCLUDE_NEXT@ @NEXT_STDCKDINT_H@
28#endif
29
30#ifndef _@GUARD_PREFIX@_STDCKDINT_H
31#define _@GUARD_PREFIX@_STDCKDINT_H
32
33/* Do nothing but include the system header if it works properly. */
34# if defined __cplusplus ? !@HAVE_WORKING_CXX_STDCKDINT_H@ : !@HAVE_WORKING_C_STDCKDINT_H@
35
36/* Avoid redefining macros. */
37# undef ckd_add
38# undef ckd_sub
39# undef ckd_mul
40
41# include "intprops-internal.h"
22 42
23/* Store into *R the low-order bits of A + B, A - B, A * B, respectively. 43/* Store into *R the low-order bits of A + B, A - B, A * B, respectively.
24 Return 1 if the result overflows, 0 otherwise. 44 Return 1 if the result overflows, 0 otherwise.
@@ -26,10 +46,13 @@
26 bit-precise integer type, or an enumeration type. 46 bit-precise integer type, or an enumeration type.
27 47
28 These are like the standard macros introduced in C23, except that 48 These are like the standard macros introduced in C23, except that
29 arguments should not have side effects. */ 49 arguments should not have side effects. The C++26 standard is
50 expected to add this header and it's macros. */
30 51
31#define ckd_add(r, a, b) ((bool) _GL_INT_ADD_WRAPV (a, b, r)) 52# define ckd_add(r, a, b) ((bool) _GL_INT_ADD_WRAPV (a, b, r))
32#define ckd_sub(r, a, b) ((bool) _GL_INT_SUBTRACT_WRAPV (a, b, r)) 53# define ckd_sub(r, a, b) ((bool) _GL_INT_SUBTRACT_WRAPV (a, b, r))
33#define ckd_mul(r, a, b) ((bool) _GL_INT_MULTIPLY_WRAPV (a, b, r)) 54# define ckd_mul(r, a, b) ((bool) _GL_INT_MULTIPLY_WRAPV (a, b, r))
34 55
35#endif /* _GL_STDCKDINT_H */ 56# endif /* defined __cplusplus ? @HAVE_WORKING_CXX_STDCKDINT_H@ : @HAVE_WORKING_C_STDCKDINT_H@ */
57#endif /* _@GUARD_PREFIX@_STDCKDINT_H */
58#endif /* _@GUARD_PREFIX@_STDCKDINT_H */
diff --git a/gl/stddef.in.h b/gl/stddef.in.h
index fa8998d9..2fe9e044 100644
--- a/gl/stddef.in.h
+++ b/gl/stddef.in.h
@@ -1,6 +1,6 @@
1/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues. 1/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
2 2
3 Copyright (C) 2009-2024 Free Software Foundation, Inc. 3 Copyright (C) 2009-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -27,13 +27,21 @@
27#endif 27#endif
28@PRAGMA_COLUMNS@ 28@PRAGMA_COLUMNS@
29 29
30#if defined __need_wchar_t || defined __need_size_t \ 30#if (defined __need_wchar_t || defined __need_size_t \
31 || defined __need_ptrdiff_t || defined __need_NULL \ 31 || defined __need_ptrdiff_t || defined __need_NULL \
32 || defined __need_wint_t 32 || defined __need_wint_t) \
33 /* Avoid warning triggered by "gcc -std=gnu23 -Wsystem-headers" \
34 in GCC 13.3 and 14.2 \
35 <https://gcc.gnu.org/PR114870>. */ \
36 && !@STDDEF_NOT_IDEMPOTENT@
33/* Special invocation convention inside gcc header files. In 37/* Special invocation convention inside gcc header files. In
34 particular, gcc provides a version of <stddef.h> that blindly 38 particular, <stddef.h> in some ancient versions of GCC blindly
35 redefines NULL even when __need_wint_t was defined, even though 39 redefined NULL when __need_wint_t was defined, even though wint_t
36 wint_t is not normally provided by <stddef.h>. Hence, we must 40 is not normally provided by <stddef.h>.
41 (FIXME: It's not clear what GCC versions those were - perhaps so
42 ancient that we can stop worrying about this?)
43 Although glibc 2.26 (2017) and later do not use __need_wint_t,
44 for portability to macOS, Cygwin, Haiku, and older Glibc + GCC,
37 remember if special invocation has ever been used to obtain wint_t, 45 remember if special invocation has ever been used to obtain wint_t,
38 in which case we need to clean up NULL yet again. */ 46 in which case we need to clean up NULL yet again. */
39 47
@@ -52,6 +60,13 @@
52# endif 60# endif
53 61
54#else 62#else
63/* For @STDDEF_NOT_IDEMPOTENT@. */
64# undef __need_wchar_t
65# undef __need_size_t
66# undef __need_ptrdiff_t
67# undef __need_NULL
68# undef __need_wint_t
69
55/* Normal invocation convention. */ 70/* Normal invocation convention. */
56 71
57# ifndef _@GUARD_PREFIX@_STDDEF_H 72# ifndef _@GUARD_PREFIX@_STDDEF_H
@@ -74,6 +89,12 @@ typedef long max_align_t;
74# endif 89# endif
75# endif 90# endif
76 91
92# if !defined _GCC_NULLPTR_T && !@NULLPTR_T_NEEDS_STDDEF@
93 /* Suppress unwanted nullptr_t typedef. See
94 <https://gcc.gnu.org/PR114869>. */
95# define _GCC_NULLPTR_T
96# endif
97
77/* The include_next requires a split double-inclusion guard. */ 98/* The include_next requires a split double-inclusion guard. */
78 99
79# @INCLUDE_NEXT@ @NEXT_STDDEF_H@ 100# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
@@ -110,7 +131,7 @@ typedef long max_align_t;
110 */ 131 */
111#ifndef _GL_ATTRIBUTE_NOTHROW 132#ifndef _GL_ATTRIBUTE_NOTHROW
112# if defined __cplusplus 133# if defined __cplusplus
113# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 134# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
114# if __cplusplus >= 201103L 135# if __cplusplus >= 201103L
115# define _GL_ATTRIBUTE_NOTHROW noexcept (true) 136# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
116# else 137# else
@@ -128,11 +149,6 @@ typedef long max_align_t;
128# endif 149# endif
129#endif 150#endif
130 151
131/* Some platforms lack wchar_t. */
132#if !@HAVE_WCHAR_T@
133# define wchar_t int
134#endif
135
136/* Some platforms lack max_align_t. The check for _GCC_MAX_ALIGN_T is 152/* Some platforms lack max_align_t. The check for _GCC_MAX_ALIGN_T is
137 a hack in case the configure-time test was done with g++ even though 153 a hack in case the configure-time test was done with g++ even though
138 we are currently compiling with gcc. 154 we are currently compiling with gcc.
@@ -172,38 +188,57 @@ typedef union
172#endif 188#endif
173 189
174/* ISO C 23 § 7.21.1 The unreachable macro */ 190/* ISO C 23 § 7.21.1 The unreachable macro */
175#ifndef unreachable 191/* This macro is only usable in C, not in C++.
192 There is no way to define it as a macro in C++, because that would break code
193 that does
194 #include <utility>
195 ... std::unreachable() ...
196 Similarly, there is no way to define it as an inline function in C++, because
197 that would break code that does
198 #include <utility>
199 using std::unreachable;
200 As a workaround, we define a macro gl_unreachable, that is like unreachable,
201 but is usable in both C and C++. */
176 202
177/* Code borrowed from verify.h. */ 203/* Code borrowed from verify.h. */
178# ifndef _GL_HAS_BUILTIN_UNREACHABLE 204#ifndef _GL_HAS_BUILTIN_UNREACHABLE
179# if defined __clang_major__ && __clang_major__ < 5 205# if defined __clang_major__ && __clang_major__ < 5
180# define _GL_HAS_BUILTIN_UNREACHABLE 0 206# define _GL_HAS_BUILTIN_UNREACHABLE 0
181# elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__) 207# elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__) && !defined __clang__
182# define _GL_HAS_BUILTIN_UNREACHABLE 1 208# define _GL_HAS_BUILTIN_UNREACHABLE 1
183# elif defined __has_builtin 209# elif defined __has_builtin
184# define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable) 210# define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable)
185# else 211# else
186# define _GL_HAS_BUILTIN_UNREACHABLE 0 212# define _GL_HAS_BUILTIN_UNREACHABLE 0
187# endif
188# endif 213# endif
214#endif
189 215
190# if _GL_HAS_BUILTIN_UNREACHABLE 216#if _GL_HAS_BUILTIN_UNREACHABLE
191# define unreachable() __builtin_unreachable () 217# define gl_unreachable() __builtin_unreachable ()
192# elif 1200 <= _MSC_VER 218#elif 1200 <= _MSC_VER
193# define unreachable() __assume (0) 219# define gl_unreachable() __assume (0)
194# else 220#elif !defined __cplusplus && @HAVE_C_UNREACHABLE@
221# define gl_unreachable() unreachable ()
222#else
195/* Declare abort(), without including <stdlib.h>. */ 223/* Declare abort(), without including <stdlib.h>. */
196extern 224extern
197# if defined __cplusplus 225# if defined __cplusplus
198"C" 226"C"
199# endif 227# endif
200_Noreturn 228_Noreturn
201void abort (void) 229void abort (void)
202# if defined __cplusplus && (__GLIBC__ >= 2) 230# if defined __cplusplus && (__GLIBC__ >= 2)
203_GL_ATTRIBUTE_NOTHROW 231_GL_ATTRIBUTE_NOTHROW
204# endif 232# endif
205; 233;
206# define unreachable() abort () 234# define gl_unreachable() abort ()
235#endif
236
237#if !defined __cplusplus && !@HAVE_C_UNREACHABLE@
238/* In C, define unreachable as a macro. */
239
240# ifndef unreachable
241# define unreachable() gl_unreachable ()
207# endif 242# endif
208 243
209#endif 244#endif
diff --git a/gl/stdint.in.h b/gl/stdint.in.h
index fea7483b..f6066094 100644
--- a/gl/stdint.in.h
+++ b/gl/stdint.in.h
@@ -1,4 +1,4 @@
1/* Copyright (C) 2001-2002, 2004-2024 Free Software Foundation, Inc. 1/* Copyright (C) 2001-2002, 2004-2026 Free Software Foundation, Inc.
2 Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. 2 Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
3 This file is part of gnulib. 3 This file is part of gnulib.
4 4
@@ -51,13 +51,6 @@
51 in public interfaces due to compiler differences. */ 51 in public interfaces due to compiler differences. */
52 52
53#if @HAVE_STDINT_H@ 53#if @HAVE_STDINT_H@
54# if defined __sgi && ! defined __c99
55 /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users
56 with "This header file is to be used only for c99 mode compilations"
57 diagnostics. */
58# define __STDINT_H__
59# endif
60
61 /* Some pre-C++11 <stdint.h> implementations need this. */ 54 /* Some pre-C++11 <stdint.h> implementations need this. */
62# ifdef __cplusplus 55# ifdef __cplusplus
63# ifndef __STDC_CONSTANT_MACROS 56# ifndef __STDC_CONSTANT_MACROS
@@ -80,7 +73,7 @@
80#define _@GUARD_PREFIX@_STDINT_H 73#define _@GUARD_PREFIX@_STDINT_H
81 74
82/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, 75/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX,
83 LONG_MIN, LONG_MAX, ULONG_MAX, _GL_INTEGER_WIDTH. */ 76 LONG_MIN, LONG_MAX, ULONG_MAX, CHAR_BIT, _GL_INTEGER_WIDTH. */
84#include <limits.h> 77#include <limits.h>
85 78
86/* Override WINT_MIN and WINT_MAX if gnulib's <wchar.h> or <wctype.h> overrides 79/* Override WINT_MIN and WINT_MAX if gnulib's <wchar.h> or <wctype.h> overrides
@@ -94,8 +87,8 @@
94 87
95#if ! @HAVE_C99_STDINT_H@ 88#if ! @HAVE_C99_STDINT_H@
96 89
97/* <sys/types.h> defines some of the stdint.h types as well, on glibc, 90/* <sys/types.h> defines some of the stdint.h types as well, on glibc and
98 IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>). 91 OpenBSD 3.8 (via <machine/types.h>).
99 AIX 5.2 <sys/types.h> isn't needed and causes troubles. 92 AIX 5.2 <sys/types.h> isn't needed and causes troubles.
100 Mac OS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but 93 Mac OS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
101 relies on the system <stdint.h> definitions, so include 94 relies on the system <stdint.h> definitions, so include
@@ -189,6 +182,10 @@ typedef __int64 gl_int64_t;
189# define int64_t gl_int64_t 182# define int64_t gl_int64_t
190# define GL_INT64_T 183# define GL_INT64_T
191# else 184# else
185/* Verify that 'long long' has exactly 64 bits. */
186typedef _gl_verify_int64_bits[
187 _STDINT_MAX (1, sizeof (long long) * CHAR_BIT, 0ll) >> 31 >> 31 == 1
188 ? 1 : -1];
192# undef int64_t 189# undef int64_t
193typedef long long int gl_int64_t; 190typedef long long int gl_int64_t;
194# define int64_t gl_int64_t 191# define int64_t gl_int64_t
@@ -210,6 +207,11 @@ typedef unsigned __int64 gl_uint64_t;
210# define uint64_t gl_uint64_t 207# define uint64_t gl_uint64_t
211# define GL_UINT64_T 208# define GL_UINT64_T
212# else 209# else
210/* Verify that 'unsigned long long' has exactly 64 bits. */
211typedef _gl_verify_uint64_bits[
212 _STDINT_MAX (0, sizeof (unsigned long long) * CHAR_BIT, 0ull)
213 >> 31 >> 31 >> 1 == 1
214 ? 1 : -1];
213# undef uint64_t 215# undef uint64_t
214typedef unsigned long long int gl_uint64_t; 216typedef unsigned long long int gl_uint64_t;
215# define uint64_t gl_uint64_t 217# define uint64_t gl_uint64_t
@@ -575,11 +577,7 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
575# endif 577# endif
576 578
577/* wchar_t limits */ 579/* wchar_t limits */
578/* Get WCHAR_MIN, WCHAR_MAX. 580/* Get WCHAR_MIN, WCHAR_MAX. */
579 This include is not on the top, above, because on OSF/1 4.0 we have a
580 sequence of nested includes
581 <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
582 <stdint.h> and assumes its types are already defined. */
583# if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) 581# if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX)
584# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H 582# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
585# include <wchar.h> 583# include <wchar.h>
diff --git a/gl/stdio-consolesafe.c b/gl/stdio-consolesafe.c
new file mode 100644
index 00000000..f634de13
--- /dev/null
+++ b/gl/stdio-consolesafe.c
@@ -0,0 +1,202 @@
1/* msvcrt workarounds.
2 Copyright (C) 2025-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#include <config.h>
18
19/* Specification. */
20#include <stdio.h>
21
22#include <stdckdint.h>
23#include <stdlib.h>
24#include <string.h>
25
26/* Outputs N bytes starting at S to FP.
27 These N bytes are known to be followed by a NUL.
28 Finally frees the string at S.
29 Returns the number of written bytes. */
30static size_t
31workaround_fwrite0 (char *s, size_t n, FILE *fp)
32{
33 const char *ptr = s;
34 /* Use fputs instead of fwrite, which is buggy in msvcrt. */
35 size_t written = 0;
36 while (n > 0)
37 {
38 size_t l = strlen (ptr); /* 0 <= l <= n */
39 if (l > 0)
40 {
41 if (fputs (ptr, fp) == EOF)
42 break;
43 written += l;
44 n -= l;
45 }
46 if (n == 0)
47 break;
48 if (fputc ('\0', fp) == EOF)
49 break;
50 written++;
51 n--;
52 ptr += l + 1;
53 }
54 free (s);
55 return written;
56}
57
58size_t
59gl_consolesafe_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *fp)
60{
61 size_t nbytes;
62 if (ckd_mul (&nbytes, size, nmemb) || nbytes == 0)
63 /* Overflow, or nothing to do. */
64 return 0;
65 char *tmp = malloc (nbytes + 1);
66 if (tmp == NULL)
67 return 0;
68 memcpy (tmp, ptr, nbytes);
69 tmp[nbytes] = '\0';
70 size_t written = workaround_fwrite0 (tmp, nbytes, fp);
71 return written / size;
72}
73
74#if defined __MINGW32__ && __USE_MINGW_ANSI_STDIO
75
76# include "fseterr.h"
77# include <stdarg.h>
78
79# if !HAVE_VASPRINTF
80
81# include <errno.h>
82
83/* The old mingw (before mingw-w64) does not have the vasprintf function.
84 Define a suitable replacement here, that supports the same format
85 specifiers as the mingw *printf functions. */
86
87static int
88local_vasprintf (char **resultp, const char *format, va_list args)
89{
90 /* First try: Use a stack-allocated buffer. */
91 char buf[2048];
92 size_t bufsize = sizeof (buf);
93 int ret = __mingw_vsnprintf (buf, bufsize, format, args);
94 if (ret < 0)
95 return -1;
96 size_t nbytes = ret;
97 char *mem = (char *) malloc (nbytes + 1);
98 if (mem == NULL)
99 {
100 errno = ENOMEM;
101 return -1;
102 }
103 if (ret < bufsize)
104 {
105 /* The buffer was sufficiently large. */
106 memcpy (mem, buf, nbytes + 1);
107 }
108 else
109 {
110 /* Second try: Use the heap-allocated memory. */
111 ret = __mingw_vsnprintf (mem, nbytes + 1, format, args);
112 if (ret < 0)
113 {
114 int saved_errno = errno;
115 free (mem);
116 errno = saved_errno;
117 return -1;
118 }
119 if (ret != nbytes)
120 abort ();
121 }
122 *resultp = mem;
123 return nbytes;
124}
125
126# undef vasprintf
127# define vasprintf local_vasprintf
128
129# endif
130
131/* Bypass the functions __mingw_[v][f]printf, that trigger a bug in msvcrt,
132 but without losing the support for modern format specifiers added by
133 __mingw_*printf. */
134
135int
136gl_consolesafe_fprintf (FILE *restrict fp, const char *restrict format, ...)
137{
138 va_list args;
139 va_start (args, format);
140 char *tmpstring;
141 int result = vasprintf (&tmpstring, format, args);
142 va_end (args);
143 if (result >= 0)
144 {
145 if (workaround_fwrite0 (tmpstring, result, fp) < result)
146 result = -1;
147 }
148 else
149 fseterr (fp);
150 return result;
151}
152
153int
154gl_consolesafe_printf (const char *restrict format, ...)
155{
156 va_list args;
157 va_start (args, format);
158 char *tmpstring;
159 int result = vasprintf (&tmpstring, format, args);
160 va_end (args);
161 if (result >= 0)
162 {
163 if (workaround_fwrite0 (tmpstring, result, stdout) < result)
164 result = -1;
165 }
166 else
167 fseterr (stdout);
168 return result;
169}
170
171int
172gl_consolesafe_vfprintf (FILE *restrict fp,
173 const char *restrict format, va_list args)
174{
175 char *tmpstring;
176 int result = vasprintf (&tmpstring, format, args);
177 if (result >= 0)
178 {
179 if (workaround_fwrite0 (tmpstring, result, fp) < result)
180 result = -1;
181 }
182 else
183 fseterr (fp);
184 return result;
185}
186
187int
188gl_consolesafe_vprintf (const char *restrict format, va_list args)
189{
190 char *tmpstring;
191 int result = vasprintf (&tmpstring, format, args);
192 if (result >= 0)
193 {
194 if (workaround_fwrite0 (tmpstring, result, stdout) < result)
195 result = -1;
196 }
197 else
198 fseterr (stdout);
199 return result;
200}
201
202#endif
diff --git a/gl/stdio-impl.h b/gl/stdio-impl.h
index 63ebf7c6..c90f64df 100644
--- a/gl/stdio-impl.h
+++ b/gl/stdio-impl.h
@@ -1,5 +1,5 @@
1/* Implementation details of FILE streams. 1/* Implementation details of FILE streams.
2 Copyright (C) 2007-2008, 2010-2024 Free Software Foundation, Inc. 2 Copyright (C) 2007-2008, 2010-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -30,6 +30,49 @@
30# endif 30# endif
31#endif 31#endif
32 32
33/* Haiku stdio implementation. */
34#if defined __HAIKU__
35# include <stdint.h>
36/* This FILE structure was made into an incomplete type in 2025.
37 See <https://cgit.haiku-os.org/haiku/tree/src/system/libroot/posix/glibc/libio/libio.h>. */
38# define fp_ ((struct { int _flags; \
39 char *_IO_read_ptr; \
40 char *_IO_read_end; \
41 char *_IO_read_base; \
42 char *_IO_write_base; \
43 char *_IO_write_ptr; \
44 char *_IO_write_end; \
45 char *_IO_buf_base; \
46 char *_IO_buf_end; \
47 char *_IO_save_base; \
48 char *_IO_backup_base; \
49 char *_IO_save_end; \
50 void *_markers; \
51 void *_chain; \
52 int _fileno; \
53 int _flags2; \
54 off_t _old_offset; \
55 unsigned short _cur_column; \
56 signed char _vtable_offset; \
57 char _shortbuf[1]; \
58 void *_lock; \
59 int64_t _offset; \
60 /* More fields, not relevant here. */ \
61 } *) fp)
62# if !defined _IO_UNBUFFERED
63# define _IO_UNBUFFERED 0x2
64# endif
65# if !defined _IO_EOF_SEEN
66# define _IO_EOF_SEEN 0x10
67# endif
68# if !defined _IO_IN_BACKUP
69# define _IO_IN_BACKUP 0x100
70# endif
71# if !defined _IO_LINE_BUF
72# define _IO_LINE_BUF 0x200
73# endif
74#endif
75
33/* BSD stdio derived implementations. */ 76/* BSD stdio derived implementations. */
34 77
35#if defined __NetBSD__ /* NetBSD */ 78#if defined __NetBSD__ /* NetBSD */
@@ -39,7 +82,7 @@
39 82
40#include <errno.h> /* For detecting Plan9. */ 83#include <errno.h> /* For detecting Plan9. */
41 84
42#if defined __sferror || defined __DragonFly__ || defined __ANDROID__ 85#if defined __sferror || defined __OpenBSD__ || defined __DragonFly__ || defined __ANDROID__
43 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ 86 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
44 87
45# if defined __DragonFly__ /* DragonFly */ 88# if defined __DragonFly__ /* DragonFly */
@@ -65,13 +108,59 @@
65# define _flags pub._flags 108# define _flags pub._flags
66# define _r pub._r 109# define _r pub._r
67# define _w pub._w 110# define _w pub._w
68# elif defined __ANDROID__ /* Android */ 111# elif defined __OpenBSD__ /* OpenBSD */
69# ifdef __LP64__ 112# if defined __sferror /* OpenBSD <= 7.7 */
113# define _gl_flags_file_t short
114# else /* OpenBSD >= 7.8 */
115# define _gl_flags_file_t int
116# endif
117 /* Up to this commit from 2025-07-16
118 <https://github.com/openbsd/src/commit/b7f6c2eb760a2da367dd51d539ef06f5f3553790>
119 the innards of FILE were public. After this commit, the innards of FILE
120 are hidden. In this commit
121 <https://github.com/openbsd/src/commit/9063a2f1ec94013fb0e2c7ec851495108e788a6e>
122 they were reshuffled. */
123# if defined __sferror /* OpenBSD <= 7.7 */
124# define fp_ ((struct { unsigned char *_p; \
125 int _r; \
126 int _w; \
127 _gl_flags_file_t _flags; \
128 _gl_flags_file_t _file; \
129 struct { unsigned char *_base; size_t _size; } _bf; \
130 int _lbfsize; \
131 void *_cookie; \
132 void *_close; \
133 void *_read; \
134 void *_seek; \
135 void *_write; \
136 struct { unsigned char *_base; size_t _size; } _ext; \
137 unsigned char *_up; \
138 int _ur; \
139 unsigned char _ubuf[3]; \
140 unsigned char _nbuf[1]; \
141 struct { unsigned char *_base; size_t _size; } _lb; \
142 int _blksize; \
143 fpos_t _offset; \
144 /* More fields, not relevant here. */ \
145 } *) fp)
146# else /* OpenBSD >= 7.8 */
147# define fp_ ((struct { _gl_flags_file_t _flags; \
148 _gl_flags_file_t _file; \
149 unsigned char *_p; \
150 int _r; \
151 int _w; \
152 struct { unsigned char *_base; size_t _size; } _bf; \
153 int _lbfsize; \
154 /* More fields, not relevant here. */ \
155 } *) fp)
156# endif
157# elif defined __ANDROID__ /* Android */
158# if defined __LP64__
70# define _gl_flags_file_t int 159# define _gl_flags_file_t int
71# else 160# else
72# define _gl_flags_file_t short 161# define _gl_flags_file_t short
73# endif 162# endif
74# ifdef __LP64__ 163# if defined __LP64__
75# define _gl_file_offset_t int64_t 164# define _gl_file_offset_t int64_t
76# else 165# else
77 /* see https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md */ 166 /* see https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md */
@@ -79,7 +168,7 @@
79# endif 168# endif
80 /* Up to this commit from 2015-10-12 169 /* Up to this commit from 2015-10-12
81 <https://android.googlesource.com/platform/bionic.git/+/f0141dfab10a4b332769d52fa76631a64741297a> 170 <https://android.googlesource.com/platform/bionic.git/+/f0141dfab10a4b332769d52fa76631a64741297a>
82 the innards of FILE were public, and fp_ub could be defined like for OpenBSD, 171 the innards of FILE were public,
83 see <https://android.googlesource.com/platform/bionic.git/+/e78392637d5086384a5631ddfdfa8d7ec8326ee3/libc/stdio/fileext.h> 172 see <https://android.googlesource.com/platform/bionic.git/+/e78392637d5086384a5631ddfdfa8d7ec8326ee3/libc/stdio/fileext.h>
84 and <https://android.googlesource.com/platform/bionic.git/+/e78392637d5086384a5631ddfdfa8d7ec8326ee3/libc/stdio/local.h>. 173 and <https://android.googlesource.com/platform/bionic.git/+/e78392637d5086384a5631ddfdfa8d7ec8326ee3/libc/stdio/local.h>.
85 After this commit, the innards of FILE are hidden. */ 174 After this commit, the innards of FILE are hidden. */
@@ -109,9 +198,8 @@
109# define fp_ fp 198# define fp_ fp
110# endif 199# endif
111 200
112# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __minix /* NetBSD >= 1.5ZA, OpenBSD, Minix 3 */ 201# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __minix /* NetBSD >= 1.5ZA, Minix 3 */
113 /* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> 202 /* See <https://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
114 and <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
115 and <https://github.com/Stichting-MINIX-Research-Foundation/minix/blob/master/lib/libc/stdio/fileext.h> */ 203 and <https://github.com/Stichting-MINIX-Research-Foundation/minix/blob/master/lib/libc/stdio/fileext.h> */
116 struct __sfileext 204 struct __sfileext
117 { 205 {
@@ -119,7 +207,7 @@
119 /* More fields, not relevant here. */ 207 /* More fields, not relevant here. */
120 }; 208 };
121# define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub 209# define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub
122# elif defined __ANDROID__ /* Android */ 210# elif defined __ANDROID__ || defined __OpenBSD__ /* Android, OpenBSD */
123 struct __sfileext 211 struct __sfileext
124 { 212 {
125 struct { unsigned char *_base; size_t _size; } _ub; /* ungetc buffer */ 213 struct { unsigned char *_base; size_t _size; } _ub; /* ungetc buffer */
@@ -132,9 +220,11 @@
132 220
133# define HASUB(fp) (fp_ub._base != NULL) 221# define HASUB(fp) (fp_ub._base != NULL)
134 222
135# if defined __ANDROID__ /* Android */ 223# if defined __ANDROID__ || defined __OpenBSD__ /* Android, OpenBSD */
136 /* Needed after this commit from 2016-01-25 224 /* Needed after this Android commit from 2016-01-25
137 <https://android.googlesource.com/platform/bionic.git/+/e70e0e9267d069bf56a5078c99307e08a7280de7> */ 225 <https://android.googlesource.com/platform/bionic.git/+/e70e0e9267d069bf56a5078c99307e08a7280de7>
226 And after this OpenBSD commit from 2025-07-16
227 <https://github.com/openbsd/src/commit/b7f6c2eb760a2da367dd51d539ef06f5f3553790>. */
138# ifndef __SEOF 228# ifndef __SEOF
139# define __SLBF 1 229# define __SLBF 1
140# define __SNBF 2 230# define __SNBF 2
diff --git a/gl/stdio-read.c b/gl/stdio-read.c
index 253b8aa4..0ca956dc 100644
--- a/gl/stdio-read.c
+++ b/gl/stdio-read.c
@@ -1,5 +1,5 @@
1/* POSIX compatible FILE stream read function. 1/* POSIX compatible FILE stream read function.
2 Copyright (C) 2008-2024 Free Software Foundation, Inc. 2 Copyright (C) 2008-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2011. 3 Written by Bruno Haible <bruno@clisp.org>, 2011.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
@@ -52,9 +52,8 @@
52 return (EXPRESSION); \ 52 return (EXPRESSION); \
53 else \ 53 else \
54 { \ 54 { \
55 RETTYPE ret; \
56 SetLastError (0); \ 55 SetLastError (0); \
57 ret = (EXPRESSION); \ 56 RETTYPE ret = (EXPRESSION); \
58 if (FAILED) \ 57 if (FAILED) \
59 { \ 58 { \
60 if (GetLastError () == ERROR_NO_DATA && ferror (stream)) \ 59 if (GetLastError () == ERROR_NO_DATA && ferror (stream)) \
@@ -86,11 +85,9 @@
86int 85int
87scanf (const char *format, ...) 86scanf (const char *format, ...)
88{ 87{
89 int retval;
90 va_list args; 88 va_list args;
91
92 va_start (args, format); 89 va_start (args, format);
93 retval = vfscanf (stdin, format, args); 90 int retval = vfscanf (stdin, format, args);
94 va_end (args); 91 va_end (args);
95 92
96 return retval; 93 return retval;
@@ -103,11 +100,9 @@ scanf (const char *format, ...)
103int 100int
104fscanf (FILE *stream, const char *format, ...) 101fscanf (FILE *stream, const char *format, ...)
105{ 102{
106 int retval;
107 va_list args; 103 va_list args;
108
109 va_start (args, format); 104 va_start (args, format);
110 retval = vfscanf (stream, format, args); 105 int retval = vfscanf (stream, format, args);
111 va_end (args); 106 va_end (args);
112 107
113 return retval; 108 return retval;
diff --git a/gl/stdio-write.c b/gl/stdio-write.c
index ca6aa00c..fc7f74fe 100644
--- a/gl/stdio-write.c
+++ b/gl/stdio-write.c
@@ -1,5 +1,5 @@
1/* POSIX compatible FILE stream write function. 1/* POSIX compatible FILE stream write function.
2 Copyright (C) 2008-2024 Free Software Foundation, Inc. 2 Copyright (C) 2008-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2008. 3 Written by Bruno Haible <bruno@clisp.org>, 2008.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
@@ -107,10 +107,9 @@
107 return (EXPRESSION); \ 107 return (EXPRESSION); \
108 else \ 108 else \
109 { \ 109 { \
110 RETTYPE ret; \
111 CLEAR_ERRNO \ 110 CLEAR_ERRNO \
112 CLEAR_LastError \ 111 CLEAR_LastError \
113 ret = (EXPRESSION); \ 112 RETTYPE ret = (EXPRESSION); \
114 if (FAILED) \ 113 if (FAILED) \
115 { \ 114 { \
116 HANDLE_ENOSPC \ 115 HANDLE_ENOSPC \
@@ -124,11 +123,9 @@
124int 123int
125printf (const char *format, ...) 124printf (const char *format, ...)
126{ 125{
127 int retval;
128 va_list args; 126 va_list args;
129
130 va_start (args, format); 127 va_start (args, format);
131 retval = vfprintf (stdout, format, args); 128 int retval = vfprintf (stdout, format, args);
132 va_end (args); 129 va_end (args);
133 130
134 return retval; 131 return retval;
@@ -139,11 +136,9 @@ printf (const char *format, ...)
139int 136int
140fprintf (FILE *stream, const char *format, ...) 137fprintf (FILE *stream, const char *format, ...)
141{ 138{
142 int retval;
143 va_list args; 139 va_list args;
144
145 va_start (args, format); 140 va_start (args, format);
146 retval = vfprintf (stream, format, args); 141 int retval = vfprintf (stream, format, args);
147 va_end (args); 142 va_end (args);
148 143
149 return retval; 144 return retval;
@@ -162,6 +157,9 @@ vprintf (const char *format, va_list args)
162int 157int
163vfprintf (FILE *stream, const char *format, va_list args) 158vfprintf (FILE *stream, const char *format, va_list args)
164#undef vfprintf 159#undef vfprintf
160#if defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO
161# define vfprintf gl_consolesafe_vfprintf
162#endif
165{ 163{
166 CALL_WITH_SIGPIPE_EMULATION (int, vfprintf (stream, format, args), ret == EOF) 164 CALL_WITH_SIGPIPE_EMULATION (int, vfprintf (stream, format, args), ret == EOF)
167} 165}
@@ -198,6 +196,9 @@ puts (const char *string)
198size_t 196size_t
199fwrite (const void *ptr, size_t s, size_t n, FILE *stream) 197fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
200#undef fwrite 198#undef fwrite
199#if (defined _WIN32 && !defined __CYGWIN__) && !defined _UCRT
200# define fwrite gl_consolesafe_fwrite
201#endif
201{ 202{
202 CALL_WITH_SIGPIPE_EMULATION (size_t, fwrite (ptr, s, n, stream), ret < n) 203 CALL_WITH_SIGPIPE_EMULATION (size_t, fwrite (ptr, s, n, stream), ret < n)
203} 204}
diff --git a/gl/stdio.in.h b/gl/stdio.in.h
index 35b9f748..33b0b8e4 100644
--- a/gl/stdio.in.h
+++ b/gl/stdio.in.h
@@ -1,6 +1,6 @@
1/* A GNU-like <stdio.h>. 1/* A GNU-like <stdio.h>.
2 2
3 Copyright (C) 2004, 2007-2024 Free Software Foundation, Inc. 3 Copyright (C) 2004, 2007-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -20,14 +20,9 @@
20#endif 20#endif
21@PRAGMA_COLUMNS@ 21@PRAGMA_COLUMNS@
22 22
23#if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H 23#if defined __need_FILE || defined __need___FILE || defined _@GUARD_PREFIX@_ALREADY_INCLUDING_STDIO_H || defined _GL_SKIP_GNULIB_STDIO_H
24/* Special invocation convention: 24/* Special invocation convention:
25 - Inside glibc header files. 25 - Inside glibc header files. */
26 - On OSF/1 5.1 we have a sequence of nested includes
27 <stdio.h> -> <getopt.h> -> <ctype.h> -> <sys/localedef.h> ->
28 <sys/lc_core.h> -> <nl_types.h> -> <mesg.h> -> <stdio.h>.
29 In this situation, the functions are not yet declared, therefore we cannot
30 provide the C++ aliases. */
31 26
32#@INCLUDE_NEXT@ @NEXT_STDIO_H@ 27#@INCLUDE_NEXT@ @NEXT_STDIO_H@
33 28
@@ -48,12 +43,12 @@
48# endif 43# endif
49#endif 44#endif
50 45
51#define _GL_ALREADY_INCLUDING_STDIO_H 46#define _@GUARD_PREFIX@_ALREADY_INCLUDING_STDIO_H
52 47
53/* The include_next requires a split double-inclusion guard. */ 48/* The include_next requires a split double-inclusion guard. */
54#@INCLUDE_NEXT@ @NEXT_STDIO_H@ 49#@INCLUDE_NEXT@ @NEXT_STDIO_H@
55 50
56#undef _GL_ALREADY_INCLUDING_STDIO_H 51#undef _@GUARD_PREFIX@_ALREADY_INCLUDING_STDIO_H
57 52
58#ifdef _GL_DEFINED__POSIX_C_SOURCE 53#ifdef _GL_DEFINED__POSIX_C_SOURCE
59# undef _GL_DEFINED__POSIX_C_SOURCE 54# undef _GL_DEFINED__POSIX_C_SOURCE
@@ -64,8 +59,8 @@
64#define _@GUARD_PREFIX@_STDIO_H 59#define _@GUARD_PREFIX@_STDIO_H
65 60
66/* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_FORMAT, 61/* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_FORMAT,
67 _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_NOTHROW, GNULIB_POSIXCHECK, 62 _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOTHROW,
68 HAVE_RAW_DECL_*. */ 63 GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
69#if !_GL_CONFIG_H_INCLUDED 64#if !_GL_CONFIG_H_INCLUDED
70 #error "Please include config.h first." 65 #error "Please include config.h first."
71#endif 66#endif
@@ -77,7 +72,8 @@
77 72
78/* Get off_t and ssize_t. Needed on many systems, including glibc 2.8 73/* Get off_t and ssize_t. Needed on many systems, including glibc 2.8
79 and eglibc 2.11.2. 74 and eglibc 2.11.2.
80 May also define off_t to a 64-bit type on native Windows. */ 75 May also define off_t to a 64-bit type on native Windows.
76 Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku. */
81#include <sys/types.h> 77#include <sys/types.h>
82 78
83/* Solaris 10 and NetBSD 7.0 declare renameat in <unistd.h>, not in <stdio.h>. */ 79/* Solaris 10 and NetBSD 7.0 declare renameat in <unistd.h>, not in <stdio.h>. */
@@ -119,7 +115,7 @@
119 that can be freed by passing them as the Ith argument to the 115 that can be freed by passing them as the Ith argument to the
120 function F. */ 116 function F. */
121#ifndef _GL_ATTRIBUTE_DEALLOC 117#ifndef _GL_ATTRIBUTE_DEALLOC
122# if __GNUC__ >= 11 118# if __GNUC__ >= 11 && !defined __clang__
123# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) 119# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
124# else 120# else
125# define _GL_ATTRIBUTE_DEALLOC(f, i) 121# define _GL_ATTRIBUTE_DEALLOC(f, i)
@@ -154,7 +150,7 @@
154 */ 150 */
155#ifndef _GL_ATTRIBUTE_NOTHROW 151#ifndef _GL_ATTRIBUTE_NOTHROW
156# if defined __cplusplus 152# if defined __cplusplus
157# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 153# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
158# if __cplusplus >= 201103L 154# if __cplusplus >= 201103L
159# define _GL_ATTRIBUTE_NOTHROW noexcept (true) 155# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
160# else 156# else
@@ -177,7 +173,7 @@
177 standardized by ISO C99 and POSIX. 173 standardized by ISO C99 and POSIX.
178 _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD */ 174 _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD */
179/* __gnu_printf__ is supported in GCC >= 4.4. */ 175/* __gnu_printf__ is supported in GCC >= 4.4. */
180#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) 176#if (__GNUC__ + (__GNUC_MINOR__ >= 4) > 4) && !defined __clang__
181# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __gnu_printf__ 177# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __gnu_printf__
182#else 178#else
183# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __printf__ 179# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __printf__
@@ -268,10 +264,6 @@
268 - with MSVC ucrt: "[-]nan" or "[-]nan(ind)" or "[-]nan(snan)", 264 - with MSVC ucrt: "[-]nan" or "[-]nan(ind)" or "[-]nan(snan)",
269 - with mingw: "[-]1.#IND" or "[-]1.#QNAN". */ 265 - with mingw: "[-]1.#IND" or "[-]1.#QNAN". */
270# define _PRINTF_NAN_LEN_MAX 10 266# define _PRINTF_NAN_LEN_MAX 10
271# elif defined __sgi
272/* On IRIX, the output typically is "[-]nan0xNNNNNNNN" with 8 hexadecimal
273 digits. */
274# define _PRINTF_NAN_LEN_MAX 14
275# else 267# else
276/* We don't know, but 32 should be a safe maximum. */ 268/* We don't know, but 32 should be a safe maximum. */
277# define _PRINTF_NAN_LEN_MAX 32 269# define _PRINTF_NAN_LEN_MAX 32
@@ -279,18 +271,64 @@
279#endif 271#endif
280 272
281 273
274#if (defined _WIN32 && !defined __CYGWIN__) && !defined _UCRT
275/* Workarounds against msvcrt bugs. */
276_GL_FUNCDECL_SYS (gl_consolesafe_fwrite, size_t,
277 (const void *ptr, size_t size, size_t nmemb, FILE *fp),
278 _GL_ARG_NONNULL ((1, 4)));
279# if defined __MINGW32__
280_GL_FUNCDECL_SYS (gl_consolesafe_fprintf, int,
281 (FILE *restrict fp, const char *restrict format, ...),
282 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
283 _GL_ARG_NONNULL ((1, 2)));
284_GL_FUNCDECL_SYS (gl_consolesafe_printf, int,
285 (const char *restrict format, ...),
286 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
287 _GL_ARG_NONNULL ((1)));
288_GL_FUNCDECL_SYS (gl_consolesafe_vfprintf, int,
289 (FILE *restrict fp,
290 const char *restrict format, va_list args),
291 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
292 _GL_ARG_NONNULL ((1, 2)));
293_GL_FUNCDECL_SYS (gl_consolesafe_vprintf, int,
294 (const char *restrict format, va_list args),
295 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0)
296 _GL_ARG_NONNULL ((1)));
297# endif
298#endif
299
300
301#if @GNULIB_DZPRINTF@
302/* Prints formatted output to file descriptor FD.
303 Returns the number of bytes written to the file descriptor. Upon
304 failure, returns -1 with errno set.
305 Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
306 Therefore, if the format string is valid and does not use %ls/%lc
307 directives nor widths, the only possible failure codes are ENOMEM
308 and the possible failure codes from write(), excluding EINTR. */
309_GL_FUNCDECL_SYS (dzprintf, off64_t,
310 (int fd, const char *restrict format, ...),
311 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
312 _GL_ARG_NONNULL ((2)));
313_GL_CXXALIAS_SYS (dzprintf, off64_t,
314 (int fd, const char *restrict format, ...));
315#endif
316
282#if @GNULIB_DPRINTF@ 317#if @GNULIB_DPRINTF@
318/* Prints formatted output to file descriptor FD.
319 Returns the number of bytes written to the file descriptor. Upon
320 failure, returns a negative value. */
283# if @REPLACE_DPRINTF@ 321# if @REPLACE_DPRINTF@
284# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 322# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
285# define dprintf rpl_dprintf 323# define dprintf rpl_dprintf
286# endif 324# endif
287_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...) 325_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...),
288 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 326 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
289 _GL_ARG_NONNULL ((2))); 327 _GL_ARG_NONNULL ((2)));
290_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *restrict format, ...)); 328_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *restrict format, ...));
291# else 329# else
292# if !@HAVE_DPRINTF@ 330# if !@HAVE_DPRINTF@
293_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...) 331_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...),
294 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 332 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
295 _GL_ARG_NONNULL ((2))); 333 _GL_ARG_NONNULL ((2)));
296# endif 334# endif
@@ -300,7 +338,7 @@ _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *restrict format, ...));
300_GL_CXXALIASWARN (dprintf); 338_GL_CXXALIASWARN (dprintf);
301# endif 339# endif
302#elif defined GNULIB_POSIXCHECK 340#elif defined GNULIB_POSIXCHECK
303# undef dprintf 341# undef dprintf /* https://lists.gnu.org/r/bug-gnulib/2025-11/msg00254.html */
304# if HAVE_RAW_DECL_DPRINTF 342# if HAVE_RAW_DECL_DPRINTF
305_GL_WARN_ON_USE (dprintf, "dprintf is unportable - " 343_GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
306 "use gnulib module dprintf for portability"); 344 "use gnulib module dprintf for portability");
@@ -313,7 +351,7 @@ _GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
313# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 351# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
314# define fclose rpl_fclose 352# define fclose rpl_fclose
315# endif 353# endif
316_GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); 354_GL_FUNCDECL_RPL (fclose, int, (FILE *stream), _GL_ARG_NONNULL ((1)));
317_GL_CXXALIAS_RPL (fclose, int, (FILE *stream)); 355_GL_CXXALIAS_RPL (fclose, int, (FILE *stream));
318# else 356# else
319_GL_CXXALIAS_SYS (fclose, int, (FILE *stream)); 357_GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
@@ -322,7 +360,6 @@ _GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
322_GL_CXXALIASWARN (fclose); 360_GL_CXXALIASWARN (fclose);
323# endif 361# endif
324#elif defined GNULIB_POSIXCHECK 362#elif defined GNULIB_POSIXCHECK
325# undef fclose
326/* Assume fclose is always declared. */ 363/* Assume fclose is always declared. */
327_GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - " 364_GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
328 "use gnulib module fclose for portable POSIX compliance"); 365 "use gnulib module fclose for portable POSIX compliance");
@@ -360,9 +397,10 @@ _GL_CXXALIASWARN (fcloseall);
360# define fdopen rpl_fdopen 397# define fdopen rpl_fdopen
361# endif 398# endif
362_GL_FUNCDECL_RPL (fdopen, FILE *, 399_GL_FUNCDECL_RPL (fdopen, FILE *,
363 (int fd, const char *mode) 400 (int fd, const char *mode),
364 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) 401 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
365 _GL_ATTRIBUTE_MALLOC); 402 _GL_ATTRIBUTE_MALLOC
403 _GL_ATTRIBUTE_NODISCARD);
366_GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode)); 404_GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
367# elif defined _WIN32 && !defined __CYGWIN__ 405# elif defined _WIN32 && !defined __CYGWIN__
368# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 406# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -371,42 +409,43 @@ _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
371# endif 409# endif
372_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode)); 410_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode));
373# else 411# else
374# if __GNUC__ >= 11 412# if __GNUC__ >= 11 && !defined __clang__
375/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */ 413/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */
376# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 414# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
377_GL_FUNCDECL_SYS (fdopen, FILE *, 415_GL_FUNCDECL_SYS (fdopen, FILE *,
378 (int fd, const char *mode) 416 (int fd, const char *mode),
379 _GL_ATTRIBUTE_NOTHROW
380 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) 417 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
381 _GL_ATTRIBUTE_MALLOC); 418 _GL_ATTRIBUTE_MALLOC
419 _GL_ATTRIBUTE_NODISCARD)
420 _GL_ATTRIBUTE_NOTHROW;
382# else 421# else
383_GL_FUNCDECL_SYS (fdopen, FILE *, 422_GL_FUNCDECL_SYS (fdopen, FILE *,
384 (int fd, const char *mode) 423 (int fd, const char *mode),
385 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) 424 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
386 _GL_ATTRIBUTE_MALLOC); 425 _GL_ATTRIBUTE_MALLOC
426 _GL_ATTRIBUTE_NODISCARD);
387# endif 427# endif
388# endif 428# endif
389_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); 429_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
390# endif 430# endif
391_GL_CXXALIASWARN (fdopen); 431_GL_CXXALIASWARN (fdopen);
392#else 432#else
393# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fdopen 433# if @GNULIB_FCLOSE@ && (__GNUC__ >= 11 && !defined __clang__) && !defined fdopen
394/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */ 434/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */
395# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 435# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
396_GL_FUNCDECL_SYS (fdopen, FILE *, 436_GL_FUNCDECL_SYS (fdopen, FILE *,
397 (int fd, const char *mode) 437 (int fd, const char *mode),
398 _GL_ATTRIBUTE_NOTHROW
399 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) 438 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
400 _GL_ATTRIBUTE_MALLOC); 439 _GL_ATTRIBUTE_MALLOC)
440 _GL_ATTRIBUTE_NOTHROW;
401# else 441# else
402_GL_FUNCDECL_SYS (fdopen, FILE *, 442_GL_FUNCDECL_SYS (fdopen, FILE *,
403 (int fd, const char *mode) 443 (int fd, const char *mode),
404 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) 444 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
405 _GL_ATTRIBUTE_MALLOC); 445 _GL_ATTRIBUTE_MALLOC);
406# endif 446# endif
407# endif 447# endif
408# if defined GNULIB_POSIXCHECK 448# if defined GNULIB_POSIXCHECK
409# undef fdopen
410/* Assume fdopen is always declared. */ 449/* Assume fdopen is always declared. */
411_GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - " 450_GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - "
412 "use gnulib module fdopen for portability"); 451 "use gnulib module fdopen for portability");
@@ -438,7 +477,7 @@ _GL_CXXALIASWARN (fdopen);
438# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 477# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
439# define fflush rpl_fflush 478# define fflush rpl_fflush
440# endif 479# endif
441_GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream)); 480_GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream), );
442_GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream)); 481_GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream));
443# else 482# else
444_GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream)); 483_GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream));
@@ -447,7 +486,6 @@ _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream));
447_GL_CXXALIASWARN (fflush); 486_GL_CXXALIASWARN (fflush);
448# endif 487# endif
449#elif defined GNULIB_POSIXCHECK 488#elif defined GNULIB_POSIXCHECK
450# undef fflush
451/* Assume fflush is always declared. */ 489/* Assume fflush is always declared. */
452_GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - " 490_GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
453 "use gnulib module fflush for portable POSIX compliance"); 491 "use gnulib module fflush for portable POSIX compliance");
@@ -459,7 +497,7 @@ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
459# undef fgetc 497# undef fgetc
460# define fgetc rpl_fgetc 498# define fgetc rpl_fgetc
461# endif 499# endif
462_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); 500_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream), _GL_ARG_NONNULL ((1)));
463_GL_CXXALIAS_RPL (fgetc, int, (FILE *stream)); 501_GL_CXXALIAS_RPL (fgetc, int, (FILE *stream));
464# else 502# else
465_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream)); 503_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream));
@@ -476,8 +514,8 @@ _GL_CXXALIASWARN (fgetc);
476# define fgets rpl_fgets 514# define fgets rpl_fgets
477# endif 515# endif
478_GL_FUNCDECL_RPL (fgets, char *, 516_GL_FUNCDECL_RPL (fgets, char *,
479 (char *restrict s, int n, FILE *restrict stream) 517 (char *restrict s, int n, FILE *restrict stream),
480 _GL_ARG_NONNULL ((1, 3))); 518 _GL_ARG_NONNULL ((1, 3)) _GL_ATTRIBUTE_NODISCARD);
481_GL_CXXALIAS_RPL (fgets, char *, 519_GL_CXXALIAS_RPL (fgets, char *,
482 (char *restrict s, int n, FILE *restrict stream)); 520 (char *restrict s, int n, FILE *restrict stream));
483# else 521# else
@@ -513,17 +551,18 @@ _GL_CXXALIASWARN (fileno);
513# define fopen rpl_fopen 551# define fopen rpl_fopen
514# endif 552# endif
515_GL_FUNCDECL_RPL (fopen, FILE *, 553_GL_FUNCDECL_RPL (fopen, FILE *,
516 (const char *restrict filename, const char *restrict mode) 554 (const char *restrict filename, const char *restrict mode),
517 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) 555 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
518 _GL_ATTRIBUTE_MALLOC); 556 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_NODISCARD);
519_GL_CXXALIAS_RPL (fopen, FILE *, 557_GL_CXXALIAS_RPL (fopen, FILE *,
520 (const char *restrict filename, const char *restrict mode)); 558 (const char *restrict filename, const char *restrict mode));
521# else 559# else
522# if __GNUC__ >= 11 560# if __GNUC__ >= 11 && !defined __clang__
523/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */ 561/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */
524_GL_FUNCDECL_SYS (fopen, FILE *, 562_GL_FUNCDECL_SYS (fopen, FILE *,
525 (const char *restrict filename, const char *restrict mode) 563 (const char *restrict filename, const char *restrict mode),
526 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); 564 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
565 _GL_ATTRIBUTE_NODISCARD);
527# endif 566# endif
528_GL_CXXALIAS_SYS (fopen, FILE *, 567_GL_CXXALIAS_SYS (fopen, FILE *,
529 (const char *restrict filename, const char *restrict mode)); 568 (const char *restrict filename, const char *restrict mode));
@@ -532,21 +571,39 @@ _GL_CXXALIAS_SYS (fopen, FILE *,
532_GL_CXXALIASWARN (fopen); 571_GL_CXXALIASWARN (fopen);
533# endif 572# endif
534#else 573#else
535# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fopen 574# if @GNULIB_FCLOSE@ && (__GNUC__ >= 11 && !defined __clang__) && !defined fopen
536/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */ 575/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */
537_GL_FUNCDECL_SYS (fopen, FILE *, 576_GL_FUNCDECL_SYS (fopen, FILE *,
538 (const char *restrict filename, const char *restrict mode) 577 (const char *restrict filename, const char *restrict mode),
539 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); 578 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1));
540# endif 579# endif
541# if defined GNULIB_POSIXCHECK 580# if defined GNULIB_POSIXCHECK
542# undef fopen
543/* Assume fopen is always declared. */ 581/* Assume fopen is always declared. */
544_GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - " 582_GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - "
545 "use gnulib module fopen for portability"); 583 "use gnulib module fopen for portability");
546# endif 584# endif
547#endif 585#endif
548 586
587#if @GNULIB_FZPRINTF@
588/* Prints formatted output to stream FP.
589 Returns the number of bytes written to the stream. Upon failure,
590 returns -1 with the stream's error indicator set.
591 Failure cause EOVERFLOW can only occur when a width > INT_MAX is used.
592 Therefore, if the format string is valid and does not use %ls/%lc
593 directives nor widths, the only possible failure causes are ENOMEM
594 and the possible failure causes from fwrite(). */
595_GL_FUNCDECL_SYS (fzprintf, off64_t,
596 (FILE *restrict fp, const char *restrict format, ...),
597 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
598 _GL_ARG_NONNULL ((1, 2)));
599_GL_CXXALIAS_SYS (fzprintf, off64_t,
600 (FILE *restrict fp, const char *restrict format, ...));
601#endif
602
549#if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@ 603#if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
604/* Prints formatted output to stream FP.
605 Returns the number of bytes written to the stream. Upon failure,
606 returns a negative value with the stream's error indicator set. */
550# if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \ 607# if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
551 || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) 608 || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
552# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 609# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -555,12 +612,12 @@ _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX complian
555# define GNULIB_overrides_fprintf 1 612# define GNULIB_overrides_fprintf 1
556# if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ 613# if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
557_GL_FUNCDECL_RPL (fprintf, int, 614_GL_FUNCDECL_RPL (fprintf, int,
558 (FILE *restrict fp, const char *restrict format, ...) 615 (FILE *restrict fp, const char *restrict format, ...),
559 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 616 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
560 _GL_ARG_NONNULL ((1, 2))); 617 _GL_ARG_NONNULL ((1, 2)));
561# else 618# else
562_GL_FUNCDECL_RPL (fprintf, int, 619_GL_FUNCDECL_RPL (fprintf, int,
563 (FILE *restrict fp, const char *restrict format, ...) 620 (FILE *restrict fp, const char *restrict format, ...),
564 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3) 621 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
565 _GL_ARG_NONNULL ((1, 2))); 622 _GL_ARG_NONNULL ((1, 2)));
566# endif 623# endif
@@ -573,11 +630,13 @@ _GL_CXXALIAS_SYS (fprintf, int,
573# if __GLIBC__ >= 2 630# if __GLIBC__ >= 2
574_GL_CXXALIASWARN (fprintf); 631_GL_CXXALIASWARN (fprintf);
575# endif 632# endif
576#endif 633#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO
577#if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK 634# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
578# if !GNULIB_overrides_fprintf
579# undef fprintf 635# undef fprintf
636# define fprintf gl_consolesafe_fprintf
580# endif 637# endif
638#endif
639#if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
581/* Assume fprintf is always declared. */ 640/* Assume fprintf is always declared. */
582_GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - " 641_GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
583 "use gnulib module fprintf-posix for portable " 642 "use gnulib module fprintf-posix for portable "
@@ -595,17 +654,18 @@ _GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
595# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 654# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
596# define fpurge rpl_fpurge 655# define fpurge rpl_fpurge
597# endif 656# endif
598_GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); 657_GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream), _GL_ARG_NONNULL ((1)));
599_GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream)); 658_GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream));
600# else 659# else
601# if !@HAVE_DECL_FPURGE@ 660# if !@HAVE_DECL_FPURGE@
602_GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); 661_GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream), _GL_ARG_NONNULL ((1)));
603# endif 662# endif
604_GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream)); 663_GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream));
605# endif 664# endif
665# if __GLIBC__ >= 2
606_GL_CXXALIASWARN (fpurge); 666_GL_CXXALIASWARN (fpurge);
667# endif
607#elif defined GNULIB_POSIXCHECK 668#elif defined GNULIB_POSIXCHECK
608# undef fpurge
609# if HAVE_RAW_DECL_FPURGE 669# if HAVE_RAW_DECL_FPURGE
610_GL_WARN_ON_USE (fpurge, "fpurge is not always present - " 670_GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
611 "use gnulib module fpurge for portability"); 671 "use gnulib module fpurge for portability");
@@ -618,7 +678,7 @@ _GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
618# undef fputc 678# undef fputc
619# define fputc rpl_fputc 679# define fputc rpl_fputc
620# endif 680# endif
621_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); 681_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream), _GL_ARG_NONNULL ((2)));
622_GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream)); 682_GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
623# else 683# else
624_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream)); 684_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
@@ -635,7 +695,7 @@ _GL_CXXALIASWARN (fputc);
635# define fputs rpl_fputs 695# define fputs rpl_fputs
636# endif 696# endif
637_GL_FUNCDECL_RPL (fputs, int, 697_GL_FUNCDECL_RPL (fputs, int,
638 (const char *restrict string, FILE *restrict stream) 698 (const char *restrict string, FILE *restrict stream),
639 _GL_ARG_NONNULL ((1, 2))); 699 _GL_ARG_NONNULL ((1, 2)));
640_GL_CXXALIAS_RPL (fputs, int, 700_GL_CXXALIAS_RPL (fputs, int,
641 (const char *restrict string, FILE *restrict stream)); 701 (const char *restrict string, FILE *restrict stream));
@@ -656,8 +716,8 @@ _GL_CXXALIASWARN (fputs);
656# endif 716# endif
657_GL_FUNCDECL_RPL (fread, size_t, 717_GL_FUNCDECL_RPL (fread, size_t,
658 (void *restrict ptr, size_t s, size_t n, 718 (void *restrict ptr, size_t s, size_t n,
659 FILE *restrict stream) 719 FILE *restrict stream),
660 _GL_ARG_NONNULL ((4))); 720 _GL_ARG_NONNULL ((4)) _GL_ATTRIBUTE_NODISCARD);
661_GL_CXXALIAS_RPL (fread, size_t, 721_GL_CXXALIAS_RPL (fread, size_t,
662 (void *restrict ptr, size_t s, size_t n, 722 (void *restrict ptr, size_t s, size_t n,
663 FILE *restrict stream)); 723 FILE *restrict stream));
@@ -679,8 +739,8 @@ _GL_CXXALIASWARN (fread);
679# endif 739# endif
680_GL_FUNCDECL_RPL (freopen, FILE *, 740_GL_FUNCDECL_RPL (freopen, FILE *,
681 (const char *restrict filename, const char *restrict mode, 741 (const char *restrict filename, const char *restrict mode,
682 FILE *restrict stream) 742 FILE *restrict stream),
683 _GL_ARG_NONNULL ((2, 3))); 743 _GL_ARG_NONNULL ((2, 3)) _GL_ATTRIBUTE_NODISCARD);
684_GL_CXXALIAS_RPL (freopen, FILE *, 744_GL_CXXALIAS_RPL (freopen, FILE *,
685 (const char *restrict filename, const char *restrict mode, 745 (const char *restrict filename, const char *restrict mode,
686 FILE *restrict stream)); 746 FILE *restrict stream));
@@ -693,7 +753,6 @@ _GL_CXXALIAS_SYS (freopen, FILE *,
693_GL_CXXALIASWARN (freopen); 753_GL_CXXALIASWARN (freopen);
694# endif 754# endif
695#elif defined GNULIB_POSIXCHECK 755#elif defined GNULIB_POSIXCHECK
696# undef freopen
697/* Assume freopen is always declared. */ 756/* Assume freopen is always declared. */
698_GL_WARN_ON_USE (freopen, 757_GL_WARN_ON_USE (freopen,
699 "freopen on native Windows platforms is not POSIX compliant - " 758 "freopen on native Windows platforms is not POSIX compliant - "
@@ -707,9 +766,9 @@ _GL_WARN_ON_USE (freopen,
707# define fscanf rpl_fscanf 766# define fscanf rpl_fscanf
708# endif 767# endif
709_GL_FUNCDECL_RPL (fscanf, int, 768_GL_FUNCDECL_RPL (fscanf, int,
710 (FILE *restrict stream, const char *restrict format, ...) 769 (FILE *restrict stream, const char *restrict format, ...),
711 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3) 770 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3)
712 _GL_ARG_NONNULL ((1, 2))); 771 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
713_GL_CXXALIAS_RPL (fscanf, int, 772_GL_CXXALIAS_RPL (fscanf, int,
714 (FILE *restrict stream, const char *restrict format, ...)); 773 (FILE *restrict stream, const char *restrict format, ...));
715# else 774# else
@@ -763,7 +822,7 @@ _GL_CXXALIASWARN (fscanf);
763# undef fseek 822# undef fseek
764# define fseek rpl_fseek 823# define fseek rpl_fseek
765# endif 824# endif
766_GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence) 825_GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence),
767 _GL_ARG_NONNULL ((1))); 826 _GL_ARG_NONNULL ((1)));
768_GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence)); 827_GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
769# else 828# else
@@ -786,12 +845,12 @@ _GL_CXXALIASWARN (fseek);
786# undef fseeko 845# undef fseeko
787# define fseeko rpl_fseeko 846# define fseeko rpl_fseeko
788# endif 847# endif
789_GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence) 848_GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence),
790 _GL_ARG_NONNULL ((1))); 849 _GL_ARG_NONNULL ((1)));
791_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)); 850_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
792# else 851# else
793# if ! @HAVE_DECL_FSEEKO@ 852# if ! @HAVE_DECL_FSEEKO@
794_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence) 853_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence),
795 _GL_ARG_NONNULL ((1))); 854 _GL_ARG_NONNULL ((1)));
796# endif 855# endif
797_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)); 856_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
@@ -800,7 +859,6 @@ _GL_CXXALIASWARN (fseeko);
800#elif defined GNULIB_POSIXCHECK 859#elif defined GNULIB_POSIXCHECK
801# define _GL_FSEEK_WARN /* Category 1, above. */ 860# define _GL_FSEEK_WARN /* Category 1, above. */
802# undef fseek 861# undef fseek
803# undef fseeko
804# if HAVE_RAW_DECL_FSEEKO 862# if HAVE_RAW_DECL_FSEEKO
805_GL_WARN_ON_USE (fseeko, "fseeko is unportable - " 863_GL_WARN_ON_USE (fseeko, "fseeko is unportable - "
806 "use gnulib module fseeko for portability"); 864 "use gnulib module fseeko for portability");
@@ -829,7 +887,8 @@ _GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB "
829# undef ftell 887# undef ftell
830# define ftell rpl_ftell 888# define ftell rpl_ftell
831# endif 889# endif
832_GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1))); 890_GL_FUNCDECL_RPL (ftell, long, (FILE *fp),
891 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
833_GL_CXXALIAS_RPL (ftell, long, (FILE *fp)); 892_GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
834# else 893# else
835_GL_CXXALIAS_SYS (ftell, long, (FILE *fp)); 894_GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
@@ -849,11 +908,13 @@ _GL_CXXALIASWARN (ftell);
849# undef ftello 908# undef ftello
850# define ftello rpl_ftello 909# define ftello rpl_ftello
851# endif 910# endif
852_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); 911_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp),
912 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
853_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp)); 913_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp));
854# else 914# else
855# if ! @HAVE_DECL_FTELLO@ 915# if ! @HAVE_DECL_FTELLO@
856_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); 916_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp),
917 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
857# endif 918# endif
858_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp)); 919_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
859# endif 920# endif
@@ -861,7 +922,6 @@ _GL_CXXALIASWARN (ftello);
861#elif defined GNULIB_POSIXCHECK 922#elif defined GNULIB_POSIXCHECK
862# define _GL_FTELL_WARN /* Category 1, above. */ 923# define _GL_FTELL_WARN /* Category 1, above. */
863# undef ftell 924# undef ftell
864# undef ftello
865# if HAVE_RAW_DECL_FTELLO 925# if HAVE_RAW_DECL_FTELLO
866_GL_WARN_ON_USE (ftello, "ftello is unportable - " 926_GL_WARN_ON_USE (ftello, "ftello is unportable - "
867 "use gnulib module ftello for portability"); 927 "use gnulib module ftello for portability");
@@ -886,7 +946,7 @@ _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
886# endif 946# endif
887_GL_FUNCDECL_RPL (fwrite, size_t, 947_GL_FUNCDECL_RPL (fwrite, size_t,
888 (const void *restrict ptr, size_t s, size_t n, 948 (const void *restrict ptr, size_t s, size_t n,
889 FILE *restrict stream) 949 FILE *restrict stream),
890 _GL_ARG_NONNULL ((1, 4))); 950 _GL_ARG_NONNULL ((1, 4)));
891_GL_CXXALIAS_RPL (fwrite, size_t, 951_GL_CXXALIAS_RPL (fwrite, size_t,
892 (const void *restrict ptr, size_t s, size_t n, 952 (const void *restrict ptr, size_t s, size_t n,
@@ -897,13 +957,13 @@ _GL_CXXALIAS_SYS (fwrite, size_t,
897 FILE *restrict stream)); 957 FILE *restrict stream));
898 958
899/* Work around bug 11959 when fortifying glibc 2.4 through 2.15 959/* Work around bug 11959 when fortifying glibc 2.4 through 2.15
900 <https://sourceware.org/bugzilla/show_bug.cgi?id=11959>, 960 <https://sourceware.org/PR11959>,
901 which sometimes causes an unwanted diagnostic for fwrite calls. 961 which sometimes causes an unwanted diagnostic for fwrite calls.
902 This affects only function declaration attributes under certain 962 This affects only function declaration attributes under certain
903 versions of gcc and clang, and is not needed for C++. */ 963 versions of gcc and clang, and is not needed for C++. */
904# if (0 < __USE_FORTIFY_LEVEL \ 964# if (0 < __USE_FORTIFY_LEVEL \
905 && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \ 965 && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \
906 && 3 < __GNUC__ + (4 <= __GNUC_MINOR__) \ 966 && (3 < __GNUC__ + (4 <= __GNUC_MINOR__) || defined __clang__) \
907 && !defined __cplusplus) 967 && !defined __cplusplus)
908# undef fwrite 968# undef fwrite
909# undef fwrite_unlocked 969# undef fwrite_unlocked
@@ -922,6 +982,11 @@ _GL_EXTERN_C size_t __REDIRECT (rpl_fwrite_unlocked,
922# if __GLIBC__ >= 2 982# if __GLIBC__ >= 2
923_GL_CXXALIASWARN (fwrite); 983_GL_CXXALIASWARN (fwrite);
924# endif 984# endif
985#elif (defined _WIN32 && !defined __CYGWIN__) && !defined _UCRT
986# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
987# undef fwrite
988# define fwrite gl_consolesafe_fwrite
989# endif
925#endif 990#endif
926 991
927#if @GNULIB_GETC@ 992#if @GNULIB_GETC@
@@ -930,7 +995,7 @@ _GL_CXXALIASWARN (fwrite);
930# undef getc 995# undef getc
931# define getc rpl_fgetc 996# define getc rpl_fgetc
932# endif 997# endif
933_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); 998_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream), _GL_ARG_NONNULL ((1)));
934_GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream)); 999_GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream));
935# else 1000# else
936_GL_CXXALIAS_SYS (getc, int, (FILE *stream)); 1001_GL_CXXALIAS_SYS (getc, int, (FILE *stream));
@@ -946,7 +1011,7 @@ _GL_CXXALIASWARN (getc);
946# undef getchar 1011# undef getchar
947# define getchar rpl_getchar 1012# define getchar rpl_getchar
948# endif 1013# endif
949_GL_FUNCDECL_RPL (getchar, int, (void)); 1014_GL_FUNCDECL_RPL (getchar, int, (void), );
950_GL_CXXALIAS_RPL (getchar, int, (void)); 1015_GL_CXXALIAS_RPL (getchar, int, (void));
951# else 1016# else
952_GL_CXXALIAS_SYS (getchar, int, (void)); 1017_GL_CXXALIAS_SYS (getchar, int, (void));
@@ -968,11 +1033,22 @@ _GL_CXXALIASWARN (getchar);
968# undef getdelim 1033# undef getdelim
969# define getdelim rpl_getdelim 1034# define getdelim rpl_getdelim
970# endif 1035# endif
1036# ifndef __has_feature
1037# define __has_feature(a) 0
1038# endif
1039# if __GLIBC__ >= 2 && !(defined __SANITIZE_ADDRESS__ \
1040 || __has_feature (address_sanitizer))
1041/* Arrange for the inline definition of getline() in <bits/stdio.h>
1042 to call our getdelim() override. Do not use the __getdelim symbol
1043 if address sanitizer is in use, otherwise it may be overridden by
1044 __interceptor_trampoline___getdelim. */
1045# define rpl_getdelim __getdelim
1046# endif
971_GL_FUNCDECL_RPL (getdelim, ssize_t, 1047_GL_FUNCDECL_RPL (getdelim, ssize_t,
972 (char **restrict lineptr, size_t *restrict linesize, 1048 (char **restrict lineptr, size_t *restrict linesize,
973 int delimiter, 1049 int delimiter,
974 FILE *restrict stream) 1050 FILE *restrict stream),
975 _GL_ARG_NONNULL ((1, 2, 4))); 1051 _GL_ARG_NONNULL ((1, 2, 4)) _GL_ATTRIBUTE_NODISCARD);
976_GL_CXXALIAS_RPL (getdelim, ssize_t, 1052_GL_CXXALIAS_RPL (getdelim, ssize_t,
977 (char **restrict lineptr, size_t *restrict linesize, 1053 (char **restrict lineptr, size_t *restrict linesize,
978 int delimiter, 1054 int delimiter,
@@ -982,8 +1058,8 @@ _GL_CXXALIAS_RPL (getdelim, ssize_t,
982_GL_FUNCDECL_SYS (getdelim, ssize_t, 1058_GL_FUNCDECL_SYS (getdelim, ssize_t,
983 (char **restrict lineptr, size_t *restrict linesize, 1059 (char **restrict lineptr, size_t *restrict linesize,
984 int delimiter, 1060 int delimiter,
985 FILE *restrict stream) 1061 FILE *restrict stream),
986 _GL_ARG_NONNULL ((1, 2, 4))); 1062 _GL_ARG_NONNULL ((1, 2, 4)) _GL_ATTRIBUTE_NODISCARD);
987# endif 1063# endif
988_GL_CXXALIAS_SYS (getdelim, ssize_t, 1064_GL_CXXALIAS_SYS (getdelim, ssize_t,
989 (char **restrict lineptr, size_t *restrict linesize, 1065 (char **restrict lineptr, size_t *restrict linesize,
@@ -994,7 +1070,6 @@ _GL_CXXALIAS_SYS (getdelim, ssize_t,
994_GL_CXXALIASWARN (getdelim); 1070_GL_CXXALIASWARN (getdelim);
995# endif 1071# endif
996#elif defined GNULIB_POSIXCHECK 1072#elif defined GNULIB_POSIXCHECK
997# undef getdelim
998# if HAVE_RAW_DECL_GETDELIM 1073# if HAVE_RAW_DECL_GETDELIM
999_GL_WARN_ON_USE (getdelim, "getdelim is unportable - " 1074_GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
1000 "use gnulib module getdelim for portability"); 1075 "use gnulib module getdelim for portability");
@@ -1009,14 +1084,27 @@ _GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
1009 Return the number of bytes read and stored at *LINEPTR (not including the 1084 Return the number of bytes read and stored at *LINEPTR (not including the
1010 NUL terminator), or -1 on error or EOF. */ 1085 NUL terminator), or -1 on error or EOF. */
1011# if @REPLACE_GETLINE@ 1086# if @REPLACE_GETLINE@
1012# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1087_GL_FUNCDECL_RPL (getline, ssize_t,
1088 (char **restrict lineptr, size_t *restrict linesize,
1089 FILE *restrict stream),
1090 _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD);
1091# if defined __cplusplus
1092/* The C++ standard library defines std::basic_istream::getline in <istream>
1093 or <string>. */
1094# if !(__GLIBC__ >= 2)
1095extern "C" {
1096inline ssize_t
1097getline (char **restrict lineptr, size_t *restrict linesize,
1098 FILE *restrict stream)
1099{
1100 return rpl_getline (lineptr, linesize, stream);
1101}
1102}
1103# endif
1104# else
1013# undef getline 1105# undef getline
1014# define getline rpl_getline 1106# define getline rpl_getline
1015# endif 1107# endif
1016_GL_FUNCDECL_RPL (getline, ssize_t,
1017 (char **restrict lineptr, size_t *restrict linesize,
1018 FILE *restrict stream)
1019 _GL_ARG_NONNULL ((1, 2, 3)));
1020_GL_CXXALIAS_RPL (getline, ssize_t, 1108_GL_CXXALIAS_RPL (getline, ssize_t,
1021 (char **restrict lineptr, size_t *restrict linesize, 1109 (char **restrict lineptr, size_t *restrict linesize,
1022 FILE *restrict stream)); 1110 FILE *restrict stream));
@@ -1024,8 +1112,8 @@ _GL_CXXALIAS_RPL (getline, ssize_t,
1024# if !@HAVE_DECL_GETLINE@ 1112# if !@HAVE_DECL_GETLINE@
1025_GL_FUNCDECL_SYS (getline, ssize_t, 1113_GL_FUNCDECL_SYS (getline, ssize_t,
1026 (char **restrict lineptr, size_t *restrict linesize, 1114 (char **restrict lineptr, size_t *restrict linesize,
1027 FILE *restrict stream) 1115 FILE *restrict stream),
1028 _GL_ARG_NONNULL ((1, 2, 3))); 1116 _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD);
1029# endif 1117# endif
1030_GL_CXXALIAS_SYS (getline, ssize_t, 1118_GL_CXXALIAS_SYS (getline, ssize_t,
1031 (char **restrict lineptr, size_t *restrict linesize, 1119 (char **restrict lineptr, size_t *restrict linesize,
@@ -1035,7 +1123,6 @@ _GL_CXXALIAS_SYS (getline, ssize_t,
1035_GL_CXXALIASWARN (getline); 1123_GL_CXXALIASWARN (getline);
1036# endif 1124# endif
1037#elif defined GNULIB_POSIXCHECK 1125#elif defined GNULIB_POSIXCHECK
1038# undef getline
1039# if HAVE_RAW_DECL_GETLINE 1126# if HAVE_RAW_DECL_GETLINE
1040_GL_WARN_ON_USE (getline, "getline is unportable - " 1127_GL_WARN_ON_USE (getline, "getline is unportable - "
1041 "use gnulib module getline for portability"); 1128 "use gnulib module getline for portability");
@@ -1045,7 +1132,6 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
1045/* It is very rare that the developer ever has full control of stdin, 1132/* It is very rare that the developer ever has full control of stdin,
1046 so any use of gets warrants an unconditional warning; besides, C11 1133 so any use of gets warrants an unconditional warning; besides, C11
1047 removed it. */ 1134 removed it. */
1048#undef gets
1049#if HAVE_RAW_DECL_GETS && !defined __cplusplus 1135#if HAVE_RAW_DECL_GETS && !defined __cplusplus
1050_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); 1136_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
1051#endif 1137#endif
@@ -1064,7 +1150,7 @@ _GL_CXXALIAS_MDA (getw, int, (FILE *restrict stream));
1064# if @HAVE_DECL_GETW@ 1150# if @HAVE_DECL_GETW@
1065# if defined __APPLE__ && defined __MACH__ 1151# if defined __APPLE__ && defined __MACH__
1066/* The presence of the declaration depends on _POSIX_C_SOURCE. */ 1152/* The presence of the declaration depends on _POSIX_C_SOURCE. */
1067_GL_FUNCDECL_SYS (getw, int, (FILE *restrict stream)); 1153_GL_FUNCDECL_SYS (getw, int, (FILE *restrict stream), );
1068# endif 1154# endif
1069_GL_CXXALIAS_SYS (getw, int, (FILE *restrict stream)); 1155_GL_CXXALIAS_SYS (getw, int, (FILE *restrict stream));
1070# endif 1156# endif
@@ -1074,19 +1160,45 @@ _GL_CXXALIASWARN (getw);
1074# endif 1160# endif
1075#endif 1161#endif
1076 1162
1163#if @GNULIB_OBSTACK_ZPRINTF@
1164struct obstack;
1165/* Grows an obstack with formatted output. Returns the number of
1166 bytes added to OBS. No trailing nul byte is added, and the
1167 object should be closed with obstack_finish before use.
1168 Upon memory allocation error, calls obstack_alloc_failed_handler.
1169 Upon other error, returns -1 with errno set.
1170
1171 Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
1172 Therefore, if the format string is valid and does not use %ls/%lc
1173 directives nor widths, the only possible failure code is through
1174 obstack_alloc_failed_handler. */
1175_GL_FUNCDECL_SYS (obstack_zprintf, ptrdiff_t,
1176 (struct obstack *obs, const char *format, ...),
1177 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1178 _GL_ARG_NONNULL ((1, 2)));
1179_GL_CXXALIAS_SYS (obstack_zprintf, ptrdiff_t,
1180 (struct obstack *obs, const char *format, ...));
1181_GL_FUNCDECL_SYS (obstack_vzprintf, ptrdiff_t,
1182 (struct obstack *obs, const char *format, va_list args),
1183 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1184 _GL_ARG_NONNULL ((1, 2)));
1185_GL_CXXALIAS_SYS (obstack_vzprintf, ptrdiff_t,
1186 (struct obstack *obs, const char *format, va_list args));
1187#endif
1188
1077#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ 1189#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
1078struct obstack; 1190struct obstack;
1079/* Grow an obstack with formatted output. Return the number of 1191/* Grows an obstack with formatted output. Returns the number of
1080 bytes added to OBS. No trailing nul byte is added, and the 1192 bytes added to OBS. No trailing nul byte is added, and the
1081 object should be closed with obstack_finish before use. Upon 1193 object should be closed with obstack_finish before use.
1082 memory allocation error, call obstack_alloc_failed_handler. Upon 1194 Upon memory allocation error, calls obstack_alloc_failed_handler.
1083 other error, return -1. */ 1195 Upon other error, returns -1. */
1084# if @REPLACE_OBSTACK_PRINTF@ 1196# if @REPLACE_OBSTACK_PRINTF@
1085# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1197# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1086# define obstack_printf rpl_obstack_printf 1198# define obstack_printf rpl_obstack_printf
1087# endif 1199# endif
1088_GL_FUNCDECL_RPL (obstack_printf, int, 1200_GL_FUNCDECL_RPL (obstack_printf, int,
1089 (struct obstack *obs, const char *format, ...) 1201 (struct obstack *obs, const char *format, ...),
1090 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1202 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1091 _GL_ARG_NONNULL ((1, 2))); 1203 _GL_ARG_NONNULL ((1, 2)));
1092_GL_CXXALIAS_RPL (obstack_printf, int, 1204_GL_CXXALIAS_RPL (obstack_printf, int,
@@ -1094,7 +1206,7 @@ _GL_CXXALIAS_RPL (obstack_printf, int,
1094# else 1206# else
1095# if !@HAVE_DECL_OBSTACK_PRINTF@ 1207# if !@HAVE_DECL_OBSTACK_PRINTF@
1096_GL_FUNCDECL_SYS (obstack_printf, int, 1208_GL_FUNCDECL_SYS (obstack_printf, int,
1097 (struct obstack *obs, const char *format, ...) 1209 (struct obstack *obs, const char *format, ...),
1098 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1210 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1099 _GL_ARG_NONNULL ((1, 2))); 1211 _GL_ARG_NONNULL ((1, 2)));
1100# endif 1212# endif
@@ -1107,7 +1219,7 @@ _GL_CXXALIASWARN (obstack_printf);
1107# define obstack_vprintf rpl_obstack_vprintf 1219# define obstack_vprintf rpl_obstack_vprintf
1108# endif 1220# endif
1109_GL_FUNCDECL_RPL (obstack_vprintf, int, 1221_GL_FUNCDECL_RPL (obstack_vprintf, int,
1110 (struct obstack *obs, const char *format, va_list args) 1222 (struct obstack *obs, const char *format, va_list args),
1111 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1223 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1112 _GL_ARG_NONNULL ((1, 2))); 1224 _GL_ARG_NONNULL ((1, 2)));
1113_GL_CXXALIAS_RPL (obstack_vprintf, int, 1225_GL_CXXALIAS_RPL (obstack_vprintf, int,
@@ -1115,7 +1227,7 @@ _GL_CXXALIAS_RPL (obstack_vprintf, int,
1115# else 1227# else
1116# if !@HAVE_DECL_OBSTACK_PRINTF@ 1228# if !@HAVE_DECL_OBSTACK_PRINTF@
1117_GL_FUNCDECL_SYS (obstack_vprintf, int, 1229_GL_FUNCDECL_SYS (obstack_vprintf, int,
1118 (struct obstack *obs, const char *format, va_list args) 1230 (struct obstack *obs, const char *format, va_list args),
1119 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1231 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1120 _GL_ARG_NONNULL ((1, 2))); 1232 _GL_ARG_NONNULL ((1, 2)));
1121# endif 1233# endif
@@ -1127,12 +1239,11 @@ _GL_CXXALIASWARN (obstack_vprintf);
1127 1239
1128#if @GNULIB_PCLOSE@ 1240#if @GNULIB_PCLOSE@
1129# if !@HAVE_PCLOSE@ 1241# if !@HAVE_PCLOSE@
1130_GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); 1242_GL_FUNCDECL_SYS (pclose, int, (FILE *stream), _GL_ARG_NONNULL ((1)));
1131# endif 1243# endif
1132_GL_CXXALIAS_SYS (pclose, int, (FILE *stream)); 1244_GL_CXXALIAS_SYS (pclose, int, (FILE *stream));
1133_GL_CXXALIASWARN (pclose); 1245_GL_CXXALIASWARN (pclose);
1134#elif defined GNULIB_POSIXCHECK 1246#elif defined GNULIB_POSIXCHECK
1135# undef pclose
1136# if HAVE_RAW_DECL_PCLOSE 1247# if HAVE_RAW_DECL_PCLOSE
1137_GL_WARN_ON_USE (pclose, "pclose is unportable - " 1248_GL_WARN_ON_USE (pclose, "pclose is unportable - "
1138 "use gnulib module pclose for more portability"); 1249 "use gnulib module pclose for more portability");
@@ -1147,7 +1258,7 @@ _GL_WARN_ON_USE (pclose, "pclose is unportable - "
1147# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1258# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1148# define perror rpl_perror 1259# define perror rpl_perror
1149# endif 1260# endif
1150_GL_FUNCDECL_RPL (perror, void, (const char *string)); 1261_GL_FUNCDECL_RPL (perror, void, (const char *string), );
1151_GL_CXXALIAS_RPL (perror, void, (const char *string)); 1262_GL_CXXALIAS_RPL (perror, void, (const char *string));
1152# else 1263# else
1153_GL_CXXALIAS_SYS (perror, void, (const char *string)); 1264_GL_CXXALIAS_SYS (perror, void, (const char *string));
@@ -1156,7 +1267,6 @@ _GL_CXXALIAS_SYS (perror, void, (const char *string));
1156_GL_CXXALIASWARN (perror); 1267_GL_CXXALIASWARN (perror);
1157# endif 1268# endif
1158#elif defined GNULIB_POSIXCHECK 1269#elif defined GNULIB_POSIXCHECK
1159# undef perror
1160/* Assume perror is always declared. */ 1270/* Assume perror is always declared. */
1161_GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - " 1271_GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
1162 "use gnulib module perror for portability"); 1272 "use gnulib module perror for portability");
@@ -1169,30 +1279,30 @@ _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
1169# define popen rpl_popen 1279# define popen rpl_popen
1170# endif 1280# endif
1171_GL_FUNCDECL_RPL (popen, FILE *, 1281_GL_FUNCDECL_RPL (popen, FILE *,
1172 (const char *cmd, const char *mode) 1282 (const char *cmd, const char *mode),
1173 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1) 1283 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)
1174 _GL_ATTRIBUTE_MALLOC); 1284 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_NODISCARD);
1175_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); 1285_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
1176# else 1286# else
1177# if !@HAVE_POPEN@ || __GNUC__ >= 11 1287# if !@HAVE_POPEN@ || (__GNUC__ >= 11 && !defined __clang__)
1178_GL_FUNCDECL_SYS (popen, FILE *, 1288_GL_FUNCDECL_SYS (popen, FILE *,
1179 (const char *cmd, const char *mode) 1289 (const char *cmd, const char *mode),
1180 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1) 1290 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)
1181 _GL_ATTRIBUTE_MALLOC); 1291 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_NODISCARD);
1182# endif 1292# endif
1183_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); 1293_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
1184# endif 1294# endif
1185_GL_CXXALIASWARN (popen); 1295_GL_CXXALIASWARN (popen);
1186#else 1296#else
1187# if @GNULIB_PCLOSE@ && __GNUC__ >= 11 && !defined popen 1297# if @GNULIB_PCLOSE@ \
1298 && (__GNUC__ >= 11 && !defined __clang__) && !defined popen
1188/* For -Wmismatched-dealloc: Associate popen with pclose or rpl_pclose. */ 1299/* For -Wmismatched-dealloc: Associate popen with pclose or rpl_pclose. */
1189_GL_FUNCDECL_SYS (popen, FILE *, 1300_GL_FUNCDECL_SYS (popen, FILE *,
1190 (const char *cmd, const char *mode) 1301 (const char *cmd, const char *mode),
1191 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1) 1302 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)
1192 _GL_ATTRIBUTE_MALLOC); 1303 _GL_ATTRIBUTE_MALLOC);
1193# endif 1304# endif
1194# if defined GNULIB_POSIXCHECK 1305# if defined GNULIB_POSIXCHECK
1195# undef popen
1196# if HAVE_RAW_DECL_POPEN 1306# if HAVE_RAW_DECL_POPEN
1197_GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " 1307_GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
1198 "use gnulib module popen or pipe for more portability"); 1308 "use gnulib module popen or pipe for more portability");
@@ -1200,7 +1310,24 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
1200# endif 1310# endif
1201#endif 1311#endif
1202 1312
1313#if @GNULIB_ZPRINTF@
1314/* Prints formatted output to standard output.
1315 Returns the number of bytes written to standard output. Upon failure,
1316 returns -1 with stdout's error indicator set.
1317 Failure cause EOVERFLOW can only occur when a width > INT_MAX is used.
1318 Therefore, if the format string is valid and does not use %ls/%lc
1319 directives nor widths, the only possible failure causes are ENOMEM
1320 and the possible failure causes from fwrite(). */
1321_GL_FUNCDECL_SYS (zprintf, off64_t, (const char *restrict format, ...),
1322 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
1323 _GL_ARG_NONNULL ((1)));
1324_GL_CXXALIAS_SYS (zprintf, off64_t, (const char *restrict format, ...));
1325#endif
1326
1203#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@ 1327#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
1328/* Prints formatted output to standard output.
1329 Returns the number of bytes written to standard output. Upon failure,
1330 returns a negative value with stdout's error indicator set. */
1204# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \ 1331# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
1205 || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) 1332 || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1206# if defined __GNUC__ || defined __clang__ 1333# if defined __GNUC__ || defined __clang__
@@ -1212,14 +1339,14 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
1212_GL_FUNCDECL_RPL_1 (__printf__, int, 1339_GL_FUNCDECL_RPL_1 (__printf__, int,
1213 (const char *restrict format, ...) 1340 (const char *restrict format, ...)
1214 __asm__ (@ASM_SYMBOL_PREFIX@ 1341 __asm__ (@ASM_SYMBOL_PREFIX@
1215 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) 1342 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)),
1216 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) 1343 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
1217 _GL_ARG_NONNULL ((1))); 1344 _GL_ARG_NONNULL ((1)));
1218# else 1345# else
1219_GL_FUNCDECL_RPL_1 (__printf__, int, 1346_GL_FUNCDECL_RPL_1 (__printf__, int,
1220 (const char *restrict format, ...) 1347 (const char *restrict format, ...)
1221 __asm__ (@ASM_SYMBOL_PREFIX@ 1348 __asm__ (@ASM_SYMBOL_PREFIX@
1222 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) 1349 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)),
1223 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2) 1350 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2)
1224 _GL_ARG_NONNULL ((1))); 1351 _GL_ARG_NONNULL ((1)));
1225# endif 1352# endif
@@ -1229,7 +1356,7 @@ _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
1229# define printf rpl_printf 1356# define printf rpl_printf
1230# endif 1357# endif
1231_GL_FUNCDECL_RPL (printf, int, 1358_GL_FUNCDECL_RPL (printf, int,
1232 (const char *restrict format, ...) 1359 (const char *restrict format, ...),
1233 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) 1360 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
1234 _GL_ARG_NONNULL ((1))); 1361 _GL_ARG_NONNULL ((1)));
1235_GL_CXXALIAS_RPL (printf, int, (const char *restrict format, ...)); 1362_GL_CXXALIAS_RPL (printf, int, (const char *restrict format, ...));
@@ -1241,11 +1368,13 @@ _GL_CXXALIAS_SYS (printf, int, (const char *restrict format, ...));
1241# if __GLIBC__ >= 2 1368# if __GLIBC__ >= 2
1242_GL_CXXALIASWARN (printf); 1369_GL_CXXALIASWARN (printf);
1243# endif 1370# endif
1244#endif 1371#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO
1245#if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK 1372# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1246# if !GNULIB_overrides_printf
1247# undef printf 1373# undef printf
1374# define printf gl_consolesafe_printf
1248# endif 1375# endif
1376#endif
1377#if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1249/* Assume printf is always declared. */ 1378/* Assume printf is always declared. */
1250_GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - " 1379_GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
1251 "use gnulib module printf-posix for portable " 1380 "use gnulib module printf-posix for portable "
@@ -1258,7 +1387,7 @@ _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
1258# undef putc 1387# undef putc
1259# define putc rpl_fputc 1388# define putc rpl_fputc
1260# endif 1389# endif
1261_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); 1390_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream), _GL_ARG_NONNULL ((2)));
1262_GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream)); 1391_GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
1263# else 1392# else
1264_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream)); 1393_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
@@ -1274,7 +1403,7 @@ _GL_CXXALIASWARN (putc);
1274# undef putchar 1403# undef putchar
1275# define putchar rpl_putchar 1404# define putchar rpl_putchar
1276# endif 1405# endif
1277_GL_FUNCDECL_RPL (putchar, int, (int c)); 1406_GL_FUNCDECL_RPL (putchar, int, (int c), );
1278_GL_CXXALIAS_RPL (putchar, int, (int c)); 1407_GL_CXXALIAS_RPL (putchar, int, (int c));
1279# else 1408# else
1280_GL_CXXALIAS_SYS (putchar, int, (int c)); 1409_GL_CXXALIAS_SYS (putchar, int, (int c));
@@ -1290,7 +1419,7 @@ _GL_CXXALIASWARN (putchar);
1290# undef puts 1419# undef puts
1291# define puts rpl_puts 1420# define puts rpl_puts
1292# endif 1421# endif
1293_GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1))); 1422_GL_FUNCDECL_RPL (puts, int, (const char *string), _GL_ARG_NONNULL ((1)));
1294_GL_CXXALIAS_RPL (puts, int, (const char *string)); 1423_GL_CXXALIAS_RPL (puts, int, (const char *string));
1295# else 1424# else
1296_GL_CXXALIAS_SYS (puts, int, (const char *string)); 1425_GL_CXXALIAS_SYS (puts, int, (const char *string));
@@ -1314,7 +1443,7 @@ _GL_CXXALIAS_MDA (putw, int, (int w, FILE *restrict stream));
1314# if @HAVE_DECL_PUTW@ 1443# if @HAVE_DECL_PUTW@
1315# if defined __APPLE__ && defined __MACH__ 1444# if defined __APPLE__ && defined __MACH__
1316/* The presence of the declaration depends on _POSIX_C_SOURCE. */ 1445/* The presence of the declaration depends on _POSIX_C_SOURCE. */
1317_GL_FUNCDECL_SYS (putw, int, (int w, FILE *restrict stream)); 1446_GL_FUNCDECL_SYS (putw, int, (int w, FILE *restrict stream), );
1318# endif 1447# endif
1319_GL_CXXALIAS_SYS (putw, int, (int w, FILE *restrict stream)); 1448_GL_CXXALIAS_SYS (putw, int, (int w, FILE *restrict stream));
1320# endif 1449# endif
@@ -1330,7 +1459,7 @@ _GL_CXXALIASWARN (putw);
1330# undef remove 1459# undef remove
1331# define remove rpl_remove 1460# define remove rpl_remove
1332# endif 1461# endif
1333_GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1))); 1462_GL_FUNCDECL_RPL (remove, int, (const char *name), _GL_ARG_NONNULL ((1)));
1334_GL_CXXALIAS_RPL (remove, int, (const char *name)); 1463_GL_CXXALIAS_RPL (remove, int, (const char *name));
1335# else 1464# else
1336_GL_CXXALIAS_SYS (remove, int, (const char *name)); 1465_GL_CXXALIAS_SYS (remove, int, (const char *name));
@@ -1339,7 +1468,6 @@ _GL_CXXALIAS_SYS (remove, int, (const char *name));
1339_GL_CXXALIASWARN (remove); 1468_GL_CXXALIASWARN (remove);
1340# endif 1469# endif
1341#elif defined GNULIB_POSIXCHECK 1470#elif defined GNULIB_POSIXCHECK
1342# undef remove
1343/* Assume remove is always declared. */ 1471/* Assume remove is always declared. */
1344_GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - " 1472_GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - "
1345 "use gnulib module remove for more portability"); 1473 "use gnulib module remove for more portability");
@@ -1352,7 +1480,7 @@ _GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - "
1352# define rename rpl_rename 1480# define rename rpl_rename
1353# endif 1481# endif
1354_GL_FUNCDECL_RPL (rename, int, 1482_GL_FUNCDECL_RPL (rename, int,
1355 (const char *old_filename, const char *new_filename) 1483 (const char *old_filename, const char *new_filename),
1356 _GL_ARG_NONNULL ((1, 2))); 1484 _GL_ARG_NONNULL ((1, 2)));
1357_GL_CXXALIAS_RPL (rename, int, 1485_GL_CXXALIAS_RPL (rename, int,
1358 (const char *old_filename, const char *new_filename)); 1486 (const char *old_filename, const char *new_filename));
@@ -1364,7 +1492,6 @@ _GL_CXXALIAS_SYS (rename, int,
1364_GL_CXXALIASWARN (rename); 1492_GL_CXXALIASWARN (rename);
1365# endif 1493# endif
1366#elif defined GNULIB_POSIXCHECK 1494#elif defined GNULIB_POSIXCHECK
1367# undef rename
1368/* Assume rename is always declared. */ 1495/* Assume rename is always declared. */
1369_GL_WARN_ON_USE (rename, "rename is buggy on some platforms - " 1496_GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
1370 "use gnulib module rename for more portability"); 1497 "use gnulib module rename for more portability");
@@ -1377,14 +1504,14 @@ _GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
1377# define renameat rpl_renameat 1504# define renameat rpl_renameat
1378# endif 1505# endif
1379_GL_FUNCDECL_RPL (renameat, int, 1506_GL_FUNCDECL_RPL (renameat, int,
1380 (int fd1, char const *file1, int fd2, char const *file2) 1507 (int fd1, char const *file1, int fd2, char const *file2),
1381 _GL_ARG_NONNULL ((2, 4))); 1508 _GL_ARG_NONNULL ((2, 4)));
1382_GL_CXXALIAS_RPL (renameat, int, 1509_GL_CXXALIAS_RPL (renameat, int,
1383 (int fd1, char const *file1, int fd2, char const *file2)); 1510 (int fd1, char const *file1, int fd2, char const *file2));
1384# else 1511# else
1385# if !@HAVE_RENAMEAT@ 1512# if !@HAVE_RENAMEAT@
1386_GL_FUNCDECL_SYS (renameat, int, 1513_GL_FUNCDECL_SYS (renameat, int,
1387 (int fd1, char const *file1, int fd2, char const *file2) 1514 (int fd1, char const *file1, int fd2, char const *file2),
1388 _GL_ARG_NONNULL ((2, 4))); 1515 _GL_ARG_NONNULL ((2, 4)));
1389# endif 1516# endif
1390_GL_CXXALIAS_SYS (renameat, int, 1517_GL_CXXALIAS_SYS (renameat, int,
@@ -1392,7 +1519,6 @@ _GL_CXXALIAS_SYS (renameat, int,
1392# endif 1519# endif
1393_GL_CXXALIASWARN (renameat); 1520_GL_CXXALIASWARN (renameat);
1394#elif defined GNULIB_POSIXCHECK 1521#elif defined GNULIB_POSIXCHECK
1395# undef renameat
1396# if HAVE_RAW_DECL_RENAMEAT 1522# if HAVE_RAW_DECL_RENAMEAT
1397_GL_WARN_ON_USE (renameat, "renameat is not portable - " 1523_GL_WARN_ON_USE (renameat, "renameat is not portable - "
1398 "use gnulib module renameat for portability"); 1524 "use gnulib module renameat for portability");
@@ -1410,18 +1536,18 @@ _GL_WARN_ON_USE (renameat, "renameat is not portable - "
1410_GL_FUNCDECL_RPL_1 (__scanf__, int, 1536_GL_FUNCDECL_RPL_1 (__scanf__, int,
1411 (const char *restrict format, ...) 1537 (const char *restrict format, ...)
1412 __asm__ (@ASM_SYMBOL_PREFIX@ 1538 __asm__ (@ASM_SYMBOL_PREFIX@
1413 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)) 1539 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)),
1414 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) 1540 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
1415 _GL_ARG_NONNULL ((1))); 1541 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1416_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *restrict format, ...)); 1542_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *restrict format, ...));
1417# else 1543# else
1418# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1544# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1419# undef scanf 1545# undef scanf
1420# define scanf rpl_scanf 1546# define scanf rpl_scanf
1421# endif 1547# endif
1422_GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...) 1548_GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...),
1423 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) 1549 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
1424 _GL_ARG_NONNULL ((1))); 1550 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1425_GL_CXXALIAS_RPL (scanf, int, (const char *restrict format, ...)); 1551_GL_CXXALIAS_RPL (scanf, int, (const char *restrict format, ...));
1426# endif 1552# endif
1427# else 1553# else
@@ -1432,7 +1558,31 @@ _GL_CXXALIASWARN (scanf);
1432# endif 1558# endif
1433#endif 1559#endif
1434 1560
1561#if @GNULIB_SNZPRINTF@
1562/* Prints formatted output to string STR. Similar to sprintf, but the
1563 additional parameter SIZE limits how much is written into STR.
1564 STR may be NULL, in which case nothing will be written.
1565 Returns the string length of the formatted string (which may be larger
1566 than SIZE). Upon failure, returns -1 with errno set.
1567 Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
1568 Therefore, if the format string is valid and does not use %ls/%lc
1569 directives nor widths, the only possible failure code is ENOMEM. */
1570_GL_FUNCDECL_SYS (snzprintf, ptrdiff_t,
1571 (char *restrict str, size_t size,
1572 const char *restrict format, ...),
1573 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
1574 _GL_ARG_NONNULL ((3)));
1575_GL_CXXALIAS_SYS (snzprintf, ptrdiff_t,
1576 (char *restrict str, size_t size,
1577 const char *restrict format, ...));
1578#endif
1579
1435#if @GNULIB_SNPRINTF@ 1580#if @GNULIB_SNPRINTF@
1581/* Prints formatted output to string STR. Similar to sprintf, but the
1582 additional parameter SIZE limits how much is written into STR.
1583 STR may be NULL, in which case nothing will be written.
1584 Returns the string length of the formatted string (which may be larger
1585 than SIZE). Upon failure, returns a negative value. */
1436# if @REPLACE_SNPRINTF@ 1586# if @REPLACE_SNPRINTF@
1437# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1587# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1438# define snprintf rpl_snprintf 1588# define snprintf rpl_snprintf
@@ -1440,7 +1590,7 @@ _GL_CXXALIASWARN (scanf);
1440# define GNULIB_overrides_snprintf 1 1590# define GNULIB_overrides_snprintf 1
1441_GL_FUNCDECL_RPL (snprintf, int, 1591_GL_FUNCDECL_RPL (snprintf, int,
1442 (char *restrict str, size_t size, 1592 (char *restrict str, size_t size,
1443 const char *restrict format, ...) 1593 const char *restrict format, ...),
1444 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4) 1594 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
1445 _GL_ARG_NONNULL ((3))); 1595 _GL_ARG_NONNULL ((3)));
1446_GL_CXXALIAS_RPL (snprintf, int, 1596_GL_CXXALIAS_RPL (snprintf, int,
@@ -1450,7 +1600,7 @@ _GL_CXXALIAS_RPL (snprintf, int,
1450# if !@HAVE_DECL_SNPRINTF@ 1600# if !@HAVE_DECL_SNPRINTF@
1451_GL_FUNCDECL_SYS (snprintf, int, 1601_GL_FUNCDECL_SYS (snprintf, int,
1452 (char *restrict str, size_t size, 1602 (char *restrict str, size_t size,
1453 const char *restrict format, ...) 1603 const char *restrict format, ...),
1454 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4) 1604 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
1455 _GL_ARG_NONNULL ((3))); 1605 _GL_ARG_NONNULL ((3)));
1456# endif 1606# endif
@@ -1462,13 +1612,29 @@ _GL_CXXALIAS_SYS (snprintf, int,
1462_GL_CXXALIASWARN (snprintf); 1612_GL_CXXALIASWARN (snprintf);
1463# endif 1613# endif
1464#elif defined GNULIB_POSIXCHECK 1614#elif defined GNULIB_POSIXCHECK
1465# undef snprintf
1466# if HAVE_RAW_DECL_SNPRINTF 1615# if HAVE_RAW_DECL_SNPRINTF
1467_GL_WARN_ON_USE (snprintf, "snprintf is unportable - " 1616_GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
1468 "use gnulib module snprintf for portability"); 1617 "use gnulib module snprintf for portability");
1469# endif 1618# endif
1470#endif 1619#endif
1471 1620
1621#if @GNULIB_SZPRINTF@
1622/* Prints formatted output to string STR.
1623 Returns the string length of the formatted string. Upon failure,
1624 returns -1 with errno set.
1625 Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
1626 Therefore, if the format string is valid and does not use %ls/%lc
1627 directives nor widths, the only possible failure code is ENOMEM. */
1628_GL_FUNCDECL_SYS (szprintf, ptrdiff_t,
1629 (char *restrict str,
1630 const char *restrict format, ...),
1631 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1632 _GL_ARG_NONNULL ((1, 2)));
1633_GL_CXXALIAS_SYS (szprintf, ptrdiff_t,
1634 (char *restrict str,
1635 const char *restrict format, ...));
1636#endif
1637
1472/* Some people would argue that all sprintf uses should be warned about 1638/* Some people would argue that all sprintf uses should be warned about
1473 (for example, OpenBSD issues a link warning for it), 1639 (for example, OpenBSD issues a link warning for it),
1474 since it can cause security holes due to buffer overruns. 1640 since it can cause security holes due to buffer overruns.
@@ -1479,13 +1645,16 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
1479 GNULIB_POSIXCHECK is defined. */ 1645 GNULIB_POSIXCHECK is defined. */
1480 1646
1481#if @GNULIB_SPRINTF_POSIX@ 1647#if @GNULIB_SPRINTF_POSIX@
1648/* Prints formatted output to string STR.
1649 Returns the string length of the formatted string. Upon failure,
1650 returns a negative value. */
1482# if @REPLACE_SPRINTF@ 1651# if @REPLACE_SPRINTF@
1483# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1652# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1484# define sprintf rpl_sprintf 1653# define sprintf rpl_sprintf
1485# endif 1654# endif
1486# define GNULIB_overrides_sprintf 1 1655# define GNULIB_overrides_sprintf 1
1487_GL_FUNCDECL_RPL (sprintf, int, 1656_GL_FUNCDECL_RPL (sprintf, int,
1488 (char *restrict str, const char *restrict format, ...) 1657 (char *restrict str, const char *restrict format, ...),
1489 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1658 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1490 _GL_ARG_NONNULL ((1, 2))); 1659 _GL_ARG_NONNULL ((1, 2)));
1491_GL_CXXALIAS_RPL (sprintf, int, 1660_GL_CXXALIAS_RPL (sprintf, int,
@@ -1498,7 +1667,6 @@ _GL_CXXALIAS_SYS (sprintf, int,
1498_GL_CXXALIASWARN (sprintf); 1667_GL_CXXALIASWARN (sprintf);
1499# endif 1668# endif
1500#elif defined GNULIB_POSIXCHECK 1669#elif defined GNULIB_POSIXCHECK
1501# undef sprintf
1502/* Assume sprintf is always declared. */ 1670/* Assume sprintf is always declared. */
1503_GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - " 1671_GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
1504 "use gnulib module sprintf-posix for portable " 1672 "use gnulib module sprintf-posix for portable "
@@ -1526,16 +1694,18 @@ _GL_CXXALIASWARN (tempnam);
1526# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1694# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1527# define tmpfile rpl_tmpfile 1695# define tmpfile rpl_tmpfile
1528# endif 1696# endif
1529_GL_FUNCDECL_RPL (tmpfile, FILE *, (void) 1697_GL_FUNCDECL_RPL (tmpfile, FILE *, (void),
1530 _GL_ATTRIBUTE_DEALLOC (fclose, 1) 1698 _GL_ATTRIBUTE_DEALLOC (fclose, 1)
1531 _GL_ATTRIBUTE_MALLOC); 1699 _GL_ATTRIBUTE_MALLOC
1700 _GL_ATTRIBUTE_NODISCARD);
1532_GL_CXXALIAS_RPL (tmpfile, FILE *, (void)); 1701_GL_CXXALIAS_RPL (tmpfile, FILE *, (void));
1533# else 1702# else
1534# if __GNUC__ >= 11 1703# if __GNUC__ >= 11 && !defined __clang__
1535/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */ 1704/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */
1536_GL_FUNCDECL_SYS (tmpfile, FILE *, (void) 1705_GL_FUNCDECL_SYS (tmpfile, FILE *, (void),
1537 _GL_ATTRIBUTE_DEALLOC (fclose, 1) 1706 _GL_ATTRIBUTE_DEALLOC (fclose, 1)
1538 _GL_ATTRIBUTE_MALLOC); 1707 _GL_ATTRIBUTE_MALLOC
1708 _GL_ATTRIBUTE_NODISCARD);
1539# endif 1709# endif
1540_GL_CXXALIAS_SYS (tmpfile, FILE *, (void)); 1710_GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
1541# endif 1711# endif
@@ -1543,14 +1713,14 @@ _GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
1543_GL_CXXALIASWARN (tmpfile); 1713_GL_CXXALIASWARN (tmpfile);
1544# endif 1714# endif
1545#else 1715#else
1546# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined tmpfile 1716# if @GNULIB_FCLOSE@ \
1717 && (__GNUC__ >= 11 && !defined __clang__) && !defined tmpfile
1547/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */ 1718/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */
1548_GL_FUNCDECL_SYS (tmpfile, FILE *, (void) 1719_GL_FUNCDECL_SYS (tmpfile, FILE *, (void),
1549 _GL_ATTRIBUTE_DEALLOC (fclose, 1) 1720 _GL_ATTRIBUTE_DEALLOC (fclose, 1)
1550 _GL_ATTRIBUTE_MALLOC); 1721 _GL_ATTRIBUTE_MALLOC);
1551# endif 1722# endif
1552# if defined GNULIB_POSIXCHECK 1723# if defined GNULIB_POSIXCHECK
1553# undef tmpfile
1554# if HAVE_RAW_DECL_TMPFILE 1724# if HAVE_RAW_DECL_TMPFILE
1555_GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - " 1725_GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
1556 "use gnulib module tmpfile for portability"); 1726 "use gnulib module tmpfile for portability");
@@ -1558,6 +1728,31 @@ _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
1558# endif 1728# endif
1559#endif 1729#endif
1560 1730
1731#if @GNULIB_VASZPRINTF@
1732/* Prints formatted output to a string dynamically allocated with malloc().
1733 If the memory allocation succeeds, it stores the address of the string in
1734 *RESULT and returns the number of resulting bytes, excluding the trailing
1735 NUL. Upon memory allocation error, or some other error, it returns -1
1736 with errno set.
1737 Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
1738 Therefore, if the format string is valid and does not use %ls/%lc
1739 directives nor widths, the only possible failure code is ENOMEM. */
1740_GL_FUNCDECL_SYS (aszprintf, ptrdiff_t,
1741 (char **result, const char *format, ...),
1742 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1743 _GL_ARG_NONNULL ((1, 2))
1744 _GL_ATTRIBUTE_NODISCARD);
1745_GL_CXXALIAS_SYS (aszprintf, ptrdiff_t,
1746 (char **result, const char *format, ...));
1747_GL_FUNCDECL_SYS (vaszprintf, ptrdiff_t,
1748 (char **result, const char *format, va_list args),
1749 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1750 _GL_ARG_NONNULL ((1, 2))
1751 _GL_ATTRIBUTE_NODISCARD);
1752_GL_CXXALIAS_SYS (vaszprintf, ptrdiff_t,
1753 (char **result, const char *format, va_list args));
1754#endif
1755
1561#if @GNULIB_VASPRINTF@ 1756#if @GNULIB_VASPRINTF@
1562/* Write formatted output to a string dynamically allocated with malloc(). 1757/* Write formatted output to a string dynamically allocated with malloc().
1563 If the memory allocation succeeds, store the address of the string in 1758 If the memory allocation succeeds, store the address of the string in
@@ -1569,17 +1764,19 @@ _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
1569# endif 1764# endif
1570# define GNULIB_overrides_asprintf 1765# define GNULIB_overrides_asprintf
1571_GL_FUNCDECL_RPL (asprintf, int, 1766_GL_FUNCDECL_RPL (asprintf, int,
1572 (char **result, const char *format, ...) 1767 (char **result, const char *format, ...),
1573 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1768 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1574 _GL_ARG_NONNULL ((1, 2))); 1769 _GL_ARG_NONNULL ((1, 2))
1770 _GL_ATTRIBUTE_NODISCARD);
1575_GL_CXXALIAS_RPL (asprintf, int, 1771_GL_CXXALIAS_RPL (asprintf, int,
1576 (char **result, const char *format, ...)); 1772 (char **result, const char *format, ...));
1577# else 1773# else
1578# if !@HAVE_VASPRINTF@ 1774# if !@HAVE_VASPRINTF@
1579_GL_FUNCDECL_SYS (asprintf, int, 1775_GL_FUNCDECL_SYS (asprintf, int,
1580 (char **result, const char *format, ...) 1776 (char **result, const char *format, ...),
1581 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1777 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1582 _GL_ARG_NONNULL ((1, 2))); 1778 _GL_ARG_NONNULL ((1, 2))
1779 _GL_ATTRIBUTE_NODISCARD);
1583# endif 1780# endif
1584_GL_CXXALIAS_SYS (asprintf, int, 1781_GL_CXXALIAS_SYS (asprintf, int,
1585 (char **result, const char *format, ...)); 1782 (char **result, const char *format, ...));
@@ -1591,17 +1788,19 @@ _GL_CXXALIASWARN (asprintf);
1591# endif 1788# endif
1592# define GNULIB_overrides_vasprintf 1 1789# define GNULIB_overrides_vasprintf 1
1593_GL_FUNCDECL_RPL (vasprintf, int, 1790_GL_FUNCDECL_RPL (vasprintf, int,
1594 (char **result, const char *format, va_list args) 1791 (char **result, const char *format, va_list args),
1595 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1792 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1596 _GL_ARG_NONNULL ((1, 2))); 1793 _GL_ARG_NONNULL ((1, 2))
1794 _GL_ATTRIBUTE_NODISCARD);
1597_GL_CXXALIAS_RPL (vasprintf, int, 1795_GL_CXXALIAS_RPL (vasprintf, int,
1598 (char **result, const char *format, va_list args)); 1796 (char **result, const char *format, va_list args));
1599# else 1797# else
1600# if !@HAVE_VASPRINTF@ 1798# if !@HAVE_VASPRINTF@
1601_GL_FUNCDECL_SYS (vasprintf, int, 1799_GL_FUNCDECL_SYS (vasprintf, int,
1602 (char **result, const char *format, va_list args) 1800 (char **result, const char *format, va_list args),
1603 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1801 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1604 _GL_ARG_NONNULL ((1, 2))); 1802 _GL_ARG_NONNULL ((1, 2))
1803 _GL_ATTRIBUTE_NODISCARD);
1605# endif 1804# endif
1606_GL_CXXALIAS_SYS (vasprintf, int, 1805_GL_CXXALIAS_SYS (vasprintf, int,
1607 (char **result, const char *format, va_list args)); 1806 (char **result, const char *format, va_list args));
@@ -1609,13 +1808,32 @@ _GL_CXXALIAS_SYS (vasprintf, int,
1609_GL_CXXALIASWARN (vasprintf); 1808_GL_CXXALIASWARN (vasprintf);
1610#endif 1809#endif
1611 1810
1811#if @GNULIB_VDZPRINTF@
1812/* Prints formatted output to file descriptor FD.
1813 Returns the number of bytes written to the file descriptor. Upon
1814 failure, returns -1 with errno set.
1815 Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
1816 Therefore, if the format string is valid and does not use %ls/%lc
1817 directives nor widths, the only possible failure codes are ENOMEM
1818 and the possible failure codes from write(), excluding EINTR. */
1819_GL_FUNCDECL_SYS (vdzprintf, off64_t,
1820 (int fd, const char *restrict format, va_list args),
1821 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1822 _GL_ARG_NONNULL ((2)));
1823_GL_CXXALIAS_SYS (vdzprintf, off64_t,
1824 (int fd, const char *restrict format, va_list args));
1825#endif
1826
1612#if @GNULIB_VDPRINTF@ 1827#if @GNULIB_VDPRINTF@
1828/* Prints formatted output to file descriptor FD.
1829 Returns the number of bytes written to the file descriptor. Upon
1830 failure, returns a negative value. */
1613# if @REPLACE_VDPRINTF@ 1831# if @REPLACE_VDPRINTF@
1614# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1832# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1615# define vdprintf rpl_vdprintf 1833# define vdprintf rpl_vdprintf
1616# endif 1834# endif
1617_GL_FUNCDECL_RPL (vdprintf, int, 1835_GL_FUNCDECL_RPL (vdprintf, int,
1618 (int fd, const char *restrict format, va_list args) 1836 (int fd, const char *restrict format, va_list args),
1619 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1837 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1620 _GL_ARG_NONNULL ((2))); 1838 _GL_ARG_NONNULL ((2)));
1621_GL_CXXALIAS_RPL (vdprintf, int, 1839_GL_CXXALIAS_RPL (vdprintf, int,
@@ -1623,7 +1841,7 @@ _GL_CXXALIAS_RPL (vdprintf, int,
1623# else 1841# else
1624# if !@HAVE_VDPRINTF@ 1842# if !@HAVE_VDPRINTF@
1625_GL_FUNCDECL_SYS (vdprintf, int, 1843_GL_FUNCDECL_SYS (vdprintf, int,
1626 (int fd, const char *restrict format, va_list args) 1844 (int fd, const char *restrict format, va_list args),
1627 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1845 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1628 _GL_ARG_NONNULL ((2))); 1846 _GL_ARG_NONNULL ((2)));
1629# endif 1847# endif
@@ -1636,14 +1854,34 @@ _GL_CXXALIAS_SYS_CAST (vdprintf, int,
1636_GL_CXXALIASWARN (vdprintf); 1854_GL_CXXALIASWARN (vdprintf);
1637# endif 1855# endif
1638#elif defined GNULIB_POSIXCHECK 1856#elif defined GNULIB_POSIXCHECK
1639# undef vdprintf
1640# if HAVE_RAW_DECL_VDPRINTF 1857# if HAVE_RAW_DECL_VDPRINTF
1641_GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - " 1858_GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
1642 "use gnulib module vdprintf for portability"); 1859 "use gnulib module vdprintf for portability");
1643# endif 1860# endif
1644#endif 1861#endif
1645 1862
1863#if @GNULIB_VFZPRINTF@
1864/* Prints formatted output to stream FP.
1865 Returns the number of bytes written to the stream. Upon failure,
1866 returns -1 with the stream's error indicator set.
1867 Failure cause EOVERFLOW can only occur when a width > INT_MAX is used.
1868 Therefore, if the format string is valid and does not use %ls/%lc
1869 directives nor widths, the only possible failure causes are ENOMEM
1870 and the possible failure causes from fwrite(). */
1871_GL_FUNCDECL_SYS (vfzprintf, off64_t,
1872 (FILE *restrict fp,
1873 const char *restrict format, va_list args),
1874 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1875 _GL_ARG_NONNULL ((1, 2)));
1876_GL_CXXALIAS_SYS (vfzprintf, off64_t,
1877 (FILE *restrict fp,
1878 const char *restrict format, va_list args));
1879#endif
1880
1646#if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@ 1881#if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
1882/* Prints formatted output to stream FP.
1883 Returns the number of bytes written to the stream. Upon failure,
1884 returns a negative value with the stream's error indicator set. */
1647# if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \ 1885# if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
1648 || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) 1886 || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1649# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1887# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1653,13 +1891,13 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
1653# if @GNULIB_VFPRINTF_POSIX@ 1891# if @GNULIB_VFPRINTF_POSIX@
1654_GL_FUNCDECL_RPL (vfprintf, int, 1892_GL_FUNCDECL_RPL (vfprintf, int,
1655 (FILE *restrict fp, 1893 (FILE *restrict fp,
1656 const char *restrict format, va_list args) 1894 const char *restrict format, va_list args),
1657 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1895 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1658 _GL_ARG_NONNULL ((1, 2))); 1896 _GL_ARG_NONNULL ((1, 2)));
1659# else 1897# else
1660_GL_FUNCDECL_RPL (vfprintf, int, 1898_GL_FUNCDECL_RPL (vfprintf, int,
1661 (FILE *restrict fp, 1899 (FILE *restrict fp,
1662 const char *restrict format, va_list args) 1900 const char *restrict format, va_list args),
1663 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0) 1901 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0)
1664 _GL_ARG_NONNULL ((1, 2))); 1902 _GL_ARG_NONNULL ((1, 2)));
1665# endif 1903# endif
@@ -1677,11 +1915,13 @@ _GL_CXXALIAS_SYS_CAST (vfprintf, int,
1677# if __GLIBC__ >= 2 1915# if __GLIBC__ >= 2
1678_GL_CXXALIASWARN (vfprintf); 1916_GL_CXXALIASWARN (vfprintf);
1679# endif 1917# endif
1680#endif 1918#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO
1681#if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK 1919# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1682# if !GNULIB_overrides_vfprintf
1683# undef vfprintf 1920# undef vfprintf
1921# define vfprintf gl_consolesafe_vfprintf
1684# endif 1922# endif
1923#endif
1924#if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1685/* Assume vfprintf is always declared. */ 1925/* Assume vfprintf is always declared. */
1686_GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - " 1926_GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
1687 "use gnulib module vfprintf-posix for portable " 1927 "use gnulib module vfprintf-posix for portable "
@@ -1696,9 +1936,9 @@ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
1696# endif 1936# endif
1697_GL_FUNCDECL_RPL (vfscanf, int, 1937_GL_FUNCDECL_RPL (vfscanf, int,
1698 (FILE *restrict stream, 1938 (FILE *restrict stream,
1699 const char *restrict format, va_list args) 1939 const char *restrict format, va_list args),
1700 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0) 1940 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0)
1701 _GL_ARG_NONNULL ((1, 2))); 1941 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1702_GL_CXXALIAS_RPL (vfscanf, int, 1942_GL_CXXALIAS_RPL (vfscanf, int,
1703 (FILE *restrict stream, 1943 (FILE *restrict stream,
1704 const char *restrict format, va_list args)); 1944 const char *restrict format, va_list args));
@@ -1712,7 +1952,26 @@ _GL_CXXALIASWARN (vfscanf);
1712# endif 1952# endif
1713#endif 1953#endif
1714 1954
1955#if @GNULIB_VZPRINTF@
1956/* Prints formatted output to standard output.
1957 Returns the number of bytes written to standard output. Upon failure,
1958 returns -1 with stdout's error indicator set.
1959 Failure cause EOVERFLOW can only occur when a width > INT_MAX is used.
1960 Therefore, if the format string is valid and does not use %ls/%lc
1961 directives nor widths, the only possible failure causes are ENOMEM
1962 and the possible failure causes from fwrite(). */
1963_GL_FUNCDECL_SYS (vzprintf, off64_t,
1964 (const char *restrict format, va_list args),
1965 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0)
1966 _GL_ARG_NONNULL ((1)));
1967_GL_CXXALIAS_SYS (vzprintf, off64_t,
1968 (const char *restrict format, va_list args));
1969#endif
1970
1715#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@ 1971#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
1972/* Prints formatted output to standard output.
1973 Returns the number of bytes written to standard output. Upon failure,
1974 returns a negative value with stdout's error indicator set. */
1716# if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \ 1975# if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
1717 || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) 1976 || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1718# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1977# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1720,11 +1979,11 @@ _GL_CXXALIASWARN (vfscanf);
1720# endif 1979# endif
1721# define GNULIB_overrides_vprintf 1 1980# define GNULIB_overrides_vprintf 1
1722# if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ 1981# if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
1723_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args) 1982_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args),
1724 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0) 1983 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0)
1725 _GL_ARG_NONNULL ((1))); 1984 _GL_ARG_NONNULL ((1)));
1726# else 1985# else
1727_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args) 1986_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args),
1728 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0) 1987 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0)
1729 _GL_ARG_NONNULL ((1))); 1988 _GL_ARG_NONNULL ((1)));
1730# endif 1989# endif
@@ -1739,11 +1998,13 @@ _GL_CXXALIAS_SYS_CAST (vprintf, int,
1739# if __GLIBC__ >= 2 1998# if __GLIBC__ >= 2
1740_GL_CXXALIASWARN (vprintf); 1999_GL_CXXALIASWARN (vprintf);
1741# endif 2000# endif
1742#endif 2001#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO
1743#if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK 2002# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1744# if !GNULIB_overrides_vprintf
1745# undef vprintf 2003# undef vprintf
2004# define vprintf gl_consolesafe_vprintf
1746# endif 2005# endif
2006#endif
2007#if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1747/* Assume vprintf is always declared. */ 2008/* Assume vprintf is always declared. */
1748_GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - " 2009_GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
1749 "use gnulib module vprintf-posix for portable " 2010 "use gnulib module vprintf-posix for portable "
@@ -1756,9 +2017,9 @@ _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
1756# undef vscanf 2017# undef vscanf
1757# define vscanf rpl_vscanf 2018# define vscanf rpl_vscanf
1758# endif 2019# endif
1759_GL_FUNCDECL_RPL (vscanf, int, (const char *restrict format, va_list args) 2020_GL_FUNCDECL_RPL (vscanf, int, (const char *restrict format, va_list args),
1760 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0) 2021 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0)
1761 _GL_ARG_NONNULL ((1))); 2022 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1762_GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args)); 2023_GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args));
1763# else 2024# else
1764_GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args)); 2025_GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args));
@@ -1768,7 +2029,31 @@ _GL_CXXALIASWARN (vscanf);
1768# endif 2029# endif
1769#endif 2030#endif
1770 2031
2032#if @GNULIB_VSNZPRINTF@
2033/* Prints formatted output to string STR. Similar to sprintf, but the
2034 additional parameter SIZE limits how much is written into STR.
2035 STR may be NULL, in which case nothing will be written.
2036 Returns the string length of the formatted string (which may be larger
2037 than SIZE). Upon failure, returns -1 with errno set.
2038 Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
2039 Therefore, if the format string is valid and does not use %ls/%lc
2040 directives nor widths, the only possible failure code is ENOMEM. */
2041_GL_FUNCDECL_SYS (vsnzprintf, ptrdiff_t,
2042 (char *restrict str, size_t size,
2043 const char *restrict format, va_list args),
2044 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
2045 _GL_ARG_NONNULL ((3)));
2046_GL_CXXALIAS_SYS (vsnzprintf, ptrdiff_t,
2047 (char *restrict str, size_t size,
2048 const char *restrict format, va_list args));
2049#endif
2050
1771#if @GNULIB_VSNPRINTF@ 2051#if @GNULIB_VSNPRINTF@
2052/* Prints formatted output to string STR. Similar to vsprintf, but the
2053 additional parameter SIZE limits how much is written into STR.
2054 STR may be NULL, in which case nothing will be written.
2055 Returns the string length of the formatted string (which may be larger
2056 than SIZE). Upon failure, returns a negative value. */
1772# if @REPLACE_VSNPRINTF@ 2057# if @REPLACE_VSNPRINTF@
1773# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2058# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1774# define vsnprintf rpl_vsnprintf 2059# define vsnprintf rpl_vsnprintf
@@ -1776,7 +2061,7 @@ _GL_CXXALIASWARN (vscanf);
1776# define GNULIB_overrides_vsnprintf 1 2061# define GNULIB_overrides_vsnprintf 1
1777_GL_FUNCDECL_RPL (vsnprintf, int, 2062_GL_FUNCDECL_RPL (vsnprintf, int,
1778 (char *restrict str, size_t size, 2063 (char *restrict str, size_t size,
1779 const char *restrict format, va_list args) 2064 const char *restrict format, va_list args),
1780 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) 2065 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
1781 _GL_ARG_NONNULL ((3))); 2066 _GL_ARG_NONNULL ((3)));
1782_GL_CXXALIAS_RPL (vsnprintf, int, 2067_GL_CXXALIAS_RPL (vsnprintf, int,
@@ -1786,7 +2071,7 @@ _GL_CXXALIAS_RPL (vsnprintf, int,
1786# if !@HAVE_DECL_VSNPRINTF@ 2071# if !@HAVE_DECL_VSNPRINTF@
1787_GL_FUNCDECL_SYS (vsnprintf, int, 2072_GL_FUNCDECL_SYS (vsnprintf, int,
1788 (char *restrict str, size_t size, 2073 (char *restrict str, size_t size,
1789 const char *restrict format, va_list args) 2074 const char *restrict format, va_list args),
1790 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) 2075 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
1791 _GL_ARG_NONNULL ((3))); 2076 _GL_ARG_NONNULL ((3)));
1792# endif 2077# endif
@@ -1798,14 +2083,33 @@ _GL_CXXALIAS_SYS (vsnprintf, int,
1798_GL_CXXALIASWARN (vsnprintf); 2083_GL_CXXALIASWARN (vsnprintf);
1799# endif 2084# endif
1800#elif defined GNULIB_POSIXCHECK 2085#elif defined GNULIB_POSIXCHECK
1801# undef vsnprintf
1802# if HAVE_RAW_DECL_VSNPRINTF 2086# if HAVE_RAW_DECL_VSNPRINTF
1803_GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - " 2087_GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
1804 "use gnulib module vsnprintf for portability"); 2088 "use gnulib module vsnprintf for portability");
1805# endif 2089# endif
1806#endif 2090#endif
1807 2091
2092#if @GNULIB_VSZPRINTF@
2093/* Prints formatted output to string STR.
2094 Returns the string length of the formatted string. Upon failure,
2095 returns -1 with errno set.
2096 Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
2097 Therefore, if the format string is valid and does not use %ls/%lc
2098 directives nor widths, the only possible failure code is ENOMEM. */
2099_GL_FUNCDECL_SYS (vszprintf, ptrdiff_t,
2100 (char *restrict str,
2101 const char *restrict format, va_list args),
2102 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
2103 _GL_ARG_NONNULL ((1, 2)));
2104_GL_CXXALIAS_SYS (vszprintf, ptrdiff_t,
2105 (char *restrict str,
2106 const char *restrict format, va_list args));
2107#endif
2108
1808#if @GNULIB_VSPRINTF_POSIX@ 2109#if @GNULIB_VSPRINTF_POSIX@
2110/* Prints formatted output to string STR.
2111 Returns the string length of the formatted string. Upon failure,
2112 returns a negative value. */
1809# if @REPLACE_VSPRINTF@ 2113# if @REPLACE_VSPRINTF@
1810# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2114# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1811# define vsprintf rpl_vsprintf 2115# define vsprintf rpl_vsprintf
@@ -1813,7 +2117,7 @@ _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
1813# define GNULIB_overrides_vsprintf 1 2117# define GNULIB_overrides_vsprintf 1
1814_GL_FUNCDECL_RPL (vsprintf, int, 2118_GL_FUNCDECL_RPL (vsprintf, int,
1815 (char *restrict str, 2119 (char *restrict str,
1816 const char *restrict format, va_list args) 2120 const char *restrict format, va_list args),
1817 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 2121 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1818 _GL_ARG_NONNULL ((1, 2))); 2122 _GL_ARG_NONNULL ((1, 2)));
1819_GL_CXXALIAS_RPL (vsprintf, int, 2123_GL_CXXALIAS_RPL (vsprintf, int,
@@ -1831,7 +2135,6 @@ _GL_CXXALIAS_SYS_CAST (vsprintf, int,
1831_GL_CXXALIASWARN (vsprintf); 2135_GL_CXXALIASWARN (vsprintf);
1832# endif 2136# endif
1833#elif defined GNULIB_POSIXCHECK 2137#elif defined GNULIB_POSIXCHECK
1834# undef vsprintf
1835/* Assume vsprintf is always declared. */ 2138/* Assume vsprintf is always declared. */
1836_GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - " 2139_GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
1837 "use gnulib module vsprintf-posix for portable " 2140 "use gnulib module vsprintf-posix for portable "
diff --git a/gl/stdlib.c b/gl/stdlib.c
new file mode 100644
index 00000000..f51a25c3
--- /dev/null
+++ b/gl/stdlib.c
@@ -0,0 +1,21 @@
1/* Inline functions for <stdlib.h>.
2
3 Copyright (C) 2024-2026 Free Software Foundation, Inc.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#define _GL_STDLIB_INLINE _GL_EXTERN_INLINE
19#include <config.h>
20
21#include <stdlib.h>
diff --git a/gl/stdlib.in.h b/gl/stdlib.in.h
index e74e7c18..95237f2a 100644
--- a/gl/stdlib.in.h
+++ b/gl/stdlib.in.h
@@ -1,6 +1,6 @@
1/* A GNU-like <stdlib.h>. 1/* A GNU-like <stdlib.h>.
2 2
3 Copyright (C) 1995, 2001-2004, 2006-2024 Free Software Foundation, Inc. 3 Copyright (C) 1995, 2001-2004, 2006-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -20,12 +20,27 @@
20#endif 20#endif
21@PRAGMA_COLUMNS@ 21@PRAGMA_COLUMNS@
22 22
23#if defined __need_system_stdlib_h || defined __need_malloc_and_calloc 23#if ((defined __need_system_stdlib_h && !defined _GLIBCXX_STDLIB_H) \
24 || defined __need_malloc_and_calloc) \
25 && !defined __SUNPRO_CC
24/* Special invocation conventions inside some gnulib header files, 26/* Special invocation conventions inside some gnulib header files,
25 and inside some glibc header files, respectively. */ 27 and inside some glibc header files, respectively.
28 Do not recognize this special invocation convention when GCC's
29 c++/11/stdlib.h is being included or has been included. This is needed
30 to support the use of clang+llvm binaries on Ubuntu 22.04 with
31 CXX="$clangdir/bin/clang++ -I/usr/include/c++/11 \
32 -I/usr/include/x86_64-linux-gnu/c++/11
33 -L/usr/lib/gcc/x86_64-linux-gnu/11
34 -Wl,-rpath,$clangdir/lib"
35 because in this case /usr/include/c++/11/stdlib.h (which does not support
36 the convention) is seen before the gnulib-generated stdlib.h. */
26 37
27#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ 38#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
28 39
40/* Make sure that the macros that indicate the special invocation convention
41 get undefined. This is needed at least on CentOS 7. */
42#undef __need_malloc_and_calloc
43
29#else 44#else
30/* Normal invocation convention. */ 45/* Normal invocation convention. */
31 46
@@ -38,8 +53,8 @@
38#define _@GUARD_PREFIX@_STDLIB_H 53#define _@GUARD_PREFIX@_STDLIB_H
39 54
40/* This file uses _Noreturn, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC, 55/* This file uses _Noreturn, _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC,
41 _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK, 56 _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PURE,
42 HAVE_RAW_DECL_*. */ 57 _GL_INLINE_HEADER_BEGIN, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
43#if !_GL_CONFIG_H_INCLUDED 58#if !_GL_CONFIG_H_INCLUDED
44 #error "Please include config.h first." 59 #error "Please include config.h first."
45#endif 60#endif
@@ -47,11 +62,6 @@
47/* NetBSD 5.0 mis-defines NULL. */ 62/* NetBSD 5.0 mis-defines NULL. */
48#include <stddef.h> 63#include <stddef.h>
49 64
50/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */
51#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
52# include <sys/wait.h>
53#endif
54
55/* Solaris declares getloadavg() in <sys/loadavg.h>. */ 65/* Solaris declares getloadavg() in <sys/loadavg.h>. */
56#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@ 66#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
57/* OpenIndiana has a bug: <sys/time.h> must be included before 67/* OpenIndiana has a bug: <sys/time.h> must be included before
@@ -60,6 +70,11 @@
60# include <sys/loadavg.h> 70# include <sys/loadavg.h>
61#endif 71#endif
62 72
73/* QNX declares getprogname() in <sys/process.h>. */
74#if (@GNULIB_GETPROGNAME@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_PROCESS_H@
75# include <sys/process.h>
76#endif
77
63/* Native Windows platforms declare _mktemp() in <io.h>. */ 78/* Native Windows platforms declare _mktemp() in <io.h>. */
64#if defined _WIN32 && !defined __CYGWIN__ 79#if defined _WIN32 && !defined __CYGWIN__
65# include <io.h> 80# include <io.h>
@@ -67,13 +82,6 @@
67 82
68#if @GNULIB_RANDOM_R@ 83#if @GNULIB_RANDOM_R@
69 84
70/* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
71 from <stdlib.h> if _REENTRANT is defined. Include it whenever we need
72 'struct random_data'. */
73# if @HAVE_RANDOM_H@
74# include <random.h>
75# endif
76
77# include <stdint.h> 85# include <stdint.h>
78 86
79# if !@HAVE_STRUCT_RANDOM_DATA@ 87# if !@HAVE_STRUCT_RANDOM_DATA@
@@ -104,11 +112,30 @@ struct random_data
104# include <unistd.h> 112# include <unistd.h>
105#endif 113#endif
106 114
115#if ((@GNULIB_STRTOL@ && @REPLACE_STRTOL@) || (@GNULIB_STRTOLL@ && @REPLACE_STRTOLL@) || (@GNULIB_STRTOUL@ && @REPLACE_STRTOUL@) || (@GNULIB_STRTOULL@ && @REPLACE_STRTOULL@)) && defined __cplusplus && !defined GNULIB_NAMESPACE && defined __GNUG__ && !defined __clang__ && (defined __sun || defined _AIX)
116/* When strtol, strtoll, strtoul, or strtoull is going to be defined as a macro
117 below, this may cause compilation errors later in the libstdc++ header files
118 (that are part of GCC), such as:
119 error: 'rpl_strtol' is not a member of 'std'
120 To avoid this, include the relevant header files here, before these symbols
121 get defined as macros. But do so only on Solaris 11 and AIX (where it is
122 needed), not on mingw (where it would cause other compilation errors). */
123# include <string>
124#endif
125
126_GL_INLINE_HEADER_BEGIN
127#ifndef _GL_STDLIB_INLINE
128# define _GL_STDLIB_INLINE _GL_INLINE
129#endif
130#ifndef _GL_REALLOC_INLINE
131# define _GL_REALLOC_INLINE _GL_INLINE
132#endif
133
107/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers 134/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
108 that can be freed by passing them as the Ith argument to the 135 that can be freed by passing them as the Ith argument to the
109 function F. */ 136 function F. */
110#ifndef _GL_ATTRIBUTE_DEALLOC 137#ifndef _GL_ATTRIBUTE_DEALLOC
111# if __GNUC__ >= 11 138# if __GNUC__ >= 11 && !defined __clang__
112# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) 139# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
113# else 140# else
114# define _GL_ATTRIBUTE_DEALLOC(f, i) 141# define _GL_ATTRIBUTE_DEALLOC(f, i)
@@ -133,11 +160,23 @@ struct random_data
133# endif 160# endif
134#endif 161#endif
135 162
163/* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP
164 (a pointer) must not be NULL if the argument NI (an integer) is != 0. */
165/* Applies to: functions. */
166#ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO
167# if __GNUC__ >= 15 && !defined __clang__
168# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) \
169 __attribute__ ((__nonnull_if_nonzero__ (np, ni)))
170# else
171# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni)
172# endif
173#endif
174
136/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. 175/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
137 */ 176 */
138#ifndef _GL_ATTRIBUTE_NOTHROW 177#ifndef _GL_ATTRIBUTE_NOTHROW
139# if defined __cplusplus 178# if defined __cplusplus
140# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 179# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
141# if __cplusplus >= 201103L 180# if __cplusplus >= 201103L
142# define _GL_ATTRIBUTE_NOTHROW noexcept (true) 181# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
143# else 182# else
@@ -188,6 +227,18 @@ struct random_data
188#endif 227#endif
189 228
190 229
230/* Declarations for ISO C N3322. */
231#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
232_GL_EXTERN_C void *_GL_FUNCDECL_SYS_NAME (bsearch)
233 (const void *__key, const void *__base, size_t __nmemb, size_t __size,
234 int (*__compare) (const void *, const void *))
235 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3) _GL_ARG_NONNULL ((5));
236_GL_EXTERN_C void qsort (void *__base, size_t __nmemb, size_t __size,
237 int (*__compare) (const void *, const void *))
238 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2) _GL_ARG_NONNULL ((4));
239#endif
240
241
191#if @GNULIB__EXIT@ 242#if @GNULIB__EXIT@
192/* Terminate the current process with the given return code, without running 243/* Terminate the current process with the given return code, without running
193 the 'atexit' handlers. */ 244 the 'atexit' handlers. */
@@ -196,11 +247,11 @@ struct random_data
196# undef _Exit 247# undef _Exit
197# define _Exit rpl__Exit 248# define _Exit rpl__Exit
198# endif 249# endif
199_GL_FUNCDECL_RPL (_Exit, _Noreturn void, (int status)); 250_GL_FUNCDECL_RPL (_Exit, _Noreturn void, (int status), );
200_GL_CXXALIAS_RPL (_Exit, void, (int status)); 251_GL_CXXALIAS_RPL (_Exit, void, (int status));
201# else 252# else
202# if !@HAVE__EXIT@ 253# if !@HAVE__EXIT@
203_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status)); 254_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status), );
204# endif 255# endif
205_GL_CXXALIAS_SYS (_Exit, void, (int status)); 256_GL_CXXALIAS_SYS (_Exit, void, (int status));
206# endif 257# endif
@@ -208,7 +259,6 @@ _GL_CXXALIAS_SYS (_Exit, void, (int status));
208_GL_CXXALIASWARN (_Exit); 259_GL_CXXALIASWARN (_Exit);
209# endif 260# endif
210#elif defined GNULIB_POSIXCHECK 261#elif defined GNULIB_POSIXCHECK
211# undef _Exit
212# if HAVE_RAW_DECL__EXIT 262# if HAVE_RAW_DECL__EXIT
213_GL_WARN_ON_USE (_Exit, "_Exit is unportable - " 263_GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
214 "use gnulib module _Exit for portability"); 264 "use gnulib module _Exit for portability");
@@ -216,6 +266,26 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
216#endif 266#endif
217 267
218 268
269#if @GNULIB_ABORT_DEBUG@
270/* Terminates the current process with signal SIGABRT.
271 Note: While the original abort() function is safe to call in signal handlers,
272 the overridden abort() function is not. */
273# if @REPLACE_ABORT@
274# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
275# undef abort
276# define abort rpl_abort
277# endif
278_GL_FUNCDECL_RPL (abort, _Noreturn void, (void), );
279_GL_CXXALIAS_RPL (abort, void, (void));
280# else
281_GL_CXXALIAS_SYS (abort, void, (void));
282# endif
283# if __GLIBC__ >= 2
284_GL_CXXALIASWARN (abort);
285# endif
286#endif
287
288
219#if @GNULIB_FREE_POSIX@ 289#if @GNULIB_FREE_POSIX@
220# if @REPLACE_FREE@ 290# if @REPLACE_FREE@
221# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 291# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -223,9 +293,9 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
223# define free rpl_free 293# define free rpl_free
224# endif 294# endif
225# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) 295# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
226_GL_FUNCDECL_RPL (free, void, (void *ptr) _GL_ATTRIBUTE_NOTHROW); 296_GL_FUNCDECL_RPL (free, void, (void *ptr), ) _GL_ATTRIBUTE_NOTHROW;
227# else 297# else
228_GL_FUNCDECL_RPL (free, void, (void *ptr)); 298_GL_FUNCDECL_RPL (free, void, (void *ptr), );
229# endif 299# endif
230_GL_CXXALIAS_RPL (free, void, (void *ptr)); 300_GL_CXXALIAS_RPL (free, void, (void *ptr));
231# else 301# else
@@ -235,10 +305,9 @@ _GL_CXXALIAS_SYS (free, void, (void *ptr));
235_GL_CXXALIASWARN (free); 305_GL_CXXALIASWARN (free);
236# endif 306# endif
237#elif defined GNULIB_POSIXCHECK 307#elif defined GNULIB_POSIXCHECK
238# undef free
239/* Assume free is always declared. */ 308/* Assume free is always declared. */
240_GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - " 309_GL_WARN_ON_USE (free, "free is not POSIX:2024 compliant everywhere - "
241 "use gnulib module free for portability"); 310 "use gnulib module free-posix for portability");
242#endif 311#endif
243 312
244 313
@@ -250,22 +319,25 @@ _GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - "
250# define aligned_alloc rpl_aligned_alloc 319# define aligned_alloc rpl_aligned_alloc
251# endif 320# endif
252_GL_FUNCDECL_RPL (aligned_alloc, void *, 321_GL_FUNCDECL_RPL (aligned_alloc, void *,
253 (size_t alignment, size_t size) 322 (size_t alignment, size_t size),
254 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 323 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
324 _GL_ATTRIBUTE_NODISCARD);
255_GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size)); 325_GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size));
256# else 326# else
257# if @HAVE_ALIGNED_ALLOC@ 327# if @HAVE_ALIGNED_ALLOC@
258# if __GNUC__ >= 11 328# if __GNUC__ >= 11 && !defined __clang__
259/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ 329/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
260# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 330# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
261_GL_FUNCDECL_SYS (aligned_alloc, void *, 331_GL_FUNCDECL_SYS (aligned_alloc, void *,
262 (size_t alignment, size_t size) 332 (size_t alignment, size_t size),
263 _GL_ATTRIBUTE_NOTHROW 333 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
264 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 334 _GL_ATTRIBUTE_NODISCARD)
335 _GL_ATTRIBUTE_NOTHROW;
265# else 336# else
266_GL_FUNCDECL_SYS (aligned_alloc, void *, 337_GL_FUNCDECL_SYS (aligned_alloc, void *,
267 (size_t alignment, size_t size) 338 (size_t alignment, size_t size),
268 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 339 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
340 _GL_ATTRIBUTE_NODISCARD);
269# endif 341# endif
270# endif 342# endif
271_GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size)); 343_GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
@@ -275,21 +347,21 @@ _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
275_GL_CXXALIASWARN (aligned_alloc); 347_GL_CXXALIASWARN (aligned_alloc);
276# endif 348# endif
277#else 349#else
278# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined aligned_alloc 350# if @GNULIB_FREE_POSIX@ \
351 && (__GNUC__ >= 11 && !defined __clang__) && !defined aligned_alloc
279/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ 352/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
280# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 353# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
281_GL_FUNCDECL_SYS (aligned_alloc, void *, 354_GL_FUNCDECL_SYS (aligned_alloc, void *,
282 (size_t alignment, size_t size) 355 (size_t alignment, size_t size),
283 _GL_ATTRIBUTE_NOTHROW 356 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
284 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 357 _GL_ATTRIBUTE_NOTHROW;
285# else 358# else
286_GL_FUNCDECL_SYS (aligned_alloc, void *, 359_GL_FUNCDECL_SYS (aligned_alloc, void *,
287 (size_t alignment, size_t size) 360 (size_t alignment, size_t size),
288 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 361 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
289# endif 362# endif
290# endif 363# endif
291# if defined GNULIB_POSIXCHECK 364# if defined GNULIB_POSIXCHECK
292# undef aligned_alloc
293# if HAVE_RAW_DECL_ALIGNED_ALLOC 365# if HAVE_RAW_DECL_ALIGNED_ALLOC
294_GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - " 366_GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - "
295 "use gnulib module aligned_alloc for portability"); 367 "use gnulib module aligned_alloc for portability");
@@ -301,14 +373,14 @@ _GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - "
301/* Parse a signed decimal integer. 373/* Parse a signed decimal integer.
302 Returns the value of the integer. Errors are not detected. */ 374 Returns the value of the integer. Errors are not detected. */
303# if !@HAVE_ATOLL@ 375# if !@HAVE_ATOLL@
304_GL_FUNCDECL_SYS (atoll, long long, (const char *string) 376_GL_FUNCDECL_SYS (atoll, long long,
305 _GL_ATTRIBUTE_PURE 377 (const char *string),
306 _GL_ARG_NONNULL ((1))); 378 _GL_ATTRIBUTE_PURE
379 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
307# endif 380# endif
308_GL_CXXALIAS_SYS (atoll, long long, (const char *string)); 381_GL_CXXALIAS_SYS (atoll, long long, (const char *string));
309_GL_CXXALIASWARN (atoll); 382_GL_CXXALIASWARN (atoll);
310#elif defined GNULIB_POSIXCHECK 383#elif defined GNULIB_POSIXCHECK
311# undef atoll
312# if HAVE_RAW_DECL_ATOLL 384# if HAVE_RAW_DECL_ATOLL
313_GL_WARN_ON_USE (atoll, "atoll is unportable - " 385_GL_WARN_ON_USE (atoll, "atoll is unportable - "
314 "use gnulib module atoll for portability"); 386 "use gnulib module atoll for portability");
@@ -316,28 +388,32 @@ _GL_WARN_ON_USE (atoll, "atoll is unportable - "
316#endif 388#endif
317 389
318#if @GNULIB_CALLOC_POSIX@ 390#if @GNULIB_CALLOC_POSIX@
319# if (@GNULIB_CALLOC_POSIX@ && @REPLACE_CALLOC_FOR_CALLOC_POSIX@) \ 391# if @REPLACE_CALLOC_FOR_CALLOC_POSIX@ \
320 || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@) 392 || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@)
321# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 393# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
394 || _GL_USE_STDLIB_ALLOC)
322# undef calloc 395# undef calloc
323# define calloc rpl_calloc 396# define calloc rpl_calloc
324# endif 397# endif
325_GL_FUNCDECL_RPL (calloc, void *, 398_GL_FUNCDECL_RPL (calloc, void *,
326 (size_t nmemb, size_t size) 399 (size_t nmemb, size_t size),
327 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 400 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
401 _GL_ATTRIBUTE_NODISCARD);
328_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); 402_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
329# else 403# else
330# if __GNUC__ >= 11 404# if __GNUC__ >= 11 && !defined __clang__
331/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ 405/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
332# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 406# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
333_GL_FUNCDECL_SYS (calloc, void *, 407_GL_FUNCDECL_SYS (calloc, void *,
334 (size_t nmemb, size_t size) 408 (size_t nmemb, size_t size),
335 _GL_ATTRIBUTE_NOTHROW 409 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
336 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 410 _GL_ATTRIBUTE_NODISCARD)
411 _GL_ATTRIBUTE_NOTHROW;
337# else 412# else
338_GL_FUNCDECL_SYS (calloc, void *, 413_GL_FUNCDECL_SYS (calloc, void *,
339 (size_t nmemb, size_t size) 414 (size_t nmemb, size_t size),
340 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 415 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
416 _GL_ATTRIBUTE_NODISCARD);
341# endif 417# endif
342# endif 418# endif
343_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); 419_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
@@ -346,21 +422,21 @@ _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
346_GL_CXXALIASWARN (calloc); 422_GL_CXXALIASWARN (calloc);
347# endif 423# endif
348#else 424#else
349# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined calloc 425# if @GNULIB_FREE_POSIX@ \
426 && (__GNUC__ >= 11 && !defined __clang__) && !defined calloc
350/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ 427/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
351# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 428# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
352_GL_FUNCDECL_SYS (calloc, void *, 429_GL_FUNCDECL_SYS (calloc, void *,
353 (size_t nmemb, size_t size) 430 (size_t nmemb, size_t size),
354 _GL_ATTRIBUTE_NOTHROW 431 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
355 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 432 _GL_ATTRIBUTE_NOTHROW;
356# else 433# else
357_GL_FUNCDECL_SYS (calloc, void *, 434_GL_FUNCDECL_SYS (calloc, void *,
358 (size_t nmemb, size_t size) 435 (size_t nmemb, size_t size),
359 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 436 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
360# endif 437# endif
361# endif 438# endif
362# if defined GNULIB_POSIXCHECK 439# if defined GNULIB_POSIXCHECK
363# undef calloc
364/* Assume calloc is always declared. */ 440/* Assume calloc is always declared. */
365_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - " 441_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
366 "use gnulib module calloc-posix for portability"); 442 "use gnulib module calloc-posix for portability");
@@ -373,23 +449,26 @@ _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
373# define canonicalize_file_name rpl_canonicalize_file_name 449# define canonicalize_file_name rpl_canonicalize_file_name
374# endif 450# endif
375_GL_FUNCDECL_RPL (canonicalize_file_name, char *, 451_GL_FUNCDECL_RPL (canonicalize_file_name, char *,
376 (const char *name) 452 (const char *name),
377 _GL_ARG_NONNULL ((1)) 453 _GL_ARG_NONNULL ((1))
378 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 454 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
455 _GL_ATTRIBUTE_NODISCARD);
379_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); 456_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
380# else 457# else
381# if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11 458# if !@HAVE_CANONICALIZE_FILE_NAME@ || (__GNUC__ >= 11 && !defined __clang__)
382# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 459# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
383_GL_FUNCDECL_SYS (canonicalize_file_name, char *, 460_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
384 (const char *name) 461 (const char *name),
385 _GL_ATTRIBUTE_NOTHROW
386 _GL_ARG_NONNULL ((1)) 462 _GL_ARG_NONNULL ((1))
387 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 463 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
464 _GL_ATTRIBUTE_NODISCARD)
465 _GL_ATTRIBUTE_NOTHROW;
388# else 466# else
389_GL_FUNCDECL_SYS (canonicalize_file_name, char *, 467_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
390 (const char *name) 468 (const char *name),
391 _GL_ARG_NONNULL ((1)) 469 _GL_ARG_NONNULL ((1))
392 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 470 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
471 _GL_ATTRIBUTE_NODISCARD);
393# endif 472# endif
394# endif 473# endif
395_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); 474_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
@@ -400,24 +479,24 @@ _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
400# endif 479# endif
401_GL_CXXALIASWARN (canonicalize_file_name); 480_GL_CXXALIASWARN (canonicalize_file_name);
402#else 481#else
403# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name 482# if @GNULIB_FREE_POSIX@ \
483 && (__GNUC__ >= 11 && !defined __clang__) && !defined canonicalize_file_name
404/* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or 484/* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or
405 rpl_free. */ 485 rpl_free. */
406# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 486# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
407_GL_FUNCDECL_SYS (canonicalize_file_name, char *, 487_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
408 (const char *name) 488 (const char *name),
409 _GL_ATTRIBUTE_NOTHROW
410 _GL_ARG_NONNULL ((1)) 489 _GL_ARG_NONNULL ((1))
411 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 490 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
491 _GL_ATTRIBUTE_NOTHROW;
412# else 492# else
413_GL_FUNCDECL_SYS (canonicalize_file_name, char *, 493_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
414 (const char *name) 494 (const char *name),
415 _GL_ARG_NONNULL ((1)) 495 _GL_ARG_NONNULL ((1))
416 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 496 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
417# endif 497# endif
418# endif 498# endif
419# if defined GNULIB_POSIXCHECK 499# if defined GNULIB_POSIXCHECK
420# undef canonicalize_file_name
421# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME 500# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
422_GL_WARN_ON_USE (canonicalize_file_name, 501_GL_WARN_ON_USE (canonicalize_file_name,
423 "canonicalize_file_name is unportable - " 502 "canonicalize_file_name is unportable - "
@@ -503,12 +582,12 @@ _GL_CXXALIASWARN (gcvt);
503# undef getloadavg 582# undef getloadavg
504# define getloadavg rpl_getloadavg 583# define getloadavg rpl_getloadavg
505# endif 584# endif
506_GL_FUNCDECL_RPL (getloadavg, int, (double loadavg[], int nelem) 585_GL_FUNCDECL_RPL (getloadavg, int, (double loadavg[], int nelem),
507 _GL_ARG_NONNULL ((1))); 586 _GL_ARG_NONNULL ((1)));
508_GL_CXXALIAS_RPL (getloadavg, int, (double loadavg[], int nelem)); 587_GL_CXXALIAS_RPL (getloadavg, int, (double loadavg[], int nelem));
509# else 588# else
510# if !@HAVE_DECL_GETLOADAVG@ 589# if !@HAVE_DECL_GETLOADAVG@
511_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem) 590_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem),
512 _GL_ARG_NONNULL ((1))); 591 _GL_ARG_NONNULL ((1)));
513# endif 592# endif
514_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); 593_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
@@ -517,7 +596,6 @@ _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
517_GL_CXXALIASWARN (getloadavg); 596_GL_CXXALIASWARN (getloadavg);
518# endif 597# endif
519#elif defined GNULIB_POSIXCHECK 598#elif defined GNULIB_POSIXCHECK
520# undef getloadavg
521# if HAVE_RAW_DECL_GETLOADAVG 599# if HAVE_RAW_DECL_GETLOADAVG
522_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - " 600_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
523 "use gnulib module getloadavg for portability"); 601 "use gnulib module getloadavg for portability");
@@ -533,17 +611,17 @@ _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
533# define getprogname rpl_getprogname 611# define getprogname rpl_getprogname
534# endif 612# endif
535# if @HAVE_DECL_PROGRAM_INVOCATION_NAME@ 613# if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
536_GL_FUNCDECL_RPL (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE); 614_GL_FUNCDECL_RPL (getprogname, const char *, (void), _GL_ATTRIBUTE_PURE);
537# else 615# else
538_GL_FUNCDECL_RPL (getprogname, const char *, (void)); 616_GL_FUNCDECL_RPL (getprogname, const char *, (void), );
539# endif 617# endif
540_GL_CXXALIAS_RPL (getprogname, const char *, (void)); 618_GL_CXXALIAS_RPL (getprogname, const char *, (void));
541# else 619# else
542# if !@HAVE_GETPROGNAME@ 620# if !@HAVE_GETPROGNAME@
543# if @HAVE_DECL_PROGRAM_INVOCATION_NAME@ 621# if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
544_GL_FUNCDECL_SYS (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE); 622_GL_FUNCDECL_SYS (getprogname, const char *, (void), _GL_ATTRIBUTE_PURE);
545# else 623# else
546_GL_FUNCDECL_SYS (getprogname, const char *, (void)); 624_GL_FUNCDECL_SYS (getprogname, const char *, (void), );
547# endif 625# endif
548# endif 626# endif
549_GL_CXXALIAS_SYS (getprogname, const char *, (void)); 627_GL_CXXALIAS_SYS (getprogname, const char *, (void));
@@ -552,7 +630,6 @@ _GL_CXXALIAS_SYS (getprogname, const char *, (void));
552_GL_CXXALIASWARN (getprogname); 630_GL_CXXALIASWARN (getprogname);
553# endif 631# endif
554#elif defined GNULIB_POSIXCHECK 632#elif defined GNULIB_POSIXCHECK
555# undef getprogname
556# if HAVE_RAW_DECL_GETPROGNAME 633# if HAVE_RAW_DECL_GETPROGNAME
557_GL_WARN_ON_USE (getprogname, "getprogname is unportable - " 634_GL_WARN_ON_USE (getprogname, "getprogname is unportable - "
558 "use gnulib module getprogname for portability"); 635 "use gnulib module getprogname for portability");
@@ -577,15 +654,15 @@ _GL_WARN_ON_USE (getprogname, "getprogname is unportable - "
577# define getsubopt rpl_getsubopt 654# define getsubopt rpl_getsubopt
578# endif 655# endif
579_GL_FUNCDECL_RPL (getsubopt, int, 656_GL_FUNCDECL_RPL (getsubopt, int,
580 (char **optionp, char *const *tokens, char **valuep) 657 (char **optionp, char *const *tokens, char **valuep),
581 _GL_ARG_NONNULL ((1, 2, 3))); 658 _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD);
582_GL_CXXALIAS_RPL (getsubopt, int, 659_GL_CXXALIAS_RPL (getsubopt, int,
583 (char **optionp, char *const *tokens, char **valuep)); 660 (char **optionp, char *const *tokens, char **valuep));
584# else 661# else
585# if !@HAVE_GETSUBOPT@ 662# if !@HAVE_GETSUBOPT@
586_GL_FUNCDECL_SYS (getsubopt, int, 663_GL_FUNCDECL_SYS (getsubopt, int,
587 (char **optionp, char *const *tokens, char **valuep) 664 (char **optionp, char *const *tokens, char **valuep),
588 _GL_ARG_NONNULL ((1, 2, 3))); 665 _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD);
589# endif 666# endif
590_GL_CXXALIAS_SYS (getsubopt, int, 667_GL_CXXALIAS_SYS (getsubopt, int,
591 (char **optionp, char *const *tokens, char **valuep)); 668 (char **optionp, char *const *tokens, char **valuep));
@@ -594,7 +671,6 @@ _GL_CXXALIAS_SYS (getsubopt, int,
594_GL_CXXALIASWARN (getsubopt); 671_GL_CXXALIASWARN (getsubopt);
595# endif 672# endif
596#elif defined GNULIB_POSIXCHECK 673#elif defined GNULIB_POSIXCHECK
597# undef getsubopt
598# if HAVE_RAW_DECL_GETSUBOPT 674# if HAVE_RAW_DECL_GETSUBOPT
599_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - " 675_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
600 "use gnulib module getsubopt for portability"); 676 "use gnulib module getsubopt for portability");
@@ -605,12 +681,11 @@ _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
605/* Change the ownership and access permission of the slave side of the 681/* Change the ownership and access permission of the slave side of the
606 pseudo-terminal whose master side is specified by FD. */ 682 pseudo-terminal whose master side is specified by FD. */
607# if !@HAVE_GRANTPT@ 683# if !@HAVE_GRANTPT@
608_GL_FUNCDECL_SYS (grantpt, int, (int fd)); 684_GL_FUNCDECL_SYS (grantpt, int, (int fd), );
609# endif 685# endif
610_GL_CXXALIAS_SYS (grantpt, int, (int fd)); 686_GL_CXXALIAS_SYS (grantpt, int, (int fd));
611_GL_CXXALIASWARN (grantpt); 687_GL_CXXALIASWARN (grantpt);
612#elif defined GNULIB_POSIXCHECK 688#elif defined GNULIB_POSIXCHECK
613# undef grantpt
614# if HAVE_RAW_DECL_GRANTPT 689# if HAVE_RAW_DECL_GRANTPT
615_GL_WARN_ON_USE (grantpt, "grantpt is not portable - " 690_GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
616 "use gnulib module grantpt for portability"); 691 "use gnulib module grantpt for portability");
@@ -622,7 +697,7 @@ _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
622 by never specifying a zero size), so it does not need malloc or 697 by never specifying a zero size), so it does not need malloc or
623 realloc to be redefined. */ 698 realloc to be redefined. */
624#if @GNULIB_MALLOC_POSIX@ 699#if @GNULIB_MALLOC_POSIX@
625# if (@GNULIB_MALLOC_POSIX@ && @REPLACE_MALLOC_FOR_MALLOC_POSIX@) \ 700# if @REPLACE_MALLOC_FOR_MALLOC_POSIX@ \
626 || (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@) 701 || (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@)
627# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ 702# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
628 || _GL_USE_STDLIB_ALLOC) 703 || _GL_USE_STDLIB_ALLOC)
@@ -630,21 +705,24 @@ _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
630# define malloc rpl_malloc 705# define malloc rpl_malloc
631# endif 706# endif
632_GL_FUNCDECL_RPL (malloc, void *, 707_GL_FUNCDECL_RPL (malloc, void *,
633 (size_t size) 708 (size_t size),
634 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 709 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
710 _GL_ATTRIBUTE_NODISCARD);
635_GL_CXXALIAS_RPL (malloc, void *, (size_t size)); 711_GL_CXXALIAS_RPL (malloc, void *, (size_t size));
636# else 712# else
637# if __GNUC__ >= 11 713# if __GNUC__ >= 11 && !defined __clang__
638/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ 714/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
639# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 715# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
640_GL_FUNCDECL_SYS (malloc, void *, 716_GL_FUNCDECL_SYS (malloc, void *,
641 (size_t size) 717 (size_t size),
642 _GL_ATTRIBUTE_NOTHROW 718 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
643 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 719 _GL_ATTRIBUTE_NODISCARD)
720 _GL_ATTRIBUTE_NOTHROW;
644# else 721# else
645_GL_FUNCDECL_SYS (malloc, void *, 722_GL_FUNCDECL_SYS (malloc, void *,
646 (size_t size) 723 (size_t size),
647 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 724 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
725 _GL_ATTRIBUTE_NODISCARD);
648# endif 726# endif
649# endif 727# endif
650_GL_CXXALIAS_SYS (malloc, void *, (size_t size)); 728_GL_CXXALIAS_SYS (malloc, void *, (size_t size));
@@ -653,35 +731,41 @@ _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
653_GL_CXXALIASWARN (malloc); 731_GL_CXXALIASWARN (malloc);
654# endif 732# endif
655#else 733#else
656# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined malloc 734# if @GNULIB_FREE_POSIX@ \
735 && (__GNUC__ >= 11 && !defined __clang__) && !defined malloc
657/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ 736/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
658# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 737# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
659_GL_FUNCDECL_SYS (malloc, void *, 738_GL_FUNCDECL_SYS (malloc, void *,
660 (size_t size) 739 (size_t size),
661 _GL_ATTRIBUTE_NOTHROW 740 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
662 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 741 _GL_ATTRIBUTE_NOTHROW;
663# else 742# else
664_GL_FUNCDECL_SYS (malloc, void *, 743_GL_FUNCDECL_SYS (malloc, void *,
665 (size_t size) 744 (size_t size),
666 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 745 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
667# endif 746# endif
668# endif 747# endif
669# if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC 748# if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
670# undef malloc
671/* Assume malloc is always declared. */ 749/* Assume malloc is always declared. */
672_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " 750_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
673 "use gnulib module malloc-posix for portability"); 751 "use gnulib module malloc-posix for portability");
674# endif 752# endif
675#endif 753#endif
676 754
677/* Return maximum number of bytes of a multibyte character. */ 755/* Return maximum number of bytes in a multibyte character in the
756 current locale. */
678#if @REPLACE_MB_CUR_MAX@ 757#if @REPLACE_MB_CUR_MAX@
679# if !GNULIB_defined_MB_CUR_MAX 758# if !GNULIB_defined_MB_CUR_MAX
680static inline 759_GL_STDLIB_INLINE size_t
681int gl_MB_CUR_MAX (void) 760gl_MB_CUR_MAX (void)
682{ 761{
762# if 0 < @REPLACE_MB_CUR_MAX@
763 return @REPLACE_MB_CUR_MAX@;
764# else
683 /* Turn the value 3 to the value 4, as needed for the UTF-8 encoding. */ 765 /* Turn the value 3 to the value 4, as needed for the UTF-8 encoding. */
684 return MB_CUR_MAX + (MB_CUR_MAX == 3); 766 int gl_mb_cur_max = MB_CUR_MAX;
767 return gl_mb_cur_max == 3 ? 4 : gl_mb_cur_max;
768# endif
685} 769}
686# undef MB_CUR_MAX 770# undef MB_CUR_MAX
687# define MB_CUR_MAX gl_MB_CUR_MAX () 771# define MB_CUR_MAX gl_MB_CUR_MAX ()
@@ -698,7 +782,7 @@ int gl_MB_CUR_MAX (void)
698# endif 782# endif
699_GL_FUNCDECL_RPL (mbstowcs, size_t, 783_GL_FUNCDECL_RPL (mbstowcs, size_t,
700 (wchar_t *restrict dest, const char *restrict src, 784 (wchar_t *restrict dest, const char *restrict src,
701 size_t len) 785 size_t len),
702 _GL_ARG_NONNULL ((2))); 786 _GL_ARG_NONNULL ((2)));
703_GL_CXXALIAS_RPL (mbstowcs, size_t, 787_GL_CXXALIAS_RPL (mbstowcs, size_t,
704 (wchar_t *restrict dest, const char *restrict src, 788 (wchar_t *restrict dest, const char *restrict src,
@@ -712,7 +796,6 @@ _GL_CXXALIAS_SYS (mbstowcs, size_t,
712_GL_CXXALIASWARN (mbstowcs); 796_GL_CXXALIASWARN (mbstowcs);
713# endif 797# endif
714#elif defined GNULIB_POSIXCHECK 798#elif defined GNULIB_POSIXCHECK
715# undef mbstowcs
716# if HAVE_RAW_DECL_MBSTOWCS 799# if HAVE_RAW_DECL_MBSTOWCS
717_GL_WARN_ON_USE (mbstowcs, "mbstowcs is unportable - " 800_GL_WARN_ON_USE (mbstowcs, "mbstowcs is unportable - "
718 "use gnulib module mbstowcs for portability"); 801 "use gnulib module mbstowcs for portability");
@@ -727,13 +810,13 @@ _GL_WARN_ON_USE (mbstowcs, "mbstowcs is unportable - "
727# define mbtowc rpl_mbtowc 810# define mbtowc rpl_mbtowc
728# endif 811# endif
729_GL_FUNCDECL_RPL (mbtowc, int, 812_GL_FUNCDECL_RPL (mbtowc, int,
730 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 813 (wchar_t *restrict pwc, const char *restrict s, size_t n), );
731_GL_CXXALIAS_RPL (mbtowc, int, 814_GL_CXXALIAS_RPL (mbtowc, int,
732 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 815 (wchar_t *restrict pwc, const char *restrict s, size_t n));
733# else 816# else
734# if !@HAVE_MBTOWC@ 817# if !@HAVE_MBTOWC@
735_GL_FUNCDECL_SYS (mbtowc, int, 818_GL_FUNCDECL_SYS (mbtowc, int,
736 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 819 (wchar_t *restrict pwc, const char *restrict s, size_t n), );
737# endif 820# endif
738_GL_CXXALIAS_SYS (mbtowc, int, 821_GL_CXXALIAS_SYS (mbtowc, int,
739 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 822 (wchar_t *restrict pwc, const char *restrict s, size_t n));
@@ -742,7 +825,6 @@ _GL_CXXALIAS_SYS (mbtowc, int,
742_GL_CXXALIASWARN (mbtowc); 825_GL_CXXALIASWARN (mbtowc);
743# endif 826# endif
744#elif defined GNULIB_POSIXCHECK 827#elif defined GNULIB_POSIXCHECK
745# undef mbtowc
746# if HAVE_RAW_DECL_MBTOWC 828# if HAVE_RAW_DECL_MBTOWC
747_GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - " 829_GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - "
748 "use gnulib module mbtowc for portability"); 830 "use gnulib module mbtowc for portability");
@@ -756,12 +838,13 @@ _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - "
756 Returns TEMPLATE, or a null pointer if it cannot get a unique name. 838 Returns TEMPLATE, or a null pointer if it cannot get a unique name.
757 The directory is created mode 700. */ 839 The directory is created mode 700. */
758# if !@HAVE_MKDTEMP@ 840# if !@HAVE_MKDTEMP@
759_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1))); 841_GL_FUNCDECL_SYS (mkdtemp, char *,
842 (char * /*template*/),
843 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
760# endif 844# endif
761_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/)); 845_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
762_GL_CXXALIASWARN (mkdtemp); 846_GL_CXXALIASWARN (mkdtemp);
763#elif defined GNULIB_POSIXCHECK 847#elif defined GNULIB_POSIXCHECK
764# undef mkdtemp
765# if HAVE_RAW_DECL_MKDTEMP 848# if HAVE_RAW_DECL_MKDTEMP
766_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - " 849_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
767 "use gnulib module mkdtemp for portability"); 850 "use gnulib module mkdtemp for portability");
@@ -786,13 +869,13 @@ _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
786# undef mkostemp 869# undef mkostemp
787# define mkostemp rpl_mkostemp 870# define mkostemp rpl_mkostemp
788# endif 871# endif
789_GL_FUNCDECL_RPL (mkostemp, int, (char * /*template*/, int /*flags*/) 872_GL_FUNCDECL_RPL (mkostemp, int, (char * /*template*/, int /*flags*/),
790 _GL_ARG_NONNULL ((1))); 873 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
791_GL_CXXALIAS_RPL (mkostemp, int, (char * /*template*/, int /*flags*/)); 874_GL_CXXALIAS_RPL (mkostemp, int, (char * /*template*/, int /*flags*/));
792# else 875# else
793# if !@HAVE_MKOSTEMP@ 876# if !@HAVE_MKOSTEMP@
794_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/) 877_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/),
795 _GL_ARG_NONNULL ((1))); 878 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
796# endif 879# endif
797_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); 880_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
798# endif 881# endif
@@ -800,7 +883,6 @@ _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
800_GL_CXXALIASWARN (mkostemp); 883_GL_CXXALIASWARN (mkostemp);
801# endif 884# endif
802#elif defined GNULIB_POSIXCHECK 885#elif defined GNULIB_POSIXCHECK
803# undef mkostemp
804# if HAVE_RAW_DECL_MKOSTEMP 886# if HAVE_RAW_DECL_MKOSTEMP
805_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - " 887_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
806 "use gnulib module mkostemp for portability"); 888 "use gnulib module mkostemp for portability");
@@ -827,15 +909,15 @@ _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
827# define mkostemps rpl_mkostemps 909# define mkostemps rpl_mkostemps
828# endif 910# endif
829_GL_FUNCDECL_RPL (mkostemps, int, 911_GL_FUNCDECL_RPL (mkostemps, int,
830 (char * /*template*/, int /*suffixlen*/, int /*flags*/) 912 (char * /*template*/, int /*suffixlen*/, int /*flags*/),
831 _GL_ARG_NONNULL ((1))); 913 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
832_GL_CXXALIAS_RPL (mkostemps, int, 914_GL_CXXALIAS_RPL (mkostemps, int,
833 (char * /*template*/, int /*suffixlen*/, int /*flags*/)); 915 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
834# else 916# else
835# if !@HAVE_MKOSTEMPS@ 917# if !@HAVE_MKOSTEMPS@
836_GL_FUNCDECL_SYS (mkostemps, int, 918_GL_FUNCDECL_SYS (mkostemps, int,
837 (char * /*template*/, int /*suffixlen*/, int /*flags*/) 919 (char * /*template*/, int /*suffixlen*/, int /*flags*/),
838 _GL_ARG_NONNULL ((1))); 920 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
839# endif 921# endif
840_GL_CXXALIAS_SYS (mkostemps, int, 922_GL_CXXALIAS_SYS (mkostemps, int,
841 (char * /*template*/, int /*suffixlen*/, int /*flags*/)); 923 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
@@ -844,7 +926,6 @@ _GL_CXXALIAS_SYS (mkostemps, int,
844_GL_CXXALIASWARN (mkostemps); 926_GL_CXXALIASWARN (mkostemps);
845# endif 927# endif
846#elif defined GNULIB_POSIXCHECK 928#elif defined GNULIB_POSIXCHECK
847# undef mkostemps
848# if HAVE_RAW_DECL_MKOSTEMPS 929# if HAVE_RAW_DECL_MKOSTEMPS
849_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - " 930_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
850 "use gnulib module mkostemps for portability"); 931 "use gnulib module mkostemps for portability");
@@ -865,17 +946,18 @@ _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
865# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 946# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
866# define mkstemp rpl_mkstemp 947# define mkstemp rpl_mkstemp
867# endif 948# endif
868_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); 949_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/),
950 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
869_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/)); 951_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
870# else 952# else
871# if ! @HAVE_MKSTEMP@ 953# if ! @HAVE_MKSTEMP@
872_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); 954_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/),
955 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
873# endif 956# endif
874_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); 957_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
875# endif 958# endif
876_GL_CXXALIASWARN (mkstemp); 959_GL_CXXALIASWARN (mkstemp);
877#elif defined GNULIB_POSIXCHECK 960#elif defined GNULIB_POSIXCHECK
878# undef mkstemp
879# if HAVE_RAW_DECL_MKSTEMP 961# if HAVE_RAW_DECL_MKSTEMP
880_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - " 962_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
881 "use gnulib module mkstemp for portability"); 963 "use gnulib module mkstemp for portability");
@@ -894,13 +976,12 @@ _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
894 Returns the open file descriptor if successful, otherwise -1 and errno 976 Returns the open file descriptor if successful, otherwise -1 and errno
895 set. */ 977 set. */
896# if !@HAVE_MKSTEMPS@ 978# if !@HAVE_MKSTEMPS@
897_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/) 979_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/),
898 _GL_ARG_NONNULL ((1))); 980 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
899# endif 981# endif
900_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)); 982_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
901_GL_CXXALIASWARN (mkstemps); 983_GL_CXXALIASWARN (mkstemps);
902#elif defined GNULIB_POSIXCHECK 984#elif defined GNULIB_POSIXCHECK
903# undef mkstemps
904# if HAVE_RAW_DECL_MKSTEMPS 985# if HAVE_RAW_DECL_MKSTEMPS
905_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - " 986_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
906 "use gnulib module mkstemps for portability"); 987 "use gnulib module mkstemps for portability");
@@ -931,8 +1012,8 @@ _GL_CXXALIASWARN (mktemp);
931# define posix_memalign rpl_posix_memalign 1012# define posix_memalign rpl_posix_memalign
932# endif 1013# endif
933_GL_FUNCDECL_RPL (posix_memalign, int, 1014_GL_FUNCDECL_RPL (posix_memalign, int,
934 (void **memptr, size_t alignment, size_t size) 1015 (void **memptr, size_t alignment, size_t size),
935 _GL_ARG_NONNULL ((1))); 1016 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
936_GL_CXXALIAS_RPL (posix_memalign, int, 1017_GL_CXXALIAS_RPL (posix_memalign, int,
937 (void **memptr, size_t alignment, size_t size)); 1018 (void **memptr, size_t alignment, size_t size));
938# else 1019# else
@@ -945,7 +1026,6 @@ _GL_CXXALIAS_SYS (posix_memalign, int,
945_GL_CXXALIASWARN (posix_memalign); 1026_GL_CXXALIASWARN (posix_memalign);
946# endif 1027# endif
947#elif defined GNULIB_POSIXCHECK 1028#elif defined GNULIB_POSIXCHECK
948# undef posix_memalign
949# if HAVE_RAW_DECL_POSIX_MEMALIGN 1029# if HAVE_RAW_DECL_POSIX_MEMALIGN
950_GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - " 1030_GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - "
951 "use gnulib module posix_memalign for portability"); 1031 "use gnulib module posix_memalign for portability");
@@ -960,11 +1040,11 @@ _GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - "
960# undef posix_openpt 1040# undef posix_openpt
961# define posix_openpt rpl_posix_openpt 1041# define posix_openpt rpl_posix_openpt
962# endif 1042# endif
963_GL_FUNCDECL_RPL (posix_openpt, int, (int flags)); 1043_GL_FUNCDECL_RPL (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD);
964_GL_CXXALIAS_RPL (posix_openpt, int, (int flags)); 1044_GL_CXXALIAS_RPL (posix_openpt, int, (int flags));
965# else 1045# else
966# if !@HAVE_POSIX_OPENPT@ 1046# if !@HAVE_POSIX_OPENPT@
967_GL_FUNCDECL_SYS (posix_openpt, int, (int flags)); 1047_GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD);
968# endif 1048# endif
969_GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); 1049_GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
970# endif 1050# endif
@@ -972,7 +1052,6 @@ _GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
972_GL_CXXALIASWARN (posix_openpt); 1052_GL_CXXALIASWARN (posix_openpt);
973# endif 1053# endif
974#elif defined GNULIB_POSIXCHECK 1054#elif defined GNULIB_POSIXCHECK
975# undef posix_openpt
976# if HAVE_RAW_DECL_POSIX_OPENPT 1055# if HAVE_RAW_DECL_POSIX_OPENPT
977_GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - " 1056_GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
978 "use gnulib module posix_openpt for portability"); 1057 "use gnulib module posix_openpt for portability");
@@ -987,17 +1066,16 @@ _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
987# undef ptsname 1066# undef ptsname
988# define ptsname rpl_ptsname 1067# define ptsname rpl_ptsname
989# endif 1068# endif
990_GL_FUNCDECL_RPL (ptsname, char *, (int fd)); 1069_GL_FUNCDECL_RPL (ptsname, char *, (int fd), _GL_ATTRIBUTE_NODISCARD);
991_GL_CXXALIAS_RPL (ptsname, char *, (int fd)); 1070_GL_CXXALIAS_RPL (ptsname, char *, (int fd));
992# else 1071# else
993# if !@HAVE_PTSNAME@ 1072# if !@HAVE_PTSNAME@
994_GL_FUNCDECL_SYS (ptsname, char *, (int fd)); 1073_GL_FUNCDECL_SYS (ptsname, char *, (int fd), _GL_ATTRIBUTE_NODISCARD);
995# endif 1074# endif
996_GL_CXXALIAS_SYS (ptsname, char *, (int fd)); 1075_GL_CXXALIAS_SYS (ptsname, char *, (int fd));
997# endif 1076# endif
998_GL_CXXALIASWARN (ptsname); 1077_GL_CXXALIASWARN (ptsname);
999#elif defined GNULIB_POSIXCHECK 1078#elif defined GNULIB_POSIXCHECK
1000# undef ptsname
1001# if HAVE_RAW_DECL_PTSNAME 1079# if HAVE_RAW_DECL_PTSNAME
1002_GL_WARN_ON_USE (ptsname, "ptsname is not portable - " 1080_GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
1003 "use gnulib module ptsname for portability"); 1081 "use gnulib module ptsname for portability");
@@ -1013,11 +1091,11 @@ _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
1013# undef ptsname_r 1091# undef ptsname_r
1014# define ptsname_r rpl_ptsname_r 1092# define ptsname_r rpl_ptsname_r
1015# endif 1093# endif
1016_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); 1094_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len), );
1017_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); 1095_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
1018# else 1096# else
1019# if !@HAVE_PTSNAME_R@ 1097# if !@HAVE_PTSNAME_R@
1020_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); 1098_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len), );
1021# endif 1099# endif
1022_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); 1100_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
1023# endif 1101# endif
@@ -1026,7 +1104,6 @@ _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
1026# endif 1104# endif
1027_GL_CXXALIASWARN (ptsname_r); 1105_GL_CXXALIASWARN (ptsname_r);
1028#elif defined GNULIB_POSIXCHECK 1106#elif defined GNULIB_POSIXCHECK
1029# undef ptsname_r
1030# if HAVE_RAW_DECL_PTSNAME_R 1107# if HAVE_RAW_DECL_PTSNAME_R
1031_GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - " 1108_GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
1032 "use gnulib module ptsname_r for portability"); 1109 "use gnulib module ptsname_r for portability");
@@ -1039,7 +1116,7 @@ _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
1039# undef putenv 1116# undef putenv
1040# define putenv rpl_putenv 1117# define putenv rpl_putenv
1041# endif 1118# endif
1042_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); 1119_GL_FUNCDECL_RPL (putenv, int, (char *string), _GL_ARG_NONNULL ((1)));
1043_GL_CXXALIAS_RPL (putenv, int, (char *string)); 1120_GL_CXXALIAS_RPL (putenv, int, (char *string));
1044# elif defined _WIN32 && !defined __CYGWIN__ 1121# elif defined _WIN32 && !defined __CYGWIN__
1045# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1122# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1098,7 +1175,9 @@ typedef int (*_gl_qsort_r_compar_fn) (void const *, void const *, void *);
1098# endif 1175# endif
1099_GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, 1176_GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
1100 _gl_qsort_r_compar_fn compare, 1177 _gl_qsort_r_compar_fn compare,
1101 void *arg) _GL_ARG_NONNULL ((1, 4))); 1178 void *arg),
1179 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
1180 _GL_ARG_NONNULL ((4)));
1102_GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, 1181_GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
1103 _gl_qsort_r_compar_fn compare, 1182 _gl_qsort_r_compar_fn compare,
1104 void *arg)); 1183 void *arg));
@@ -1106,7 +1185,9 @@ _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
1106# if !@HAVE_QSORT_R@ 1185# if !@HAVE_QSORT_R@
1107_GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, 1186_GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
1108 _gl_qsort_r_compar_fn compare, 1187 _gl_qsort_r_compar_fn compare,
1109 void *arg) _GL_ARG_NONNULL ((1, 4))); 1188 void *arg),
1189 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
1190 _GL_ARG_NONNULL ((4)));
1110# endif 1191# endif
1111_GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, 1192_GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
1112 _gl_qsort_r_compar_fn compare, 1193 _gl_qsort_r_compar_fn compare,
@@ -1116,7 +1197,6 @@ _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
1116_GL_CXXALIASWARN (qsort_r); 1197_GL_CXXALIASWARN (qsort_r);
1117# endif 1198# endif
1118#elif defined GNULIB_POSIXCHECK 1199#elif defined GNULIB_POSIXCHECK
1119# undef qsort_r
1120# if HAVE_RAW_DECL_QSORT_R 1200# if HAVE_RAW_DECL_QSORT_R
1121_GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - " 1201_GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
1122 "use gnulib module qsort_r for portability"); 1202 "use gnulib module qsort_r for portability");
@@ -1137,7 +1217,7 @@ _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
1137# undef rand 1217# undef rand
1138# define rand rpl_rand 1218# define rand rpl_rand
1139# endif 1219# endif
1140_GL_FUNCDECL_RPL (rand, int, (void)); 1220_GL_FUNCDECL_RPL (rand, int, (void), );
1141_GL_CXXALIAS_RPL (rand, int, (void)); 1221_GL_CXXALIAS_RPL (rand, int, (void));
1142# else 1222# else
1143_GL_CXXALIAS_SYS (rand, int, (void)); 1223_GL_CXXALIAS_SYS (rand, int, (void));
@@ -1154,11 +1234,11 @@ _GL_CXXALIASWARN (rand);
1154# undef random 1234# undef random
1155# define random rpl_random 1235# define random rpl_random
1156# endif 1236# endif
1157_GL_FUNCDECL_RPL (random, long, (void)); 1237_GL_FUNCDECL_RPL (random, long, (void), );
1158_GL_CXXALIAS_RPL (random, long, (void)); 1238_GL_CXXALIAS_RPL (random, long, (void));
1159# else 1239# else
1160# if !@HAVE_RANDOM@ 1240# if !@HAVE_RANDOM@
1161_GL_FUNCDECL_SYS (random, long, (void)); 1241_GL_FUNCDECL_SYS (random, long, (void), );
1162# endif 1242# endif
1163/* Need to cast, because on Haiku, the return type is 1243/* Need to cast, because on Haiku, the return type is
1164 int. */ 1244 int. */
@@ -1168,7 +1248,6 @@ _GL_CXXALIAS_SYS_CAST (random, long, (void));
1168_GL_CXXALIASWARN (random); 1248_GL_CXXALIASWARN (random);
1169# endif 1249# endif
1170#elif defined GNULIB_POSIXCHECK 1250#elif defined GNULIB_POSIXCHECK
1171# undef random
1172# if HAVE_RAW_DECL_RANDOM 1251# if HAVE_RAW_DECL_RANDOM
1173_GL_WARN_ON_USE (random, "random is unportable - " 1252_GL_WARN_ON_USE (random, "random is unportable - "
1174 "use gnulib module random for portability"); 1253 "use gnulib module random for portability");
@@ -1181,11 +1260,11 @@ _GL_WARN_ON_USE (random, "random is unportable - "
1181# undef srandom 1260# undef srandom
1182# define srandom rpl_srandom 1261# define srandom rpl_srandom
1183# endif 1262# endif
1184_GL_FUNCDECL_RPL (srandom, void, (unsigned int seed)); 1263_GL_FUNCDECL_RPL (srandom, void, (unsigned int seed), );
1185_GL_CXXALIAS_RPL (srandom, void, (unsigned int seed)); 1264_GL_CXXALIAS_RPL (srandom, void, (unsigned int seed));
1186# else 1265# else
1187# if !@HAVE_RANDOM@ 1266# if !@HAVE_RANDOM@
1188_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); 1267_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed), );
1189# endif 1268# endif
1190/* Need to cast, because on FreeBSD, the first parameter is 1269/* Need to cast, because on FreeBSD, the first parameter is
1191 unsigned long seed. */ 1270 unsigned long seed. */
@@ -1195,7 +1274,6 @@ _GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed));
1195_GL_CXXALIASWARN (srandom); 1274_GL_CXXALIASWARN (srandom);
1196# endif 1275# endif
1197#elif defined GNULIB_POSIXCHECK 1276#elif defined GNULIB_POSIXCHECK
1198# undef srandom
1199# if HAVE_RAW_DECL_SRANDOM 1277# if HAVE_RAW_DECL_SRANDOM
1200_GL_WARN_ON_USE (srandom, "srandom is unportable - " 1278_GL_WARN_ON_USE (srandom, "srandom is unportable - "
1201 "use gnulib module random for portability"); 1279 "use gnulib module random for portability");
@@ -1209,14 +1287,14 @@ _GL_WARN_ON_USE (srandom, "srandom is unportable - "
1209# define initstate rpl_initstate 1287# define initstate rpl_initstate
1210# endif 1288# endif
1211_GL_FUNCDECL_RPL (initstate, char *, 1289_GL_FUNCDECL_RPL (initstate, char *,
1212 (unsigned int seed, char *buf, size_t buf_size) 1290 (unsigned int seed, char *buf, size_t buf_size),
1213 _GL_ARG_NONNULL ((2))); 1291 _GL_ARG_NONNULL ((2)));
1214_GL_CXXALIAS_RPL (initstate, char *, 1292_GL_CXXALIAS_RPL (initstate, char *,
1215 (unsigned int seed, char *buf, size_t buf_size)); 1293 (unsigned int seed, char *buf, size_t buf_size));
1216# else 1294# else
1217# if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@ 1295# if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@
1218_GL_FUNCDECL_SYS (initstate, char *, 1296_GL_FUNCDECL_SYS (initstate, char *,
1219 (unsigned int seed, char *buf, size_t buf_size) 1297 (unsigned int seed, char *buf, size_t buf_size),
1220 _GL_ARG_NONNULL ((2))); 1298 _GL_ARG_NONNULL ((2)));
1221# endif 1299# endif
1222/* Need to cast, because on FreeBSD, the first parameter is 1300/* Need to cast, because on FreeBSD, the first parameter is
@@ -1228,7 +1306,6 @@ _GL_CXXALIAS_SYS_CAST (initstate, char *,
1228_GL_CXXALIASWARN (initstate); 1306_GL_CXXALIASWARN (initstate);
1229# endif 1307# endif
1230#elif defined GNULIB_POSIXCHECK 1308#elif defined GNULIB_POSIXCHECK
1231# undef initstate
1232# if HAVE_RAW_DECL_INITSTATE 1309# if HAVE_RAW_DECL_INITSTATE
1233_GL_WARN_ON_USE (initstate, "initstate is unportable - " 1310_GL_WARN_ON_USE (initstate, "initstate is unportable - "
1234 "use gnulib module random for portability"); 1311 "use gnulib module random for portability");
@@ -1241,11 +1318,11 @@ _GL_WARN_ON_USE (initstate, "initstate is unportable - "
1241# undef setstate 1318# undef setstate
1242# define setstate rpl_setstate 1319# define setstate rpl_setstate
1243# endif 1320# endif
1244_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); 1321_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state), _GL_ARG_NONNULL ((1)));
1245_GL_CXXALIAS_RPL (setstate, char *, (char *arg_state)); 1322_GL_CXXALIAS_RPL (setstate, char *, (char *arg_state));
1246# else 1323# else
1247# if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@ 1324# if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
1248_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); 1325_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state), _GL_ARG_NONNULL ((1)));
1249# endif 1326# endif
1250/* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter 1327/* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter
1251 is const char *arg_state. */ 1328 is const char *arg_state. */
@@ -1255,7 +1332,6 @@ _GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state));
1255_GL_CXXALIASWARN (setstate); 1332_GL_CXXALIASWARN (setstate);
1256# endif 1333# endif
1257#elif defined GNULIB_POSIXCHECK 1334#elif defined GNULIB_POSIXCHECK
1258# undef setstate
1259# if HAVE_RAW_DECL_SETSTATE 1335# if HAVE_RAW_DECL_SETSTATE
1260_GL_WARN_ON_USE (setstate, "setstate is unportable - " 1336_GL_WARN_ON_USE (setstate, "setstate is unportable - "
1261 "use gnulib module random for portability"); 1337 "use gnulib module random for portability");
@@ -1269,19 +1345,18 @@ _GL_WARN_ON_USE (setstate, "setstate is unportable - "
1269# undef random_r 1345# undef random_r
1270# define random_r rpl_random_r 1346# define random_r rpl_random_r
1271# endif 1347# endif
1272_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result) 1348_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result),
1273 _GL_ARG_NONNULL ((1, 2))); 1349 _GL_ARG_NONNULL ((1, 2)));
1274_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result)); 1350_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
1275# else 1351# else
1276# if !@HAVE_RANDOM_R@ 1352# if !@HAVE_RANDOM_R@
1277_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) 1353_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result),
1278 _GL_ARG_NONNULL ((1, 2))); 1354 _GL_ARG_NONNULL ((1, 2)));
1279# endif 1355# endif
1280_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); 1356_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
1281# endif 1357# endif
1282_GL_CXXALIASWARN (random_r); 1358_GL_CXXALIASWARN (random_r);
1283#elif defined GNULIB_POSIXCHECK 1359#elif defined GNULIB_POSIXCHECK
1284# undef random_r
1285# if HAVE_RAW_DECL_RANDOM_R 1360# if HAVE_RAW_DECL_RANDOM_R
1286_GL_WARN_ON_USE (random_r, "random_r is unportable - " 1361_GL_WARN_ON_USE (random_r, "random_r is unportable - "
1287 "use gnulib module random_r for portability"); 1362 "use gnulib module random_r for portability");
@@ -1295,14 +1370,14 @@ _GL_WARN_ON_USE (random_r, "random_r is unportable - "
1295# define srandom_r rpl_srandom_r 1370# define srandom_r rpl_srandom_r
1296# endif 1371# endif
1297_GL_FUNCDECL_RPL (srandom_r, int, 1372_GL_FUNCDECL_RPL (srandom_r, int,
1298 (unsigned int seed, struct random_data *rand_state) 1373 (unsigned int seed, struct random_data *rand_state),
1299 _GL_ARG_NONNULL ((2))); 1374 _GL_ARG_NONNULL ((2)));
1300_GL_CXXALIAS_RPL (srandom_r, int, 1375_GL_CXXALIAS_RPL (srandom_r, int,
1301 (unsigned int seed, struct random_data *rand_state)); 1376 (unsigned int seed, struct random_data *rand_state));
1302# else 1377# else
1303# if !@HAVE_RANDOM_R@ 1378# if !@HAVE_RANDOM_R@
1304_GL_FUNCDECL_SYS (srandom_r, int, 1379_GL_FUNCDECL_SYS (srandom_r, int,
1305 (unsigned int seed, struct random_data *rand_state) 1380 (unsigned int seed, struct random_data *rand_state),
1306 _GL_ARG_NONNULL ((2))); 1381 _GL_ARG_NONNULL ((2)));
1307# endif 1382# endif
1308_GL_CXXALIAS_SYS (srandom_r, int, 1383_GL_CXXALIAS_SYS (srandom_r, int,
@@ -1310,7 +1385,6 @@ _GL_CXXALIAS_SYS (srandom_r, int,
1310# endif 1385# endif
1311_GL_CXXALIASWARN (srandom_r); 1386_GL_CXXALIASWARN (srandom_r);
1312#elif defined GNULIB_POSIXCHECK 1387#elif defined GNULIB_POSIXCHECK
1313# undef srandom_r
1314# if HAVE_RAW_DECL_SRANDOM_R 1388# if HAVE_RAW_DECL_SRANDOM_R
1315_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - " 1389_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
1316 "use gnulib module random_r for portability"); 1390 "use gnulib module random_r for portability");
@@ -1325,7 +1399,7 @@ _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
1325# endif 1399# endif
1326_GL_FUNCDECL_RPL (initstate_r, int, 1400_GL_FUNCDECL_RPL (initstate_r, int,
1327 (unsigned int seed, char *buf, size_t buf_size, 1401 (unsigned int seed, char *buf, size_t buf_size,
1328 struct random_data *rand_state) 1402 struct random_data *rand_state),
1329 _GL_ARG_NONNULL ((2, 4))); 1403 _GL_ARG_NONNULL ((2, 4)));
1330_GL_CXXALIAS_RPL (initstate_r, int, 1404_GL_CXXALIAS_RPL (initstate_r, int,
1331 (unsigned int seed, char *buf, size_t buf_size, 1405 (unsigned int seed, char *buf, size_t buf_size,
@@ -1334,7 +1408,7 @@ _GL_CXXALIAS_RPL (initstate_r, int,
1334# if !@HAVE_RANDOM_R@ 1408# if !@HAVE_RANDOM_R@
1335_GL_FUNCDECL_SYS (initstate_r, int, 1409_GL_FUNCDECL_SYS (initstate_r, int,
1336 (unsigned int seed, char *buf, size_t buf_size, 1410 (unsigned int seed, char *buf, size_t buf_size,
1337 struct random_data *rand_state) 1411 struct random_data *rand_state),
1338 _GL_ARG_NONNULL ((2, 4))); 1412 _GL_ARG_NONNULL ((2, 4)));
1339# endif 1413# endif
1340/* Need to cast, because on Haiku, the third parameter is 1414/* Need to cast, because on Haiku, the third parameter is
@@ -1345,7 +1419,6 @@ _GL_CXXALIAS_SYS_CAST (initstate_r, int,
1345# endif 1419# endif
1346_GL_CXXALIASWARN (initstate_r); 1420_GL_CXXALIASWARN (initstate_r);
1347#elif defined GNULIB_POSIXCHECK 1421#elif defined GNULIB_POSIXCHECK
1348# undef initstate_r
1349# if HAVE_RAW_DECL_INITSTATE_R 1422# if HAVE_RAW_DECL_INITSTATE_R
1350_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - " 1423_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
1351 "use gnulib module random_r for portability"); 1424 "use gnulib module random_r for portability");
@@ -1359,14 +1432,14 @@ _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
1359# define setstate_r rpl_setstate_r 1432# define setstate_r rpl_setstate_r
1360# endif 1433# endif
1361_GL_FUNCDECL_RPL (setstate_r, int, 1434_GL_FUNCDECL_RPL (setstate_r, int,
1362 (char *arg_state, struct random_data *rand_state) 1435 (char *arg_state, struct random_data *rand_state),
1363 _GL_ARG_NONNULL ((1, 2))); 1436 _GL_ARG_NONNULL ((1, 2)));
1364_GL_CXXALIAS_RPL (setstate_r, int, 1437_GL_CXXALIAS_RPL (setstate_r, int,
1365 (char *arg_state, struct random_data *rand_state)); 1438 (char *arg_state, struct random_data *rand_state));
1366# else 1439# else
1367# if !@HAVE_RANDOM_R@ 1440# if !@HAVE_RANDOM_R@
1368_GL_FUNCDECL_SYS (setstate_r, int, 1441_GL_FUNCDECL_SYS (setstate_r, int,
1369 (char *arg_state, struct random_data *rand_state) 1442 (char *arg_state, struct random_data *rand_state),
1370 _GL_ARG_NONNULL ((1, 2))); 1443 _GL_ARG_NONNULL ((1, 2)));
1371# endif 1444# endif
1372/* Need to cast, because on Haiku, the first parameter is 1445/* Need to cast, because on Haiku, the first parameter is
@@ -1376,7 +1449,6 @@ _GL_CXXALIAS_SYS_CAST (setstate_r, int,
1376# endif 1449# endif
1377_GL_CXXALIASWARN (setstate_r); 1450_GL_CXXALIASWARN (setstate_r);
1378#elif defined GNULIB_POSIXCHECK 1451#elif defined GNULIB_POSIXCHECK
1379# undef setstate_r
1380# if HAVE_RAW_DECL_SETSTATE_R 1452# if HAVE_RAW_DECL_SETSTATE_R
1381_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - " 1453_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
1382 "use gnulib module random_r for portability"); 1454 "use gnulib module random_r for portability");
@@ -1385,28 +1457,44 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
1385 1457
1386 1458
1387#if @GNULIB_REALLOC_POSIX@ 1459#if @GNULIB_REALLOC_POSIX@
1388# if (@GNULIB_REALLOC_POSIX@ && @REPLACE_REALLOC_FOR_REALLOC_POSIX@) \ 1460# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@
1389 || (@GNULIB_REALLOC_GNU@ && @REPLACE_REALLOC_FOR_REALLOC_GNU@) 1461# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@ == 2
1462# define _GL_INLINE_RPL_REALLOC 1
1463# ifdef __cplusplus
1464extern "C" {
1465# endif
1466_GL_REALLOC_INLINE void *
1467rpl_realloc (void *ptr, size_t size)
1468{
1469 return realloc (ptr, size ? size : 1);
1470}
1471# ifdef __cplusplus
1472}
1473# endif
1474# endif
1390# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ 1475# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
1391 || _GL_USE_STDLIB_ALLOC) 1476 || _GL_USE_STDLIB_ALLOC)
1392# undef realloc 1477# undef realloc
1393# define realloc rpl_realloc 1478# define realloc rpl_realloc
1394# endif 1479# endif
1395_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size) 1480# if !defined _GL_INLINE_RPL_REALLOC
1396 _GL_ATTRIBUTE_DEALLOC_FREE); 1481_GL_FUNCDECL_RPL (realloc, void *,
1482 (void *ptr, size_t size),
1483 _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD);
1484# endif
1397_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); 1485_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
1398# else 1486# else
1399# if __GNUC__ >= 11 1487# if __GNUC__ >= 11 && !defined __clang__
1400/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ 1488/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
1401# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 1489# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
1402_GL_FUNCDECL_SYS (realloc, void *, 1490_GL_FUNCDECL_SYS (realloc, void *,
1403 (void *ptr, size_t size) 1491 (void *ptr, size_t size),
1404 _GL_ATTRIBUTE_NOTHROW 1492 _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD)
1405 _GL_ATTRIBUTE_DEALLOC_FREE); 1493 _GL_ATTRIBUTE_NOTHROW;
1406# else 1494# else
1407_GL_FUNCDECL_SYS (realloc, void *, 1495_GL_FUNCDECL_SYS (realloc, void *,
1408 (void *ptr, size_t size) 1496 (void *ptr, size_t size),
1409 _GL_ATTRIBUTE_DEALLOC_FREE); 1497 _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD);
1410# endif 1498# endif
1411# endif 1499# endif
1412_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); 1500_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
@@ -1415,21 +1503,21 @@ _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
1415_GL_CXXALIASWARN (realloc); 1503_GL_CXXALIASWARN (realloc);
1416# endif 1504# endif
1417#else 1505#else
1418# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc 1506# if @GNULIB_FREE_POSIX@ \
1507 && (__GNUC__ >= 11 && !defined __clang__) && !defined realloc
1419/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ 1508/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
1420# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 1509# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
1421_GL_FUNCDECL_SYS (realloc, void *, 1510_GL_FUNCDECL_SYS (realloc, void *,
1422 (void *ptr, size_t size) 1511 (void *ptr, size_t size),
1423 _GL_ATTRIBUTE_NOTHROW 1512 _GL_ATTRIBUTE_DEALLOC_FREE)
1424 _GL_ATTRIBUTE_DEALLOC_FREE); 1513 _GL_ATTRIBUTE_NOTHROW;
1425# else 1514# else
1426_GL_FUNCDECL_SYS (realloc, void *, 1515_GL_FUNCDECL_SYS (realloc, void *,
1427 (void *ptr, size_t size) 1516 (void *ptr, size_t size),
1428 _GL_ATTRIBUTE_DEALLOC_FREE); 1517 _GL_ATTRIBUTE_DEALLOC_FREE);
1429# endif 1518# endif
1430# endif 1519# endif
1431# if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC 1520# if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
1432# undef realloc
1433/* Assume realloc is always declared. */ 1521/* Assume realloc is always declared. */
1434_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - " 1522_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
1435 "use gnulib module realloc-posix for portability"); 1523 "use gnulib module realloc-posix for portability");
@@ -1444,13 +1532,15 @@ _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
1444# define reallocarray rpl_reallocarray 1532# define reallocarray rpl_reallocarray
1445# endif 1533# endif
1446_GL_FUNCDECL_RPL (reallocarray, void *, 1534_GL_FUNCDECL_RPL (reallocarray, void *,
1447 (void *ptr, size_t nmemb, size_t size)); 1535 (void *ptr, size_t nmemb, size_t size),
1536 _GL_ATTRIBUTE_NODISCARD);
1448_GL_CXXALIAS_RPL (reallocarray, void *, 1537_GL_CXXALIAS_RPL (reallocarray, void *,
1449 (void *ptr, size_t nmemb, size_t size)); 1538 (void *ptr, size_t nmemb, size_t size));
1450# else 1539# else
1451# if ! @HAVE_REALLOCARRAY@ 1540# if ! @HAVE_REALLOCARRAY@
1452_GL_FUNCDECL_SYS (reallocarray, void *, 1541_GL_FUNCDECL_SYS (reallocarray, void *,
1453 (void *ptr, size_t nmemb, size_t size)); 1542 (void *ptr, size_t nmemb, size_t size),
1543 _GL_ATTRIBUTE_NODISCARD);
1454# endif 1544# endif
1455_GL_CXXALIAS_SYS (reallocarray, void *, 1545_GL_CXXALIAS_SYS (reallocarray, void *,
1456 (void *ptr, size_t nmemb, size_t size)); 1546 (void *ptr, size_t nmemb, size_t size));
@@ -1459,7 +1549,6 @@ _GL_CXXALIAS_SYS (reallocarray, void *,
1459_GL_CXXALIASWARN (reallocarray); 1549_GL_CXXALIASWARN (reallocarray);
1460# endif 1550# endif
1461#elif defined GNULIB_POSIXCHECK 1551#elif defined GNULIB_POSIXCHECK
1462# undef reallocarray
1463# if HAVE_RAW_DECL_REALLOCARRAY 1552# if HAVE_RAW_DECL_REALLOCARRAY
1464_GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - " 1553_GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - "
1465 "use gnulib module reallocarray for portability"); 1554 "use gnulib module reallocarray for portability");
@@ -1472,22 +1561,21 @@ _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - "
1472# define realpath rpl_realpath 1561# define realpath rpl_realpath
1473# endif 1562# endif
1474_GL_FUNCDECL_RPL (realpath, char *, 1563_GL_FUNCDECL_RPL (realpath, char *,
1475 (const char *restrict name, char *restrict resolved) 1564 (const char *restrict name, char *restrict resolved),
1476 _GL_ARG_NONNULL ((1))); 1565 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1477_GL_CXXALIAS_RPL (realpath, char *, 1566_GL_CXXALIAS_RPL (realpath, char *,
1478 (const char *restrict name, char *restrict resolved)); 1567 (const char *restrict name, char *restrict resolved));
1479# else 1568# else
1480# if !@HAVE_REALPATH@ 1569# if !@HAVE_REALPATH@
1481_GL_FUNCDECL_SYS (realpath, char *, 1570_GL_FUNCDECL_SYS (realpath, char *,
1482 (const char *restrict name, char *restrict resolved) 1571 (const char *restrict name, char *restrict resolved),
1483 _GL_ARG_NONNULL ((1))); 1572 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1484# endif 1573# endif
1485_GL_CXXALIAS_SYS (realpath, char *, 1574_GL_CXXALIAS_SYS (realpath, char *,
1486 (const char *restrict name, char *restrict resolved)); 1575 (const char *restrict name, char *restrict resolved));
1487# endif 1576# endif
1488_GL_CXXALIASWARN (realpath); 1577_GL_CXXALIASWARN (realpath);
1489#elif defined GNULIB_POSIXCHECK 1578#elif defined GNULIB_POSIXCHECK
1490# undef realpath
1491# if HAVE_RAW_DECL_REALPATH 1579# if HAVE_RAW_DECL_REALPATH
1492_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module " 1580_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
1493 "canonicalize or canonicalize-lgpl for portability"); 1581 "canonicalize or canonicalize-lgpl for portability");
@@ -1498,12 +1586,12 @@ _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
1498/* Test a user response to a question. 1586/* Test a user response to a question.
1499 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */ 1587 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
1500# if !@HAVE_RPMATCH@ 1588# if !@HAVE_RPMATCH@
1501_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1))); 1589_GL_FUNCDECL_SYS (rpmatch, int, (const char *response),
1590 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1502# endif 1591# endif
1503_GL_CXXALIAS_SYS (rpmatch, int, (const char *response)); 1592_GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
1504_GL_CXXALIASWARN (rpmatch); 1593_GL_CXXALIASWARN (rpmatch);
1505#elif defined GNULIB_POSIXCHECK 1594#elif defined GNULIB_POSIXCHECK
1506# undef rpmatch
1507# if HAVE_RAW_DECL_RPMATCH 1595# if HAVE_RAW_DECL_RPMATCH
1508_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - " 1596_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
1509 "use gnulib module rpmatch for portability"); 1597 "use gnulib module rpmatch for portability");
@@ -1514,12 +1602,12 @@ _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
1514/* Look up NAME in the environment, returning 0 in insecure situations. */ 1602/* Look up NAME in the environment, returning 0 in insecure situations. */
1515# if !@HAVE_SECURE_GETENV@ 1603# if !@HAVE_SECURE_GETENV@
1516_GL_FUNCDECL_SYS (secure_getenv, char *, 1604_GL_FUNCDECL_SYS (secure_getenv, char *,
1517 (char const *name) _GL_ARG_NONNULL ((1))); 1605 (char const *name),
1606 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1518# endif 1607# endif
1519_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name)); 1608_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
1520_GL_CXXALIASWARN (secure_getenv); 1609_GL_CXXALIASWARN (secure_getenv);
1521#elif defined GNULIB_POSIXCHECK 1610#elif defined GNULIB_POSIXCHECK
1522# undef secure_getenv
1523# if HAVE_RAW_DECL_SECURE_GETENV 1611# if HAVE_RAW_DECL_SECURE_GETENV
1524_GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - " 1612_GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
1525 "use gnulib module secure_getenv for portability"); 1613 "use gnulib module secure_getenv for portability");
@@ -1535,14 +1623,14 @@ _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
1535# define setenv rpl_setenv 1623# define setenv rpl_setenv
1536# endif 1624# endif
1537_GL_FUNCDECL_RPL (setenv, int, 1625_GL_FUNCDECL_RPL (setenv, int,
1538 (const char *name, const char *value, int replace) 1626 (const char *name, const char *value, int replace),
1539 _GL_ARG_NONNULL ((1))); 1627 _GL_ARG_NONNULL ((1)));
1540_GL_CXXALIAS_RPL (setenv, int, 1628_GL_CXXALIAS_RPL (setenv, int,
1541 (const char *name, const char *value, int replace)); 1629 (const char *name, const char *value, int replace));
1542# else 1630# else
1543# if !@HAVE_DECL_SETENV@ 1631# if !@HAVE_DECL_SETENV@
1544_GL_FUNCDECL_SYS (setenv, int, 1632_GL_FUNCDECL_SYS (setenv, int,
1545 (const char *name, const char *value, int replace) 1633 (const char *name, const char *value, int replace),
1546 _GL_ARG_NONNULL ((1))); 1634 _GL_ARG_NONNULL ((1)));
1547# endif 1635# endif
1548_GL_CXXALIAS_SYS (setenv, int, 1636_GL_CXXALIAS_SYS (setenv, int,
@@ -1552,13 +1640,25 @@ _GL_CXXALIAS_SYS (setenv, int,
1552_GL_CXXALIASWARN (setenv); 1640_GL_CXXALIASWARN (setenv);
1553# endif 1641# endif
1554#elif defined GNULIB_POSIXCHECK 1642#elif defined GNULIB_POSIXCHECK
1555# undef setenv
1556# if HAVE_RAW_DECL_SETENV 1643# if HAVE_RAW_DECL_SETENV
1557_GL_WARN_ON_USE (setenv, "setenv is unportable - " 1644_GL_WARN_ON_USE (setenv, "setenv is unportable - "
1558 "use gnulib module setenv for portability"); 1645 "use gnulib module setenv for portability");
1559# endif 1646# endif
1560#endif 1647#endif
1561 1648
1649#if @GNULIB_STACK_TRACE@
1650/* Prints a stack trace of the current thread to standard error,
1651 if possible. */
1652# if @CAN_PRINT_STACK_TRACE@
1653_GL_EXTERN_C void print_stack_trace (void);
1654# else
1655# if !GNULIB_defined_print_stack_trace
1656# define print_stack_trace() /* nothing */
1657# define GNULIB_defined_print_stack_trace 1
1658# endif
1659# endif
1660#endif
1661
1562#if @GNULIB_STRTOD@ 1662#if @GNULIB_STRTOD@
1563 /* Parse a double from STRING, updating ENDP if appropriate. */ 1663 /* Parse a double from STRING, updating ENDP if appropriate. */
1564# if @REPLACE_STRTOD@ 1664# if @REPLACE_STRTOD@
@@ -1567,14 +1667,14 @@ _GL_WARN_ON_USE (setenv, "setenv is unportable - "
1567# endif 1667# endif
1568# define GNULIB_defined_strtod_function 1 1668# define GNULIB_defined_strtod_function 1
1569_GL_FUNCDECL_RPL (strtod, double, 1669_GL_FUNCDECL_RPL (strtod, double,
1570 (const char *restrict str, char **restrict endp) 1670 (const char *restrict str, char **restrict endp),
1571 _GL_ARG_NONNULL ((1))); 1671 _GL_ARG_NONNULL ((1)));
1572_GL_CXXALIAS_RPL (strtod, double, 1672_GL_CXXALIAS_RPL (strtod, double,
1573 (const char *restrict str, char **restrict endp)); 1673 (const char *restrict str, char **restrict endp));
1574# else 1674# else
1575# if !@HAVE_STRTOD@ 1675# if !@HAVE_STRTOD@
1576_GL_FUNCDECL_SYS (strtod, double, 1676_GL_FUNCDECL_SYS (strtod, double,
1577 (const char *restrict str, char **restrict endp) 1677 (const char *restrict str, char **restrict endp),
1578 _GL_ARG_NONNULL ((1))); 1678 _GL_ARG_NONNULL ((1)));
1579# endif 1679# endif
1580_GL_CXXALIAS_SYS (strtod, double, 1680_GL_CXXALIAS_SYS (strtod, double,
@@ -1584,7 +1684,6 @@ _GL_CXXALIAS_SYS (strtod, double,
1584_GL_CXXALIASWARN (strtod); 1684_GL_CXXALIASWARN (strtod);
1585# endif 1685# endif
1586#elif defined GNULIB_POSIXCHECK 1686#elif defined GNULIB_POSIXCHECK
1587# undef strtod
1588# if HAVE_RAW_DECL_STRTOD 1687# if HAVE_RAW_DECL_STRTOD
1589_GL_WARN_ON_USE (strtod, "strtod is unportable - " 1688_GL_WARN_ON_USE (strtod, "strtod is unportable - "
1590 "use gnulib module strtod for portability"); 1689 "use gnulib module strtod for portability");
@@ -1599,14 +1698,14 @@ _GL_WARN_ON_USE (strtod, "strtod is unportable - "
1599# endif 1698# endif
1600# define GNULIB_defined_strtof_function 1 1699# define GNULIB_defined_strtof_function 1
1601_GL_FUNCDECL_RPL (strtof, float, 1700_GL_FUNCDECL_RPL (strtof, float,
1602 (const char *restrict str, char **restrict endp) 1701 (const char *restrict str, char **restrict endp),
1603 _GL_ARG_NONNULL ((1))); 1702 _GL_ARG_NONNULL ((1)));
1604_GL_CXXALIAS_RPL (strtof, float, 1703_GL_CXXALIAS_RPL (strtof, float,
1605 (const char *restrict str, char **restrict endp)); 1704 (const char *restrict str, char **restrict endp));
1606# else 1705# else
1607# if !@HAVE_STRTOF@ 1706# if !@HAVE_STRTOF@
1608_GL_FUNCDECL_SYS (strtof, float, 1707_GL_FUNCDECL_SYS (strtof, float,
1609 (const char *restrict str, char **restrict endp) 1708 (const char *restrict str, char **restrict endp),
1610 _GL_ARG_NONNULL ((1))); 1709 _GL_ARG_NONNULL ((1)));
1611# endif 1710# endif
1612_GL_CXXALIAS_SYS (strtof, float, 1711_GL_CXXALIAS_SYS (strtof, float,
@@ -1616,7 +1715,6 @@ _GL_CXXALIAS_SYS (strtof, float,
1616_GL_CXXALIASWARN (strtof); 1715_GL_CXXALIASWARN (strtof);
1617# endif 1716# endif
1618#elif defined GNULIB_POSIXCHECK 1717#elif defined GNULIB_POSIXCHECK
1619# undef strtof
1620# if HAVE_RAW_DECL_STRTOF 1718# if HAVE_RAW_DECL_STRTOF
1621_GL_WARN_ON_USE (strtof, "strtof is unportable - " 1719_GL_WARN_ON_USE (strtof, "strtof is unportable - "
1622 "use gnulib module strtof for portability"); 1720 "use gnulib module strtof for portability");
@@ -1631,14 +1729,14 @@ _GL_WARN_ON_USE (strtof, "strtof is unportable - "
1631# endif 1729# endif
1632# define GNULIB_defined_strtold_function 1 1730# define GNULIB_defined_strtold_function 1
1633_GL_FUNCDECL_RPL (strtold, long double, 1731_GL_FUNCDECL_RPL (strtold, long double,
1634 (const char *restrict str, char **restrict endp) 1732 (const char *restrict str, char **restrict endp),
1635 _GL_ARG_NONNULL ((1))); 1733 _GL_ARG_NONNULL ((1)));
1636_GL_CXXALIAS_RPL (strtold, long double, 1734_GL_CXXALIAS_RPL (strtold, long double,
1637 (const char *restrict str, char **restrict endp)); 1735 (const char *restrict str, char **restrict endp));
1638# else 1736# else
1639# if !@HAVE_STRTOLD@ 1737# if !@HAVE_STRTOLD@
1640_GL_FUNCDECL_SYS (strtold, long double, 1738_GL_FUNCDECL_SYS (strtold, long double,
1641 (const char *restrict str, char **restrict endp) 1739 (const char *restrict str, char **restrict endp),
1642 _GL_ARG_NONNULL ((1))); 1740 _GL_ARG_NONNULL ((1)));
1643# endif 1741# endif
1644_GL_CXXALIAS_SYS (strtold, long double, 1742_GL_CXXALIAS_SYS (strtold, long double,
@@ -1646,7 +1744,6 @@ _GL_CXXALIAS_SYS (strtold, long double,
1646# endif 1744# endif
1647_GL_CXXALIASWARN (strtold); 1745_GL_CXXALIASWARN (strtold);
1648#elif defined GNULIB_POSIXCHECK 1746#elif defined GNULIB_POSIXCHECK
1649# undef strtold
1650# if HAVE_RAW_DECL_STRTOLD 1747# if HAVE_RAW_DECL_STRTOLD
1651_GL_WARN_ON_USE (strtold, "strtold is unportable - " 1748_GL_WARN_ON_USE (strtold, "strtold is unportable - "
1652 "use gnulib module strtold for portability"); 1749 "use gnulib module strtold for portability");
@@ -1669,7 +1766,7 @@ _GL_WARN_ON_USE (strtold, "strtold is unportable - "
1669# define GNULIB_defined_strtol_function 1 1766# define GNULIB_defined_strtol_function 1
1670_GL_FUNCDECL_RPL (strtol, long, 1767_GL_FUNCDECL_RPL (strtol, long,
1671 (const char *restrict string, char **restrict endptr, 1768 (const char *restrict string, char **restrict endptr,
1672 int base) 1769 int base),
1673 _GL_ARG_NONNULL ((1))); 1770 _GL_ARG_NONNULL ((1)));
1674_GL_CXXALIAS_RPL (strtol, long, 1771_GL_CXXALIAS_RPL (strtol, long,
1675 (const char *restrict string, char **restrict endptr, 1772 (const char *restrict string, char **restrict endptr,
@@ -1678,7 +1775,7 @@ _GL_CXXALIAS_RPL (strtol, long,
1678# if !@HAVE_STRTOL@ 1775# if !@HAVE_STRTOL@
1679_GL_FUNCDECL_SYS (strtol, long, 1776_GL_FUNCDECL_SYS (strtol, long,
1680 (const char *restrict string, char **restrict endptr, 1777 (const char *restrict string, char **restrict endptr,
1681 int base) 1778 int base),
1682 _GL_ARG_NONNULL ((1))); 1779 _GL_ARG_NONNULL ((1)));
1683# endif 1780# endif
1684_GL_CXXALIAS_SYS (strtol, long, 1781_GL_CXXALIAS_SYS (strtol, long,
@@ -1689,7 +1786,6 @@ _GL_CXXALIAS_SYS (strtol, long,
1689_GL_CXXALIASWARN (strtol); 1786_GL_CXXALIASWARN (strtol);
1690# endif 1787# endif
1691#elif defined GNULIB_POSIXCHECK 1788#elif defined GNULIB_POSIXCHECK
1692# undef strtol
1693# if HAVE_RAW_DECL_STRTOL 1789# if HAVE_RAW_DECL_STRTOL
1694_GL_WARN_ON_USE (strtol, "strtol is unportable - " 1790_GL_WARN_ON_USE (strtol, "strtol is unportable - "
1695 "use gnulib module strtol for portability"); 1791 "use gnulib module strtol for portability");
@@ -1712,7 +1808,7 @@ _GL_WARN_ON_USE (strtol, "strtol is unportable - "
1712# define GNULIB_defined_strtoll_function 1 1808# define GNULIB_defined_strtoll_function 1
1713_GL_FUNCDECL_RPL (strtoll, long long, 1809_GL_FUNCDECL_RPL (strtoll, long long,
1714 (const char *restrict string, char **restrict endptr, 1810 (const char *restrict string, char **restrict endptr,
1715 int base) 1811 int base),
1716 _GL_ARG_NONNULL ((1))); 1812 _GL_ARG_NONNULL ((1)));
1717_GL_CXXALIAS_RPL (strtoll, long long, 1813_GL_CXXALIAS_RPL (strtoll, long long,
1718 (const char *restrict string, char **restrict endptr, 1814 (const char *restrict string, char **restrict endptr,
@@ -1721,7 +1817,7 @@ _GL_CXXALIAS_RPL (strtoll, long long,
1721# if !@HAVE_STRTOLL@ 1817# if !@HAVE_STRTOLL@
1722_GL_FUNCDECL_SYS (strtoll, long long, 1818_GL_FUNCDECL_SYS (strtoll, long long,
1723 (const char *restrict string, char **restrict endptr, 1819 (const char *restrict string, char **restrict endptr,
1724 int base) 1820 int base),
1725 _GL_ARG_NONNULL ((1))); 1821 _GL_ARG_NONNULL ((1)));
1726# endif 1822# endif
1727_GL_CXXALIAS_SYS (strtoll, long long, 1823_GL_CXXALIAS_SYS (strtoll, long long,
@@ -1730,7 +1826,6 @@ _GL_CXXALIAS_SYS (strtoll, long long,
1730# endif 1826# endif
1731_GL_CXXALIASWARN (strtoll); 1827_GL_CXXALIASWARN (strtoll);
1732#elif defined GNULIB_POSIXCHECK 1828#elif defined GNULIB_POSIXCHECK
1733# undef strtoll
1734# if HAVE_RAW_DECL_STRTOLL 1829# if HAVE_RAW_DECL_STRTOLL
1735_GL_WARN_ON_USE (strtoll, "strtoll is unportable - " 1830_GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
1736 "use gnulib module strtoll for portability"); 1831 "use gnulib module strtoll for portability");
@@ -1752,7 +1847,7 @@ _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
1752# define GNULIB_defined_strtoul_function 1 1847# define GNULIB_defined_strtoul_function 1
1753_GL_FUNCDECL_RPL (strtoul, unsigned long, 1848_GL_FUNCDECL_RPL (strtoul, unsigned long,
1754 (const char *restrict string, char **restrict endptr, 1849 (const char *restrict string, char **restrict endptr,
1755 int base) 1850 int base),
1756 _GL_ARG_NONNULL ((1))); 1851 _GL_ARG_NONNULL ((1)));
1757_GL_CXXALIAS_RPL (strtoul, unsigned long, 1852_GL_CXXALIAS_RPL (strtoul, unsigned long,
1758 (const char *restrict string, char **restrict endptr, 1853 (const char *restrict string, char **restrict endptr,
@@ -1761,7 +1856,7 @@ _GL_CXXALIAS_RPL (strtoul, unsigned long,
1761# if !@HAVE_STRTOUL@ 1856# if !@HAVE_STRTOUL@
1762_GL_FUNCDECL_SYS (strtoul, unsigned long, 1857_GL_FUNCDECL_SYS (strtoul, unsigned long,
1763 (const char *restrict string, char **restrict endptr, 1858 (const char *restrict string, char **restrict endptr,
1764 int base) 1859 int base),
1765 _GL_ARG_NONNULL ((1))); 1860 _GL_ARG_NONNULL ((1)));
1766# endif 1861# endif
1767_GL_CXXALIAS_SYS (strtoul, unsigned long, 1862_GL_CXXALIAS_SYS (strtoul, unsigned long,
@@ -1772,7 +1867,6 @@ _GL_CXXALIAS_SYS (strtoul, unsigned long,
1772_GL_CXXALIASWARN (strtoul); 1867_GL_CXXALIASWARN (strtoul);
1773# endif 1868# endif
1774#elif defined GNULIB_POSIXCHECK 1869#elif defined GNULIB_POSIXCHECK
1775# undef strtoul
1776# if HAVE_RAW_DECL_STRTOUL 1870# if HAVE_RAW_DECL_STRTOUL
1777_GL_WARN_ON_USE (strtoul, "strtoul is unportable - " 1871_GL_WARN_ON_USE (strtoul, "strtoul is unportable - "
1778 "use gnulib module strtoul for portability"); 1872 "use gnulib module strtoul for portability");
@@ -1795,7 +1889,7 @@ _GL_WARN_ON_USE (strtoul, "strtoul is unportable - "
1795# define GNULIB_defined_strtoull_function 1 1889# define GNULIB_defined_strtoull_function 1
1796_GL_FUNCDECL_RPL (strtoull, unsigned long long, 1890_GL_FUNCDECL_RPL (strtoull, unsigned long long,
1797 (const char *restrict string, char **restrict endptr, 1891 (const char *restrict string, char **restrict endptr,
1798 int base) 1892 int base),
1799 _GL_ARG_NONNULL ((1))); 1893 _GL_ARG_NONNULL ((1)));
1800_GL_CXXALIAS_RPL (strtoull, unsigned long long, 1894_GL_CXXALIAS_RPL (strtoull, unsigned long long,
1801 (const char *restrict string, char **restrict endptr, 1895 (const char *restrict string, char **restrict endptr,
@@ -1804,7 +1898,7 @@ _GL_CXXALIAS_RPL (strtoull, unsigned long long,
1804# if !@HAVE_STRTOULL@ 1898# if !@HAVE_STRTOULL@
1805_GL_FUNCDECL_SYS (strtoull, unsigned long long, 1899_GL_FUNCDECL_SYS (strtoull, unsigned long long,
1806 (const char *restrict string, char **restrict endptr, 1900 (const char *restrict string, char **restrict endptr,
1807 int base) 1901 int base),
1808 _GL_ARG_NONNULL ((1))); 1902 _GL_ARG_NONNULL ((1)));
1809# endif 1903# endif
1810_GL_CXXALIAS_SYS (strtoull, unsigned long long, 1904_GL_CXXALIAS_SYS (strtoull, unsigned long long,
@@ -1813,7 +1907,6 @@ _GL_CXXALIAS_SYS (strtoull, unsigned long long,
1813# endif 1907# endif
1814_GL_CXXALIASWARN (strtoull); 1908_GL_CXXALIASWARN (strtoull);
1815#elif defined GNULIB_POSIXCHECK 1909#elif defined GNULIB_POSIXCHECK
1816# undef strtoull
1817# if HAVE_RAW_DECL_STRTOULL 1910# if HAVE_RAW_DECL_STRTOULL
1818_GL_WARN_ON_USE (strtoull, "strtoull is unportable - " 1911_GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
1819 "use gnulib module strtoull for portability"); 1912 "use gnulib module strtoull for portability");
@@ -1824,12 +1917,11 @@ _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
1824/* Unlock the slave side of the pseudo-terminal whose master side is specified 1917/* Unlock the slave side of the pseudo-terminal whose master side is specified
1825 by FD, so that it can be opened. */ 1918 by FD, so that it can be opened. */
1826# if !@HAVE_UNLOCKPT@ 1919# if !@HAVE_UNLOCKPT@
1827_GL_FUNCDECL_SYS (unlockpt, int, (int fd)); 1920_GL_FUNCDECL_SYS (unlockpt, int, (int fd), );
1828# endif 1921# endif
1829_GL_CXXALIAS_SYS (unlockpt, int, (int fd)); 1922_GL_CXXALIAS_SYS (unlockpt, int, (int fd));
1830_GL_CXXALIASWARN (unlockpt); 1923_GL_CXXALIASWARN (unlockpt);
1831#elif defined GNULIB_POSIXCHECK 1924#elif defined GNULIB_POSIXCHECK
1832# undef unlockpt
1833# if HAVE_RAW_DECL_UNLOCKPT 1925# if HAVE_RAW_DECL_UNLOCKPT
1834_GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - " 1926_GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
1835 "use gnulib module unlockpt for portability"); 1927 "use gnulib module unlockpt for portability");
@@ -1843,11 +1935,11 @@ _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
1843# undef unsetenv 1935# undef unsetenv
1844# define unsetenv rpl_unsetenv 1936# define unsetenv rpl_unsetenv
1845# endif 1937# endif
1846_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); 1938_GL_FUNCDECL_RPL (unsetenv, int, (const char *name), _GL_ARG_NONNULL ((1)));
1847_GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); 1939_GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
1848# else 1940# else
1849# if !@HAVE_DECL_UNSETENV@ 1941# if !@HAVE_DECL_UNSETENV@
1850_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); 1942_GL_FUNCDECL_SYS (unsetenv, int, (const char *name), _GL_ARG_NONNULL ((1)));
1851# endif 1943# endif
1852_GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); 1944_GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
1853# endif 1945# endif
@@ -1855,7 +1947,6 @@ _GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
1855_GL_CXXALIASWARN (unsetenv); 1947_GL_CXXALIASWARN (unsetenv);
1856# endif 1948# endif
1857#elif defined GNULIB_POSIXCHECK 1949#elif defined GNULIB_POSIXCHECK
1858# undef unsetenv
1859# if HAVE_RAW_DECL_UNSETENV 1950# if HAVE_RAW_DECL_UNSETENV
1860_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - " 1951_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
1861 "use gnulib module unsetenv for portability"); 1952 "use gnulib module unsetenv for portability");
@@ -1869,7 +1960,7 @@ _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
1869# undef wctomb 1960# undef wctomb
1870# define wctomb rpl_wctomb 1961# define wctomb rpl_wctomb
1871# endif 1962# endif
1872_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc)); 1963_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc), );
1873_GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc)); 1964_GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
1874# else 1965# else
1875_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); 1966_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
@@ -1880,6 +1971,20 @@ _GL_CXXALIASWARN (wctomb);
1880#endif 1971#endif
1881 1972
1882 1973
1974_GL_INLINE_HEADER_END
1975
1976
1977/* Includes that provide only macros that don't need to be overridden.
1978 (Includes that are needed for type definitions and function declarations
1979 have their place above, before the function overrides.) */
1980
1981/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>.
1982 glibc 2.41 defines WCOREDUMP in <sys/wait.h>, not in <stdlib.h>. */
1983#if @GNULIB_SYSTEM_POSIX@ && !(defined WEXITSTATUS && defined WCOREDUMP)
1984# include <sys/wait.h>
1985#endif
1986
1987
1883#endif /* _@GUARD_PREFIX@_STDLIB_H */ 1988#endif /* _@GUARD_PREFIX@_STDLIB_H */
1884#endif /* _@GUARD_PREFIX@_STDLIB_H */ 1989#endif /* _@GUARD_PREFIX@_STDLIB_H */
1885#endif 1990#endif
diff --git a/gl/str-two-way.h b/gl/str-two-way.h
index cf85e268..7cf91ffd 100644
--- a/gl/str-two-way.h
+++ b/gl/str-two-way.h
@@ -1,5 +1,5 @@
1/* Byte-wise substring search, using the Two-Way algorithm. 1/* Byte-wise substring search, using the Two-Way algorithm.
2 Copyright (C) 2008-2024 Free Software Foundation, Inc. 2 Copyright (C) 2008-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 Written by Eric Blake <ebb9@byu.net>, 2008. 4 Written by Eric Blake <ebb9@byu.net>, 2008.
5 5
@@ -108,13 +108,6 @@ static size_t
108critical_factorization (const unsigned char *needle, size_t needle_len, 108critical_factorization (const unsigned char *needle, size_t needle_len,
109 size_t *period) 109 size_t *period)
110{ 110{
111 /* Index of last byte of left half, or SIZE_MAX. */
112 size_t max_suffix, max_suffix_rev;
113 size_t j; /* Index into NEEDLE for current candidate suffix. */
114 size_t k; /* Offset into current period. */
115 size_t p; /* Intermediate period. */
116 unsigned char a, b; /* Current comparison bytes. */
117
118 /* Special case NEEDLE_LEN of 1 or 2 (all callers already filtered 111 /* Special case NEEDLE_LEN of 1 or 2 (all callers already filtered
119 out 0-length needles. */ 112 out 0-length needles. */
120 if (needle_len < 3) 113 if (needle_len < 3)
@@ -133,73 +126,83 @@ critical_factorization (const unsigned char *needle, size_t needle_len,
133 */ 126 */
134 127
135 /* Perform lexicographic search. */ 128 /* Perform lexicographic search. */
136 max_suffix = SIZE_MAX; 129 size_t max_suffix = /* Index of last byte of left half, or SIZE_MAX. */
137 j = 0; 130 SIZE_MAX;
138 k = p = 1; 131 {
139 while (j + k < needle_len) 132 size_t j = 0; /* Index into NEEDLE for current candidate suffix. */
140 { 133 size_t k = 1; /* Offset into current period. */
141 a = CANON_ELEMENT (needle[j + k]); 134 size_t p = 1; /* Intermediate period. */
142 b = CANON_ELEMENT (needle[max_suffix + k]); 135 while (j + k < needle_len)
143 if (a < b) 136 {
144 { 137 unsigned char a = CANON_ELEMENT (needle[j + k]);
145 /* Suffix is smaller, period is entire prefix so far. */ 138 unsigned char b = CANON_ELEMENT (needle[max_suffix + k]);
146 j += k; 139 if (a < b)
147 k = 1; 140 {
148 p = j - max_suffix; 141 /* Suffix is smaller, period is entire prefix so far. */
149 } 142 j += k;
150 else if (a == b) 143 k = 1;
151 { 144 p = j - max_suffix;
152 /* Advance through repetition of the current period. */ 145 }
153 if (k != p) 146 else if (a == b)
154 ++k; 147 {
155 else 148 /* Advance through repetition of the current period. */
156 { 149 if (k != p)
157 j += p; 150 ++k;
158 k = 1; 151 else
159 } 152 {
160 } 153 j += p;
161 else /* b < a */ 154 k = 1;
162 { 155 }
163 /* Suffix is larger, start over from current location. */ 156 }
164 max_suffix = j++; 157 else /* b < a */
165 k = p = 1; 158 {
166 } 159 /* Suffix is larger, start over from current location. */
167 } 160 max_suffix = j++;
168 *period = p; 161 k = p = 1;
162 }
163 }
164 *period = p;
165 }
169 166
170 /* Perform reverse lexicographic search. */ 167 /* Perform reverse lexicographic search. */
171 max_suffix_rev = SIZE_MAX; 168 size_t max_suffix_rev = /* Index of last byte of left half, or SIZE_MAX. */
172 j = 0; 169 SIZE_MAX;
173 k = p = 1; 170 size_t p_rev;
174 while (j + k < needle_len) 171 {
175 { 172 size_t j = 0; /* Index into NEEDLE for current candidate suffix. */
176 a = CANON_ELEMENT (needle[j + k]); 173 size_t k = 1; /* Offset into current period. */
177 b = CANON_ELEMENT (needle[max_suffix_rev + k]); 174 size_t p = 1; /* Intermediate period. */
178 if (b < a) 175 while (j + k < needle_len)
179 { 176 {
180 /* Suffix is smaller, period is entire prefix so far. */ 177 unsigned char a = CANON_ELEMENT (needle[j + k]);
181 j += k; 178 unsigned char b = CANON_ELEMENT (needle[max_suffix_rev + k]);
182 k = 1; 179 if (b < a)
183 p = j - max_suffix_rev; 180 {
184 } 181 /* Suffix is smaller, period is entire prefix so far. */
185 else if (a == b) 182 j += k;
186 { 183 k = 1;
187 /* Advance through repetition of the current period. */ 184 p = j - max_suffix_rev;
188 if (k != p) 185 }
189 ++k; 186 else if (a == b)
190 else 187 {
191 { 188 /* Advance through repetition of the current period. */
192 j += p; 189 if (k != p)
193 k = 1; 190 ++k;
194 } 191 else
195 } 192 {
196 else /* a < b */ 193 j += p;
197 { 194 k = 1;
198 /* Suffix is larger, start over from current location. */ 195 }
199 max_suffix_rev = j++; 196 }
200 k = p = 1; 197 else /* a < b */
201 } 198 {
202 } 199 /* Suffix is larger, start over from current location. */
200 max_suffix_rev = j++;
201 k = p = 1;
202 }
203 }
204 p_rev = p;
205 }
203 206
204 /* Choose the shorter suffix. Return the index of the first byte of 207 /* Choose the shorter suffix. Return the index of the first byte of
205 the right half, rather than the last byte of the left half. 208 the right half, rather than the last byte of the left half.
@@ -217,7 +220,7 @@ critical_factorization (const unsigned char *needle, size_t needle_len,
217 factorization. */ 220 factorization. */
218 if (max_suffix_rev + 1 < max_suffix + 1) 221 if (max_suffix_rev + 1 < max_suffix + 1)
219 return max_suffix + 1; 222 return max_suffix + 1;
220 *period = p; 223 *period = p_rev;
221 return max_suffix_rev + 1; 224 return max_suffix_rev + 1;
222} 225}
223 226
@@ -235,15 +238,12 @@ static RETURN_TYPE _GL_ATTRIBUTE_PURE
235two_way_short_needle (const unsigned char *haystack, size_t haystack_len, 238two_way_short_needle (const unsigned char *haystack, size_t haystack_len,
236 const unsigned char *needle, size_t needle_len) 239 const unsigned char *needle, size_t needle_len)
237{ 240{
238 size_t i; /* Index into current byte of NEEDLE. */
239 size_t j; /* Index into current window of HAYSTACK. */
240 size_t period; /* The period of the right half of needle. */
241 size_t suffix; /* The index of the right half of needle. */
242
243 /* Factor the needle into two halves, such that the left half is 241 /* Factor the needle into two halves, such that the left half is
244 smaller than the global period, and the right half is 242 smaller than the global period, and the right half is
245 periodic (with a period as large as NEEDLE_LEN - suffix). */ 243 periodic (with a period as large as NEEDLE_LEN - suffix). */
246 suffix = critical_factorization (needle, needle_len, &period); 244 size_t period; /* The period of the right half of needle. */
245 size_t suffix = /* The index of the right half of needle. */
246 critical_factorization (needle, needle_len, &period);
247 247
248 /* Perform the search. Each iteration compares the right half 248 /* Perform the search. Each iteration compares the right half
249 first. */ 249 first. */
@@ -253,11 +253,12 @@ two_way_short_needle (const unsigned char *haystack, size_t haystack_len,
253 only advance by the period, so use memory to avoid rescanning 253 only advance by the period, so use memory to avoid rescanning
254 known occurrences of the period in the right half. */ 254 known occurrences of the period in the right half. */
255 size_t memory = 0; 255 size_t memory = 0;
256 j = 0; 256 size_t j = 0; /* Index into current window of HAYSTACK. */
257 while (AVAILABLE (haystack, haystack_len, j, needle_len)) 257 while (AVAILABLE (haystack, haystack_len, j, needle_len))
258 { 258 {
259 /* Scan for matches in right half. */ 259 /* Scan for matches in right half. */
260 i = MAX (suffix, memory); 260 size_t i = /* Index into current byte of NEEDLE. */
261 MAX (suffix, memory);
261 while (i < needle_len && (CANON_ELEMENT (needle[i]) 262 while (i < needle_len && (CANON_ELEMENT (needle[i])
262 == CANON_ELEMENT (haystack[i + j]))) 263 == CANON_ELEMENT (haystack[i + j])))
263 ++i; 264 ++i;
@@ -287,11 +288,12 @@ two_way_short_needle (const unsigned char *haystack, size_t haystack_len,
287 /* The two halves of needle are distinct; no extra memory is 288 /* The two halves of needle are distinct; no extra memory is
288 required, and any mismatch results in a maximal shift. */ 289 required, and any mismatch results in a maximal shift. */
289 period = MAX (suffix, needle_len - suffix) + 1; 290 period = MAX (suffix, needle_len - suffix) + 1;
290 j = 0; 291 size_t j = 0; /* Index into current window of HAYSTACK. */
291 while (AVAILABLE (haystack, haystack_len, j, needle_len)) 292 while (AVAILABLE (haystack, haystack_len, j, needle_len))
292 { 293 {
293 /* Scan for matches in right half. */ 294 /* Scan for matches in right half. */
294 i = suffix; 295 size_t i = /* Index into current byte of NEEDLE. */
296 suffix;
295 while (i < needle_len && (CANON_ELEMENT (needle[i]) 297 while (i < needle_len && (CANON_ELEMENT (needle[i])
296 == CANON_ELEMENT (haystack[i + j]))) 298 == CANON_ELEMENT (haystack[i + j])))
297 ++i; 299 ++i;
@@ -329,24 +331,21 @@ static RETURN_TYPE _GL_ATTRIBUTE_PURE
329two_way_long_needle (const unsigned char *haystack, size_t haystack_len, 331two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
330 const unsigned char *needle, size_t needle_len) 332 const unsigned char *needle, size_t needle_len)
331{ 333{
332 size_t i; /* Index into current byte of NEEDLE. */
333 size_t j; /* Index into current window of HAYSTACK. */
334 size_t period; /* The period of the right half of needle. */
335 size_t suffix; /* The index of the right half of needle. */
336 size_t shift_table[1U << CHAR_BIT]; /* See below. */
337
338 /* Factor the needle into two halves, such that the left half is 334 /* Factor the needle into two halves, such that the left half is
339 smaller than the global period, and the right half is 335 smaller than the global period, and the right half is
340 periodic (with a period as large as NEEDLE_LEN - suffix). */ 336 periodic (with a period as large as NEEDLE_LEN - suffix). */
341 suffix = critical_factorization (needle, needle_len, &period); 337 size_t period; /* The period of the right half of needle. */
338 size_t suffix = /* The index of the right half of needle. */
339 critical_factorization (needle, needle_len, &period);
342 340
343 /* Populate shift_table. For each possible byte value c, 341 /* Populate shift_table. For each possible byte value c,
344 shift_table[c] is the distance from the last occurrence of c to 342 shift_table[c] is the distance from the last occurrence of c to
345 the end of NEEDLE, or NEEDLE_LEN if c is absent from the NEEDLE. 343 the end of NEEDLE, or NEEDLE_LEN if c is absent from the NEEDLE.
346 shift_table[NEEDLE[NEEDLE_LEN - 1]] contains the only 0. */ 344 shift_table[NEEDLE[NEEDLE_LEN - 1]] contains the only 0. */
347 for (i = 0; i < 1U << CHAR_BIT; i++) 345 size_t shift_table[1U << CHAR_BIT];
346 for (size_t i = 0; i < 1U << CHAR_BIT; i++)
348 shift_table[i] = needle_len; 347 shift_table[i] = needle_len;
349 for (i = 0; i < needle_len; i++) 348 for (size_t i = 0; i < needle_len; i++)
350 shift_table[CANON_ELEMENT (needle[i])] = needle_len - i - 1; 349 shift_table[CANON_ELEMENT (needle[i])] = needle_len - i - 1;
351 350
352 /* Perform the search. Each iteration compares the right half 351 /* Perform the search. Each iteration compares the right half
@@ -357,13 +356,13 @@ two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
357 only advance by the period, so use memory to avoid rescanning 356 only advance by the period, so use memory to avoid rescanning
358 known occurrences of the period in the right half. */ 357 known occurrences of the period in the right half. */
359 size_t memory = 0; 358 size_t memory = 0;
360 size_t shift; 359 size_t j = 0; /* Index into current window of HAYSTACK. */
361 j = 0;
362 while (AVAILABLE (haystack, haystack_len, j, needle_len)) 360 while (AVAILABLE (haystack, haystack_len, j, needle_len))
363 { 361 {
364 /* Check the last byte first; if it does not match, then 362 /* Check the last byte first; if it does not match, then
365 shift to the next possible match location. */ 363 shift to the next possible match location. */
366 shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])]; 364 size_t shift =
365 shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])];
367 if (0 < shift) 366 if (0 < shift)
368 { 367 {
369 if (memory && shift < period) 368 if (memory && shift < period)
@@ -375,32 +374,34 @@ two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
375 } 374 }
376 memory = 0; 375 memory = 0;
377 j += shift; 376 j += shift;
378 continue;
379 }
380 /* Scan for matches in right half. The last byte has
381 already been matched, by virtue of the shift table. */
382 i = MAX (suffix, memory);
383 while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
384 == CANON_ELEMENT (haystack[i + j])))
385 ++i;
386 if (needle_len - 1 <= i)
387 {
388 /* Scan for matches in left half. */
389 i = suffix - 1;
390 while (memory < i + 1 && (CANON_ELEMENT (needle[i])
391 == CANON_ELEMENT (haystack[i + j])))
392 --i;
393 if (i + 1 < memory + 1)
394 return (RETURN_TYPE) (haystack + j);
395 /* No match, so remember how many repetitions of period
396 on the right half were scanned. */
397 j += period;
398 memory = needle_len - period;
399 } 377 }
400 else 378 else
401 { 379 {
402 j += i - suffix + 1; 380 /* Scan for matches in right half. The last byte has
403 memory = 0; 381 already been matched, by virtue of the shift table. */
382 size_t i = MAX (suffix, memory);
383 while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
384 == CANON_ELEMENT (haystack[i + j])))
385 ++i;
386 if (needle_len - 1 <= i)
387 {
388 /* Scan for matches in left half. */
389 i = suffix - 1;
390 while (memory < i + 1 && (CANON_ELEMENT (needle[i])
391 == CANON_ELEMENT (haystack[i + j])))
392 --i;
393 if (i + 1 < memory + 1)
394 return (RETURN_TYPE) (haystack + j);
395 /* No match, so remember how many repetitions of period
396 on the right half were scanned. */
397 j += period;
398 memory = needle_len - period;
399 }
400 else
401 {
402 j += i - suffix + 1;
403 memory = 0;
404 }
404 } 405 }
405 } 406 }
406 } 407 }
@@ -408,38 +409,40 @@ two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
408 { 409 {
409 /* The two halves of needle are distinct; no extra memory is 410 /* The two halves of needle are distinct; no extra memory is
410 required, and any mismatch results in a maximal shift. */ 411 required, and any mismatch results in a maximal shift. */
411 size_t shift;
412 period = MAX (suffix, needle_len - suffix) + 1; 412 period = MAX (suffix, needle_len - suffix) + 1;
413 j = 0; 413 size_t j = 0; /* Index into current window of HAYSTACK. */
414 while (AVAILABLE (haystack, haystack_len, j, needle_len)) 414 while (AVAILABLE (haystack, haystack_len, j, needle_len))
415 { 415 {
416 /* Check the last byte first; if it does not match, then 416 /* Check the last byte first; if it does not match, then
417 shift to the next possible match location. */ 417 shift to the next possible match location. */
418 shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])]; 418 size_t shift =
419 shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])];
419 if (0 < shift) 420 if (0 < shift)
420 { 421 {
421 j += shift; 422 j += shift;
422 continue;
423 } 423 }
424 /* Scan for matches in right half. The last byte has 424 else
425 already been matched, by virtue of the shift table. */
426 i = suffix;
427 while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
428 == CANON_ELEMENT (haystack[i + j])))
429 ++i;
430 if (needle_len - 1 <= i)
431 { 425 {
432 /* Scan for matches in left half. */ 426 /* Scan for matches in right half. The last byte has
433 i = suffix - 1; 427 already been matched, by virtue of the shift table. */
434 while (i != SIZE_MAX && (CANON_ELEMENT (needle[i]) 428 size_t i = suffix;
435 == CANON_ELEMENT (haystack[i + j]))) 429 while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
436 --i; 430 == CANON_ELEMENT (haystack[i + j])))
437 if (i == SIZE_MAX) 431 ++i;
438 return (RETURN_TYPE) (haystack + j); 432 if (needle_len - 1 <= i)
439 j += period; 433 {
434 /* Scan for matches in left half. */
435 i = suffix - 1;
436 while (i != SIZE_MAX && (CANON_ELEMENT (needle[i])
437 == CANON_ELEMENT (haystack[i + j])))
438 --i;
439 if (i == SIZE_MAX)
440 return (RETURN_TYPE) (haystack + j);
441 j += period;
442 }
443 else
444 j += i - suffix + 1;
440 } 445 }
441 else
442 j += i - suffix + 1;
443 } 446 }
444 } 447 }
445 return NULL; 448 return NULL;
diff --git a/gl/strcasecmp.c b/gl/strcasecmp.c
index 7939b404..67192a31 100644
--- a/gl/strcasecmp.c
+++ b/gl/strcasecmp.c
@@ -1,5 +1,5 @@
1/* Case-insensitive string comparison function. 1/* Case-insensitive string comparison function for unibyte locales.
2 Copyright (C) 1998-1999, 2005-2007, 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 1998-1999, 2005-2007, 2009-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -17,7 +17,7 @@
17#include <config.h> 17#include <config.h>
18 18
19/* Specification. */ 19/* Specification. */
20#include <string.h> 20#include <strings.h>
21 21
22#include <ctype.h> 22#include <ctype.h>
23#include <limits.h> 23#include <limits.h>
@@ -32,29 +32,24 @@ strcasecmp (const char *s1, const char *s2)
32{ 32{
33 const unsigned char *p1 = (const unsigned char *) s1; 33 const unsigned char *p1 = (const unsigned char *) s1;
34 const unsigned char *p2 = (const unsigned char *) s2; 34 const unsigned char *p2 = (const unsigned char *) s2;
35 unsigned char c1, c2;
36 35
37 if (p1 == p2) 36 if (p1 == p2)
38 return 0; 37 return 0;
39 38
40 do 39 for (;; p1++, p2++)
41 { 40 {
42 c1 = tolower (*p1); 41 unsigned char c1 = tolower (*p1);
43 c2 = tolower (*p2); 42 unsigned char c2 = tolower (*p2);
44 43
45 if (c1 == '\0') 44 if (c1 == '\0' || c1 != c2)
46 break; 45 {
47 46 if (UCHAR_MAX <= INT_MAX)
48 ++p1; 47 return c1 - c2;
49 ++p2; 48 else
49 /* On machines where 'char' and 'int' are types of the same size,
50 the difference of two 'unsigned char' values - including the
51 sign bit - doesn't fit in an 'int'. */
52 return _GL_CMP (c1, c2);
53 }
50 } 54 }
51 while (c1 == c2);
52
53 if (UCHAR_MAX <= INT_MAX)
54 return c1 - c2;
55 else
56 /* On machines where 'char' and 'int' are types of the same size, the
57 difference of two 'unsigned char' values - including the sign bit -
58 doesn't fit in an 'int'. */
59 return _GL_CMP (c1, c2);
60} 55}
diff --git a/gl/strcasestr.c b/gl/strcasestr.c
index b8c0479d..fcfbcf3b 100644
--- a/gl/strcasestr.c
+++ b/gl/strcasestr.c
@@ -1,5 +1,5 @@
1/* Case-insensitive searching in a string. 1/* Case-insensitive searching in a string.
2 Copyright (C) 2005-2024 Free Software Foundation, Inc. 2 Copyright (C) 2005-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2005. 3 Written by Bruno Haible <bruno@clisp.org>, 2005.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
@@ -39,29 +39,32 @@
39char * 39char *
40strcasestr (const char *haystack_start, const char *needle_start) 40strcasestr (const char *haystack_start, const char *needle_start)
41{ 41{
42 const char *haystack = haystack_start;
43 const char *needle = needle_start; 42 const char *needle = needle_start;
44 size_t needle_len; /* Length of NEEDLE. */
45 size_t haystack_len; /* Known minimum length of HAYSTACK. */
46 bool ok = true; /* True if NEEDLE is prefix of HAYSTACK. */
47 43
48 /* Determine length of NEEDLE, and in the process, make sure 44 /* Determine length of NEEDLE, and in the process, make sure
49 HAYSTACK is at least as long (no point processing all of a long 45 HAYSTACK is at least as long (no point processing all of a long
50 NEEDLE if HAYSTACK is too short). */ 46 NEEDLE if HAYSTACK is too short). */
51 while (*haystack && *needle) 47 {
52 { 48 const char *haystack = haystack_start;
53 ok &= (tolower ((unsigned char) *haystack) 49 bool ok = true; /* True if NEEDLE is prefix of HAYSTACK. */
54 == tolower ((unsigned char) *needle)); 50 while (*haystack && *needle)
55 haystack++; 51 {
56 needle++; 52 ok &= (tolower ((unsigned char) *haystack)
57 } 53 == tolower ((unsigned char) *needle));
58 if (*needle) 54 haystack++;
59 return NULL; 55 needle++;
60 if (ok) 56 }
61 return (char *) haystack_start; 57 if (*needle)
62 needle_len = needle - needle_start; 58 return NULL;
63 haystack = haystack_start + 1; 59 if (ok)
64 haystack_len = needle_len - 1; 60 return (char *) haystack_start;
61 }
62
63 size_t needle_len = /* Length of NEEDLE. */
64 needle - needle_start;
65 const char *haystack = haystack_start + 1;
66 size_t haystack_len = /* Known minimum length of HAYSTACK. */
67 needle_len - 1;
65 68
66 /* Perform the search. Abstract memory is considered to be an array 69 /* Perform the search. Abstract memory is considered to be an array
67 of 'unsigned char' values, not an array of 'char' values. See 70 of 'unsigned char' values, not an array of 'char' values. See
diff --git a/gl/streq.h b/gl/streq.h
index 8593de6d..505fc4ae 100644
--- a/gl/streq.h
+++ b/gl/streq.h
@@ -1,5 +1,5 @@
1/* Optimized string comparison. 1/* Optimized string comparison.
2 Copyright (C) 2001-2002, 2007, 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 2001-2002, 2007, 2009-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -26,7 +26,7 @@ extern "C" {
26#endif 26#endif
27 27
28 28
29/* STREQ_OPT allows to optimize string comparison with a small literal string. 29/* STREQ_OPT optimizes string comparison with a small literal string.
30 STREQ_OPT (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0) 30 STREQ_OPT (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
31 is semantically equivalent to 31 is semantically equivalent to
32 strcmp (s, "EUC-KR") == 0 32 strcmp (s, "EUC-KR") == 0
@@ -39,7 +39,7 @@ extern "C" {
39static inline int 39static inline int
40streq9 (const char *s1, const char *s2) 40streq9 (const char *s1, const char *s2)
41{ 41{
42 return strcmp (s1 + 9, s2 + 9) == 0; 42 return streq (s1 + 9, s2 + 9);
43} 43}
44 44
45static inline int 45static inline int
diff --git a/gl/strerror-override.c b/gl/strerror-override.c
index b9c1c7ab..a07ed62f 100644
--- a/gl/strerror-override.c
+++ b/gl/strerror-override.c
@@ -1,6 +1,6 @@
1/* strerror-override.c --- POSIX compatible system error routine 1/* strerror-override.c --- POSIX compatible system error routine
2 2
3 Copyright (C) 2010-2024 Free Software Foundation, Inc. 3 Copyright (C) 2010-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -298,6 +298,11 @@ strerror_override (int errnum)
298 return "Invalid or incomplete multibyte or wide character"; 298 return "Invalid or incomplete multibyte or wide character";
299# endif 299# endif
300 300
301# if GNULIB_defined_ESOCKTNOSUPPORT
302 case ESOCKTNOSUPPORT:
303 return "Socket type not supported";
304# endif
305
301 default: 306 default:
302 return NULL; 307 return NULL;
303 } 308 }
diff --git a/gl/strerror-override.h b/gl/strerror-override.h
index a1734a24..1e84bdbc 100644
--- a/gl/strerror-override.h
+++ b/gl/strerror-override.h
@@ -1,6 +1,6 @@
1/* strerror-override.h --- POSIX compatible system error routine 1/* strerror-override.h --- POSIX compatible system error routine
2 2
3 Copyright (C) 2010-2024 Free Software Foundation, Inc. 3 Copyright (C) 2010-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -57,7 +57,8 @@ extern "C" {
57 || GNULIB_defined_ECANCELED \ 57 || GNULIB_defined_ECANCELED \
58 || GNULIB_defined_EOWNERDEAD \ 58 || GNULIB_defined_EOWNERDEAD \
59 || GNULIB_defined_ENOTRECOVERABLE \ 59 || GNULIB_defined_ENOTRECOVERABLE \
60 || GNULIB_defined_EILSEQ 60 || GNULIB_defined_EILSEQ \
61 || GNULIB_defined_ESOCKTNOSUPPORT
61extern const char *strerror_override (int errnum) _GL_ATTRIBUTE_CONST; 62extern const char *strerror_override (int errnum) _GL_ATTRIBUTE_CONST;
62#else 63#else
63# define strerror_override(ignored) NULL 64# define strerror_override(ignored) NULL
diff --git a/gl/strerror.c b/gl/strerror.c
index 6b760ff4..c451f055 100644
--- a/gl/strerror.c
+++ b/gl/strerror.c
@@ -1,6 +1,6 @@
1/* strerror.c --- POSIX compatible system error routine 1/* strerror.c --- POSIX compatible system error routine
2 2
3 Copyright (C) 2007-2024 Free Software Foundation, Inc. 3 Copyright (C) 2007-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -31,12 +31,17 @@
31/* Use the system functions, not the gnulib overrides in this file. */ 31/* Use the system functions, not the gnulib overrides in this file. */
32#undef sprintf 32#undef sprintf
33 33
34/* macOS 12's "warning: 'sprintf' is deprecated" is pointless,
35 as sprintf is used safely here. */
36#if defined __APPLE__ && defined __MACH__ && _GL_GNUC_PREREQ (4, 2)
37# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
38#endif
39
34char * 40char *
35strerror (int n) 41strerror (int n)
36#undef strerror 42#undef strerror
37{ 43{
38 static char buf[STACKBUF_LEN]; 44 static char buf[STACKBUF_LEN];
39 size_t len;
40 45
41 /* Cast away const, due to the historical signature of strerror; 46 /* Cast away const, due to the historical signature of strerror;
42 callers should not be modifying the string. */ 47 callers should not be modifying the string. */
@@ -61,7 +66,7 @@ strerror (int n)
61 } 66 }
62 67
63 /* Fix STACKBUF_LEN if this ever aborts. */ 68 /* Fix STACKBUF_LEN if this ever aborts. */
64 len = strlen (msg); 69 size_t len = strlen (msg);
65 if (sizeof buf <= len) 70 if (sizeof buf <= len)
66 abort (); 71 abort ();
67 72
diff --git a/gl/string.c b/gl/string.c
new file mode 100644
index 00000000..c2e1b1f4
--- /dev/null
+++ b/gl/string.c
@@ -0,0 +1,19 @@
1/* streq and memeq functions.
2 Copyright (C) 2025-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#define _GL_STRING_INLINE _GL_EXTERN_INLINE
18#include <config.h>
19#include <string.h>
diff --git a/gl/string.in.h b/gl/string.in.h
index 44ec2e7e..b54ec0ca 100644
--- a/gl/string.in.h
+++ b/gl/string.in.h
@@ -1,6 +1,6 @@
1/* A GNU-like <string.h>. 1/* A GNU-like <string.h>.
2 2
3 Copyright (C) 1995-1996, 2001-2024 Free Software Foundation, Inc. 3 Copyright (C) 1995-1996, 2001-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -20,7 +20,7 @@
20#endif 20#endif
21@PRAGMA_COLUMNS@ 21@PRAGMA_COLUMNS@
22 22
23#if defined _GL_ALREADY_INCLUDING_STRING_H 23#if defined _@GUARD_PREFIX@_ALREADY_INCLUDING_STRING_H
24/* Special invocation convention: 24/* Special invocation convention:
25 - On OS X/NetBSD we have a sequence of nested includes 25 - On OS X/NetBSD we have a sequence of nested includes
26 <string.h> -> <strings.h> -> "string.h" 26 <string.h> -> <strings.h> -> "string.h"
@@ -34,12 +34,12 @@
34 34
35#ifndef _@GUARD_PREFIX@_STRING_H 35#ifndef _@GUARD_PREFIX@_STRING_H
36 36
37#define _GL_ALREADY_INCLUDING_STRING_H 37#define _@GUARD_PREFIX@_ALREADY_INCLUDING_STRING_H
38 38
39/* The include_next requires a split double-inclusion guard. */ 39/* The include_next requires a split double-inclusion guard. */
40#@INCLUDE_NEXT@ @NEXT_STRING_H@ 40#@INCLUDE_NEXT@ @NEXT_STRING_H@
41 41
42#undef _GL_ALREADY_INCLUDING_STRING_H 42#undef _@GUARD_PREFIX@_ALREADY_INCLUDING_STRING_H
43 43
44#ifndef _@GUARD_PREFIX@_STRING_H 44#ifndef _@GUARD_PREFIX@_STRING_H
45#define _@GUARD_PREFIX@_STRING_H 45#define _@GUARD_PREFIX@_STRING_H
@@ -54,6 +54,11 @@
54/* NetBSD 5.0 mis-defines NULL. */ 54/* NetBSD 5.0 mis-defines NULL. */
55#include <stddef.h> 55#include <stddef.h>
56 56
57#if @GNULIB_STRERROR_L@
58/* Get locale_t. */
59# include <locale.h>
60#endif
61
57/* MirBSD defines mbslen as a macro. */ 62/* MirBSD defines mbslen as a macro. */
58#if @GNULIB_MBSLEN@ && defined __MirBSD__ 63#if @GNULIB_MBSLEN@ && defined __MirBSD__
59# include <wchar.h> 64# include <wchar.h>
@@ -75,11 +80,17 @@
75# include <strings.h> 80# include <strings.h>
76#endif 81#endif
77 82
83_GL_INLINE_HEADER_BEGIN
84
85#ifndef _GL_STRING_INLINE
86# define _GL_STRING_INLINE _GL_INLINE
87#endif
88
78/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers 89/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
79 that can be freed by passing them as the Ith argument to the 90 that can be freed by passing them as the Ith argument to the
80 function F. */ 91 function F. */
81#ifndef _GL_ATTRIBUTE_DEALLOC 92#ifndef _GL_ATTRIBUTE_DEALLOC
82# if __GNUC__ >= 11 93# if __GNUC__ >= 11 && !defined __clang__
83# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) 94# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
84# else 95# else
85# define _GL_ATTRIBUTE_DEALLOC(f, i) 96# define _GL_ATTRIBUTE_DEALLOC(f, i)
@@ -91,7 +102,7 @@
91/* Applies to: functions. Cannot be used on inline functions. */ 102/* Applies to: functions. Cannot be used on inline functions. */
92#ifndef _GL_ATTRIBUTE_DEALLOC_FREE 103#ifndef _GL_ATTRIBUTE_DEALLOC_FREE
93# if defined __cplusplus && defined __GNUC__ && !defined __clang__ 104# if defined __cplusplus && defined __GNUC__ && !defined __clang__
94/* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231> */ 105/* Work around GCC bug <https://gcc.gnu.org/PR108231> */
95# define _GL_ATTRIBUTE_DEALLOC_FREE \ 106# define _GL_ATTRIBUTE_DEALLOC_FREE \
96 _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1) 107 _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1)
97# else 108# else
@@ -111,11 +122,23 @@
111# endif 122# endif
112#endif 123#endif
113 124
125/* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP
126 (a pointer) must not be NULL if the argument NI (an integer) is != 0. */
127/* Applies to: functions. */
128#ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO
129# if __GNUC__ >= 15 && !defined __clang__
130# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) \
131 __attribute__ ((__nonnull_if_nonzero__ (np, ni)))
132# else
133# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni)
134# endif
135#endif
136
114/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. 137/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
115 */ 138 */
116#ifndef _GL_ATTRIBUTE_NOTHROW 139#ifndef _GL_ATTRIBUTE_NOTHROW
117# if defined __cplusplus 140# if defined __cplusplus
118# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 141# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
119# if __cplusplus >= 201103L 142# if __cplusplus >= 201103L
120# define _GL_ATTRIBUTE_NOTHROW noexcept (true) 143# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
121# else 144# else
@@ -149,6 +172,7 @@
149 172
150/* The definition of _GL_WARN_ON_USE is copied here. */ 173/* The definition of _GL_WARN_ON_USE is copied here. */
151 174
175
152/* Make _GL_ATTRIBUTE_DEALLOC_FREE work, even though <stdlib.h> may not have 176/* Make _GL_ATTRIBUTE_DEALLOC_FREE work, even though <stdlib.h> may not have
153 been included yet. */ 177 been included yet. */
154#if @GNULIB_FREE_POSIX@ 178#if @GNULIB_FREE_POSIX@
@@ -193,32 +217,116 @@ _GL_EXTERN_C void free (void *);
193# endif 217# endif
194#endif 218#endif
195 219
220
221/* Declarations for ISO C N3322. */
222#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
223# ifndef memcpy
224_GL_EXTERN_C void *memcpy (void *__dest, const void *__src, size_t __n)
225# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
226 _GL_ATTRIBUTE_NOTHROW
227# endif
228 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
229 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
230# endif
231# ifndef memccpy
232_GL_EXTERN_C void *memccpy (void *__dest, const void *__src, int __c, size_t __n)
233# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
234 _GL_ATTRIBUTE_NOTHROW
235# endif
236 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 4)
237 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 4);
238# endif
239# ifndef memmove
240_GL_EXTERN_C void *memmove (void *__dest, const void *__src, size_t __n)
241# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
242 _GL_ATTRIBUTE_NOTHROW
243# endif
244 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
245 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
246# endif
247# ifndef strncpy
248_GL_EXTERN_C char *strncpy (char *__dest, const char *__src, size_t __n)
249# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
250 _GL_ATTRIBUTE_NOTHROW
251# endif
252 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
253 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
254# endif
255# ifndef strndup
256_GL_EXTERN_C char *strndup (const char *__s, size_t __n)
257# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
258 _GL_ATTRIBUTE_NOTHROW
259# endif
260 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2);
261# endif
262# ifndef strncat
263_GL_EXTERN_C char *strncat (char *__dest, const char *__src, size_t __n)
264# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
265 _GL_ATTRIBUTE_NOTHROW
266# endif
267 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
268# endif
269# ifndef memcmp
270_GL_EXTERN_C int memcmp (const void *__s1, const void *__s2, size_t __n)
271# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
272 _GL_ATTRIBUTE_NOTHROW
273# endif
274 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
275 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
276# endif
277# ifndef strncmp
278_GL_EXTERN_C int strncmp (const char *__s1, const char *__s2, size_t __n)
279# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
280 _GL_ATTRIBUTE_NOTHROW
281# endif
282 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
283 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
284# endif
285# if !defined memchr && !defined __cplusplus
286_GL_EXTERN_C void *memchr (const void *__s, int __c, size_t __n)
287 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3);
288_GL_EXTERN_C void *memrchr (const void *__s, int __c, size_t __n)
289 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3);
290# endif
291# ifndef memset
292_GL_EXTERN_C void *memset (void *__s, int __c, size_t __n)
293# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
294 _GL_ATTRIBUTE_NOTHROW
295# endif
296 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3);
297# endif
298# ifndef memset_explicit
299_GL_EXTERN_C void *memset_explicit (void *__s, int __c, size_t __n)
300 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3);
301# endif
302#endif
303
304
196/* Clear a block of memory. The compiler will not delete a call to 305/* Clear a block of memory. The compiler will not delete a call to
197 this function, even if the block is dead after the call. */ 306 this function, even if the block is dead after the call. */
198#if @GNULIB_EXPLICIT_BZERO@ 307#if @GNULIB_EXPLICIT_BZERO@
199# if ! @HAVE_EXPLICIT_BZERO@ 308# if ! @HAVE_EXPLICIT_BZERO@
200_GL_FUNCDECL_SYS (explicit_bzero, void, 309_GL_FUNCDECL_SYS (explicit_bzero, void,
201 (void *__dest, size_t __n) _GL_ARG_NONNULL ((1))); 310 (void *__dest, size_t __n), _GL_ARG_NONNULL ((1)));
202# endif 311# endif
203_GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n)); 312_GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n));
204_GL_CXXALIASWARN (explicit_bzero); 313_GL_CXXALIASWARN (explicit_bzero);
205#elif defined GNULIB_POSIXCHECK 314#elif defined GNULIB_POSIXCHECK
206# undef explicit_bzero
207# if HAVE_RAW_DECL_EXPLICIT_BZERO 315# if HAVE_RAW_DECL_EXPLICIT_BZERO
208_GL_WARN_ON_USE (explicit_bzero, "explicit_bzero is unportable - " 316_GL_WARN_ON_USE (explicit_bzero, "explicit_bzero is unportable - "
209 "use gnulib module explicit_bzero for portability"); 317 "use gnulib module explicit_bzero for portability");
210# endif 318# endif
211#endif 319#endif
212 320
321
213/* Find the index of the least-significant set bit. */ 322/* Find the index of the least-significant set bit. */
214#if @GNULIB_FFSL@ 323#if @GNULIB_FFSL@
215# if !@HAVE_FFSL@ 324# if !@HAVE_FFSL@
216_GL_FUNCDECL_SYS (ffsl, int, (long int i)); 325_GL_FUNCDECL_SYS (ffsl, int, (long int i), );
217# endif 326# endif
218_GL_CXXALIAS_SYS (ffsl, int, (long int i)); 327_GL_CXXALIAS_SYS (ffsl, int, (long int i));
219_GL_CXXALIASWARN (ffsl); 328_GL_CXXALIASWARN (ffsl);
220#elif defined GNULIB_POSIXCHECK 329#elif defined GNULIB_POSIXCHECK
221# undef ffsl
222# if HAVE_RAW_DECL_FFSL 330# if HAVE_RAW_DECL_FFSL
223_GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module"); 331_GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module");
224# endif 332# endif
@@ -231,17 +339,16 @@ _GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module");
231# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 339# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
232# define ffsll rpl_ffsll 340# define ffsll rpl_ffsll
233# endif 341# endif
234_GL_FUNCDECL_RPL (ffsll, int, (long long int i)); 342_GL_FUNCDECL_RPL (ffsll, int, (long long int i), );
235_GL_CXXALIAS_RPL (ffsll, int, (long long int i)); 343_GL_CXXALIAS_RPL (ffsll, int, (long long int i));
236# else 344# else
237# if !@HAVE_FFSLL@ 345# if !@HAVE_FFSLL@
238_GL_FUNCDECL_SYS (ffsll, int, (long long int i)); 346_GL_FUNCDECL_SYS (ffsll, int, (long long int i), );
239# endif 347# endif
240_GL_CXXALIAS_SYS (ffsll, int, (long long int i)); 348_GL_CXXALIAS_SYS (ffsll, int, (long long int i));
241# endif 349# endif
242_GL_CXXALIASWARN (ffsll); 350_GL_CXXALIASWARN (ffsll);
243#elif defined GNULIB_POSIXCHECK 351#elif defined GNULIB_POSIXCHECK
244# undef ffsll
245# if HAVE_RAW_DECL_FFSLL 352# if HAVE_RAW_DECL_FFSLL
246_GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module"); 353_GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module");
247# endif 354# endif
@@ -274,9 +381,9 @@ _GL_CXXALIASWARN (memccpy);
274# undef memchr 381# undef memchr
275# define memchr rpl_memchr 382# define memchr rpl_memchr
276# endif 383# endif
277_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n) 384_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n),
278 _GL_ATTRIBUTE_PURE 385 _GL_ATTRIBUTE_PURE
279 _GL_ARG_NONNULL ((1))); 386 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3));
280_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n)); 387_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
281# else 388# else
282 /* On some systems, this function is defined as an overloaded function: 389 /* On some systems, this function is defined as an overloaded function:
@@ -299,10 +406,26 @@ _GL_CXXALIASWARN1 (memchr, void const *,
299_GL_CXXALIASWARN (memchr); 406_GL_CXXALIASWARN (memchr);
300# endif 407# endif
301#elif defined GNULIB_POSIXCHECK 408#elif defined GNULIB_POSIXCHECK
302# undef memchr
303/* Assume memchr is always declared. */ 409/* Assume memchr is always declared. */
304_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - " 410_GL_WARN_ON_USE_CXX (memchr,
305 "use gnulib module memchr for portability" ); 411 const void *, void *, (void const *, int, size_t),
412 "memchr has platform-specific bugs - "
413 "use gnulib module memchr for portability" );
414#endif
415
416/* Are S1 and S2, of size N, bytewise equal? */
417#if @GNULIB_STRINGEQ@ && !@HAVE_DECL_MEMEQ@
418# ifdef __cplusplus
419extern "C" {
420# endif
421_GL_STRING_INLINE bool
422memeq (void const *__s1, void const *__s2, size_t __n)
423{
424 return !memcmp (__s1, __s2, __n);
425}
426# ifdef __cplusplus
427}
428# endif
306#endif 429#endif
307 430
308/* Return the first occurrence of NEEDLE in HAYSTACK. */ 431/* Return the first occurrence of NEEDLE in HAYSTACK. */
@@ -313,7 +436,7 @@ _GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
313# endif 436# endif
314_GL_FUNCDECL_RPL (memmem, void *, 437_GL_FUNCDECL_RPL (memmem, void *,
315 (void const *__haystack, size_t __haystack_len, 438 (void const *__haystack, size_t __haystack_len,
316 void const *__needle, size_t __needle_len) 439 void const *__needle, size_t __needle_len),
317 _GL_ATTRIBUTE_PURE 440 _GL_ATTRIBUTE_PURE
318 _GL_ARG_NONNULL ((1, 3))); 441 _GL_ARG_NONNULL ((1, 3)));
319_GL_CXXALIAS_RPL (memmem, void *, 442_GL_CXXALIAS_RPL (memmem, void *,
@@ -323,7 +446,7 @@ _GL_CXXALIAS_RPL (memmem, void *,
323# if ! @HAVE_DECL_MEMMEM@ 446# if ! @HAVE_DECL_MEMMEM@
324_GL_FUNCDECL_SYS (memmem, void *, 447_GL_FUNCDECL_SYS (memmem, void *,
325 (void const *__haystack, size_t __haystack_len, 448 (void const *__haystack, size_t __haystack_len,
326 void const *__needle, size_t __needle_len) 449 void const *__needle, size_t __needle_len),
327 _GL_ATTRIBUTE_PURE 450 _GL_ATTRIBUTE_PURE
328 _GL_ARG_NONNULL ((1, 3))); 451 _GL_ARG_NONNULL ((1, 3)));
329# endif 452# endif
@@ -333,7 +456,6 @@ _GL_CXXALIAS_SYS (memmem, void *,
333# endif 456# endif
334_GL_CXXALIASWARN (memmem); 457_GL_CXXALIASWARN (memmem);
335#elif defined GNULIB_POSIXCHECK 458#elif defined GNULIB_POSIXCHECK
336# undef memmem
337# if HAVE_RAW_DECL_MEMMEM 459# if HAVE_RAW_DECL_MEMMEM
338_GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - " 460_GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
339 "use gnulib module memmem-simple for portability, " 461 "use gnulib module memmem-simple for portability, "
@@ -351,7 +473,7 @@ _GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
351# endif 473# endif
352_GL_FUNCDECL_RPL (mempcpy, void *, 474_GL_FUNCDECL_RPL (mempcpy, void *,
353 (void *restrict __dest, void const *restrict __src, 475 (void *restrict __dest, void const *restrict __src,
354 size_t __n) 476 size_t __n),
355 _GL_ARG_NONNULL ((1, 2))); 477 _GL_ARG_NONNULL ((1, 2)));
356_GL_CXXALIAS_RPL (mempcpy, void *, 478_GL_CXXALIAS_RPL (mempcpy, void *,
357 (void *restrict __dest, void const *restrict __src, 479 (void *restrict __dest, void const *restrict __src,
@@ -360,7 +482,7 @@ _GL_CXXALIAS_RPL (mempcpy, void *,
360# if !@HAVE_MEMPCPY@ 482# if !@HAVE_MEMPCPY@
361_GL_FUNCDECL_SYS (mempcpy, void *, 483_GL_FUNCDECL_SYS (mempcpy, void *,
362 (void *restrict __dest, void const *restrict __src, 484 (void *restrict __dest, void const *restrict __src,
363 size_t __n) 485 size_t __n),
364 _GL_ARG_NONNULL ((1, 2))); 486 _GL_ARG_NONNULL ((1, 2)));
365# endif 487# endif
366_GL_CXXALIAS_SYS (mempcpy, void *, 488_GL_CXXALIAS_SYS (mempcpy, void *,
@@ -371,7 +493,6 @@ _GL_CXXALIAS_SYS (mempcpy, void *,
371_GL_CXXALIASWARN (mempcpy); 493_GL_CXXALIASWARN (mempcpy);
372# endif 494# endif
373#elif defined GNULIB_POSIXCHECK 495#elif defined GNULIB_POSIXCHECK
374# undef mempcpy
375# if HAVE_RAW_DECL_MEMPCPY 496# if HAVE_RAW_DECL_MEMPCPY
376_GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - " 497_GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
377 "use gnulib module mempcpy for portability"); 498 "use gnulib module mempcpy for portability");
@@ -381,9 +502,9 @@ _GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
381/* Search backwards through a block for a byte (specified as an int). */ 502/* Search backwards through a block for a byte (specified as an int). */
382#if @GNULIB_MEMRCHR@ 503#if @GNULIB_MEMRCHR@
383# if ! @HAVE_DECL_MEMRCHR@ 504# if ! @HAVE_DECL_MEMRCHR@
384_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t) 505_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t),
385 _GL_ATTRIBUTE_PURE 506 _GL_ATTRIBUTE_PURE
386 _GL_ARG_NONNULL ((1))); 507 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3));
387# endif 508# endif
388 /* On some systems, this function is defined as an overloaded function: 509 /* On some systems, this function is defined as an overloaded function:
389 extern "C++" { const void * std::memrchr (const void *, int, size_t); } 510 extern "C++" { const void * std::memrchr (const void *, int, size_t); }
@@ -404,7 +525,6 @@ _GL_CXXALIASWARN1 (memrchr, void const *,
404_GL_CXXALIASWARN (memrchr); 525_GL_CXXALIASWARN (memrchr);
405# endif 526# endif
406#elif defined GNULIB_POSIXCHECK 527#elif defined GNULIB_POSIXCHECK
407# undef memrchr
408# if HAVE_RAW_DECL_MEMRCHR 528# if HAVE_RAW_DECL_MEMRCHR
409_GL_WARN_ON_USE (memrchr, "memrchr is unportable - " 529_GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
410 "use gnulib module memrchr for portability"); 530 "use gnulib module memrchr for portability");
@@ -420,18 +540,21 @@ _GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
420# define memset_explicit rpl_memset_explicit 540# define memset_explicit rpl_memset_explicit
421# endif 541# endif
422_GL_FUNCDECL_RPL (memset_explicit, void *, 542_GL_FUNCDECL_RPL (memset_explicit, void *,
423 (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1))); 543 (void *__dest, int __c, size_t __n),
544 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3));
424_GL_CXXALIAS_RPL (memset_explicit, void *, (void *__dest, int __c, size_t __n)); 545_GL_CXXALIAS_RPL (memset_explicit, void *, (void *__dest, int __c, size_t __n));
425# else 546# else
426# if !@HAVE_MEMSET_EXPLICIT@ 547# if !@HAVE_MEMSET_EXPLICIT@
427_GL_FUNCDECL_SYS (memset_explicit, void *, 548_GL_FUNCDECL_SYS (memset_explicit, void *,
428 (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1))); 549 (void *__dest, int __c, size_t __n),
550 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3));
429# endif 551# endif
430_GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n)); 552_GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n));
431# endif 553# endif
554# if __GLIBC__ >= 2
432_GL_CXXALIASWARN (memset_explicit); 555_GL_CXXALIASWARN (memset_explicit);
556# endif
433#elif defined GNULIB_POSIXCHECK 557#elif defined GNULIB_POSIXCHECK
434# undef memset_explicit
435# if HAVE_RAW_DECL_MEMSET_EXPLICIT 558# if HAVE_RAW_DECL_MEMSET_EXPLICIT
436_GL_WARN_ON_USE (memset_explicit, "memset_explicit is unportable - " 559_GL_WARN_ON_USE (memset_explicit, "memset_explicit is unportable - "
437 "use gnulib module memset_explicit for portability"); 560 "use gnulib module memset_explicit for portability");
@@ -443,7 +566,7 @@ _GL_WARN_ON_USE (memset_explicit, "memset_explicit is unportable - "
443 occur within N bytes. */ 566 occur within N bytes. */
444#if @GNULIB_RAWMEMCHR@ 567#if @GNULIB_RAWMEMCHR@
445# if ! @HAVE_RAWMEMCHR@ 568# if ! @HAVE_RAWMEMCHR@
446_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in) 569_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in),
447 _GL_ATTRIBUTE_PURE 570 _GL_ATTRIBUTE_PURE
448 _GL_ARG_NONNULL ((1))); 571 _GL_ARG_NONNULL ((1)));
449# endif 572# endif
@@ -466,7 +589,6 @@ _GL_CXXALIASWARN1 (rawmemchr, void const *,
466_GL_CXXALIASWARN (rawmemchr); 589_GL_CXXALIASWARN (rawmemchr);
467# endif 590# endif
468#elif defined GNULIB_POSIXCHECK 591#elif defined GNULIB_POSIXCHECK
469# undef rawmemchr
470# if HAVE_RAW_DECL_RAWMEMCHR 592# if HAVE_RAW_DECL_RAWMEMCHR
471_GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - " 593_GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
472 "use gnulib module rawmemchr for portability"); 594 "use gnulib module rawmemchr for portability");
@@ -481,14 +603,14 @@ _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
481# define stpcpy rpl_stpcpy 603# define stpcpy rpl_stpcpy
482# endif 604# endif
483_GL_FUNCDECL_RPL (stpcpy, char *, 605_GL_FUNCDECL_RPL (stpcpy, char *,
484 (char *restrict __dst, char const *restrict __src) 606 (char *restrict __dst, char const *restrict __src),
485 _GL_ARG_NONNULL ((1, 2))); 607 _GL_ARG_NONNULL ((1, 2)));
486_GL_CXXALIAS_RPL (stpcpy, char *, 608_GL_CXXALIAS_RPL (stpcpy, char *,
487 (char *restrict __dst, char const *restrict __src)); 609 (char *restrict __dst, char const *restrict __src));
488# else 610# else
489# if !@HAVE_STPCPY@ 611# if !@HAVE_STPCPY@
490_GL_FUNCDECL_SYS (stpcpy, char *, 612_GL_FUNCDECL_SYS (stpcpy, char *,
491 (char *restrict __dst, char const *restrict __src) 613 (char *restrict __dst, char const *restrict __src),
492 _GL_ARG_NONNULL ((1, 2))); 614 _GL_ARG_NONNULL ((1, 2)));
493# endif 615# endif
494_GL_CXXALIAS_SYS (stpcpy, char *, 616_GL_CXXALIAS_SYS (stpcpy, char *,
@@ -498,7 +620,6 @@ _GL_CXXALIAS_SYS (stpcpy, char *,
498_GL_CXXALIASWARN (stpcpy); 620_GL_CXXALIASWARN (stpcpy);
499# endif 621# endif
500#elif defined GNULIB_POSIXCHECK 622#elif defined GNULIB_POSIXCHECK
501# undef stpcpy
502# if HAVE_RAW_DECL_STPCPY 623# if HAVE_RAW_DECL_STPCPY
503_GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - " 624_GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
504 "use gnulib module stpcpy for portability"); 625 "use gnulib module stpcpy for portability");
@@ -515,7 +636,7 @@ _GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
515# endif 636# endif
516_GL_FUNCDECL_RPL (stpncpy, char *, 637_GL_FUNCDECL_RPL (stpncpy, char *,
517 (char *restrict __dst, char const *restrict __src, 638 (char *restrict __dst, char const *restrict __src,
518 size_t __n) 639 size_t __n),
519 _GL_ARG_NONNULL ((1, 2))); 640 _GL_ARG_NONNULL ((1, 2)));
520_GL_CXXALIAS_RPL (stpncpy, char *, 641_GL_CXXALIAS_RPL (stpncpy, char *,
521 (char *restrict __dst, char const *restrict __src, 642 (char *restrict __dst, char const *restrict __src,
@@ -524,7 +645,7 @@ _GL_CXXALIAS_RPL (stpncpy, char *,
524# if ! @HAVE_STPNCPY@ 645# if ! @HAVE_STPNCPY@
525_GL_FUNCDECL_SYS (stpncpy, char *, 646_GL_FUNCDECL_SYS (stpncpy, char *,
526 (char *restrict __dst, char const *restrict __src, 647 (char *restrict __dst, char const *restrict __src,
527 size_t __n) 648 size_t __n),
528 _GL_ARG_NONNULL ((1, 2))); 649 _GL_ARG_NONNULL ((1, 2)));
529# endif 650# endif
530_GL_CXXALIAS_SYS (stpncpy, char *, 651_GL_CXXALIAS_SYS (stpncpy, char *,
@@ -535,7 +656,6 @@ _GL_CXXALIAS_SYS (stpncpy, char *,
535_GL_CXXALIASWARN (stpncpy); 656_GL_CXXALIASWARN (stpncpy);
536# endif 657# endif
537#elif defined GNULIB_POSIXCHECK 658#elif defined GNULIB_POSIXCHECK
538# undef stpncpy
539# if HAVE_RAW_DECL_STPNCPY 659# if HAVE_RAW_DECL_STPNCPY
540_GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - " 660_GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - "
541 "use gnulib module stpncpy for portability"); 661 "use gnulib module stpncpy for portability");
@@ -545,7 +665,6 @@ _GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - "
545#if defined GNULIB_POSIXCHECK 665#if defined GNULIB_POSIXCHECK
546/* strchr() does not work with multibyte strings if the locale encoding is 666/* strchr() does not work with multibyte strings if the locale encoding is
547 GB18030 and the character to be searched is a digit. */ 667 GB18030 and the character to be searched is a digit. */
548# undef strchr
549/* Assume strchr is always declared. */ 668/* Assume strchr is always declared. */
550_GL_WARN_ON_USE_CXX (strchr, 669_GL_WARN_ON_USE_CXX (strchr,
551 const char *, char *, (const char *, int), 670 const char *, char *, (const char *, int),
@@ -560,14 +679,14 @@ _GL_WARN_ON_USE_CXX (strchr,
560# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 679# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
561# define strchrnul rpl_strchrnul 680# define strchrnul rpl_strchrnul
562# endif 681# endif
563_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in) 682_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in),
564 _GL_ATTRIBUTE_PURE 683 _GL_ATTRIBUTE_PURE
565 _GL_ARG_NONNULL ((1))); 684 _GL_ARG_NONNULL ((1)));
566_GL_CXXALIAS_RPL (strchrnul, char *, 685_GL_CXXALIAS_RPL (strchrnul, char *,
567 (const char *str, int ch)); 686 (const char *str, int ch));
568# else 687# else
569# if ! @HAVE_STRCHRNUL@ 688# if ! @HAVE_STRCHRNUL@
570_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in) 689_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in),
571 _GL_ATTRIBUTE_PURE 690 _GL_ATTRIBUTE_PURE
572 _GL_ARG_NONNULL ((1))); 691 _GL_ARG_NONNULL ((1)));
573# endif 692# endif
@@ -591,7 +710,6 @@ _GL_CXXALIASWARN1 (strchrnul, char const *,
591_GL_CXXALIASWARN (strchrnul); 710_GL_CXXALIASWARN (strchrnul);
592# endif 711# endif
593#elif defined GNULIB_POSIXCHECK 712#elif defined GNULIB_POSIXCHECK
594# undef strchrnul
595# if HAVE_RAW_DECL_STRCHRNUL 713# if HAVE_RAW_DECL_STRCHRNUL
596_GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - " 714_GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
597 "use gnulib module strchrnul for portability"); 715 "use gnulib module strchrnul for portability");
@@ -606,7 +724,7 @@ _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
606# define strdup rpl_strdup 724# define strdup rpl_strdup
607# endif 725# endif
608_GL_FUNCDECL_RPL (strdup, char *, 726_GL_FUNCDECL_RPL (strdup, char *,
609 (char const *__s) 727 (char const *__s),
610 _GL_ARG_NONNULL ((1)) 728 _GL_ARG_NONNULL ((1))
611 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 729 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
612_GL_CXXALIAS_RPL (strdup, char *, (char const *__s)); 730_GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
@@ -621,16 +739,17 @@ _GL_CXXALIAS_MDA (strdup, char *, (char const *__s));
621 /* strdup exists as a function and as a macro. Get rid of the macro. */ 739 /* strdup exists as a function and as a macro. Get rid of the macro. */
622# undef strdup 740# undef strdup
623# endif 741# endif
624# if (!@HAVE_DECL_STRDUP@ || __GNUC__ >= 11) && !defined strdup 742# if (!@HAVE_DECL_STRDUP@ || (__GNUC__ >= 11 && !defined __clang__)) \
743 && !defined strdup
625# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 744# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
626_GL_FUNCDECL_SYS (strdup, char *, 745_GL_FUNCDECL_SYS (strdup, char *,
627 (char const *__s) 746 (char const *__s),
628 _GL_ATTRIBUTE_NOTHROW
629 _GL_ARG_NONNULL ((1)) 747 _GL_ARG_NONNULL ((1))
630 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 748 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
749 _GL_ATTRIBUTE_NOTHROW;
631# else 750# else
632_GL_FUNCDECL_SYS (strdup, char *, 751_GL_FUNCDECL_SYS (strdup, char *,
633 (char const *__s) 752 (char const *__s),
634 _GL_ARG_NONNULL ((1)) 753 _GL_ARG_NONNULL ((1))
635 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 754 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
636# endif 755# endif
@@ -639,23 +758,22 @@ _GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
639# endif 758# endif
640_GL_CXXALIASWARN (strdup); 759_GL_CXXALIASWARN (strdup);
641#else 760#else
642# if __GNUC__ >= 11 && !defined strdup 761# if (__GNUC__ >= 11 && !defined __clang__) && !defined strdup
643/* For -Wmismatched-dealloc: Associate strdup with free or rpl_free. */ 762/* For -Wmismatched-dealloc: Associate strdup with free or rpl_free. */
644# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 763# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
645_GL_FUNCDECL_SYS (strdup, char *, 764_GL_FUNCDECL_SYS (strdup, char *,
646 (char const *__s) 765 (char const *__s),
647 _GL_ATTRIBUTE_NOTHROW
648 _GL_ARG_NONNULL ((1)) 766 _GL_ARG_NONNULL ((1))
649 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 767 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
768 _GL_ATTRIBUTE_NOTHROW;
650# else 769# else
651_GL_FUNCDECL_SYS (strdup, char *, 770_GL_FUNCDECL_SYS (strdup, char *,
652 (char const *__s) 771 (char const *__s),
653 _GL_ARG_NONNULL ((1)) 772 _GL_ARG_NONNULL ((1))
654 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 773 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
655# endif 774# endif
656# endif 775# endif
657# if defined GNULIB_POSIXCHECK 776# if defined GNULIB_POSIXCHECK
658# undef strdup
659# if HAVE_RAW_DECL_STRDUP 777# if HAVE_RAW_DECL_STRDUP
660_GL_WARN_ON_USE (strdup, "strdup is unportable - " 778_GL_WARN_ON_USE (strdup, "strdup is unportable - "
661 "use gnulib module strdup for portability"); 779 "use gnulib module strdup for portability");
@@ -680,6 +798,21 @@ _GL_CXXALIASWARN (strdup);
680# endif 798# endif
681#endif 799#endif
682 800
801/* Are strings S1 and S2 equal? */
802#if @GNULIB_STRINGEQ@ && !@HAVE_DECL_STREQ@
803# ifdef __cplusplus
804extern "C" {
805# endif
806_GL_STRING_INLINE bool
807streq (char const *__s1, char const *__s2)
808{
809 return !strcmp (__s1, __s2);
810}
811# ifdef __cplusplus
812}
813# endif
814#endif
815
683/* Append no more than N characters from SRC onto DEST. */ 816/* Append no more than N characters from SRC onto DEST. */
684#if @GNULIB_STRNCAT@ 817#if @GNULIB_STRNCAT@
685# if @REPLACE_STRNCAT@ 818# if @REPLACE_STRNCAT@
@@ -688,8 +821,9 @@ _GL_CXXALIASWARN (strdup);
688# define strncat rpl_strncat 821# define strncat rpl_strncat
689# endif 822# endif
690_GL_FUNCDECL_RPL (strncat, char *, 823_GL_FUNCDECL_RPL (strncat, char *,
691 (char *restrict dest, const char *restrict src, size_t n) 824 (char *restrict dest, const char *restrict src, size_t n),
692 _GL_ARG_NONNULL ((1, 2))); 825 _GL_ARG_NONNULL ((1))
826 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
693_GL_CXXALIAS_RPL (strncat, char *, 827_GL_CXXALIAS_RPL (strncat, char *,
694 (char *restrict dest, const char *restrict src, size_t n)); 828 (char *restrict dest, const char *restrict src, size_t n));
695# else 829# else
@@ -700,13 +834,41 @@ _GL_CXXALIAS_SYS (strncat, char *,
700_GL_CXXALIASWARN (strncat); 834_GL_CXXALIASWARN (strncat);
701# endif 835# endif
702#elif defined GNULIB_POSIXCHECK 836#elif defined GNULIB_POSIXCHECK
703# undef strncat
704# if HAVE_RAW_DECL_STRNCAT 837# if HAVE_RAW_DECL_STRNCAT
705_GL_WARN_ON_USE (strncat, "strncat is unportable - " 838_GL_WARN_ON_USE (strncat, "strncat is unportable - "
706 "use gnulib module strncat for portability"); 839 "use gnulib module strncat for portability");
707# endif 840# endif
708#endif 841#endif
709 842
843/* Copy no more than N bytes of SRC to DST, returning DST. */
844#if @GNULIB_STRNCPY@
845# if @REPLACE_STRNCPY@
846# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
847# undef strncpy
848# define strncpy rpl_strncpy
849# endif
850_GL_FUNCDECL_RPL (strncpy, char *,
851 (char *restrict __dst, char const *restrict __src,
852 size_t __n),
853 _GL_ARG_NONNULL ((1, 2)));
854_GL_CXXALIAS_RPL (strncpy, char *,
855 (char *restrict __dst, char const *restrict __src,
856 size_t __n));
857# else
858_GL_CXXALIAS_SYS (strncpy, char *,
859 (char *restrict __dst, char const *restrict __src,
860 size_t __n));
861# endif
862# if __GLIBC__ >= 2
863_GL_CXXALIASWARN (strncpy);
864# endif
865#elif defined GNULIB_POSIXCHECK
866# if HAVE_RAW_DECL_STRNCPY
867_GL_WARN_ON_USE (strncpy, "strncpy is unportable - "
868 "use gnulib module strncpy for portability");
869# endif
870#endif
871
710/* Return a newly allocated copy of at most N bytes of STRING. */ 872/* Return a newly allocated copy of at most N bytes of STRING. */
711#if @GNULIB_STRNDUP@ 873#if @GNULIB_STRNDUP@
712# if @REPLACE_STRNDUP@ 874# if @REPLACE_STRNDUP@
@@ -715,22 +877,23 @@ _GL_WARN_ON_USE (strncat, "strncat is unportable - "
715# define strndup rpl_strndup 877# define strndup rpl_strndup
716# endif 878# endif
717_GL_FUNCDECL_RPL (strndup, char *, 879_GL_FUNCDECL_RPL (strndup, char *,
718 (char const *__s, size_t __n) 880 (char const *__s, size_t __n),
719 _GL_ARG_NONNULL ((1)) 881 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
720 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 882 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
721_GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n)); 883_GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n));
722# else 884# else
723# if !@HAVE_DECL_STRNDUP@ || (__GNUC__ >= 11 && !defined strndup) 885# if !@HAVE_DECL_STRNDUP@ \
886 || ((__GNUC__ >= 11 && !defined __clang__) && !defined strndup)
724# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 887# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
725_GL_FUNCDECL_SYS (strndup, char *, 888_GL_FUNCDECL_SYS (strndup, char *,
726 (char const *__s, size_t __n) 889 (char const *__s, size_t __n),
727 _GL_ATTRIBUTE_NOTHROW 890 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
728 _GL_ARG_NONNULL ((1)) 891 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
729 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 892 _GL_ATTRIBUTE_NOTHROW;
730# else 893# else
731_GL_FUNCDECL_SYS (strndup, char *, 894_GL_FUNCDECL_SYS (strndup, char *,
732 (char const *__s, size_t __n) 895 (char const *__s, size_t __n),
733 _GL_ARG_NONNULL ((1)) 896 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
734 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 897 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
735# endif 898# endif
736# endif 899# endif
@@ -738,23 +901,22 @@ _GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n));
738# endif 901# endif
739_GL_CXXALIASWARN (strndup); 902_GL_CXXALIASWARN (strndup);
740#else 903#else
741# if __GNUC__ >= 11 && !defined strndup 904# if (__GNUC__ >= 11 && !defined __clang__) && !defined strndup
742/* For -Wmismatched-dealloc: Associate strndup with free or rpl_free. */ 905/* For -Wmismatched-dealloc: Associate strndup with free or rpl_free. */
743# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 906# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
744_GL_FUNCDECL_SYS (strndup, char *, 907_GL_FUNCDECL_SYS (strndup, char *,
745 (char const *__s, size_t __n) 908 (char const *__s, size_t __n),
746 _GL_ATTRIBUTE_NOTHROW 909 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
747 _GL_ARG_NONNULL ((1)) 910 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
748 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 911 _GL_ATTRIBUTE_NOTHROW;
749# else 912# else
750_GL_FUNCDECL_SYS (strndup, char *, 913_GL_FUNCDECL_SYS (strndup, char *,
751 (char const *__s, size_t __n) 914 (char const *__s, size_t __n),
752 _GL_ARG_NONNULL ((1)) 915 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
753 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 916 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
754# endif 917# endif
755# endif 918# endif
756# if defined GNULIB_POSIXCHECK 919# if defined GNULIB_POSIXCHECK
757# undef strndup
758# if HAVE_RAW_DECL_STRNDUP 920# if HAVE_RAW_DECL_STRNDUP
759_GL_WARN_ON_USE (strndup, "strndup is unportable - " 921_GL_WARN_ON_USE (strndup, "strndup is unportable - "
760 "use gnulib module strndup for portability"); 922 "use gnulib module strndup for portability");
@@ -771,13 +933,13 @@ _GL_WARN_ON_USE (strndup, "strndup is unportable - "
771# undef strnlen 933# undef strnlen
772# define strnlen rpl_strnlen 934# define strnlen rpl_strnlen
773# endif 935# endif
774_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen) 936_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen),
775 _GL_ATTRIBUTE_PURE 937 _GL_ATTRIBUTE_PURE
776 _GL_ARG_NONNULL ((1))); 938 _GL_ARG_NONNULL ((1)));
777_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__s, size_t __maxlen)); 939_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__s, size_t __maxlen));
778# else 940# else
779# if ! @HAVE_DECL_STRNLEN@ 941# if ! @HAVE_DECL_STRNLEN@
780_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen) 942_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen),
781 _GL_ATTRIBUTE_PURE 943 _GL_ATTRIBUTE_PURE
782 _GL_ARG_NONNULL ((1))); 944 _GL_ARG_NONNULL ((1)));
783# endif 945# endif
@@ -785,7 +947,6 @@ _GL_CXXALIAS_SYS (strnlen, size_t, (char const *__s, size_t __maxlen));
785# endif 947# endif
786_GL_CXXALIASWARN (strnlen); 948_GL_CXXALIASWARN (strnlen);
787#elif defined GNULIB_POSIXCHECK 949#elif defined GNULIB_POSIXCHECK
788# undef strnlen
789# if HAVE_RAW_DECL_STRNLEN 950# if HAVE_RAW_DECL_STRNLEN
790_GL_WARN_ON_USE (strnlen, "strnlen is unportable - " 951_GL_WARN_ON_USE (strnlen, "strnlen is unportable - "
791 "use gnulib module strnlen for portability"); 952 "use gnulib module strnlen for portability");
@@ -797,7 +958,6 @@ _GL_WARN_ON_USE (strnlen, "strnlen is unportable - "
797 Even in this simple case, it does not work with multibyte strings if the 958 Even in this simple case, it does not work with multibyte strings if the
798 locale encoding is GB18030 and one of the characters to be searched is a 959 locale encoding is GB18030 and one of the characters to be searched is a
799 digit. */ 960 digit. */
800# undef strcspn
801/* Assume strcspn is always declared. */ 961/* Assume strcspn is always declared. */
802_GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings " 962_GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings "
803 "in multibyte locales - " 963 "in multibyte locales - "
@@ -807,7 +967,7 @@ _GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings "
807/* Find the first occurrence in S of any character in ACCEPT. */ 967/* Find the first occurrence in S of any character in ACCEPT. */
808#if @GNULIB_STRPBRK@ 968#if @GNULIB_STRPBRK@
809# if ! @HAVE_STRPBRK@ 969# if ! @HAVE_STRPBRK@
810_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept) 970_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept),
811 _GL_ATTRIBUTE_PURE 971 _GL_ATTRIBUTE_PURE
812 _GL_ARG_NONNULL ((1, 2))); 972 _GL_ARG_NONNULL ((1, 2)));
813# endif 973# endif
@@ -834,7 +994,6 @@ _GL_CXXALIASWARN (strpbrk);
834 Even in this simple case, it does not work with multibyte strings if the 994 Even in this simple case, it does not work with multibyte strings if the
835 locale encoding is GB18030 and one of the characters to be searched is a 995 locale encoding is GB18030 and one of the characters to be searched is a
836 digit. */ 996 digit. */
837# undef strpbrk
838_GL_WARN_ON_USE_CXX (strpbrk, 997_GL_WARN_ON_USE_CXX (strpbrk,
839 const char *, char *, (const char *, const char *), 998 const char *, char *, (const char *, const char *),
840 "strpbrk cannot work correctly on character strings " 999 "strpbrk cannot work correctly on character strings "
@@ -854,7 +1013,6 @@ _GL_WARN_ON_USE_CXX (strpbrk,
854#if defined GNULIB_POSIXCHECK 1013#if defined GNULIB_POSIXCHECK
855/* strspn() assumes the second argument is a list of single-byte characters. 1014/* strspn() assumes the second argument is a list of single-byte characters.
856 Even in this simple case, it cannot work with multibyte strings. */ 1015 Even in this simple case, it cannot work with multibyte strings. */
857# undef strspn
858/* Assume strspn is always declared. */ 1016/* Assume strspn is always declared. */
859_GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings " 1017_GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings "
860 "in multibyte locales - " 1018 "in multibyte locales - "
@@ -864,7 +1022,6 @@ _GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings "
864#if defined GNULIB_POSIXCHECK 1022#if defined GNULIB_POSIXCHECK
865/* strrchr() does not work with multibyte strings if the locale encoding is 1023/* strrchr() does not work with multibyte strings if the locale encoding is
866 GB18030 and the character to be searched is a digit. */ 1024 GB18030 and the character to be searched is a digit. */
867# undef strrchr
868/* Assume strrchr is always declared. */ 1025/* Assume strrchr is always declared. */
869_GL_WARN_ON_USE_CXX (strrchr, 1026_GL_WARN_ON_USE_CXX (strrchr,
870 const char *, char *, (const char *, int), 1027 const char *, char *, (const char *, int),
@@ -892,20 +1049,18 @@ _GL_WARN_ON_USE_CXX (strrchr,
892#if @GNULIB_STRSEP@ 1049#if @GNULIB_STRSEP@
893# if ! @HAVE_STRSEP@ 1050# if ! @HAVE_STRSEP@
894_GL_FUNCDECL_SYS (strsep, char *, 1051_GL_FUNCDECL_SYS (strsep, char *,
895 (char **restrict __stringp, char const *restrict __delim) 1052 (char **restrict __stringp, char const *restrict __delim),
896 _GL_ARG_NONNULL ((1, 2))); 1053 _GL_ARG_NONNULL ((1, 2)));
897# endif 1054# endif
898_GL_CXXALIAS_SYS (strsep, char *, 1055_GL_CXXALIAS_SYS (strsep, char *,
899 (char **restrict __stringp, char const *restrict __delim)); 1056 (char **restrict __stringp, char const *restrict __delim));
900_GL_CXXALIASWARN (strsep); 1057_GL_CXXALIASWARN (strsep);
901# if defined GNULIB_POSIXCHECK 1058# if defined GNULIB_POSIXCHECK
902# undef strsep
903_GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings " 1059_GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings "
904 "in multibyte locales - " 1060 "in multibyte locales - "
905 "use mbssep if you care about internationalization"); 1061 "use mbssep if you care about internationalization");
906# endif 1062# endif
907#elif defined GNULIB_POSIXCHECK 1063#elif defined GNULIB_POSIXCHECK
908# undef strsep
909# if HAVE_RAW_DECL_STRSEP 1064# if HAVE_RAW_DECL_STRSEP
910_GL_WARN_ON_USE (strsep, "strsep is unportable - " 1065_GL_WARN_ON_USE (strsep, "strsep is unportable - "
911 "use gnulib module strsep for portability"); 1066 "use gnulib module strsep for portability");
@@ -917,7 +1072,7 @@ _GL_WARN_ON_USE (strsep, "strsep is unportable - "
917# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1072# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
918# define strstr rpl_strstr 1073# define strstr rpl_strstr
919# endif 1074# endif
920_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle) 1075_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle),
921 _GL_ATTRIBUTE_PURE 1076 _GL_ATTRIBUTE_PURE
922 _GL_ARG_NONNULL ((1, 2))); 1077 _GL_ARG_NONNULL ((1, 2)));
923_GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle)); 1078_GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle));
@@ -948,11 +1103,13 @@ _GL_CXXALIASWARN (strstr);
948 as a sequence of bytes, not of characters. */ 1103 as a sequence of bytes, not of characters. */
949# undef strstr 1104# undef strstr
950/* Assume strstr is always declared. */ 1105/* Assume strstr is always declared. */
951_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot " 1106_GL_WARN_ON_USE_CXX (strstr,
952 "work correctly on character strings in most " 1107 const char *, char *, (const char *, const char *),
953 "multibyte locales - " 1108 "strstr is quadratic on many systems, and cannot "
954 "use mbsstr if you care about internationalization, " 1109 "work correctly on character strings in most "
955 "or use strstr if you care about speed"); 1110 "multibyte locales - "
1111 "use mbsstr if you care about internationalization, "
1112 "or use strstr if you care about speed");
956#endif 1113#endif
957 1114
958/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive 1115/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
@@ -963,7 +1120,7 @@ _GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot "
963# define strcasestr rpl_strcasestr 1120# define strcasestr rpl_strcasestr
964# endif 1121# endif
965_GL_FUNCDECL_RPL (strcasestr, char *, 1122_GL_FUNCDECL_RPL (strcasestr, char *,
966 (const char *haystack, const char *needle) 1123 (const char *haystack, const char *needle),
967 _GL_ATTRIBUTE_PURE 1124 _GL_ATTRIBUTE_PURE
968 _GL_ARG_NONNULL ((1, 2))); 1125 _GL_ARG_NONNULL ((1, 2)));
969_GL_CXXALIAS_RPL (strcasestr, char *, 1126_GL_CXXALIAS_RPL (strcasestr, char *,
@@ -971,7 +1128,7 @@ _GL_CXXALIAS_RPL (strcasestr, char *,
971# else 1128# else
972# if ! @HAVE_STRCASESTR@ 1129# if ! @HAVE_STRCASESTR@
973_GL_FUNCDECL_SYS (strcasestr, char *, 1130_GL_FUNCDECL_SYS (strcasestr, char *,
974 (const char *haystack, const char *needle) 1131 (const char *haystack, const char *needle),
975 _GL_ATTRIBUTE_PURE 1132 _GL_ATTRIBUTE_PURE
976 _GL_ARG_NONNULL ((1, 2))); 1133 _GL_ARG_NONNULL ((1, 2)));
977# endif 1134# endif
@@ -998,7 +1155,6 @@ _GL_CXXALIASWARN (strcasestr);
998/* strcasestr() does not work with multibyte strings: 1155/* strcasestr() does not work with multibyte strings:
999 It is a glibc extension, and glibc implements it only for unibyte 1156 It is a glibc extension, and glibc implements it only for unibyte
1000 locales. */ 1157 locales. */
1001# undef strcasestr
1002# if HAVE_RAW_DECL_STRCASESTR 1158# if HAVE_RAW_DECL_STRCASESTR
1003_GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character " 1159_GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
1004 "strings in multibyte locales - " 1160 "strings in multibyte locales - "
@@ -1038,19 +1194,19 @@ _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
1038# endif 1194# endif
1039_GL_FUNCDECL_RPL (strtok_r, char *, 1195_GL_FUNCDECL_RPL (strtok_r, char *,
1040 (char *restrict s, char const *restrict delim, 1196 (char *restrict s, char const *restrict delim,
1041 char **restrict save_ptr) 1197 char **restrict save_ptr),
1042 _GL_ARG_NONNULL ((2, 3))); 1198 _GL_ARG_NONNULL ((2, 3)));
1043_GL_CXXALIAS_RPL (strtok_r, char *, 1199_GL_CXXALIAS_RPL (strtok_r, char *,
1044 (char *restrict s, char const *restrict delim, 1200 (char *restrict s, char const *restrict delim,
1045 char **restrict save_ptr)); 1201 char **restrict save_ptr));
1046# else 1202# else
1047# if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK 1203# if @UNDEFINE_STRTOK_R@
1048# undef strtok_r 1204# undef strtok_r
1049# endif 1205# endif
1050# if ! @HAVE_DECL_STRTOK_R@ 1206# if ! @HAVE_DECL_STRTOK_R@
1051_GL_FUNCDECL_SYS (strtok_r, char *, 1207_GL_FUNCDECL_SYS (strtok_r, char *,
1052 (char *restrict s, char const *restrict delim, 1208 (char *restrict s, char const *restrict delim,
1053 char **restrict save_ptr) 1209 char **restrict save_ptr),
1054 _GL_ARG_NONNULL ((2, 3))); 1210 _GL_ARG_NONNULL ((2, 3)));
1055# endif 1211# endif
1056_GL_CXXALIAS_SYS (strtok_r, char *, 1212_GL_CXXALIAS_SYS (strtok_r, char *,
@@ -1064,7 +1220,6 @@ _GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character "
1064 "use mbstok_r if you care about internationalization"); 1220 "use mbstok_r if you care about internationalization");
1065# endif 1221# endif
1066#elif defined GNULIB_POSIXCHECK 1222#elif defined GNULIB_POSIXCHECK
1067# undef strtok_r
1068# if HAVE_RAW_DECL_STRTOK_R 1223# if HAVE_RAW_DECL_STRTOK_R
1069_GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - " 1224_GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
1070 "use gnulib module strtok_r for portability"); 1225 "use gnulib module strtok_r for portability");
@@ -1075,22 +1230,38 @@ _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
1075/* The following functions are not specified by POSIX. They are gnulib 1230/* The following functions are not specified by POSIX. They are gnulib
1076 extensions. */ 1231 extensions. */
1077 1232
1233#if @GNULIB_STR_STARTSWITH@
1234/* Returns true if STRING starts with PREFIX.
1235 Returns false otherwise. */
1236_GL_EXTERN_C bool str_startswith (const char *string, const char *prefix)
1237 _GL_ATTRIBUTE_PURE
1238 _GL_ARG_NONNULL ((1, 2));
1239#endif
1240
1241#if @GNULIB_STR_ENDSWITH@
1242/* Returns true if STRING ends with SUFFIX.
1243 Returns false otherwise. */
1244_GL_EXTERN_C bool str_endswith (const char *string, const char *prefix)
1245 _GL_ATTRIBUTE_PURE
1246 _GL_ARG_NONNULL ((1, 2));
1247#endif
1248
1078#if @GNULIB_MBSLEN@ 1249#if @GNULIB_MBSLEN@
1079/* Return the number of multibyte characters in the character string STRING. 1250/* Return the number of multibyte characters in the character string STRING.
1080 This considers multibyte characters, unlike strlen, which counts bytes. */ 1251 This considers multibyte characters, unlike strlen, which counts bytes. */
1081# ifdef __MirBSD__ /* MirBSD defines mbslen as a macro. Override it. */ 1252# ifdef __MirBSD__ /* MirBSD defines mbslen as a macro. Override it. */
1082# undef mbslen 1253# undef mbslen
1083# endif 1254# endif
1084# if @HAVE_MBSLEN@ /* AIX, OSF/1, MirBSD define mbslen already in libc. */ 1255# if @HAVE_MBSLEN@ /* AIX, MirBSD define mbslen already in libc. */
1085# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1256# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1086# define mbslen rpl_mbslen 1257# define mbslen rpl_mbslen
1087# endif 1258# endif
1088_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) 1259_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string),
1089 _GL_ATTRIBUTE_PURE 1260 _GL_ATTRIBUTE_PURE
1090 _GL_ARG_NONNULL ((1))); 1261 _GL_ARG_NONNULL ((1)));
1091_GL_CXXALIAS_RPL (mbslen, size_t, (const char *string)); 1262_GL_CXXALIAS_RPL (mbslen, size_t, (const char *string));
1092# else 1263# else
1093_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) 1264_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string),
1094 _GL_ATTRIBUTE_PURE 1265 _GL_ATTRIBUTE_PURE
1095 _GL_ARG_NONNULL ((1))); 1266 _GL_ARG_NONNULL ((1)));
1096_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string)); 1267_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string));
@@ -1117,12 +1288,12 @@ _GL_EXTERN_C size_t mbsnlen (const char *string, size_t len)
1117# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1288# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1118# define mbschr rpl_mbschr /* avoid collision with HP-UX function */ 1289# define mbschr rpl_mbschr /* avoid collision with HP-UX function */
1119# endif 1290# endif
1120_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c) 1291_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c),
1121 _GL_ATTRIBUTE_PURE 1292 _GL_ATTRIBUTE_PURE
1122 _GL_ARG_NONNULL ((1))); 1293 _GL_ARG_NONNULL ((1)));
1123_GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c)); 1294_GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c));
1124# else 1295# else
1125_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c) 1296_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c),
1126 _GL_ATTRIBUTE_PURE 1297 _GL_ATTRIBUTE_PURE
1127 _GL_ARG_NONNULL ((1))); 1298 _GL_ARG_NONNULL ((1)));
1128_GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c)); 1299_GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c));
@@ -1139,12 +1310,12 @@ _GL_CXXALIASWARN (mbschr);
1139# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1310# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1140# define mbsrchr rpl_mbsrchr /* avoid collision with system function */ 1311# define mbsrchr rpl_mbsrchr /* avoid collision with system function */
1141# endif 1312# endif
1142_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c) 1313_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c),
1143 _GL_ATTRIBUTE_PURE 1314 _GL_ATTRIBUTE_PURE
1144 _GL_ARG_NONNULL ((1))); 1315 _GL_ARG_NONNULL ((1)));
1145_GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c)); 1316_GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c));
1146# else 1317# else
1147_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c) 1318_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c),
1148 _GL_ATTRIBUTE_PURE 1319 _GL_ATTRIBUTE_PURE
1149 _GL_ARG_NONNULL ((1))); 1320 _GL_ARG_NONNULL ((1)));
1150_GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c)); 1321_GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c));
@@ -1160,6 +1331,33 @@ _GL_CXXALIASWARN (mbsrchr);
1160_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle) 1331_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
1161 _GL_ATTRIBUTE_PURE 1332 _GL_ATTRIBUTE_PURE
1162 _GL_ARG_NONNULL ((1, 2)); 1333 _GL_ARG_NONNULL ((1, 2));
1334# ifndef _GL_NO_CONST_GENERICS
1335/* Don't silently convert a 'const char *' to a 'char *'. Programmers want
1336 compiler warnings for 'const' related mistakes. */
1337# ifdef __cplusplus
1338extern "C++" { /* needed for AIX */
1339template <typename T>
1340 T * mbsstr_template (T* haystack, const char *needle);
1341template <>
1342 inline char * mbsstr_template (char *haystack, const char *needle)
1343 { return mbsstr (haystack, needle); }
1344template <>
1345 inline const char * mbsstr_template (const char *haystack, const char *needle)
1346 { return mbsstr (haystack, needle); }
1347}
1348# undef mbsstr
1349# define mbsstr mbsstr_template
1350# elif !defined mbsstr
1351# if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
1352 || defined __ICC || defined __TINYC__ \
1353 || (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__)))
1354# define mbsstr(h,n) \
1355 _Generic ((h), \
1356 char const *: (char const *) mbsstr ((h), (n)), \
1357 default : mbsstr ((h), (n)))
1358# endif
1359# endif
1360# endif
1163#endif 1361#endif
1164 1362
1165#if @GNULIB_MBSCASECMP@ 1363#if @GNULIB_MBSCASECMP@
@@ -1201,6 +1399,33 @@ _GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n)
1201_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix) 1399_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
1202 _GL_ATTRIBUTE_PURE 1400 _GL_ATTRIBUTE_PURE
1203 _GL_ARG_NONNULL ((1, 2)); 1401 _GL_ARG_NONNULL ((1, 2));
1402# ifndef _GL_NO_CONST_GENERICS
1403/* Don't silently convert a 'const char *' to a 'char *'. Programmers want
1404 compiler warnings for 'const' related mistakes. */
1405# ifdef __cplusplus
1406extern "C++" { /* needed for AIX */
1407template <typename T>
1408 T * mbspcasecmp_template (T* string, const char *prefix);
1409template <>
1410 inline char * mbspcasecmp_template (char *string, const char *prefix)
1411 { return mbspcasecmp (string, prefix); }
1412template <>
1413 inline const char * mbspcasecmp_template (const char *string, const char *prefix)
1414 { return mbspcasecmp (string, prefix); }
1415}
1416# undef mbspcasecmp
1417# define mbspcasecmp mbspcasecmp_template
1418# elif !defined mbspcasecmp
1419# if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
1420 || defined __ICC || defined __TINYC__ \
1421 || (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__)))
1422# define mbspcasecmp(s,p) \
1423 _Generic ((s), \
1424 char const *: (char const *) mbspcasecmp ((s), (p)), \
1425 default : mbspcasecmp ((s), (p)))
1426# endif
1427# endif
1428# endif
1204#endif 1429#endif
1205 1430
1206#if @GNULIB_MBSCASESTR@ 1431#if @GNULIB_MBSCASESTR@
@@ -1212,6 +1437,33 @@ _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
1212_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle) 1437_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
1213 _GL_ATTRIBUTE_PURE 1438 _GL_ATTRIBUTE_PURE
1214 _GL_ARG_NONNULL ((1, 2)); 1439 _GL_ARG_NONNULL ((1, 2));
1440# ifndef _GL_NO_CONST_GENERICS
1441/* Don't silently convert a 'const char *' to a 'char *'. Programmers want
1442 compiler warnings for 'const' related mistakes. */
1443# ifdef __cplusplus
1444extern "C++" { /* needed for AIX */
1445template <typename T>
1446 T * mbscasestr_template (T* haystack, const char *needle);
1447template <>
1448 inline char * mbscasestr_template (char *haystack, const char *needle)
1449 { return mbscasestr (haystack, needle); }
1450template <>
1451 inline const char * mbscasestr_template (const char *haystack, const char *needle)
1452 { return mbscasestr (haystack, needle); }
1453}
1454# undef mbscasestr
1455# define mbscasestr mbscasestr_template
1456# elif !defined mbscasestr
1457# if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
1458 || defined __ICC || defined __TINYC__ \
1459 || (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__)))
1460# define mbscasestr(h,n) \
1461 _Generic ((h), \
1462 char const *: (char const *) mbscasestr ((h), (n)), \
1463 default : mbscasestr ((h), (n)))
1464# endif
1465# endif
1466# endif
1215#endif 1467#endif
1216 1468
1217#if @GNULIB_MBSCSPN@ 1469#if @GNULIB_MBSCSPN@
@@ -1234,12 +1486,12 @@ _GL_EXTERN_C size_t mbscspn (const char *string, const char *accept)
1234# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1486# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1235# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */ 1487# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
1236# endif 1488# endif
1237_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept) 1489_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept),
1238 _GL_ATTRIBUTE_PURE 1490 _GL_ATTRIBUTE_PURE
1239 _GL_ARG_NONNULL ((1, 2))); 1491 _GL_ARG_NONNULL ((1, 2)));
1240_GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept)); 1492_GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept));
1241# else 1493# else
1242_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept) 1494_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept),
1243 _GL_ATTRIBUTE_PURE 1495 _GL_ATTRIBUTE_PURE
1244 _GL_ARG_NONNULL ((1, 2))); 1496 _GL_ARG_NONNULL ((1, 2)));
1245_GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept)); 1497_GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept));
@@ -1299,6 +1551,24 @@ _GL_EXTERN_C char * mbstok_r (char *restrict string, const char *delim,
1299 _GL_ARG_NONNULL ((2, 3)); 1551 _GL_ARG_NONNULL ((2, 3));
1300#endif 1552#endif
1301 1553
1554#if @GNULIB_MBS_STARTSWITH@
1555/* Returns true if STRING starts with PREFIX.
1556 Returns false otherwise. */
1557_GL_EXTERN_C bool mbs_startswith (const char *string, const char *prefix)
1558 _GL_ATTRIBUTE_PURE
1559 _GL_ARG_NONNULL ((1, 2));
1560#endif
1561
1562#if @GNULIB_MBS_ENDSWITH@
1563/* Returns true if STRING ends with SUFFIX.
1564 Returns false otherwise.
1565 Unlike str_endswith(), this function works correctly in multibyte locales.
1566 */
1567_GL_EXTERN_C bool mbs_endswith (const char *string, const char *suffix)
1568 _GL_ATTRIBUTE_PURE
1569 _GL_ARG_NONNULL ((1, 2));
1570#endif
1571
1302/* Map any int, typically from errno, into an error message. */ 1572/* Map any int, typically from errno, into an error message. */
1303#if @GNULIB_STRERROR@ 1573#if @GNULIB_STRERROR@
1304# if @REPLACE_STRERROR@ 1574# if @REPLACE_STRERROR@
@@ -1306,7 +1576,7 @@ _GL_EXTERN_C char * mbstok_r (char *restrict string, const char *delim,
1306# undef strerror 1576# undef strerror
1307# define strerror rpl_strerror 1577# define strerror rpl_strerror
1308# endif 1578# endif
1309_GL_FUNCDECL_RPL (strerror, char *, (int)); 1579_GL_FUNCDECL_RPL (strerror, char *, (int), );
1310_GL_CXXALIAS_RPL (strerror, char *, (int)); 1580_GL_CXXALIAS_RPL (strerror, char *, (int));
1311# else 1581# else
1312_GL_CXXALIAS_SYS (strerror, char *, (int)); 1582_GL_CXXALIAS_SYS (strerror, char *, (int));
@@ -1315,7 +1585,6 @@ _GL_CXXALIAS_SYS (strerror, char *, (int));
1315_GL_CXXALIASWARN (strerror); 1585_GL_CXXALIASWARN (strerror);
1316# endif 1586# endif
1317#elif defined GNULIB_POSIXCHECK 1587#elif defined GNULIB_POSIXCHECK
1318# undef strerror
1319/* Assume strerror is always declared. */ 1588/* Assume strerror is always declared. */
1320_GL_WARN_ON_USE (strerror, "strerror is unportable - " 1589_GL_WARN_ON_USE (strerror, "strerror is unportable - "
1321 "use gnulib module strerror to guarantee non-NULL result"); 1590 "use gnulib module strerror to guarantee non-NULL result");
@@ -1329,12 +1598,12 @@ _GL_WARN_ON_USE (strerror, "strerror is unportable - "
1329# undef strerror_r 1598# undef strerror_r
1330# define strerror_r rpl_strerror_r 1599# define strerror_r rpl_strerror_r
1331# endif 1600# endif
1332_GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen) 1601_GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen),
1333 _GL_ARG_NONNULL ((2))); 1602 _GL_ARG_NONNULL ((2)));
1334_GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)); 1603_GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen));
1335# else 1604# else
1336# if !@HAVE_DECL_STRERROR_R@ 1605# if !@HAVE_DECL_STRERROR_R@
1337_GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen) 1606_GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen),
1338 _GL_ARG_NONNULL ((2))); 1607 _GL_ARG_NONNULL ((2)));
1339# endif 1608# endif
1340_GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)); 1609_GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen));
@@ -1343,13 +1612,49 @@ _GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen));
1343_GL_CXXALIASWARN (strerror_r); 1612_GL_CXXALIASWARN (strerror_r);
1344# endif 1613# endif
1345#elif defined GNULIB_POSIXCHECK 1614#elif defined GNULIB_POSIXCHECK
1346# undef strerror_r
1347# if HAVE_RAW_DECL_STRERROR_R 1615# if HAVE_RAW_DECL_STRERROR_R
1348_GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - " 1616_GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - "
1349 "use gnulib module strerror_r-posix for portability"); 1617 "use gnulib module strerror_r-posix for portability");
1350# endif 1618# endif
1351#endif 1619#endif
1352 1620
1621/* Map any int, typically from errno, into an error message.
1622 With locale_t argument. */
1623#if @GNULIB_STRERROR_L@
1624# if @REPLACE_STRERROR_L@
1625# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1626# undef strerror_l
1627# define strerror_l rpl_strerror_l
1628# endif
1629_GL_FUNCDECL_RPL (strerror_l, char *, (int errnum, locale_t locale),
1630 _GL_ARG_NONNULL ((2)));
1631_GL_CXXALIAS_RPL (strerror_l, char *, (int errnum, locale_t locale));
1632# else
1633# if !@HAVE_STRERROR_L@
1634_GL_FUNCDECL_SYS (strerror_l, char *, (int errnum, locale_t locale),
1635 _GL_ARG_NONNULL ((2)));
1636# endif
1637_GL_CXXALIAS_SYS (strerror_l, char *, (int errnum, locale_t locale));
1638# endif
1639# if __GLIBC__ >= 2
1640_GL_CXXALIASWARN (strerror_l);
1641# endif
1642#elif defined GNULIB_POSIXCHECK
1643# if HAVE_RAW_DECL_STRERROR_L
1644_GL_WARN_ON_USE (strerror_l, "strerror_l is unportable - "
1645 "use gnulib module strerror_l for portability");
1646# endif
1647#endif
1648
1649/* Map any int, typically from errno, into an error message. Multithread-safe,
1650 with locale_t argument.
1651 Not portable! Only provided by gnulib. */
1652#if @GNULIB_STRERROR_L@
1653_GL_FUNCDECL_SYS (strerror_l_r, int,
1654 (int errnum, char *buf, size_t buflen, locale_t locale),
1655 _GL_ARG_NONNULL ((2, 4)));
1656#endif
1657
1353/* Return the name of the system error code ERRNUM. */ 1658/* Return the name of the system error code ERRNUM. */
1354#if @GNULIB_STRERRORNAME_NP@ 1659#if @GNULIB_STRERRORNAME_NP@
1355# if @REPLACE_STRERRORNAME_NP@ 1660# if @REPLACE_STRERRORNAME_NP@
@@ -1357,17 +1662,18 @@ _GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - "
1357# undef strerrorname_np 1662# undef strerrorname_np
1358# define strerrorname_np rpl_strerrorname_np 1663# define strerrorname_np rpl_strerrorname_np
1359# endif 1664# endif
1360_GL_FUNCDECL_RPL (strerrorname_np, const char *, (int errnum)); 1665_GL_FUNCDECL_RPL (strerrorname_np, const char *, (int errnum), );
1361_GL_CXXALIAS_RPL (strerrorname_np, const char *, (int errnum)); 1666_GL_CXXALIAS_RPL (strerrorname_np, const char *, (int errnum));
1362# else 1667# else
1363# if !@HAVE_STRERRORNAME_NP@ 1668# if !@HAVE_STRERRORNAME_NP@
1364_GL_FUNCDECL_SYS (strerrorname_np, const char *, (int errnum)); 1669_GL_FUNCDECL_SYS (strerrorname_np, const char *, (int errnum), );
1365# endif 1670# endif
1366_GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum)); 1671_GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum));
1367# endif 1672# endif
1673# if __GLIBC__ >= 2
1368_GL_CXXALIASWARN (strerrorname_np); 1674_GL_CXXALIASWARN (strerrorname_np);
1675# endif
1369#elif defined GNULIB_POSIXCHECK 1676#elif defined GNULIB_POSIXCHECK
1370# undef strerrorname_np
1371# if HAVE_RAW_DECL_STRERRORNAME_NP 1677# if HAVE_RAW_DECL_STRERRORNAME_NP
1372_GL_WARN_ON_USE (strerrorname_np, "strerrorname_np is unportable - " 1678_GL_WARN_ON_USE (strerrorname_np, "strerrorname_np is unportable - "
1373 "use gnulib module strerrorname_np for portability"); 1679 "use gnulib module strerrorname_np for portability");
@@ -1377,12 +1683,11 @@ _GL_WARN_ON_USE (strerrorname_np, "strerrorname_np is unportable - "
1377/* Return an abbreviation string for the signal number SIG. */ 1683/* Return an abbreviation string for the signal number SIG. */
1378#if @GNULIB_SIGABBREV_NP@ 1684#if @GNULIB_SIGABBREV_NP@
1379# if ! @HAVE_SIGABBREV_NP@ 1685# if ! @HAVE_SIGABBREV_NP@
1380_GL_FUNCDECL_SYS (sigabbrev_np, const char *, (int sig)); 1686_GL_FUNCDECL_SYS (sigabbrev_np, const char *, (int sig), );
1381# endif 1687# endif
1382_GL_CXXALIAS_SYS (sigabbrev_np, const char *, (int sig)); 1688_GL_CXXALIAS_SYS (sigabbrev_np, const char *, (int sig));
1383_GL_CXXALIASWARN (sigabbrev_np); 1689_GL_CXXALIASWARN (sigabbrev_np);
1384#elif defined GNULIB_POSIXCHECK 1690#elif defined GNULIB_POSIXCHECK
1385# undef sigabbrev_np
1386# if HAVE_RAW_DECL_SIGABBREV_NP 1691# if HAVE_RAW_DECL_SIGABBREV_NP
1387_GL_WARN_ON_USE (sigabbrev_np, "sigabbrev_np is unportable - " 1692_GL_WARN_ON_USE (sigabbrev_np, "sigabbrev_np is unportable - "
1388 "use gnulib module sigabbrev_np for portability"); 1693 "use gnulib module sigabbrev_np for portability");
@@ -1392,12 +1697,11 @@ _GL_WARN_ON_USE (sigabbrev_np, "sigabbrev_np is unportable - "
1392/* Return an English description string for the signal number SIG. */ 1697/* Return an English description string for the signal number SIG. */
1393#if @GNULIB_SIGDESCR_NP@ 1698#if @GNULIB_SIGDESCR_NP@
1394# if ! @HAVE_SIGDESCR_NP@ 1699# if ! @HAVE_SIGDESCR_NP@
1395_GL_FUNCDECL_SYS (sigdescr_np, const char *, (int sig)); 1700_GL_FUNCDECL_SYS (sigdescr_np, const char *, (int sig), );
1396# endif 1701# endif
1397_GL_CXXALIAS_SYS (sigdescr_np, const char *, (int sig)); 1702_GL_CXXALIAS_SYS (sigdescr_np, const char *, (int sig));
1398_GL_CXXALIASWARN (sigdescr_np); 1703_GL_CXXALIASWARN (sigdescr_np);
1399#elif defined GNULIB_POSIXCHECK 1704#elif defined GNULIB_POSIXCHECK
1400# undef sigdescr_np
1401# if HAVE_RAW_DECL_SIGDESCR_NP 1705# if HAVE_RAW_DECL_SIGDESCR_NP
1402_GL_WARN_ON_USE (sigdescr_np, "sigdescr_np is unportable - " 1706_GL_WARN_ON_USE (sigdescr_np, "sigdescr_np is unportable - "
1403 "use gnulib module sigdescr_np for portability"); 1707 "use gnulib module sigdescr_np for portability");
@@ -1409,11 +1713,11 @@ _GL_WARN_ON_USE (sigdescr_np, "sigdescr_np is unportable - "
1409# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1713# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1410# define strsignal rpl_strsignal 1714# define strsignal rpl_strsignal
1411# endif 1715# endif
1412_GL_FUNCDECL_RPL (strsignal, char *, (int __sig)); 1716_GL_FUNCDECL_RPL (strsignal, char *, (int __sig), );
1413_GL_CXXALIAS_RPL (strsignal, char *, (int __sig)); 1717_GL_CXXALIAS_RPL (strsignal, char *, (int __sig));
1414# else 1718# else
1415# if ! @HAVE_DECL_STRSIGNAL@ 1719# if ! @HAVE_DECL_STRSIGNAL@
1416_GL_FUNCDECL_SYS (strsignal, char *, (int __sig)); 1720_GL_FUNCDECL_SYS (strsignal, char *, (int __sig), );
1417# endif 1721# endif
1418/* Need to cast, because on Cygwin 1.5.x systems, the return type is 1722/* Need to cast, because on Cygwin 1.5.x systems, the return type is
1419 'const char *'. */ 1723 'const char *'. */
@@ -1421,7 +1725,6 @@ _GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig));
1421# endif 1725# endif
1422_GL_CXXALIASWARN (strsignal); 1726_GL_CXXALIASWARN (strsignal);
1423#elif defined GNULIB_POSIXCHECK 1727#elif defined GNULIB_POSIXCHECK
1424# undef strsignal
1425# if HAVE_RAW_DECL_STRSIGNAL 1728# if HAVE_RAW_DECL_STRSIGNAL
1426_GL_WARN_ON_USE (strsignal, "strsignal is unportable - " 1729_GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
1427 "use gnulib module strsignal for portability"); 1730 "use gnulib module strsignal for portability");
@@ -1433,13 +1736,13 @@ _GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
1433# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1736# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1434# define strverscmp rpl_strverscmp 1737# define strverscmp rpl_strverscmp
1435# endif 1738# endif
1436_GL_FUNCDECL_RPL (strverscmp, int, (const char *, const char *) 1739_GL_FUNCDECL_RPL (strverscmp, int, (const char *, const char *),
1437 _GL_ATTRIBUTE_PURE 1740 _GL_ATTRIBUTE_PURE
1438 _GL_ARG_NONNULL ((1, 2))); 1741 _GL_ARG_NONNULL ((1, 2)));
1439_GL_CXXALIAS_RPL (strverscmp, int, (const char *, const char *)); 1742_GL_CXXALIAS_RPL (strverscmp, int, (const char *, const char *));
1440# else 1743# else
1441# if !@HAVE_STRVERSCMP@ 1744# if !@HAVE_STRVERSCMP@
1442_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *) 1745_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *),
1443 _GL_ATTRIBUTE_PURE 1746 _GL_ATTRIBUTE_PURE
1444 _GL_ARG_NONNULL ((1, 2))); 1747 _GL_ARG_NONNULL ((1, 2)));
1445# endif 1748# endif
@@ -1447,13 +1750,13 @@ _GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *));
1447# endif 1750# endif
1448_GL_CXXALIASWARN (strverscmp); 1751_GL_CXXALIASWARN (strverscmp);
1449#elif defined GNULIB_POSIXCHECK 1752#elif defined GNULIB_POSIXCHECK
1450# undef strverscmp
1451# if HAVE_RAW_DECL_STRVERSCMP 1753# if HAVE_RAW_DECL_STRVERSCMP
1452_GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - " 1754_GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
1453 "use gnulib module strverscmp for portability"); 1755 "use gnulib module strverscmp for portability");
1454# endif 1756# endif
1455#endif 1757#endif
1456 1758
1759_GL_INLINE_HEADER_END
1457 1760
1458#endif /* _@GUARD_PREFIX@_STRING_H */ 1761#endif /* _@GUARD_PREFIX@_STRING_H */
1459#endif /* _@GUARD_PREFIX@_STRING_H */ 1762#endif /* _@GUARD_PREFIX@_STRING_H */
diff --git a/gl/strings.in.h b/gl/strings.in.h
index 2b3e062a..fd7cd2df 100644
--- a/gl/strings.in.h
+++ b/gl/strings.in.h
@@ -1,6 +1,6 @@
1/* A substitute <strings.h>. 1/* A substitute <strings.h>.
2 2
3 Copyright (C) 2007-2024 Free Software Foundation, Inc. 3 Copyright (C) 2007-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -36,7 +36,7 @@
36#ifndef _@GUARD_PREFIX@_STRINGS_H 36#ifndef _@GUARD_PREFIX@_STRINGS_H
37#define _@GUARD_PREFIX@_STRINGS_H 37#define _@GUARD_PREFIX@_STRINGS_H
38 38
39/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ 39/* This file uses _GL_ARG_NONNULL, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
40#if !_GL_CONFIG_H_INCLUDED 40#if !_GL_CONFIG_H_INCLUDED
41 #error "Please include config.h first." 41 #error "Please include config.h first."
42#endif 42#endif
@@ -46,6 +46,16 @@
46# include <stddef.h> 46# include <stddef.h>
47#endif 47#endif
48 48
49#if @GNULIB_STRCASECMP_L@ || @GNULIB_STRNCASECMP_L@
50/* Get locale_t. */
51# include <locale.h>
52# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ < 10) \
53 || (defined __APPLE__ && defined __MACH__))
54/* Get the declaration of strcasecmp_l. */
55# include <string.h>
56# endif
57#endif
58
49 59
50/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 60/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
51 61
@@ -58,66 +68,161 @@ extern "C" {
58#endif 68#endif
59 69
60 70
61 /* Find the index of the least-significant set bit. */
62#if @GNULIB_FFS@ 71#if @GNULIB_FFS@
72/* Find the index of the least-significant set bit. */
63# if !@HAVE_FFS@ 73# if !@HAVE_FFS@
64_GL_FUNCDECL_SYS (ffs, int, (int i)); 74_GL_FUNCDECL_SYS (ffs, int, (int i), );
65# endif 75# endif
66_GL_CXXALIAS_SYS (ffs, int, (int i)); 76_GL_CXXALIAS_SYS (ffs, int, (int i));
67_GL_CXXALIASWARN (ffs); 77_GL_CXXALIASWARN (ffs);
68#elif defined GNULIB_POSIXCHECK 78#elif defined GNULIB_POSIXCHECK
69# undef ffs
70# if HAVE_RAW_DECL_FFS 79# if HAVE_RAW_DECL_FFS
71_GL_WARN_ON_USE (ffs, "ffs is not portable - use the ffs module"); 80_GL_WARN_ON_USE (ffs, "ffs is not portable - use the ffs module");
72# endif 81# endif
73#endif 82#endif
74 83
84#if @GNULIB_STRCASECMP@
75/* Compare strings S1 and S2, ignoring case, returning less than, equal to or 85/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
76 greater than zero if S1 is lexicographically less than, equal to or greater 86 greater than zero if S1 is lexicographically less than, equal to or greater
77 than S2. 87 than S2.
78 Note: This function does not work in multibyte locales. */ 88 Note: This function does not work in multibyte locales. */
79#if ! @HAVE_STRCASECMP@ 89# if @REPLACE_STRCASECMP@
80extern int strcasecmp (char const *s1, char const *s2) 90# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
81 _GL_ARG_NONNULL ((1, 2)); 91# undef strcasecmp
82#endif 92# define strcasecmp rpl_strcasecmp
83#if defined GNULIB_POSIXCHECK 93# endif
94_GL_FUNCDECL_RPL (strcasecmp, int, (const char *, const char *),
95 _GL_ARG_NONNULL ((1, 2)));
96_GL_CXXALIAS_RPL (strcasecmp, int, (const char *, const char *));
97# else
98# if !@HAVE_STRCASECMP@
99_GL_FUNCDECL_SYS (strcasecmp, int, (const char *, const char *),
100 _GL_ARG_NONNULL ((1, 2)));
101# endif
102_GL_CXXALIAS_SYS (strcasecmp, int, (const char *, const char *));
103# endif
104# if __GLIBC__ >= 2
105_GL_CXXALIASWARN (strcasecmp);
106# endif
107#elif defined GNULIB_POSIXCHECK
84/* strcasecmp() does not work with multibyte strings: 108/* strcasecmp() does not work with multibyte strings:
85 POSIX says that it operates on "strings", and "string" in POSIX is defined 109 POSIX says that it operates on "strings", and "string" in POSIX is defined
86 as a sequence of bytes, not of characters. */ 110 as a sequence of bytes, not of characters. */
87# undef strcasecmp
88# if HAVE_RAW_DECL_STRCASECMP 111# if HAVE_RAW_DECL_STRCASECMP
89_GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character " 112_GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character "
90 "strings in multibyte locales - " 113 "strings in multibyte locales and is unportable - "
91 "use mbscasecmp if you care about " 114 "use mbscasecmp if you care about "
92 "internationalization, or use c_strcasecmp , " 115 "internationalization, or use c_strcasecmp "
93 "gnulib module c-strcase) if you want a locale " 116 "(gnulib module c-strcasecmp) if you want a locale "
94 "independent function"); 117 "independent function");
95# endif 118# endif
96#endif 119#endif
97 120
121#if @GNULIB_STRCASECMP_L@
122# if @REPLACE_STRCASECMP_L@
123# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
124# undef strcasecmp_l
125# define strcasecmp_l rpl_strcasecmp_l
126# endif
127_GL_FUNCDECL_RPL (strcasecmp_l, int,
128 (const char *s1, const char *s2, locale_t locale),
129 _GL_ARG_NONNULL ((1, 2, 3)));
130_GL_CXXALIAS_RPL (strcasecmp_l, int,
131 (const char *s1, const char *s2, locale_t locale));
132# else
133# if !@HAVE_STRCASECMP_L@
134_GL_FUNCDECL_SYS (strcasecmp_l, int,
135 (const char *s1, const char *s2, locale_t locale),
136 _GL_ARG_NONNULL ((1, 2, 3)));
137# endif
138_GL_CXXALIAS_SYS (strcasecmp_l, int,
139 (const char *s1, const char *s2, locale_t locale));
140# endif
141# if __GLIBC__ >= 2
142_GL_CXXALIASWARN (strcasecmp_l);
143# endif
144#elif defined GNULIB_POSIXCHECK
145/* strcasecmp_l() does not work with multibyte strings:
146 POSIX says that it operates on "strings", and "string" in POSIX is defined
147 as a sequence of bytes, not of characters. */
148# if HAVE_RAW_DECL_STRCASECMP_L
149_GL_WARN_ON_USE (strcasecmp_l, "strcasecmp_l cannot work correctly on "
150 "character strings in multibyte locales and is unportable - "
151 "use gnulib module strcasecmp_l for portability");
152# endif
153#endif
154
155#if @GNULIB_STRNCASECMP@
98/* Compare no more than N bytes of strings S1 and S2, ignoring case, 156/* Compare no more than N bytes of strings S1 and S2, ignoring case,
99 returning less than, equal to or greater than zero if S1 is 157 returning less than, equal to or greater than zero if S1 is
100 lexicographically less than, equal to or greater than S2. 158 lexicographically less than, equal to or greater than S2.
101 Note: This function cannot work correctly in multibyte locales. */ 159 Note: This function cannot work correctly in multibyte locales. */
102#if ! @HAVE_DECL_STRNCASECMP@ 160# if @REPLACE_STRNCASECMP@
103extern int strncasecmp (char const *s1, char const *s2, size_t n) 161# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
104 _GL_ARG_NONNULL ((1, 2)); 162# undef strncasecmp
105#endif 163# define strncasecmp rpl_strncasecmp
106#if defined GNULIB_POSIXCHECK 164# endif
165_GL_FUNCDECL_RPL (strncasecmp, int, (const char *, const char *, size_t),
166 _GL_ARG_NONNULL ((1, 2)));
167_GL_CXXALIAS_RPL (strncasecmp, int, (const char *, const char *, size_t));
168# else
169# if !@HAVE_DECL_STRNCASECMP@
170_GL_FUNCDECL_SYS (strncasecmp, int, (const char *, const char *, size_t),
171 _GL_ARG_NONNULL ((1, 2)));
172# endif
173_GL_CXXALIAS_SYS (strncasecmp, int, (const char *, const char *, size_t));
174# endif
175# if __GLIBC__ >= 2
176_GL_CXXALIASWARN (strncasecmp);
177# endif
178#elif defined GNULIB_POSIXCHECK
107/* strncasecmp() does not work with multibyte strings: 179/* strncasecmp() does not work with multibyte strings:
108 POSIX says that it operates on "strings", and "string" in POSIX is defined 180 POSIX says that it operates on "strings", and "string" in POSIX is defined
109 as a sequence of bytes, not of characters. */ 181 as a sequence of bytes, not of characters. */
110# undef strncasecmp
111# if HAVE_RAW_DECL_STRNCASECMP 182# if HAVE_RAW_DECL_STRNCASECMP
112_GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character " 183_GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character "
113 "strings in multibyte locales - " 184 "strings in multibyte locales and is unportable - "
114 "use mbsncasecmp or mbspcasecmp if you care about " 185 "use mbsncasecmp or mbspcasecmp if you care about "
115 "internationalization, or use c_strncasecmp , " 186 "internationalization, or use c_strncasecmp "
116 "gnulib module c-strcase) if you want a locale " 187 "(gnulib module c-strncasecmp) if you want a locale "
117 "independent function"); 188 "independent function");
118# endif 189# endif
119#endif 190#endif
120 191
192#if @GNULIB_STRNCASECMP_L@
193# if @REPLACE_STRNCASECMP_L@
194# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
195# undef strncasecmp_l
196# define strncasecmp_l rpl_strncasecmp_l
197# endif
198_GL_FUNCDECL_RPL (strncasecmp_l, int,
199 (const char *s1, const char *s2, size_t n, locale_t locale),
200 _GL_ARG_NONNULL ((1, 2, 4)));
201_GL_CXXALIAS_RPL (strncasecmp_l, int,
202 (const char *s1, const char *s2, size_t n, locale_t locale));
203# else
204# if !@HAVE_STRNCASECMP_L@
205_GL_FUNCDECL_SYS (strncasecmp_l, int,
206 (const char *s1, const char *s2, size_t n, locale_t locale),
207 _GL_ARG_NONNULL ((1, 2, 4)));
208# endif
209_GL_CXXALIAS_SYS (strncasecmp_l, int,
210 (const char *s1, const char *s2, size_t n, locale_t locale));
211# endif
212# if __GLIBC__ >= 2
213_GL_CXXALIASWARN (strncasecmp_l);
214# endif
215#elif defined GNULIB_POSIXCHECK
216/* strncasecmp_l() does not work with multibyte strings:
217 POSIX says that it operates on "strings", and "string" in POSIX is defined
218 as a sequence of bytes, not of characters. */
219# if HAVE_RAW_DECL_STRNCASECMP_L
220_GL_WARN_ON_USE (strncasecmp_l, "strncasecmp_l cannot work correctly on "
221 "character strings in multibyte locales and is unportable - "
222 "use gnulib module strncasecmp_l for portability");
223# endif
224#endif
225
121 226
122#ifdef __cplusplus 227#ifdef __cplusplus
123} 228}
diff --git a/gl/stripslash.c b/gl/stripslash.c
index c127ce7e..8f8c38e3 100644
--- a/gl/stripslash.c
+++ b/gl/stripslash.c
@@ -1,6 +1,6 @@
1/* stripslash.c -- remove redundant trailing slashes from a file name 1/* stripslash.c -- remove redundant trailing slashes from a file name
2 2
3 Copyright (C) 1990, 2001, 2003-2006, 2009-2024 Free Software Foundation, 3 Copyright (C) 1990, 2001, 2003-2006, 2009-2026 Free Software Foundation,
4 Inc. 4 Inc.
5 5
6 This file is free software: you can redistribute it and/or modify 6 This file is free software: you can redistribute it and/or modify
@@ -31,15 +31,13 @@ bool
31strip_trailing_slashes (char *file) 31strip_trailing_slashes (char *file)
32{ 32{
33 char *base = last_component (file); 33 char *base = last_component (file);
34 char *base_lim;
35 bool had_slash;
36 34
37 /* last_component returns "" for file system roots, but we need to turn 35 /* last_component returns "" for file system roots, but we need to turn
38 "///" into "/". */ 36 "///" into "/". */
39 if (! *base) 37 if (! *base)
40 base = file; 38 base = file;
41 base_lim = base + base_len (base); 39 char *base_lim = base + base_len (base);
42 had_slash = (*base_lim != '\0'); 40 bool had_slash = (*base_lim != '\0');
43 *base_lim = '\0'; 41 *base_lim = '\0';
44 return had_slash; 42 return had_slash;
45} 43}
diff --git a/gl/strncasecmp.c b/gl/strncasecmp.c
index c79161f3..c6bec00d 100644
--- a/gl/strncasecmp.c
+++ b/gl/strncasecmp.c
@@ -1,5 +1,5 @@
1/* strncasecmp.c -- case insensitive string comparator 1/* Case-insensitive string comparison function for unibyte locales.
2 Copyright (C) 1998-1999, 2005-2007, 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 1998-1999, 2005-2007, 2009-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -17,7 +17,7 @@
17#include <config.h> 17#include <config.h>
18 18
19/* Specification. */ 19/* Specification. */
20#include <string.h> 20#include <strings.h>
21 21
22#include <ctype.h> 22#include <ctype.h>
23#include <limits.h> 23#include <limits.h>
@@ -32,29 +32,24 @@ strncasecmp (const char *s1, const char *s2, size_t n)
32{ 32{
33 register const unsigned char *p1 = (const unsigned char *) s1; 33 register const unsigned char *p1 = (const unsigned char *) s1;
34 register const unsigned char *p2 = (const unsigned char *) s2; 34 register const unsigned char *p2 = (const unsigned char *) s2;
35 unsigned char c1, c2;
36 35
37 if (p1 == p2 || n == 0) 36 if (p1 == p2 || n == 0)
38 return 0; 37 return 0;
39 38
40 do 39 for (;; p1++, p2++)
41 { 40 {
42 c1 = tolower (*p1); 41 unsigned char c1 = tolower (*p1);
43 c2 = tolower (*p2); 42 unsigned char c2 = tolower (*p2);
44 43
45 if (--n == 0 || c1 == '\0') 44 if (--n == 0 || c1 == '\0' || c1 != c2)
46 break; 45 {
47 46 if (UCHAR_MAX <= INT_MAX)
48 ++p1; 47 return c1 - c2;
49 ++p2; 48 else
49 /* On machines where 'char' and 'int' are types of the same size,
50 the difference of two 'unsigned char' values - including the
51 sign bit - doesn't fit in an 'int'. */
52 return _GL_CMP (c1, c2);
53 }
50 } 54 }
51 while (c1 == c2);
52
53 if (UCHAR_MAX <= INT_MAX)
54 return c1 - c2;
55 else
56 /* On machines where 'char' and 'int' are types of the same size, the
57 difference of two 'unsigned char' values - including the sign bit -
58 doesn't fit in an 'int'. */
59 return _GL_CMP (c1, c2);
60} 55}
diff --git a/gl/strncpy.c b/gl/strncpy.c
new file mode 100644
index 00000000..25908377
--- /dev/null
+++ b/gl/strncpy.c
@@ -0,0 +1,38 @@
1/* Copy a size-bounded string.
2 Copyright (C) 1999, 2011-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17/* Written by Bruno Haible <bruno@clisp.org>, 1999. */
18
19#include <config.h>
20
21/* Specification. */
22#include <string.h>
23
24char *
25strncpy (char *dest, const char *src, size_t n)
26{
27 char *destptr = dest;
28
29 for (; n > 0 && (*destptr = *src) != '\0'; src++, destptr++, n--)
30 ;
31
32 /* This behavior is rarely useful, but it is specified by the ISO C
33 standard. */
34 for (; n > 0; n--)
35 *destptr++ = '\0';
36
37 return dest;
38}
diff --git a/gl/strsep.c b/gl/strsep.c
index eefd85e2..6338c62d 100644
--- a/gl/strsep.c
+++ b/gl/strsep.c
@@ -1,4 +1,4 @@
1/* Copyright (C) 2004, 2007, 2009-2024 Free Software Foundation, Inc. 1/* Copyright (C) 2004, 2007, 2009-2026 Free Software Foundation, Inc.
2 2
3 Written by Yoann Vandoorselaere <yoann@prelude-ids.org>. 3 Written by Yoann Vandoorselaere <yoann@prelude-ids.org>.
4 4
@@ -26,7 +26,6 @@ char *
26strsep (char **stringp, const char *delim) 26strsep (char **stringp, const char *delim)
27{ 27{
28 char *start = *stringp; 28 char *start = *stringp;
29 char *ptr;
30 29
31 if (start == NULL) 30 if (start == NULL)
32 return NULL; 31 return NULL;
@@ -38,12 +37,14 @@ strsep (char **stringp, const char *delim)
38 return start; 37 return start;
39 } 38 }
40 39
40 char *ptr;
41 /* Optimize the case of one delimiter. */ 41 /* Optimize the case of one delimiter. */
42 if (delim[1] == '\0') 42 if (delim[1] == '\0')
43 ptr = strchr (start, delim[0]); 43 ptr = strchr (start, delim[0]);
44 else 44 else
45 /* The general case. */ 45 /* The general case. */
46 ptr = strpbrk (start, delim); 46 ptr = strpbrk (start, delim);
47
47 if (ptr == NULL) 48 if (ptr == NULL)
48 { 49 {
49 *stringp = NULL; 50 *stringp = NULL;
diff --git a/gl/strstr.c b/gl/strstr.c
index 7ea28603..a5730a37 100644
--- a/gl/strstr.c
+++ b/gl/strstr.c
@@ -1,4 +1,4 @@
1/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2024 Free Software 1/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2026 Free Software
2 Foundation, Inc. 2 Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 4
@@ -36,31 +36,33 @@
36char * 36char *
37strstr (const char *haystack_start, const char *needle_start) 37strstr (const char *haystack_start, const char *needle_start)
38{ 38{
39 const char *haystack = haystack_start;
40 const char *needle = needle_start; 39 const char *needle = needle_start;
41 size_t needle_len; /* Length of NEEDLE. */
42 size_t haystack_len; /* Known minimum length of HAYSTACK. */
43 bool ok = true; /* True if NEEDLE is prefix of HAYSTACK. */
44 40
45 /* Determine length of NEEDLE, and in the process, make sure 41 /* Determine length of NEEDLE, and in the process, make sure
46 HAYSTACK is at least as long (no point processing all of a long 42 HAYSTACK is at least as long (no point processing all of a long
47 NEEDLE if HAYSTACK is too short). */ 43 NEEDLE if HAYSTACK is too short). */
48 while (*haystack && *needle) 44 {
49 ok &= *haystack++ == *needle++; 45 const char *haystack = haystack_start;
50 if (*needle) 46 bool ok = true; /* True if NEEDLE is prefix of HAYSTACK. */
51 return NULL; 47 while (*haystack && *needle)
52 if (ok) 48 ok &= *haystack++ == *needle++;
53 return (char *) haystack_start; 49 if (*needle)
50 return NULL;
51 if (ok)
52 return (char *) haystack_start;
53 }
54 54
55 /* Reduce the size of haystack using strchr, since it has a smaller 55 /* Reduce the size of haystack using strchr, since it has a smaller
56 linear coefficient than the Two-Way algorithm. */ 56 linear coefficient than the Two-Way algorithm. */
57 needle_len = needle - needle_start; 57 size_t needle_len = /* Length of NEEDLE. */
58 haystack = strchr (haystack_start + 1, *needle_start); 58 needle - needle_start;
59 const char *haystack = strchr (haystack_start + 1, *needle_start);
59 if (!haystack || __builtin_expect (needle_len == 1, 0)) 60 if (!haystack || __builtin_expect (needle_len == 1, 0))
60 return (char *) haystack; 61 return (char *) haystack;
61 needle -= needle_len; 62 needle -= needle_len;
62 haystack_len = (haystack > haystack_start + needle_len ? 1 63 size_t haystack_len = /* Known minimum length of HAYSTACK. */
63 : needle_len + haystack_start - haystack); 64 (haystack > haystack_start + needle_len ? 1
65 : needle_len + haystack_start - haystack);
64 66
65 /* Perform the search. Abstract memory is considered to be an array 67 /* Perform the search. Abstract memory is considered to be an array
66 of 'unsigned char' values, not an array of 'char' values. See 68 of 'unsigned char' values, not an array of 'char' values. See
diff --git a/gl/sys-limits.h b/gl/sys-limits.h
index d2f29d80..d61ebdf7 100644
--- a/gl/sys-limits.h
+++ b/gl/sys-limits.h
@@ -1,6 +1,6 @@
1/* System call limits 1/* System call limits
2 2
3 Copyright 2018-2024 Free Software Foundation, Inc. 3 Copyright 2018-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -30,10 +30,6 @@
30 Using this also works around a serious Linux bug before 2.6.16; see 30 Using this also works around a serious Linux bug before 2.6.16; see
31 <https://bugzilla.redhat.com/show_bug.cgi?id=612839>. 31 <https://bugzilla.redhat.com/show_bug.cgi?id=612839>.
32 32
33 Using this also works around a Tru64 5.1 bug, where attempting
34 to read INT_MAX bytes fails with errno == EINVAL. See
35 <https://lists.gnu.org/r/bug-gnu-utils/2002-04/msg00010.html>.
36
37 Using this is likely to work around similar bugs in other operating 33 Using this is likely to work around similar bugs in other operating
38 systems. */ 34 systems. */
39 35
diff --git a/gl/sys_socket.c b/gl/sys_socket.c
index 672d3aac..023a7c55 100644
--- a/gl/sys_socket.c
+++ b/gl/sys_socket.c
@@ -1,6 +1,6 @@
1/* Inline functions for <sys/socket.h>. 1/* Inline functions for <sys/socket.h>.
2 2
3 Copyright (C) 2012-2024 Free Software Foundation, Inc. 3 Copyright (C) 2012-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -15,8 +15,8 @@
15 You should have received a copy of the GNU Lesser General Public License 15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 17
18#define _GL_SYS_SOCKET_INLINE _GL_EXTERN_INLINE
18#include <config.h> 19#include <config.h>
19 20
20#define _GL_SYS_SOCKET_INLINE _GL_EXTERN_INLINE
21#include <sys/socket.h> 21#include <sys/socket.h>
22typedef int dummy; 22typedef int dummy;
diff --git a/gl/sys_socket.in.h b/gl/sys_socket.in.h
index 13833c0f..c19b7461 100644
--- a/gl/sys_socket.in.h
+++ b/gl/sys_socket.in.h
@@ -1,6 +1,6 @@
1/* Provide a sys/socket header file for systems lacking it (read: MinGW) 1/* Provide a sys/socket header file for systems lacking it (read: MinGW)
2 and for systems where it is incomplete. 2 and for systems where it is incomplete.
3 Copyright (C) 2005-2024 Free Software Foundation, Inc. 3 Copyright (C) 2005-2026 Free Software Foundation, Inc.
4 Written by Simon Josefsson. 4 Written by Simon Josefsson.
5 5
6 This file is free software: you can redistribute it and/or modify 6 This file is free software: you can redistribute it and/or modify
@@ -27,7 +27,7 @@
27#endif 27#endif
28@PRAGMA_COLUMNS@ 28@PRAGMA_COLUMNS@
29 29
30#if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H 30#if defined _@GUARD_PREFIX@_ALREADY_INCLUDING_SYS_SOCKET_H
31/* Special invocation convention: 31/* Special invocation convention:
32 - On Cygwin 1.5.x we have a sequence of nested includes 32 - On Cygwin 1.5.x we have a sequence of nested includes
33 <sys/socket.h> -> <cygwin/socket.h> -> <asm/socket.h> -> <cygwin/if.h>, 33 <sys/socket.h> -> <cygwin/socket.h> -> <asm/socket.h> -> <cygwin/if.h>,
@@ -43,7 +43,7 @@
43 43
44#if @HAVE_SYS_SOCKET_H@ 44#if @HAVE_SYS_SOCKET_H@
45 45
46# define _GL_ALREADY_INCLUDING_SYS_SOCKET_H 46# define _@GUARD_PREFIX@_ALREADY_INCLUDING_SYS_SOCKET_H
47 47
48/* On many platforms, <sys/socket.h> assumes prior inclusion of 48/* On many platforms, <sys/socket.h> assumes prior inclusion of
49 <sys/types.h>. */ 49 <sys/types.h>. */
@@ -56,7 +56,7 @@
56/* The include_next requires a split double-inclusion guard. */ 56/* The include_next requires a split double-inclusion guard. */
57# @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@ 57# @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
58 58
59# undef _GL_ALREADY_INCLUDING_SYS_SOCKET_H 59# undef _@GUARD_PREFIX@_ALREADY_INCLUDING_SYS_SOCKET_H
60 60
61#endif 61#endif
62 62
@@ -202,6 +202,7 @@ struct sockaddr_storage
202 202
203/* Rudimentary 'struct msghdr'; this works as long as you don't try to 203/* Rudimentary 'struct msghdr'; this works as long as you don't try to
204 access msg_control or msg_controllen. */ 204 access msg_control or msg_controllen. */
205# if !defined GNULIB_defined_struct_msghdr
205struct msghdr { 206struct msghdr {
206 void *msg_name; 207 void *msg_name;
207 socklen_t msg_namelen; 208 socklen_t msg_namelen;
@@ -209,6 +210,8 @@ struct msghdr {
209 int msg_iovlen; 210 int msg_iovlen;
210 int msg_flags; 211 int msg_flags;
211}; 212};
213# define GNULIB_defined_struct_msghdr 1
214# endif
212 215
213#endif 216#endif
214 217
@@ -232,11 +235,10 @@ struct msghdr {
232_GL_SYS_SOCKET_INLINE int 235_GL_SYS_SOCKET_INLINE int
233rpl_fd_isset (SOCKET fd, fd_set * set) 236rpl_fd_isset (SOCKET fd, fd_set * set)
234{ 237{
235 u_int i;
236 if (set == NULL) 238 if (set == NULL)
237 return 0; 239 return 0;
238 240
239 for (i = 0; i < set->fd_count; i++) 241 for (u_int i = 0; i < set->fd_count; i++)
240 if (set->fd_array[i] == fd) 242 if (set->fd_array[i] == fd)
241 return 1; 243 return 1;
242 244
@@ -289,17 +291,18 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
289# undef socket 291# undef socket
290# define socket rpl_socket 292# define socket rpl_socket
291# endif 293# endif
292_GL_FUNCDECL_RPL (socket, int, (int domain, int type, int protocol)); 294_GL_FUNCDECL_RPL (socket, int, (int domain, int type, int protocol), );
293_GL_CXXALIAS_RPL (socket, int, (int domain, int type, int protocol)); 295_GL_CXXALIAS_RPL (socket, int, (int domain, int type, int protocol));
294# else 296# else
295_GL_CXXALIAS_SYS (socket, int, (int domain, int type, int protocol)); 297_GL_CXXALIAS_SYS (socket, int, (int domain, int type, int protocol));
296# endif 298# endif
297_GL_CXXALIASWARN (socket); 299_GL_CXXALIASWARN (socket);
298#elif @HAVE_WINSOCK2_H@ 300#elif @HAVE_WINSOCK2_H@
299# undef socket 301# if !GNULIB_SOCKET
300# define socket socket_used_without_requesting_gnulib_module_socket 302# undef socket
303# define socket socket_used_without_requesting_gnulib_module_socket
304# endif
301#elif defined GNULIB_POSIXCHECK 305#elif defined GNULIB_POSIXCHECK
302# undef socket
303# if HAVE_RAW_DECL_SOCKET 306# if HAVE_RAW_DECL_SOCKET
304_GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - " 307_GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - "
305 "use gnulib module socket for portability"); 308 "use gnulib module socket for portability");
@@ -313,7 +316,7 @@ _GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - "
313# define connect rpl_connect 316# define connect rpl_connect
314# endif 317# endif
315_GL_FUNCDECL_RPL (connect, int, 318_GL_FUNCDECL_RPL (connect, int,
316 (int fd, const struct sockaddr *addr, socklen_t addrlen) 319 (int fd, const struct sockaddr *addr, socklen_t addrlen),
317 _GL_ARG_NONNULL ((2))); 320 _GL_ARG_NONNULL ((2)));
318_GL_CXXALIAS_RPL (connect, int, 321_GL_CXXALIAS_RPL (connect, int,
319 (int fd, const struct sockaddr *addr, socklen_t addrlen)); 322 (int fd, const struct sockaddr *addr, socklen_t addrlen));
@@ -326,10 +329,11 @@ _GL_CXXALIAS_SYS_CAST (connect, int,
326# endif 329# endif
327_GL_CXXALIASWARN (connect); 330_GL_CXXALIASWARN (connect);
328#elif @HAVE_WINSOCK2_H@ 331#elif @HAVE_WINSOCK2_H@
329# undef connect 332# if !GNULIB_CONNECT
330# define connect socket_used_without_requesting_gnulib_module_connect 333# undef connect
334# define connect connect_used_without_requesting_gnulib_module_connect
335# endif
331#elif defined GNULIB_POSIXCHECK 336#elif defined GNULIB_POSIXCHECK
332# undef connect
333# if HAVE_RAW_DECL_CONNECT 337# if HAVE_RAW_DECL_CONNECT
334_GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - " 338_GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - "
335 "use gnulib module connect for portability"); 339 "use gnulib module connect for portability");
@@ -345,7 +349,7 @@ _GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - "
345_GL_FUNCDECL_RPL (accept, int, 349_GL_FUNCDECL_RPL (accept, int,
346 (int fd, 350 (int fd,
347 struct sockaddr *restrict addr, 351 struct sockaddr *restrict addr,
348 socklen_t *restrict addrlen)); 352 socklen_t *restrict addrlen), );
349_GL_CXXALIAS_RPL (accept, int, 353_GL_CXXALIAS_RPL (accept, int,
350 (int fd, 354 (int fd,
351 struct sockaddr *restrict addr, 355 struct sockaddr *restrict addr,
@@ -362,10 +366,11 @@ _GL_CXXALIAS_SYS_CAST (accept, int,
362_GL_CXXALIASWARN (accept); 366_GL_CXXALIASWARN (accept);
363# endif 367# endif
364#elif @HAVE_WINSOCK2_H@ 368#elif @HAVE_WINSOCK2_H@
365# undef accept 369# if !GNULIB_ACCEPT
366# define accept accept_used_without_requesting_gnulib_module_accept 370# undef accept
371# define accept accept_used_without_requesting_gnulib_module_accept
372# endif
367#elif defined GNULIB_POSIXCHECK 373#elif defined GNULIB_POSIXCHECK
368# undef accept
369# if HAVE_RAW_DECL_ACCEPT 374# if HAVE_RAW_DECL_ACCEPT
370_GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - " 375_GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - "
371 "use gnulib module accept for portability"); 376 "use gnulib module accept for portability");
@@ -379,7 +384,7 @@ _GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - "
379# define bind rpl_bind 384# define bind rpl_bind
380# endif 385# endif
381_GL_FUNCDECL_RPL (bind, int, 386_GL_FUNCDECL_RPL (bind, int,
382 (int fd, const struct sockaddr *addr, socklen_t addrlen) 387 (int fd, const struct sockaddr *addr, socklen_t addrlen),
383 _GL_ARG_NONNULL ((2))); 388 _GL_ARG_NONNULL ((2)));
384_GL_CXXALIAS_RPL (bind, int, 389_GL_CXXALIAS_RPL (bind, int,
385 (int fd, const struct sockaddr *addr, socklen_t addrlen)); 390 (int fd, const struct sockaddr *addr, socklen_t addrlen));
@@ -392,10 +397,11 @@ _GL_CXXALIAS_SYS_CAST (bind, int,
392# endif 397# endif
393_GL_CXXALIASWARN (bind); 398_GL_CXXALIASWARN (bind);
394#elif @HAVE_WINSOCK2_H@ 399#elif @HAVE_WINSOCK2_H@
395# undef bind 400# if !GNULIB_BIND
396# define bind bind_used_without_requesting_gnulib_module_bind 401# undef bind
402# define bind bind_used_without_requesting_gnulib_module_bind
403# endif
397#elif defined GNULIB_POSIXCHECK 404#elif defined GNULIB_POSIXCHECK
398# undef bind
399# if HAVE_RAW_DECL_BIND 405# if HAVE_RAW_DECL_BIND
400_GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - " 406_GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - "
401 "use gnulib module bind for portability"); 407 "use gnulib module bind for portability");
@@ -410,7 +416,7 @@ _GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - "
410# endif 416# endif
411_GL_FUNCDECL_RPL (getpeername, int, 417_GL_FUNCDECL_RPL (getpeername, int,
412 (int fd, struct sockaddr *restrict addr, 418 (int fd, struct sockaddr *restrict addr,
413 socklen_t *restrict addrlen) 419 socklen_t *restrict addrlen),
414 _GL_ARG_NONNULL ((2, 3))); 420 _GL_ARG_NONNULL ((2, 3)));
415_GL_CXXALIAS_RPL (getpeername, int, 421_GL_CXXALIAS_RPL (getpeername, int,
416 (int fd, struct sockaddr *restrict addr, 422 (int fd, struct sockaddr *restrict addr,
@@ -426,10 +432,11 @@ _GL_CXXALIAS_SYS_CAST (getpeername, int,
426_GL_CXXALIASWARN (getpeername); 432_GL_CXXALIASWARN (getpeername);
427# endif 433# endif
428#elif @HAVE_WINSOCK2_H@ 434#elif @HAVE_WINSOCK2_H@
429# undef getpeername 435# if !GNULIB_GETPEERNAME
430# define getpeername getpeername_used_without_requesting_gnulib_module_getpeername 436# undef getpeername
437# define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
438# endif
431#elif defined GNULIB_POSIXCHECK 439#elif defined GNULIB_POSIXCHECK
432# undef getpeername
433# if HAVE_RAW_DECL_GETPEERNAME 440# if HAVE_RAW_DECL_GETPEERNAME
434_GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - " 441_GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - "
435 "use gnulib module getpeername for portability"); 442 "use gnulib module getpeername for portability");
@@ -444,7 +451,7 @@ _GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - "
444# endif 451# endif
445_GL_FUNCDECL_RPL (getsockname, int, 452_GL_FUNCDECL_RPL (getsockname, int,
446 (int fd, struct sockaddr *restrict addr, 453 (int fd, struct sockaddr *restrict addr,
447 socklen_t *restrict addrlen) 454 socklen_t *restrict addrlen),
448 _GL_ARG_NONNULL ((2, 3))); 455 _GL_ARG_NONNULL ((2, 3)));
449_GL_CXXALIAS_RPL (getsockname, int, 456_GL_CXXALIAS_RPL (getsockname, int,
450 (int fd, struct sockaddr *restrict addr, 457 (int fd, struct sockaddr *restrict addr,
@@ -460,10 +467,11 @@ _GL_CXXALIAS_SYS_CAST (getsockname, int,
460_GL_CXXALIASWARN (getsockname); 467_GL_CXXALIASWARN (getsockname);
461# endif 468# endif
462#elif @HAVE_WINSOCK2_H@ 469#elif @HAVE_WINSOCK2_H@
463# undef getsockname 470# if !GNULIB_GETSOCKNAME
464# define getsockname getsockname_used_without_requesting_gnulib_module_getsockname 471# undef getsockname
472# define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
473# endif
465#elif defined GNULIB_POSIXCHECK 474#elif defined GNULIB_POSIXCHECK
466# undef getsockname
467# if HAVE_RAW_DECL_GETSOCKNAME 475# if HAVE_RAW_DECL_GETSOCKNAME
468_GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - " 476_GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - "
469 "use gnulib module getsockname for portability"); 477 "use gnulib module getsockname for portability");
@@ -478,7 +486,7 @@ _GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - "
478# endif 486# endif
479_GL_FUNCDECL_RPL (getsockopt, int, 487_GL_FUNCDECL_RPL (getsockopt, int,
480 (int fd, int level, int optname, 488 (int fd, int level, int optname,
481 void *restrict optval, socklen_t *restrict optlen) 489 void *restrict optval, socklen_t *restrict optlen),
482 _GL_ARG_NONNULL ((4, 5))); 490 _GL_ARG_NONNULL ((4, 5)));
483_GL_CXXALIAS_RPL (getsockopt, int, 491_GL_CXXALIAS_RPL (getsockopt, int,
484 (int fd, int level, int optname, 492 (int fd, int level, int optname,
@@ -492,10 +500,11 @@ _GL_CXXALIAS_SYS_CAST (getsockopt, int,
492# endif 500# endif
493_GL_CXXALIASWARN (getsockopt); 501_GL_CXXALIASWARN (getsockopt);
494#elif @HAVE_WINSOCK2_H@ 502#elif @HAVE_WINSOCK2_H@
495# undef getsockopt 503# if !GNULIB_GETSOCKOPT
496# define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt 504# undef getsockopt
505# define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
506# endif
497#elif defined GNULIB_POSIXCHECK 507#elif defined GNULIB_POSIXCHECK
498# undef getsockopt
499# if HAVE_RAW_DECL_GETSOCKOPT 508# if HAVE_RAW_DECL_GETSOCKOPT
500_GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - " 509_GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - "
501 "use gnulib module getsockopt for portability"); 510 "use gnulib module getsockopt for portability");
@@ -508,17 +517,18 @@ _GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - "
508# undef listen 517# undef listen
509# define listen rpl_listen 518# define listen rpl_listen
510# endif 519# endif
511_GL_FUNCDECL_RPL (listen, int, (int fd, int backlog)); 520_GL_FUNCDECL_RPL (listen, int, (int fd, int backlog), );
512_GL_CXXALIAS_RPL (listen, int, (int fd, int backlog)); 521_GL_CXXALIAS_RPL (listen, int, (int fd, int backlog));
513# else 522# else
514_GL_CXXALIAS_SYS (listen, int, (int fd, int backlog)); 523_GL_CXXALIAS_SYS (listen, int, (int fd, int backlog));
515# endif 524# endif
516_GL_CXXALIASWARN (listen); 525_GL_CXXALIASWARN (listen);
517#elif @HAVE_WINSOCK2_H@ 526#elif @HAVE_WINSOCK2_H@
518# undef listen 527# if !GNULIB_LISTEN
519# define listen listen_used_without_requesting_gnulib_module_listen 528# undef listen
529# define listen listen_used_without_requesting_gnulib_module_listen
530# endif
520#elif defined GNULIB_POSIXCHECK 531#elif defined GNULIB_POSIXCHECK
521# undef listen
522# if HAVE_RAW_DECL_LISTEN 532# if HAVE_RAW_DECL_LISTEN
523_GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - " 533_GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - "
524 "use gnulib module listen for portability"); 534 "use gnulib module listen for portability");
@@ -531,7 +541,7 @@ _GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - "
531# undef recv 541# undef recv
532# define recv rpl_recv 542# define recv rpl_recv
533# endif 543# endif
534_GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags) 544_GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags),
535 _GL_ARG_NONNULL ((2))); 545 _GL_ARG_NONNULL ((2)));
536_GL_CXXALIAS_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags)); 546_GL_CXXALIAS_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
537# else 547# else
@@ -542,10 +552,11 @@ _GL_CXXALIAS_SYS_CAST (recv, ssize_t, (int fd, void *buf, size_t len, int flags)
542# endif 552# endif
543_GL_CXXALIASWARN (recv); 553_GL_CXXALIASWARN (recv);
544#elif @HAVE_WINSOCK2_H@ 554#elif @HAVE_WINSOCK2_H@
545# undef recv 555# if !GNULIB_RECV
546# define recv recv_used_without_requesting_gnulib_module_recv 556# undef recv
557# define recv recv_used_without_requesting_gnulib_module_recv
558# endif
547#elif defined GNULIB_POSIXCHECK 559#elif defined GNULIB_POSIXCHECK
548# undef recv
549# if HAVE_RAW_DECL_RECV 560# if HAVE_RAW_DECL_RECV
550_GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - " 561_GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - "
551 "use gnulib module recv for portability"); 562 "use gnulib module recv for portability");
@@ -559,7 +570,7 @@ _GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - "
559# define send rpl_send 570# define send rpl_send
560# endif 571# endif
561_GL_FUNCDECL_RPL (send, ssize_t, 572_GL_FUNCDECL_RPL (send, ssize_t,
562 (int fd, const void *buf, size_t len, int flags) 573 (int fd, const void *buf, size_t len, int flags),
563 _GL_ARG_NONNULL ((2))); 574 _GL_ARG_NONNULL ((2)));
564_GL_CXXALIAS_RPL (send, ssize_t, 575_GL_CXXALIAS_RPL (send, ssize_t,
565 (int fd, const void *buf, size_t len, int flags)); 576 (int fd, const void *buf, size_t len, int flags));
@@ -572,10 +583,11 @@ _GL_CXXALIAS_SYS_CAST (send, ssize_t,
572# endif 583# endif
573_GL_CXXALIASWARN (send); 584_GL_CXXALIASWARN (send);
574#elif @HAVE_WINSOCK2_H@ 585#elif @HAVE_WINSOCK2_H@
575# undef send 586# if !GNULIB_SEND
576# define send send_used_without_requesting_gnulib_module_send 587# undef send
588# define send send_used_without_requesting_gnulib_module_send
589# endif
577#elif defined GNULIB_POSIXCHECK 590#elif defined GNULIB_POSIXCHECK
578# undef send
579# if HAVE_RAW_DECL_SEND 591# if HAVE_RAW_DECL_SEND
580_GL_WARN_ON_USE (send, "send is not always POSIX compliant - " 592_GL_WARN_ON_USE (send, "send is not always POSIX compliant - "
581 "use gnulib module send for portability"); 593 "use gnulib module send for portability");
@@ -591,7 +603,7 @@ _GL_WARN_ON_USE (send, "send is not always POSIX compliant - "
591_GL_FUNCDECL_RPL (recvfrom, ssize_t, 603_GL_FUNCDECL_RPL (recvfrom, ssize_t,
592 (int fd, void *restrict buf, size_t len, int flags, 604 (int fd, void *restrict buf, size_t len, int flags,
593 struct sockaddr *restrict from, 605 struct sockaddr *restrict from,
594 socklen_t *restrict fromlen) 606 socklen_t *restrict fromlen),
595 _GL_ARG_NONNULL ((2))); 607 _GL_ARG_NONNULL ((2)));
596_GL_CXXALIAS_RPL (recvfrom, ssize_t, 608_GL_CXXALIAS_RPL (recvfrom, ssize_t,
597 (int fd, void *restrict buf, size_t len, int flags, 609 (int fd, void *restrict buf, size_t len, int flags,
@@ -609,10 +621,11 @@ _GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t,
609_GL_CXXALIASWARN (recvfrom); 621_GL_CXXALIASWARN (recvfrom);
610# endif 622# endif
611#elif @HAVE_WINSOCK2_H@ 623#elif @HAVE_WINSOCK2_H@
612# undef recvfrom 624# if !GNULIB_RECVFROM
613# define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom 625# undef recvfrom
626# define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
627# endif
614#elif defined GNULIB_POSIXCHECK 628#elif defined GNULIB_POSIXCHECK
615# undef recvfrom
616# if HAVE_RAW_DECL_RECVFROM 629# if HAVE_RAW_DECL_RECVFROM
617_GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - " 630_GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - "
618 "use gnulib module recvfrom for portability"); 631 "use gnulib module recvfrom for portability");
@@ -627,7 +640,7 @@ _GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - "
627# endif 640# endif
628_GL_FUNCDECL_RPL (sendto, ssize_t, 641_GL_FUNCDECL_RPL (sendto, ssize_t,
629 (int fd, const void *buf, size_t len, int flags, 642 (int fd, const void *buf, size_t len, int flags,
630 const struct sockaddr *to, socklen_t tolen) 643 const struct sockaddr *to, socklen_t tolen),
631 _GL_ARG_NONNULL ((2))); 644 _GL_ARG_NONNULL ((2)));
632_GL_CXXALIAS_RPL (sendto, ssize_t, 645_GL_CXXALIAS_RPL (sendto, ssize_t,
633 (int fd, const void *buf, size_t len, int flags, 646 (int fd, const void *buf, size_t len, int flags,
@@ -641,10 +654,11 @@ _GL_CXXALIAS_SYS_CAST (sendto, ssize_t,
641# endif 654# endif
642_GL_CXXALIASWARN (sendto); 655_GL_CXXALIASWARN (sendto);
643#elif @HAVE_WINSOCK2_H@ 656#elif @HAVE_WINSOCK2_H@
644# undef sendto 657# if !GNULIB_SENDTO
645# define sendto sendto_used_without_requesting_gnulib_module_sendto 658# undef sendto
659# define sendto sendto_used_without_requesting_gnulib_module_sendto
660# endif
646#elif defined GNULIB_POSIXCHECK 661#elif defined GNULIB_POSIXCHECK
647# undef sendto
648# if HAVE_RAW_DECL_SENDTO 662# if HAVE_RAW_DECL_SENDTO
649_GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - " 663_GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - "
650 "use gnulib module sendto for portability"); 664 "use gnulib module sendto for portability");
@@ -658,7 +672,7 @@ _GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - "
658# define setsockopt rpl_setsockopt 672# define setsockopt rpl_setsockopt
659# endif 673# endif
660_GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname, 674_GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname,
661 const void * optval, socklen_t optlen) 675 const void * optval, socklen_t optlen),
662 _GL_ARG_NONNULL ((4))); 676 _GL_ARG_NONNULL ((4)));
663_GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname, 677_GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname,
664 const void * optval, socklen_t optlen)); 678 const void * optval, socklen_t optlen));
@@ -671,10 +685,11 @@ _GL_CXXALIAS_SYS_CAST (setsockopt, int,
671# endif 685# endif
672_GL_CXXALIASWARN (setsockopt); 686_GL_CXXALIASWARN (setsockopt);
673#elif @HAVE_WINSOCK2_H@ 687#elif @HAVE_WINSOCK2_H@
674# undef setsockopt 688# if !GNULIB_SETSOCKOPT
675# define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt 689# undef setsockopt
690# define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
691# endif
676#elif defined GNULIB_POSIXCHECK 692#elif defined GNULIB_POSIXCHECK
677# undef setsockopt
678# if HAVE_RAW_DECL_SETSOCKOPT 693# if HAVE_RAW_DECL_SETSOCKOPT
679_GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - " 694_GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - "
680 "use gnulib module setsockopt for portability"); 695 "use gnulib module setsockopt for portability");
@@ -687,17 +702,18 @@ _GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - "
687# undef shutdown 702# undef shutdown
688# define shutdown rpl_shutdown 703# define shutdown rpl_shutdown
689# endif 704# endif
690_GL_FUNCDECL_RPL (shutdown, int, (int fd, int how)); 705_GL_FUNCDECL_RPL (shutdown, int, (int fd, int how), );
691_GL_CXXALIAS_RPL (shutdown, int, (int fd, int how)); 706_GL_CXXALIAS_RPL (shutdown, int, (int fd, int how));
692# else 707# else
693_GL_CXXALIAS_SYS (shutdown, int, (int fd, int how)); 708_GL_CXXALIAS_SYS (shutdown, int, (int fd, int how));
694# endif 709# endif
695_GL_CXXALIASWARN (shutdown); 710_GL_CXXALIASWARN (shutdown);
696#elif @HAVE_WINSOCK2_H@ 711#elif @HAVE_WINSOCK2_H@
697# undef shutdown 712# if !GNULIB_SHUTDOWN
698# define shutdown shutdown_used_without_requesting_gnulib_module_shutdown 713# undef shutdown
714# define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
715# endif
699#elif defined GNULIB_POSIXCHECK 716#elif defined GNULIB_POSIXCHECK
700# undef shutdown
701# if HAVE_RAW_DECL_SHUTDOWN 717# if HAVE_RAW_DECL_SHUTDOWN
702_GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - " 718_GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
703 "use gnulib module shutdown for portability"); 719 "use gnulib module shutdown for portability");
@@ -716,21 +732,20 @@ _GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
716# endif 732# endif
717_GL_FUNCDECL_RPL (accept4, int, 733_GL_FUNCDECL_RPL (accept4, int,
718 (int sockfd, struct sockaddr *addr, socklen_t *addrlen, 734 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
719 int flags)); 735 int flags), );
720_GL_CXXALIAS_RPL (accept4, int, 736_GL_CXXALIAS_RPL (accept4, int,
721 (int sockfd, struct sockaddr *addr, socklen_t *addrlen, 737 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
722 int flags)); 738 int flags));
723# else 739# else
724_GL_FUNCDECL_SYS (accept4, int, 740_GL_FUNCDECL_SYS (accept4, int,
725 (int sockfd, struct sockaddr *addr, socklen_t *addrlen, 741 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
726 int flags)); 742 int flags), );
727_GL_CXXALIAS_SYS (accept4, int, 743_GL_CXXALIAS_SYS (accept4, int,
728 (int sockfd, struct sockaddr *addr, socklen_t *addrlen, 744 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
729 int flags)); 745 int flags));
730# endif 746# endif
731_GL_CXXALIASWARN (accept4); 747_GL_CXXALIASWARN (accept4);
732#elif defined GNULIB_POSIXCHECK 748#elif defined GNULIB_POSIXCHECK
733# undef accept4
734# if HAVE_RAW_DECL_ACCEPT4 749# if HAVE_RAW_DECL_ACCEPT4
735_GL_WARN_ON_USE (accept4, "accept4 is unportable - " 750_GL_WARN_ON_USE (accept4, "accept4 is unportable - "
736 "use gnulib module accept4 for portability"); 751 "use gnulib module accept4 for portability");
diff --git a/gl/sys_stat.in.h b/gl/sys_stat.in.h
index bf08f335..deed21cd 100644
--- a/gl/sys_stat.in.h
+++ b/gl/sys_stat.in.h
@@ -1,5 +1,5 @@
1/* Provide a more complete sys/stat.h header file. 1/* Provide a more complete sys/stat.h header file.
2 Copyright (C) 2005-2024 Free Software Foundation, Inc. 2 Copyright (C) 2005-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -55,7 +55,8 @@
55#ifndef _@GUARD_PREFIX@_SYS_STAT_H 55#ifndef _@GUARD_PREFIX@_SYS_STAT_H
56#define _@GUARD_PREFIX@_SYS_STAT_H 56#define _@GUARD_PREFIX@_SYS_STAT_H
57 57
58/* This file uses _GL_ATTRIBUTE_NOTHROW, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ 58/* This file uses _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOTHROW,
59 GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
59#if !_GL_CONFIG_H_INCLUDED 60#if !_GL_CONFIG_H_INCLUDED
60 #error "Please include config.h first." 61 #error "Please include config.h first."
61#endif 62#endif
@@ -65,7 +66,7 @@
65 */ 66 */
66#ifndef _GL_ATTRIBUTE_NOTHROW 67#ifndef _GL_ATTRIBUTE_NOTHROW
67# if defined __cplusplus 68# if defined __cplusplus
68# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 69# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
69# if __cplusplus >= 201103L 70# if __cplusplus >= 201103L
70# define _GL_ATTRIBUTE_NOTHROW noexcept (true) 71# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
71# else 72# else
@@ -122,9 +123,11 @@
122# if @GNULIB_STAT@ 123# if @GNULIB_STAT@
123# define stat rpl_stat 124# define stat rpl_stat
124# else 125# else
125 /* Provoke a clear link error if stat() is used as a function and 126# if !GNULIB_STAT
126 module 'stat' is not in use. */ 127 /* Provoke a clear link error if stat() is used as a function and
127# define stat stat_used_without_requesting_gnulib_module_stat 128 module 'stat' is not in use. */
129# define stat stat_used_without_requesting_gnulib_module_stat
130# endif
128# endif 131# endif
129 132
130# if !GNULIB_defined_struct_stat 133# if !GNULIB_defined_struct_stat
@@ -433,7 +436,7 @@ struct stat
433# undef chmod 436# undef chmod
434# define chmod rpl_chmod 437# define chmod rpl_chmod
435# endif 438# endif
436_GL_FUNCDECL_RPL (chmod, int, (const char *filename, mode_t mode) 439_GL_FUNCDECL_RPL (chmod, int, (const char *filename, mode_t mode),
437 _GL_ARG_NONNULL ((1))); 440 _GL_ARG_NONNULL ((1)));
438_GL_CXXALIAS_RPL (chmod, int, (const char *filename, mode_t mode)); 441_GL_CXXALIAS_RPL (chmod, int, (const char *filename, mode_t mode));
439# elif defined _WIN32 && !defined __CYGWIN__ 442# elif defined _WIN32 && !defined __CYGWIN__
@@ -448,7 +451,6 @@ _GL_CXXALIAS_SYS (chmod, int, (const char *filename, mode_t mode));
448# endif 451# endif
449_GL_CXXALIASWARN (chmod); 452_GL_CXXALIASWARN (chmod);
450#elif defined GNULIB_POSIXCHECK 453#elif defined GNULIB_POSIXCHECK
451# undef chmod
452# if HAVE_RAW_DECL_CHMOD 454# if HAVE_RAW_DECL_CHMOD
453_GL_WARN_ON_USE (chmod, "chmod has portability problems - " 455_GL_WARN_ON_USE (chmod, "chmod has portability problems - "
454 "use gnulib module chmod for portability"); 456 "use gnulib module chmod for portability");
@@ -478,22 +480,21 @@ _GL_CXXALIASWARN (chmod);
478# define fchmodat rpl_fchmodat 480# define fchmodat rpl_fchmodat
479# endif 481# endif
480_GL_FUNCDECL_RPL (fchmodat, int, 482_GL_FUNCDECL_RPL (fchmodat, int,
481 (int fd, char const *file, mode_t mode, int flag) 483 (int fd, char const *file, mode_t mode, int flag),
482 _GL_ARG_NONNULL ((2))); 484 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
483_GL_CXXALIAS_RPL (fchmodat, int, 485_GL_CXXALIAS_RPL (fchmodat, int,
484 (int fd, char const *file, mode_t mode, int flag)); 486 (int fd, char const *file, mode_t mode, int flag));
485# else 487# else
486# if !@HAVE_FCHMODAT@ 488# if !@HAVE_FCHMODAT@
487_GL_FUNCDECL_SYS (fchmodat, int, 489_GL_FUNCDECL_SYS (fchmodat, int,
488 (int fd, char const *file, mode_t mode, int flag) 490 (int fd, char const *file, mode_t mode, int flag),
489 _GL_ARG_NONNULL ((2))); 491 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
490# endif 492# endif
491_GL_CXXALIAS_SYS (fchmodat, int, 493_GL_CXXALIAS_SYS (fchmodat, int,
492 (int fd, char const *file, mode_t mode, int flag)); 494 (int fd, char const *file, mode_t mode, int flag));
493# endif 495# endif
494_GL_CXXALIASWARN (fchmodat); 496_GL_CXXALIASWARN (fchmodat);
495#elif defined GNULIB_POSIXCHECK 497#elif defined GNULIB_POSIXCHECK
496# undef fchmodat
497# if HAVE_RAW_DECL_FCHMODAT 498# if HAVE_RAW_DECL_FCHMODAT
498_GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - " 499_GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
499 "use gnulib module openat for portability"); 500 "use gnulib module openat for portability");
@@ -507,7 +508,8 @@ _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
507# undef fstat 508# undef fstat
508# define fstat rpl_fstat 509# define fstat rpl_fstat
509# endif 510# endif
510_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2))); 511_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf),
512 _GL_ARG_NONNULL ((2)));
511_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf)); 513_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
512# else 514# else
513_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); 515_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
@@ -516,13 +518,14 @@ _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
516_GL_CXXALIASWARN (fstat); 518_GL_CXXALIASWARN (fstat);
517# endif 519# endif
518#elif @GNULIB_OVERRIDES_STRUCT_STAT@ 520#elif @GNULIB_OVERRIDES_STRUCT_STAT@
519# undef fstat 521# if !GNULIB_FSTAT
520# define fstat fstat_used_without_requesting_gnulib_module_fstat 522# undef fstat
523# define fstat fstat_used_without_requesting_gnulib_module_fstat
524# endif
521#elif @WINDOWS_64_BIT_ST_SIZE@ 525#elif @WINDOWS_64_BIT_ST_SIZE@
522/* Above, we define stat to _stati64. */ 526/* Above, we define stat to _stati64. */
523# define fstat _fstati64 527# define fstat _fstati64
524#elif defined GNULIB_POSIXCHECK 528#elif defined GNULIB_POSIXCHECK
525# undef fstat
526# if HAVE_RAW_DECL_FSTAT 529# if HAVE_RAW_DECL_FSTAT
527_GL_WARN_ON_USE (fstat, "fstat has portability problems - " 530_GL_WARN_ON_USE (fstat, "fstat has portability problems - "
528 "use gnulib module fstat for portability"); 531 "use gnulib module fstat for portability");
@@ -538,7 +541,7 @@ _GL_WARN_ON_USE (fstat, "fstat has portability problems - "
538# endif 541# endif
539_GL_FUNCDECL_RPL (fstatat, int, 542_GL_FUNCDECL_RPL (fstatat, int,
540 (int fd, char const *restrict name, struct stat *restrict st, 543 (int fd, char const *restrict name, struct stat *restrict st,
541 int flags) 544 int flags),
542 _GL_ARG_NONNULL ((2, 3))); 545 _GL_ARG_NONNULL ((2, 3)));
543_GL_CXXALIAS_RPL (fstatat, int, 546_GL_CXXALIAS_RPL (fstatat, int,
544 (int fd, char const *restrict name, struct stat *restrict st, 547 (int fd, char const *restrict name, struct stat *restrict st,
@@ -547,7 +550,7 @@ _GL_CXXALIAS_RPL (fstatat, int,
547# if !@HAVE_FSTATAT@ 550# if !@HAVE_FSTATAT@
548_GL_FUNCDECL_SYS (fstatat, int, 551_GL_FUNCDECL_SYS (fstatat, int,
549 (int fd, char const *restrict name, struct stat *restrict st, 552 (int fd, char const *restrict name, struct stat *restrict st,
550 int flags) 553 int flags),
551 _GL_ARG_NONNULL ((2, 3))); 554 _GL_ARG_NONNULL ((2, 3)));
552# endif 555# endif
553_GL_CXXALIAS_SYS (fstatat, int, 556_GL_CXXALIAS_SYS (fstatat, int,
@@ -556,10 +559,11 @@ _GL_CXXALIAS_SYS (fstatat, int,
556# endif 559# endif
557_GL_CXXALIASWARN (fstatat); 560_GL_CXXALIASWARN (fstatat);
558#elif @GNULIB_OVERRIDES_STRUCT_STAT@ 561#elif @GNULIB_OVERRIDES_STRUCT_STAT@
559# undef fstatat 562# if !GNULIB_FSTATAT
560# define fstatat fstatat_used_without_requesting_gnulib_module_fstatat 563# undef fstatat
564# define fstatat fstatat_used_without_requesting_gnulib_module_fstatat
565# endif
561#elif defined GNULIB_POSIXCHECK 566#elif defined GNULIB_POSIXCHECK
562# undef fstatat
563# if HAVE_RAW_DECL_FSTATAT 567# if HAVE_RAW_DECL_FSTATAT
564_GL_WARN_ON_USE (fstatat, "fstatat is not portable - " 568_GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
565 "use gnulib module openat for portability"); 569 "use gnulib module openat for portability");
@@ -577,11 +581,11 @@ _GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
577# undef futimens 581# undef futimens
578# define futimens rpl_futimens 582# define futimens rpl_futimens
579# endif 583# endif
580_GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2])); 584_GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]), );
581_GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2])); 585_GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
582# else 586# else
583# if !@HAVE_FUTIMENS@ 587# if !@HAVE_FUTIMENS@
584_GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2])); 588_GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]), );
585# endif 589# endif
586_GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2])); 590_GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
587# endif 591# endif
@@ -589,7 +593,6 @@ _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
589_GL_CXXALIASWARN (futimens); 593_GL_CXXALIASWARN (futimens);
590# endif 594# endif
591#elif defined GNULIB_POSIXCHECK 595#elif defined GNULIB_POSIXCHECK
592# undef futimens
593# if HAVE_RAW_DECL_FUTIMENS 596# if HAVE_RAW_DECL_FUTIMENS
594_GL_WARN_ON_USE (futimens, "futimens is not portable - " 597_GL_WARN_ON_USE (futimens, "futimens is not portable - "
595 "use gnulib module futimens for portability"); 598 "use gnulib module futimens for portability");
@@ -600,9 +603,9 @@ _GL_WARN_ON_USE (futimens, "futimens is not portable - "
600#if @GNULIB_GETUMASK@ 603#if @GNULIB_GETUMASK@
601# if !@HAVE_GETUMASK@ 604# if !@HAVE_GETUMASK@
602# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 605# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
603_GL_FUNCDECL_SYS (getumask, mode_t, (void) _GL_ATTRIBUTE_NOTHROW); 606_GL_FUNCDECL_SYS (getumask, mode_t, (void), ) _GL_ATTRIBUTE_NOTHROW;
604# else 607# else
605_GL_FUNCDECL_SYS (getumask, mode_t, (void)); 608_GL_FUNCDECL_SYS (getumask, mode_t, (void), );
606# endif 609# endif
607# endif 610# endif
608_GL_CXXALIAS_SYS (getumask, mode_t, (void)); 611_GL_CXXALIAS_SYS (getumask, mode_t, (void));
@@ -610,7 +613,6 @@ _GL_CXXALIAS_SYS (getumask, mode_t, (void));
610_GL_CXXALIASWARN (getumask); 613_GL_CXXALIASWARN (getumask);
611# endif 614# endif
612#elif defined GNULIB_POSIXCHECK 615#elif defined GNULIB_POSIXCHECK
613# undef getumask
614# if HAVE_RAW_DECL_GETUMASK 616# if HAVE_RAW_DECL_GETUMASK
615_GL_WARN_ON_USE (getumask, "getumask is not portable - " 617_GL_WARN_ON_USE (getumask, "getumask is not portable - "
616 "use gnulib module getumask for portability"); 618 "use gnulib module getumask for portability");
@@ -622,13 +624,12 @@ _GL_WARN_ON_USE (getumask, "getumask is not portable - "
622/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME 624/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
623 denotes a symbolic link. */ 625 denotes a symbolic link. */
624# if !@HAVE_LCHMOD@ || defined __hpux 626# if !@HAVE_LCHMOD@ || defined __hpux
625_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode) 627_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode),
626 _GL_ARG_NONNULL ((1))); 628 _GL_ARG_NONNULL ((1)));
627# endif 629# endif
628_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode)); 630_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
629_GL_CXXALIASWARN (lchmod); 631_GL_CXXALIASWARN (lchmod);
630#elif defined GNULIB_POSIXCHECK 632#elif defined GNULIB_POSIXCHECK
631# undef lchmod
632# if HAVE_RAW_DECL_LCHMOD 633# if HAVE_RAW_DECL_LCHMOD
633_GL_WARN_ON_USE (lchmod, "lchmod is unportable - " 634_GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
634 "use gnulib module lchmod for portability"); 635 "use gnulib module lchmod for portability");
@@ -642,7 +643,7 @@ _GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
642# undef mkdir 643# undef mkdir
643# define mkdir rpl_mkdir 644# define mkdir rpl_mkdir
644# endif 645# endif
645_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode) 646_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode),
646 _GL_ARG_NONNULL ((1))); 647 _GL_ARG_NONNULL ((1)));
647_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); 648_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
648# elif defined _WIN32 && !defined __CYGWIN__ 649# elif defined _WIN32 && !defined __CYGWIN__
@@ -667,12 +668,6 @@ _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
667_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); 668_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
668# endif 669# endif
669_GL_CXXALIASWARN (mkdir); 670_GL_CXXALIASWARN (mkdir);
670#elif defined GNULIB_POSIXCHECK
671# undef mkdir
672# if HAVE_RAW_DECL_MKDIR
673_GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - "
674 "use gnulib module mkdir for portability");
675# endif
676#elif @GNULIB_MDA_MKDIR@ 671#elif @GNULIB_MDA_MKDIR@
677/* On native Windows, map 'mkdir' to '_mkdir', so that -loldnames is not 672/* On native Windows, map 'mkdir' to '_mkdir', so that -loldnames is not
678 required. In C++ with GNULIB_NAMESPACE, avoid differences between 673 required. In C++ with GNULIB_NAMESPACE, avoid differences between
@@ -695,18 +690,22 @@ _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
695_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); 690_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
696# endif 691# endif
697_GL_CXXALIASWARN (mkdir); 692_GL_CXXALIASWARN (mkdir);
693#elif defined GNULIB_POSIXCHECK
694# if HAVE_RAW_DECL_MKDIR
695_GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - "
696 "use gnulib module mkdir for portability");
697# endif
698#endif 698#endif
699 699
700 700
701#if @GNULIB_MKDIRAT@ 701#if @GNULIB_MKDIRAT@
702# if !@HAVE_MKDIRAT@ 702# if !@HAVE_MKDIRAT@
703_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode) 703_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode),
704 _GL_ARG_NONNULL ((2))); 704 _GL_ARG_NONNULL ((2)));
705# endif 705# endif
706_GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)); 706_GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
707_GL_CXXALIASWARN (mkdirat); 707_GL_CXXALIASWARN (mkdirat);
708#elif defined GNULIB_POSIXCHECK 708#elif defined GNULIB_POSIXCHECK
709# undef mkdirat
710# if HAVE_RAW_DECL_MKDIRAT 709# if HAVE_RAW_DECL_MKDIRAT
711_GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - " 710_GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
712 "use gnulib module openat for portability"); 711 "use gnulib module openat for portability");
@@ -720,19 +719,18 @@ _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
720# undef mkfifo 719# undef mkfifo
721# define mkfifo rpl_mkfifo 720# define mkfifo rpl_mkfifo
722# endif 721# endif
723_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode) 722_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode),
724 _GL_ARG_NONNULL ((1))); 723 _GL_ARG_NONNULL ((1)));
725_GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode)); 724_GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
726# else 725# else
727# if !@HAVE_MKFIFO@ 726# if !@HAVE_MKFIFO@
728_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode) 727_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode),
729 _GL_ARG_NONNULL ((1))); 728 _GL_ARG_NONNULL ((1)));
730# endif 729# endif
731_GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode)); 730_GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
732# endif 731# endif
733_GL_CXXALIASWARN (mkfifo); 732_GL_CXXALIASWARN (mkfifo);
734#elif defined GNULIB_POSIXCHECK 733#elif defined GNULIB_POSIXCHECK
735# undef mkfifo
736# if HAVE_RAW_DECL_MKFIFO 734# if HAVE_RAW_DECL_MKFIFO
737_GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - " 735_GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
738 "use gnulib module mkfifo for portability"); 736 "use gnulib module mkfifo for portability");
@@ -746,12 +744,12 @@ _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
746# undef mkfifoat 744# undef mkfifoat
747# define mkfifoat rpl_mkfifoat 745# define mkfifoat rpl_mkfifoat
748# endif 746# endif
749_GL_FUNCDECL_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode) 747_GL_FUNCDECL_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode),
750 _GL_ARG_NONNULL ((2))); 748 _GL_ARG_NONNULL ((2)));
751_GL_CXXALIAS_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode)); 749_GL_CXXALIAS_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode));
752# else 750# else
753# if !@HAVE_MKFIFOAT@ 751# if !@HAVE_MKFIFOAT@
754_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode) 752_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode),
755 _GL_ARG_NONNULL ((2))); 753 _GL_ARG_NONNULL ((2)));
756# endif 754# endif
757_GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)); 755_GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
@@ -760,7 +758,6 @@ _GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
760_GL_CXXALIASWARN (mkfifoat); 758_GL_CXXALIASWARN (mkfifoat);
761# endif 759# endif
762#elif defined GNULIB_POSIXCHECK 760#elif defined GNULIB_POSIXCHECK
763# undef mkfifoat
764# if HAVE_RAW_DECL_MKFIFOAT 761# if HAVE_RAW_DECL_MKFIFOAT
765_GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - " 762_GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
766 "use gnulib module mkfifoat for portability"); 763 "use gnulib module mkfifoat for portability");
@@ -774,20 +771,18 @@ _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
774# undef mknod 771# undef mknod
775# define mknod rpl_mknod 772# define mknod rpl_mknod
776# endif 773# endif
777_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev) 774_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev),
778 _GL_ARG_NONNULL ((1))); 775 _GL_ARG_NONNULL ((1)));
779_GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)); 776_GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
780# else 777# else
781# if !@HAVE_MKNOD@ 778# if !@HAVE_MKNOD@
782_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev) 779_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev),
783 _GL_ARG_NONNULL ((1))); 780 _GL_ARG_NONNULL ((1)));
784# endif 781# endif
785/* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */ 782_GL_CXXALIAS_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev));
786_GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev));
787# endif 783# endif
788_GL_CXXALIASWARN (mknod); 784_GL_CXXALIASWARN (mknod);
789#elif defined GNULIB_POSIXCHECK 785#elif defined GNULIB_POSIXCHECK
790# undef mknod
791# if HAVE_RAW_DECL_MKNOD 786# if HAVE_RAW_DECL_MKNOD
792_GL_WARN_ON_USE (mknod, "mknod is not portable - " 787_GL_WARN_ON_USE (mknod, "mknod is not portable - "
793 "use gnulib module mknod for portability"); 788 "use gnulib module mknod for portability");
@@ -802,14 +797,14 @@ _GL_WARN_ON_USE (mknod, "mknod is not portable - "
802# define mknodat rpl_mknodat 797# define mknodat rpl_mknodat
803# endif 798# endif
804_GL_FUNCDECL_RPL (mknodat, int, 799_GL_FUNCDECL_RPL (mknodat, int,
805 (int fd, char const *file, mode_t mode, dev_t dev) 800 (int fd, char const *file, mode_t mode, dev_t dev),
806 _GL_ARG_NONNULL ((2))); 801 _GL_ARG_NONNULL ((2)));
807_GL_CXXALIAS_RPL (mknodat, int, 802_GL_CXXALIAS_RPL (mknodat, int,
808 (int fd, char const *file, mode_t mode, dev_t dev)); 803 (int fd, char const *file, mode_t mode, dev_t dev));
809# else 804# else
810# if !@HAVE_MKNODAT@ 805# if !@HAVE_MKNODAT@
811_GL_FUNCDECL_SYS (mknodat, int, 806_GL_FUNCDECL_SYS (mknodat, int,
812 (int fd, char const *file, mode_t mode, dev_t dev) 807 (int fd, char const *file, mode_t mode, dev_t dev),
813 _GL_ARG_NONNULL ((2))); 808 _GL_ARG_NONNULL ((2)));
814# endif 809# endif
815_GL_CXXALIAS_SYS (mknodat, int, 810_GL_CXXALIAS_SYS (mknodat, int,
@@ -819,7 +814,6 @@ _GL_CXXALIAS_SYS (mknodat, int,
819_GL_CXXALIASWARN (mknodat); 814_GL_CXXALIASWARN (mknodat);
820# endif 815# endif
821#elif defined GNULIB_POSIXCHECK 816#elif defined GNULIB_POSIXCHECK
822# undef mknodat
823# if HAVE_RAW_DECL_MKNODAT 817# if HAVE_RAW_DECL_MKNODAT
824_GL_WARN_ON_USE (mknodat, "mknodat is not portable - " 818_GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
825 "use gnulib module mkfifoat for portability"); 819 "use gnulib module mkfifoat for portability");
@@ -841,7 +835,11 @@ _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
841# elif @WINDOWS_64_BIT_ST_SIZE@ 835# elif @WINDOWS_64_BIT_ST_SIZE@
842 /* Above, we define stat to _stati64. */ 836 /* Above, we define stat to _stati64. */
843# if defined __MINGW32__ && defined _stati64 837# if defined __MINGW32__ && defined _stati64
844# ifndef _USE_32BIT_TIME_T 838# ifdef _USE_32BIT_TIME_T
839 /* The system headers possibly define _stati64 to _stat32i64. */
840# undef _stat32i64
841# define _stat32i64(name, st) rpl_stat (name, st)
842# else
845 /* The system headers define _stati64 to _stat64. */ 843 /* The system headers define _stati64 to _stat64. */
846# undef _stat64 844# undef _stat64
847# define _stat64(name, st) rpl_stat (name, st) 845# define _stat64(name, st) rpl_stat (name, st)
@@ -893,7 +891,6 @@ _GL_EXTERN_C int stat (const char *restrict name, struct stat *restrict buf)
893 #define stat stat_used_without_requesting_gnulib_module_stat 891 #define stat stat_used_without_requesting_gnulib_module_stat
894 */ 892 */
895#elif defined GNULIB_POSIXCHECK 893#elif defined GNULIB_POSIXCHECK
896# undef stat
897# if HAVE_RAW_DECL_STAT 894# if HAVE_RAW_DECL_STAT
898_GL_WARN_ON_USE (stat, "stat is unportable - " 895_GL_WARN_ON_USE (stat, "stat is unportable - "
899 "use gnulib module stat for portability"); 896 "use gnulib module stat for portability");
@@ -916,7 +913,7 @@ _GL_CXXALIAS_RPL_1 (lstat, stat, int,
916# define lstat rpl_lstat 913# define lstat rpl_lstat
917# endif 914# endif
918_GL_FUNCDECL_RPL (lstat, int, 915_GL_FUNCDECL_RPL (lstat, int,
919 (const char *restrict name, struct stat *restrict buf) 916 (const char *restrict name, struct stat *restrict buf),
920 _GL_ARG_NONNULL ((1, 2))); 917 _GL_ARG_NONNULL ((1, 2)));
921_GL_CXXALIAS_RPL (lstat, int, 918_GL_CXXALIAS_RPL (lstat, int,
922 (const char *restrict name, struct stat *restrict buf)); 919 (const char *restrict name, struct stat *restrict buf));
@@ -928,10 +925,11 @@ _GL_CXXALIAS_SYS (lstat, int,
928_GL_CXXALIASWARN (lstat); 925_GL_CXXALIASWARN (lstat);
929# endif 926# endif
930#elif @GNULIB_OVERRIDES_STRUCT_STAT@ 927#elif @GNULIB_OVERRIDES_STRUCT_STAT@
931# undef lstat 928# if !GNULIB_LSTAT
932# define lstat lstat_used_without_requesting_gnulib_module_lstat 929# undef lstat
930# define lstat lstat_used_without_requesting_gnulib_module_lstat
931# endif
933#elif defined GNULIB_POSIXCHECK 932#elif defined GNULIB_POSIXCHECK
934# undef lstat
935# if HAVE_RAW_DECL_LSTAT 933# if HAVE_RAW_DECL_LSTAT
936_GL_WARN_ON_USE (lstat, "lstat is unportable - " 934_GL_WARN_ON_USE (lstat, "lstat is unportable - "
937 "use gnulib module lstat for portability"); 935 "use gnulib module lstat for portability");
@@ -968,14 +966,14 @@ _GL_CXXALIASWARN (umask);
968# define utimensat rpl_utimensat 966# define utimensat rpl_utimensat
969# endif 967# endif
970_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name, 968_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
971 struct timespec const times[2], int flag) 969 struct timespec const times[2], int flag),
972 _GL_ARG_NONNULL ((2))); 970 _GL_ARG_NONNULL ((2)));
973_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name, 971_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
974 struct timespec const times[2], int flag)); 972 struct timespec const times[2], int flag));
975# else 973# else
976# if !@HAVE_UTIMENSAT@ 974# if !@HAVE_UTIMENSAT@
977_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name, 975_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
978 struct timespec const times[2], int flag) 976 struct timespec const times[2], int flag),
979 _GL_ARG_NONNULL ((2))); 977 _GL_ARG_NONNULL ((2)));
980# endif 978# endif
981_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name, 979_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
@@ -985,7 +983,6 @@ _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
985_GL_CXXALIASWARN (utimensat); 983_GL_CXXALIASWARN (utimensat);
986# endif 984# endif
987#elif defined GNULIB_POSIXCHECK 985#elif defined GNULIB_POSIXCHECK
988# undef utimensat
989# if HAVE_RAW_DECL_UTIMENSAT 986# if HAVE_RAW_DECL_UTIMENSAT
990_GL_WARN_ON_USE (utimensat, "utimensat is not portable - " 987_GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
991 "use gnulib module utimensat for portability"); 988 "use gnulib module utimensat for portability");
diff --git a/gl/sys_types.in.h b/gl/sys_types.in.h
index 0a0ccc3c..733b4ba4 100644
--- a/gl/sys_types.in.h
+++ b/gl/sys_types.in.h
@@ -1,6 +1,6 @@
1/* Provide a more complete sys/types.h. 1/* Provide a more complete sys/types.h.
2 2
3 Copyright (C) 2011-2024 Free Software Foundation, Inc. 3 Copyright (C) 2011-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -60,6 +60,15 @@
60# define _GL_WINDOWS_64_BIT_OFF_T 1 60# define _GL_WINDOWS_64_BIT_OFF_T 1
61#endif 61#endif
62 62
63/* Define the off64_t type. */
64#if !@HAVE_OFF64_T@
65# if !GNULIB_defined_off64_t
66/* Define off64_t to int64_t always. */
67typedef long long off64_t;
68# define GNULIB_defined_off64_t 1
69# endif
70#endif
71
63/* Override dev_t and ino_t if distinguishable inodes support is requested 72/* Override dev_t and ino_t if distinguishable inodes support is requested
64 on native Windows. */ 73 on native Windows. */
65#if @WINDOWS_STAT_INODES@ 74#if @WINDOWS_STAT_INODES@
@@ -108,6 +117,22 @@ typedef unsigned long long int rpl_ino_t;
108# include <stddef.h> 117# include <stddef.h>
109#endif 118#endif
110 119
120/* Define blksize_t, required by POSIX:2024. */
121#if !@HAVE_BLKSIZE_T@
122# if !defined GNULIB_defined_blksize_t
123typedef int blksize_t;
124# define GNULIB_defined_blksize_t 1
125# endif
126#endif
127
128/* Define blkcnt_t, required by POSIX:2024. */
129#if !@HAVE_BLKCNT_T@
130# if !defined GNULIB_defined_blkcnt_t
131typedef long long blkcnt_t;
132# define GNULIB_defined_blkcnt_t 1
133# endif
134#endif
135
111#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */ 136#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */
112#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */ 137#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */
113#endif /* __need_XXX */ 138#endif /* __need_XXX */
diff --git a/gl/sys_uio.in.h b/gl/sys_uio.in.h
index 5e71859d..8f7f506f 100644
--- a/gl/sys_uio.in.h
+++ b/gl/sys_uio.in.h
@@ -1,5 +1,5 @@
1/* Substitute for <sys/uio.h>. 1/* Substitute for <sys/uio.h>.
2 Copyright (C) 2011-2024 Free Software Foundation, Inc. 2 Copyright (C) 2011-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/time.in.h b/gl/time.in.h
index df99c8ab..5bbccf76 100644
--- a/gl/time.in.h
+++ b/gl/time.in.h
@@ -1,6 +1,6 @@
1/* A more-standard <time.h>. 1/* A more-standard <time.h>.
2 2
3 Copyright (C) 2007-2024 Free Software Foundation, Inc. 3 Copyright (C) 2007-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -122,6 +122,23 @@ struct __time_t_must_be_integral {
122# endif 122# endif
123# endif 123# endif
124 124
125# if @GNULIB_TZNAME@
126/* tzname[0..1]: Abbreviated time zone names, set by the tzset() function. */
127# if NEED_DECL_TZNAME
128extern
129# ifdef __cplusplus
130 "C"
131# endif
132 char *tzname[];
133# endif
134# if defined _WIN32 && !defined __CYGWIN__
135/* On native Windows, map 'tzname' to '_tzname' etc., so that -loldnames is not
136 required. */
137# undef tzname
138# define tzname _tzname
139# endif
140# endif
141
125/* Set *TS to the current time, and return BASE. 142/* Set *TS to the current time, and return BASE.
126 Upon failure, return 0. */ 143 Upon failure, return 0. */
127# if @GNULIB_TIMESPEC_GET@ 144# if @GNULIB_TIMESPEC_GET@
@@ -130,12 +147,12 @@ struct __time_t_must_be_integral {
130# undef timespec_get 147# undef timespec_get
131# define timespec_get rpl_timespec_get 148# define timespec_get rpl_timespec_get
132# endif 149# endif
133_GL_FUNCDECL_RPL (timespec_get, int, (struct timespec *ts, int base) 150_GL_FUNCDECL_RPL (timespec_get, int, (struct timespec *ts, int base),
134 _GL_ARG_NONNULL ((1))); 151 _GL_ARG_NONNULL ((1)));
135_GL_CXXALIAS_RPL (timespec_get, int, (struct timespec *ts, int base)); 152_GL_CXXALIAS_RPL (timespec_get, int, (struct timespec *ts, int base));
136# else 153# else
137# if !@HAVE_TIMESPEC_GET@ 154# if !@HAVE_TIMESPEC_GET@
138_GL_FUNCDECL_SYS (timespec_get, int, (struct timespec *ts, int base) 155_GL_FUNCDECL_SYS (timespec_get, int, (struct timespec *ts, int base),
139 _GL_ARG_NONNULL ((1))); 156 _GL_ARG_NONNULL ((1)));
140# endif 157# endif
141_GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base)); 158_GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base));
@@ -144,7 +161,6 @@ _GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base));
144_GL_CXXALIASWARN (timespec_get); 161_GL_CXXALIASWARN (timespec_get);
145# endif 162# endif
146# elif defined GNULIB_POSIXCHECK 163# elif defined GNULIB_POSIXCHECK
147# undef timespec_get
148# if HAVE_RAW_DECL_TIMESPEC_GET 164# if HAVE_RAW_DECL_TIMESPEC_GET
149_GL_WARN_ON_USE (timespec_get, "timespec_get is unportable - " 165_GL_WARN_ON_USE (timespec_get, "timespec_get is unportable - "
150 "use gnulib module timespec_get for portability"); 166 "use gnulib module timespec_get for portability");
@@ -159,19 +175,20 @@ _GL_WARN_ON_USE (timespec_get, "timespec_get is unportable - "
159# undef timespec_getres 175# undef timespec_getres
160# define timespec_getres rpl_timespec_getres 176# define timespec_getres rpl_timespec_getres
161# endif 177# endif
162_GL_FUNCDECL_RPL (timespec_getres, int, (struct timespec *ts, int base) 178_GL_FUNCDECL_RPL (timespec_getres, int, (struct timespec *ts, int base),
163 _GL_ARG_NONNULL ((1))); 179 _GL_ARG_NONNULL ((1)));
164_GL_CXXALIAS_RPL (timespec_getres, int, (struct timespec *ts, int base)); 180_GL_CXXALIAS_RPL (timespec_getres, int, (struct timespec *ts, int base));
165# else 181# else
166# if !@HAVE_TIMESPEC_GETRES@ 182# if !@HAVE_TIMESPEC_GETRES@
167_GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base) 183_GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base),
168 _GL_ARG_NONNULL ((1))); 184 _GL_ARG_NONNULL ((1)));
169# endif 185# endif
170_GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base)); 186_GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base));
171# endif 187# endif
188# if __GLIBC__ >= 2
172_GL_CXXALIASWARN (timespec_getres); 189_GL_CXXALIASWARN (timespec_getres);
190# endif
173# elif defined GNULIB_POSIXCHECK 191# elif defined GNULIB_POSIXCHECK
174# undef timespec_getres
175# if HAVE_RAW_DECL_TIMESPEC_GETRES 192# if HAVE_RAW_DECL_TIMESPEC_GETRES
176_GL_WARN_ON_USE (timespec_getres, "timespec_getres is unportable - " 193_GL_WARN_ON_USE (timespec_getres, "timespec_getres is unportable - "
177 "use gnulib module timespec_getres for portability"); 194 "use gnulib module timespec_getres for portability");
@@ -184,7 +201,7 @@ _GL_WARN_ON_USE (timespec_getres, "timespec_getres is unportable - "
184# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 201# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
185# define time rpl_time 202# define time rpl_time
186# endif 203# endif
187_GL_FUNCDECL_RPL (time, time_t, (time_t *__tp)); 204_GL_FUNCDECL_RPL (time, time_t, (time_t *__tp), );
188_GL_CXXALIAS_RPL (time, time_t, (time_t *__tp)); 205_GL_CXXALIAS_RPL (time, time_t, (time_t *__tp));
189# else 206# else
190_GL_CXXALIAS_SYS (time, time_t, (time_t *__tp)); 207_GL_CXXALIAS_SYS (time, time_t, (time_t *__tp));
@@ -193,7 +210,6 @@ _GL_CXXALIAS_SYS (time, time_t, (time_t *__tp));
193_GL_CXXALIASWARN (time); 210_GL_CXXALIASWARN (time);
194# endif 211# endif
195# elif defined GNULIB_POSIXCHECK 212# elif defined GNULIB_POSIXCHECK
196# undef time
197# if HAVE_RAW_DECL_TIME 213# if HAVE_RAW_DECL_TIME
198_GL_WARN_ON_USE (time, "time has consistency problems - " 214_GL_WARN_ON_USE (time, "time has consistency problems - "
199 "use gnulib module time for portability"); 215 "use gnulib module time for portability");
@@ -209,14 +225,14 @@ _GL_WARN_ON_USE (time, "time has consistency problems - "
209# define nanosleep rpl_nanosleep 225# define nanosleep rpl_nanosleep
210# endif 226# endif
211_GL_FUNCDECL_RPL (nanosleep, int, 227_GL_FUNCDECL_RPL (nanosleep, int,
212 (struct timespec const *__rqtp, struct timespec *__rmtp) 228 (struct timespec const *__rqtp, struct timespec *__rmtp),
213 _GL_ARG_NONNULL ((1))); 229 _GL_ARG_NONNULL ((1)));
214_GL_CXXALIAS_RPL (nanosleep, int, 230_GL_CXXALIAS_RPL (nanosleep, int,
215 (struct timespec const *__rqtp, struct timespec *__rmtp)); 231 (struct timespec const *__rqtp, struct timespec *__rmtp));
216# else 232# else
217# if ! @HAVE_NANOSLEEP@ 233# if ! @HAVE_NANOSLEEP@
218_GL_FUNCDECL_SYS (nanosleep, int, 234_GL_FUNCDECL_SYS (nanosleep, int,
219 (struct timespec const *__rqtp, struct timespec *__rmtp) 235 (struct timespec const *__rqtp, struct timespec *__rmtp),
220 _GL_ARG_NONNULL ((1))); 236 _GL_ARG_NONNULL ((1)));
221# endif 237# endif
222_GL_CXXALIAS_SYS (nanosleep, int, 238_GL_CXXALIAS_SYS (nanosleep, int,
@@ -224,7 +240,6 @@ _GL_CXXALIAS_SYS (nanosleep, int,
224# endif 240# endif
225_GL_CXXALIASWARN (nanosleep); 241_GL_CXXALIASWARN (nanosleep);
226# elif defined GNULIB_POSIXCHECK 242# elif defined GNULIB_POSIXCHECK
227# undef nanosleep
228# if HAVE_RAW_DECL_NANOSLEEP 243# if HAVE_RAW_DECL_NANOSLEEP
229_GL_WARN_ON_USE (nanosleep, "nanosleep is unportable - " 244_GL_WARN_ON_USE (nanosleep, "nanosleep is unportable - "
230 "use gnulib module nanosleep for portability"); 245 "use gnulib module nanosleep for portability");
@@ -238,7 +253,7 @@ _GL_WARN_ON_USE (nanosleep, "nanosleep is unportable - "
238# undef tzset 253# undef tzset
239# define tzset rpl_tzset 254# define tzset rpl_tzset
240# endif 255# endif
241_GL_FUNCDECL_RPL (tzset, void, (void)); 256_GL_FUNCDECL_RPL (tzset, void, (void), );
242_GL_CXXALIAS_RPL (tzset, void, (void)); 257_GL_CXXALIAS_RPL (tzset, void, (void));
243# elif defined _WIN32 && !defined __CYGWIN__ 258# elif defined _WIN32 && !defined __CYGWIN__
244# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 259# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -265,7 +280,6 @@ _GL_CXXALIAS_SYS (tzset, void, (void));
265# endif 280# endif
266_GL_CXXALIASWARN (tzset); 281_GL_CXXALIASWARN (tzset);
267# elif defined GNULIB_POSIXCHECK 282# elif defined GNULIB_POSIXCHECK
268# undef tzset
269# if HAVE_RAW_DECL_TZSET 283# if HAVE_RAW_DECL_TZSET
270_GL_WARN_ON_USE (tzset, "tzset has portability problems - " 284_GL_WARN_ON_USE (tzset, "tzset has portability problems - "
271 "use gnulib module tzset for portability"); 285 "use gnulib module tzset for portability");
@@ -278,7 +292,7 @@ _GL_WARN_ON_USE (tzset, "tzset has portability problems - "
278# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 292# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
279# define mktime rpl_mktime 293# define mktime rpl_mktime
280# endif 294# endif
281_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1))); 295_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp), _GL_ARG_NONNULL ((1)));
282_GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp)); 296_GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp));
283# else 297# else
284_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); 298_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
@@ -287,7 +301,6 @@ _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
287_GL_CXXALIASWARN (mktime); 301_GL_CXXALIASWARN (mktime);
288# endif 302# endif
289# elif defined GNULIB_POSIXCHECK 303# elif defined GNULIB_POSIXCHECK
290# undef mktime
291# if HAVE_RAW_DECL_MKTIME 304# if HAVE_RAW_DECL_MKTIME
292_GL_WARN_ON_USE (mktime, "mktime has portability problems - " 305_GL_WARN_ON_USE (mktime, "mktime has portability problems - "
293 "use gnulib module mktime for portability"); 306 "use gnulib module mktime for portability");
@@ -304,14 +317,14 @@ _GL_WARN_ON_USE (mktime, "mktime has portability problems - "
304# define localtime_r rpl_localtime_r 317# define localtime_r rpl_localtime_r
305# endif 318# endif
306_GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, 319_GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
307 struct tm *restrict __result) 320 struct tm *restrict __result),
308 _GL_ARG_NONNULL ((1, 2))); 321 _GL_ARG_NONNULL ((1, 2)));
309_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, 322_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
310 struct tm *restrict __result)); 323 struct tm *restrict __result));
311# else 324# else
312# if ! @HAVE_DECL_LOCALTIME_R@ 325# if ! @HAVE_DECL_LOCALTIME_R@
313_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, 326_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
314 struct tm *restrict __result) 327 struct tm *restrict __result),
315 _GL_ARG_NONNULL ((1, 2))); 328 _GL_ARG_NONNULL ((1, 2)));
316# endif 329# endif
317_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, 330_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
@@ -326,14 +339,14 @@ _GL_CXXALIASWARN (localtime_r);
326# define gmtime_r rpl_gmtime_r 339# define gmtime_r rpl_gmtime_r
327# endif 340# endif
328_GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, 341_GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
329 struct tm *restrict __result) 342 struct tm *restrict __result),
330 _GL_ARG_NONNULL ((1, 2))); 343 _GL_ARG_NONNULL ((1, 2)));
331_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, 344_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
332 struct tm *restrict __result)); 345 struct tm *restrict __result));
333# else 346# else
334# if ! @HAVE_DECL_LOCALTIME_R@ 347# if ! @HAVE_DECL_LOCALTIME_R@
335_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, 348_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
336 struct tm *restrict __result) 349 struct tm *restrict __result),
337 _GL_ARG_NONNULL ((1, 2))); 350 _GL_ARG_NONNULL ((1, 2)));
338# endif 351# endif
339_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, 352_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
@@ -343,12 +356,10 @@ _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
343_GL_CXXALIASWARN (gmtime_r); 356_GL_CXXALIASWARN (gmtime_r);
344# endif 357# endif
345# elif defined GNULIB_POSIXCHECK 358# elif defined GNULIB_POSIXCHECK
346# undef localtime_r
347# if HAVE_RAW_DECL_LOCALTIME_R 359# if HAVE_RAW_DECL_LOCALTIME_R
348_GL_WARN_ON_USE (localtime_r, "localtime_r is unportable - " 360_GL_WARN_ON_USE (localtime_r, "localtime_r is unportable - "
349 "use gnulib module time_r for portability"); 361 "use gnulib module time_r for portability");
350# endif 362# endif
351# undef gmtime_r
352# if HAVE_RAW_DECL_GMTIME_R 363# if HAVE_RAW_DECL_GMTIME_R
353_GL_WARN_ON_USE (gmtime_r, "gmtime_r is unportable - " 364_GL_WARN_ON_USE (gmtime_r, "gmtime_r is unportable - "
354 "use gnulib module time_r for portability"); 365 "use gnulib module time_r for portability");
@@ -364,7 +375,7 @@ _GL_WARN_ON_USE (gmtime_r, "gmtime_r is unportable - "
364# undef localtime 375# undef localtime
365# define localtime rpl_localtime 376# define localtime rpl_localtime
366# endif 377# endif
367_GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer) 378_GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer),
368 _GL_ARG_NONNULL ((1))); 379 _GL_ARG_NONNULL ((1)));
369_GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer)); 380_GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer));
370# else 381# else
@@ -374,7 +385,6 @@ _GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer));
374_GL_CXXALIASWARN (localtime); 385_GL_CXXALIASWARN (localtime);
375# endif 386# endif
376# elif defined GNULIB_POSIXCHECK 387# elif defined GNULIB_POSIXCHECK
377# undef localtime
378# if HAVE_RAW_DECL_LOCALTIME 388# if HAVE_RAW_DECL_LOCALTIME
379_GL_WARN_ON_USE (localtime, "localtime has portability problems - " 389_GL_WARN_ON_USE (localtime, "localtime has portability problems - "
380 "use gnulib module localtime for portability"); 390 "use gnulib module localtime for portability");
@@ -387,7 +397,7 @@ _GL_WARN_ON_USE (localtime, "localtime has portability problems - "
387# undef gmtime 397# undef gmtime
388# define gmtime rpl_gmtime 398# define gmtime rpl_gmtime
389# endif 399# endif
390_GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer) 400_GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer),
391 _GL_ARG_NONNULL ((1))); 401 _GL_ARG_NONNULL ((1)));
392_GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer)); 402_GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer));
393# else 403# else
@@ -403,7 +413,7 @@ _GL_CXXALIASWARN (gmtime);
403# if ! @HAVE_STRPTIME@ 413# if ! @HAVE_STRPTIME@
404_GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf, 414_GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf,
405 char const *restrict __format, 415 char const *restrict __format,
406 struct tm *restrict __tm) 416 struct tm *restrict __tm),
407 _GL_ARG_NONNULL ((1, 2, 3))); 417 _GL_ARG_NONNULL ((1, 2, 3)));
408# endif 418# endif
409_GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, 419_GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
@@ -411,7 +421,6 @@ _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
411 struct tm *restrict __tm)); 421 struct tm *restrict __tm));
412_GL_CXXALIASWARN (strptime); 422_GL_CXXALIASWARN (strptime);
413# elif defined GNULIB_POSIXCHECK 423# elif defined GNULIB_POSIXCHECK
414# undef strptime
415# if HAVE_RAW_DECL_STRPTIME 424# if HAVE_RAW_DECL_STRPTIME
416_GL_WARN_ON_USE (strptime, "strptime is unportable - " 425_GL_WARN_ON_USE (strptime, "strptime is unportable - "
417 "use gnulib module strptime for portability"); 426 "use gnulib module strptime for portability");
@@ -428,7 +437,7 @@ _GL_WARN_ON_USE (strptime, "strptime is unportable - "
428# ifndef __cplusplus 437# ifndef __cplusplus
429_GL_ATTRIBUTE_DEPRECATED 438_GL_ATTRIBUTE_DEPRECATED
430# endif 439# endif
431_GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp) 440_GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp),
432 _GL_ARG_NONNULL ((1))); 441 _GL_ARG_NONNULL ((1)));
433_GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp)); 442_GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp));
434# else 443# else
@@ -450,7 +459,7 @@ _GL_CXXALIASWARN (ctime);
450# endif 459# endif
451_GL_FUNCDECL_RPL (strftime, size_t, 460_GL_FUNCDECL_RPL (strftime, size_t,
452 (char *restrict __buf, size_t __bufsize, 461 (char *restrict __buf, size_t __bufsize,
453 const char *restrict __fmt, const struct tm *restrict __tp) 462 const char *restrict __fmt, const struct tm *restrict __tp),
454 _GL_ARG_NONNULL ((1, 3, 4))); 463 _GL_ARG_NONNULL ((1, 3, 4)));
455_GL_CXXALIAS_RPL (strftime, size_t, 464_GL_CXXALIAS_RPL (strftime, size_t,
456 (char *restrict __buf, size_t __bufsize, 465 (char *restrict __buf, size_t __bufsize,
@@ -464,21 +473,30 @@ _GL_CXXALIAS_SYS (strftime, size_t,
464_GL_CXXALIASWARN (strftime); 473_GL_CXXALIASWARN (strftime);
465# endif 474# endif
466# elif defined GNULIB_POSIXCHECK 475# elif defined GNULIB_POSIXCHECK
467# undef strftime
468# if HAVE_RAW_DECL_STRFTIME 476# if HAVE_RAW_DECL_STRFTIME
469_GL_WARN_ON_USE (strftime, "strftime has portability problems - " 477_GL_WARN_ON_USE (strftime, "strftime has portability problems - "
470 "use gnulib module strftime-fixes for portability"); 478 "use gnulib module strftime-fixes for portability");
471# endif 479# endif
472# endif 480# endif
473 481
474# if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@ 482# if @GNULIB_TIME_RZ@
475/* Functions that use a first-class time zone data type, instead of 483/* Functions that use a first-class time zone data type, instead of
476 relying on an implicit global time zone. 484 relying on an implicit global time zone.
477 Inspired by NetBSD. */ 485 Inspired by NetBSD. */
478 486
479/* Represents a time zone. 487/* Represents a time zone.
480 (timezone_t) NULL stands for UTC. */ 488 (timezone_t) NULL stands for UTC. */
489# if !@HAVE_TZALLOC@
490# if !GNULIB_defined_timezone_t
491# if !@HAVE_TIMEZONE_T@
481typedef struct tm_zone *timezone_t; 492typedef struct tm_zone *timezone_t;
493# else
494typedef struct tm_zone *rpl_timezone_t;
495# define timezone_t rpl_timezone_t
496# endif
497# define GNULIB_defined_timezone_t 1
498# endif
499# endif
482 500
483/* tzalloc (name) 501/* tzalloc (name)
484 Returns a time zone object for the given time zone NAME. This object 502 Returns a time zone object for the given time zone NAME. This object
@@ -488,37 +506,79 @@ typedef struct tm_zone *timezone_t;
488 would use it the TZ environment variable was unset. 506 would use it the TZ environment variable was unset.
489 May return NULL if NAME is invalid (this is platform dependent) or 507 May return NULL if NAME is invalid (this is platform dependent) or
490 upon memory allocation failure. */ 508 upon memory allocation failure. */
491_GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name)); 509# if !@HAVE_TZALLOC@
510_GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name), );
492_GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name)); 511_GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name));
512# endif
493 513
494/* tzfree (tz) 514/* tzfree (tz)
495 Frees a time zone object. 515 Free a time zone object, preserving errno.
496 The argument must have been returned by tzalloc(). */ 516 The argument must have been returned by tzalloc(). */
497_GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz)); 517# if !@HAVE_TZALLOC@
518_GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz), );
498_GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz)); 519_GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz));
520# else
521# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
522# undef tzfree
523# define tzfree rpl_tzfree
524# endif
525_GL_FUNCDECL_RPL (tzfree, void, (timezone_t __tz), );
526_GL_CXXALIAS_RPL (tzfree, void, (timezone_t __tz));
527# endif
499 528
500/* localtime_rz (tz, &t, &result) 529/* localtime_rz (tz, &t, &result)
501 Converts an absolute time T to a broken-down time RESULT, assuming the 530 Converts an absolute time T to a broken-down time RESULT, assuming the
502 time zone TZ. 531 time zone TZ.
503 This function is like 'localtime_r', but relies on the argument TZ instead 532 This function is like 'localtime_r', but relies on the argument TZ instead
504 of an implicit global time zone. */ 533 of an implicit global time zone. */
534# if @REPLACE_LOCALTIME_RZ@
535# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
536# undef localtime_rz
537# define localtime_rz rpl_localtime_rz
538# endif
539_GL_FUNCDECL_RPL (localtime_rz, struct tm *,
540 (timezone_t __tz, time_t const *restrict __timer,
541 struct tm *restrict __result),
542 _GL_ARG_NONNULL ((2, 3)));
543_GL_CXXALIAS_RPL (localtime_rz, struct tm *,
544 (timezone_t __tz, time_t const *restrict __timer,
545 struct tm *restrict __result));
546# else
547# if !@HAVE_TZALLOC@
505_GL_FUNCDECL_SYS (localtime_rz, struct tm *, 548_GL_FUNCDECL_SYS (localtime_rz, struct tm *,
506 (timezone_t __tz, time_t const *restrict __timer, 549 (timezone_t __tz, time_t const *restrict __timer,
507 struct tm *restrict __result) _GL_ARG_NONNULL ((2, 3))); 550 struct tm *restrict __result),
551 _GL_ARG_NONNULL ((2, 3)));
552# endif
508_GL_CXXALIAS_SYS (localtime_rz, struct tm *, 553_GL_CXXALIAS_SYS (localtime_rz, struct tm *,
509 (timezone_t __tz, time_t const *restrict __timer, 554 (timezone_t __tz, time_t const *restrict __timer,
510 struct tm *restrict __result)); 555 struct tm *restrict __result));
556# endif
511 557
512/* mktime_z (tz, &tm) 558/* mktime_z (tz, &tm)
513 Normalizes the broken-down time TM and converts it to an absolute time, 559 Normalizes the broken-down time TM and converts it to an absolute time,
514 assuming the time zone TZ. Returns the absolute time. 560 assuming the time zone TZ. Returns the absolute time.
515 This function is like 'mktime', but relies on the argument TZ instead 561 This function is like 'mktime', but relies on the argument TZ instead
516 of an implicit global time zone. */ 562 of an implicit global time zone. */
563# if @REPLACE_MKTIME_Z@
564# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
565# undef mktime_z
566# define mktime_z rpl_mktime_z
567# endif
568_GL_FUNCDECL_RPL (mktime_z, time_t,
569 (timezone_t __tz, struct tm *restrict __tm),
570 _GL_ARG_NONNULL ((2)));
571_GL_CXXALIAS_RPL (mktime_z, time_t,
572 (timezone_t __tz, struct tm *restrict __tm));
573# else
574# if !@HAVE_TZALLOC@
517_GL_FUNCDECL_SYS (mktime_z, time_t, 575_GL_FUNCDECL_SYS (mktime_z, time_t,
518 (timezone_t __tz, struct tm *restrict __tm) 576 (timezone_t __tz, struct tm *restrict __tm),
519 _GL_ARG_NONNULL ((2))); 577 _GL_ARG_NONNULL ((2)));
578# endif
520_GL_CXXALIAS_SYS (mktime_z, time_t, 579_GL_CXXALIAS_SYS (mktime_z, time_t,
521 (timezone_t __tz, struct tm *restrict __tm)); 580 (timezone_t __tz, struct tm *restrict __tm));
581# endif
522 582
523/* Time zone abbreviation strings (returned by 'localtime_rz' or 'mktime_z' 583/* Time zone abbreviation strings (returned by 'localtime_rz' or 'mktime_z'
524 in the 'tm_zone' member of 'struct tm') are valid as long as 584 in the 'tm_zone' member of 'struct tm') are valid as long as
@@ -535,11 +595,11 @@ _GL_CXXALIAS_SYS (mktime_z, time_t,
535# undef timegm 595# undef timegm
536# define timegm rpl_timegm 596# define timegm rpl_timegm
537# endif 597# endif
538_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); 598_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm), _GL_ARG_NONNULL ((1)));
539_GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm)); 599_GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm));
540# else 600# else
541# if ! @HAVE_TIMEGM@ 601# if ! @HAVE_TIMEGM@
542_GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); 602_GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm), _GL_ARG_NONNULL ((1)));
543# endif 603# endif
544_GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm)); 604_GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm));
545# endif 605# endif
@@ -547,7 +607,6 @@ _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm));
547_GL_CXXALIASWARN (timegm); 607_GL_CXXALIASWARN (timegm);
548# endif 608# endif
549# elif defined GNULIB_POSIXCHECK 609# elif defined GNULIB_POSIXCHECK
550# undef timegm
551# if HAVE_RAW_DECL_TIMEGM 610# if HAVE_RAW_DECL_TIMEGM
552_GL_WARN_ON_USE (timegm, "timegm is unportable - " 611_GL_WARN_ON_USE (timegm, "timegm is unportable - "
553 "use gnulib module timegm for portability"); 612 "use gnulib module timegm for portability");
@@ -558,28 +617,24 @@ _GL_WARN_ON_USE (timegm, "timegm is unportable - "
558 buffers when given outlandish struct tm values. Portable 617 buffers when given outlandish struct tm values. Portable
559 applications should use strftime (or even sprintf) instead. */ 618 applications should use strftime (or even sprintf) instead. */
560# if defined GNULIB_POSIXCHECK 619# if defined GNULIB_POSIXCHECK
561# undef asctime
562# if HAVE_RAW_DECL_ASCTIME 620# if HAVE_RAW_DECL_ASCTIME
563_GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - " 621_GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - "
564 "better use strftime (or even sprintf) instead"); 622 "better use strftime (or even sprintf) instead");
565# endif 623# endif
566# endif 624# endif
567# if defined GNULIB_POSIXCHECK 625# if defined GNULIB_POSIXCHECK
568# undef asctime_r
569# if HAVE_RAW_DECL_ASCTIME_R 626# if HAVE_RAW_DECL_ASCTIME_R
570_GL_WARN_ON_USE (asctime_r, "asctime_r can overrun buffers in some cases - " 627_GL_WARN_ON_USE (asctime_r, "asctime_r can overrun buffers in some cases - "
571 "better use strftime (or even sprintf) instead"); 628 "better use strftime (or even sprintf) instead");
572# endif 629# endif
573# endif 630# endif
574# if defined GNULIB_POSIXCHECK 631# if defined GNULIB_POSIXCHECK
575# undef ctime
576# if HAVE_RAW_DECL_CTIME 632# if HAVE_RAW_DECL_CTIME
577_GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - " 633_GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - "
578 "better use strftime (or even sprintf) instead"); 634 "better use strftime (or even sprintf) instead");
579# endif 635# endif
580# endif 636# endif
581# if defined GNULIB_POSIXCHECK 637# if defined GNULIB_POSIXCHECK
582# undef ctime_r
583# if HAVE_RAW_DECL_CTIME_R 638# if HAVE_RAW_DECL_CTIME_R
584_GL_WARN_ON_USE (ctime_r, "ctime_r can overrun buffers in some cases - " 639_GL_WARN_ON_USE (ctime_r, "ctime_r can overrun buffers in some cases - "
585 "better use strftime (or even sprintf) instead"); 640 "better use strftime (or even sprintf) instead");
diff --git a/gl/time_r.c b/gl/time_r.c
index b724f3b3..dfc427f6 100644
--- a/gl/time_r.c
+++ b/gl/time_r.c
@@ -1,6 +1,6 @@
1/* Reentrant time functions like localtime_r. 1/* Reentrant time functions like localtime_r.
2 2
3 Copyright (C) 2003, 2006-2007, 2010-2024 Free Software Foundation, Inc. 3 Copyright (C) 2003, 2006-2007, 2010-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/timegm.c b/gl/timegm.c
index e5cf30c0..0862b6e9 100644
--- a/gl/timegm.c
+++ b/gl/timegm.c
@@ -1,6 +1,6 @@
1/* Convert UTC calendar time to simple time. Like mktime but assumes UTC. 1/* Convert UTC calendar time to simple time. Like mktime but assumes UTC.
2 2
3 Copyright (C) 1994-2024 Free Software Foundation, Inc. 3 Copyright (C) 1994-2026 Free Software Foundation, Inc.
4 This file is part of the GNU C Library. 4 This file is part of the GNU C Library.
5 5
6 The GNU C Library is free software; you can redistribute it and/or 6 The GNU C Library is free software; you can redistribute it and/or
@@ -30,8 +30,7 @@ __time64_t
30__timegm64 (struct tm *tmp) 30__timegm64 (struct tm *tmp)
31{ 31{
32 static mktime_offset_t gmtime_offset; 32 static mktime_offset_t gmtime_offset;
33 tmp->tm_isdst = 0; 33 return __mktime_internal (tmp, false, &gmtime_offset);
34 return __mktime_internal (tmp, __gmtime64_r, &gmtime_offset);
35} 34}
36 35
37#if defined _LIBC && __TIMESIZE != 64 36#if defined _LIBC && __TIMESIZE != 64
diff --git a/gl/uchar.in.h b/gl/uchar.in.h
new file mode 100644
index 00000000..300f7b5f
--- /dev/null
+++ b/gl/uchar.in.h
@@ -0,0 +1,909 @@
1/* <uchar.h> substitute - 16-bit and 32-bit wide character types.
2 Copyright (C) 2019-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17/* Written by Bruno Haible <bruno@clisp.org>, 2019. */
18
19/*
20 * ISO C 23 <uchar.h> for platforms that lack it.
21 */
22
23#ifndef _@GUARD_PREFIX@_UCHAR_H
24
25#if __GNUC__ >= 3
26@PRAGMA_SYSTEM_HEADER@
27#endif
28@PRAGMA_COLUMNS@
29
30/* The include_next requires a split double-inclusion guard. */
31#if (defined __cplusplus ? @CXX_HAVE_UCHAR_H@ : @HAVE_UCHAR_H@)
32# if defined __HAIKU__
33/* Work around <https://dev.haiku-os.org/ticket/17040>. */
34# include <stdint.h>
35# endif
36/* On AIX 7.2 with xlclang++, /usr/include/uchar.h produces compilation errors
37 because it contains typedef definitions of char16_t and char32_t, however
38 char16_t and char32_t are keywords in this situation. To work around it,
39 define char16_t and char32_t as macros. */
40# if defined __cplusplus && defined _AIX && defined __ibmxl__ && defined __clang__
41# define char16_t gl_char16_t
42# define char32_t gl_char32_t
43# endif
44# @INCLUDE_NEXT@ @NEXT_UCHAR_H@
45#endif
46
47#ifndef _@GUARD_PREFIX@_UCHAR_H
48#define _@GUARD_PREFIX@_UCHAR_H
49
50/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_BEGIN_C_LINKAGE,
51 _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
52#if !_GL_CONFIG_H_INCLUDED
53 #error "Please include config.h first."
54#endif
55
56/* Get uint_least16_t, uint_least32_t. */
57#include <stdint.h>
58
59/* Get mbstate_t, size_t. */
60#include <wchar.h>
61
62/* For the inline functions. */
63#include <string.h>
64#include <wctype.h>
65
66/* The __attribute__ feature is available in gcc versions 2.5 and later.
67 The attribute __pure__ was added in gcc 2.96. */
68#ifndef _GL_ATTRIBUTE_PURE
69# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
70# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
71# else
72# define _GL_ATTRIBUTE_PURE /* empty */
73# endif
74#endif
75
76/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
77
78/* The definition of _GL_ARG_NONNULL is copied here. */
79
80/* The definition of _GL_WARN_ON_USE is copied here. */
81
82
83_GL_INLINE_HEADER_BEGIN
84
85
86#if !(defined __cplusplus ? @CXX_HAVE_UCHAR_H@ || @CXX_HAS_CHAR8_TYPE@ : @HAVE_UCHAR_H@)
87
88/* An 8-bit variant of wchar_t.
89 Note: This type is only mandated by ISO C 23 or newer, and it does
90 denote UTF-8 units. */
91typedef unsigned char char8_t;
92
93#elif @GNULIBHEADERS_OVERRIDE_CHAR8_T@
94
95typedef unsigned char gl_char8_t;
96# define char8_t gl_char8_t
97
98#endif
99
100#if !(defined __cplusplus ? @CXX_HAVE_UCHAR_H@ || @CXX_HAS_UCHAR_TYPES@ : @HAVE_UCHAR_H@)
101
102/* A 16-bit variant of wchar_t.
103 Note: This type is only mandated by ISO C 11 or newer. In ISO C 23
104 and newer, it denotes UTF-16 units; in older versions of ISO C it did
105 so only on platforms on which __STDC_UTF_16__ was defined. */
106typedef uint_least16_t char16_t;
107
108#elif @GNULIBHEADERS_OVERRIDE_CHAR16_T@
109
110typedef uint_least16_t gl_char16_t;
111# define char16_t gl_char16_t
112
113#endif
114
115#if !(defined __cplusplus ? @CXX_HAVE_UCHAR_H@ || @CXX_HAS_UCHAR_TYPES@ : @HAVE_UCHAR_H@)
116
117/* A 32-bit variant of wchar_t.
118 Note: This type is only mandated by ISO C 11 or newer. In ISO C 23
119 and newer, it denotes UTF-32 code points; in older versions of ISO C
120 it did so only on platforms on which __STDC_UTF_32__ was defined.
121 In gnulib, we guarantee that it denotes UTF-32 code points if and
122 only if the module 'uchar-h-c23' is in use. */
123typedef uint_least32_t char32_t;
124
125#elif @GNULIBHEADERS_OVERRIDE_CHAR32_T@
126
127typedef uint_least32_t gl_char32_t;
128# define char32_t gl_char32_t
129
130#endif
131
132/* Define if a 'char32_t' can hold more characters than a 'wchar_t'. */
133#if @SMALL_WCHAR_T@ /* 32-bit AIX, Cygwin, native Windows */
134# define _GL_SMALL_WCHAR_T 1
135#endif
136
137/* Define if 'wchar_t', like 'char32_t',
138 - is a 32-bit type, and
139 - represents Unicode code points.
140 For this test, we can use __STDC_ISO_10646__ (defined by glibc, musl libc,
141 Cygwin) but need to consider _GL_SMALL_WCHAR_T, so as to exclude Cygwin.
142 We cannot use __STDC_UTF_16__ or __STDC_UTF_32__
143 - because these macros provide info about char16_t and char32_t (not
144 wchar_t!), and
145 - because GCC >= 4.9 defines these macros on all platforms, even on
146 FreeBSD and Solaris.
147 We should better not use __STD_UTF_16__, __STD_UTF_32__ either, because
148 these macros are misspellings, only defined by Android's <uchar.h>. */
149#if defined __STDC_ISO_10646__ && !_GL_SMALL_WCHAR_T
150/* glibc, musl libc */
151# define _GL_WCHAR_T_IS_UCS4 1
152#endif
153#if _GL_WCHAR_T_IS_UCS4
154static_assert (sizeof (char32_t) == sizeof (wchar_t));
155#endif
156
157
158/* Convert a single-byte character to a 32-bit wide character. */
159#if @GNULIB_BTOC32@
160# if _GL_WCHAR_T_IS_UCS4 && !defined IN_BTOC32
161_GL_BEGIN_C_LINKAGE
162_GL_INLINE _GL_ATTRIBUTE_PURE wint_t
163btoc32 (int c)
164{
165 return
166# if @GNULIB_BTOWC@ && defined __cplusplus && defined GNULIB_NAMESPACE
167 GNULIB_NAMESPACE::
168# endif
169 btowc (c);
170}
171_GL_END_C_LINKAGE
172# else
173_GL_FUNCDECL_SYS (btoc32, wint_t, (int c), _GL_ATTRIBUTE_PURE);
174# endif
175_GL_CXXALIAS_SYS (btoc32, wint_t, (int c));
176_GL_CXXALIASWARN (btoc32);
177#endif
178
179
180/* Test a specific property of a 32-bit wide character. */
181#if @GNULIB_C32ISALNUM@
182# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISALNUM
183_GL_BEGIN_C_LINKAGE
184_GL_INLINE int
185c32isalnum (wint_t wc)
186{
187 return
188# if defined __cplusplus && defined GNULIB_NAMESPACE
189 GNULIB_NAMESPACE::
190# endif
191 iswalnum (wc);
192}
193_GL_END_C_LINKAGE
194# else
195_GL_FUNCDECL_SYS (c32isalnum, int, (wint_t wc), );
196# endif
197_GL_CXXALIAS_SYS (c32isalnum, int, (wint_t wc));
198_GL_CXXALIASWARN (c32isalnum);
199#endif
200#if @GNULIB_C32ISALPHA@
201# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISALPHA
202_GL_BEGIN_C_LINKAGE
203_GL_INLINE int
204c32isalpha (wint_t wc)
205{
206 return
207# if defined __cplusplus && defined GNULIB_NAMESPACE
208 GNULIB_NAMESPACE::
209# endif
210 iswalpha (wc);
211}
212_GL_END_C_LINKAGE
213# else
214_GL_FUNCDECL_SYS (c32isalpha, int, (wint_t wc), );
215# endif
216_GL_CXXALIAS_SYS (c32isalpha, int, (wint_t wc));
217_GL_CXXALIASWARN (c32isalpha);
218#endif
219#if @GNULIB_C32ISBLANK@
220# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISBLANK
221_GL_BEGIN_C_LINKAGE
222_GL_INLINE int
223c32isblank (wint_t wc)
224{
225 return
226# if defined __cplusplus && defined GNULIB_NAMESPACE
227 GNULIB_NAMESPACE::
228# endif
229 iswblank (wc);
230}
231_GL_END_C_LINKAGE
232# else
233_GL_FUNCDECL_SYS (c32isblank, int, (wint_t wc), );
234# endif
235_GL_CXXALIAS_SYS (c32isblank, int, (wint_t wc));
236_GL_CXXALIASWARN (c32isblank);
237#endif
238#if @GNULIB_C32ISCNTRL@
239# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISCNTRL
240_GL_BEGIN_C_LINKAGE
241_GL_INLINE int
242c32iscntrl (wint_t wc)
243{
244 return
245# if defined __cplusplus && defined GNULIB_NAMESPACE
246 GNULIB_NAMESPACE::
247# endif
248 iswcntrl (wc);
249}
250_GL_END_C_LINKAGE
251# else
252_GL_FUNCDECL_SYS (c32iscntrl, int, (wint_t wc), );
253# endif
254_GL_CXXALIAS_SYS (c32iscntrl, int, (wint_t wc));
255_GL_CXXALIASWARN (c32iscntrl);
256#endif
257#if @GNULIB_C32ISDIGIT@
258# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISDIGIT
259_GL_BEGIN_C_LINKAGE
260_GL_INLINE int
261c32isdigit (wint_t wc)
262{
263 return
264# if @GNULIB_ISWDIGIT@ && defined __cplusplus && defined GNULIB_NAMESPACE
265 GNULIB_NAMESPACE::
266# endif
267 iswdigit (wc);
268}
269_GL_END_C_LINKAGE
270# else
271_GL_FUNCDECL_SYS (c32isdigit, int, (wint_t wc), );
272# endif
273_GL_CXXALIAS_SYS (c32isdigit, int, (wint_t wc));
274_GL_CXXALIASWARN (c32isdigit);
275#endif
276#if @GNULIB_C32ISGRAPH@
277# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISGRAPH
278_GL_BEGIN_C_LINKAGE
279_GL_INLINE int
280c32isgraph (wint_t wc)
281{
282 return
283# if defined __cplusplus && defined GNULIB_NAMESPACE
284 GNULIB_NAMESPACE::
285# endif
286 iswgraph (wc);
287}
288_GL_END_C_LINKAGE
289# else
290_GL_FUNCDECL_SYS (c32isgraph, int, (wint_t wc), );
291# endif
292_GL_CXXALIAS_SYS (c32isgraph, int, (wint_t wc));
293_GL_CXXALIASWARN (c32isgraph);
294#endif
295#if @GNULIB_C32ISLOWER@
296# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISLOWER
297_GL_BEGIN_C_LINKAGE
298_GL_INLINE int
299c32islower (wint_t wc)
300{
301 return
302# if defined __cplusplus && defined GNULIB_NAMESPACE
303 GNULIB_NAMESPACE::
304# endif
305 iswlower (wc);
306}
307_GL_END_C_LINKAGE
308# else
309_GL_FUNCDECL_SYS (c32islower, int, (wint_t wc), );
310# endif
311_GL_CXXALIAS_SYS (c32islower, int, (wint_t wc));
312_GL_CXXALIASWARN (c32islower);
313#endif
314#if @GNULIB_C32ISPRINT@
315# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISPRINT
316_GL_BEGIN_C_LINKAGE
317_GL_INLINE int
318c32isprint (wint_t wc)
319{
320 return
321# if defined __cplusplus && defined GNULIB_NAMESPACE
322 GNULIB_NAMESPACE::
323# endif
324 iswprint (wc);
325}
326_GL_END_C_LINKAGE
327# else
328_GL_FUNCDECL_SYS (c32isprint, int, (wint_t wc), );
329# endif
330_GL_CXXALIAS_SYS (c32isprint, int, (wint_t wc));
331_GL_CXXALIASWARN (c32isprint);
332#endif
333#if @GNULIB_C32ISPUNCT@
334# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISPUNCT
335_GL_BEGIN_C_LINKAGE
336_GL_INLINE int
337c32ispunct (wint_t wc)
338{
339 return
340# if defined __cplusplus && defined GNULIB_NAMESPACE
341 GNULIB_NAMESPACE::
342# endif
343 iswpunct (wc);
344}
345_GL_END_C_LINKAGE
346# else
347_GL_FUNCDECL_SYS (c32ispunct, int, (wint_t wc), );
348# endif
349_GL_CXXALIAS_SYS (c32ispunct, int, (wint_t wc));
350_GL_CXXALIASWARN (c32ispunct);
351#endif
352#if @GNULIB_C32ISSPACE@
353# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISSPACE
354_GL_BEGIN_C_LINKAGE
355_GL_INLINE int
356c32isspace (wint_t wc)
357{
358 return
359# if defined __cplusplus && defined GNULIB_NAMESPACE
360 GNULIB_NAMESPACE::
361# endif
362 iswspace (wc);
363}
364_GL_END_C_LINKAGE
365# else
366_GL_FUNCDECL_SYS (c32isspace, int, (wint_t wc), );
367# endif
368_GL_CXXALIAS_SYS (c32isspace, int, (wint_t wc));
369_GL_CXXALIASWARN (c32isspace);
370#endif
371#if @GNULIB_C32ISUPPER@
372# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISUPPER
373_GL_BEGIN_C_LINKAGE
374_GL_INLINE int
375c32isupper (wint_t wc)
376{
377 return
378# if defined __cplusplus && defined GNULIB_NAMESPACE
379 GNULIB_NAMESPACE::
380# endif
381 iswupper (wc);
382}
383_GL_END_C_LINKAGE
384# else
385_GL_FUNCDECL_SYS (c32isupper, int, (wint_t wc), );
386# endif
387_GL_CXXALIAS_SYS (c32isupper, int, (wint_t wc));
388_GL_CXXALIASWARN (c32isupper);
389#endif
390#if @GNULIB_C32ISXDIGIT@
391# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISXDIGIT
392_GL_BEGIN_C_LINKAGE
393_GL_INLINE int
394c32isxdigit (wint_t wc)
395{
396 return
397# if @GNULIB_ISWXDIGIT@ && defined __cplusplus && defined GNULIB_NAMESPACE
398 GNULIB_NAMESPACE::
399# endif
400 iswxdigit (wc);
401}
402_GL_END_C_LINKAGE
403# else
404_GL_FUNCDECL_SYS (c32isxdigit, int, (wint_t wc), );
405# endif
406_GL_CXXALIAS_SYS (c32isxdigit, int, (wint_t wc));
407_GL_CXXALIASWARN (c32isxdigit);
408#endif
409
410
411/* Case mapping of a 32-bit wide character. */
412#if @GNULIB_C32TOLOWER@
413# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32TOLOWER
414_GL_BEGIN_C_LINKAGE
415_GL_INLINE wint_t
416c32tolower (wint_t wc)
417{
418 return
419# if defined __cplusplus && defined GNULIB_NAMESPACE
420 GNULIB_NAMESPACE::
421# endif
422 towlower (wc);
423}
424_GL_END_C_LINKAGE
425# else
426_GL_FUNCDECL_SYS (c32tolower, wint_t, (wint_t wc), );
427# endif
428_GL_CXXALIAS_SYS (c32tolower, wint_t, (wint_t wc));
429_GL_CXXALIASWARN (c32tolower);
430#endif
431#if @GNULIB_C32TOUPPER@
432# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32TOUPPER
433_GL_BEGIN_C_LINKAGE
434_GL_INLINE wint_t
435c32toupper (wint_t wc)
436{
437 return
438# if defined __cplusplus && defined GNULIB_NAMESPACE
439 GNULIB_NAMESPACE::
440# endif
441 towupper (wc);
442}
443_GL_END_C_LINKAGE
444# else
445_GL_FUNCDECL_SYS (c32toupper, wint_t, (wint_t wc), );
446# endif
447_GL_CXXALIAS_SYS (c32toupper, wint_t, (wint_t wc));
448_GL_CXXALIASWARN (c32toupper);
449#endif
450
451
452/* Number of screen columns needed for a 32-bit wide character. */
453#if @GNULIB_C32WIDTH@
454# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32WIDTH
455_GL_BEGIN_C_LINKAGE
456_GL_INLINE int
457c32width (char32_t wc)
458{
459 return
460# if @GNULIB_WCWIDTH@ && defined __cplusplus && defined GNULIB_NAMESPACE
461 GNULIB_NAMESPACE::
462# endif
463 wcwidth (wc);
464}
465_GL_END_C_LINKAGE
466# else
467_GL_FUNCDECL_SYS (c32width, int, (char32_t wc), );
468# endif
469_GL_CXXALIAS_SYS (c32width, int, (char32_t wc));
470_GL_CXXALIASWARN (c32width);
471#endif
472
473
474/* Converts a 32-bit wide character to a multibyte character. */
475#if @GNULIB_C32RTOMB@
476# if @REPLACE_C32RTOMB@
477# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
478# undef c32rtomb
479# define c32rtomb rpl_c32rtomb
480# endif
481_GL_FUNCDECL_RPL (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps), );
482_GL_CXXALIAS_RPL (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps));
483# else
484# if !@HAVE_C32RTOMB@
485_GL_FUNCDECL_SYS (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps), );
486# endif
487_GL_CXXALIAS_SYS (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps));
488# endif
489# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
490_GL_CXXALIASWARN (c32rtomb);
491# endif
492#elif defined GNULIB_POSIXCHECK
493# if HAVE_RAW_DECL_C32RTOMB
494_GL_WARN_ON_USE (c32rtomb, "c32rtomb is not portable - "
495 "use gnulib module c32rtomb for portability");
496# endif
497#endif
498
499
500/* Convert a 32-bit wide string to a string. */
501#if @GNULIB_C32SNRTOMBS@
502# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32SNRTOMBS
503_GL_BEGIN_C_LINKAGE
504_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
505c32snrtombs (char *dest, const char32_t **srcp, size_t srclen, size_t len,
506 mbstate_t *ps)
507{
508 return
509# if @GNULIB_WCSNRTOMBS@ && defined __cplusplus && defined GNULIB_NAMESPACE
510 GNULIB_NAMESPACE::
511# endif
512 wcsnrtombs (dest, (const wchar_t **) srcp, srclen, len, ps);
513}
514_GL_END_C_LINKAGE
515# else
516_GL_FUNCDECL_SYS (c32snrtombs, size_t,
517 (char *dest, const char32_t **srcp, size_t srclen, size_t len,
518 mbstate_t *ps),
519 _GL_ARG_NONNULL ((2)));
520# endif
521_GL_CXXALIAS_SYS (c32snrtombs, size_t,
522 (char *dest, const char32_t **srcp, size_t srclen, size_t len,
523 mbstate_t *ps));
524_GL_CXXALIASWARN (c32snrtombs);
525#endif
526
527
528/* Convert a 32-bit wide string to a string. */
529#if @GNULIB_C32SRTOMBS@
530# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32SRTOMBS
531_GL_BEGIN_C_LINKAGE
532_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
533c32srtombs (char *dest, const char32_t **srcp, size_t len, mbstate_t *ps)
534{
535 return
536# if @GNULIB_WCSRTOMBS@ && defined __cplusplus && defined GNULIB_NAMESPACE
537 GNULIB_NAMESPACE::
538# endif
539 wcsrtombs (dest, (const wchar_t **) srcp, len, ps);
540}
541_GL_END_C_LINKAGE
542# else
543_GL_FUNCDECL_SYS (c32srtombs, size_t,
544 (char *dest, const char32_t **srcp, size_t len,
545 mbstate_t *ps),
546 _GL_ARG_NONNULL ((2)));
547# endif
548_GL_CXXALIAS_SYS (c32srtombs, size_t,
549 (char *dest, const char32_t **srcp, size_t len,
550 mbstate_t *ps));
551_GL_CXXALIASWARN (c32srtombs);
552#endif
553
554
555/* Convert a 32-bit wide string to a string. */
556#if @GNULIB_C32STOMBS@
557# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32STOMBS
558_GL_BEGIN_C_LINKAGE
559_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
560c32stombs (char *dest, const char32_t *src, size_t len)
561{
562 mbstate_t state;
563
564 mbszero (&state);
565 return c32srtombs (dest, &src, len, &state);
566}
567_GL_END_C_LINKAGE
568# else
569_GL_FUNCDECL_SYS (c32stombs, size_t,
570 (char *dest, const char32_t *src, size_t len),
571 _GL_ARG_NONNULL ((2)));
572# endif
573_GL_CXXALIAS_SYS (c32stombs, size_t,
574 (char *dest, const char32_t *src, size_t len));
575_GL_CXXALIASWARN (c32stombs);
576#endif
577
578
579/* Number of screen columns needed for a size-bounded 32-bit wide string. */
580#if @GNULIB_C32SWIDTH@
581# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32SWIDTH
582_GL_BEGIN_C_LINKAGE
583_GL_INLINE _GL_ARG_NONNULL ((1)) int
584c32swidth (const char32_t *s, size_t n)
585{
586 return
587# if @GNULIB_WCSWIDTH@ && defined __cplusplus && defined GNULIB_NAMESPACE
588 GNULIB_NAMESPACE::
589# endif
590 wcswidth ((const wchar_t *) s, n);
591}
592_GL_END_C_LINKAGE
593# else
594_GL_FUNCDECL_SYS (c32swidth, int, (const char32_t *s, size_t n),
595 _GL_ARG_NONNULL ((1)));
596# endif
597_GL_CXXALIAS_SYS (c32swidth, int, (const char32_t *s, size_t n));
598_GL_CXXALIASWARN (c32swidth);
599#endif
600
601
602/* Converts a 32-bit wide character to unibyte character.
603 Returns the single-byte representation of WC if it exists,
604 or EOF otherwise. */
605#if @GNULIB_C32TOB@
606# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32TOB
607_GL_BEGIN_C_LINKAGE
608_GL_INLINE int
609c32tob (wint_t wc)
610{
611 return
612# if @GNULIB_WCTOB@ && defined __cplusplus && defined GNULIB_NAMESPACE
613 GNULIB_NAMESPACE::
614# endif
615 wctob (wc);
616}
617_GL_END_C_LINKAGE
618# else
619_GL_FUNCDECL_SYS (c32tob, int, (wint_t wc), );
620# endif
621_GL_CXXALIAS_SYS (c32tob, int, (wint_t wc));
622_GL_CXXALIASWARN (c32tob);
623#endif
624
625
626/* Converts a multibyte character to a 32-bit wide character. */
627#if @GNULIB_MBRTOC32@
628# if @REPLACE_MBRTOC32@
629# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
630# undef mbrtoc32
631# define mbrtoc32 rpl_mbrtoc32
632# endif
633_GL_FUNCDECL_RPL (mbrtoc32, size_t,
634 (char32_t *pc, const char *s, size_t n, mbstate_t *ps), );
635_GL_CXXALIAS_RPL (mbrtoc32, size_t,
636 (char32_t *pc, const char *s, size_t n, mbstate_t *ps));
637# else
638# if !@HAVE_MBRTOC32@
639_GL_FUNCDECL_SYS (mbrtoc32, size_t,
640 (char32_t *pc, const char *s, size_t n, mbstate_t *ps), );
641# endif
642_GL_CXXALIAS_SYS (mbrtoc32, size_t,
643 (char32_t *pc, const char *s, size_t n, mbstate_t *ps));
644# endif
645# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
646_GL_CXXALIASWARN (mbrtoc32);
647# endif
648#elif defined GNULIB_POSIXCHECK
649# if HAVE_RAW_DECL_MBRTOC32
650_GL_WARN_ON_USE (mbrtoc32, "mbrtoc32 is not portable - "
651 "use gnulib module mbrtoc32 for portability");
652# endif
653#endif
654
655
656/* Converts a multibyte character and returns the next 16-bit wide
657 character. */
658#if @GNULIB_MBRTOC16@
659# if @REPLACE_MBRTOC16@
660# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
661# undef mbrtoc16
662# define mbrtoc16 rpl_mbrtoc16
663# endif
664_GL_FUNCDECL_RPL (mbrtoc16, size_t,
665 (char16_t *pc, const char *s, size_t n, mbstate_t *ps), );
666_GL_CXXALIAS_RPL (mbrtoc16, size_t,
667 (char16_t *pc, const char *s, size_t n, mbstate_t *ps));
668# else
669# if !@HAVE_MBRTOC16@
670_GL_FUNCDECL_SYS (mbrtoc16, size_t,
671 (char16_t *pc, const char *s, size_t n, mbstate_t *ps), );
672# endif
673_GL_CXXALIAS_SYS (mbrtoc16, size_t,
674 (char16_t *pc, const char *s, size_t n, mbstate_t *ps));
675# endif
676# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
677_GL_CXXALIASWARN (mbrtoc16);
678# endif
679#elif defined GNULIB_POSIXCHECK
680# if HAVE_RAW_DECL_MBRTOC16
681_GL_WARN_ON_USE (mbrtoc16, "mbrtoc16 is not portable - "
682 "use gnulib module mbrtoc16 for portability");
683# endif
684#endif
685
686
687/* Convert a string to a 32-bit wide string. */
688#if @GNULIB_MBSNRTOC32S@
689# if _GL_WCHAR_T_IS_UCS4 && !defined IN_MBSNRTOC32S
690_GL_BEGIN_C_LINKAGE
691_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
692mbsnrtoc32s (char32_t *dest, const char **srcp, size_t srclen, size_t len,
693 mbstate_t *ps)
694{
695 return
696# if @GNULIB_MBSNRTOWCS@ && defined __cplusplus && defined GNULIB_NAMESPACE
697 GNULIB_NAMESPACE::
698# endif
699 mbsnrtowcs ((wchar_t *) dest, srcp, srclen, len, ps);
700}
701_GL_END_C_LINKAGE
702# else
703_GL_FUNCDECL_SYS (mbsnrtoc32s, size_t,
704 (char32_t *dest, const char **srcp, size_t srclen, size_t len,
705 mbstate_t *ps),
706 _GL_ARG_NONNULL ((2)));
707# endif
708_GL_CXXALIAS_SYS (mbsnrtoc32s, size_t,
709 (char32_t *dest, const char **srcp, size_t srclen, size_t len,
710 mbstate_t *ps));
711_GL_CXXALIASWARN (mbsnrtoc32s);
712#endif
713
714
715/* Convert a string to a 32-bit wide string. */
716#if @GNULIB_MBSRTOC32S@
717# if _GL_WCHAR_T_IS_UCS4 && !defined IN_MBSRTOC32S
718_GL_BEGIN_C_LINKAGE
719_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
720mbsrtoc32s (char32_t *dest, const char **srcp, size_t len, mbstate_t *ps)
721{
722 return
723# if @GNULIB_MBSRTOWCS@ && defined __cplusplus && defined GNULIB_NAMESPACE
724 GNULIB_NAMESPACE::
725# endif
726 mbsrtowcs ((wchar_t *) dest, srcp, len, ps);
727}
728_GL_END_C_LINKAGE
729# else
730_GL_FUNCDECL_SYS (mbsrtoc32s, size_t,
731 (char32_t *dest, const char **srcp, size_t len,
732 mbstate_t *ps),
733 _GL_ARG_NONNULL ((2)));
734# endif
735_GL_CXXALIAS_SYS (mbsrtoc32s, size_t,
736 (char32_t *dest, const char **srcp, size_t len,
737 mbstate_t *ps));
738_GL_CXXALIASWARN (mbsrtoc32s);
739#endif
740
741
742/* Convert a string to a 32-bit wide string. */
743#if @GNULIB_MBSTOC32S@
744# if _GL_WCHAR_T_IS_UCS4 && !defined IN_MBSTOC32S
745_GL_BEGIN_C_LINKAGE
746_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
747mbstoc32s (char32_t *dest, const char *src, size_t len)
748{
749 mbstate_t state;
750
751 mbszero (&state);
752 return mbsrtoc32s (dest, &src, len, &state);
753}
754_GL_END_C_LINKAGE
755# else
756_GL_FUNCDECL_SYS (mbstoc32s, size_t,
757 (char32_t *dest, const char *src, size_t len),
758 _GL_ARG_NONNULL ((2)));
759# endif
760_GL_CXXALIAS_SYS (mbstoc32s, size_t,
761 (char32_t *dest, const char *src, size_t len));
762_GL_CXXALIASWARN (mbstoc32s);
763#endif
764
765
766#if @GNULIB_C32_GET_TYPE_TEST@ || @GNULIB_C32_APPLY_TYPE_TEST@
767/* A scalar type. Instances of this type, other than (c32_type_test_t) 0,
768 represent a character property, sometimes also viewed as a "character class".
769 It can be applied to 32-bit wide characters. It is the counterpart of
770 type 'wctype_t' for wide characters.
771 To test whether a given character has a certain property, use the function
772 'c32_apply_type_test'. */
773# if _GL_WCHAR_T_IS_UCS4
774typedef wctype_t c32_type_test_t;
775# else
776typedef /*bool*/int (*c32_type_test_t) (wint_t wc);
777# endif
778#endif
779
780/* Return a character property with the given name, or (c32_type_test_t) 0
781 if the designated property does not exist.
782 This function is the counterpart of function 'wctype' for wide characters.
783 */
784#if @GNULIB_C32_GET_TYPE_TEST@
785# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_GET_TYPE_TEST
786_GL_BEGIN_C_LINKAGE
787_GL_INLINE _GL_ARG_NONNULL ((1)) c32_type_test_t
788c32_get_type_test (const char *name)
789{
790 return
791# if @GNULIB_WCTYPE@ && defined __cplusplus && defined GNULIB_NAMESPACE
792 GNULIB_NAMESPACE::
793# endif
794 wctype (name);
795}
796_GL_END_C_LINKAGE
797# else
798_GL_FUNCDECL_SYS (c32_get_type_test, c32_type_test_t, (const char *name),
799 _GL_ARG_NONNULL ((1)));
800# endif
801_GL_CXXALIAS_SYS (c32_get_type_test, c32_type_test_t, (const char *name));
802_GL_CXXALIASWARN (c32_get_type_test);
803#endif
804
805/* Test whether a given 32-bit wide character has the specified character
806 property.
807 Return non-zero if true, zero if false or if the argument is WEOF.
808 This function is the counterpart of function 'iswctype' for wide characters.
809 */
810#if @GNULIB_C32_APPLY_TYPE_TEST@
811# if _GL_WCHAR_T_IS_UCS4
812# if !defined IN_C32_APPLY_TYPE_TEST
813_GL_BEGIN_C_LINKAGE
814_GL_INLINE int
815c32_apply_type_test (wint_t wc, c32_type_test_t property)
816{
817 return
818# if @GNULIB_ISWCTYPE@ && defined __cplusplus && defined GNULIB_NAMESPACE
819 GNULIB_NAMESPACE::
820# endif
821 iswctype (wc, property);
822}
823_GL_END_C_LINKAGE
824# else
825_GL_FUNCDECL_SYS (c32_apply_type_test, int,
826 (wint_t wc, c32_type_test_t property), );
827# endif
828# else
829_GL_FUNCDECL_SYS (c32_apply_type_test, int,
830 (wint_t wc, c32_type_test_t property),
831 _GL_ARG_NONNULL ((2)));
832# endif
833_GL_CXXALIAS_SYS (c32_apply_type_test, int,
834 (wint_t wc, c32_type_test_t property));
835_GL_CXXALIASWARN (c32_apply_type_test);
836#endif
837
838
839#if @GNULIB_C32_GET_MAPPING@ || @GNULIB_C32_APPLY_MAPPING@
840/* A scalar type. Instances of this type, other than (c32_mapping_t) 0,
841 represent a character mapping. It can be applied to 32-bit wide characters.
842 It is the counterpart of type 'wctrans_t' for wide characters.
843 To apply a certain mapping to a given character, use the function
844 'c32_apply_mapping'. */
845# if _GL_WCHAR_T_IS_UCS4
846typedef wctrans_t c32_mapping_t;
847# else
848typedef wint_t (*c32_mapping_t) (wint_t wc);
849# endif
850#endif
851
852/* Return a character mapping with the given name, or (c32_mapping_t) 0
853 if the designated mapping does not exist.
854 This function is the counterpart of function 'wctrans' for wide characters.
855 */
856#if @GNULIB_C32_GET_MAPPING@
857# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_GET_MAPPING
858_GL_BEGIN_C_LINKAGE
859_GL_INLINE _GL_ARG_NONNULL ((1)) c32_mapping_t
860c32_get_mapping (const char *name)
861{
862 return
863# if @GNULIB_WCTRANS@ && defined __cplusplus && defined GNULIB_NAMESPACE
864 GNULIB_NAMESPACE::
865# endif
866 wctrans (name);
867}
868_GL_END_C_LINKAGE
869# else
870_GL_FUNCDECL_SYS (c32_get_mapping, c32_mapping_t, (const char *name),
871 _GL_ARG_NONNULL ((1)));
872# endif
873_GL_CXXALIAS_SYS (c32_get_mapping, c32_mapping_t, (const char *name));
874_GL_CXXALIASWARN (c32_get_mapping);
875#endif
876
877/* Apply the specified character mapping to a given 32-bit wide character.
878 Return the result of this mapping. Return the WC argument unchanged if it is
879 WEOF.
880 This function is the counterpart of function 'towctrans' for wide characters.
881 */
882#if @GNULIB_C32_APPLY_MAPPING@
883# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_APPLY_MAPPING
884_GL_BEGIN_C_LINKAGE
885_GL_INLINE _GL_ARG_NONNULL ((2)) wint_t
886c32_apply_mapping (wint_t wc, c32_mapping_t mapping)
887{
888 return
889# if @GNULIB_TOWCTRANS@ && defined __cplusplus && defined GNULIB_NAMESPACE
890 GNULIB_NAMESPACE::
891# endif
892 towctrans (wc, mapping);
893}
894_GL_END_C_LINKAGE
895# else
896_GL_FUNCDECL_SYS (c32_apply_mapping, wint_t,
897 (wint_t wc, c32_mapping_t mapping),
898 _GL_ARG_NONNULL ((2)));
899# endif
900_GL_CXXALIAS_SYS (c32_apply_mapping, wint_t,
901 (wint_t wc, c32_mapping_t mapping));
902_GL_CXXALIASWARN (c32_apply_mapping);
903#endif
904
905
906_GL_INLINE_HEADER_END
907
908#endif /* _@GUARD_PREFIX@_UCHAR_H */
909#endif /* _@GUARD_PREFIX@_UCHAR_H */
diff --git a/gl/unicase.in.h b/gl/unicase.in.h
new file mode 100644
index 00000000..e1615aff
--- /dev/null
+++ b/gl/unicase.in.h
@@ -0,0 +1,471 @@
1/* Unicode character case mappings.
2 Copyright (C) 2002, 2009-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#ifndef _UNICASE_H
18#define _UNICASE_H
19
20#include "unitypes.h"
21
22/* Get bool. */
23#include <stdbool.h>
24
25/* Get size_t. */
26#include <stddef.h>
27
28/* Get uninorm_t. */
29#include "uninorm.h"
30
31#if @HAVE_UNISTRING_WOE32DLL_H@
32# include <unistring/woe32dll.h>
33#else
34# define LIBUNISTRING_DLL_VARIABLE
35#endif
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41/* ========================================================================= */
42
43/* Character case mappings.
44 These mappings are locale and context independent.
45 WARNING! These functions are not sufficient for languages such as German.
46 Better use the functions below that treat an entire string at once and are
47 language aware. */
48
49/* Return the uppercase mapping of a Unicode character. */
50extern ucs4_t
51 uc_toupper (ucs4_t uc)
52 _UC_ATTRIBUTE_CONST;
53
54/* Return the lowercase mapping of a Unicode character. */
55extern ucs4_t
56 uc_tolower (ucs4_t uc)
57 _UC_ATTRIBUTE_CONST;
58
59/* Return the titlecase mapping of a Unicode character. */
60extern ucs4_t
61 uc_totitle (ucs4_t uc)
62 _UC_ATTRIBUTE_CONST;
63
64/* ========================================================================= */
65
66/* String case mappings. */
67
68/* These functions are locale dependent. The iso639_language argument
69 identifies the language (e.g. "tr" for Turkish). NULL means to use
70 locale independent case mappings. */
71
72/* Return the ISO 639 language code of the current locale.
73 Return "" if it is unknown, or in the "C" locale. */
74extern const char *
75 uc_locale_language (void)
76 _UC_ATTRIBUTE_PURE;
77
78/* Conventions:
79
80 All functions prefixed with u8_ operate on UTF-8 encoded strings.
81 Their unit is an uint8_t (1 byte).
82
83 All functions prefixed with u16_ operate on UTF-16 encoded strings.
84 Their unit is an uint16_t (a 2-byte word).
85
86 All functions prefixed with u32_ operate on UCS-4 encoded strings.
87 Their unit is an uint32_t (a 4-byte word).
88
89 All argument pairs (s, n) denote a Unicode string s[0..n-1] with exactly
90 n units.
91
92 Functions returning a string result take a (resultbuf, lengthp) argument
93 pair. If resultbuf is not NULL and the result fits into *lengthp units,
94 it is put in resultbuf, and resultbuf is returned. Otherwise, a freshly
95 allocated string is returned. In both cases, *lengthp is set to the
96 length (number of units) of the returned string. In case of error,
97 NULL is returned and errno is set. */
98
99/* Return the uppercase mapping of a string.
100 The nf argument identifies the normalization form to apply after the
101 case-mapping. It can also be NULL, for no normalization. */
102extern uint8_t *
103 u8_toupper (const uint8_t *s, size_t n, const char *iso639_language,
104 uninorm_t nf,
105 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
106extern uint16_t *
107 u16_toupper (const uint16_t *s, size_t n, const char *iso639_language,
108 uninorm_t nf,
109 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
110extern uint32_t *
111 u32_toupper (const uint32_t *s, size_t n, const char *iso639_language,
112 uninorm_t nf,
113 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
114
115/* Return the lowercase mapping of a string.
116 The nf argument identifies the normalization form to apply after the
117 case-mapping. It can also be NULL, for no normalization. */
118extern uint8_t *
119 u8_tolower (const uint8_t *s, size_t n, const char *iso639_language,
120 uninorm_t nf,
121 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
122extern uint16_t *
123 u16_tolower (const uint16_t *s, size_t n, const char *iso639_language,
124 uninorm_t nf,
125 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
126extern uint32_t *
127 u32_tolower (const uint32_t *s, size_t n, const char *iso639_language,
128 uninorm_t nf,
129 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
130
131/* Return the titlecase mapping of a string.
132 The nf argument identifies the normalization form to apply after the
133 case-mapping. It can also be NULL, for no normalization. */
134extern uint8_t *
135 u8_totitle (const uint8_t *s, size_t n, const char *iso639_language,
136 uninorm_t nf,
137 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
138extern uint16_t *
139 u16_totitle (const uint16_t *s, size_t n, const char *iso639_language,
140 uninorm_t nf,
141 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
142extern uint32_t *
143 u32_totitle (const uint32_t *s, size_t n, const char *iso639_language,
144 uninorm_t nf,
145 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
146
147/* The case-mapping context given by a prefix string. */
148typedef struct casing_prefix_context
149 {
150 /* These fields are private, undocumented. */
151 uint32_t last_char_except_ignorable;
152 uint32_t last_char_normal_or_above;
153 }
154 casing_prefix_context_t;
155/* The case-mapping context of the empty prefix string. */
156extern @GNULIB_UNICASE_EMPTY_PREFIX_CONTEXT_DLL_VARIABLE@ const casing_prefix_context_t unicase_empty_prefix_context;
157/* Return the case-mapping context of a given prefix string. */
158extern casing_prefix_context_t
159 u8_casing_prefix_context (const uint8_t *s, size_t n);
160extern casing_prefix_context_t
161 u16_casing_prefix_context (const uint16_t *s, size_t n);
162extern casing_prefix_context_t
163 u32_casing_prefix_context (const uint32_t *s, size_t n);
164/* Return the case-mapping context of the prefix concat(A, S), given the
165 case-mapping context of the prefix A. */
166extern casing_prefix_context_t
167 u8_casing_prefixes_context (const uint8_t *s, size_t n,
168 casing_prefix_context_t a_context);
169extern casing_prefix_context_t
170 u16_casing_prefixes_context (const uint16_t *s, size_t n,
171 casing_prefix_context_t a_context);
172extern casing_prefix_context_t
173 u32_casing_prefixes_context (const uint32_t *s, size_t n,
174 casing_prefix_context_t a_context);
175
176/* The case-mapping context given by a suffix string. */
177typedef struct casing_suffix_context
178 {
179 /* These fields are private, undocumented. */
180 uint32_t first_char_except_ignorable;
181 uint32_t bits;
182 }
183 casing_suffix_context_t;
184/* The case-mapping context of the empty suffix string. */
185extern @GNULIB_UNICASE_EMPTY_SUFFIX_CONTEXT_DLL_VARIABLE@ const casing_suffix_context_t unicase_empty_suffix_context;
186/* Return the case-mapping context of a given suffix string. */
187extern casing_suffix_context_t
188 u8_casing_suffix_context (const uint8_t *s, size_t n);
189extern casing_suffix_context_t
190 u16_casing_suffix_context (const uint16_t *s, size_t n);
191extern casing_suffix_context_t
192 u32_casing_suffix_context (const uint32_t *s, size_t n);
193/* Return the case-mapping context of the suffix concat(S, A), given the
194 case-mapping context of the suffix A. */
195extern casing_suffix_context_t
196 u8_casing_suffixes_context (const uint8_t *s, size_t n,
197 casing_suffix_context_t a_context);
198extern casing_suffix_context_t
199 u16_casing_suffixes_context (const uint16_t *s, size_t n,
200 casing_suffix_context_t a_context);
201extern casing_suffix_context_t
202 u32_casing_suffixes_context (const uint32_t *s, size_t n,
203 casing_suffix_context_t a_context);
204
205/* Return the uppercase mapping of a string that is surrounded by a prefix
206 and a suffix. */
207extern uint8_t *
208 u8_ct_toupper (const uint8_t *s, size_t n,
209 casing_prefix_context_t prefix_context,
210 casing_suffix_context_t suffix_context,
211 const char *iso639_language,
212 uninorm_t nf,
213 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
214extern uint16_t *
215 u16_ct_toupper (const uint16_t *s, size_t n,
216 casing_prefix_context_t prefix_context,
217 casing_suffix_context_t suffix_context,
218 const char *iso639_language,
219 uninorm_t nf,
220 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
221extern uint32_t *
222 u32_ct_toupper (const uint32_t *s, size_t n,
223 casing_prefix_context_t prefix_context,
224 casing_suffix_context_t suffix_context,
225 const char *iso639_language,
226 uninorm_t nf,
227 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
228
229/* Return the lowercase mapping of a string that is surrounded by a prefix
230 and a suffix. */
231extern uint8_t *
232 u8_ct_tolower (const uint8_t *s, size_t n,
233 casing_prefix_context_t prefix_context,
234 casing_suffix_context_t suffix_context,
235 const char *iso639_language,
236 uninorm_t nf,
237 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
238extern uint16_t *
239 u16_ct_tolower (const uint16_t *s, size_t n,
240 casing_prefix_context_t prefix_context,
241 casing_suffix_context_t suffix_context,
242 const char *iso639_language,
243 uninorm_t nf,
244 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
245extern uint32_t *
246 u32_ct_tolower (const uint32_t *s, size_t n,
247 casing_prefix_context_t prefix_context,
248 casing_suffix_context_t suffix_context,
249 const char *iso639_language,
250 uninorm_t nf,
251 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
252
253/* Return the titlecase mapping of a string that is surrounded by a prefix
254 and a suffix. */
255extern uint8_t *
256 u8_ct_totitle (const uint8_t *s, size_t n,
257 casing_prefix_context_t prefix_context,
258 casing_suffix_context_t suffix_context,
259 const char *iso639_language,
260 uninorm_t nf,
261 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
262extern uint16_t *
263 u16_ct_totitle (const uint16_t *s, size_t n,
264 casing_prefix_context_t prefix_context,
265 casing_suffix_context_t suffix_context,
266 const char *iso639_language,
267 uninorm_t nf,
268 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
269extern uint32_t *
270 u32_ct_totitle (const uint32_t *s, size_t n,
271 casing_prefix_context_t prefix_context,
272 casing_suffix_context_t suffix_context,
273 const char *iso639_language,
274 uninorm_t nf,
275 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
276
277/* Return the case folded string.
278 Comparing uN_casefold (S1) and uN_casefold (S2) with uN_cmp2() is equivalent
279 to comparing S1 and S2 with uN_casecmp().
280 The nf argument identifies the normalization form to apply after the
281 case-mapping. It can also be NULL, for no normalization. */
282extern uint8_t *
283 u8_casefold (const uint8_t *s, size_t n, const char *iso639_language,
284 uninorm_t nf,
285 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
286extern uint16_t *
287 u16_casefold (const uint16_t *s, size_t n, const char *iso639_language,
288 uninorm_t nf,
289 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
290extern uint32_t *
291 u32_casefold (const uint32_t *s, size_t n, const char *iso639_language,
292 uninorm_t nf,
293 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
294/* Likewise, for a string that is surrounded by a prefix and a suffix. */
295extern uint8_t *
296 u8_ct_casefold (const uint8_t *s, size_t n,
297 casing_prefix_context_t prefix_context,
298 casing_suffix_context_t suffix_context,
299 const char *iso639_language,
300 uninorm_t nf,
301 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
302extern uint16_t *
303 u16_ct_casefold (const uint16_t *s, size_t n,
304 casing_prefix_context_t prefix_context,
305 casing_suffix_context_t suffix_context,
306 const char *iso639_language,
307 uninorm_t nf,
308 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
309extern uint32_t *
310 u32_ct_casefold (const uint32_t *s, size_t n,
311 casing_prefix_context_t prefix_context,
312 casing_suffix_context_t suffix_context,
313 const char *iso639_language,
314 uninorm_t nf,
315 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
316
317/* Compare S1 and S2, ignoring differences in case and normalization.
318 The nf argument identifies the normalization form to apply after the
319 case-mapping. It can also be NULL, for no normalization.
320 If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2, and
321 return 0. Upon failure, return -1 with errno set. */
322extern int
323 u8_casecmp (const uint8_t *s1, size_t n1,
324 const uint8_t *s2, size_t n2,
325 const char *iso639_language, uninorm_t nf, int *resultp);
326extern int
327 u16_casecmp (const uint16_t *s1, size_t n1,
328 const uint16_t *s2, size_t n2,
329 const char *iso639_language, uninorm_t nf, int *resultp);
330extern int
331 u32_casecmp (const uint32_t *s1, size_t n1,
332 const uint32_t *s2, size_t n2,
333 const char *iso639_language, uninorm_t nf, int *resultp);
334extern int
335 ulc_casecmp (const char *s1, size_t n1,
336 const char *s2, size_t n2,
337 const char *iso639_language, uninorm_t nf, int *resultp);
338
339/* Convert the string S of length N to a NUL-terminated byte sequence, in such
340 a way that comparing uN_casexfrm (S1) and uN_casexfrm (S2) with the gnulib
341 function memcmp2() is equivalent to comparing S1 and S2 with uN_casecoll().
342 NF must be either UNINORM_NFC, UNINORM_NFKC, or NULL for no normalization. */
343extern char *
344 u8_casexfrm (const uint8_t *s, size_t n, const char *iso639_language,
345 uninorm_t nf,
346 char *_UC_RESTRICT resultbuf, size_t *lengthp);
347extern char *
348 u16_casexfrm (const uint16_t *s, size_t n, const char *iso639_language,
349 uninorm_t nf,
350 char *_UC_RESTRICT resultbuf, size_t *lengthp);
351extern char *
352 u32_casexfrm (const uint32_t *s, size_t n, const char *iso639_language,
353 uninorm_t nf,
354 char *_UC_RESTRICT resultbuf, size_t *lengthp);
355extern char *
356 ulc_casexfrm (const char *s, size_t n, const char *iso639_language,
357 uninorm_t nf,
358 char *_UC_RESTRICT resultbuf, size_t *lengthp);
359
360/* Compare S1 and S2, ignoring differences in case and normalization, using the
361 collation rules of the current locale.
362 The nf argument identifies the normalization form to apply after the
363 case-mapping. It must be either UNINORM_NFC or UNINORM_NFKC. It can also
364 be NULL, for no normalization.
365 If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2, and
366 return 0. Upon failure, return -1 with errno set. */
367extern int
368 u8_casecoll (const uint8_t *s1, size_t n1,
369 const uint8_t *s2, size_t n2,
370 const char *iso639_language, uninorm_t nf, int *resultp);
371extern int
372 u16_casecoll (const uint16_t *s1, size_t n1,
373 const uint16_t *s2, size_t n2,
374 const char *iso639_language, uninorm_t nf, int *resultp);
375extern int
376 u32_casecoll (const uint32_t *s1, size_t n1,
377 const uint32_t *s2, size_t n2,
378 const char *iso639_language, uninorm_t nf, int *resultp);
379extern int
380 ulc_casecoll (const char *s1, size_t n1,
381 const char *s2, size_t n2,
382 const char *iso639_language, uninorm_t nf, int *resultp);
383
384
385/* Set *RESULTP to true if mapping NFD(S) to upper case is a no-op, or to false
386 otherwise, and return 0. Upon failure, return -1 with errno set. */
387extern int
388 u8_is_uppercase (const uint8_t *s, size_t n,
389 const char *iso639_language,
390 bool *resultp);
391extern int
392 u16_is_uppercase (const uint16_t *s, size_t n,
393 const char *iso639_language,
394 bool *resultp);
395extern int
396 u32_is_uppercase (const uint32_t *s, size_t n,
397 const char *iso639_language,
398 bool *resultp);
399
400/* Set *RESULTP to true if mapping NFD(S) to lower case is a no-op, or to false
401 otherwise, and return 0. Upon failure, return -1 with errno set. */
402extern int
403 u8_is_lowercase (const uint8_t *s, size_t n,
404 const char *iso639_language,
405 bool *resultp);
406extern int
407 u16_is_lowercase (const uint16_t *s, size_t n,
408 const char *iso639_language,
409 bool *resultp);
410extern int
411 u32_is_lowercase (const uint32_t *s, size_t n,
412 const char *iso639_language,
413 bool *resultp);
414
415/* Set *RESULTP to true if mapping NFD(S) to title case is a no-op, or to false
416 otherwise, and return 0. Upon failure, return -1 with errno set. */
417extern int
418 u8_is_titlecase (const uint8_t *s, size_t n,
419 const char *iso639_language,
420 bool *resultp);
421extern int
422 u16_is_titlecase (const uint16_t *s, size_t n,
423 const char *iso639_language,
424 bool *resultp);
425extern int
426 u32_is_titlecase (const uint32_t *s, size_t n,
427 const char *iso639_language,
428 bool *resultp);
429
430/* Set *RESULTP to true if applying case folding to NFD(S) is a no-op, or to
431 false otherwise, and return 0. Upon failure, return -1 with errno set. */
432extern int
433 u8_is_casefolded (const uint8_t *s, size_t n,
434 const char *iso639_language,
435 bool *resultp);
436extern int
437 u16_is_casefolded (const uint16_t *s, size_t n,
438 const char *iso639_language,
439 bool *resultp);
440extern int
441 u32_is_casefolded (const uint32_t *s, size_t n,
442 const char *iso639_language,
443 bool *resultp);
444
445/* Set *RESULTP to true if case matters for S, that is, if mapping NFD(S) to
446 either upper case or lower case or title case is not a no-op.
447 Set *RESULTP to false if NFD(S) maps to itself under the upper case mapping,
448 under the lower case mapping, and under the title case mapping; in other
449 words, when NFD(S) consists entirely of caseless characters.
450 Upon failure, return -1 with errno set. */
451extern int
452 u8_is_cased (const uint8_t *s, size_t n,
453 const char *iso639_language,
454 bool *resultp);
455extern int
456 u16_is_cased (const uint16_t *s, size_t n,
457 const char *iso639_language,
458 bool *resultp);
459extern int
460 u32_is_cased (const uint32_t *s, size_t n,
461 const char *iso639_language,
462 bool *resultp);
463
464
465/* ========================================================================= */
466
467#ifdef __cplusplus
468}
469#endif
470
471#endif /* _UNICASE_H */
diff --git a/gl/unicase/.dirstamp b/gl/unicase/.dirstamp
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/gl/unicase/.dirstamp
diff --git a/gl/unicase/simple-mapping.h b/gl/unicase/simple-mapping.h
new file mode 100644
index 00000000..2b3d21d6
--- /dev/null
+++ b/gl/unicase/simple-mapping.h
@@ -0,0 +1,39 @@
1/* Simple case mapping for Unicode characters.
2 Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2009.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18ucs4_t
19FUNC (ucs4_t uc)
20{
21 unsigned int index1 = uc >> mapping_header_0;
22 if (index1 < mapping_header_1)
23 {
24 int lookup1 = u_mapping.level1[index1];
25 if (lookup1 >= 0)
26 {
27 unsigned int index2 = (uc >> mapping_header_2) & mapping_header_3;
28 int lookup2 = u_mapping.level2[lookup1 + index2];
29 if (lookup2 >= 0)
30 {
31 unsigned int index3 = (uc & mapping_header_4);
32 int lookup3 = u_mapping.level3[lookup2 + index3];
33
34 return uc + lookup3;
35 }
36 }
37 }
38 return uc;
39}
diff --git a/gl/unicase/tolower.c b/gl/unicase/tolower.c
new file mode 100644
index 00000000..89676ad6
--- /dev/null
+++ b/gl/unicase/tolower.c
@@ -0,0 +1,27 @@
1/* Lowercase mapping for Unicode characters (locale and context independent).
2 Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2009.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#include <config.h>
19
20/* Specification. */
21#include "unicase.h"
22
23/* Define u_mapping table. */
24#include "tolower.h"
25
26#define FUNC uc_tolower
27#include "simple-mapping.h"
diff --git a/gl/unicase/tolower.h b/gl/unicase/tolower.h
new file mode 100644
index 00000000..f06dacf5
--- /dev/null
+++ b/gl/unicase/tolower.h
@@ -0,0 +1,759 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* Simple character mapping of Unicode characters. */
3/* Generated automatically by gen-uni-tables.c for Unicode 17.0.0. */
4
5/* Copyright (C) 2000-2025 Free Software Foundation, Inc.
6
7 This file is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
11
12 This file is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19
20#define mapping_header_0 16
21#define mapping_header_1 2
22#define mapping_header_2 7
23#define mapping_header_3 511
24#define mapping_header_4 127
25static const
26struct
27 {
28 int level1[2];
29 short level2[2 << 9];
30 int level3[37 << 7];
31 }
32u_mapping =
33{
34 { 0, 512 },
35 {
36 0, 128, 256, 384, 512, -1, 640, 768,
37 896, 1024, 1152, -1, -1, -1, -1, -1,
38 -1, -1, -1, -1, -1, -1, -1, -1,
39 -1, -1, -1, -1, -1, -1, -1, -1,
40 -1, 1280, -1, -1, -1, -1, -1, 1408,
41 -1, -1, -1, -1, -1, -1, -1, -1,
42 -1, -1, -1, -1, -1, -1, -1, -1,
43 -1, 1536, -1, -1, 1664, 1792, 1920, 2048,
44 -1, -1, 2176, 2304, -1, -1, -1, -1,
45 -1, 2432, -1, -1, -1, -1, -1, -1,
46 -1, -1, -1, -1, -1, -1, -1, -1,
47 2560, 2688, -1, -1, -1, -1, -1, -1,
48 -1, -1, -1, -1, -1, -1, -1, -1,
49 -1, -1, -1, -1, -1, -1, -1, -1,
50 -1, -1, -1, -1, -1, -1, -1, -1,
51 -1, -1, -1, -1, -1, -1, -1, -1,
52 -1, -1, -1, -1, -1, -1, -1, -1,
53 -1, -1, -1, -1, -1, -1, -1, -1,
54 -1, -1, -1, -1, -1, -1, -1, -1,
55 -1, -1, -1, -1, -1, -1, -1, -1,
56 -1, -1, -1, -1, -1, -1, -1, -1,
57 -1, -1, -1, -1, -1, -1, -1, -1,
58 -1, -1, -1, -1, -1, -1, -1, -1,
59 -1, -1, -1, -1, -1, -1, -1, -1,
60 -1, -1, -1, -1, -1, -1, -1, -1,
61 -1, -1, -1, -1, -1, -1, -1, -1,
62 -1, -1, -1, -1, -1, -1, -1, -1,
63 -1, -1, -1, -1, -1, -1, -1, -1,
64 -1, -1, -1, -1, -1, -1, -1, -1,
65 -1, -1, -1, -1, -1, -1, -1, -1,
66 -1, -1, -1, -1, -1, -1, -1, -1,
67 -1, -1, -1, -1, -1, -1, -1, -1,
68 -1, -1, -1, -1, -1, -1, -1, -1,
69 -1, -1, -1, -1, -1, -1, -1, -1,
70 -1, -1, -1, -1, -1, -1, -1, -1,
71 -1, -1, -1, -1, -1, -1, -1, -1,
72 -1, -1, -1, -1, -1, -1, -1, -1,
73 -1, -1, -1, -1, -1, -1, -1, -1,
74 -1, -1, -1, -1, -1, -1, -1, -1,
75 -1, -1, -1, -1, -1, -1, -1, -1,
76 -1, -1, -1, -1, -1, -1, -1, -1,
77 -1, -1, -1, -1, 2816, 2944, 3072, 3200,
78 -1, -1, -1, -1, -1, -1, -1, -1,
79 -1, -1, -1, -1, -1, -1, -1, -1,
80 -1, -1, -1, -1, -1, -1, -1, -1,
81 -1, -1, -1, -1, -1, -1, -1, -1,
82 -1, -1, -1, -1, -1, -1, -1, -1,
83 -1, -1, -1, -1, -1, -1, -1, -1,
84 -1, -1, -1, -1, -1, -1, -1, -1,
85 -1, -1, -1, -1, -1, -1, -1, -1,
86 -1, -1, -1, -1, -1, -1, -1, -1,
87 -1, -1, -1, -1, -1, -1, -1, -1,
88 -1, -1, -1, -1, -1, -1, -1, -1,
89 -1, -1, -1, -1, -1, -1, -1, -1,
90 -1, -1, -1, -1, -1, -1, -1, -1,
91 -1, -1, -1, -1, -1, -1, -1, -1,
92 -1, -1, -1, -1, -1, -1, -1, -1,
93 -1, -1, -1, -1, -1, -1, -1, -1,
94 -1, -1, -1, -1, -1, -1, -1, -1,
95 -1, -1, -1, -1, -1, -1, -1, -1,
96 -1, -1, -1, -1, -1, -1, -1, -1,
97 -1, -1, -1, -1, -1, -1, -1, -1,
98 -1, -1, -1, -1, -1, -1, -1, -1,
99 -1, -1, -1, -1, -1, -1, 3328, -1,
100 -1, -1, -1, -1, -1, -1, -1, -1,
101 3456, 3584, 3712, 3840, -1, -1, -1, -1,
102 -1, -1, -1, -1, -1, -1, -1, -1,
103 -1, 3968, 4096, -1, -1, -1, -1, -1,
104 -1, -1, -1, -1, -1, -1, -1, -1,
105 -1, -1, -1, -1, -1, -1, -1, -1,
106 -1, 4224, -1, -1, -1, -1, -1, -1,
107 -1, -1, -1, -1, -1, -1, -1, -1,
108 -1, -1, -1, -1, -1, -1, -1, -1,
109 -1, -1, -1, -1, -1, -1, -1, -1,
110 -1, -1, -1, -1, -1, -1, -1, -1,
111 -1, -1, -1, -1, -1, -1, -1, -1,
112 -1, -1, -1, -1, -1, -1, -1, -1,
113 -1, -1, -1, -1, -1, -1, -1, -1,
114 -1, -1, -1, -1, -1, -1, -1, -1,
115 -1, -1, -1, -1, -1, -1, -1, -1,
116 -1, -1, -1, -1, -1, -1, -1, -1,
117 -1, -1, -1, -1, -1, -1, -1, -1,
118 -1, -1, -1, -1, -1, -1, -1, -1,
119 -1, -1, -1, -1, -1, -1, -1, -1,
120 -1, -1, -1, -1, -1, -1, -1, -1,
121 -1, -1, -1, -1, -1, -1, -1, -1,
122 -1, -1, -1, -1, -1, -1, -1, -1,
123 -1, -1, -1, -1, -1, -1, -1, -1,
124 -1, -1, -1, -1, -1, -1, -1, -1,
125 -1, -1, -1, -1, -1, -1, -1, -1,
126 -1, -1, -1, -1, -1, -1, -1, -1,
127 -1, -1, -1, -1, 4352, 4480, -1, -1,
128 -1, -1, -1, -1, -1, -1, -1, -1,
129 -1, -1, -1, -1, -1, -1, -1, -1,
130 -1, -1, -1, -1, -1, -1, -1, -1,
131 -1, -1, -1, -1, -1, -1, -1, -1,
132 -1, -1, -1, -1, -1, -1, -1, -1,
133 -1, -1, -1, -1, -1, -1, -1, -1,
134 -1, -1, -1, -1, -1, -1, -1, -1,
135 -1, -1, -1, -1, -1, -1, -1, -1,
136 -1, -1, -1, -1, -1, -1, -1, -1,
137 -1, -1, -1, -1, -1, -1, -1, -1,
138 -1, -1, -1, -1, -1, -1, -1, -1,
139 -1, -1, -1, -1, -1, -1, -1, -1,
140 -1, -1, -1, -1, -1, -1, -1, -1,
141 -1, -1, -1, -1, -1, -1, -1, -1,
142 -1, -1, -1, -1, -1, -1, -1, -1,
143 -1, -1, -1, -1, -1, -1, -1, -1,
144 -1, -1, -1, -1, -1, -1, -1, -1,
145 -1, -1, -1, -1, -1, -1, -1, -1,
146 -1, -1, -1, -1, -1, -1, -1, -1,
147 -1, -1, -1, -1, -1, -1, -1, -1,
148 -1, -1, -1, -1, -1, -1, -1, -1,
149 -1, -1, -1, -1, -1, -1, -1, -1,
150 -1, -1, -1, -1, -1, -1, -1, -1,
151 -1, -1, -1, -1, -1, -1, -1, -1,
152 -1, -1, -1, -1, -1, -1, -1, -1,
153 -1, -1, -1, -1, -1, -1, -1, -1,
154 -1, -1, -1, -1, -1, -1, -1, -1,
155 -1, -1, -1, -1, -1, -1, -1, -1,
156 -1, -1, -1, -1, -1, -1, -1, -1,
157 -1, -1, -1, -1, -1, -1, -1, -1,
158 -1, -1, 4608, -1, -1, -1, -1, -1,
159 -1, -1, -1, -1, -1, -1, -1, -1,
160 -1, -1, -1, -1, -1, -1, -1, -1,
161 -1, -1, -1, -1, -1, -1, -1, -1,
162 -1, -1, -1, -1, -1, -1, -1, -1,
163 -1, -1, -1, -1, -1, -1, -1, -1
164 },
165 {
166 0, 0, 0, 0, 0, 0, 0, 0,
167 0, 0, 0, 0, 0, 0, 0, 0,
168 0, 0, 0, 0, 0, 0, 0, 0,
169 0, 0, 0, 0, 0, 0, 0, 0,
170 0, 0, 0, 0, 0, 0, 0, 0,
171 0, 0, 0, 0, 0, 0, 0, 0,
172 0, 0, 0, 0, 0, 0, 0, 0,
173 0, 0, 0, 0, 0, 0, 0, 0,
174 0, 32, 32, 32, 32, 32, 32, 32,
175 32, 32, 32, 32, 32, 32, 32, 32,
176 32, 32, 32, 32, 32, 32, 32, 32,
177 32, 32, 32, 0, 0, 0, 0, 0,
178 0, 0, 0, 0, 0, 0, 0, 0,
179 0, 0, 0, 0, 0, 0, 0, 0,
180 0, 0, 0, 0, 0, 0, 0, 0,
181 0, 0, 0, 0, 0, 0, 0, 0,
182 0, 0, 0, 0, 0, 0, 0, 0,
183 0, 0, 0, 0, 0, 0, 0, 0,
184 0, 0, 0, 0, 0, 0, 0, 0,
185 0, 0, 0, 0, 0, 0, 0, 0,
186 0, 0, 0, 0, 0, 0, 0, 0,
187 0, 0, 0, 0, 0, 0, 0, 0,
188 0, 0, 0, 0, 0, 0, 0, 0,
189 0, 0, 0, 0, 0, 0, 0, 0,
190 32, 32, 32, 32, 32, 32, 32, 32,
191 32, 32, 32, 32, 32, 32, 32, 32,
192 32, 32, 32, 32, 32, 32, 32, 0,
193 32, 32, 32, 32, 32, 32, 32, 0,
194 0, 0, 0, 0, 0, 0, 0, 0,
195 0, 0, 0, 0, 0, 0, 0, 0,
196 0, 0, 0, 0, 0, 0, 0, 0,
197 0, 0, 0, 0, 0, 0, 0, 0,
198 1, 0, 1, 0, 1, 0, 1, 0,
199 1, 0, 1, 0, 1, 0, 1, 0,
200 1, 0, 1, 0, 1, 0, 1, 0,
201 1, 0, 1, 0, 1, 0, 1, 0,
202 1, 0, 1, 0, 1, 0, 1, 0,
203 1, 0, 1, 0, 1, 0, 1, 0,
204 -199, 0, 1, 0, 1, 0, 1, 0,
205 0, 1, 0, 1, 0, 1, 0, 1,
206 0, 1, 0, 1, 0, 1, 0, 1,
207 0, 0, 1, 0, 1, 0, 1, 0,
208 1, 0, 1, 0, 1, 0, 1, 0,
209 1, 0, 1, 0, 1, 0, 1, 0,
210 1, 0, 1, 0, 1, 0, 1, 0,
211 1, 0, 1, 0, 1, 0, 1, 0,
212 1, 0, 1, 0, 1, 0, 1, 0,
213 -121, 1, 0, 1, 0, 1, 0, 0,
214 0, 210, 1, 0, 1, 0, 206, 1,
215 0, 205, 205, 1, 0, 0, 79, 202,
216 203, 1, 0, 205, 207, 0, 211, 209,
217 1, 0, 0, 0, 211, 213, 0, 214,
218 1, 0, 1, 0, 1, 0, 218, 1,
219 0, 218, 0, 0, 1, 0, 218, 1,
220 0, 217, 217, 1, 0, 1, 0, 219,
221 1, 0, 0, 0, 1, 0, 0, 0,
222 0, 0, 0, 0, 2, 1, 0, 2,
223 1, 0, 2, 1, 0, 1, 0, 1,
224 0, 1, 0, 1, 0, 1, 0, 1,
225 0, 1, 0, 1, 0, 0, 1, 0,
226 1, 0, 1, 0, 1, 0, 1, 0,
227 1, 0, 1, 0, 1, 0, 1, 0,
228 0, 2, 1, 0, 1, 0, -97, -56,
229 1, 0, 1, 0, 1, 0, 1, 0,
230 1, 0, 1, 0, 1, 0, 1, 0,
231 1, 0, 1, 0, 1, 0, 1, 0,
232 1, 0, 1, 0, 1, 0, 1, 0,
233 1, 0, 1, 0, 1, 0, 1, 0,
234 -130, 0, 1, 0, 1, 0, 1, 0,
235 1, 0, 1, 0, 1, 0, 1, 0,
236 1, 0, 1, 0, 0, 0, 0, 0,
237 0, 0, 10795, 1, 0, -163, 10792, 0,
238 0, 1, 0, -195, 69, 71, 1, 0,
239 1, 0, 1, 0, 1, 0, 1, 0,
240 0, 0, 0, 0, 0, 0, 0, 0,
241 0, 0, 0, 0, 0, 0, 0, 0,
242 0, 0, 0, 0, 0, 0, 0, 0,
243 0, 0, 0, 0, 0, 0, 0, 0,
244 0, 0, 0, 0, 0, 0, 0, 0,
245 0, 0, 0, 0, 0, 0, 0, 0,
246 0, 0, 0, 0, 0, 0, 0, 0,
247 0, 0, 0, 0, 0, 0, 0, 0,
248 0, 0, 0, 0, 0, 0, 0, 0,
249 0, 0, 0, 0, 0, 0, 0, 0,
250 0, 0, 0, 0, 0, 0, 0, 0,
251 0, 0, 0, 0, 0, 0, 0, 0,
252 0, 0, 0, 0, 0, 0, 0, 0,
253 0, 0, 0, 0, 0, 0, 0, 0,
254 0, 0, 0, 0, 0, 0, 0, 0,
255 0, 0, 0, 0, 0, 0, 0, 0,
256 0, 0, 0, 0, 0, 0, 0, 0,
257 0, 0, 0, 0, 0, 0, 0, 0,
258 0, 0, 0, 0, 0, 0, 0, 0,
259 0, 0, 0, 0, 0, 0, 0, 0,
260 1, 0, 1, 0, 0, 0, 1, 0,
261 0, 0, 0, 0, 0, 0, 0, 116,
262 0, 0, 0, 0, 0, 0, 38, 0,
263 37, 37, 37, 0, 64, 0, 63, 63,
264 0, 32, 32, 32, 32, 32, 32, 32,
265 32, 32, 32, 32, 32, 32, 32, 32,
266 32, 32, 0, 32, 32, 32, 32, 32,
267 32, 32, 32, 32, 0, 0, 0, 0,
268 0, 0, 0, 0, 0, 0, 0, 0,
269 0, 0, 0, 0, 0, 0, 0, 0,
270 0, 0, 0, 0, 0, 0, 0, 0,
271 0, 0, 0, 0, 0, 0, 0, 8,
272 0, 0, 0, 0, 0, 0, 0, 0,
273 1, 0, 1, 0, 1, 0, 1, 0,
274 1, 0, 1, 0, 1, 0, 1, 0,
275 1, 0, 1, 0, 1, 0, 1, 0,
276 0, 0, 0, 0, -60, 0, 0, 1,
277 0, -7, 1, 0, 0, -130, -130, -130,
278 80, 80, 80, 80, 80, 80, 80, 80,
279 80, 80, 80, 80, 80, 80, 80, 80,
280 32, 32, 32, 32, 32, 32, 32, 32,
281 32, 32, 32, 32, 32, 32, 32, 32,
282 32, 32, 32, 32, 32, 32, 32, 32,
283 32, 32, 32, 32, 32, 32, 32, 32,
284 0, 0, 0, 0, 0, 0, 0, 0,
285 0, 0, 0, 0, 0, 0, 0, 0,
286 0, 0, 0, 0, 0, 0, 0, 0,
287 0, 0, 0, 0, 0, 0, 0, 0,
288 0, 0, 0, 0, 0, 0, 0, 0,
289 0, 0, 0, 0, 0, 0, 0, 0,
290 1, 0, 1, 0, 1, 0, 1, 0,
291 1, 0, 1, 0, 1, 0, 1, 0,
292 1, 0, 1, 0, 1, 0, 1, 0,
293 1, 0, 1, 0, 1, 0, 1, 0,
294 1, 0, 0, 0, 0, 0, 0, 0,
295 0, 0, 1, 0, 1, 0, 1, 0,
296 1, 0, 1, 0, 1, 0, 1, 0,
297 1, 0, 1, 0, 1, 0, 1, 0,
298 1, 0, 1, 0, 1, 0, 1, 0,
299 1, 0, 1, 0, 1, 0, 1, 0,
300 1, 0, 1, 0, 1, 0, 1, 0,
301 1, 0, 1, 0, 1, 0, 1, 0,
302 15, 1, 0, 1, 0, 1, 0, 1,
303 0, 1, 0, 1, 0, 1, 0, 0,
304 1, 0, 1, 0, 1, 0, 1, 0,
305 1, 0, 1, 0, 1, 0, 1, 0,
306 1, 0, 1, 0, 1, 0, 1, 0,
307 1, 0, 1, 0, 1, 0, 1, 0,
308 1, 0, 1, 0, 1, 0, 1, 0,
309 1, 0, 1, 0, 1, 0, 1, 0,
310 1, 0, 1, 0, 1, 0, 1, 0,
311 1, 0, 1, 0, 1, 0, 1, 0,
312 1, 0, 1, 0, 1, 0, 1, 0,
313 1, 0, 1, 0, 1, 0, 1, 0,
314 1, 0, 1, 0, 1, 0, 1, 0,
315 1, 0, 1, 0, 1, 0, 1, 0,
316 0, 48, 48, 48, 48, 48, 48, 48,
317 48, 48, 48, 48, 48, 48, 48, 48,
318 48, 48, 48, 48, 48, 48, 48, 48,
319 48, 48, 48, 48, 48, 48, 48, 48,
320 48, 48, 48, 48, 48, 48, 48, 0,
321 0, 0, 0, 0, 0, 0, 0, 0,
322 0, 0, 0, 0, 0, 0, 0, 0,
323 0, 0, 0, 0, 0, 0, 0, 0,
324 0, 0, 0, 0, 0, 0, 0, 0,
325 0, 0, 0, 0, 0, 0, 0, 0,
326 0, 0, 0, 0, 0, 0, 0, 0,
327 0, 0, 0, 0, 0, 0, 0, 0,
328 0, 0, 0, 0, 0, 0, 0, 0,
329 0, 0, 0, 0, 0, 0, 0, 0,
330 7264, 7264, 7264, 7264, 7264, 7264, 7264, 7264,
331 7264, 7264, 7264, 7264, 7264, 7264, 7264, 7264,
332 7264, 7264, 7264, 7264, 7264, 7264, 7264, 7264,
333 7264, 7264, 7264, 7264, 7264, 7264, 7264, 7264,
334 7264, 7264, 7264, 7264, 7264, 7264, 0, 7264,
335 0, 0, 0, 0, 0, 7264, 0, 0,
336 0, 0, 0, 0, 0, 0, 0, 0,
337 0, 0, 0, 0, 0, 0, 0, 0,
338 0, 0, 0, 0, 0, 0, 0, 0,
339 0, 0, 0, 0, 0, 0, 0, 0,
340 0, 0, 0, 0, 0, 0, 0, 0,
341 0, 0, 0, 0, 0, 0, 0, 0,
342 0, 0, 0, 0, 0, 0, 0, 0,
343 0, 0, 0, 0, 0, 0, 0, 0,
344 0, 0, 0, 0, 0, 0, 0, 0,
345 0, 0, 0, 0, 0, 0, 0, 0,
346 38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864,
347 38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864,
348 38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864,
349 38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864,
350 38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864,
351 38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864,
352 38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864,
353 38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864,
354 38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864,
355 38864, 38864, 38864, 38864, 38864, 38864, 38864, 38864,
356 8, 8, 8, 8, 8, 8, 0, 0,
357 0, 0, 0, 0, 0, 0, 0, 0,
358 0, 0, 0, 0, 0, 0, 0, 0,
359 0, 1, 0, 0, 0, 0, 0, 0,
360 -3008, -3008, -3008, -3008, -3008, -3008, -3008, -3008,
361 -3008, -3008, -3008, -3008, -3008, -3008, -3008, -3008,
362 -3008, -3008, -3008, -3008, -3008, -3008, -3008, -3008,
363 -3008, -3008, -3008, -3008, -3008, -3008, -3008, -3008,
364 -3008, -3008, -3008, -3008, -3008, -3008, -3008, -3008,
365 -3008, -3008, -3008, 0, 0, -3008, -3008, -3008,
366 0, 0, 0, 0, 0, 0, 0, 0,
367 0, 0, 0, 0, 0, 0, 0, 0,
368 0, 0, 0, 0, 0, 0, 0, 0,
369 0, 0, 0, 0, 0, 0, 0, 0,
370 0, 0, 0, 0, 0, 0, 0, 0,
371 0, 0, 0, 0, 0, 0, 0, 0,
372 0, 0, 0, 0, 0, 0, 0, 0,
373 0, 0, 0, 0, 0, 0, 0, 0,
374 1, 0, 1, 0, 1, 0, 1, 0,
375 1, 0, 1, 0, 1, 0, 1, 0,
376 1, 0, 1, 0, 1, 0, 1, 0,
377 1, 0, 1, 0, 1, 0, 1, 0,
378 1, 0, 1, 0, 1, 0, 1, 0,
379 1, 0, 1, 0, 1, 0, 1, 0,
380 1, 0, 1, 0, 1, 0, 1, 0,
381 1, 0, 1, 0, 1, 0, 1, 0,
382 1, 0, 1, 0, 1, 0, 1, 0,
383 1, 0, 1, 0, 1, 0, 1, 0,
384 1, 0, 1, 0, 1, 0, 1, 0,
385 1, 0, 1, 0, 1, 0, 1, 0,
386 1, 0, 1, 0, 1, 0, 1, 0,
387 1, 0, 1, 0, 1, 0, 1, 0,
388 1, 0, 1, 0, 1, 0, 1, 0,
389 1, 0, 1, 0, 1, 0, 1, 0,
390 1, 0, 1, 0, 1, 0, 1, 0,
391 1, 0, 1, 0, 1, 0, 1, 0,
392 1, 0, 1, 0, 1, 0, 0, 0,
393 0, 0, 0, 0, 0, 0, -7615, 0,
394 1, 0, 1, 0, 1, 0, 1, 0,
395 1, 0, 1, 0, 1, 0, 1, 0,
396 1, 0, 1, 0, 1, 0, 1, 0,
397 1, 0, 1, 0, 1, 0, 1, 0,
398 1, 0, 1, 0, 1, 0, 1, 0,
399 1, 0, 1, 0, 1, 0, 1, 0,
400 1, 0, 1, 0, 1, 0, 1, 0,
401 1, 0, 1, 0, 1, 0, 1, 0,
402 1, 0, 1, 0, 1, 0, 1, 0,
403 1, 0, 1, 0, 1, 0, 1, 0,
404 1, 0, 1, 0, 1, 0, 1, 0,
405 1, 0, 1, 0, 1, 0, 1, 0,
406 0, 0, 0, 0, 0, 0, 0, 0,
407 -8, -8, -8, -8, -8, -8, -8, -8,
408 0, 0, 0, 0, 0, 0, 0, 0,
409 -8, -8, -8, -8, -8, -8, 0, 0,
410 0, 0, 0, 0, 0, 0, 0, 0,
411 -8, -8, -8, -8, -8, -8, -8, -8,
412 0, 0, 0, 0, 0, 0, 0, 0,
413 -8, -8, -8, -8, -8, -8, -8, -8,
414 0, 0, 0, 0, 0, 0, 0, 0,
415 -8, -8, -8, -8, -8, -8, 0, 0,
416 0, 0, 0, 0, 0, 0, 0, 0,
417 0, -8, 0, -8, 0, -8, 0, -8,
418 0, 0, 0, 0, 0, 0, 0, 0,
419 -8, -8, -8, -8, -8, -8, -8, -8,
420 0, 0, 0, 0, 0, 0, 0, 0,
421 0, 0, 0, 0, 0, 0, 0, 0,
422 0, 0, 0, 0, 0, 0, 0, 0,
423 -8, -8, -8, -8, -8, -8, -8, -8,
424 0, 0, 0, 0, 0, 0, 0, 0,
425 -8, -8, -8, -8, -8, -8, -8, -8,
426 0, 0, 0, 0, 0, 0, 0, 0,
427 -8, -8, -8, -8, -8, -8, -8, -8,
428 0, 0, 0, 0, 0, 0, 0, 0,
429 -8, -8, -74, -74, -9, 0, 0, 0,
430 0, 0, 0, 0, 0, 0, 0, 0,
431 -86, -86, -86, -86, -9, 0, 0, 0,
432 0, 0, 0, 0, 0, 0, 0, 0,
433 -8, -8, -100, -100, 0, 0, 0, 0,
434 0, 0, 0, 0, 0, 0, 0, 0,
435 -8, -8, -112, -112, -7, 0, 0, 0,
436 0, 0, 0, 0, 0, 0, 0, 0,
437 -128, -128, -126, -126, -9, 0, 0, 0,
438 0, 0, 0, 0, 0, 0, 0, 0,
439 0, 0, 0, 0, 0, 0, 0, 0,
440 0, 0, 0, 0, 0, 0, 0, 0,
441 0, 0, 0, 0, 0, 0, 0, 0,
442 0, 0, 0, 0, 0, 0, -7517, 0,
443 0, 0, -8383, -8262, 0, 0, 0, 0,
444 0, 0, 28, 0, 0, 0, 0, 0,
445 0, 0, 0, 0, 0, 0, 0, 0,
446 0, 0, 0, 0, 0, 0, 0, 0,
447 0, 0, 0, 0, 0, 0, 0, 0,
448 0, 0, 0, 0, 0, 0, 0, 0,
449 0, 0, 0, 0, 0, 0, 0, 0,
450 16, 16, 16, 16, 16, 16, 16, 16,
451 16, 16, 16, 16, 16, 16, 16, 16,
452 0, 0, 0, 0, 0, 0, 0, 0,
453 0, 0, 0, 0, 0, 0, 0, 0,
454 0, 0, 0, 1, 0, 0, 0, 0,
455 0, 0, 0, 0, 0, 0, 0, 0,
456 0, 0, 0, 0, 0, 0, 0, 0,
457 0, 0, 0, 0, 0, 0, 0, 0,
458 0, 0, 0, 0, 0, 0, 0, 0,
459 0, 0, 0, 0, 0, 0, 0, 0,
460 0, 0, 0, 0, 0, 0, 0, 0,
461 0, 0, 0, 0, 0, 0, 0, 0,
462 0, 0, 0, 0, 0, 0, 0, 0,
463 0, 0, 0, 0, 0, 0, 0, 0,
464 0, 0, 0, 0, 0, 0, 0, 0,
465 0, 0, 0, 0, 0, 0, 0, 0,
466 0, 0, 0, 0, 0, 0, 0, 0,
467 0, 0, 0, 0, 0, 0, 0, 0,
468 0, 0, 0, 0, 0, 0, 0, 0,
469 0, 0, 0, 0, 0, 0, 0, 0,
470 0, 0, 0, 0, 0, 0, 0, 0,
471 0, 0, 0, 0, 0, 0, 0, 0,
472 0, 0, 0, 0, 0, 0, 0, 0,
473 0, 0, 0, 0, 0, 0, 0, 0,
474 0, 0, 0, 0, 0, 0, 0, 0,
475 0, 0, 0, 0, 0, 0, 0, 0,
476 0, 0, 0, 0, 0, 0, 26, 26,
477 26, 26, 26, 26, 26, 26, 26, 26,
478 26, 26, 26, 26, 26, 26, 26, 26,
479 26, 26, 26, 26, 26, 26, 26, 26,
480 0, 0, 0, 0, 0, 0, 0, 0,
481 0, 0, 0, 0, 0, 0, 0, 0,
482 0, 0, 0, 0, 0, 0, 0, 0,
483 0, 0, 0, 0, 0, 0, 0, 0,
484 0, 0, 0, 0, 0, 0, 0, 0,
485 0, 0, 0, 0, 0, 0, 0, 0,
486 48, 48, 48, 48, 48, 48, 48, 48,
487 48, 48, 48, 48, 48, 48, 48, 48,
488 48, 48, 48, 48, 48, 48, 48, 48,
489 48, 48, 48, 48, 48, 48, 48, 48,
490 48, 48, 48, 48, 48, 48, 48, 48,
491 48, 48, 48, 48, 48, 48, 48, 48,
492 0, 0, 0, 0, 0, 0, 0, 0,
493 0, 0, 0, 0, 0, 0, 0, 0,
494 0, 0, 0, 0, 0, 0, 0, 0,
495 0, 0, 0, 0, 0, 0, 0, 0,
496 0, 0, 0, 0, 0, 0, 0, 0,
497 0, 0, 0, 0, 0, 0, 0, 0,
498 1, 0, -10743, -3814, -10727, 0, 0, 1,
499 0, 1, 0, 1, 0, -10780, -10749, -10783,
500 -10782, 0, 1, 0, 0, 1, 0, 0,
501 0, 0, 0, 0, 0, 0, -10815, -10815,
502 1, 0, 1, 0, 1, 0, 1, 0,
503 1, 0, 1, 0, 1, 0, 1, 0,
504 1, 0, 1, 0, 1, 0, 1, 0,
505 1, 0, 1, 0, 1, 0, 1, 0,
506 1, 0, 1, 0, 1, 0, 1, 0,
507 1, 0, 1, 0, 1, 0, 1, 0,
508 1, 0, 1, 0, 1, 0, 1, 0,
509 1, 0, 1, 0, 1, 0, 1, 0,
510 1, 0, 1, 0, 1, 0, 1, 0,
511 1, 0, 1, 0, 1, 0, 1, 0,
512 1, 0, 1, 0, 1, 0, 1, 0,
513 1, 0, 1, 0, 1, 0, 1, 0,
514 1, 0, 1, 0, 0, 0, 0, 0,
515 0, 0, 0, 1, 0, 1, 0, 0,
516 0, 0, 1, 0, 0, 0, 0, 0,
517 0, 0, 0, 0, 0, 0, 0, 0,
518 0, 0, 0, 0, 0, 0, 0, 0,
519 0, 0, 0, 0, 0, 0, 0, 0,
520 0, 0, 0, 0, 0, 0, 0, 0,
521 0, 0, 0, 0, 0, 0, 0, 0,
522 0, 0, 0, 0, 0, 0, 0, 0,
523 0, 0, 0, 0, 0, 0, 0, 0,
524 0, 0, 0, 0, 0, 0, 0, 0,
525 0, 0, 0, 0, 0, 0, 0, 0,
526 1, 0, 1, 0, 1, 0, 1, 0,
527 1, 0, 1, 0, 1, 0, 1, 0,
528 1, 0, 1, 0, 1, 0, 1, 0,
529 1, 0, 1, 0, 1, 0, 1, 0,
530 1, 0, 1, 0, 1, 0, 1, 0,
531 1, 0, 1, 0, 1, 0, 0, 0,
532 0, 0, 0, 0, 0, 0, 0, 0,
533 0, 0, 0, 0, 0, 0, 0, 0,
534 1, 0, 1, 0, 1, 0, 1, 0,
535 1, 0, 1, 0, 1, 0, 1, 0,
536 1, 0, 1, 0, 1, 0, 1, 0,
537 1, 0, 1, 0, 0, 0, 0, 0,
538 0, 0, 0, 0, 0, 0, 0, 0,
539 0, 0, 0, 0, 0, 0, 0, 0,
540 0, 0, 0, 0, 0, 0, 0, 0,
541 0, 0, 0, 0, 0, 0, 0, 0,
542 0, 0, 0, 0, 0, 0, 0, 0,
543 0, 0, 0, 0, 0, 0, 0, 0,
544 0, 0, 0, 0, 0, 0, 0, 0,
545 0, 0, 0, 0, 0, 0, 0, 0,
546 0, 0, 0, 0, 0, 0, 0, 0,
547 0, 0, 0, 0, 0, 0, 0, 0,
548 0, 0, 0, 0, 0, 0, 0, 0,
549 0, 0, 0, 0, 0, 0, 0, 0,
550 0, 0, 0, 0, 0, 0, 0, 0,
551 0, 0, 0, 0, 0, 0, 0, 0,
552 0, 0, 0, 0, 0, 0, 0, 0,
553 0, 0, 0, 0, 0, 0, 0, 0,
554 0, 0, 1, 0, 1, 0, 1, 0,
555 1, 0, 1, 0, 1, 0, 1, 0,
556 0, 0, 1, 0, 1, 0, 1, 0,
557 1, 0, 1, 0, 1, 0, 1, 0,
558 1, 0, 1, 0, 1, 0, 1, 0,
559 1, 0, 1, 0, 1, 0, 1, 0,
560 1, 0, 1, 0, 1, 0, 1, 0,
561 1, 0, 1, 0, 1, 0, 1, 0,
562 1, 0, 1, 0, 1, 0, 1, 0,
563 1, 0, 1, 0, 1, 0, 1, 0,
564 0, 0, 0, 0, 0, 0, 0, 0,
565 0, 1, 0, 1, 0, -35332, 1, 0,
566 1, 0, 1, 0, 1, 0, 1, 0,
567 0, 0, 0, 1, 0, -42280, 0, 0,
568 1, 0, 1, 0, 0, 0, 1, 0,
569 1, 0, 1, 0, 1, 0, 1, 0,
570 1, 0, 1, 0, 1, 0, 1, 0,
571 1, 0, -42308, -42319, -42315, -42305, -42308, 0,
572 -42258, -42282, -42261, 928, 1, 0, 1, 0,
573 1, 0, 1, 0, 1, 0, 1, 0,
574 1, 0, 1, 0, -48, -42307, -35384, 1,
575 0, 1, 0, -42343, 1, 0, 1, 0,
576 1, 0, 1, 0, 1, 0, 1, 0,
577 1, 0, 1, 0, -42561, 0, 0, 0,
578 0, 0, 0, 0, 0, 0, 0, 0,
579 0, 0, 0, 0, 0, 0, 0, 0,
580 0, 0, 0, 0, 0, 1, 0, 0,
581 0, 0, 0, 0, 0, 0, 0, 0,
582 0, 0, 0, 0, 0, 0, 0, 0,
583 0, 0, 0, 0, 0, 0, 0, 0,
584 0, 0, 0, 0, 0, 0, 0, 0,
585 0, 0, 0, 0, 0, 0, 0, 0,
586 0, 32, 32, 32, 32, 32, 32, 32,
587 32, 32, 32, 32, 32, 32, 32, 32,
588 32, 32, 32, 32, 32, 32, 32, 32,
589 32, 32, 32, 0, 0, 0, 0, 0,
590 0, 0, 0, 0, 0, 0, 0, 0,
591 0, 0, 0, 0, 0, 0, 0, 0,
592 0, 0, 0, 0, 0, 0, 0, 0,
593 0, 0, 0, 0, 0, 0, 0, 0,
594 0, 0, 0, 0, 0, 0, 0, 0,
595 0, 0, 0, 0, 0, 0, 0, 0,
596 0, 0, 0, 0, 0, 0, 0, 0,
597 0, 0, 0, 0, 0, 0, 0, 0,
598 40, 40, 40, 40, 40, 40, 40, 40,
599 40, 40, 40, 40, 40, 40, 40, 40,
600 40, 40, 40, 40, 40, 40, 40, 40,
601 40, 40, 40, 40, 40, 40, 40, 40,
602 40, 40, 40, 40, 40, 40, 40, 40,
603 0, 0, 0, 0, 0, 0, 0, 0,
604 0, 0, 0, 0, 0, 0, 0, 0,
605 0, 0, 0, 0, 0, 0, 0, 0,
606 0, 0, 0, 0, 0, 0, 0, 0,
607 0, 0, 0, 0, 0, 0, 0, 0,
608 0, 0, 0, 0, 0, 0, 0, 0,
609 0, 0, 0, 0, 0, 0, 0, 0,
610 0, 0, 0, 0, 0, 0, 0, 0,
611 0, 0, 0, 0, 0, 0, 0, 0,
612 0, 0, 0, 0, 0, 0, 0, 0,
613 0, 0, 0, 0, 0, 0, 0, 0,
614 0, 0, 0, 0, 0, 0, 0, 0,
615 0, 0, 0, 0, 0, 0, 0, 0,
616 0, 0, 0, 0, 0, 0, 0, 0,
617 0, 0, 0, 0, 0, 0, 0, 0,
618 0, 0, 0, 0, 0, 0, 0, 0,
619 0, 0, 0, 0, 0, 0, 0, 0,
620 40, 40, 40, 40, 40, 40, 40, 40,
621 40, 40, 40, 40, 40, 40, 40, 40,
622 40, 40, 40, 40, 40, 40, 40, 40,
623 40, 40, 40, 40, 40, 40, 40, 40,
624 40, 40, 40, 40, 0, 0, 0, 0,
625 0, 0, 0, 0, 0, 0, 0, 0,
626 0, 0, 0, 0, 0, 0, 0, 0,
627 0, 0, 0, 0, 0, 0, 0, 0,
628 0, 0, 0, 0, 0, 0, 0, 0,
629 0, 0, 0, 0, 0, 0, 0, 0,
630 0, 0, 0, 0, 0, 0, 0, 0,
631 0, 0, 0, 0, 0, 0, 0, 0,
632 0, 0, 0, 0, 0, 0, 0, 0,
633 0, 0, 0, 0, 0, 0, 0, 0,
634 0, 0, 0, 0, 0, 0, 0, 0,
635 0, 0, 0, 0, 0, 0, 0, 0,
636 0, 0, 0, 0, 0, 0, 0, 0,
637 0, 0, 0, 0, 0, 0, 0, 0,
638 0, 0, 0, 0, 0, 0, 0, 0,
639 0, 0, 0, 0, 0, 0, 0, 0,
640 0, 0, 0, 0, 0, 0, 0, 0,
641 0, 0, 0, 0, 0, 0, 0, 0,
642 0, 0, 0, 0, 0, 0, 0, 0,
643 0, 0, 0, 0, 0, 0, 0, 0,
644 39, 39, 39, 39, 39, 39, 39, 39,
645 39, 39, 39, 0, 39, 39, 39, 39,
646 39, 39, 39, 39, 39, 39, 39, 39,
647 39, 39, 39, 0, 39, 39, 39, 39,
648 39, 39, 39, 0, 39, 39, 0, 0,
649 0, 0, 0, 0, 0, 0, 0, 0,
650 0, 0, 0, 0, 0, 0, 0, 0,
651 0, 0, 0, 0, 0, 0, 0, 0,
652 0, 0, 0, 0, 0, 0, 0, 0,
653 0, 0, 0, 0, 0, 0, 0, 0,
654 0, 0, 0, 0, 0, 0, 0, 0,
655 0, 0, 0, 0, 0, 0, 0, 0,
656 0, 0, 0, 0, 0, 0, 0, 0,
657 0, 0, 0, 0, 0, 0, 0, 0,
658 0, 0, 0, 0, 0, 0, 0, 0,
659 0, 0, 0, 0, 0, 0, 0, 0,
660 0, 0, 0, 0, 0, 0, 0, 0,
661 0, 0, 0, 0, 0, 0, 0, 0,
662 64, 64, 64, 64, 64, 64, 64, 64,
663 64, 64, 64, 64, 64, 64, 64, 64,
664 64, 64, 64, 64, 64, 64, 64, 64,
665 64, 64, 64, 64, 64, 64, 64, 64,
666 64, 64, 64, 64, 64, 64, 64, 64,
667 64, 64, 64, 64, 64, 64, 64, 64,
668 64, 64, 64, 0, 0, 0, 0, 0,
669 0, 0, 0, 0, 0, 0, 0, 0,
670 0, 0, 0, 0, 0, 0, 0, 0,
671 0, 0, 0, 0, 0, 0, 0, 0,
672 0, 0, 0, 0, 0, 0, 0, 0,
673 0, 0, 0, 0, 0, 0, 0, 0,
674 0, 0, 0, 0, 0, 0, 0, 0,
675 0, 0, 0, 0, 0, 0, 0, 0,
676 0, 0, 0, 0, 0, 0, 0, 0,
677 0, 0, 0, 0, 0, 0, 0, 0,
678 0, 0, 0, 0, 0, 0, 0, 0,
679 0, 0, 0, 0, 0, 0, 0, 0,
680 0, 0, 0, 0, 0, 0, 0, 0,
681 0, 0, 0, 0, 0, 0, 0, 0,
682 0, 0, 0, 0, 0, 0, 0, 0,
683 0, 0, 0, 0, 0, 0, 0, 0,
684 0, 0, 0, 0, 0, 0, 0, 0,
685 0, 0, 0, 0, 0, 0, 0, 0,
686 0, 0, 0, 0, 0, 0, 0, 0,
687 0, 0, 0, 0, 0, 0, 0, 0,
688 32, 32, 32, 32, 32, 32, 32, 32,
689 32, 32, 32, 32, 32, 32, 32, 32,
690 32, 32, 32, 32, 32, 32, 0, 0,
691 0, 0, 0, 0, 0, 0, 0, 0,
692 0, 0, 0, 0, 0, 0, 0, 0,
693 0, 0, 0, 0, 0, 0, 0, 0,
694 0, 0, 0, 0, 0, 0, 0, 0,
695 0, 0, 0, 0, 0, 0, 0, 0,
696 0, 0, 0, 0, 0, 0, 0, 0,
697 0, 0, 0, 0, 0, 0, 0, 0,
698 32, 32, 32, 32, 32, 32, 32, 32,
699 32, 32, 32, 32, 32, 32, 32, 32,
700 32, 32, 32, 32, 32, 32, 32, 32,
701 32, 32, 32, 32, 32, 32, 32, 32,
702 0, 0, 0, 0, 0, 0, 0, 0,
703 0, 0, 0, 0, 0, 0, 0, 0,
704 0, 0, 0, 0, 0, 0, 0, 0,
705 0, 0, 0, 0, 0, 0, 0, 0,
706 0, 0, 0, 0, 0, 0, 0, 0,
707 0, 0, 0, 0, 0, 0, 0, 0,
708 0, 0, 0, 0, 0, 0, 0, 0,
709 0, 0, 0, 0, 0, 0, 0, 0,
710 0, 0, 0, 0, 0, 0, 0, 0,
711 0, 0, 0, 0, 0, 0, 0, 0,
712 0, 0, 0, 0, 0, 0, 0, 0,
713 0, 0, 0, 0, 0, 0, 0, 0,
714 0, 0, 0, 0, 0, 0, 0, 0,
715 0, 0, 0, 0, 0, 0, 0, 0,
716 0, 0, 0, 0, 0, 0, 0, 0,
717 0, 0, 0, 0, 0, 0, 0, 0,
718 32, 32, 32, 32, 32, 32, 32, 32,
719 32, 32, 32, 32, 32, 32, 32, 32,
720 32, 32, 32, 32, 32, 32, 32, 32,
721 32, 32, 32, 32, 32, 32, 32, 32,
722 0, 0, 0, 0, 0, 0, 0, 0,
723 0, 0, 0, 0, 0, 0, 0, 0,
724 0, 0, 0, 0, 0, 0, 0, 0,
725 0, 0, 0, 0, 0, 0, 0, 0,
726 0, 0, 0, 0, 0, 0, 0, 0,
727 0, 0, 0, 0, 0, 0, 0, 0,
728 0, 0, 0, 0, 0, 0, 0, 0,
729 0, 0, 0, 0, 0, 0, 0, 0,
730 27, 27, 27, 27, 27, 27, 27, 27,
731 27, 27, 27, 27, 27, 27, 27, 27,
732 27, 27, 27, 27, 27, 27, 27, 27,
733 27, 0, 0, 0, 0, 0, 0, 0,
734 0, 0, 0, 0, 0, 0, 0, 0,
735 0, 0, 0, 0, 0, 0, 0, 0,
736 0, 0, 0, 0, 0, 0, 0, 0,
737 0, 0, 0, 0, 0, 0, 0, 0,
738 0, 0, 0, 0, 0, 0, 0, 0,
739 0, 0, 0, 0, 0, 0, 0, 0,
740 0, 0, 0, 0, 0, 0, 0, 0,
741 0, 0, 0, 0, 0, 0, 0, 0,
742 34, 34, 34, 34, 34, 34, 34, 34,
743 34, 34, 34, 34, 34, 34, 34, 34,
744 34, 34, 34, 34, 34, 34, 34, 34,
745 34, 34, 34, 34, 34, 34, 34, 34,
746 34, 34, 0, 0, 0, 0, 0, 0,
747 0, 0, 0, 0, 0, 0, 0, 0,
748 0, 0, 0, 0, 0, 0, 0, 0,
749 0, 0, 0, 0, 0, 0, 0, 0,
750 0, 0, 0, 0, 0, 0, 0, 0,
751 0, 0, 0, 0, 0, 0, 0, 0,
752 0, 0, 0, 0, 0, 0, 0, 0,
753 0, 0, 0, 0, 0, 0, 0, 0,
754 0, 0, 0, 0, 0, 0, 0, 0,
755 0, 0, 0, 0, 0, 0, 0, 0,
756 0, 0, 0, 0, 0, 0, 0, 0,
757 0, 0, 0, 0, 0, 0, 0, 0
758 }
759};
diff --git a/gl/unictype.in.h b/gl/unictype.in.h
new file mode 100644
index 00000000..c3b9ecaf
--- /dev/null
+++ b/gl/unictype.in.h
@@ -0,0 +1,1147 @@
1/* Unicode character classification and properties.
2 Copyright (C) 2002, 2005-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#ifndef _UNICTYPE_H
18#define _UNICTYPE_H
19
20#include "unitypes.h"
21
22/* Get bool. */
23#include <stdbool.h>
24
25/* Get size_t. */
26#include <stddef.h>
27
28#if @HAVE_UNISTRING_WOE32DLL_H@
29# include <unistring/woe32dll.h>
30#else
31# define LIBUNISTRING_DLL_VARIABLE
32#endif
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38/* ========================================================================= */
39
40/* Field 1 of Unicode Character Database: Character name.
41 See "uniname.h". */
42
43/* ========================================================================= */
44
45/* Field 2 of Unicode Character Database: General category. */
46
47/* Data type denoting a General category value. This is not just a bitmask,
48 but rather a bitmask and a pointer to the lookup table, so that programs
49 that use only the predefined bitmasks (i.e. don't combine bitmasks with &
50 and |) don't have a link-time dependency towards the big general table. */
51typedef struct
52{
53 uint32_t bitmask : 31;
54 /*bool*/ unsigned int generic : 1;
55 union
56 {
57 const void *table; /* when generic is 0 */
58 bool (*lookup_fn) (ucs4_t uc, uint32_t bitmask); /* when generic is 1 */
59 } lookup;
60}
61uc_general_category_t;
62
63/* Bits and bit masks denoting General category values. UnicodeData-3.2.0.html
64 says a 32-bit integer will always suffice to represent them.
65 These bit masks can only be used with the uc_is_general_category_withtable
66 function. */
67enum
68{
69 UC_CATEGORY_MASK_L = 0x0000001f,
70 UC_CATEGORY_MASK_LC = 0x00000007,
71 UC_CATEGORY_MASK_Lu = 0x00000001,
72 UC_CATEGORY_MASK_Ll = 0x00000002,
73 UC_CATEGORY_MASK_Lt = 0x00000004,
74 UC_CATEGORY_MASK_Lm = 0x00000008,
75 UC_CATEGORY_MASK_Lo = 0x00000010,
76 UC_CATEGORY_MASK_M = 0x000000e0,
77 UC_CATEGORY_MASK_Mn = 0x00000020,
78 UC_CATEGORY_MASK_Mc = 0x00000040,
79 UC_CATEGORY_MASK_Me = 0x00000080,
80 UC_CATEGORY_MASK_N = 0x00000700,
81 UC_CATEGORY_MASK_Nd = 0x00000100,
82 UC_CATEGORY_MASK_Nl = 0x00000200,
83 UC_CATEGORY_MASK_No = 0x00000400,
84 UC_CATEGORY_MASK_P = 0x0003f800,
85 UC_CATEGORY_MASK_Pc = 0x00000800,
86 UC_CATEGORY_MASK_Pd = 0x00001000,
87 UC_CATEGORY_MASK_Ps = 0x00002000,
88 UC_CATEGORY_MASK_Pe = 0x00004000,
89 UC_CATEGORY_MASK_Pi = 0x00008000,
90 UC_CATEGORY_MASK_Pf = 0x00010000,
91 UC_CATEGORY_MASK_Po = 0x00020000,
92 UC_CATEGORY_MASK_S = 0x003c0000,
93 UC_CATEGORY_MASK_Sm = 0x00040000,
94 UC_CATEGORY_MASK_Sc = 0x00080000,
95 UC_CATEGORY_MASK_Sk = 0x00100000,
96 UC_CATEGORY_MASK_So = 0x00200000,
97 UC_CATEGORY_MASK_Z = 0x01c00000,
98 UC_CATEGORY_MASK_Zs = 0x00400000,
99 UC_CATEGORY_MASK_Zl = 0x00800000,
100 UC_CATEGORY_MASK_Zp = 0x01000000,
101 UC_CATEGORY_MASK_C = 0x3e000000,
102 UC_CATEGORY_MASK_Cc = 0x02000000,
103 UC_CATEGORY_MASK_Cf = 0x04000000,
104 UC_CATEGORY_MASK_Cs = 0x08000000,
105 UC_CATEGORY_MASK_Co = 0x10000000,
106 UC_CATEGORY_MASK_Cn = 0x20000000
107};
108
109/* Predefined General category values. */
110extern @GNULIB_UNICTYPE_CATEGORY_L_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_L;
111extern @GNULIB_UNICTYPE_CATEGORY_LC_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_LC;
112extern @GNULIB_UNICTYPE_CATEGORY_LU_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Lu;
113extern @GNULIB_UNICTYPE_CATEGORY_LL_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Ll;
114extern @GNULIB_UNICTYPE_CATEGORY_LT_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Lt;
115extern @GNULIB_UNICTYPE_CATEGORY_LM_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Lm;
116extern @GNULIB_UNICTYPE_CATEGORY_LO_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Lo;
117extern @GNULIB_UNICTYPE_CATEGORY_M_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_M;
118extern @GNULIB_UNICTYPE_CATEGORY_MN_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Mn;
119extern @GNULIB_UNICTYPE_CATEGORY_MC_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Mc;
120extern @GNULIB_UNICTYPE_CATEGORY_ME_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Me;
121extern @GNULIB_UNICTYPE_CATEGORY_N_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_N;
122extern @GNULIB_UNICTYPE_CATEGORY_ND_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Nd;
123extern @GNULIB_UNICTYPE_CATEGORY_NL_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Nl;
124extern @GNULIB_UNICTYPE_CATEGORY_NO_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_No;
125extern @GNULIB_UNICTYPE_CATEGORY_P_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_P;
126extern @GNULIB_UNICTYPE_CATEGORY_PC_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Pc;
127extern @GNULIB_UNICTYPE_CATEGORY_PD_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Pd;
128extern @GNULIB_UNICTYPE_CATEGORY_PS_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Ps;
129extern @GNULIB_UNICTYPE_CATEGORY_PE_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Pe;
130extern @GNULIB_UNICTYPE_CATEGORY_PI_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Pi;
131extern @GNULIB_UNICTYPE_CATEGORY_PF_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Pf;
132extern @GNULIB_UNICTYPE_CATEGORY_PO_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Po;
133extern @GNULIB_UNICTYPE_CATEGORY_S_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_S;
134extern @GNULIB_UNICTYPE_CATEGORY_SM_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Sm;
135extern @GNULIB_UNICTYPE_CATEGORY_SC_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Sc;
136extern @GNULIB_UNICTYPE_CATEGORY_SK_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Sk;
137extern @GNULIB_UNICTYPE_CATEGORY_SO_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_So;
138extern @GNULIB_UNICTYPE_CATEGORY_Z_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Z;
139extern @GNULIB_UNICTYPE_CATEGORY_ZS_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Zs;
140extern @GNULIB_UNICTYPE_CATEGORY_ZL_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Zl;
141extern @GNULIB_UNICTYPE_CATEGORY_ZP_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Zp;
142extern @GNULIB_UNICTYPE_CATEGORY_C_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_C;
143extern @GNULIB_UNICTYPE_CATEGORY_CC_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Cc;
144extern @GNULIB_UNICTYPE_CATEGORY_CF_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Cf;
145extern @GNULIB_UNICTYPE_CATEGORY_CS_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Cs;
146extern @GNULIB_UNICTYPE_CATEGORY_CO_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Co;
147extern @GNULIB_UNICTYPE_CATEGORY_CN_DLL_VARIABLE@ const uc_general_category_t UC_CATEGORY_Cn;
148/* Non-public. */
149extern const uc_general_category_t _UC_CATEGORY_NONE;
150
151/* Alias names for predefined General category values. */
152#define UC_LETTER UC_CATEGORY_L
153#define UC_CASED_LETTER UC_CATEGORY_LC
154#define UC_UPPERCASE_LETTER UC_CATEGORY_Lu
155#define UC_LOWERCASE_LETTER UC_CATEGORY_Ll
156#define UC_TITLECASE_LETTER UC_CATEGORY_Lt
157#define UC_MODIFIER_LETTER UC_CATEGORY_Lm
158#define UC_OTHER_LETTER UC_CATEGORY_Lo
159#define UC_MARK UC_CATEGORY_M
160#define UC_NON_SPACING_MARK UC_CATEGORY_Mn
161#define UC_COMBINING_SPACING_MARK UC_CATEGORY_Mc
162#define UC_ENCLOSING_MARK UC_CATEGORY_Me
163#define UC_NUMBER UC_CATEGORY_N
164#define UC_DECIMAL_DIGIT_NUMBER UC_CATEGORY_Nd
165#define UC_LETTER_NUMBER UC_CATEGORY_Nl
166#define UC_OTHER_NUMBER UC_CATEGORY_No
167#define UC_PUNCTUATION UC_CATEGORY_P
168#define UC_CONNECTOR_PUNCTUATION UC_CATEGORY_Pc
169#define UC_DASH_PUNCTUATION UC_CATEGORY_Pd
170#define UC_OPEN_PUNCTUATION UC_CATEGORY_Ps /* a.k.a. UC_START_PUNCTUATION */
171#define UC_CLOSE_PUNCTUATION UC_CATEGORY_Pe /* a.k.a. UC_END_PUNCTUATION */
172#define UC_INITIAL_QUOTE_PUNCTUATION UC_CATEGORY_Pi
173#define UC_FINAL_QUOTE_PUNCTUATION UC_CATEGORY_Pf
174#define UC_OTHER_PUNCTUATION UC_CATEGORY_Po
175#define UC_SYMBOL UC_CATEGORY_S
176#define UC_MATH_SYMBOL UC_CATEGORY_Sm
177#define UC_CURRENCY_SYMBOL UC_CATEGORY_Sc
178#define UC_MODIFIER_SYMBOL UC_CATEGORY_Sk
179#define UC_OTHER_SYMBOL UC_CATEGORY_So
180#define UC_SEPARATOR UC_CATEGORY_Z
181#define UC_SPACE_SEPARATOR UC_CATEGORY_Zs
182#define UC_LINE_SEPARATOR UC_CATEGORY_Zl
183#define UC_PARAGRAPH_SEPARATOR UC_CATEGORY_Zp
184#define UC_OTHER UC_CATEGORY_C
185#define UC_CONTROL UC_CATEGORY_Cc
186#define UC_FORMAT UC_CATEGORY_Cf
187#define UC_SURROGATE UC_CATEGORY_Cs /* all of them are invalid characters */
188#define UC_PRIVATE_USE UC_CATEGORY_Co
189#define UC_UNASSIGNED UC_CATEGORY_Cn /* some of them are invalid characters */
190
191/* Return the union of two general categories.
192 This corresponds to the unions of the two sets of characters. */
193extern uc_general_category_t
194 uc_general_category_or (uc_general_category_t category1,
195 uc_general_category_t category2);
196
197/* Return the intersection of two general categories as bit masks.
198 This *does*not* correspond to the intersection of the two sets of
199 characters. */
200extern uc_general_category_t
201 uc_general_category_and (uc_general_category_t category1,
202 uc_general_category_t category2);
203
204/* Return the intersection of a general category with the complement of a
205 second general category, as bit masks.
206 This *does*not* correspond to the intersection with complement, when
207 viewing the categories as sets of characters. */
208extern uc_general_category_t
209 uc_general_category_and_not (uc_general_category_t category1,
210 uc_general_category_t category2);
211
212/* Return the name of a general category. */
213extern const char *
214 uc_general_category_name (uc_general_category_t category)
215 _UC_ATTRIBUTE_PURE;
216
217/* Return the long name of a general category. */
218extern const char *
219 uc_general_category_long_name (uc_general_category_t category)
220 _UC_ATTRIBUTE_PURE;
221
222/* Return the general category given by name, e.g. "Lu", or by long name,
223 e.g. "Uppercase Letter". */
224extern uc_general_category_t
225 uc_general_category_byname (const char *category_name)
226 _UC_ATTRIBUTE_PURE;
227
228/* Return the general category of a Unicode character. */
229extern uc_general_category_t
230 uc_general_category (ucs4_t uc)
231 _UC_ATTRIBUTE_PURE;
232
233/* Test whether a Unicode character belongs to a given category.
234 The CATEGORY argument can be the combination of several predefined
235 general categories. */
236extern bool
237 uc_is_general_category (ucs4_t uc, uc_general_category_t category)
238 _UC_ATTRIBUTE_PURE;
239/* Likewise. This function uses a big table comprising all categories. */
240extern bool
241 uc_is_general_category_withtable (ucs4_t uc, uint32_t bitmask)
242 _UC_ATTRIBUTE_CONST;
243
244/* ========================================================================= */
245
246/* Field 3 of Unicode Character Database: Canonical combining class. */
247
248/* The possible results of uc_combining_class (0..255) are described in
249 UCD.html. The list here is not definitive; more values can be added
250 in future versions. */
251enum
252{
253 UC_CCC_NR = 0, /* Not Reordered */
254 UC_CCC_OV = 1, /* Overlay */
255 UC_CCC_NK = 7, /* Nukta */
256 UC_CCC_KV = 8, /* Kana Voicing */
257 UC_CCC_VR = 9, /* Virama */
258 UC_CCC_ATBL = 200, /* Attached Below Left */
259 UC_CCC_ATB = 202, /* Attached Below */
260 UC_CCC_ATA = 214, /* Attached Above */
261 UC_CCC_ATAR = 216, /* Attached Above Right */
262 UC_CCC_BL = 218, /* Below Left */
263 UC_CCC_B = 220, /* Below */
264 UC_CCC_BR = 222, /* Below Right */
265 UC_CCC_L = 224, /* Left */
266 UC_CCC_R = 226, /* Right */
267 UC_CCC_AL = 228, /* Above Left */
268 UC_CCC_A = 230, /* Above */
269 UC_CCC_AR = 232, /* Above Right */
270 UC_CCC_DB = 233, /* Double Below */
271 UC_CCC_DA = 234, /* Double Above */
272 UC_CCC_IS = 240 /* Iota Subscript */
273};
274
275/* Return the canonical combining class of a Unicode character. */
276extern int
277 uc_combining_class (ucs4_t uc)
278 _UC_ATTRIBUTE_CONST;
279
280/* Return the name of a canonical combining class. */
281extern const char *
282 uc_combining_class_name (int ccc)
283 _UC_ATTRIBUTE_CONST;
284
285/* Return the long name of a canonical combining class. */
286extern const char *
287 uc_combining_class_long_name (int ccc)
288 _UC_ATTRIBUTE_CONST;
289
290/* Return the canonical combining class given by name, e.g. "BL", or by long
291 name, e.g. "Below Left". */
292extern int
293 uc_combining_class_byname (const char *ccc_name)
294 _UC_ATTRIBUTE_PURE;
295
296/* ========================================================================= */
297
298/* Field 4 of Unicode Character Database: Bidi class.
299 Before Unicode 4.0, this field was called "Bidirectional category". */
300
301enum
302{
303 UC_BIDI_L, /* Left-to-Right */
304 UC_BIDI_LRE, /* Left-to-Right Embedding */
305 UC_BIDI_LRO, /* Left-to-Right Override */
306 UC_BIDI_R, /* Right-to-Left */
307 UC_BIDI_AL, /* Right-to-Left Arabic */
308 UC_BIDI_RLE, /* Right-to-Left Embedding */
309 UC_BIDI_RLO, /* Right-to-Left Override */
310 UC_BIDI_PDF, /* Pop Directional Format */
311 UC_BIDI_EN, /* European Number */
312 UC_BIDI_ES, /* European Number Separator */
313 UC_BIDI_ET, /* European Number Terminator */
314 UC_BIDI_AN, /* Arabic Number */
315 UC_BIDI_CS, /* Common Number Separator */
316 UC_BIDI_NSM, /* Non-Spacing Mark */
317 UC_BIDI_BN, /* Boundary Neutral */
318 UC_BIDI_B, /* Paragraph Separator */
319 UC_BIDI_S, /* Segment Separator */
320 UC_BIDI_WS, /* Whitespace */
321 UC_BIDI_ON, /* Other Neutral */
322 UC_BIDI_LRI, /* Left-to-Right Isolate */
323 UC_BIDI_RLI, /* Right-to-Left Isolate */
324 UC_BIDI_FSI, /* First Strong Isolate */
325 UC_BIDI_PDI /* Pop Directional Isolate */
326};
327
328/* Return the name of a bidi class. */
329extern const char *
330 uc_bidi_class_name (int bidi_class)
331 _UC_ATTRIBUTE_CONST;
332/* Same; obsolete function name. */
333extern const char *
334 uc_bidi_category_name (int category)
335 _UC_ATTRIBUTE_CONST;
336
337/* Return the long name of a bidi class. */
338extern const char *
339 uc_bidi_class_long_name (int bidi_class)
340 _UC_ATTRIBUTE_CONST;
341
342/* Return the bidi class given by name, e.g. "LRE", or by long name, e.g.
343 "Left-to-Right Embedding". */
344extern int
345 uc_bidi_class_byname (const char *bidi_class_name)
346 _UC_ATTRIBUTE_PURE;
347/* Same; obsolete function name. */
348extern int
349 uc_bidi_category_byname (const char *category_name)
350 _UC_ATTRIBUTE_PURE;
351
352/* Return the bidi class of a Unicode character. */
353extern int
354 uc_bidi_class (ucs4_t uc)
355 _UC_ATTRIBUTE_CONST;
356/* Same; obsolete function name. */
357extern int
358 uc_bidi_category (ucs4_t uc)
359 _UC_ATTRIBUTE_CONST;
360
361/* Test whether a Unicode character belongs to a given bidi class. */
362extern bool
363 uc_is_bidi_class (ucs4_t uc, int bidi_class)
364 _UC_ATTRIBUTE_CONST;
365/* Same; obsolete function name. */
366extern bool
367 uc_is_bidi_category (ucs4_t uc, int category)
368 _UC_ATTRIBUTE_CONST;
369
370/* ========================================================================= */
371
372/* Field 5 of Unicode Character Database: Character decomposition mapping.
373 See "uninorm.h". */
374
375/* ========================================================================= */
376
377/* Field 6 of Unicode Character Database: Decimal digit value. */
378
379/* Return the decimal digit value of a Unicode character. */
380extern int
381 uc_decimal_value (ucs4_t uc)
382 _UC_ATTRIBUTE_CONST;
383
384/* ========================================================================= */
385
386/* Field 7 of Unicode Character Database: Digit value. */
387
388/* Return the digit value of a Unicode character. */
389extern int
390 uc_digit_value (ucs4_t uc)
391 _UC_ATTRIBUTE_CONST;
392
393/* ========================================================================= */
394
395/* Field 8 of Unicode Character Database: Numeric value. */
396
397/* Return the numeric value of a Unicode character. */
398typedef struct
399{
400 int numerator;
401 int denominator;
402}
403uc_fraction_t;
404extern uc_fraction_t
405 uc_numeric_value (ucs4_t uc)
406 _UC_ATTRIBUTE_CONST;
407
408/* ========================================================================= */
409
410/* Field 9 of Unicode Character Database: Mirrored. */
411
412/* Return the mirrored character of a Unicode character UC in *PUC. */
413extern bool
414 uc_mirror_char (ucs4_t uc, ucs4_t *puc);
415
416/* ========================================================================= */
417
418/* Field 10 of Unicode Character Database: Unicode 1.0 Name.
419 Not available in this library. */
420
421/* ========================================================================= */
422
423/* Field 11 of Unicode Character Database: ISO 10646 comment.
424 Not available in this library. */
425
426/* ========================================================================= */
427
428/* Field 12, 13, 14 of Unicode Character Database: Uppercase mapping,
429 lowercase mapping, titlecase mapping. See "unicase.h". */
430
431/* ========================================================================= */
432
433/* Field 2 of the file ArabicShaping.txt in the Unicode Character Database. */
434
435/* Possible joining types. */
436enum
437{
438 UC_JOINING_TYPE_U, /* Non_Joining */
439 UC_JOINING_TYPE_T, /* Transparent */
440 UC_JOINING_TYPE_C, /* Join_Causing */
441 UC_JOINING_TYPE_L, /* Left_Joining */
442 UC_JOINING_TYPE_R, /* Right_Joining */
443 UC_JOINING_TYPE_D /* Dual_Joining */
444};
445
446/* Return the name of a joining type. */
447extern const char *
448 uc_joining_type_name (int joining_type)
449 _UC_ATTRIBUTE_CONST;
450
451/* Return the long name of a joining type. */
452extern const char *
453 uc_joining_type_long_name (int joining_type)
454 _UC_ATTRIBUTE_CONST;
455
456/* Return the joining type given by name, e.g. "D", or by long name, e.g.
457 "Dual Joining". */
458extern int
459 uc_joining_type_byname (const char *joining_type_name)
460 _UC_ATTRIBUTE_PURE;
461
462/* Return the joining type of a Unicode character. */
463extern int
464 uc_joining_type (ucs4_t uc)
465 _UC_ATTRIBUTE_CONST;
466
467/* ========================================================================= */
468
469/* Field 3 of the file ArabicShaping.txt in the Unicode Character Database. */
470
471/* Possible joining groups.
472 This enumeration may be extended in the future. */
473enum
474{
475 UC_JOINING_GROUP_NONE, /* No_Joining_Group */
476 UC_JOINING_GROUP_AIN, /* Ain */
477 UC_JOINING_GROUP_ALAPH, /* Alaph */
478 UC_JOINING_GROUP_ALEF, /* Alef */
479 UC_JOINING_GROUP_BEH, /* Beh */
480 UC_JOINING_GROUP_BETH, /* Beth */
481 UC_JOINING_GROUP_BURUSHASKI_YEH_BARREE, /* Burushaski_Yeh_Barree */
482 UC_JOINING_GROUP_DAL, /* Dal */
483 UC_JOINING_GROUP_DALATH_RISH, /* Dalath_Rish */
484 UC_JOINING_GROUP_E, /* E */
485 UC_JOINING_GROUP_FARSI_YEH, /* Farsi_Yeh */
486 UC_JOINING_GROUP_FE, /* Fe */
487 UC_JOINING_GROUP_FEH, /* Feh */
488 UC_JOINING_GROUP_FINAL_SEMKATH, /* Final_Semkath */
489 UC_JOINING_GROUP_GAF, /* Gaf */
490 UC_JOINING_GROUP_GAMAL, /* Gamal */
491 UC_JOINING_GROUP_HAH, /* Hah */
492 UC_JOINING_GROUP_HE, /* He */
493 UC_JOINING_GROUP_HEH, /* Heh */
494 UC_JOINING_GROUP_HEH_GOAL, /* Heh_Goal */
495 UC_JOINING_GROUP_HETH, /* Heth */
496 UC_JOINING_GROUP_KAF, /* Kaf */
497 UC_JOINING_GROUP_KAPH, /* Kaph */
498 UC_JOINING_GROUP_KHAPH, /* Khaph */
499 UC_JOINING_GROUP_KNOTTED_HEH, /* Knotted_Heh */
500 UC_JOINING_GROUP_LAM, /* Lam */
501 UC_JOINING_GROUP_LAMADH, /* Lamadh */
502 UC_JOINING_GROUP_MEEM, /* Meem */
503 UC_JOINING_GROUP_MIM, /* Mim */
504 UC_JOINING_GROUP_NOON, /* Noon */
505 UC_JOINING_GROUP_NUN, /* Nun */
506 UC_JOINING_GROUP_NYA, /* Nya */
507 UC_JOINING_GROUP_PE, /* Pe */
508 UC_JOINING_GROUP_QAF, /* Qaf */
509 UC_JOINING_GROUP_QAPH, /* Qaph */
510 UC_JOINING_GROUP_REH, /* Reh */
511 UC_JOINING_GROUP_REVERSED_PE, /* Reversed_Pe */
512 UC_JOINING_GROUP_SAD, /* Sad */
513 UC_JOINING_GROUP_SADHE, /* Sadhe */
514 UC_JOINING_GROUP_SEEN, /* Seen */
515 UC_JOINING_GROUP_SEMKATH, /* Semkath */
516 UC_JOINING_GROUP_SHIN, /* Shin */
517 UC_JOINING_GROUP_SWASH_KAF, /* Swash_Kaf */
518 UC_JOINING_GROUP_SYRIAC_WAW, /* Syriac_Waw */
519 UC_JOINING_GROUP_TAH, /* Tah */
520 UC_JOINING_GROUP_TAW, /* Taw */
521 UC_JOINING_GROUP_TEH_MARBUTA, /* Teh_Marbuta */
522 UC_JOINING_GROUP_TEH_MARBUTA_GOAL, /* Teh_Marbuta_Goal */
523 UC_JOINING_GROUP_TETH, /* Teth */
524 UC_JOINING_GROUP_WAW, /* Waw */
525 UC_JOINING_GROUP_YEH, /* Yeh */
526 UC_JOINING_GROUP_YEH_BARREE, /* Yeh_Barree */
527 UC_JOINING_GROUP_YEH_WITH_TAIL, /* Yeh_With_Tail */
528 UC_JOINING_GROUP_YUDH, /* Yudh */
529 UC_JOINING_GROUP_YUDH_HE, /* Yudh_He */
530 UC_JOINING_GROUP_ZAIN, /* Zain */
531 UC_JOINING_GROUP_ZHAIN, /* Zhain */
532 UC_JOINING_GROUP_ROHINGYA_YEH, /* Rohingya_Yeh */
533 UC_JOINING_GROUP_STRAIGHT_WAW, /* Straight_Waw */
534 UC_JOINING_GROUP_MANICHAEAN_ALEPH, /* Manichaean_Aleph */
535 UC_JOINING_GROUP_MANICHAEAN_BETH, /* Manichaean_Beth */
536 UC_JOINING_GROUP_MANICHAEAN_GIMEL, /* Manichaean_Gimel */
537 UC_JOINING_GROUP_MANICHAEAN_DALETH, /* Manichaean_Daleth */
538 UC_JOINING_GROUP_MANICHAEAN_WAW, /* Manichaean_Waw */
539 UC_JOINING_GROUP_MANICHAEAN_ZAYIN, /* Manichaean_Zayin */
540 UC_JOINING_GROUP_MANICHAEAN_HETH, /* Manichaean_Heth */
541 UC_JOINING_GROUP_MANICHAEAN_TETH, /* Manichaean_Teth */
542 UC_JOINING_GROUP_MANICHAEAN_YODH, /* Manichaean_Yodh */
543 UC_JOINING_GROUP_MANICHAEAN_KAPH, /* Manichaean_Kaph */
544 UC_JOINING_GROUP_MANICHAEAN_LAMEDH, /* Manichaean_Lamedh */
545 UC_JOINING_GROUP_MANICHAEAN_DHAMEDH, /* Manichaean_Dhamedh */
546 UC_JOINING_GROUP_MANICHAEAN_THAMEDH, /* Manichaean_Thamedh */
547 UC_JOINING_GROUP_MANICHAEAN_MEM, /* Manichaean_Mem */
548 UC_JOINING_GROUP_MANICHAEAN_NUN, /* Manichaean_Nun */
549 UC_JOINING_GROUP_MANICHAEAN_SAMEKH, /* Manichaean_Aleph */
550 UC_JOINING_GROUP_MANICHAEAN_AYIN, /* Manichaean_Ayin */
551 UC_JOINING_GROUP_MANICHAEAN_PE, /* Manichaean_Pe */
552 UC_JOINING_GROUP_MANICHAEAN_SADHE, /* Manichaean_Sadhe */
553 UC_JOINING_GROUP_MANICHAEAN_QOPH, /* Manichaean_Qoph */
554 UC_JOINING_GROUP_MANICHAEAN_RESH, /* Manichaean_Resh */
555 UC_JOINING_GROUP_MANICHAEAN_TAW, /* Manichaean_Taw */
556 UC_JOINING_GROUP_MANICHAEAN_ONE, /* Manichaean_One */
557 UC_JOINING_GROUP_MANICHAEAN_FIVE, /* Manichaean_Five */
558 UC_JOINING_GROUP_MANICHAEAN_TEN, /* Manichaean_Ten */
559 UC_JOINING_GROUP_MANICHAEAN_TWENTY, /* Manichaean_Twenty */
560 UC_JOINING_GROUP_MANICHAEAN_HUNDRED, /* Manichaean_Hundred */
561 UC_JOINING_GROUP_AFRICAN_FEH, /* African_Feh */
562 UC_JOINING_GROUP_AFRICAN_QAF, /* African_Qaf */
563 UC_JOINING_GROUP_AFRICAN_NOON, /* African_Noon */
564 UC_JOINING_GROUP_MALAYALAM_NGA, /* Malayalam_Nga */
565 UC_JOINING_GROUP_MALAYALAM_JA, /* Malayalam_Ja */
566 UC_JOINING_GROUP_MALAYALAM_NYA, /* Malayalam_Nya */
567 UC_JOINING_GROUP_MALAYALAM_TTA, /* Malayalam_Tta */
568 UC_JOINING_GROUP_MALAYALAM_NNA, /* Malayalam_Nna */
569 UC_JOINING_GROUP_MALAYALAM_NNNA, /* Malayalam_Nnna */
570 UC_JOINING_GROUP_MALAYALAM_BHA, /* Malayalam_Bha */
571 UC_JOINING_GROUP_MALAYALAM_RA, /* Malayalam_Ra */
572 UC_JOINING_GROUP_MALAYALAM_LLA, /* Malayalam_Lla */
573 UC_JOINING_GROUP_MALAYALAM_LLLA, /* Malayalam_Llla */
574 UC_JOINING_GROUP_MALAYALAM_SSA, /* Malayalam_Ssa */
575 UC_JOINING_GROUP_HANIFI_ROHINGYA_PA, /* Hanifi_Rohingya_Pa */
576 UC_JOINING_GROUP_HANIFI_ROHINGYA_KINNA_YA, /* Hanifi_Rohingya_Kinna_Ya */
577 UC_JOINING_GROUP_THIN_YEH, /* Thin_Yeh */
578 UC_JOINING_GROUP_VERTICAL_TAIL, /* Vertical_Tail */
579 UC_JOINING_GROUP_KASHMIRI_YEH, /* Kashmiri_Yeh */
580 UC_JOINING_GROUP_THIN_NOON /* Thin_Noon */
581};
582
583/* Return the name of a joining group. */
584extern const char *
585 uc_joining_group_name (int joining_group)
586 _UC_ATTRIBUTE_CONST;
587
588/* Return the joining group given by name, e.g. "Teh_Marbuta". */
589extern int
590 uc_joining_group_byname (const char *joining_group_name)
591 _UC_ATTRIBUTE_PURE;
592
593/* Return the joining group of a Unicode character. */
594extern int
595 uc_joining_group (ucs4_t uc)
596 _UC_ATTRIBUTE_CONST;
597
598/* ========================================================================= */
599
600/* Common API for properties. */
601
602/* Data type denoting a property. This is not just a number, but rather a
603 pointer to the test functions, so that programs that use only few of the
604 properties don't have a link-time dependency towards all the tables. */
605typedef struct
606{
607 bool (*test_fn) (ucs4_t uc);
608}
609uc_property_t;
610
611/* Predefined properties. */
612/* General. */
613extern @GNULIB_UNICTYPE_PROPERTY_WHITE_SPACE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_WHITE_SPACE;
614extern @GNULIB_UNICTYPE_PROPERTY_ALPHABETIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ALPHABETIC;
615extern @GNULIB_UNICTYPE_PROPERTY_OTHER_ALPHABETIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_ALPHABETIC;
616extern @GNULIB_UNICTYPE_PROPERTY_NOT_A_CHARACTER_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_NOT_A_CHARACTER;
617extern @GNULIB_UNICTYPE_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT;
618extern @GNULIB_UNICTYPE_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT;
619extern @GNULIB_UNICTYPE_PROPERTY_DEPRECATED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DEPRECATED;
620extern @GNULIB_UNICTYPE_PROPERTY_LOGICAL_ORDER_EXCEPTION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_LOGICAL_ORDER_EXCEPTION;
621extern @GNULIB_UNICTYPE_PROPERTY_VARIATION_SELECTOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_VARIATION_SELECTOR;
622extern @GNULIB_UNICTYPE_PROPERTY_PRIVATE_USE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PRIVATE_USE;
623extern @GNULIB_UNICTYPE_PROPERTY_UNASSIGNED_CODE_VALUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_UNASSIGNED_CODE_VALUE;
624/* Case. */
625extern @GNULIB_UNICTYPE_PROPERTY_UPPERCASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_UPPERCASE;
626extern @GNULIB_UNICTYPE_PROPERTY_OTHER_UPPERCASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_UPPERCASE;
627extern @GNULIB_UNICTYPE_PROPERTY_LOWERCASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_LOWERCASE;
628extern @GNULIB_UNICTYPE_PROPERTY_OTHER_LOWERCASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_LOWERCASE;
629extern @GNULIB_UNICTYPE_PROPERTY_TITLECASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_TITLECASE;
630extern @GNULIB_UNICTYPE_PROPERTY_CASED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CASED;
631extern @GNULIB_UNICTYPE_PROPERTY_CASE_IGNORABLE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CASE_IGNORABLE;
632extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_LOWERCASED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_LOWERCASED;
633extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_UPPERCASED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_UPPERCASED;
634extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_TITLECASED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_TITLECASED;
635extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEFOLDED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_CASEFOLDED;
636extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEMAPPED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_CASEMAPPED;
637extern @GNULIB_UNICTYPE_PROPERTY_SOFT_DOTTED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_SOFT_DOTTED;
638/* Identifiers. */
639extern @GNULIB_UNICTYPE_PROPERTY_ID_START_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ID_START;
640extern @GNULIB_UNICTYPE_PROPERTY_OTHER_ID_START_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_ID_START;
641extern @GNULIB_UNICTYPE_PROPERTY_ID_CONTINUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ID_CONTINUE;
642extern @GNULIB_UNICTYPE_PROPERTY_OTHER_ID_CONTINUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_ID_CONTINUE;
643extern @GNULIB_UNICTYPE_PROPERTY_XID_START_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_XID_START;
644extern @GNULIB_UNICTYPE_PROPERTY_XID_CONTINUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_XID_CONTINUE;
645extern @GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_START_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ID_COMPAT_MATH_START;
646extern @GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_CONTINUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ID_COMPAT_MATH_CONTINUE;
647extern @GNULIB_UNICTYPE_PROPERTY_PATTERN_WHITE_SPACE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PATTERN_WHITE_SPACE;
648extern @GNULIB_UNICTYPE_PROPERTY_PATTERN_SYNTAX_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PATTERN_SYNTAX;
649/* Shaping and rendering. */
650extern @GNULIB_UNICTYPE_PROPERTY_JOIN_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_JOIN_CONTROL;
651extern @GNULIB_UNICTYPE_PROPERTY_GRAPHEME_BASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_GRAPHEME_BASE;
652extern @GNULIB_UNICTYPE_PROPERTY_GRAPHEME_EXTEND_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_GRAPHEME_EXTEND;
653extern @GNULIB_UNICTYPE_PROPERTY_OTHER_GRAPHEME_EXTEND_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_GRAPHEME_EXTEND;
654extern @GNULIB_UNICTYPE_PROPERTY_GRAPHEME_LINK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_GRAPHEME_LINK;
655extern @GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_MODIFIER_COMBINING_MARK;
656/* Bidi. */
657extern @GNULIB_UNICTYPE_PROPERTY_BIDI_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_CONTROL;
658extern @GNULIB_UNICTYPE_PROPERTY_BIDI_LEFT_TO_RIGHT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_LEFT_TO_RIGHT;
659extern @GNULIB_UNICTYPE_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT;
660extern @GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT;
661extern @GNULIB_UNICTYPE_PROPERTY_BIDI_EUROPEAN_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_EUROPEAN_DIGIT;
662extern @GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_EUR_NUM_SEPARATOR;
663extern @GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_TERMINATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_EUR_NUM_TERMINATOR;
664extern @GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_ARABIC_DIGIT;
665extern @GNULIB_UNICTYPE_PROPERTY_BIDI_COMMON_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_COMMON_SEPARATOR;
666extern @GNULIB_UNICTYPE_PROPERTY_BIDI_BLOCK_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_BLOCK_SEPARATOR;
667extern @GNULIB_UNICTYPE_PROPERTY_BIDI_SEGMENT_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_SEGMENT_SEPARATOR;
668extern @GNULIB_UNICTYPE_PROPERTY_BIDI_WHITESPACE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_WHITESPACE;
669extern @GNULIB_UNICTYPE_PROPERTY_BIDI_NON_SPACING_MARK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_NON_SPACING_MARK;
670extern @GNULIB_UNICTYPE_PROPERTY_BIDI_BOUNDARY_NEUTRAL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_BOUNDARY_NEUTRAL;
671extern @GNULIB_UNICTYPE_PROPERTY_BIDI_PDF_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_PDF;
672extern @GNULIB_UNICTYPE_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE;
673extern @GNULIB_UNICTYPE_PROPERTY_BIDI_OTHER_NEUTRAL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_OTHER_NEUTRAL;
674/* Numeric. */
675extern @GNULIB_UNICTYPE_PROPERTY_HEX_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_HEX_DIGIT;
676extern @GNULIB_UNICTYPE_PROPERTY_ASCII_HEX_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ASCII_HEX_DIGIT;
677/* CJK. */
678extern @GNULIB_UNICTYPE_PROPERTY_IDEOGRAPHIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IDEOGRAPHIC;
679extern @GNULIB_UNICTYPE_PROPERTY_UNIFIED_IDEOGRAPH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_UNIFIED_IDEOGRAPH;
680extern @GNULIB_UNICTYPE_PROPERTY_RADICAL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_RADICAL;
681extern @GNULIB_UNICTYPE_PROPERTY_IDS_UNARY_OPERATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IDS_UNARY_OPERATOR;
682extern @GNULIB_UNICTYPE_PROPERTY_IDS_BINARY_OPERATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IDS_BINARY_OPERATOR;
683extern @GNULIB_UNICTYPE_PROPERTY_IDS_TRINARY_OPERATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IDS_TRINARY_OPERATOR;
684/* Emoji. */
685extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI;
686extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_PRESENTATION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI_PRESENTATION;
687extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI_MODIFIER;
688extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_BASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI_MODIFIER_BASE;
689extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_COMPONENT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI_COMPONENT;
690extern @GNULIB_UNICTYPE_PROPERTY_EXTENDED_PICTOGRAPHIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EXTENDED_PICTOGRAPHIC;
691/* Misc. */
692extern @GNULIB_UNICTYPE_PROPERTY_ZERO_WIDTH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ZERO_WIDTH;
693extern @GNULIB_UNICTYPE_PROPERTY_SPACE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_SPACE;
694extern @GNULIB_UNICTYPE_PROPERTY_NON_BREAK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_NON_BREAK;
695extern @GNULIB_UNICTYPE_PROPERTY_ISO_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ISO_CONTROL;
696extern @GNULIB_UNICTYPE_PROPERTY_FORMAT_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_FORMAT_CONTROL;
697extern @GNULIB_UNICTYPE_PROPERTY_PREPENDED_CONCATENATION_MARK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PREPENDED_CONCATENATION_MARK;
698extern @GNULIB_UNICTYPE_PROPERTY_DASH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DASH;
699extern @GNULIB_UNICTYPE_PROPERTY_HYPHEN_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_HYPHEN;
700extern @GNULIB_UNICTYPE_PROPERTY_PUNCTUATION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PUNCTUATION;
701extern @GNULIB_UNICTYPE_PROPERTY_LINE_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_LINE_SEPARATOR;
702extern @GNULIB_UNICTYPE_PROPERTY_PARAGRAPH_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PARAGRAPH_SEPARATOR;
703extern @GNULIB_UNICTYPE_PROPERTY_QUOTATION_MARK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_QUOTATION_MARK;
704extern @GNULIB_UNICTYPE_PROPERTY_SENTENCE_TERMINAL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_SENTENCE_TERMINAL;
705extern @GNULIB_UNICTYPE_PROPERTY_TERMINAL_PUNCTUATION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_TERMINAL_PUNCTUATION;
706extern @GNULIB_UNICTYPE_PROPERTY_CURRENCY_SYMBOL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CURRENCY_SYMBOL;
707extern @GNULIB_UNICTYPE_PROPERTY_MATH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_MATH;
708extern @GNULIB_UNICTYPE_PROPERTY_OTHER_MATH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_MATH;
709extern @GNULIB_UNICTYPE_PROPERTY_PAIRED_PUNCTUATION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PAIRED_PUNCTUATION;
710extern @GNULIB_UNICTYPE_PROPERTY_LEFT_OF_PAIR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_LEFT_OF_PAIR;
711extern @GNULIB_UNICTYPE_PROPERTY_COMBINING_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_COMBINING;
712extern @GNULIB_UNICTYPE_PROPERTY_COMPOSITE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_COMPOSITE;
713extern @GNULIB_UNICTYPE_PROPERTY_DECIMAL_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DECIMAL_DIGIT;
714extern @GNULIB_UNICTYPE_PROPERTY_NUMERIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_NUMERIC;
715extern @GNULIB_UNICTYPE_PROPERTY_DIACRITIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DIACRITIC;
716extern @GNULIB_UNICTYPE_PROPERTY_EXTENDER_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EXTENDER;
717extern @GNULIB_UNICTYPE_PROPERTY_IGNORABLE_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IGNORABLE_CONTROL;
718extern @GNULIB_UNICTYPE_PROPERTY_REGIONAL_INDICATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_REGIONAL_INDICATOR;
719
720/* Return the property given by name, e.g. "White space". */
721extern uc_property_t
722 uc_property_byname (const char *property_name);
723
724/* Test whether a property is valid. */
725#define uc_property_is_valid(property) ((property).test_fn != NULL)
726
727/* Test whether a Unicode character has a given property. */
728extern bool
729 uc_is_property (ucs4_t uc, uc_property_t property);
730extern bool uc_is_property_white_space (ucs4_t uc)
731 _UC_ATTRIBUTE_CONST;
732extern bool uc_is_property_alphabetic (ucs4_t uc)
733 _UC_ATTRIBUTE_CONST;
734extern bool uc_is_property_other_alphabetic (ucs4_t uc)
735 _UC_ATTRIBUTE_CONST;
736extern bool uc_is_property_not_a_character (ucs4_t uc)
737 _UC_ATTRIBUTE_CONST;
738extern bool uc_is_property_default_ignorable_code_point (ucs4_t uc)
739 _UC_ATTRIBUTE_CONST;
740extern bool uc_is_property_other_default_ignorable_code_point (ucs4_t uc)
741 _UC_ATTRIBUTE_CONST;
742extern bool uc_is_property_deprecated (ucs4_t uc)
743 _UC_ATTRIBUTE_CONST;
744extern bool uc_is_property_logical_order_exception (ucs4_t uc)
745 _UC_ATTRIBUTE_CONST;
746extern bool uc_is_property_variation_selector (ucs4_t uc)
747 _UC_ATTRIBUTE_CONST;
748extern bool uc_is_property_private_use (ucs4_t uc)
749 _UC_ATTRIBUTE_CONST;
750extern bool uc_is_property_unassigned_code_value (ucs4_t uc)
751 _UC_ATTRIBUTE_CONST;
752extern bool uc_is_property_uppercase (ucs4_t uc)
753 _UC_ATTRIBUTE_CONST;
754extern bool uc_is_property_other_uppercase (ucs4_t uc)
755 _UC_ATTRIBUTE_CONST;
756extern bool uc_is_property_lowercase (ucs4_t uc)
757 _UC_ATTRIBUTE_CONST;
758extern bool uc_is_property_other_lowercase (ucs4_t uc)
759 _UC_ATTRIBUTE_CONST;
760extern bool uc_is_property_titlecase (ucs4_t uc)
761 _UC_ATTRIBUTE_CONST;
762extern bool uc_is_property_cased (ucs4_t uc)
763 _UC_ATTRIBUTE_CONST;
764extern bool uc_is_property_case_ignorable (ucs4_t uc)
765 _UC_ATTRIBUTE_CONST;
766extern bool uc_is_property_changes_when_lowercased (ucs4_t uc)
767 _UC_ATTRIBUTE_CONST;
768extern bool uc_is_property_changes_when_uppercased (ucs4_t uc)
769 _UC_ATTRIBUTE_CONST;
770extern bool uc_is_property_changes_when_titlecased (ucs4_t uc)
771 _UC_ATTRIBUTE_CONST;
772extern bool uc_is_property_changes_when_casefolded (ucs4_t uc)
773 _UC_ATTRIBUTE_CONST;
774extern bool uc_is_property_changes_when_casemapped (ucs4_t uc)
775 _UC_ATTRIBUTE_CONST;
776extern bool uc_is_property_soft_dotted (ucs4_t uc)
777 _UC_ATTRIBUTE_CONST;
778extern bool uc_is_property_id_start (ucs4_t uc)
779 _UC_ATTRIBUTE_CONST;
780extern bool uc_is_property_other_id_start (ucs4_t uc)
781 _UC_ATTRIBUTE_CONST;
782extern bool uc_is_property_id_continue (ucs4_t uc)
783 _UC_ATTRIBUTE_CONST;
784extern bool uc_is_property_other_id_continue (ucs4_t uc)
785 _UC_ATTRIBUTE_CONST;
786extern bool uc_is_property_xid_start (ucs4_t uc)
787 _UC_ATTRIBUTE_CONST;
788extern bool uc_is_property_xid_continue (ucs4_t uc)
789 _UC_ATTRIBUTE_CONST;
790extern bool uc_is_property_id_compat_math_start (ucs4_t uc)
791 _UC_ATTRIBUTE_CONST;
792extern bool uc_is_property_id_compat_math_continue (ucs4_t uc)
793 _UC_ATTRIBUTE_CONST;
794extern bool uc_is_property_pattern_white_space (ucs4_t uc)
795 _UC_ATTRIBUTE_CONST;
796extern bool uc_is_property_pattern_syntax (ucs4_t uc)
797 _UC_ATTRIBUTE_CONST;
798extern bool uc_is_property_join_control (ucs4_t uc)
799 _UC_ATTRIBUTE_CONST;
800extern bool uc_is_property_grapheme_base (ucs4_t uc)
801 _UC_ATTRIBUTE_CONST;
802extern bool uc_is_property_grapheme_extend (ucs4_t uc)
803 _UC_ATTRIBUTE_CONST;
804extern bool uc_is_property_other_grapheme_extend (ucs4_t uc)
805 _UC_ATTRIBUTE_CONST;
806extern bool uc_is_property_grapheme_link (ucs4_t uc)
807 _UC_ATTRIBUTE_CONST;
808extern bool uc_is_property_modifier_combining_mark (ucs4_t uc)
809 _UC_ATTRIBUTE_CONST;
810extern bool uc_is_property_bidi_control (ucs4_t uc)
811 _UC_ATTRIBUTE_CONST;
812extern bool uc_is_property_bidi_left_to_right (ucs4_t uc)
813 _UC_ATTRIBUTE_CONST;
814extern bool uc_is_property_bidi_hebrew_right_to_left (ucs4_t uc)
815 _UC_ATTRIBUTE_CONST;
816extern bool uc_is_property_bidi_arabic_right_to_left (ucs4_t uc)
817 _UC_ATTRIBUTE_CONST;
818extern bool uc_is_property_bidi_european_digit (ucs4_t uc)
819 _UC_ATTRIBUTE_CONST;
820extern bool uc_is_property_bidi_eur_num_separator (ucs4_t uc)
821 _UC_ATTRIBUTE_CONST;
822extern bool uc_is_property_bidi_eur_num_terminator (ucs4_t uc)
823 _UC_ATTRIBUTE_CONST;
824extern bool uc_is_property_bidi_arabic_digit (ucs4_t uc)
825 _UC_ATTRIBUTE_CONST;
826extern bool uc_is_property_bidi_common_separator (ucs4_t uc)
827 _UC_ATTRIBUTE_CONST;
828extern bool uc_is_property_bidi_block_separator (ucs4_t uc)
829 _UC_ATTRIBUTE_CONST;
830extern bool uc_is_property_bidi_segment_separator (ucs4_t uc)
831 _UC_ATTRIBUTE_CONST;
832extern bool uc_is_property_bidi_whitespace (ucs4_t uc)
833 _UC_ATTRIBUTE_CONST;
834extern bool uc_is_property_bidi_non_spacing_mark (ucs4_t uc)
835 _UC_ATTRIBUTE_CONST;
836extern bool uc_is_property_bidi_boundary_neutral (ucs4_t uc)
837 _UC_ATTRIBUTE_CONST;
838extern bool uc_is_property_bidi_pdf (ucs4_t uc)
839 _UC_ATTRIBUTE_CONST;
840extern bool uc_is_property_bidi_embedding_or_override (ucs4_t uc)
841 _UC_ATTRIBUTE_CONST;
842extern bool uc_is_property_bidi_other_neutral (ucs4_t uc)
843 _UC_ATTRIBUTE_CONST;
844extern bool uc_is_property_hex_digit (ucs4_t uc)
845 _UC_ATTRIBUTE_CONST;
846extern bool uc_is_property_ascii_hex_digit (ucs4_t uc)
847 _UC_ATTRIBUTE_CONST;
848extern bool uc_is_property_ideographic (ucs4_t uc)
849 _UC_ATTRIBUTE_CONST;
850extern bool uc_is_property_unified_ideograph (ucs4_t uc)
851 _UC_ATTRIBUTE_CONST;
852extern bool uc_is_property_radical (ucs4_t uc)
853 _UC_ATTRIBUTE_CONST;
854extern bool uc_is_property_ids_unary_operator (ucs4_t uc)
855 _UC_ATTRIBUTE_CONST;
856extern bool uc_is_property_ids_binary_operator (ucs4_t uc)
857 _UC_ATTRIBUTE_CONST;
858extern bool uc_is_property_ids_trinary_operator (ucs4_t uc)
859 _UC_ATTRIBUTE_CONST;
860extern bool uc_is_property_emoji (ucs4_t uc)
861 _UC_ATTRIBUTE_CONST;
862extern bool uc_is_property_emoji_presentation (ucs4_t uc)
863 _UC_ATTRIBUTE_CONST;
864extern bool uc_is_property_emoji_modifier (ucs4_t uc)
865 _UC_ATTRIBUTE_CONST;
866extern bool uc_is_property_emoji_modifier_base (ucs4_t uc)
867 _UC_ATTRIBUTE_CONST;
868extern bool uc_is_property_emoji_component (ucs4_t uc)
869 _UC_ATTRIBUTE_CONST;
870extern bool uc_is_property_extended_pictographic (ucs4_t uc)
871 _UC_ATTRIBUTE_CONST;
872extern bool uc_is_property_zero_width (ucs4_t uc)
873 _UC_ATTRIBUTE_CONST;
874extern bool uc_is_property_space (ucs4_t uc)
875 _UC_ATTRIBUTE_CONST;
876extern bool uc_is_property_non_break (ucs4_t uc)
877 _UC_ATTRIBUTE_CONST;
878extern bool uc_is_property_iso_control (ucs4_t uc)
879 _UC_ATTRIBUTE_CONST;
880extern bool uc_is_property_format_control (ucs4_t uc)
881 _UC_ATTRIBUTE_CONST;
882extern bool uc_is_property_prepended_concatenation_mark (ucs4_t uc)
883 _UC_ATTRIBUTE_CONST;
884extern bool uc_is_property_dash (ucs4_t uc)
885 _UC_ATTRIBUTE_CONST;
886extern bool uc_is_property_hyphen (ucs4_t uc)
887 _UC_ATTRIBUTE_CONST;
888extern bool uc_is_property_punctuation (ucs4_t uc)
889 _UC_ATTRIBUTE_CONST;
890extern bool uc_is_property_line_separator (ucs4_t uc)
891 _UC_ATTRIBUTE_CONST;
892extern bool uc_is_property_paragraph_separator (ucs4_t uc)
893 _UC_ATTRIBUTE_CONST;
894extern bool uc_is_property_quotation_mark (ucs4_t uc)
895 _UC_ATTRIBUTE_CONST;
896extern bool uc_is_property_sentence_terminal (ucs4_t uc)
897 _UC_ATTRIBUTE_CONST;
898extern bool uc_is_property_terminal_punctuation (ucs4_t uc)
899 _UC_ATTRIBUTE_CONST;
900extern bool uc_is_property_currency_symbol (ucs4_t uc)
901 _UC_ATTRIBUTE_CONST;
902extern bool uc_is_property_math (ucs4_t uc)
903 _UC_ATTRIBUTE_CONST;
904extern bool uc_is_property_other_math (ucs4_t uc)
905 _UC_ATTRIBUTE_CONST;
906extern bool uc_is_property_paired_punctuation (ucs4_t uc)
907 _UC_ATTRIBUTE_CONST;
908extern bool uc_is_property_left_of_pair (ucs4_t uc)
909 _UC_ATTRIBUTE_CONST;
910extern bool uc_is_property_combining (ucs4_t uc)
911 _UC_ATTRIBUTE_CONST;
912extern bool uc_is_property_composite (ucs4_t uc)
913 _UC_ATTRIBUTE_CONST;
914extern bool uc_is_property_decimal_digit (ucs4_t uc)
915 _UC_ATTRIBUTE_CONST;
916extern bool uc_is_property_numeric (ucs4_t uc)
917 _UC_ATTRIBUTE_CONST;
918extern bool uc_is_property_diacritic (ucs4_t uc)
919 _UC_ATTRIBUTE_CONST;
920extern bool uc_is_property_extender (ucs4_t uc)
921 _UC_ATTRIBUTE_CONST;
922extern bool uc_is_property_ignorable_control (ucs4_t uc)
923 _UC_ATTRIBUTE_CONST;
924extern bool uc_is_property_regional_indicator (ucs4_t uc)
925 _UC_ATTRIBUTE_CONST;
926
927/* ========================================================================= */
928
929/* Other attributes. */
930
931/* ------------------------------------------------------------------------- */
932
933/* Indic_Conjunct_Break (InCB): from the file DerivedCoreProperties.txt
934 in the Unicode Character Database. */
935
936/* Possible values of the Indic_Conjunct_Break attribute.
937 This enumeration may be extended in the future. */
938enum
939{
940 UC_INDIC_CONJUNCT_BREAK_NONE, /* None */
941 UC_INDIC_CONJUNCT_BREAK_CONSONANT, /* Consonant */
942 UC_INDIC_CONJUNCT_BREAK_LINKER, /* Linker */
943 UC_INDIC_CONJUNCT_BREAK_EXTEND /* Extend */
944};
945
946/* Return the name of an Indic_Conjunct_Break value. */
947extern const char *
948 uc_indic_conjunct_break_name (int indic_conjunct_break)
949 _UC_ATTRIBUTE_CONST;
950
951/* Return the Indic_Conjunct_Break value given by name, e.g. "Consonant". */
952extern int
953 uc_indic_conjunct_break_byname (const char *indic_conjunct_break_name)
954 _UC_ATTRIBUTE_PURE;
955
956/* Return the Indic_Conjunct_Break attribute of a Unicode character. */
957extern int
958 uc_indic_conjunct_break (ucs4_t uc)
959 _UC_ATTRIBUTE_CONST;
960
961/* ========================================================================= */
962
963/* Subdivision of the Unicode characters into scripts. */
964
965typedef struct
966{
967 unsigned int code : 21;
968 unsigned int start : 1;
969 unsigned int end : 1;
970}
971uc_interval_t;
972typedef struct
973{
974 unsigned int nintervals;
975 const uc_interval_t *intervals;
976 const char *name;
977}
978uc_script_t;
979
980/* Return the script of a Unicode character. */
981extern const uc_script_t *
982 uc_script (ucs4_t uc)
983 _UC_ATTRIBUTE_CONST;
984
985/* Return the script given by name, e.g. "HAN". */
986extern const uc_script_t *
987 uc_script_byname (const char *script_name)
988 _UC_ATTRIBUTE_PURE;
989
990/* Test whether a Unicode character belongs to a given script. */
991extern bool
992 uc_is_script (ucs4_t uc, const uc_script_t *script)
993 _UC_ATTRIBUTE_PURE;
994
995/* Get the list of all scripts. */
996extern void
997 uc_all_scripts (const uc_script_t **scripts, size_t *count);
998
999/* ========================================================================= */
1000
1001/* Subdivision of the Unicode character range into blocks. */
1002
1003typedef struct
1004{
1005 ucs4_t start;
1006 ucs4_t end;
1007 const char *name;
1008}
1009uc_block_t;
1010
1011/* Return the block a character belongs to. */
1012extern const uc_block_t *
1013 uc_block (ucs4_t uc)
1014 _UC_ATTRIBUTE_CONST;
1015
1016/* Test whether a Unicode character belongs to a given block. */
1017extern bool
1018 uc_is_block (ucs4_t uc, const uc_block_t *block)
1019 _UC_ATTRIBUTE_PURE;
1020
1021/* Get the list of all blocks. */
1022extern void
1023 uc_all_blocks (const uc_block_t **blocks, size_t *count);
1024
1025/* ========================================================================= */
1026
1027/* Properties taken from language standards. */
1028
1029/* Test whether a Unicode character is considered whitespace in ISO C 99. */
1030extern bool
1031 uc_is_c_whitespace (ucs4_t uc)
1032 _UC_ATTRIBUTE_CONST;
1033
1034/* Test whether a Unicode character is considered whitespace in Java. */
1035extern bool
1036 uc_is_java_whitespace (ucs4_t uc)
1037 _UC_ATTRIBUTE_CONST;
1038
1039enum
1040{
1041 UC_IDENTIFIER_START, /* valid as first or subsequent character */
1042 UC_IDENTIFIER_VALID, /* valid as subsequent character only */
1043 UC_IDENTIFIER_INVALID, /* not valid */
1044 UC_IDENTIFIER_IGNORABLE /* ignorable (Java only) */
1045};
1046
1047/* Return the categorization of a Unicode character w.r.t. the ISO C 99
1048 identifier syntax. */
1049extern int
1050 uc_c_ident_category (ucs4_t uc)
1051 _UC_ATTRIBUTE_CONST;
1052
1053/* Return the categorization of a Unicode character w.r.t. the Java
1054 identifier syntax. */
1055extern int
1056 uc_java_ident_category (ucs4_t uc)
1057 _UC_ATTRIBUTE_CONST;
1058
1059/* ========================================================================= */
1060
1061/* Like ISO C <ctype.h> and <wctype.h>. These functions are deprecated,
1062 because this set of functions was designed with ASCII in mind and cannot
1063 reflect the more diverse reality of the Unicode character set. But they
1064 can be a quick-and-dirty porting aid when migrating from wchar_t APIs
1065 to Unicode strings. */
1066
1067/* Test for any character for which 'uc_is_alpha' or 'uc_is_digit' is true. */
1068extern bool
1069 uc_is_alnum (ucs4_t uc)
1070 _UC_ATTRIBUTE_CONST;
1071
1072/* Test for any character for which 'uc_is_upper' or 'uc_is_lower' is true,
1073 or any character that is one of a locale-specific set of characters for
1074 which none of 'uc_is_cntrl', 'uc_is_digit', 'uc_is_punct', or 'uc_is_space'
1075 is true. */
1076extern bool
1077 uc_is_alpha (ucs4_t uc)
1078 _UC_ATTRIBUTE_CONST;
1079
1080/* Test for any control character. */
1081extern bool
1082 uc_is_cntrl (ucs4_t uc)
1083 _UC_ATTRIBUTE_CONST;
1084
1085/* Test for any character that corresponds to a decimal-digit character. */
1086extern bool
1087 uc_is_digit (ucs4_t uc)
1088 _UC_ATTRIBUTE_CONST;
1089
1090/* Test for any character for which 'uc_is_print' is true and 'uc_is_space'
1091 is false. */
1092extern bool
1093 uc_is_graph (ucs4_t uc)
1094 _UC_ATTRIBUTE_CONST;
1095
1096/* Test for any character that corresponds to a lowercase letter or is one
1097 of a locale-specific set of characters for which none of 'uc_is_cntrl',
1098 'uc_is_digit', 'uc_is_punct', or 'uc_is_space' is true. */
1099extern bool
1100 uc_is_lower (ucs4_t uc)
1101 _UC_ATTRIBUTE_CONST;
1102
1103/* Test for any printing character. */
1104extern bool
1105 uc_is_print (ucs4_t uc)
1106 _UC_ATTRIBUTE_CONST;
1107
1108/* Test for any printing character that is one of a locale-specific set of
1109 characters for which neither 'uc_is_space' nor 'uc_is_alnum' is true. */
1110extern bool
1111 uc_is_punct (ucs4_t uc)
1112 _UC_ATTRIBUTE_CONST;
1113
1114/* Test for any character that corresponds to a locale-specific set of
1115 characters for which none of 'uc_is_alnum', 'uc_is_graph', or 'uc_is_punct'
1116 is true. */
1117extern bool
1118 uc_is_space (ucs4_t uc)
1119 _UC_ATTRIBUTE_CONST;
1120
1121/* Test for any character that corresponds to an uppercase letter or is one
1122 of a locale-specific set of character for which none of 'uc_is_cntrl',
1123 'uc_is_digit', 'uc_is_punct', or 'uc_is_space' is true. */
1124extern bool
1125 uc_is_upper (ucs4_t uc)
1126 _UC_ATTRIBUTE_CONST;
1127
1128/* Test for any character that corresponds to a hexadecimal-digit
1129 character. */
1130extern bool
1131 uc_is_xdigit (ucs4_t uc)
1132 _UC_ATTRIBUTE_CONST;
1133
1134/* GNU extension. */
1135/* Test for any character that corresponds to a standard blank character or
1136 a locale-specific set of characters for which 'uc_is_alnum' is false. */
1137extern bool
1138 uc_is_blank (ucs4_t uc)
1139 _UC_ATTRIBUTE_CONST;
1140
1141/* ========================================================================= */
1142
1143#ifdef __cplusplus
1144}
1145#endif
1146
1147#endif /* _UNICTYPE_H */
diff --git a/gl/unictype/.dirstamp b/gl/unictype/.dirstamp
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/gl/unictype/.dirstamp
diff --git a/gl/unictype/bitmap.h b/gl/unictype/bitmap.h
new file mode 100644
index 00000000..621861da
--- /dev/null
+++ b/gl/unictype/bitmap.h
@@ -0,0 +1,48 @@
1/* Three-level bitmap lookup.
2 Copyright (C) 2000-2002, 2005-2007, 2009-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2000-2002.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18static inline int bitmap_lookup (const void *table, ucs4_t uc);
19
20/* These values are currently hardcoded into gen-uni-tables.c, function
21 output_predicate(). */
22#define header_0 16
23#define header_2 9
24#define header_3 127
25#define header_4 15
26
27static inline int
28bitmap_lookup (const void *table, ucs4_t uc)
29{
30 unsigned int index1 = uc >> header_0;
31 if (index1 < ((const int *) table)[0])
32 {
33 int lookup1 = ((const int *) table)[1 + index1];
34 if (lookup1 >= 0)
35 {
36 unsigned int index2 = (uc >> header_2) & header_3;
37 int lookup2 = ((const short *) table)[lookup1 + index2];
38 if (lookup2 >= 0)
39 {
40 unsigned int index3 = (uc >> 5) & header_4;
41 unsigned int lookup3 = ((const unsigned int *) table)[lookup2 + index3];
42
43 return (lookup3 >> (uc & 0x1f)) & 1;
44 }
45 }
46 }
47 return 0;
48}
diff --git a/gl/unictype/ctype_alnum.c b/gl/unictype/ctype_alnum.c
new file mode 100644
index 00000000..7cd9157a
--- /dev/null
+++ b/gl/unictype/ctype_alnum.c
@@ -0,0 +1,32 @@
1/* ISO C <ctype.h> like properties of Unicode characters.
2 Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2002.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#include <config.h>
19
20/* Specification. */
21#include "unictype.h"
22
23#include "bitmap.h"
24
25/* Define u_is_alnum table. */
26#include "ctype_alnum.h"
27
28bool
29uc_is_alnum (ucs4_t uc)
30{
31 return bitmap_lookup (&u_is_alnum, uc);
32}
diff --git a/gl/unictype/ctype_alnum.h b/gl/unictype/ctype_alnum.h
new file mode 100644
index 00000000..0530175e
--- /dev/null
+++ b/gl/unictype/ctype_alnum.h
@@ -0,0 +1,889 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* ISO C <ctype.h> like properties of Unicode characters. */
3/* Generated automatically by gen-uni-tables.c for Unicode 17.0.0. */
4
5/* Copyright (C) 2000-2025 Free Software Foundation, Inc.
6
7 This file is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
11
12 This file is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19
20#define header_0 16
21#define header_2 9
22#define header_3 127
23#define header_4 15
24static const
25struct
26 {
27 int header[1];
28 int level1[4];
29 short level2[4 << 7];
30 unsigned int level3[83 << 4];
31 }
32u_is_alnum =
33{
34 { 4 },
35 {
36 5 * sizeof (int) / sizeof (short) + 0,
37 5 * sizeof (int) / sizeof (short) + 128,
38 5 * sizeof (int) / sizeof (short) + 256,
39 5 * sizeof (int) / sizeof (short) + 384
40 },
41 {
42 5 + 512 * sizeof (short) / sizeof (int) + 0,
43 5 + 512 * sizeof (short) / sizeof (int) + 16,
44 5 + 512 * sizeof (short) / sizeof (int) + 32,
45 5 + 512 * sizeof (short) / sizeof (int) + 48,
46 5 + 512 * sizeof (short) / sizeof (int) + 64,
47 5 + 512 * sizeof (short) / sizeof (int) + 80,
48 5 + 512 * sizeof (short) / sizeof (int) + 96,
49 5 + 512 * sizeof (short) / sizeof (int) + 112,
50 5 + 512 * sizeof (short) / sizeof (int) + 128,
51 5 + 512 * sizeof (short) / sizeof (int) + 144,
52 5 + 512 * sizeof (short) / sizeof (int) + 160,
53 5 + 512 * sizeof (short) / sizeof (int) + 176,
54 5 + 512 * sizeof (short) / sizeof (int) + 192,
55 5 + 512 * sizeof (short) / sizeof (int) + 208,
56 5 + 512 * sizeof (short) / sizeof (int) + 224,
57 5 + 512 * sizeof (short) / sizeof (int) + 240,
58 5 + 512 * sizeof (short) / sizeof (int) + 256,
59 -1,
60 5 + 512 * sizeof (short) / sizeof (int) + 272,
61 -1,
62 -1,
63 -1,
64 5 + 512 * sizeof (short) / sizeof (int) + 288,
65 5 + 512 * sizeof (short) / sizeof (int) + 304,
66 5 + 512 * sizeof (short) / sizeof (int) + 320,
67 -1,
68 5 + 512 * sizeof (short) / sizeof (int) + 336,
69 5 + 512 * sizeof (short) / sizeof (int) + 336,
70 5 + 512 * sizeof (short) / sizeof (int) + 336,
71 5 + 512 * sizeof (short) / sizeof (int) + 336,
72 5 + 512 * sizeof (short) / sizeof (int) + 336,
73 5 + 512 * sizeof (short) / sizeof (int) + 336,
74 5 + 512 * sizeof (short) / sizeof (int) + 336,
75 5 + 512 * sizeof (short) / sizeof (int) + 336,
76 5 + 512 * sizeof (short) / sizeof (int) + 336,
77 5 + 512 * sizeof (short) / sizeof (int) + 336,
78 5 + 512 * sizeof (short) / sizeof (int) + 336,
79 5 + 512 * sizeof (short) / sizeof (int) + 336,
80 5 + 512 * sizeof (short) / sizeof (int) + 352,
81 5 + 512 * sizeof (short) / sizeof (int) + 336,
82 5 + 512 * sizeof (short) / sizeof (int) + 336,
83 5 + 512 * sizeof (short) / sizeof (int) + 336,
84 5 + 512 * sizeof (short) / sizeof (int) + 336,
85 5 + 512 * sizeof (short) / sizeof (int) + 336,
86 5 + 512 * sizeof (short) / sizeof (int) + 336,
87 5 + 512 * sizeof (short) / sizeof (int) + 336,
88 5 + 512 * sizeof (short) / sizeof (int) + 336,
89 5 + 512 * sizeof (short) / sizeof (int) + 336,
90 5 + 512 * sizeof (short) / sizeof (int) + 336,
91 5 + 512 * sizeof (short) / sizeof (int) + 336,
92 5 + 512 * sizeof (short) / sizeof (int) + 336,
93 5 + 512 * sizeof (short) / sizeof (int) + 336,
94 5 + 512 * sizeof (short) / sizeof (int) + 336,
95 5 + 512 * sizeof (short) / sizeof (int) + 336,
96 5 + 512 * sizeof (short) / sizeof (int) + 336,
97 5 + 512 * sizeof (short) / sizeof (int) + 336,
98 5 + 512 * sizeof (short) / sizeof (int) + 336,
99 5 + 512 * sizeof (short) / sizeof (int) + 336,
100 5 + 512 * sizeof (short) / sizeof (int) + 336,
101 5 + 512 * sizeof (short) / sizeof (int) + 336,
102 5 + 512 * sizeof (short) / sizeof (int) + 336,
103 5 + 512 * sizeof (short) / sizeof (int) + 336,
104 5 + 512 * sizeof (short) / sizeof (int) + 336,
105 5 + 512 * sizeof (short) / sizeof (int) + 336,
106 5 + 512 * sizeof (short) / sizeof (int) + 336,
107 5 + 512 * sizeof (short) / sizeof (int) + 336,
108 5 + 512 * sizeof (short) / sizeof (int) + 336,
109 5 + 512 * sizeof (short) / sizeof (int) + 336,
110 5 + 512 * sizeof (short) / sizeof (int) + 336,
111 5 + 512 * sizeof (short) / sizeof (int) + 336,
112 5 + 512 * sizeof (short) / sizeof (int) + 336,
113 5 + 512 * sizeof (short) / sizeof (int) + 336,
114 5 + 512 * sizeof (short) / sizeof (int) + 336,
115 5 + 512 * sizeof (short) / sizeof (int) + 336,
116 5 + 512 * sizeof (short) / sizeof (int) + 336,
117 5 + 512 * sizeof (short) / sizeof (int) + 336,
118 5 + 512 * sizeof (short) / sizeof (int) + 336,
119 5 + 512 * sizeof (short) / sizeof (int) + 336,
120 5 + 512 * sizeof (short) / sizeof (int) + 336,
121 5 + 512 * sizeof (short) / sizeof (int) + 336,
122 5 + 512 * sizeof (short) / sizeof (int) + 336,
123 5 + 512 * sizeof (short) / sizeof (int) + 336,
124 5 + 512 * sizeof (short) / sizeof (int) + 368,
125 5 + 512 * sizeof (short) / sizeof (int) + 384,
126 5 + 512 * sizeof (short) / sizeof (int) + 400,
127 5 + 512 * sizeof (short) / sizeof (int) + 416,
128 5 + 512 * sizeof (short) / sizeof (int) + 336,
129 5 + 512 * sizeof (short) / sizeof (int) + 336,
130 5 + 512 * sizeof (short) / sizeof (int) + 336,
131 5 + 512 * sizeof (short) / sizeof (int) + 336,
132 5 + 512 * sizeof (short) / sizeof (int) + 336,
133 5 + 512 * sizeof (short) / sizeof (int) + 336,
134 5 + 512 * sizeof (short) / sizeof (int) + 336,
135 5 + 512 * sizeof (short) / sizeof (int) + 336,
136 5 + 512 * sizeof (short) / sizeof (int) + 336,
137 5 + 512 * sizeof (short) / sizeof (int) + 336,
138 5 + 512 * sizeof (short) / sizeof (int) + 336,
139 5 + 512 * sizeof (short) / sizeof (int) + 336,
140 5 + 512 * sizeof (short) / sizeof (int) + 336,
141 5 + 512 * sizeof (short) / sizeof (int) + 336,
142 5 + 512 * sizeof (short) / sizeof (int) + 336,
143 5 + 512 * sizeof (short) / sizeof (int) + 336,
144 5 + 512 * sizeof (short) / sizeof (int) + 336,
145 5 + 512 * sizeof (short) / sizeof (int) + 336,
146 5 + 512 * sizeof (short) / sizeof (int) + 336,
147 5 + 512 * sizeof (short) / sizeof (int) + 336,
148 5 + 512 * sizeof (short) / sizeof (int) + 336,
149 5 + 512 * sizeof (short) / sizeof (int) + 432,
150 -1,
151 -1,
152 -1,
153 -1,
154 -1,
155 -1,
156 -1,
157 -1,
158 -1,
159 -1,
160 -1,
161 -1,
162 -1,
163 -1,
164 -1,
165 -1,
166 5 + 512 * sizeof (short) / sizeof (int) + 448,
167 5 + 512 * sizeof (short) / sizeof (int) + 464,
168 5 + 512 * sizeof (short) / sizeof (int) + 480,
169 5 + 512 * sizeof (short) / sizeof (int) + 496,
170 5 + 512 * sizeof (short) / sizeof (int) + 512,
171 5 + 512 * sizeof (short) / sizeof (int) + 528,
172 5 + 512 * sizeof (short) / sizeof (int) + 544,
173 5 + 512 * sizeof (short) / sizeof (int) + 560,
174 5 + 512 * sizeof (short) / sizeof (int) + 576,
175 5 + 512 * sizeof (short) / sizeof (int) + 592,
176 5 + 512 * sizeof (short) / sizeof (int) + 608,
177 5 + 512 * sizeof (short) / sizeof (int) + 624,
178 5 + 512 * sizeof (short) / sizeof (int) + 640,
179 5 + 512 * sizeof (short) / sizeof (int) + 656,
180 5 + 512 * sizeof (short) / sizeof (int) + 672,
181 5 + 512 * sizeof (short) / sizeof (int) + 688,
182 5 + 512 * sizeof (short) / sizeof (int) + 704,
183 5 + 512 * sizeof (short) / sizeof (int) + 720,
184 5 + 512 * sizeof (short) / sizeof (int) + 736,
185 5 + 512 * sizeof (short) / sizeof (int) + 752,
186 5 + 512 * sizeof (short) / sizeof (int) + 336,
187 5 + 512 * sizeof (short) / sizeof (int) + 768,
188 5 + 512 * sizeof (short) / sizeof (int) + 784,
189 -1,
190 -1,
191 -1,
192 -1,
193 5 + 512 * sizeof (short) / sizeof (int) + 800,
194 5 + 512 * sizeof (short) / sizeof (int) + 336,
195 5 + 512 * sizeof (short) / sizeof (int) + 336,
196 5 + 512 * sizeof (short) / sizeof (int) + 816,
197 5 + 512 * sizeof (short) / sizeof (int) + 336,
198 5 + 512 * sizeof (short) / sizeof (int) + 336,
199 5 + 512 * sizeof (short) / sizeof (int) + 336,
200 5 + 512 * sizeof (short) / sizeof (int) + 336,
201 5 + 512 * sizeof (short) / sizeof (int) + 336,
202 5 + 512 * sizeof (short) / sizeof (int) + 336,
203 5 + 512 * sizeof (short) / sizeof (int) + 832,
204 5 + 512 * sizeof (short) / sizeof (int) + 336,
205 5 + 512 * sizeof (short) / sizeof (int) + 848,
206 -1,
207 -1,
208 -1,
209 -1,
210 -1,
211 -1,
212 -1,
213 -1,
214 -1,
215 -1,
216 -1,
217 -1,
218 5 + 512 * sizeof (short) / sizeof (int) + 864,
219 -1,
220 -1,
221 -1,
222 5 + 512 * sizeof (short) / sizeof (int) + 336,
223 5 + 512 * sizeof (short) / sizeof (int) + 880,
224 5 + 512 * sizeof (short) / sizeof (int) + 896,
225 5 + 512 * sizeof (short) / sizeof (int) + 912,
226 5 + 512 * sizeof (short) / sizeof (int) + 336,
227 5 + 512 * sizeof (short) / sizeof (int) + 336,
228 5 + 512 * sizeof (short) / sizeof (int) + 336,
229 5 + 512 * sizeof (short) / sizeof (int) + 336,
230 5 + 512 * sizeof (short) / sizeof (int) + 336,
231 5 + 512 * sizeof (short) / sizeof (int) + 336,
232 5 + 512 * sizeof (short) / sizeof (int) + 336,
233 5 + 512 * sizeof (short) / sizeof (int) + 336,
234 5 + 512 * sizeof (short) / sizeof (int) + 336,
235 5 + 512 * sizeof (short) / sizeof (int) + 336,
236 5 + 512 * sizeof (short) / sizeof (int) + 336,
237 5 + 512 * sizeof (short) / sizeof (int) + 336,
238 5 + 512 * sizeof (short) / sizeof (int) + 336,
239 5 + 512 * sizeof (short) / sizeof (int) + 336,
240 5 + 512 * sizeof (short) / sizeof (int) + 928,
241 -1,
242 -1,
243 -1,
244 -1,
245 -1,
246 -1,
247 -1,
248 -1,
249 -1,
250 -1,
251 -1,
252 -1,
253 -1,
254 -1,
255 -1,
256 -1,
257 5 + 512 * sizeof (short) / sizeof (int) + 944,
258 5 + 512 * sizeof (short) / sizeof (int) + 960,
259 5 + 512 * sizeof (short) / sizeof (int) + 976,
260 -1,
261 -1,
262 -1,
263 -1,
264 5 + 512 * sizeof (short) / sizeof (int) + 992,
265 -1,
266 -1,
267 -1,
268 -1,
269 -1,
270 -1,
271 -1,
272 5 + 512 * sizeof (short) / sizeof (int) + 1008,
273 -1,
274 -1,
275 -1,
276 5 + 512 * sizeof (short) / sizeof (int) + 1024,
277 5 + 512 * sizeof (short) / sizeof (int) + 1040,
278 -1,
279 -1,
280 -1,
281 5 + 512 * sizeof (short) / sizeof (int) + 1056,
282 5 + 512 * sizeof (short) / sizeof (int) + 1072,
283 5 + 512 * sizeof (short) / sizeof (int) + 1088,
284 5 + 512 * sizeof (short) / sizeof (int) + 1104,
285 5 + 512 * sizeof (short) / sizeof (int) + 1120,
286 5 + 512 * sizeof (short) / sizeof (int) + 1136,
287 -1,
288 -1,
289 5 + 512 * sizeof (short) / sizeof (int) + 1152,
290 5 + 512 * sizeof (short) / sizeof (int) + 1168,
291 -1,
292 -1,
293 -1,
294 -1,
295 5 + 512 * sizeof (short) / sizeof (int) + 1184,
296 -1,
297 -1,
298 5 + 512 * sizeof (short) / sizeof (int) + 336,
299 5 + 512 * sizeof (short) / sizeof (int) + 336,
300 5 + 512 * sizeof (short) / sizeof (int) + 336,
301 5 + 512 * sizeof (short) / sizeof (int) + 336,
302 5 + 512 * sizeof (short) / sizeof (int) + 336,
303 5 + 512 * sizeof (short) / sizeof (int) + 336,
304 5 + 512 * sizeof (short) / sizeof (int) + 336,
305 5 + 512 * sizeof (short) / sizeof (int) + 336,
306 5 + 512 * sizeof (short) / sizeof (int) + 336,
307 5 + 512 * sizeof (short) / sizeof (int) + 336,
308 5 + 512 * sizeof (short) / sizeof (int) + 336,
309 5 + 512 * sizeof (short) / sizeof (int) + 336,
310 5 + 512 * sizeof (short) / sizeof (int) + 336,
311 5 + 512 * sizeof (short) / sizeof (int) + 336,
312 5 + 512 * sizeof (short) / sizeof (int) + 336,
313 5 + 512 * sizeof (short) / sizeof (int) + 336,
314 5 + 512 * sizeof (short) / sizeof (int) + 336,
315 5 + 512 * sizeof (short) / sizeof (int) + 336,
316 5 + 512 * sizeof (short) / sizeof (int) + 336,
317 5 + 512 * sizeof (short) / sizeof (int) + 336,
318 5 + 512 * sizeof (short) / sizeof (int) + 336,
319 5 + 512 * sizeof (short) / sizeof (int) + 336,
320 5 + 512 * sizeof (short) / sizeof (int) + 336,
321 5 + 512 * sizeof (short) / sizeof (int) + 336,
322 5 + 512 * sizeof (short) / sizeof (int) + 336,
323 5 + 512 * sizeof (short) / sizeof (int) + 336,
324 5 + 512 * sizeof (short) / sizeof (int) + 336,
325 5 + 512 * sizeof (short) / sizeof (int) + 336,
326 5 + 512 * sizeof (short) / sizeof (int) + 336,
327 5 + 512 * sizeof (short) / sizeof (int) + 336,
328 5 + 512 * sizeof (short) / sizeof (int) + 336,
329 5 + 512 * sizeof (short) / sizeof (int) + 336,
330 5 + 512 * sizeof (short) / sizeof (int) + 336,
331 5 + 512 * sizeof (short) / sizeof (int) + 336,
332 5 + 512 * sizeof (short) / sizeof (int) + 336,
333 5 + 512 * sizeof (short) / sizeof (int) + 336,
334 5 + 512 * sizeof (short) / sizeof (int) + 336,
335 5 + 512 * sizeof (short) / sizeof (int) + 336,
336 5 + 512 * sizeof (short) / sizeof (int) + 336,
337 5 + 512 * sizeof (short) / sizeof (int) + 336,
338 5 + 512 * sizeof (short) / sizeof (int) + 336,
339 5 + 512 * sizeof (short) / sizeof (int) + 336,
340 5 + 512 * sizeof (short) / sizeof (int) + 336,
341 5 + 512 * sizeof (short) / sizeof (int) + 336,
342 5 + 512 * sizeof (short) / sizeof (int) + 336,
343 5 + 512 * sizeof (short) / sizeof (int) + 336,
344 5 + 512 * sizeof (short) / sizeof (int) + 336,
345 5 + 512 * sizeof (short) / sizeof (int) + 336,
346 5 + 512 * sizeof (short) / sizeof (int) + 336,
347 5 + 512 * sizeof (short) / sizeof (int) + 336,
348 5 + 512 * sizeof (short) / sizeof (int) + 336,
349 5 + 512 * sizeof (short) / sizeof (int) + 336,
350 5 + 512 * sizeof (short) / sizeof (int) + 336,
351 5 + 512 * sizeof (short) / sizeof (int) + 336,
352 5 + 512 * sizeof (short) / sizeof (int) + 336,
353 5 + 512 * sizeof (short) / sizeof (int) + 336,
354 5 + 512 * sizeof (short) / sizeof (int) + 336,
355 5 + 512 * sizeof (short) / sizeof (int) + 336,
356 5 + 512 * sizeof (short) / sizeof (int) + 336,
357 5 + 512 * sizeof (short) / sizeof (int) + 336,
358 5 + 512 * sizeof (short) / sizeof (int) + 336,
359 5 + 512 * sizeof (short) / sizeof (int) + 336,
360 5 + 512 * sizeof (short) / sizeof (int) + 336,
361 5 + 512 * sizeof (short) / sizeof (int) + 336,
362 5 + 512 * sizeof (short) / sizeof (int) + 336,
363 5 + 512 * sizeof (short) / sizeof (int) + 336,
364 5 + 512 * sizeof (short) / sizeof (int) + 336,
365 5 + 512 * sizeof (short) / sizeof (int) + 336,
366 5 + 512 * sizeof (short) / sizeof (int) + 336,
367 5 + 512 * sizeof (short) / sizeof (int) + 336,
368 5 + 512 * sizeof (short) / sizeof (int) + 336,
369 5 + 512 * sizeof (short) / sizeof (int) + 336,
370 5 + 512 * sizeof (short) / sizeof (int) + 336,
371 5 + 512 * sizeof (short) / sizeof (int) + 336,
372 5 + 512 * sizeof (short) / sizeof (int) + 336,
373 5 + 512 * sizeof (short) / sizeof (int) + 336,
374 5 + 512 * sizeof (short) / sizeof (int) + 336,
375 5 + 512 * sizeof (short) / sizeof (int) + 336,
376 5 + 512 * sizeof (short) / sizeof (int) + 336,
377 5 + 512 * sizeof (short) / sizeof (int) + 336,
378 5 + 512 * sizeof (short) / sizeof (int) + 336,
379 5 + 512 * sizeof (short) / sizeof (int) + 336,
380 5 + 512 * sizeof (short) / sizeof (int) + 336,
381 5 + 512 * sizeof (short) / sizeof (int) + 1200,
382 5 + 512 * sizeof (short) / sizeof (int) + 336,
383 5 + 512 * sizeof (short) / sizeof (int) + 336,
384 5 + 512 * sizeof (short) / sizeof (int) + 336,
385 5 + 512 * sizeof (short) / sizeof (int) + 336,
386 5 + 512 * sizeof (short) / sizeof (int) + 336,
387 5 + 512 * sizeof (short) / sizeof (int) + 336,
388 5 + 512 * sizeof (short) / sizeof (int) + 336,
389 5 + 512 * sizeof (short) / sizeof (int) + 336,
390 5 + 512 * sizeof (short) / sizeof (int) + 1216,
391 5 + 512 * sizeof (short) / sizeof (int) + 336,
392 5 + 512 * sizeof (short) / sizeof (int) + 336,
393 5 + 512 * sizeof (short) / sizeof (int) + 336,
394 5 + 512 * sizeof (short) / sizeof (int) + 336,
395 5 + 512 * sizeof (short) / sizeof (int) + 336,
396 5 + 512 * sizeof (short) / sizeof (int) + 336,
397 5 + 512 * sizeof (short) / sizeof (int) + 336,
398 5 + 512 * sizeof (short) / sizeof (int) + 336,
399 5 + 512 * sizeof (short) / sizeof (int) + 336,
400 5 + 512 * sizeof (short) / sizeof (int) + 336,
401 5 + 512 * sizeof (short) / sizeof (int) + 1232,
402 5 + 512 * sizeof (short) / sizeof (int) + 336,
403 5 + 512 * sizeof (short) / sizeof (int) + 336,
404 5 + 512 * sizeof (short) / sizeof (int) + 336,
405 5 + 512 * sizeof (short) / sizeof (int) + 336,
406 5 + 512 * sizeof (short) / sizeof (int) + 336,
407 5 + 512 * sizeof (short) / sizeof (int) + 336,
408 5 + 512 * sizeof (short) / sizeof (int) + 336,
409 5 + 512 * sizeof (short) / sizeof (int) + 336,
410 5 + 512 * sizeof (short) / sizeof (int) + 336,
411 5 + 512 * sizeof (short) / sizeof (int) + 336,
412 5 + 512 * sizeof (short) / sizeof (int) + 336,
413 5 + 512 * sizeof (short) / sizeof (int) + 336,
414 5 + 512 * sizeof (short) / sizeof (int) + 336,
415 5 + 512 * sizeof (short) / sizeof (int) + 1248,
416 5 + 512 * sizeof (short) / sizeof (int) + 336,
417 5 + 512 * sizeof (short) / sizeof (int) + 1264,
418 -1,
419 -1,
420 -1,
421 -1,
422 5 + 512 * sizeof (short) / sizeof (int) + 336,
423 5 + 512 * sizeof (short) / sizeof (int) + 1280,
424 -1,
425 -1,
426 5 + 512 * sizeof (short) / sizeof (int) + 336,
427 5 + 512 * sizeof (short) / sizeof (int) + 336,
428 5 + 512 * sizeof (short) / sizeof (int) + 336,
429 5 + 512 * sizeof (short) / sizeof (int) + 336,
430 5 + 512 * sizeof (short) / sizeof (int) + 336,
431 5 + 512 * sizeof (short) / sizeof (int) + 336,
432 5 + 512 * sizeof (short) / sizeof (int) + 336,
433 5 + 512 * sizeof (short) / sizeof (int) + 336,
434 5 + 512 * sizeof (short) / sizeof (int) + 336,
435 5 + 512 * sizeof (short) / sizeof (int) + 1296,
436 5 + 512 * sizeof (short) / sizeof (int) + 336,
437 5 + 512 * sizeof (short) / sizeof (int) + 336,
438 5 + 512 * sizeof (short) / sizeof (int) + 336,
439 5 + 512 * sizeof (short) / sizeof (int) + 336,
440 5 + 512 * sizeof (short) / sizeof (int) + 336,
441 5 + 512 * sizeof (short) / sizeof (int) + 336,
442 5 + 512 * sizeof (short) / sizeof (int) + 336,
443 5 + 512 * sizeof (short) / sizeof (int) + 336,
444 5 + 512 * sizeof (short) / sizeof (int) + 336,
445 5 + 512 * sizeof (short) / sizeof (int) + 336,
446 5 + 512 * sizeof (short) / sizeof (int) + 336,
447 5 + 512 * sizeof (short) / sizeof (int) + 336,
448 5 + 512 * sizeof (short) / sizeof (int) + 336,
449 5 + 512 * sizeof (short) / sizeof (int) + 336,
450 5 + 512 * sizeof (short) / sizeof (int) + 336,
451 5 + 512 * sizeof (short) / sizeof (int) + 336,
452 5 + 512 * sizeof (short) / sizeof (int) + 1312,
453 -1,
454 -1,
455 -1,
456 -1,
457 -1,
458 -1,
459 -1,
460 -1,
461 -1,
462 -1,
463 -1,
464 -1,
465 -1,
466 -1,
467 -1,
468 -1,
469 -1,
470 -1,
471 -1,
472 -1,
473 -1,
474 -1,
475 -1,
476 -1,
477 -1,
478 -1,
479 -1,
480 -1,
481 -1,
482 -1,
483 -1,
484 -1,
485 -1,
486 -1,
487 -1,
488 -1,
489 -1,
490 -1,
491 -1,
492 -1,
493 -1,
494 -1,
495 -1,
496 -1,
497 -1,
498 -1,
499 -1,
500 -1,
501 -1,
502 -1,
503 -1,
504 -1,
505 -1,
506 -1,
507 -1,
508 -1,
509 -1,
510 -1,
511 -1,
512 -1,
513 -1,
514 -1,
515 -1,
516 -1,
517 -1,
518 -1,
519 -1,
520 -1,
521 -1,
522 -1,
523 -1,
524 -1,
525 -1,
526 -1,
527 -1,
528 -1,
529 -1,
530 -1,
531 -1,
532 -1,
533 -1,
534 -1,
535 -1,
536 -1,
537 -1,
538 -1,
539 -1,
540 -1,
541 -1,
542 -1,
543 -1,
544 -1,
545 -1,
546 -1,
547 -1,
548 -1,
549 -1,
550 -1,
551 -1,
552 -1,
553 -1
554 },
555 {
556 0x00000000U, 0x03FF0000U, 0x07FFFFFEU, 0x07FFFFFEU,
557 0x00000000U, 0x04200400U, 0xFF7FFFFFU, 0xFF7FFFFFU,
558 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
559 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
560 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
561 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0003FFC3U, 0x0000501FU,
562 0x00000000U, 0x00000000U, 0x00000020U, 0xBCDF0000U,
563 0xFFFFD740U, 0xFFFFFFFBU, 0xFFFFFFFFU, 0xFFBFFFFFU,
564 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
565 0xFFFFFC03U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
566 0xFFFFFFFFU, 0xFFFEFFFFU, 0x027FFFFFU, 0xFFFFFFFFU,
567 0x000001FFU, 0x00000000U, 0xFFFF0000U, 0x000787FFU,
568 0x00000000U, 0xFFFFFFFFU, 0x000007FFU, 0xFFFEC3FFU,
569 0xFFFFFFFFU, 0xFFFFFFFFU, 0x002FFFFFU, 0x9FFFC060U,
570 0xFFFD0000U, 0x0000FFFFU, 0xFFFFE000U, 0xFFFFFFFFU,
571 0xFFFFFFFFU, 0x0002003FU, 0xFFFFFFFFU, 0x043007FFU,
572 0x043FFFFFU, 0x00000110U, 0x01FFFFFFU, 0xFFFF07FFU,
573 0x0000FEFFU, 0xFFFFFFFFU, 0x000003FFU, 0x00000000U,
574 0xFFFFFFF0U, 0x23FFFFFFU, 0xFF010000U, 0xFFFEFFC3U,
575 0xFFF99FE1U, 0x23C5FDFFU, 0xB0004000U, 0x1003FFC3U,
576 0xFFF987E0U, 0x036DFDFFU, 0x5E000000U, 0x001CFFC0U,
577 0xFFFBBFE0U, 0x23EDFDFFU, 0x00010000U, 0x0200FFC3U,
578 0xFFF99FE0U, 0x23EDFDFFU, 0xB0000000U, 0x0002FFC3U,
579 0xD63DC7E8U, 0x03FFC718U, 0x00010000U, 0x0000FFC0U,
580 0xFFFDDFE0U, 0x23FFFDFFU, 0x37000000U, 0x0000FFC3U,
581 0xFFFDDFE1U, 0x23EFFDFFU, 0x70000000U, 0x0006FFC3U,
582 0xFFFDDFF0U, 0x27FFFFFFU, 0x80704000U, 0xFC00FFC3U,
583 0xFC7FFFE0U, 0x2FFBFFFFU, 0x0000007FU, 0x0000FFC0U,
584 0xFFFFFFFEU, 0x07FF7FFFU, 0x03FF7FBFU, 0x00000000U,
585 0xFFFFF7D6U, 0x200DFFAFU, 0xF3FF005FU, 0x00000000U,
586 0x00000001U, 0x000003FFU, 0xFFFFFEFFU, 0x00001FFFU,
587 0x00001F00U, 0x00000000U, 0x00000000U, 0x00000000U,
588 0xFFFFFFFFU, 0x800007FFU, 0x3C3F03FFU, 0xFFE1C062U,
589 0x03FF4003U, 0xFFFFFFFFU, 0xFFFF20BFU, 0xF7FFFFFFU,
590 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
591 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
592 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3D7F3DFFU, 0xFFFFFFFFU,
593 0xFFFF3DFFU, 0x7F3DFFFFU, 0xFF7FFF3DU, 0xFFFFFFFFU,
594 0xFF3DFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU, 0x00000000U,
595 0x0000FFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3F3FFFFFU,
596 0xFFFFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
597 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
598 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
599 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
600 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF9FFFU,
601 0x07FFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFC7FFU,
602 0x8003FFFFU, 0x0003FFFFU, 0x0003FFFFU, 0x0001DFFFU,
603 0xFFFFFFFFU, 0x000FFFFFU, 0x10800000U, 0x000003FFU,
604 0x03FF0000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFFFFFU,
605 0xFFFFFF9FU, 0xFFFF05FFU, 0xFFFFFFFFU, 0x003FFFFFU,
606 0x7FFFFFFFU, 0x00000000U, 0xFFFFFFC0U, 0x001F3FFFU,
607 0xFFFFFFFFU, 0xFFFF0FFFU, 0x03FF03FFU, 0x00000000U,
608 0x007FFFFFU, 0xFFFFFFFFU, 0x001FFFFFU, 0x00000000U,
609 0x03FF03FFU, 0x00000080U, 0x00000000U, 0x00000000U,
610 0xFFFFFFE0U, 0x000FFFFFU, 0x03FF1FE0U, 0x00000000U,
611 0xFFFFFFF8U, 0xFFFFC001U, 0xFFFFFFFFU, 0x0000003FU,
612 0xFFFFFFFFU, 0x0000000FU, 0xFFFFE3FFU, 0x3FFFFFFFU,
613 0xFFFF07FFU, 0xE7FFFFFFU, 0x00000000U, 0x046FDE00U,
614 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
615 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, 0x00000000U,
616 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
617 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
618 0x3F3FFFFFU, 0xFFFFFFFFU, 0xAAFF3F3FU, 0x3FFFFFFFU,
619 0xFFFFFFFFU, 0x5FDFFFFFU, 0x0FCF1FDCU, 0x1FDC1FFFU,
620 0x00000000U, 0x00000000U, 0x00000000U, 0x80020000U,
621 0x1FFF0000U, 0x00000000U, 0x00000000U, 0x00000000U,
622 0x3E2FFC84U, 0xF3FFBF50U, 0x000043E0U, 0xFFFFFFFFU,
623 0x000001FFU, 0x00000000U, 0x00000000U, 0x00000000U,
624 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
625 0xF0000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000003FFU,
626 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
627 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
628 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
629 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000C781FU,
630 0xFFFFFFFFU, 0xFFFF20BFU, 0xFFFFFFFFU, 0x000080FFU,
631 0x007FFFFFU, 0x7F7F7F7FU, 0x7F7F7F7FU, 0x00000000U,
632 0x00000000U, 0x00008000U, 0x00000000U, 0x00000000U,
633 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
634 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
635 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
636 0x000000E0U, 0x1F3E03FEU, 0xFFFFFFFEU, 0xFFFFFFFFU,
637 0xE07FFFFFU, 0xFFFFFFFEU, 0xFFFFFFFFU, 0xF7FFFFFFU,
638 0xFFFFFFE0U, 0xFFFEFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
639 0x00007FFFU, 0xFFFFFFFFU, 0x00000000U, 0xFFFF0000U,
640 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
641 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
642 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
643 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
644 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
645 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
646 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
647 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, 0x00000000U,
648 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
649 0x00001FFFU, 0x00000000U, 0xFFFF0000U, 0x3FFFFFFFU,
650 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
651 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
652 0xFFFF1FFFU, 0x00000FFFU, 0xFFFFFFFFU, 0x80007FFFU,
653 0x3FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU,
654 0xFF800000U, 0xFFFFFFFCU, 0xFFFFFFFFU, 0xFFFFFFFFU,
655 0xFFFFF9FFU, 0xFFFFFFFFU, 0x1FFFFFFFU, 0xFFFE0000U,
656 0xFFFFF7BBU, 0x00000007U, 0xFFFFFFFFU, 0x000FFFFFU,
657 0xFFFFFFFCU, 0x000FFFFFU, 0x03FF0000U, 0x68FC0000U,
658 0xFFFFFFFFU, 0xFFFF003FU, 0x0000007FU, 0x1FFFFFFFU,
659 0xFFFFFFF0U, 0x0007FFFFU, 0x03FF8000U, 0x7FFFFFDFU,
660 0xFFFFFFFFU, 0x000001FFU, 0x03FF0FF7U, 0xC47FFFFFU,
661 0xFFFFFFFFU, 0x3E62FFFFU, 0x38000005U, 0x001C07FFU,
662 0x007E7E7EU, 0xFFFF7F7FU, 0xF7FFFFFFU, 0xFFFF03FFU,
663 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF0007U,
664 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
665 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
666 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
667 0xFFFFFFFFU, 0xFFFF000FU, 0xFFFFF87FU, 0x0FFFFFFFU,
668 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
669 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
670 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
671 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
672 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF3FFFU,
673 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00000000U,
674 0xA0F8007FU, 0x5F7FFDFFU, 0xFFFFFFDBU, 0xFFFFFFFFU,
675 0xFFFFFFFFU, 0x0003FFFFU, 0xFFF80000U, 0xFFFFFFFFU,
676 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
677 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
678 0xFFFFFFFFU, 0x3FFFFFFFU, 0xFFFF0000U, 0xFFFFFFFFU,
679 0xFFFCFFFFU, 0xFFFFFFFFU, 0x000000FFU, 0x0FFF0000U,
680 0x00000000U, 0x00000000U, 0x00000000U, 0xFFDF0000U,
681 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFFFFFFU,
682 0x03FF0000U, 0x07FFFFFEU, 0x07FFFFFEU, 0xFFFFFFC0U,
683 0xFFFFFFFFU, 0x7FFFFFFFU, 0x1CFCFCFCU, 0x00000000U,
684 0xFFFFEFFFU, 0xB7FFFF7FU, 0x3FFF3FFFU, 0x00000000U,
685 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU,
686 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x001FFFFFU,
687 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
688 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
689 0x1FFFFFFFU, 0xFFFFFFFFU, 0x0001FFFFU, 0x00000000U,
690 0xFFFFFFFFU, 0xFFFFE000U, 0xFFFF07FFU, 0x003FFFFFU,
691 0x3FFFFFFFU, 0xFFFFFFFFU, 0x003EFF0FU, 0x00000000U,
692 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
693 0x3FFFFFFFU, 0xFFFF03FFU, 0xFF0FFFFFU, 0x0FFFFFFFU,
694 0xFFFFFFFFU, 0xFFFF00FFU, 0xFFFFFFFFU, 0xF7FF000FU,
695 0xFFB7F7FFU, 0x1BFBFFFBU, 0xFFFFFFFFU, 0x000FFFFFU,
696 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
697 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
698 0xFFFFFFFFU, 0x007FFFFFU, 0x003FFFFFU, 0x000000FFU,
699 0xFFFFFFBFU, 0x07FDFFFFU, 0x00000000U, 0x00000000U,
700 0xFFFFFD3FU, 0x91BFFFFFU, 0x003FFFFFU, 0x007FFFFFU,
701 0x7FFFFFFFU, 0x00000000U, 0x00000000U, 0x0037FFFFU,
702 0x003FFFFFU, 0x03FFFFFFU, 0x03FFFFFFU, 0x00000000U,
703 0xFFFFFFFFU, 0xC0FFFFFFU, 0x00000000U, 0x00000000U,
704 0xFEEF0001U, 0x003FFFFFU, 0x00000000U, 0x1FFFFFFFU,
705 0x1FFFFFFFU, 0x00000000U, 0xFFFFFEFFU, 0x0000001FU,
706 0xFFFFFFFFU, 0x003FFFFFU, 0x003FFFFFU, 0x0007FFFFU,
707 0x0003FFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
708 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000001FFU, 0x00000000U,
709 0xFFFFFFFFU, 0x0007FFFFU, 0xFFFFFFFFU, 0x0007FFFFU,
710 0xFFFFFFFFU, 0x03FF000FU, 0xFFFFFFFFU, 0xFFFF803FU,
711 0x0000003FU, 0x00000000U, 0x00000000U, 0x00000000U,
712 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
713 0xFFFFFFFFU, 0x000303FFU, 0x000000FCU, 0x00000000U,
714 0x1FFFFFFFU, 0xFFFF0080U, 0x0000003FU, 0xFFFF0000U,
715 0x00000003U, 0xFFFF0000U, 0x0000001FU, 0x007FFFFFU,
716 0xFFFFFFF8U, 0x00FFFFFFU, 0x00000000U, 0x0026FFC0U,
717 0xFFFFFFF8U, 0x0000FFFFU, 0xFFFF0000U, 0x03FF01FFU,
718 0xFFFFFFF8U, 0xFFC0007FU, 0xFFFF0090U, 0x0047FFFFU,
719 0xFFFFFFF8U, 0x0007FFFFU, 0x17FF001EU, 0x00000000U,
720 0xFFFBFFFFU, 0x80000FFFU, 0x00000001U, 0x00000000U,
721 0xBFFFBD7FU, 0xFFFF01FFU, 0x7FFFFFFFU, 0x03FF0000U,
722 0xFFF99FE0U, 0x23EDFDFFU, 0xE0010000U, 0x00000003U,
723 0xFFFF4BFFU, 0x00BFFFFFU, 0x000A0000U, 0x00000000U,
724 0xFFFFFFFFU, 0x001FFFFFU, 0x83FF0780U, 0x00000003U,
725 0xFFFFFFFFU, 0x0000FFFFU, 0x03FF00B0U, 0x00000000U,
726 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
727 0xFFFFFFFFU, 0x00007FFFU, 0x0F000000U, 0x00000000U,
728 0xFFFFFFFFU, 0x0000FFFFU, 0x03FF0010U, 0x00000000U,
729 0xFFFFFFFFU, 0x010007FFU, 0xFFFF03FFU, 0x0000000FU,
730 0x07FFFFFFU, 0x03FF0000U, 0x0000007FU, 0x00000000U,
731 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
732 0xFFFFFFFFU, 0x00000FFFU, 0x00000000U, 0x00000000U,
733 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x800003FFU,
734 0xFF6FF27FU, 0x8000FFFFU, 0x03FF0002U, 0x00000000U,
735 0x00000000U, 0xFFFFFCFFU, 0x0001FFFFU, 0x0000000AU,
736 0xFFFFF801U, 0x0407FFFFU, 0xF0010000U, 0xFFFFFFFFU,
737 0x200003FFU, 0xFFFF0000U, 0xFFFFFFFFU, 0x01FFFFFFU,
738 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
739 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x03FF0001U,
740 0xFFFFFDFFU, 0x00007FFFU, 0x03FF0001U, 0xFFFC0000U,
741 0x0000FFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
742 0xFFFFFB7FU, 0x0001FFFFU, 0x03FF0040U, 0xFFFFFDBFU,
743 0x010003FFU, 0xFFFF03FFU, 0x0FFFFFFFU, 0x000003FFU,
744 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
745 0x00000000U, 0x00000000U, 0x00000000U, 0x0007FFFFU,
746 0xFFFDFFF4U, 0x000FFFFFU, 0x03FF0000U, 0x00000000U,
747 0x00000000U, 0x00010000U, 0x00000000U, 0x00000000U,
748 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
749 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
750 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
751 0x03FFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
752 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00007FFFU,
753 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
754 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U,
755 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
756 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
757 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
758 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
759 0xFFFF0000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0001FFFFU,
760 0xFFFFFFFFU, 0x0000FFFFU, 0x0000007EU, 0xFFFFFFFFU,
761 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
762 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
763 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
764 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
765 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
766 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
767 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU,
768 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000007FU, 0x00000000U,
769 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
770 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
771 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
772 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
773 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
774 0x3FFFFFFFU, 0x03FF0000U, 0x00000000U, 0x00000000U,
775 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
776 0xFFFFFFFFU, 0x01FFFFFFU, 0x7FFFFFFFU, 0xFFFF03FFU,
777 0xFFFFFFFFU, 0x7FFFFFFFU, 0xFFFF03FFU, 0x00003FFFU,
778 0xFFFFFFFFU, 0x0000FFFFU, 0x03FF000FU, 0xE0FFFFF8U,
779 0x0000FFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
780 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
781 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
782 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x03FF1FFFU,
783 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
784 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU,
785 0x00000000U, 0xF9FFFFFFU, 0x000FFFFFU, 0x00000000U,
786 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000107FFU, 0x00000000U,
787 0xFFF80000U, 0x00000000U, 0x00000000U, 0x007C000BU,
788 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
789 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x80000000U,
790 0x7FFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
791 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0007FFFFU,
792 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
793 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
794 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
795 0x00000000U, 0x00000000U, 0x00000000U, 0x6FEF0000U,
796 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
797 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
798 0xFFFFFFFFU, 0x00040007U, 0x00270000U, 0xFFFF00F0U,
799 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
800 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
801 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0FFFFFFFU,
802 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
803 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
804 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFF07FFU,
805 0x03FF01FFU, 0x00000000U, 0x00000000U, 0x00000000U,
806 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
807 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
808 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
809 0x00000000U, 0x00000000U, 0xFFC00000U, 0x03FFFFFFU,
810 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
811 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
812 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFDFFFFFU, 0xFFFFFFFFU,
813 0xDFFFFFFFU, 0xEBFFDE64U, 0xFFFFFFEFU, 0xFFFFFFFFU,
814 0xDFDFE7BFU, 0x7BFFFFFFU, 0xFFFDFC5FU, 0xFFFFFFFFU,
815 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
816 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
817 0xFFFFFFFFU, 0xFFFFFF3FU, 0xF7FFFFFDU, 0xF7FFFFFFU,
818 0xFFDFFFFFU, 0xFFDFFFFFU, 0xFFFF7FFFU, 0xFFFF7FFFU,
819 0xFFFFFDFFU, 0xFFFFFDFFU, 0xFFFFCFF7U, 0xFFFFFFFFU,
820 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
821 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
822 0x7FFFFFFFU, 0x000007E0U, 0x00000000U, 0x00000000U,
823 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
824 0x00000000U, 0xFFFF0000U, 0xFFFFFFFFU, 0x00003FFFU,
825 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
826 0xFFFFFFFFU, 0x3F801FFFU, 0x000043FFU, 0x00000000U,
827 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
828 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
829 0xFFFF0000U, 0x00003FFFU, 0xFFFFFFFFU, 0x03FF0FFFU,
830 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
831 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
832 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
833 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x03FF0FFFU,
834 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
835 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x07FF3FFFU,
836 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
837 0x00000000U, 0x00000000U, 0x7FFFFFFFU, 0xC01F3FB7U,
838 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
839 0x00000000U, 0x00000000U, 0x00000000U, 0x7FFF6F7FU,
840 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
841 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000001FU, 0x00000000U,
842 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF080FU, 0x00000000U,
843 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
844 0xFFFFFFEFU, 0x0AF7FE96U, 0xAA96EA84U, 0x5EF7F796U,
845 0x0FFFFBFFU, 0x0FFFFBEEU, 0x00000000U, 0x00000000U,
846 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
847 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
848 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
849 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
850 0xFFFF0000U, 0xFFFF1FFFU, 0xFFFF03FFU, 0xFFFF03FFU,
851 0x000007FFU, 0x00000020U, 0x00000000U, 0xFFFFFFC0U,
852 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
853 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
854 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
855 0x00000000U, 0x00000000U, 0x00000000U, 0x03FF0000U,
856 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
857 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U,
858 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
859 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
860 0x3FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
861 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
862 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
863 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
864 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
865 0xFFFFFFFFU, 0xFFFF3FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
866 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
867 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
868 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
869 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
870 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
871 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF0001U,
872 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x00000000U,
873 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
874 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
875 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
876 0x3FFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
877 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
878 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
879 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
880 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
881 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
882 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF07FFU, 0xFFFFFFFFU,
883 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
884 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU,
885 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
886 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
887 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U
888 }
889};
diff --git a/gl/unictype/ctype_alpha.c b/gl/unictype/ctype_alpha.c
new file mode 100644
index 00000000..9beeb03f
--- /dev/null
+++ b/gl/unictype/ctype_alpha.c
@@ -0,0 +1,32 @@
1/* ISO C <ctype.h> like properties of Unicode characters.
2 Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2002.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#include <config.h>
19
20/* Specification. */
21#include "unictype.h"
22
23#include "bitmap.h"
24
25/* Define u_is_alpha table. */
26#include "ctype_alpha.h"
27
28bool
29uc_is_alpha (ucs4_t uc)
30{
31 return bitmap_lookup (&u_is_alpha, uc);
32}
diff --git a/gl/unictype/ctype_alpha.h b/gl/unictype/ctype_alpha.h
new file mode 100644
index 00000000..39f2f09a
--- /dev/null
+++ b/gl/unictype/ctype_alpha.h
@@ -0,0 +1,889 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* ISO C <ctype.h> like properties of Unicode characters. */
3/* Generated automatically by gen-uni-tables.c for Unicode 17.0.0. */
4
5/* Copyright (C) 2000-2025 Free Software Foundation, Inc.
6
7 This file is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
11
12 This file is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19
20#define header_0 16
21#define header_2 9
22#define header_3 127
23#define header_4 15
24static const
25struct
26 {
27 int header[1];
28 int level1[4];
29 short level2[4 << 7];
30 unsigned int level3[83 << 4];
31 }
32u_is_alpha =
33{
34 { 4 },
35 {
36 5 * sizeof (int) / sizeof (short) + 0,
37 5 * sizeof (int) / sizeof (short) + 128,
38 5 * sizeof (int) / sizeof (short) + 256,
39 5 * sizeof (int) / sizeof (short) + 384
40 },
41 {
42 5 + 512 * sizeof (short) / sizeof (int) + 0,
43 5 + 512 * sizeof (short) / sizeof (int) + 16,
44 5 + 512 * sizeof (short) / sizeof (int) + 32,
45 5 + 512 * sizeof (short) / sizeof (int) + 48,
46 5 + 512 * sizeof (short) / sizeof (int) + 64,
47 5 + 512 * sizeof (short) / sizeof (int) + 80,
48 5 + 512 * sizeof (short) / sizeof (int) + 96,
49 5 + 512 * sizeof (short) / sizeof (int) + 112,
50 5 + 512 * sizeof (short) / sizeof (int) + 128,
51 5 + 512 * sizeof (short) / sizeof (int) + 144,
52 5 + 512 * sizeof (short) / sizeof (int) + 160,
53 5 + 512 * sizeof (short) / sizeof (int) + 176,
54 5 + 512 * sizeof (short) / sizeof (int) + 192,
55 5 + 512 * sizeof (short) / sizeof (int) + 208,
56 5 + 512 * sizeof (short) / sizeof (int) + 224,
57 5 + 512 * sizeof (short) / sizeof (int) + 240,
58 5 + 512 * sizeof (short) / sizeof (int) + 256,
59 -1,
60 5 + 512 * sizeof (short) / sizeof (int) + 272,
61 -1,
62 -1,
63 -1,
64 5 + 512 * sizeof (short) / sizeof (int) + 288,
65 5 + 512 * sizeof (short) / sizeof (int) + 304,
66 5 + 512 * sizeof (short) / sizeof (int) + 320,
67 -1,
68 5 + 512 * sizeof (short) / sizeof (int) + 336,
69 5 + 512 * sizeof (short) / sizeof (int) + 336,
70 5 + 512 * sizeof (short) / sizeof (int) + 336,
71 5 + 512 * sizeof (short) / sizeof (int) + 336,
72 5 + 512 * sizeof (short) / sizeof (int) + 336,
73 5 + 512 * sizeof (short) / sizeof (int) + 336,
74 5 + 512 * sizeof (short) / sizeof (int) + 336,
75 5 + 512 * sizeof (short) / sizeof (int) + 336,
76 5 + 512 * sizeof (short) / sizeof (int) + 336,
77 5 + 512 * sizeof (short) / sizeof (int) + 336,
78 5 + 512 * sizeof (short) / sizeof (int) + 336,
79 5 + 512 * sizeof (short) / sizeof (int) + 336,
80 5 + 512 * sizeof (short) / sizeof (int) + 352,
81 5 + 512 * sizeof (short) / sizeof (int) + 336,
82 5 + 512 * sizeof (short) / sizeof (int) + 336,
83 5 + 512 * sizeof (short) / sizeof (int) + 336,
84 5 + 512 * sizeof (short) / sizeof (int) + 336,
85 5 + 512 * sizeof (short) / sizeof (int) + 336,
86 5 + 512 * sizeof (short) / sizeof (int) + 336,
87 5 + 512 * sizeof (short) / sizeof (int) + 336,
88 5 + 512 * sizeof (short) / sizeof (int) + 336,
89 5 + 512 * sizeof (short) / sizeof (int) + 336,
90 5 + 512 * sizeof (short) / sizeof (int) + 336,
91 5 + 512 * sizeof (short) / sizeof (int) + 336,
92 5 + 512 * sizeof (short) / sizeof (int) + 336,
93 5 + 512 * sizeof (short) / sizeof (int) + 336,
94 5 + 512 * sizeof (short) / sizeof (int) + 336,
95 5 + 512 * sizeof (short) / sizeof (int) + 336,
96 5 + 512 * sizeof (short) / sizeof (int) + 336,
97 5 + 512 * sizeof (short) / sizeof (int) + 336,
98 5 + 512 * sizeof (short) / sizeof (int) + 336,
99 5 + 512 * sizeof (short) / sizeof (int) + 336,
100 5 + 512 * sizeof (short) / sizeof (int) + 336,
101 5 + 512 * sizeof (short) / sizeof (int) + 336,
102 5 + 512 * sizeof (short) / sizeof (int) + 336,
103 5 + 512 * sizeof (short) / sizeof (int) + 336,
104 5 + 512 * sizeof (short) / sizeof (int) + 336,
105 5 + 512 * sizeof (short) / sizeof (int) + 336,
106 5 + 512 * sizeof (short) / sizeof (int) + 336,
107 5 + 512 * sizeof (short) / sizeof (int) + 336,
108 5 + 512 * sizeof (short) / sizeof (int) + 336,
109 5 + 512 * sizeof (short) / sizeof (int) + 336,
110 5 + 512 * sizeof (short) / sizeof (int) + 336,
111 5 + 512 * sizeof (short) / sizeof (int) + 336,
112 5 + 512 * sizeof (short) / sizeof (int) + 336,
113 5 + 512 * sizeof (short) / sizeof (int) + 336,
114 5 + 512 * sizeof (short) / sizeof (int) + 336,
115 5 + 512 * sizeof (short) / sizeof (int) + 336,
116 5 + 512 * sizeof (short) / sizeof (int) + 336,
117 5 + 512 * sizeof (short) / sizeof (int) + 336,
118 5 + 512 * sizeof (short) / sizeof (int) + 336,
119 5 + 512 * sizeof (short) / sizeof (int) + 336,
120 5 + 512 * sizeof (short) / sizeof (int) + 336,
121 5 + 512 * sizeof (short) / sizeof (int) + 336,
122 5 + 512 * sizeof (short) / sizeof (int) + 336,
123 5 + 512 * sizeof (short) / sizeof (int) + 336,
124 5 + 512 * sizeof (short) / sizeof (int) + 368,
125 5 + 512 * sizeof (short) / sizeof (int) + 384,
126 5 + 512 * sizeof (short) / sizeof (int) + 400,
127 5 + 512 * sizeof (short) / sizeof (int) + 416,
128 5 + 512 * sizeof (short) / sizeof (int) + 336,
129 5 + 512 * sizeof (short) / sizeof (int) + 336,
130 5 + 512 * sizeof (short) / sizeof (int) + 336,
131 5 + 512 * sizeof (short) / sizeof (int) + 336,
132 5 + 512 * sizeof (short) / sizeof (int) + 336,
133 5 + 512 * sizeof (short) / sizeof (int) + 336,
134 5 + 512 * sizeof (short) / sizeof (int) + 336,
135 5 + 512 * sizeof (short) / sizeof (int) + 336,
136 5 + 512 * sizeof (short) / sizeof (int) + 336,
137 5 + 512 * sizeof (short) / sizeof (int) + 336,
138 5 + 512 * sizeof (short) / sizeof (int) + 336,
139 5 + 512 * sizeof (short) / sizeof (int) + 336,
140 5 + 512 * sizeof (short) / sizeof (int) + 336,
141 5 + 512 * sizeof (short) / sizeof (int) + 336,
142 5 + 512 * sizeof (short) / sizeof (int) + 336,
143 5 + 512 * sizeof (short) / sizeof (int) + 336,
144 5 + 512 * sizeof (short) / sizeof (int) + 336,
145 5 + 512 * sizeof (short) / sizeof (int) + 336,
146 5 + 512 * sizeof (short) / sizeof (int) + 336,
147 5 + 512 * sizeof (short) / sizeof (int) + 336,
148 5 + 512 * sizeof (short) / sizeof (int) + 336,
149 5 + 512 * sizeof (short) / sizeof (int) + 432,
150 -1,
151 -1,
152 -1,
153 -1,
154 -1,
155 -1,
156 -1,
157 -1,
158 -1,
159 -1,
160 -1,
161 -1,
162 -1,
163 -1,
164 -1,
165 -1,
166 5 + 512 * sizeof (short) / sizeof (int) + 448,
167 5 + 512 * sizeof (short) / sizeof (int) + 464,
168 5 + 512 * sizeof (short) / sizeof (int) + 480,
169 5 + 512 * sizeof (short) / sizeof (int) + 496,
170 5 + 512 * sizeof (short) / sizeof (int) + 512,
171 5 + 512 * sizeof (short) / sizeof (int) + 528,
172 5 + 512 * sizeof (short) / sizeof (int) + 544,
173 5 + 512 * sizeof (short) / sizeof (int) + 560,
174 5 + 512 * sizeof (short) / sizeof (int) + 576,
175 5 + 512 * sizeof (short) / sizeof (int) + 592,
176 5 + 512 * sizeof (short) / sizeof (int) + 608,
177 5 + 512 * sizeof (short) / sizeof (int) + 624,
178 5 + 512 * sizeof (short) / sizeof (int) + 640,
179 5 + 512 * sizeof (short) / sizeof (int) + 656,
180 5 + 512 * sizeof (short) / sizeof (int) + 672,
181 5 + 512 * sizeof (short) / sizeof (int) + 688,
182 5 + 512 * sizeof (short) / sizeof (int) + 704,
183 5 + 512 * sizeof (short) / sizeof (int) + 720,
184 5 + 512 * sizeof (short) / sizeof (int) + 736,
185 5 + 512 * sizeof (short) / sizeof (int) + 752,
186 5 + 512 * sizeof (short) / sizeof (int) + 336,
187 5 + 512 * sizeof (short) / sizeof (int) + 768,
188 5 + 512 * sizeof (short) / sizeof (int) + 784,
189 -1,
190 -1,
191 -1,
192 -1,
193 5 + 512 * sizeof (short) / sizeof (int) + 800,
194 5 + 512 * sizeof (short) / sizeof (int) + 336,
195 5 + 512 * sizeof (short) / sizeof (int) + 336,
196 5 + 512 * sizeof (short) / sizeof (int) + 816,
197 5 + 512 * sizeof (short) / sizeof (int) + 336,
198 5 + 512 * sizeof (short) / sizeof (int) + 336,
199 5 + 512 * sizeof (short) / sizeof (int) + 336,
200 5 + 512 * sizeof (short) / sizeof (int) + 336,
201 5 + 512 * sizeof (short) / sizeof (int) + 336,
202 5 + 512 * sizeof (short) / sizeof (int) + 336,
203 5 + 512 * sizeof (short) / sizeof (int) + 832,
204 5 + 512 * sizeof (short) / sizeof (int) + 336,
205 5 + 512 * sizeof (short) / sizeof (int) + 848,
206 -1,
207 -1,
208 -1,
209 -1,
210 -1,
211 -1,
212 -1,
213 -1,
214 -1,
215 -1,
216 -1,
217 -1,
218 5 + 512 * sizeof (short) / sizeof (int) + 864,
219 -1,
220 -1,
221 -1,
222 5 + 512 * sizeof (short) / sizeof (int) + 336,
223 5 + 512 * sizeof (short) / sizeof (int) + 880,
224 5 + 512 * sizeof (short) / sizeof (int) + 896,
225 5 + 512 * sizeof (short) / sizeof (int) + 912,
226 5 + 512 * sizeof (short) / sizeof (int) + 336,
227 5 + 512 * sizeof (short) / sizeof (int) + 336,
228 5 + 512 * sizeof (short) / sizeof (int) + 336,
229 5 + 512 * sizeof (short) / sizeof (int) + 336,
230 5 + 512 * sizeof (short) / sizeof (int) + 336,
231 5 + 512 * sizeof (short) / sizeof (int) + 336,
232 5 + 512 * sizeof (short) / sizeof (int) + 336,
233 5 + 512 * sizeof (short) / sizeof (int) + 336,
234 5 + 512 * sizeof (short) / sizeof (int) + 336,
235 5 + 512 * sizeof (short) / sizeof (int) + 336,
236 5 + 512 * sizeof (short) / sizeof (int) + 336,
237 5 + 512 * sizeof (short) / sizeof (int) + 336,
238 5 + 512 * sizeof (short) / sizeof (int) + 336,
239 5 + 512 * sizeof (short) / sizeof (int) + 336,
240 5 + 512 * sizeof (short) / sizeof (int) + 928,
241 -1,
242 -1,
243 -1,
244 -1,
245 -1,
246 -1,
247 -1,
248 -1,
249 -1,
250 -1,
251 -1,
252 -1,
253 -1,
254 -1,
255 -1,
256 -1,
257 5 + 512 * sizeof (short) / sizeof (int) + 944,
258 5 + 512 * sizeof (short) / sizeof (int) + 960,
259 5 + 512 * sizeof (short) / sizeof (int) + 976,
260 -1,
261 -1,
262 -1,
263 -1,
264 5 + 512 * sizeof (short) / sizeof (int) + 992,
265 -1,
266 -1,
267 -1,
268 -1,
269 -1,
270 -1,
271 -1,
272 5 + 512 * sizeof (short) / sizeof (int) + 1008,
273 -1,
274 -1,
275 -1,
276 5 + 512 * sizeof (short) / sizeof (int) + 1024,
277 5 + 512 * sizeof (short) / sizeof (int) + 1040,
278 -1,
279 -1,
280 -1,
281 5 + 512 * sizeof (short) / sizeof (int) + 1056,
282 5 + 512 * sizeof (short) / sizeof (int) + 1072,
283 5 + 512 * sizeof (short) / sizeof (int) + 1088,
284 5 + 512 * sizeof (short) / sizeof (int) + 1104,
285 5 + 512 * sizeof (short) / sizeof (int) + 1120,
286 5 + 512 * sizeof (short) / sizeof (int) + 1136,
287 -1,
288 -1,
289 5 + 512 * sizeof (short) / sizeof (int) + 1152,
290 5 + 512 * sizeof (short) / sizeof (int) + 1168,
291 -1,
292 -1,
293 -1,
294 -1,
295 5 + 512 * sizeof (short) / sizeof (int) + 1184,
296 -1,
297 -1,
298 5 + 512 * sizeof (short) / sizeof (int) + 336,
299 5 + 512 * sizeof (short) / sizeof (int) + 336,
300 5 + 512 * sizeof (short) / sizeof (int) + 336,
301 5 + 512 * sizeof (short) / sizeof (int) + 336,
302 5 + 512 * sizeof (short) / sizeof (int) + 336,
303 5 + 512 * sizeof (short) / sizeof (int) + 336,
304 5 + 512 * sizeof (short) / sizeof (int) + 336,
305 5 + 512 * sizeof (short) / sizeof (int) + 336,
306 5 + 512 * sizeof (short) / sizeof (int) + 336,
307 5 + 512 * sizeof (short) / sizeof (int) + 336,
308 5 + 512 * sizeof (short) / sizeof (int) + 336,
309 5 + 512 * sizeof (short) / sizeof (int) + 336,
310 5 + 512 * sizeof (short) / sizeof (int) + 336,
311 5 + 512 * sizeof (short) / sizeof (int) + 336,
312 5 + 512 * sizeof (short) / sizeof (int) + 336,
313 5 + 512 * sizeof (short) / sizeof (int) + 336,
314 5 + 512 * sizeof (short) / sizeof (int) + 336,
315 5 + 512 * sizeof (short) / sizeof (int) + 336,
316 5 + 512 * sizeof (short) / sizeof (int) + 336,
317 5 + 512 * sizeof (short) / sizeof (int) + 336,
318 5 + 512 * sizeof (short) / sizeof (int) + 336,
319 5 + 512 * sizeof (short) / sizeof (int) + 336,
320 5 + 512 * sizeof (short) / sizeof (int) + 336,
321 5 + 512 * sizeof (short) / sizeof (int) + 336,
322 5 + 512 * sizeof (short) / sizeof (int) + 336,
323 5 + 512 * sizeof (short) / sizeof (int) + 336,
324 5 + 512 * sizeof (short) / sizeof (int) + 336,
325 5 + 512 * sizeof (short) / sizeof (int) + 336,
326 5 + 512 * sizeof (short) / sizeof (int) + 336,
327 5 + 512 * sizeof (short) / sizeof (int) + 336,
328 5 + 512 * sizeof (short) / sizeof (int) + 336,
329 5 + 512 * sizeof (short) / sizeof (int) + 336,
330 5 + 512 * sizeof (short) / sizeof (int) + 336,
331 5 + 512 * sizeof (short) / sizeof (int) + 336,
332 5 + 512 * sizeof (short) / sizeof (int) + 336,
333 5 + 512 * sizeof (short) / sizeof (int) + 336,
334 5 + 512 * sizeof (short) / sizeof (int) + 336,
335 5 + 512 * sizeof (short) / sizeof (int) + 336,
336 5 + 512 * sizeof (short) / sizeof (int) + 336,
337 5 + 512 * sizeof (short) / sizeof (int) + 336,
338 5 + 512 * sizeof (short) / sizeof (int) + 336,
339 5 + 512 * sizeof (short) / sizeof (int) + 336,
340 5 + 512 * sizeof (short) / sizeof (int) + 336,
341 5 + 512 * sizeof (short) / sizeof (int) + 336,
342 5 + 512 * sizeof (short) / sizeof (int) + 336,
343 5 + 512 * sizeof (short) / sizeof (int) + 336,
344 5 + 512 * sizeof (short) / sizeof (int) + 336,
345 5 + 512 * sizeof (short) / sizeof (int) + 336,
346 5 + 512 * sizeof (short) / sizeof (int) + 336,
347 5 + 512 * sizeof (short) / sizeof (int) + 336,
348 5 + 512 * sizeof (short) / sizeof (int) + 336,
349 5 + 512 * sizeof (short) / sizeof (int) + 336,
350 5 + 512 * sizeof (short) / sizeof (int) + 336,
351 5 + 512 * sizeof (short) / sizeof (int) + 336,
352 5 + 512 * sizeof (short) / sizeof (int) + 336,
353 5 + 512 * sizeof (short) / sizeof (int) + 336,
354 5 + 512 * sizeof (short) / sizeof (int) + 336,
355 5 + 512 * sizeof (short) / sizeof (int) + 336,
356 5 + 512 * sizeof (short) / sizeof (int) + 336,
357 5 + 512 * sizeof (short) / sizeof (int) + 336,
358 5 + 512 * sizeof (short) / sizeof (int) + 336,
359 5 + 512 * sizeof (short) / sizeof (int) + 336,
360 5 + 512 * sizeof (short) / sizeof (int) + 336,
361 5 + 512 * sizeof (short) / sizeof (int) + 336,
362 5 + 512 * sizeof (short) / sizeof (int) + 336,
363 5 + 512 * sizeof (short) / sizeof (int) + 336,
364 5 + 512 * sizeof (short) / sizeof (int) + 336,
365 5 + 512 * sizeof (short) / sizeof (int) + 336,
366 5 + 512 * sizeof (short) / sizeof (int) + 336,
367 5 + 512 * sizeof (short) / sizeof (int) + 336,
368 5 + 512 * sizeof (short) / sizeof (int) + 336,
369 5 + 512 * sizeof (short) / sizeof (int) + 336,
370 5 + 512 * sizeof (short) / sizeof (int) + 336,
371 5 + 512 * sizeof (short) / sizeof (int) + 336,
372 5 + 512 * sizeof (short) / sizeof (int) + 336,
373 5 + 512 * sizeof (short) / sizeof (int) + 336,
374 5 + 512 * sizeof (short) / sizeof (int) + 336,
375 5 + 512 * sizeof (short) / sizeof (int) + 336,
376 5 + 512 * sizeof (short) / sizeof (int) + 336,
377 5 + 512 * sizeof (short) / sizeof (int) + 336,
378 5 + 512 * sizeof (short) / sizeof (int) + 336,
379 5 + 512 * sizeof (short) / sizeof (int) + 336,
380 5 + 512 * sizeof (short) / sizeof (int) + 336,
381 5 + 512 * sizeof (short) / sizeof (int) + 1200,
382 5 + 512 * sizeof (short) / sizeof (int) + 336,
383 5 + 512 * sizeof (short) / sizeof (int) + 336,
384 5 + 512 * sizeof (short) / sizeof (int) + 336,
385 5 + 512 * sizeof (short) / sizeof (int) + 336,
386 5 + 512 * sizeof (short) / sizeof (int) + 336,
387 5 + 512 * sizeof (short) / sizeof (int) + 336,
388 5 + 512 * sizeof (short) / sizeof (int) + 336,
389 5 + 512 * sizeof (short) / sizeof (int) + 336,
390 5 + 512 * sizeof (short) / sizeof (int) + 1216,
391 5 + 512 * sizeof (short) / sizeof (int) + 336,
392 5 + 512 * sizeof (short) / sizeof (int) + 336,
393 5 + 512 * sizeof (short) / sizeof (int) + 336,
394 5 + 512 * sizeof (short) / sizeof (int) + 336,
395 5 + 512 * sizeof (short) / sizeof (int) + 336,
396 5 + 512 * sizeof (short) / sizeof (int) + 336,
397 5 + 512 * sizeof (short) / sizeof (int) + 336,
398 5 + 512 * sizeof (short) / sizeof (int) + 336,
399 5 + 512 * sizeof (short) / sizeof (int) + 336,
400 5 + 512 * sizeof (short) / sizeof (int) + 336,
401 5 + 512 * sizeof (short) / sizeof (int) + 1232,
402 5 + 512 * sizeof (short) / sizeof (int) + 336,
403 5 + 512 * sizeof (short) / sizeof (int) + 336,
404 5 + 512 * sizeof (short) / sizeof (int) + 336,
405 5 + 512 * sizeof (short) / sizeof (int) + 336,
406 5 + 512 * sizeof (short) / sizeof (int) + 336,
407 5 + 512 * sizeof (short) / sizeof (int) + 336,
408 5 + 512 * sizeof (short) / sizeof (int) + 336,
409 5 + 512 * sizeof (short) / sizeof (int) + 336,
410 5 + 512 * sizeof (short) / sizeof (int) + 336,
411 5 + 512 * sizeof (short) / sizeof (int) + 336,
412 5 + 512 * sizeof (short) / sizeof (int) + 336,
413 5 + 512 * sizeof (short) / sizeof (int) + 336,
414 5 + 512 * sizeof (short) / sizeof (int) + 336,
415 5 + 512 * sizeof (short) / sizeof (int) + 1248,
416 5 + 512 * sizeof (short) / sizeof (int) + 336,
417 5 + 512 * sizeof (short) / sizeof (int) + 1264,
418 -1,
419 -1,
420 -1,
421 -1,
422 5 + 512 * sizeof (short) / sizeof (int) + 336,
423 5 + 512 * sizeof (short) / sizeof (int) + 1280,
424 -1,
425 -1,
426 5 + 512 * sizeof (short) / sizeof (int) + 336,
427 5 + 512 * sizeof (short) / sizeof (int) + 336,
428 5 + 512 * sizeof (short) / sizeof (int) + 336,
429 5 + 512 * sizeof (short) / sizeof (int) + 336,
430 5 + 512 * sizeof (short) / sizeof (int) + 336,
431 5 + 512 * sizeof (short) / sizeof (int) + 336,
432 5 + 512 * sizeof (short) / sizeof (int) + 336,
433 5 + 512 * sizeof (short) / sizeof (int) + 336,
434 5 + 512 * sizeof (short) / sizeof (int) + 336,
435 5 + 512 * sizeof (short) / sizeof (int) + 1296,
436 5 + 512 * sizeof (short) / sizeof (int) + 336,
437 5 + 512 * sizeof (short) / sizeof (int) + 336,
438 5 + 512 * sizeof (short) / sizeof (int) + 336,
439 5 + 512 * sizeof (short) / sizeof (int) + 336,
440 5 + 512 * sizeof (short) / sizeof (int) + 336,
441 5 + 512 * sizeof (short) / sizeof (int) + 336,
442 5 + 512 * sizeof (short) / sizeof (int) + 336,
443 5 + 512 * sizeof (short) / sizeof (int) + 336,
444 5 + 512 * sizeof (short) / sizeof (int) + 336,
445 5 + 512 * sizeof (short) / sizeof (int) + 336,
446 5 + 512 * sizeof (short) / sizeof (int) + 336,
447 5 + 512 * sizeof (short) / sizeof (int) + 336,
448 5 + 512 * sizeof (short) / sizeof (int) + 336,
449 5 + 512 * sizeof (short) / sizeof (int) + 336,
450 5 + 512 * sizeof (short) / sizeof (int) + 336,
451 5 + 512 * sizeof (short) / sizeof (int) + 336,
452 5 + 512 * sizeof (short) / sizeof (int) + 1312,
453 -1,
454 -1,
455 -1,
456 -1,
457 -1,
458 -1,
459 -1,
460 -1,
461 -1,
462 -1,
463 -1,
464 -1,
465 -1,
466 -1,
467 -1,
468 -1,
469 -1,
470 -1,
471 -1,
472 -1,
473 -1,
474 -1,
475 -1,
476 -1,
477 -1,
478 -1,
479 -1,
480 -1,
481 -1,
482 -1,
483 -1,
484 -1,
485 -1,
486 -1,
487 -1,
488 -1,
489 -1,
490 -1,
491 -1,
492 -1,
493 -1,
494 -1,
495 -1,
496 -1,
497 -1,
498 -1,
499 -1,
500 -1,
501 -1,
502 -1,
503 -1,
504 -1,
505 -1,
506 -1,
507 -1,
508 -1,
509 -1,
510 -1,
511 -1,
512 -1,
513 -1,
514 -1,
515 -1,
516 -1,
517 -1,
518 -1,
519 -1,
520 -1,
521 -1,
522 -1,
523 -1,
524 -1,
525 -1,
526 -1,
527 -1,
528 -1,
529 -1,
530 -1,
531 -1,
532 -1,
533 -1,
534 -1,
535 -1,
536 -1,
537 -1,
538 -1,
539 -1,
540 -1,
541 -1,
542 -1,
543 -1,
544 -1,
545 -1,
546 -1,
547 -1,
548 -1,
549 -1,
550 -1,
551 -1,
552 -1,
553 -1
554 },
555 {
556 0x00000000U, 0x00000000U, 0x07FFFFFEU, 0x07FFFFFEU,
557 0x00000000U, 0x04200400U, 0xFF7FFFFFU, 0xFF7FFFFFU,
558 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
559 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
560 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
561 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0003FFC3U, 0x0000501FU,
562 0x00000000U, 0x00000000U, 0x00000020U, 0xBCDF0000U,
563 0xFFFFD740U, 0xFFFFFFFBU, 0xFFFFFFFFU, 0xFFBFFFFFU,
564 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
565 0xFFFFFC03U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
566 0xFFFFFFFFU, 0xFFFEFFFFU, 0x027FFFFFU, 0xFFFFFFFFU,
567 0x000001FFU, 0x00000000U, 0xFFFF0000U, 0x000787FFU,
568 0x00000000U, 0xFFFFFFFFU, 0x000007FFU, 0xFFFEC3FFU,
569 0xFFFFFFFFU, 0xFFFFFFFFU, 0x002FFFFFU, 0x9FFFC060U,
570 0xFFFD0000U, 0x0000FFFFU, 0xFFFFE000U, 0xFFFFFFFFU,
571 0xFFFFFFFFU, 0x0002003FU, 0xFFFFFFFFU, 0x043007FFU,
572 0x043FFFFFU, 0x00000110U, 0x01FFFFFFU, 0xFFFF07FFU,
573 0x0000FEFFU, 0xFFFFFFFFU, 0x000003FFU, 0x00000000U,
574 0xFFFFFFF0U, 0x23FFFFFFU, 0xFF010000U, 0xFFFEFFC3U,
575 0xFFF99FE1U, 0x23C5FDFFU, 0xB0004000U, 0x1003FFC3U,
576 0xFFF987E0U, 0x036DFDFFU, 0x5E000000U, 0x001CFFC0U,
577 0xFFFBBFE0U, 0x23EDFDFFU, 0x00010000U, 0x0200FFC3U,
578 0xFFF99FE0U, 0x23EDFDFFU, 0xB0000000U, 0x0002FFC3U,
579 0xD63DC7E8U, 0x03FFC718U, 0x00010000U, 0x0000FFC0U,
580 0xFFFDDFE0U, 0x23FFFDFFU, 0x37000000U, 0x0000FFC3U,
581 0xFFFDDFE1U, 0x23EFFDFFU, 0x70000000U, 0x0006FFC3U,
582 0xFFFDDFF0U, 0x27FFFFFFU, 0x80704000U, 0xFC00FFC3U,
583 0xFC7FFFE0U, 0x2FFBFFFFU, 0x0000007FU, 0x0000FFC0U,
584 0xFFFFFFFEU, 0x07FF7FFFU, 0x03FF7FBFU, 0x00000000U,
585 0xFFFFF7D6U, 0x200DFFAFU, 0xF3FF005FU, 0x00000000U,
586 0x00000001U, 0x000003FFU, 0xFFFFFEFFU, 0x00001FFFU,
587 0x00001F00U, 0x00000000U, 0x00000000U, 0x00000000U,
588 0xFFFFFFFFU, 0x800007FFU, 0x3C3F03FFU, 0xFFE1C062U,
589 0x03FF4003U, 0xFFFFFFFFU, 0xFFFF20BFU, 0xF7FFFFFFU,
590 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
591 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
592 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3D7F3DFFU, 0xFFFFFFFFU,
593 0xFFFF3DFFU, 0x7F3DFFFFU, 0xFF7FFF3DU, 0xFFFFFFFFU,
594 0xFF3DFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU, 0x00000000U,
595 0x0000FFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3F3FFFFFU,
596 0xFFFFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
597 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
598 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
599 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
600 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF9FFFU,
601 0x07FFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFC7FFU,
602 0x8003FFFFU, 0x0003FFFFU, 0x0003FFFFU, 0x0001DFFFU,
603 0xFFFFFFFFU, 0x000FFFFFU, 0x10800000U, 0x000003FFU,
604 0x03FF0000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFFFFFU,
605 0xFFFFFF9FU, 0xFFFF05FFU, 0xFFFFFFFFU, 0x003FFFFFU,
606 0x7FFFFFFFU, 0x00000000U, 0xFFFFFFC0U, 0x001F3FFFU,
607 0xFFFFFFFFU, 0xFFFF0FFFU, 0x03FF03FFU, 0x00000000U,
608 0x007FFFFFU, 0xFFFFFFFFU, 0x001FFFFFU, 0x00000000U,
609 0x03FF03FFU, 0x00000080U, 0x00000000U, 0x00000000U,
610 0xFFFFFFE0U, 0x000FFFFFU, 0x03FF1FE0U, 0x00000000U,
611 0xFFFFFFF8U, 0xFFFFC001U, 0xFFFFFFFFU, 0x0000003FU,
612 0xFFFFFFFFU, 0x0000000FU, 0xFFFFE3FFU, 0x3FFFFFFFU,
613 0xFFFF07FFU, 0xE7FFFFFFU, 0x00000000U, 0x046FDE00U,
614 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
615 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, 0x00000000U,
616 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
617 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
618 0x3F3FFFFFU, 0xFFFFFFFFU, 0xAAFF3F3FU, 0x3FFFFFFFU,
619 0xFFFFFFFFU, 0x5FDFFFFFU, 0x0FCF1FDCU, 0x1FDC1FFFU,
620 0x00000000U, 0x00000000U, 0x00000000U, 0x80020000U,
621 0x1FFF0000U, 0x00000000U, 0x00000000U, 0x00000000U,
622 0x3E2FFC84U, 0xF3FFBF50U, 0x000043E0U, 0xFFFFFFFFU,
623 0x000001FFU, 0x00000000U, 0x00000000U, 0x00000000U,
624 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
625 0xF0000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000003FFU,
626 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
627 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
628 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
629 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000C781FU,
630 0xFFFFFFFFU, 0xFFFF20BFU, 0xFFFFFFFFU, 0x000080FFU,
631 0x007FFFFFU, 0x7F7F7F7FU, 0x7F7F7F7FU, 0x00000000U,
632 0x00000000U, 0x00008000U, 0x00000000U, 0x00000000U,
633 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
634 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
635 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
636 0x000000E0U, 0x1F3E03FEU, 0xFFFFFFFEU, 0xFFFFFFFFU,
637 0xE07FFFFFU, 0xFFFFFFFEU, 0xFFFFFFFFU, 0xF7FFFFFFU,
638 0xFFFFFFE0U, 0xFFFEFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
639 0x00007FFFU, 0xFFFFFFFFU, 0x00000000U, 0xFFFF0000U,
640 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
641 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
642 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
643 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
644 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
645 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
646 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
647 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, 0x00000000U,
648 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
649 0x00001FFFU, 0x00000000U, 0xFFFF0000U, 0x3FFFFFFFU,
650 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
651 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
652 0xFFFF1FFFU, 0x00000FFFU, 0xFFFFFFFFU, 0x80007FFFU,
653 0x3FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU,
654 0xFF800000U, 0xFFFFFFFCU, 0xFFFFFFFFU, 0xFFFFFFFFU,
655 0xFFFFF9FFU, 0xFFFFFFFFU, 0x1FFFFFFFU, 0xFFFE0000U,
656 0xFFFFF7BBU, 0x00000007U, 0xFFFFFFFFU, 0x000FFFFFU,
657 0xFFFFFFFCU, 0x000FFFFFU, 0x03FF0000U, 0x68FC0000U,
658 0xFFFFFFFFU, 0xFFFF003FU, 0x0000007FU, 0x1FFFFFFFU,
659 0xFFFFFFF0U, 0x0007FFFFU, 0x03FF8000U, 0x7FFFFFDFU,
660 0xFFFFFFFFU, 0x000001FFU, 0x03FF0FF7U, 0xC47FFFFFU,
661 0xFFFFFFFFU, 0x3E62FFFFU, 0x38000005U, 0x001C07FFU,
662 0x007E7E7EU, 0xFFFF7F7FU, 0xF7FFFFFFU, 0xFFFF03FFU,
663 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF0007U,
664 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
665 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
666 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
667 0xFFFFFFFFU, 0xFFFF000FU, 0xFFFFF87FU, 0x0FFFFFFFU,
668 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
669 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
670 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
671 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
672 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF3FFFU,
673 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00000000U,
674 0xA0F8007FU, 0x5F7FFDFFU, 0xFFFFFFDBU, 0xFFFFFFFFU,
675 0xFFFFFFFFU, 0x0003FFFFU, 0xFFF80000U, 0xFFFFFFFFU,
676 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
677 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
678 0xFFFFFFFFU, 0x3FFFFFFFU, 0xFFFF0000U, 0xFFFFFFFFU,
679 0xFFFCFFFFU, 0xFFFFFFFFU, 0x000000FFU, 0x0FFF0000U,
680 0x00000000U, 0x00000000U, 0x00000000U, 0xFFDF0000U,
681 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFFFFFFU,
682 0x03FF0000U, 0x07FFFFFEU, 0x07FFFFFEU, 0xFFFFFFC0U,
683 0xFFFFFFFFU, 0x7FFFFFFFU, 0x1CFCFCFCU, 0x00000000U,
684 0xFFFFEFFFU, 0xB7FFFF7FU, 0x3FFF3FFFU, 0x00000000U,
685 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU,
686 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x001FFFFFU,
687 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
688 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
689 0x1FFFFFFFU, 0xFFFFFFFFU, 0x0001FFFFU, 0x00000000U,
690 0xFFFFFFFFU, 0xFFFFE000U, 0xFFFF07FFU, 0x003FFFFFU,
691 0x3FFFFFFFU, 0xFFFFFFFFU, 0x003EFF0FU, 0x00000000U,
692 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
693 0x3FFFFFFFU, 0xFFFF03FFU, 0xFF0FFFFFU, 0x0FFFFFFFU,
694 0xFFFFFFFFU, 0xFFFF00FFU, 0xFFFFFFFFU, 0xF7FF000FU,
695 0xFFB7F7FFU, 0x1BFBFFFBU, 0xFFFFFFFFU, 0x000FFFFFU,
696 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
697 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
698 0xFFFFFFFFU, 0x007FFFFFU, 0x003FFFFFU, 0x000000FFU,
699 0xFFFFFFBFU, 0x07FDFFFFU, 0x00000000U, 0x00000000U,
700 0xFFFFFD3FU, 0x91BFFFFFU, 0x003FFFFFU, 0x007FFFFFU,
701 0x7FFFFFFFU, 0x00000000U, 0x00000000U, 0x0037FFFFU,
702 0x003FFFFFU, 0x03FFFFFFU, 0x03FFFFFFU, 0x00000000U,
703 0xFFFFFFFFU, 0xC0FFFFFFU, 0x00000000U, 0x00000000U,
704 0xFEEF0001U, 0x003FFFFFU, 0x00000000U, 0x1FFFFFFFU,
705 0x1FFFFFFFU, 0x00000000U, 0xFFFFFEFFU, 0x0000001FU,
706 0xFFFFFFFFU, 0x003FFFFFU, 0x003FFFFFU, 0x0007FFFFU,
707 0x0003FFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
708 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000001FFU, 0x00000000U,
709 0xFFFFFFFFU, 0x0007FFFFU, 0xFFFFFFFFU, 0x0007FFFFU,
710 0xFFFFFFFFU, 0x03FF000FU, 0xFFFFFFFFU, 0xFFFF803FU,
711 0x0000003FU, 0x00000000U, 0x00000000U, 0x00000000U,
712 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
713 0xFFFFFFFFU, 0x000303FFU, 0x000000FCU, 0x00000000U,
714 0x1FFFFFFFU, 0xFFFF0080U, 0x0000003FU, 0xFFFF0000U,
715 0x00000003U, 0xFFFF0000U, 0x0000001FU, 0x007FFFFFU,
716 0xFFFFFFF8U, 0x00FFFFFFU, 0x00000000U, 0x0026FFC0U,
717 0xFFFFFFF8U, 0x0000FFFFU, 0xFFFF0000U, 0x03FF01FFU,
718 0xFFFFFFF8U, 0xFFC0007FU, 0xFFFF0090U, 0x0047FFFFU,
719 0xFFFFFFF8U, 0x0007FFFFU, 0x17FF001EU, 0x00000000U,
720 0xFFFBFFFFU, 0x80000FFFU, 0x00000001U, 0x00000000U,
721 0xBFFFBD7FU, 0xFFFF01FFU, 0x7FFFFFFFU, 0x03FF0000U,
722 0xFFF99FE0U, 0x23EDFDFFU, 0xE0010000U, 0x00000003U,
723 0xFFFF4BFFU, 0x00BFFFFFU, 0x000A0000U, 0x00000000U,
724 0xFFFFFFFFU, 0x001FFFFFU, 0x83FF0780U, 0x00000003U,
725 0xFFFFFFFFU, 0x0000FFFFU, 0x03FF00B0U, 0x00000000U,
726 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
727 0xFFFFFFFFU, 0x00007FFFU, 0x0F000000U, 0x00000000U,
728 0xFFFFFFFFU, 0x0000FFFFU, 0x03FF0010U, 0x00000000U,
729 0xFFFFFFFFU, 0x010007FFU, 0xFFFF03FFU, 0x0000000FU,
730 0x07FFFFFFU, 0x03FF0000U, 0x0000007FU, 0x00000000U,
731 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
732 0xFFFFFFFFU, 0x00000FFFU, 0x00000000U, 0x00000000U,
733 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x800003FFU,
734 0xFF6FF27FU, 0x8000FFFFU, 0x03FF0002U, 0x00000000U,
735 0x00000000U, 0xFFFFFCFFU, 0x0001FFFFU, 0x0000000AU,
736 0xFFFFF801U, 0x0407FFFFU, 0xF0010000U, 0xFFFFFFFFU,
737 0x200003FFU, 0xFFFF0000U, 0xFFFFFFFFU, 0x01FFFFFFU,
738 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
739 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x03FF0001U,
740 0xFFFFFDFFU, 0x00007FFFU, 0x03FF0001U, 0xFFFC0000U,
741 0x0000FFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
742 0xFFFFFB7FU, 0x0001FFFFU, 0x03FF0040U, 0xFFFFFDBFU,
743 0x010003FFU, 0xFFFF03FFU, 0x0FFFFFFFU, 0x000003FFU,
744 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
745 0x00000000U, 0x00000000U, 0x00000000U, 0x0007FFFFU,
746 0xFFFDFFF4U, 0x000FFFFFU, 0x03FF0000U, 0x00000000U,
747 0x00000000U, 0x00010000U, 0x00000000U, 0x00000000U,
748 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
749 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
750 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
751 0x03FFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
752 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00007FFFU,
753 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
754 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U,
755 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
756 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
757 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
758 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
759 0xFFFF0000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0001FFFFU,
760 0xFFFFFFFFU, 0x0000FFFFU, 0x0000007EU, 0xFFFFFFFFU,
761 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
762 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
763 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
764 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
765 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
766 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
767 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU,
768 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000007FU, 0x00000000U,
769 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
770 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
771 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
772 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
773 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
774 0x3FFFFFFFU, 0x03FF0000U, 0x00000000U, 0x00000000U,
775 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
776 0xFFFFFFFFU, 0x01FFFFFFU, 0x7FFFFFFFU, 0xFFFF03FFU,
777 0xFFFFFFFFU, 0x7FFFFFFFU, 0xFFFF03FFU, 0x00003FFFU,
778 0xFFFFFFFFU, 0x0000FFFFU, 0x03FF000FU, 0xE0FFFFF8U,
779 0x0000FFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
780 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
781 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
782 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x03FF1FFFU,
783 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
784 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU,
785 0x00000000U, 0xF9FFFFFFU, 0x000FFFFFU, 0x00000000U,
786 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000107FFU, 0x00000000U,
787 0xFFF80000U, 0x00000000U, 0x00000000U, 0x007C000BU,
788 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
789 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x80000000U,
790 0x7FFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
791 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0007FFFFU,
792 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
793 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
794 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
795 0x00000000U, 0x00000000U, 0x00000000U, 0x6FEF0000U,
796 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
797 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
798 0xFFFFFFFFU, 0x00040007U, 0x00270000U, 0xFFFF00F0U,
799 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
800 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
801 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0FFFFFFFU,
802 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
803 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
804 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFF07FFU,
805 0x03FF01FFU, 0x00000000U, 0x00000000U, 0x00000000U,
806 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
807 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
808 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
809 0x00000000U, 0x00000000U, 0xFFC00000U, 0x03FFFFFFU,
810 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
811 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
812 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFDFFFFFU, 0xFFFFFFFFU,
813 0xDFFFFFFFU, 0xEBFFDE64U, 0xFFFFFFEFU, 0xFFFFFFFFU,
814 0xDFDFE7BFU, 0x7BFFFFFFU, 0xFFFDFC5FU, 0xFFFFFFFFU,
815 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
816 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
817 0xFFFFFFFFU, 0xFFFFFF3FU, 0xF7FFFFFDU, 0xF7FFFFFFU,
818 0xFFDFFFFFU, 0xFFDFFFFFU, 0xFFFF7FFFU, 0xFFFF7FFFU,
819 0xFFFFFDFFU, 0xFFFFFDFFU, 0xFFFFCFF7U, 0xFFFFFFFFU,
820 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
821 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
822 0x7FFFFFFFU, 0x000007E0U, 0x00000000U, 0x00000000U,
823 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
824 0x00000000U, 0xFFFF0000U, 0xFFFFFFFFU, 0x00003FFFU,
825 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
826 0xFFFFFFFFU, 0x3F801FFFU, 0x000043FFU, 0x00000000U,
827 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
828 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
829 0xFFFF0000U, 0x00003FFFU, 0xFFFFFFFFU, 0x03FF0FFFU,
830 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
831 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
832 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
833 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x03FF0FFFU,
834 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
835 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x07FF3FFFU,
836 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
837 0x00000000U, 0x00000000U, 0x7FFFFFFFU, 0xC01F3FB7U,
838 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
839 0x00000000U, 0x00000000U, 0x00000000U, 0x7FFF6F7FU,
840 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
841 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000001FU, 0x00000000U,
842 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF080FU, 0x00000000U,
843 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
844 0xFFFFFFEFU, 0x0AF7FE96U, 0xAA96EA84U, 0x5EF7F796U,
845 0x0FFFFBFFU, 0x0FFFFBEEU, 0x00000000U, 0x00000000U,
846 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
847 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
848 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
849 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
850 0xFFFF0000U, 0xFFFF1FFFU, 0xFFFF03FFU, 0xFFFF03FFU,
851 0x000007FFU, 0x00000020U, 0x00000000U, 0xFFFFFFC0U,
852 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
853 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
854 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
855 0x00000000U, 0x00000000U, 0x00000000U, 0x03FF0000U,
856 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
857 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U,
858 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
859 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
860 0x3FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
861 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
862 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
863 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
864 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
865 0xFFFFFFFFU, 0xFFFF3FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
866 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
867 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
868 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
869 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
870 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
871 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF0001U,
872 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x00000000U,
873 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
874 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
875 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
876 0x3FFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
877 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
878 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
879 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
880 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
881 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
882 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF07FFU, 0xFFFFFFFFU,
883 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
884 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU,
885 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
886 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
887 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U
888 }
889};
diff --git a/gl/unictype/ctype_blank.c b/gl/unictype/ctype_blank.c
new file mode 100644
index 00000000..e14cc44e
--- /dev/null
+++ b/gl/unictype/ctype_blank.c
@@ -0,0 +1,32 @@
1/* ISO C <ctype.h> like properties of Unicode characters.
2 Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2002.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#include <config.h>
19
20/* Specification. */
21#include "unictype.h"
22
23#include "bitmap.h"
24
25/* Define u_is_blank table. */
26#include "ctype_blank.h"
27
28bool
29uc_is_blank (ucs4_t uc)
30{
31 return bitmap_lookup (&u_is_blank, uc);
32}
diff --git a/gl/unictype/ctype_blank.h b/gl/unictype/ctype_blank.h
new file mode 100644
index 00000000..d0605c69
--- /dev/null
+++ b/gl/unictype/ctype_blank.h
@@ -0,0 +1,184 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* ISO C <ctype.h> like properties of Unicode characters. */
3/* Generated automatically by gen-uni-tables.c for Unicode 17.0.0. */
4
5/* Copyright (C) 2000-2025 Free Software Foundation, Inc.
6
7 This file is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
11
12 This file is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19
20#define header_0 16
21#define header_2 9
22#define header_3 127
23#define header_4 15
24static const
25struct
26 {
27 int header[1];
28 int level1[1];
29 short level2[1 << 7];
30 unsigned int level3[4 << 4];
31 }
32u_is_blank =
33{
34 { 1 },
35 { 2 * sizeof (int) / sizeof (short) + 0 },
36 {
37 2 + 128 * sizeof (short) / sizeof (int) + 0,
38 -1,
39 -1,
40 -1,
41 -1,
42 -1,
43 -1,
44 -1,
45 -1,
46 -1,
47 -1,
48 2 + 128 * sizeof (short) / sizeof (int) + 16,
49 -1,
50 -1,
51 -1,
52 -1,
53 2 + 128 * sizeof (short) / sizeof (int) + 32,
54 -1,
55 -1,
56 -1,
57 -1,
58 -1,
59 -1,
60 -1,
61 2 + 128 * sizeof (short) / sizeof (int) + 48,
62 -1,
63 -1,
64 -1,
65 -1,
66 -1,
67 -1,
68 -1,
69 -1,
70 -1,
71 -1,
72 -1,
73 -1,
74 -1,
75 -1,
76 -1,
77 -1,
78 -1,
79 -1,
80 -1,
81 -1,
82 -1,
83 -1,
84 -1,
85 -1,
86 -1,
87 -1,
88 -1,
89 -1,
90 -1,
91 -1,
92 -1,
93 -1,
94 -1,
95 -1,
96 -1,
97 -1,
98 -1,
99 -1,
100 -1,
101 -1,
102 -1,
103 -1,
104 -1,
105 -1,
106 -1,
107 -1,
108 -1,
109 -1,
110 -1,
111 -1,
112 -1,
113 -1,
114 -1,
115 -1,
116 -1,
117 -1,
118 -1,
119 -1,
120 -1,
121 -1,
122 -1,
123 -1,
124 -1,
125 -1,
126 -1,
127 -1,
128 -1,
129 -1,
130 -1,
131 -1,
132 -1,
133 -1,
134 -1,
135 -1,
136 -1,
137 -1,
138 -1,
139 -1,
140 -1,
141 -1,
142 -1,
143 -1,
144 -1,
145 -1,
146 -1,
147 -1,
148 -1,
149 -1,
150 -1,
151 -1,
152 -1,
153 -1,
154 -1,
155 -1,
156 -1,
157 -1,
158 -1,
159 -1,
160 -1,
161 -1,
162 -1,
163 -1,
164 -1
165 },
166 {
167 0x00000200U, 0x00000001U, 0x00000000U, 0x00000000U,
168 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
169 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
170 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
171 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
172 0x00000001U, 0x00000000U, 0x00000000U, 0x00000000U,
173 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
174 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
175 0x0000077FU, 0x00000000U, 0x80000000U, 0x00000000U,
176 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
177 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
178 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
179 0x00000001U, 0x00000000U, 0x00000000U, 0x00000000U,
180 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
181 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
182 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U
183 }
184};
diff --git a/gl/unictype/ctype_cntrl.c b/gl/unictype/ctype_cntrl.c
new file mode 100644
index 00000000..1c5cefa1
--- /dev/null
+++ b/gl/unictype/ctype_cntrl.c
@@ -0,0 +1,32 @@
1/* ISO C <ctype.h> like properties of Unicode characters.
2 Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2002.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#include <config.h>
19
20/* Specification. */
21#include "unictype.h"
22
23#include "bitmap.h"
24
25/* Define u_is_cntrl table. */
26#include "ctype_cntrl.h"
27
28bool
29uc_is_cntrl (ucs4_t uc)
30{
31 return bitmap_lookup (&u_is_cntrl, uc);
32}
diff --git a/gl/unictype/ctype_cntrl.h b/gl/unictype/ctype_cntrl.h
new file mode 100644
index 00000000..ba6bf7ca
--- /dev/null
+++ b/gl/unictype/ctype_cntrl.h
@@ -0,0 +1,176 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* ISO C <ctype.h> like properties of Unicode characters. */
3/* Generated automatically by gen-uni-tables.c for Unicode 17.0.0. */
4
5/* Copyright (C) 2000-2025 Free Software Foundation, Inc.
6
7 This file is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
11
12 This file is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19
20#define header_0 16
21#define header_2 9
22#define header_3 127
23#define header_4 15
24static const
25struct
26 {
27 int header[1];
28 int level1[1];
29 short level2[1 << 7];
30 unsigned int level3[2 << 4];
31 }
32u_is_cntrl =
33{
34 { 1 },
35 { 2 * sizeof (int) / sizeof (short) + 0 },
36 {
37 2 + 128 * sizeof (short) / sizeof (int) + 0,
38 -1,
39 -1,
40 -1,
41 -1,
42 -1,
43 -1,
44 -1,
45 -1,
46 -1,
47 -1,
48 -1,
49 -1,
50 -1,
51 -1,
52 -1,
53 2 + 128 * sizeof (short) / sizeof (int) + 16,
54 -1,
55 -1,
56 -1,
57 -1,
58 -1,
59 -1,
60 -1,
61 -1,
62 -1,
63 -1,
64 -1,
65 -1,
66 -1,
67 -1,
68 -1,
69 -1,
70 -1,
71 -1,
72 -1,
73 -1,
74 -1,
75 -1,
76 -1,
77 -1,
78 -1,
79 -1,
80 -1,
81 -1,
82 -1,
83 -1,
84 -1,
85 -1,
86 -1,
87 -1,
88 -1,
89 -1,
90 -1,
91 -1,
92 -1,
93 -1,
94 -1,
95 -1,
96 -1,
97 -1,
98 -1,
99 -1,
100 -1,
101 -1,
102 -1,
103 -1,
104 -1,
105 -1,
106 -1,
107 -1,
108 -1,
109 -1,
110 -1,
111 -1,
112 -1,
113 -1,
114 -1,
115 -1,
116 -1,
117 -1,
118 -1,
119 -1,
120 -1,
121 -1,
122 -1,
123 -1,
124 -1,
125 -1,
126 -1,
127 -1,
128 -1,
129 -1,
130 -1,
131 -1,
132 -1,
133 -1,
134 -1,
135 -1,
136 -1,
137 -1,
138 -1,
139 -1,
140 -1,
141 -1,
142 -1,
143 -1,
144 -1,
145 -1,
146 -1,
147 -1,
148 -1,
149 -1,
150 -1,
151 -1,
152 -1,
153 -1,
154 -1,
155 -1,
156 -1,
157 -1,
158 -1,
159 -1,
160 -1,
161 -1,
162 -1,
163 -1,
164 -1
165 },
166 {
167 0xFFFFFFFFU, 0x00000000U, 0x00000000U, 0x80000000U,
168 0xFFFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
169 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
170 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
171 0x00000000U, 0x00000300U, 0x00000000U, 0x00000000U,
172 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
173 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
174 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U
175 }
176};
diff --git a/gl/unictype/ctype_digit.c b/gl/unictype/ctype_digit.c
new file mode 100644
index 00000000..71d68807
--- /dev/null
+++ b/gl/unictype/ctype_digit.c
@@ -0,0 +1,32 @@
1/* ISO C <ctype.h> like properties of Unicode characters.
2 Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2002.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#include <config.h>
19
20/* Specification. */
21#include "unictype.h"
22
23#include "bitmap.h"
24
25/* Define u_is_digit table. */
26#include "ctype_digit.h"
27
28bool
29uc_is_digit (ucs4_t uc)
30{
31 return bitmap_lookup (&u_is_digit, uc);
32}
diff --git a/gl/unictype/ctype_digit.h b/gl/unictype/ctype_digit.h
new file mode 100644
index 00000000..7322861f
--- /dev/null
+++ b/gl/unictype/ctype_digit.h
@@ -0,0 +1,172 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* ISO C <ctype.h> like properties of Unicode characters. */
3/* Generated automatically by gen-uni-tables.c for Unicode 17.0.0. */
4
5/* Copyright (C) 2000-2025 Free Software Foundation, Inc.
6
7 This file is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
11
12 This file is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19
20#define header_0 16
21#define header_2 9
22#define header_3 127
23#define header_4 15
24static const
25struct
26 {
27 int header[1];
28 int level1[1];
29 short level2[1 << 7];
30 unsigned int level3[1 << 4];
31 }
32u_is_digit =
33{
34 { 1 },
35 { 2 * sizeof (int) / sizeof (short) + 0 },
36 {
37 2 + 128 * sizeof (short) / sizeof (int) + 0,
38 -1,
39 -1,
40 -1,
41 -1,
42 -1,
43 -1,
44 -1,
45 -1,
46 -1,
47 -1,
48 -1,
49 -1,
50 -1,
51 -1,
52 -1,
53 -1,
54 -1,
55 -1,
56 -1,
57 -1,
58 -1,
59 -1,
60 -1,
61 -1,
62 -1,
63 -1,
64 -1,
65 -1,
66 -1,
67 -1,
68 -1,
69 -1,
70 -1,
71 -1,
72 -1,
73 -1,
74 -1,
75 -1,
76 -1,
77 -1,
78 -1,
79 -1,
80 -1,
81 -1,
82 -1,
83 -1,
84 -1,
85 -1,
86 -1,
87 -1,
88 -1,
89 -1,
90 -1,
91 -1,
92 -1,
93 -1,
94 -1,
95 -1,
96 -1,
97 -1,
98 -1,
99 -1,
100 -1,
101 -1,
102 -1,
103 -1,
104 -1,
105 -1,
106 -1,
107 -1,
108 -1,
109 -1,
110 -1,
111 -1,
112 -1,
113 -1,
114 -1,
115 -1,
116 -1,
117 -1,
118 -1,
119 -1,
120 -1,
121 -1,
122 -1,
123 -1,
124 -1,
125 -1,
126 -1,
127 -1,
128 -1,
129 -1,
130 -1,
131 -1,
132 -1,
133 -1,
134 -1,
135 -1,
136 -1,
137 -1,
138 -1,
139 -1,
140 -1,
141 -1,
142 -1,
143 -1,
144 -1,
145 -1,
146 -1,
147 -1,
148 -1,
149 -1,
150 -1,
151 -1,
152 -1,
153 -1,
154 -1,
155 -1,
156 -1,
157 -1,
158 -1,
159 -1,
160 -1,
161 -1,
162 -1,
163 -1,
164 -1
165 },
166 {
167 0x00000000U, 0x03FF0000U, 0x00000000U, 0x00000000U,
168 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
169 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
170 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U
171 }
172};
diff --git a/gl/unictype/ctype_graph.c b/gl/unictype/ctype_graph.c
new file mode 100644
index 00000000..92701700
--- /dev/null
+++ b/gl/unictype/ctype_graph.c
@@ -0,0 +1,32 @@
1/* ISO C <ctype.h> like properties of Unicode characters.
2 Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2002.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#include <config.h>
19
20/* Specification. */
21#include "unictype.h"
22
23#include "bitmap.h"
24
25/* Define u_is_graph table. */
26#include "ctype_graph.h"
27
28bool
29uc_is_graph (ucs4_t uc)
30{
31 return bitmap_lookup (&u_is_graph, uc);
32}
diff --git a/gl/unictype/ctype_graph.h b/gl/unictype/ctype_graph.h
new file mode 100644
index 00000000..948d21d2
--- /dev/null
+++ b/gl/unictype/ctype_graph.h
@@ -0,0 +1,1194 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* ISO C <ctype.h> like properties of Unicode characters. */
3/* Generated automatically by gen-uni-tables.c for Unicode 17.0.0. */
4
5/* Copyright (C) 2000-2025 Free Software Foundation, Inc.
6
7 This file is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
11
12 This file is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19
20#define header_0 16
21#define header_2 9
22#define header_3 127
23#define header_4 15
24static const
25struct
26 {
27 int header[1];
28 int level1[17];
29 short level2[6 << 7];
30 unsigned int level3[92 << 4];
31 }
32u_is_graph =
33{
34 { 17 },
35 {
36 18 * sizeof (int) / sizeof (short) + 0,
37 18 * sizeof (int) / sizeof (short) + 128,
38 18 * sizeof (int) / sizeof (short) + 256,
39 18 * sizeof (int) / sizeof (short) + 384,
40 -1,
41 -1,
42 -1,
43 -1,
44 -1,
45 -1,
46 -1,
47 -1,
48 -1,
49 -1,
50 18 * sizeof (int) / sizeof (short) + 512,
51 18 * sizeof (int) / sizeof (short) + 640,
52 18 * sizeof (int) / sizeof (short) + 640
53 },
54 {
55 18 + 768 * sizeof (short) / sizeof (int) + 0,
56 18 + 768 * sizeof (short) / sizeof (int) + 16,
57 18 + 768 * sizeof (short) / sizeof (int) + 32,
58 18 + 768 * sizeof (short) / sizeof (int) + 48,
59 18 + 768 * sizeof (short) / sizeof (int) + 64,
60 18 + 768 * sizeof (short) / sizeof (int) + 80,
61 18 + 768 * sizeof (short) / sizeof (int) + 96,
62 18 + 768 * sizeof (short) / sizeof (int) + 112,
63 18 + 768 * sizeof (short) / sizeof (int) + 128,
64 18 + 768 * sizeof (short) / sizeof (int) + 144,
65 18 + 768 * sizeof (short) / sizeof (int) + 160,
66 18 + 768 * sizeof (short) / sizeof (int) + 176,
67 18 + 768 * sizeof (short) / sizeof (int) + 192,
68 18 + 768 * sizeof (short) / sizeof (int) + 208,
69 18 + 768 * sizeof (short) / sizeof (int) + 224,
70 18 + 768 * sizeof (short) / sizeof (int) + 240,
71 18 + 768 * sizeof (short) / sizeof (int) + 256,
72 18 + 768 * sizeof (short) / sizeof (int) + 160,
73 18 + 768 * sizeof (short) / sizeof (int) + 272,
74 18 + 768 * sizeof (short) / sizeof (int) + 160,
75 18 + 768 * sizeof (short) / sizeof (int) + 160,
76 18 + 768 * sizeof (short) / sizeof (int) + 288,
77 18 + 768 * sizeof (short) / sizeof (int) + 304,
78 18 + 768 * sizeof (short) / sizeof (int) + 320,
79 18 + 768 * sizeof (short) / sizeof (int) + 336,
80 18 + 768 * sizeof (short) / sizeof (int) + 352,
81 18 + 768 * sizeof (short) / sizeof (int) + 160,
82 18 + 768 * sizeof (short) / sizeof (int) + 160,
83 18 + 768 * sizeof (short) / sizeof (int) + 160,
84 18 + 768 * sizeof (short) / sizeof (int) + 160,
85 18 + 768 * sizeof (short) / sizeof (int) + 160,
86 18 + 768 * sizeof (short) / sizeof (int) + 160,
87 18 + 768 * sizeof (short) / sizeof (int) + 160,
88 18 + 768 * sizeof (short) / sizeof (int) + 160,
89 18 + 768 * sizeof (short) / sizeof (int) + 160,
90 18 + 768 * sizeof (short) / sizeof (int) + 160,
91 18 + 768 * sizeof (short) / sizeof (int) + 160,
92 18 + 768 * sizeof (short) / sizeof (int) + 160,
93 18 + 768 * sizeof (short) / sizeof (int) + 160,
94 18 + 768 * sizeof (short) / sizeof (int) + 160,
95 18 + 768 * sizeof (short) / sizeof (int) + 160,
96 18 + 768 * sizeof (short) / sizeof (int) + 160,
97 18 + 768 * sizeof (short) / sizeof (int) + 160,
98 18 + 768 * sizeof (short) / sizeof (int) + 160,
99 18 + 768 * sizeof (short) / sizeof (int) + 160,
100 18 + 768 * sizeof (short) / sizeof (int) + 160,
101 18 + 768 * sizeof (short) / sizeof (int) + 160,
102 18 + 768 * sizeof (short) / sizeof (int) + 160,
103 18 + 768 * sizeof (short) / sizeof (int) + 160,
104 18 + 768 * sizeof (short) / sizeof (int) + 160,
105 18 + 768 * sizeof (short) / sizeof (int) + 160,
106 18 + 768 * sizeof (short) / sizeof (int) + 160,
107 18 + 768 * sizeof (short) / sizeof (int) + 160,
108 18 + 768 * sizeof (short) / sizeof (int) + 160,
109 18 + 768 * sizeof (short) / sizeof (int) + 160,
110 18 + 768 * sizeof (short) / sizeof (int) + 160,
111 18 + 768 * sizeof (short) / sizeof (int) + 160,
112 18 + 768 * sizeof (short) / sizeof (int) + 160,
113 18 + 768 * sizeof (short) / sizeof (int) + 160,
114 18 + 768 * sizeof (short) / sizeof (int) + 160,
115 18 + 768 * sizeof (short) / sizeof (int) + 160,
116 18 + 768 * sizeof (short) / sizeof (int) + 160,
117 18 + 768 * sizeof (short) / sizeof (int) + 160,
118 18 + 768 * sizeof (short) / sizeof (int) + 160,
119 18 + 768 * sizeof (short) / sizeof (int) + 160,
120 18 + 768 * sizeof (short) / sizeof (int) + 160,
121 18 + 768 * sizeof (short) / sizeof (int) + 160,
122 18 + 768 * sizeof (short) / sizeof (int) + 160,
123 18 + 768 * sizeof (short) / sizeof (int) + 160,
124 18 + 768 * sizeof (short) / sizeof (int) + 160,
125 18 + 768 * sizeof (short) / sizeof (int) + 160,
126 18 + 768 * sizeof (short) / sizeof (int) + 160,
127 18 + 768 * sizeof (short) / sizeof (int) + 160,
128 18 + 768 * sizeof (short) / sizeof (int) + 160,
129 18 + 768 * sizeof (short) / sizeof (int) + 160,
130 18 + 768 * sizeof (short) / sizeof (int) + 160,
131 18 + 768 * sizeof (short) / sizeof (int) + 160,
132 18 + 768 * sizeof (short) / sizeof (int) + 160,
133 18 + 768 * sizeof (short) / sizeof (int) + 160,
134 18 + 768 * sizeof (short) / sizeof (int) + 160,
135 18 + 768 * sizeof (short) / sizeof (int) + 160,
136 18 + 768 * sizeof (short) / sizeof (int) + 160,
137 18 + 768 * sizeof (short) / sizeof (int) + 368,
138 18 + 768 * sizeof (short) / sizeof (int) + 384,
139 18 + 768 * sizeof (short) / sizeof (int) + 400,
140 18 + 768 * sizeof (short) / sizeof (int) + 416,
141 18 + 768 * sizeof (short) / sizeof (int) + 160,
142 18 + 768 * sizeof (short) / sizeof (int) + 160,
143 18 + 768 * sizeof (short) / sizeof (int) + 160,
144 18 + 768 * sizeof (short) / sizeof (int) + 160,
145 18 + 768 * sizeof (short) / sizeof (int) + 160,
146 18 + 768 * sizeof (short) / sizeof (int) + 160,
147 18 + 768 * sizeof (short) / sizeof (int) + 160,
148 18 + 768 * sizeof (short) / sizeof (int) + 160,
149 18 + 768 * sizeof (short) / sizeof (int) + 160,
150 18 + 768 * sizeof (short) / sizeof (int) + 160,
151 18 + 768 * sizeof (short) / sizeof (int) + 160,
152 18 + 768 * sizeof (short) / sizeof (int) + 160,
153 18 + 768 * sizeof (short) / sizeof (int) + 160,
154 18 + 768 * sizeof (short) / sizeof (int) + 160,
155 18 + 768 * sizeof (short) / sizeof (int) + 160,
156 18 + 768 * sizeof (short) / sizeof (int) + 160,
157 18 + 768 * sizeof (short) / sizeof (int) + 160,
158 18 + 768 * sizeof (short) / sizeof (int) + 160,
159 18 + 768 * sizeof (short) / sizeof (int) + 160,
160 18 + 768 * sizeof (short) / sizeof (int) + 160,
161 18 + 768 * sizeof (short) / sizeof (int) + 160,
162 18 + 768 * sizeof (short) / sizeof (int) + 432,
163 -1,
164 -1,
165 -1,
166 -1,
167 18 + 768 * sizeof (short) / sizeof (int) + 160,
168 18 + 768 * sizeof (short) / sizeof (int) + 160,
169 18 + 768 * sizeof (short) / sizeof (int) + 160,
170 18 + 768 * sizeof (short) / sizeof (int) + 160,
171 18 + 768 * sizeof (short) / sizeof (int) + 160,
172 18 + 768 * sizeof (short) / sizeof (int) + 160,
173 18 + 768 * sizeof (short) / sizeof (int) + 160,
174 18 + 768 * sizeof (short) / sizeof (int) + 160,
175 18 + 768 * sizeof (short) / sizeof (int) + 160,
176 18 + 768 * sizeof (short) / sizeof (int) + 160,
177 18 + 768 * sizeof (short) / sizeof (int) + 160,
178 18 + 768 * sizeof (short) / sizeof (int) + 160,
179 18 + 768 * sizeof (short) / sizeof (int) + 160,
180 18 + 768 * sizeof (short) / sizeof (int) + 448,
181 18 + 768 * sizeof (short) / sizeof (int) + 464,
182 18 + 768 * sizeof (short) / sizeof (int) + 480,
183 18 + 768 * sizeof (short) / sizeof (int) + 496,
184 18 + 768 * sizeof (short) / sizeof (int) + 512,
185 18 + 768 * sizeof (short) / sizeof (int) + 528,
186 18 + 768 * sizeof (short) / sizeof (int) + 544,
187 18 + 768 * sizeof (short) / sizeof (int) + 560,
188 18 + 768 * sizeof (short) / sizeof (int) + 576,
189 18 + 768 * sizeof (short) / sizeof (int) + 592,
190 18 + 768 * sizeof (short) / sizeof (int) + 608,
191 18 + 768 * sizeof (short) / sizeof (int) + 624,
192 18 + 768 * sizeof (short) / sizeof (int) + 640,
193 18 + 768 * sizeof (short) / sizeof (int) + 656,
194 18 + 768 * sizeof (short) / sizeof (int) + 672,
195 18 + 768 * sizeof (short) / sizeof (int) + 688,
196 18 + 768 * sizeof (short) / sizeof (int) + 704,
197 18 + 768 * sizeof (short) / sizeof (int) + 720,
198 18 + 768 * sizeof (short) / sizeof (int) + 736,
199 18 + 768 * sizeof (short) / sizeof (int) + 160,
200 18 + 768 * sizeof (short) / sizeof (int) + 752,
201 18 + 768 * sizeof (short) / sizeof (int) + 768,
202 -1,
203 -1,
204 -1,
205 -1,
206 18 + 768 * sizeof (short) / sizeof (int) + 784,
207 18 + 768 * sizeof (short) / sizeof (int) + 160,
208 18 + 768 * sizeof (short) / sizeof (int) + 160,
209 18 + 768 * sizeof (short) / sizeof (int) + 800,
210 18 + 768 * sizeof (short) / sizeof (int) + 160,
211 18 + 768 * sizeof (short) / sizeof (int) + 160,
212 18 + 768 * sizeof (short) / sizeof (int) + 160,
213 18 + 768 * sizeof (short) / sizeof (int) + 160,
214 18 + 768 * sizeof (short) / sizeof (int) + 160,
215 18 + 768 * sizeof (short) / sizeof (int) + 160,
216 18 + 768 * sizeof (short) / sizeof (int) + 816,
217 18 + 768 * sizeof (short) / sizeof (int) + 160,
218 18 + 768 * sizeof (short) / sizeof (int) + 832,
219 -1,
220 -1,
221 -1,
222 -1,
223 -1,
224 -1,
225 -1,
226 -1,
227 -1,
228 -1,
229 -1,
230 -1,
231 18 + 768 * sizeof (short) / sizeof (int) + 848,
232 -1,
233 -1,
234 -1,
235 18 + 768 * sizeof (short) / sizeof (int) + 160,
236 18 + 768 * sizeof (short) / sizeof (int) + 864,
237 18 + 768 * sizeof (short) / sizeof (int) + 880,
238 18 + 768 * sizeof (short) / sizeof (int) + 896,
239 18 + 768 * sizeof (short) / sizeof (int) + 160,
240 18 + 768 * sizeof (short) / sizeof (int) + 160,
241 18 + 768 * sizeof (short) / sizeof (int) + 160,
242 18 + 768 * sizeof (short) / sizeof (int) + 160,
243 18 + 768 * sizeof (short) / sizeof (int) + 160,
244 18 + 768 * sizeof (short) / sizeof (int) + 160,
245 18 + 768 * sizeof (short) / sizeof (int) + 160,
246 18 + 768 * sizeof (short) / sizeof (int) + 160,
247 18 + 768 * sizeof (short) / sizeof (int) + 160,
248 18 + 768 * sizeof (short) / sizeof (int) + 160,
249 18 + 768 * sizeof (short) / sizeof (int) + 160,
250 18 + 768 * sizeof (short) / sizeof (int) + 160,
251 18 + 768 * sizeof (short) / sizeof (int) + 160,
252 18 + 768 * sizeof (short) / sizeof (int) + 160,
253 18 + 768 * sizeof (short) / sizeof (int) + 912,
254 -1,
255 -1,
256 -1,
257 -1,
258 -1,
259 -1,
260 -1,
261 -1,
262 -1,
263 -1,
264 -1,
265 -1,
266 -1,
267 -1,
268 -1,
269 -1,
270 18 + 768 * sizeof (short) / sizeof (int) + 928,
271 18 + 768 * sizeof (short) / sizeof (int) + 944,
272 18 + 768 * sizeof (short) / sizeof (int) + 960,
273 -1,
274 -1,
275 -1,
276 -1,
277 18 + 768 * sizeof (short) / sizeof (int) + 976,
278 -1,
279 -1,
280 -1,
281 -1,
282 -1,
283 -1,
284 -1,
285 18 + 768 * sizeof (short) / sizeof (int) + 992,
286 18 + 768 * sizeof (short) / sizeof (int) + 1008,
287 18 + 768 * sizeof (short) / sizeof (int) + 1024,
288 18 + 768 * sizeof (short) / sizeof (int) + 1040,
289 18 + 768 * sizeof (short) / sizeof (int) + 1056,
290 18 + 768 * sizeof (short) / sizeof (int) + 1072,
291 18 + 768 * sizeof (short) / sizeof (int) + 160,
292 18 + 768 * sizeof (short) / sizeof (int) + 1088,
293 -1,
294 18 + 768 * sizeof (short) / sizeof (int) + 1104,
295 18 + 768 * sizeof (short) / sizeof (int) + 1120,
296 18 + 768 * sizeof (short) / sizeof (int) + 1136,
297 18 + 768 * sizeof (short) / sizeof (int) + 1152,
298 18 + 768 * sizeof (short) / sizeof (int) + 1168,
299 18 + 768 * sizeof (short) / sizeof (int) + 1184,
300 -1,
301 18 + 768 * sizeof (short) / sizeof (int) + 1200,
302 18 + 768 * sizeof (short) / sizeof (int) + 1216,
303 18 + 768 * sizeof (short) / sizeof (int) + 1232,
304 18 + 768 * sizeof (short) / sizeof (int) + 1248,
305 18 + 768 * sizeof (short) / sizeof (int) + 160,
306 18 + 768 * sizeof (short) / sizeof (int) + 1264,
307 18 + 768 * sizeof (short) / sizeof (int) + 1280,
308 18 + 768 * sizeof (short) / sizeof (int) + 1296,
309 -1,
310 -1,
311 18 + 768 * sizeof (short) / sizeof (int) + 160,
312 18 + 768 * sizeof (short) / sizeof (int) + 160,
313 18 + 768 * sizeof (short) / sizeof (int) + 160,
314 18 + 768 * sizeof (short) / sizeof (int) + 160,
315 18 + 768 * sizeof (short) / sizeof (int) + 160,
316 18 + 768 * sizeof (short) / sizeof (int) + 160,
317 18 + 768 * sizeof (short) / sizeof (int) + 160,
318 18 + 768 * sizeof (short) / sizeof (int) + 160,
319 18 + 768 * sizeof (short) / sizeof (int) + 160,
320 18 + 768 * sizeof (short) / sizeof (int) + 160,
321 18 + 768 * sizeof (short) / sizeof (int) + 160,
322 18 + 768 * sizeof (short) / sizeof (int) + 160,
323 18 + 768 * sizeof (short) / sizeof (int) + 160,
324 18 + 768 * sizeof (short) / sizeof (int) + 160,
325 18 + 768 * sizeof (short) / sizeof (int) + 160,
326 18 + 768 * sizeof (short) / sizeof (int) + 160,
327 18 + 768 * sizeof (short) / sizeof (int) + 160,
328 18 + 768 * sizeof (short) / sizeof (int) + 160,
329 18 + 768 * sizeof (short) / sizeof (int) + 160,
330 18 + 768 * sizeof (short) / sizeof (int) + 160,
331 18 + 768 * sizeof (short) / sizeof (int) + 160,
332 18 + 768 * sizeof (short) / sizeof (int) + 160,
333 18 + 768 * sizeof (short) / sizeof (int) + 160,
334 18 + 768 * sizeof (short) / sizeof (int) + 160,
335 18 + 768 * sizeof (short) / sizeof (int) + 160,
336 18 + 768 * sizeof (short) / sizeof (int) + 160,
337 18 + 768 * sizeof (short) / sizeof (int) + 160,
338 18 + 768 * sizeof (short) / sizeof (int) + 160,
339 18 + 768 * sizeof (short) / sizeof (int) + 160,
340 18 + 768 * sizeof (short) / sizeof (int) + 160,
341 18 + 768 * sizeof (short) / sizeof (int) + 160,
342 18 + 768 * sizeof (short) / sizeof (int) + 160,
343 18 + 768 * sizeof (short) / sizeof (int) + 160,
344 18 + 768 * sizeof (short) / sizeof (int) + 160,
345 18 + 768 * sizeof (short) / sizeof (int) + 160,
346 18 + 768 * sizeof (short) / sizeof (int) + 160,
347 18 + 768 * sizeof (short) / sizeof (int) + 160,
348 18 + 768 * sizeof (short) / sizeof (int) + 160,
349 18 + 768 * sizeof (short) / sizeof (int) + 160,
350 18 + 768 * sizeof (short) / sizeof (int) + 160,
351 18 + 768 * sizeof (short) / sizeof (int) + 160,
352 18 + 768 * sizeof (short) / sizeof (int) + 160,
353 18 + 768 * sizeof (short) / sizeof (int) + 160,
354 18 + 768 * sizeof (short) / sizeof (int) + 160,
355 18 + 768 * sizeof (short) / sizeof (int) + 160,
356 18 + 768 * sizeof (short) / sizeof (int) + 160,
357 18 + 768 * sizeof (short) / sizeof (int) + 160,
358 18 + 768 * sizeof (short) / sizeof (int) + 160,
359 18 + 768 * sizeof (short) / sizeof (int) + 160,
360 18 + 768 * sizeof (short) / sizeof (int) + 160,
361 18 + 768 * sizeof (short) / sizeof (int) + 160,
362 18 + 768 * sizeof (short) / sizeof (int) + 160,
363 18 + 768 * sizeof (short) / sizeof (int) + 160,
364 18 + 768 * sizeof (short) / sizeof (int) + 160,
365 18 + 768 * sizeof (short) / sizeof (int) + 160,
366 18 + 768 * sizeof (short) / sizeof (int) + 160,
367 18 + 768 * sizeof (short) / sizeof (int) + 160,
368 18 + 768 * sizeof (short) / sizeof (int) + 160,
369 18 + 768 * sizeof (short) / sizeof (int) + 160,
370 18 + 768 * sizeof (short) / sizeof (int) + 160,
371 18 + 768 * sizeof (short) / sizeof (int) + 160,
372 18 + 768 * sizeof (short) / sizeof (int) + 160,
373 18 + 768 * sizeof (short) / sizeof (int) + 160,
374 18 + 768 * sizeof (short) / sizeof (int) + 160,
375 18 + 768 * sizeof (short) / sizeof (int) + 160,
376 18 + 768 * sizeof (short) / sizeof (int) + 160,
377 18 + 768 * sizeof (short) / sizeof (int) + 160,
378 18 + 768 * sizeof (short) / sizeof (int) + 160,
379 18 + 768 * sizeof (short) / sizeof (int) + 160,
380 18 + 768 * sizeof (short) / sizeof (int) + 160,
381 18 + 768 * sizeof (short) / sizeof (int) + 160,
382 18 + 768 * sizeof (short) / sizeof (int) + 160,
383 18 + 768 * sizeof (short) / sizeof (int) + 160,
384 18 + 768 * sizeof (short) / sizeof (int) + 160,
385 18 + 768 * sizeof (short) / sizeof (int) + 160,
386 18 + 768 * sizeof (short) / sizeof (int) + 160,
387 18 + 768 * sizeof (short) / sizeof (int) + 160,
388 18 + 768 * sizeof (short) / sizeof (int) + 160,
389 18 + 768 * sizeof (short) / sizeof (int) + 160,
390 18 + 768 * sizeof (short) / sizeof (int) + 160,
391 18 + 768 * sizeof (short) / sizeof (int) + 160,
392 18 + 768 * sizeof (short) / sizeof (int) + 160,
393 18 + 768 * sizeof (short) / sizeof (int) + 160,
394 18 + 768 * sizeof (short) / sizeof (int) + 1312,
395 18 + 768 * sizeof (short) / sizeof (int) + 160,
396 18 + 768 * sizeof (short) / sizeof (int) + 160,
397 18 + 768 * sizeof (short) / sizeof (int) + 160,
398 18 + 768 * sizeof (short) / sizeof (int) + 160,
399 18 + 768 * sizeof (short) / sizeof (int) + 160,
400 18 + 768 * sizeof (short) / sizeof (int) + 160,
401 18 + 768 * sizeof (short) / sizeof (int) + 160,
402 18 + 768 * sizeof (short) / sizeof (int) + 160,
403 18 + 768 * sizeof (short) / sizeof (int) + 1328,
404 18 + 768 * sizeof (short) / sizeof (int) + 160,
405 18 + 768 * sizeof (short) / sizeof (int) + 160,
406 18 + 768 * sizeof (short) / sizeof (int) + 160,
407 18 + 768 * sizeof (short) / sizeof (int) + 160,
408 18 + 768 * sizeof (short) / sizeof (int) + 160,
409 18 + 768 * sizeof (short) / sizeof (int) + 160,
410 18 + 768 * sizeof (short) / sizeof (int) + 160,
411 18 + 768 * sizeof (short) / sizeof (int) + 160,
412 18 + 768 * sizeof (short) / sizeof (int) + 160,
413 18 + 768 * sizeof (short) / sizeof (int) + 160,
414 18 + 768 * sizeof (short) / sizeof (int) + 1344,
415 18 + 768 * sizeof (short) / sizeof (int) + 160,
416 18 + 768 * sizeof (short) / sizeof (int) + 160,
417 18 + 768 * sizeof (short) / sizeof (int) + 160,
418 18 + 768 * sizeof (short) / sizeof (int) + 160,
419 18 + 768 * sizeof (short) / sizeof (int) + 160,
420 18 + 768 * sizeof (short) / sizeof (int) + 160,
421 18 + 768 * sizeof (short) / sizeof (int) + 160,
422 18 + 768 * sizeof (short) / sizeof (int) + 160,
423 18 + 768 * sizeof (short) / sizeof (int) + 160,
424 18 + 768 * sizeof (short) / sizeof (int) + 160,
425 18 + 768 * sizeof (short) / sizeof (int) + 160,
426 18 + 768 * sizeof (short) / sizeof (int) + 160,
427 18 + 768 * sizeof (short) / sizeof (int) + 160,
428 18 + 768 * sizeof (short) / sizeof (int) + 1360,
429 18 + 768 * sizeof (short) / sizeof (int) + 160,
430 18 + 768 * sizeof (short) / sizeof (int) + 1376,
431 -1,
432 -1,
433 -1,
434 -1,
435 18 + 768 * sizeof (short) / sizeof (int) + 160,
436 18 + 768 * sizeof (short) / sizeof (int) + 1392,
437 -1,
438 -1,
439 18 + 768 * sizeof (short) / sizeof (int) + 160,
440 18 + 768 * sizeof (short) / sizeof (int) + 160,
441 18 + 768 * sizeof (short) / sizeof (int) + 160,
442 18 + 768 * sizeof (short) / sizeof (int) + 160,
443 18 + 768 * sizeof (short) / sizeof (int) + 160,
444 18 + 768 * sizeof (short) / sizeof (int) + 160,
445 18 + 768 * sizeof (short) / sizeof (int) + 160,
446 18 + 768 * sizeof (short) / sizeof (int) + 160,
447 18 + 768 * sizeof (short) / sizeof (int) + 160,
448 18 + 768 * sizeof (short) / sizeof (int) + 1408,
449 18 + 768 * sizeof (short) / sizeof (int) + 160,
450 18 + 768 * sizeof (short) / sizeof (int) + 160,
451 18 + 768 * sizeof (short) / sizeof (int) + 160,
452 18 + 768 * sizeof (short) / sizeof (int) + 160,
453 18 + 768 * sizeof (short) / sizeof (int) + 160,
454 18 + 768 * sizeof (short) / sizeof (int) + 160,
455 18 + 768 * sizeof (short) / sizeof (int) + 160,
456 18 + 768 * sizeof (short) / sizeof (int) + 160,
457 18 + 768 * sizeof (short) / sizeof (int) + 160,
458 18 + 768 * sizeof (short) / sizeof (int) + 160,
459 18 + 768 * sizeof (short) / sizeof (int) + 160,
460 18 + 768 * sizeof (short) / sizeof (int) + 160,
461 18 + 768 * sizeof (short) / sizeof (int) + 160,
462 18 + 768 * sizeof (short) / sizeof (int) + 160,
463 18 + 768 * sizeof (short) / sizeof (int) + 160,
464 18 + 768 * sizeof (short) / sizeof (int) + 160,
465 18 + 768 * sizeof (short) / sizeof (int) + 1424,
466 -1,
467 -1,
468 -1,
469 -1,
470 -1,
471 -1,
472 -1,
473 -1,
474 -1,
475 -1,
476 -1,
477 -1,
478 -1,
479 -1,
480 -1,
481 -1,
482 -1,
483 -1,
484 -1,
485 -1,
486 -1,
487 -1,
488 -1,
489 -1,
490 -1,
491 -1,
492 -1,
493 -1,
494 -1,
495 -1,
496 -1,
497 -1,
498 -1,
499 -1,
500 -1,
501 -1,
502 -1,
503 -1,
504 -1,
505 -1,
506 -1,
507 -1,
508 -1,
509 -1,
510 -1,
511 -1,
512 -1,
513 -1,
514 -1,
515 -1,
516 -1,
517 -1,
518 -1,
519 -1,
520 -1,
521 -1,
522 -1,
523 -1,
524 -1,
525 -1,
526 -1,
527 -1,
528 -1,
529 -1,
530 -1,
531 -1,
532 -1,
533 -1,
534 -1,
535 -1,
536 -1,
537 -1,
538 -1,
539 -1,
540 -1,
541 -1,
542 -1,
543 -1,
544 -1,
545 -1,
546 -1,
547 -1,
548 -1,
549 -1,
550 -1,
551 -1,
552 -1,
553 -1,
554 -1,
555 -1,
556 -1,
557 -1,
558 -1,
559 -1,
560 -1,
561 -1,
562 -1,
563 -1,
564 -1,
565 -1,
566 -1,
567 18 + 768 * sizeof (short) / sizeof (int) + 1440,
568 -1,
569 -1,
570 -1,
571 -1,
572 -1,
573 -1,
574 -1,
575 -1,
576 -1,
577 -1,
578 -1,
579 -1,
580 -1,
581 -1,
582 -1,
583 -1,
584 -1,
585 -1,
586 -1,
587 -1,
588 -1,
589 -1,
590 -1,
591 -1,
592 -1,
593 -1,
594 -1,
595 -1,
596 -1,
597 -1,
598 -1,
599 -1,
600 -1,
601 -1,
602 -1,
603 -1,
604 -1,
605 -1,
606 -1,
607 -1,
608 -1,
609 -1,
610 -1,
611 -1,
612 -1,
613 -1,
614 -1,
615 -1,
616 -1,
617 -1,
618 -1,
619 -1,
620 -1,
621 -1,
622 -1,
623 -1,
624 -1,
625 -1,
626 -1,
627 -1,
628 -1,
629 -1,
630 -1,
631 -1,
632 -1,
633 -1,
634 -1,
635 -1,
636 -1,
637 -1,
638 -1,
639 -1,
640 -1,
641 -1,
642 -1,
643 -1,
644 -1,
645 -1,
646 -1,
647 -1,
648 -1,
649 -1,
650 -1,
651 -1,
652 -1,
653 -1,
654 -1,
655 -1,
656 -1,
657 -1,
658 -1,
659 -1,
660 -1,
661 -1,
662 -1,
663 -1,
664 -1,
665 -1,
666 -1,
667 -1,
668 -1,
669 -1,
670 -1,
671 -1,
672 -1,
673 -1,
674 -1,
675 -1,
676 -1,
677 -1,
678 -1,
679 -1,
680 -1,
681 -1,
682 -1,
683 -1,
684 -1,
685 -1,
686 -1,
687 -1,
688 -1,
689 -1,
690 -1,
691 -1,
692 -1,
693 -1,
694 -1,
695 18 + 768 * sizeof (short) / sizeof (int) + 160,
696 18 + 768 * sizeof (short) / sizeof (int) + 160,
697 18 + 768 * sizeof (short) / sizeof (int) + 160,
698 18 + 768 * sizeof (short) / sizeof (int) + 160,
699 18 + 768 * sizeof (short) / sizeof (int) + 160,
700 18 + 768 * sizeof (short) / sizeof (int) + 160,
701 18 + 768 * sizeof (short) / sizeof (int) + 160,
702 18 + 768 * sizeof (short) / sizeof (int) + 160,
703 18 + 768 * sizeof (short) / sizeof (int) + 160,
704 18 + 768 * sizeof (short) / sizeof (int) + 160,
705 18 + 768 * sizeof (short) / sizeof (int) + 160,
706 18 + 768 * sizeof (short) / sizeof (int) + 160,
707 18 + 768 * sizeof (short) / sizeof (int) + 160,
708 18 + 768 * sizeof (short) / sizeof (int) + 160,
709 18 + 768 * sizeof (short) / sizeof (int) + 160,
710 18 + 768 * sizeof (short) / sizeof (int) + 160,
711 18 + 768 * sizeof (short) / sizeof (int) + 160,
712 18 + 768 * sizeof (short) / sizeof (int) + 160,
713 18 + 768 * sizeof (short) / sizeof (int) + 160,
714 18 + 768 * sizeof (short) / sizeof (int) + 160,
715 18 + 768 * sizeof (short) / sizeof (int) + 160,
716 18 + 768 * sizeof (short) / sizeof (int) + 160,
717 18 + 768 * sizeof (short) / sizeof (int) + 160,
718 18 + 768 * sizeof (short) / sizeof (int) + 160,
719 18 + 768 * sizeof (short) / sizeof (int) + 160,
720 18 + 768 * sizeof (short) / sizeof (int) + 160,
721 18 + 768 * sizeof (short) / sizeof (int) + 160,
722 18 + 768 * sizeof (short) / sizeof (int) + 160,
723 18 + 768 * sizeof (short) / sizeof (int) + 160,
724 18 + 768 * sizeof (short) / sizeof (int) + 160,
725 18 + 768 * sizeof (short) / sizeof (int) + 160,
726 18 + 768 * sizeof (short) / sizeof (int) + 160,
727 18 + 768 * sizeof (short) / sizeof (int) + 160,
728 18 + 768 * sizeof (short) / sizeof (int) + 160,
729 18 + 768 * sizeof (short) / sizeof (int) + 160,
730 18 + 768 * sizeof (short) / sizeof (int) + 160,
731 18 + 768 * sizeof (short) / sizeof (int) + 160,
732 18 + 768 * sizeof (short) / sizeof (int) + 160,
733 18 + 768 * sizeof (short) / sizeof (int) + 160,
734 18 + 768 * sizeof (short) / sizeof (int) + 160,
735 18 + 768 * sizeof (short) / sizeof (int) + 160,
736 18 + 768 * sizeof (short) / sizeof (int) + 160,
737 18 + 768 * sizeof (short) / sizeof (int) + 160,
738 18 + 768 * sizeof (short) / sizeof (int) + 160,
739 18 + 768 * sizeof (short) / sizeof (int) + 160,
740 18 + 768 * sizeof (short) / sizeof (int) + 160,
741 18 + 768 * sizeof (short) / sizeof (int) + 160,
742 18 + 768 * sizeof (short) / sizeof (int) + 160,
743 18 + 768 * sizeof (short) / sizeof (int) + 160,
744 18 + 768 * sizeof (short) / sizeof (int) + 160,
745 18 + 768 * sizeof (short) / sizeof (int) + 160,
746 18 + 768 * sizeof (short) / sizeof (int) + 160,
747 18 + 768 * sizeof (short) / sizeof (int) + 160,
748 18 + 768 * sizeof (short) / sizeof (int) + 160,
749 18 + 768 * sizeof (short) / sizeof (int) + 160,
750 18 + 768 * sizeof (short) / sizeof (int) + 160,
751 18 + 768 * sizeof (short) / sizeof (int) + 160,
752 18 + 768 * sizeof (short) / sizeof (int) + 160,
753 18 + 768 * sizeof (short) / sizeof (int) + 160,
754 18 + 768 * sizeof (short) / sizeof (int) + 160,
755 18 + 768 * sizeof (short) / sizeof (int) + 160,
756 18 + 768 * sizeof (short) / sizeof (int) + 160,
757 18 + 768 * sizeof (short) / sizeof (int) + 160,
758 18 + 768 * sizeof (short) / sizeof (int) + 160,
759 18 + 768 * sizeof (short) / sizeof (int) + 160,
760 18 + 768 * sizeof (short) / sizeof (int) + 160,
761 18 + 768 * sizeof (short) / sizeof (int) + 160,
762 18 + 768 * sizeof (short) / sizeof (int) + 160,
763 18 + 768 * sizeof (short) / sizeof (int) + 160,
764 18 + 768 * sizeof (short) / sizeof (int) + 160,
765 18 + 768 * sizeof (short) / sizeof (int) + 160,
766 18 + 768 * sizeof (short) / sizeof (int) + 160,
767 18 + 768 * sizeof (short) / sizeof (int) + 160,
768 18 + 768 * sizeof (short) / sizeof (int) + 160,
769 18 + 768 * sizeof (short) / sizeof (int) + 160,
770 18 + 768 * sizeof (short) / sizeof (int) + 160,
771 18 + 768 * sizeof (short) / sizeof (int) + 160,
772 18 + 768 * sizeof (short) / sizeof (int) + 160,
773 18 + 768 * sizeof (short) / sizeof (int) + 160,
774 18 + 768 * sizeof (short) / sizeof (int) + 160,
775 18 + 768 * sizeof (short) / sizeof (int) + 160,
776 18 + 768 * sizeof (short) / sizeof (int) + 160,
777 18 + 768 * sizeof (short) / sizeof (int) + 160,
778 18 + 768 * sizeof (short) / sizeof (int) + 160,
779 18 + 768 * sizeof (short) / sizeof (int) + 160,
780 18 + 768 * sizeof (short) / sizeof (int) + 160,
781 18 + 768 * sizeof (short) / sizeof (int) + 160,
782 18 + 768 * sizeof (short) / sizeof (int) + 160,
783 18 + 768 * sizeof (short) / sizeof (int) + 160,
784 18 + 768 * sizeof (short) / sizeof (int) + 160,
785 18 + 768 * sizeof (short) / sizeof (int) + 160,
786 18 + 768 * sizeof (short) / sizeof (int) + 160,
787 18 + 768 * sizeof (short) / sizeof (int) + 160,
788 18 + 768 * sizeof (short) / sizeof (int) + 160,
789 18 + 768 * sizeof (short) / sizeof (int) + 160,
790 18 + 768 * sizeof (short) / sizeof (int) + 160,
791 18 + 768 * sizeof (short) / sizeof (int) + 160,
792 18 + 768 * sizeof (short) / sizeof (int) + 160,
793 18 + 768 * sizeof (short) / sizeof (int) + 160,
794 18 + 768 * sizeof (short) / sizeof (int) + 160,
795 18 + 768 * sizeof (short) / sizeof (int) + 160,
796 18 + 768 * sizeof (short) / sizeof (int) + 160,
797 18 + 768 * sizeof (short) / sizeof (int) + 160,
798 18 + 768 * sizeof (short) / sizeof (int) + 160,
799 18 + 768 * sizeof (short) / sizeof (int) + 160,
800 18 + 768 * sizeof (short) / sizeof (int) + 160,
801 18 + 768 * sizeof (short) / sizeof (int) + 160,
802 18 + 768 * sizeof (short) / sizeof (int) + 160,
803 18 + 768 * sizeof (short) / sizeof (int) + 160,
804 18 + 768 * sizeof (short) / sizeof (int) + 160,
805 18 + 768 * sizeof (short) / sizeof (int) + 160,
806 18 + 768 * sizeof (short) / sizeof (int) + 160,
807 18 + 768 * sizeof (short) / sizeof (int) + 160,
808 18 + 768 * sizeof (short) / sizeof (int) + 160,
809 18 + 768 * sizeof (short) / sizeof (int) + 160,
810 18 + 768 * sizeof (short) / sizeof (int) + 160,
811 18 + 768 * sizeof (short) / sizeof (int) + 160,
812 18 + 768 * sizeof (short) / sizeof (int) + 160,
813 18 + 768 * sizeof (short) / sizeof (int) + 160,
814 18 + 768 * sizeof (short) / sizeof (int) + 160,
815 18 + 768 * sizeof (short) / sizeof (int) + 160,
816 18 + 768 * sizeof (short) / sizeof (int) + 160,
817 18 + 768 * sizeof (short) / sizeof (int) + 160,
818 18 + 768 * sizeof (short) / sizeof (int) + 160,
819 18 + 768 * sizeof (short) / sizeof (int) + 160,
820 18 + 768 * sizeof (short) / sizeof (int) + 160,
821 18 + 768 * sizeof (short) / sizeof (int) + 160,
822 18 + 768 * sizeof (short) / sizeof (int) + 1456
823 },
824 {
825 0x00000000U, 0xFFFFFFFEU, 0xFFFFFFFFU, 0x7FFFFFFFU,
826 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
827 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
828 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
829 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
830 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
831 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFCFFFFFFU,
832 0xFFFFD7F0U, 0xFFFFFFFBU, 0xFFFFFFFFU, 0xFFFFFFFFU,
833 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
834 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
835 0xFFFFFFFFU, 0xFFFEFFFFU, 0xFE7FFFFFU, 0xFFFFFFFFU,
836 0xFFFEE7FFU, 0xFFFFFFFFU, 0xFFFF00FFU, 0x001F87FFU,
837 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
838 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
839 0xFFFFBFFFU, 0xFFFFFFFFU, 0xFFFFE7FFU, 0xFFFFFFFFU,
840 0xFFFFFFFFU, 0x0003FFFFU, 0xFFFFFFFFU, 0xE7FFFFFFU,
841 0xFFFFFFFFU, 0x7FFF3FFFU, 0x4FFFFFFFU, 0xFFFF07FFU,
842 0xFF83FFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
843 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
844 0xFFF99FEFU, 0xF3C5FDFFU, 0xB080799FU, 0x7FFFFFCFU,
845 0xFFF987EEU, 0xD36DFDFFU, 0x5E023987U, 0x007FFFC0U,
846 0xFFFBBFEEU, 0xF3EDFDFFU, 0x00013BBFU, 0xFE03FFCFU,
847 0xFFF99FEEU, 0xF3EDFDFFU, 0xB0E0399FU, 0x00FFFFCFU,
848 0xD63DC7ECU, 0xC3FFC718U, 0x00813DC7U, 0x07FFFFC0U,
849 0xFFFDDFFFU, 0xF3FFFDFFU, 0x37603DDFU, 0xFF80FFCFU,
850 0xFFFDDFFFU, 0xF3EFFDFFU, 0x70603DDFU, 0x000EFFCFU,
851 0xFFFDDFFFU, 0xFFFFFFFFU, 0xFFF0FDDFU, 0xFFFFFFCFU,
852 0xFC7FFFEEU, 0x2FFBFFFFU, 0xFF5F847FU, 0x001CFFC0U,
853 0xFFFFFFFEU, 0x87FFFFFFU, 0x0FFFFFFFU, 0x00000000U,
854 0xFFFFF7D6U, 0x3FFFFFAFU, 0xF3FF7F5FU, 0x00000000U,
855 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFEFFU, 0xFFFE1FFFU,
856 0xFEFFFFFFU, 0xDFFFFFFFU, 0x07FFDFFFU, 0x00000000U,
857 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
858 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF20BFU, 0xFFFFFFFFU,
859 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
860 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
861 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3D7F3DFFU, 0xFFFFFFFFU,
862 0xFFFF3DFFU, 0x7F3DFFFFU, 0xFF7FFF3DU, 0xFFFFFFFFU,
863 0xFF3DFFFFU, 0xFFFFFFFFU, 0xE7FFFFFFU, 0x1FFFFFFFU,
864 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3F3FFFFFU,
865 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
866 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
867 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
868 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
869 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
870 0x1FFFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFFFFFU,
871 0x803FFFFFU, 0x007FFFFFU, 0x000FFFFFU, 0x000DDFFFU,
872 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x03FF03FFU,
873 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFFFFFU,
874 0xFFFFFFFFU, 0xFFFF07FFU, 0xFFFFFFFFU, 0x003FFFFFU,
875 0x7FFFFFFFU, 0x0FFF0FFFU, 0xFFFFFFF1U, 0x001F3FFFU,
876 0xFFFFFFFFU, 0xFFFF0FFFU, 0xC7FF03FFU, 0xFFFFFFFFU,
877 0xCFFFFFFFU, 0xFFFFFFFFU, 0x7FFFFFFFU, 0x9FFFFFFFU,
878 0x03FF03FFU, 0xFFFF3FFFU, 0x3FFFFFFFU, 0x00000FFFU,
879 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFDFFFU, 0xFFFFFFFFU,
880 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF00FFFFFU,
881 0xFFFFFFFFU, 0xF8FFFFFFU, 0xFFFFE3FFU, 0xFFFFFFFFU,
882 0xFFFF07FFU, 0xE7FFFFFFU, 0xFFFF00FFU, 0x07FFFFFFU,
883 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
884 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
885 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
886 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
887 0x3F3FFFFFU, 0xFFFFFFFFU, 0xAAFF3F3FU, 0x3FFFFFFFU,
888 0xFFFFFFFFU, 0xFFDFFFFFU, 0xEFCFFFDFU, 0x7FDCFFFFU,
889 0xFFFFF880U, 0xFFFFFCFFU, 0x7FFFFFFFU, 0xFFF3FFDFU,
890 0x1FFF7FFFU, 0xFFFFFFFFU, 0xFFFF0003U, 0x0001FFFFU,
891 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
892 0xFFFF0FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
893 0xFFFFFFFFU, 0x000003FFU, 0x000007FFU, 0xFFFFFFFFU,
894 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
895 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
896 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
897 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
898 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
899 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFCFFFFFU,
900 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
901 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
902 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFE0FFFFFU,
903 0xFFFFFFFFU, 0xFFFF20BFU, 0xFFFFFFFFU, 0x800180FFU,
904 0x007FFFFFU, 0x7F7F7F7FU, 0x7F7F7F7FU, 0xFFFFFFFFU,
905 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x00000000U,
906 0xFBFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000FFFFFU,
907 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
908 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0xFFFF0000U,
909 0xFFFFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFEU, 0xFFFFFFFFU,
910 0xFE7FFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
911 0xFFFFFFE0U, 0xFFFEFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
912 0xFFFF7FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF803FU,
913 0x7FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
914 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
915 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
916 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
917 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
918 0xFFFF1FFFU, 0xFFFFFFFFU, 0xFFFF007FU, 0xFFFFFFFFU,
919 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
920 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
921 0xFFFFFFFFU, 0x00000FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
922 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU,
923 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
924 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFFFFFFU, 0xFFFE0000U,
925 0xFFFFFFFFU, 0x03FF1FFFU, 0xFFFFFFFFU, 0x00FFFFFFU,
926 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFC03FU, 0xFFFFFFFFU,
927 0xFFFFFFFFU, 0xFFFFFFFFU, 0x800FFFFFU, 0x1FFFFFFFU,
928 0xFFFFFFFFU, 0xFFFFFFFFU, 0xC3FFBFFFU, 0x7FFFFFFFU,
929 0xFFFFFFFFU, 0x007FFFFFU, 0xF3FF3FFFU, 0xFFFFFFFFU,
930 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF8000007U, 0x007FFFFFU,
931 0x007E7E7EU, 0xFFFF7F7FU, 0xFFFFFFFFU, 0xFFFF0FFFU,
932 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF3FFFU,
933 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
934 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
935 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
936 0xFFFFFFFFU, 0xFFFF000FU, 0xFFFFF87FU, 0x0FFFFFFFU,
937 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF3FFFU,
938 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00000000U,
939 0xE0F8007FU, 0x5F7FFFFFU, 0xFFFFFFDBU, 0xFFFFFFFFU,
940 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
941 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
942 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
943 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
944 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU, 0xFFFF0000U,
945 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFF7FFFFU, 0xFFDF0F7FU,
946 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x9FFFFFFFU,
947 0xFFFFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
948 0xFFFFFFFFU, 0x7FFFFFFFU, 0x1CFCFCFCU, 0x3E007F7FU,
949 0xFFFFEFFFU, 0xB7FFFF7FU, 0x3FFF3FFFU, 0x00000000U,
950 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU,
951 0xFFFFFF87U, 0xFF8FFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
952 0x1FFF7FFFU, 0x00000001U, 0xFFFF0000U, 0x3FFFFFFFU,
953 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
954 0x1FFFFFFFU, 0xFFFFFFFFU, 0x0001FFFFU, 0x0FFFFFFFU,
955 0xFFFFFFFFU, 0xFFFFE00FU, 0xFFFF07FFU, 0x07FFFFFFU,
956 0xBFFFFFFFU, 0xFFFFFFFFU, 0x003FFF0FU, 0x00000000U,
957 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
958 0x3FFFFFFFU, 0xFFFF03FFU, 0xFF0FFFFFU, 0x0FFFFFFFU,
959 0xFFFFFFFFU, 0xFFFF00FFU, 0xFFFFFFFFU, 0xF7FF800FU,
960 0xFFB7F7FFU, 0x1BFBFFFBU, 0xFFFFFFFFU, 0x000FFFFFU,
961 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
962 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
963 0xFFFFFFFFU, 0x007FFFFFU, 0x003FFFFFU, 0x000000FFU,
964 0xFFFFFFBFU, 0x07FDFFFFU, 0x00000000U, 0x00000000U,
965 0xFFFFFD3FU, 0x91BFFFFFU, 0xFFBFFFFFU, 0xFFFFFFFFU,
966 0x7FFFFFFFU, 0x0000FF80U, 0x00000000U, 0xF837FFFFU,
967 0x8FFFFFFFU, 0x83FFFFFFU, 0x03FFFFFFU, 0x00000000U,
968 0xFFFFFFFFU, 0xF0FFFFFFU, 0xFFFCFFFFU, 0xFFFFFFFFU,
969 0xFEEFF06FU, 0x873FFFFFU, 0x01FF01FFU, 0xFFFFFFFFU,
970 0xFFFFFFFFU, 0x00000000U, 0xFFFFFFFFU, 0x007FF87FU,
971 0xFFFFFFFFU, 0xFE3FFFFFU, 0xFF3FFFFFU, 0xFF07FFFFU,
972 0x1E03FFFFU, 0x0000FE00U, 0x00000000U, 0x00000000U,
973 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000001FFU, 0x00000000U,
974 0xFFFFFFFFU, 0x0007FFFFU, 0xFFFFFFFFU, 0xFC07FFFFU,
975 0xFFFFFFFFU, 0x03FF00FFU, 0xFFFFFFFFU, 0xFFFFFE3FU,
976 0x0000C03FU, 0x00000000U, 0x00000000U, 0x00000000U,
977 0x00000000U, 0x00000000U, 0x00000000U, 0x7FFFFFFFU,
978 0xFFFFFFFFU, 0x00033BFFU, 0x01FF00FCU, 0xFC000000U,
979 0xFFFFFFFFU, 0xFFFF00FFU, 0x03FFFFFFU, 0xFFFF0000U,
980 0x000003FFU, 0xFFFF0000U, 0x00000FFFU, 0x007FFFFFU,
981 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFC3FFFU, 0x803FFFFFU,
982 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF2007U, 0x03FF01FFU,
983 0xFFFFFFFFU, 0xFFDFFFFFU, 0xFFFF00FFU, 0x007FFFFFU,
984 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x001FFFFEU,
985 0xFFFBFFFFU, 0xFFFFFFFFU, 0x00000003U, 0x00000000U,
986 0xBFFFBD7FU, 0xFFFF03FFU, 0xFFFFFFFFU, 0x03FF07FFU,
987 0xFFF99FEFU, 0xFBEDFDFFU, 0xE081399FU, 0x001F1FCFU,
988 0xFFFF4BFFU, 0xFFBFFFFFU, 0x01BFF7A5U, 0x00000006U,
989 0xFFFFFFFFU, 0xFFFFFFFFU, 0xEFFFFFFFU, 0x00000003U,
990 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF00FFU, 0x00000000U,
991 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
992 0xFFFFFFFFU, 0xFF3FFFFFU, 0x3FFFFFFFU, 0x00000000U,
993 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF001FU, 0x00001FFFU,
994 0xFFFFFFFFU, 0x03FFFFFFU, 0xFFFF03FFU, 0x0000000FU,
995 0xE7FFFFFFU, 0xFFFF0FFFU, 0x0000007FU, 0x00000000U,
996 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
997 0xFFFFFFFFU, 0x0FFFFFFFU, 0x00000000U, 0x00000000U,
998 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x8007FFFFU,
999 0xFF6FF27FU, 0xF9BFFFFFU, 0x03FF007FU, 0x00000000U,
1000 0x00000000U, 0xFFFFFCFFU, 0xFCFFFFFFU, 0x0000001FU,
1001 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF00FFU, 0xFFFFFFFFU,
1002 0xFFFFFFFFU, 0xFFFF0007U, 0xFFFFFFFFU, 0x01FFFFFFU,
1003 0x000003FFU, 0x00000000U, 0x00000000U, 0x000000FFU,
1004 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x03FF0003U,
1005 0xFFFFFDFFU, 0xFF7FFFFFU, 0xFFFF003FU, 0xFFFF1FFFU,
1006 0xFFFCFFFFU, 0x007FFEFFU, 0x00000000U, 0x00000000U,
1007 0xFFFFFB7FU, 0xB47FFFFFU, 0x03FF00FFU, 0xFFFFFDBFU,
1008 0x01FB7FFFU, 0xFFFF03FFU, 0x0FFFFFFFU, 0x000003FFU,
1009 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1010 0x00000000U, 0x00000000U, 0x00000000U, 0x01FFFFFFU,
1011 0xFFFDFFFFU, 0xC7FFFFFFU, 0x07FFFFFFU, 0x00000000U,
1012 0x00000000U, 0x00010000U, 0xFFFFFFFFU, 0x8003FFFFU,
1013 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1014 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1015 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1016 0x03FFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
1017 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x001F7FFFU,
1018 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1019 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U,
1020 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1021 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1022 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1023 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1024 0xFFFF0000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0007FFFFU,
1025 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0xFFFFFFFFU,
1026 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1027 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1028 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1029 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1030 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1031 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1032 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU,
1033 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000007FU, 0x00000000U,
1034 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1035 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1036 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1037 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1038 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1039 0xFFFFFFFFU, 0x03FFFFFFU, 0x00000000U, 0x00000000U,
1040 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1041 0xFFFFFFFFU, 0x01FFFFFFU, 0x7FFFFFFFU, 0xFFFFC3FFU,
1042 0xFFFFFFFFU, 0x7FFFFFFFU, 0xFFFF03FFU, 0x003F3FFFU,
1043 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFBFF003FU, 0xE0FFFFFBU,
1044 0x0000FFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
1045 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1046 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1047 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x03FFFFFFU,
1048 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1049 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU,
1050 0x07FFFFFFU, 0xF9FFFFFFU, 0x000FFFFFU, 0x00000000U,
1051 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF87FFU, 0xFFFFFFFFU,
1052 0xFFFF80FFU, 0x00000000U, 0x00000000U, 0x007F001FU,
1053 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1054 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x80000000U,
1055 0x7FFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
1056 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0007FFFFU,
1057 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1058 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1059 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1060 0x00000000U, 0x00000000U, 0x00000000U, 0x6FEF0000U,
1061 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1062 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1063 0xFFFFFFFFU, 0x00040007U, 0x00270000U, 0xFFFF00F0U,
1064 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1065 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1066 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0FFFFFFFU,
1067 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1068 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1069 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFF07FFU,
1070 0xF3FF01FFU, 0x0000000FU, 0x00000000U, 0x00000000U,
1071 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1072 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1073 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1074 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFFFFFFU,
1075 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1076 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1077 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1078 0xFFFFFFFFU, 0xFC0FFFFFU, 0x0001FFFFU, 0x0001FFFFU,
1079 0xFFFFFFFFU, 0xFFFF3FFFU, 0xFFFF007FU, 0xFFFFFFFFU,
1080 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U,
1081 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1082 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU,
1083 0xFFFFFFFFU, 0xFFFFFE7FU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1084 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000007FFU,
1085 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000003FU, 0x00000000U,
1086 0x00000000U, 0x00000000U, 0x000FFFFFU, 0x000FFFFFU,
1087 0xFFFFFFFFU, 0xFFFFFFFFU, 0x007FFFFFU, 0x01FFFFFFU,
1088 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1089 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFDFFFFFU, 0xFFFFFFFFU,
1090 0xDFFFFFFFU, 0xEBFFDE64U, 0xFFFFFFEFU, 0xFFFFFFFFU,
1091 0xDFDFE7BFU, 0x7BFFFFFFU, 0xFFFDFC5FU, 0xFFFFFFFFU,
1092 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1093 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1094 0xFFFFFFFFU, 0xFFFFFF3FU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1095 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1096 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFCFFFU, 0xFFFFFFFFU,
1097 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1098 0xF8000FFFU, 0x0000FFFEU, 0x00000000U, 0x00000000U,
1099 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1100 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1101 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1102 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1103 0x7FFFFFFFU, 0x000007E0U, 0x00000000U, 0x00000000U,
1104 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1105 0xF9FFFF7FU, 0xFFFF07DBU, 0xFFFFFFFFU, 0x00003FFFU,
1106 0x00008000U, 0x00000000U, 0x00000000U, 0x00000000U,
1107 0xFFFFFFFFU, 0x3FFF1FFFU, 0x0000C3FFU, 0x00000000U,
1108 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1109 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1110 0xFFFF0000U, 0x00007FFFU, 0xFFFFFFFFU, 0x83FFFFFFU,
1111 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1112 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1113 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1114 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x03FFFFFFU,
1115 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1116 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x87FFFFFFU,
1117 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1118 0x00000000U, 0x00000000U, 0x7FFFFFFFU, 0xC03FFFFFU,
1119 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1120 0x00000000U, 0x00000000U, 0x00000000U, 0x7FFF6F7FU,
1121 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1122 0xFFFFFFFFU, 0xFFFFFFFFU, 0x007FFF9FU, 0x00000000U,
1123 0xFFFFFFFFU, 0xFFFFFFFFU, 0xC3FF0FFFU, 0x00000000U,
1124 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1125 0x00000000U, 0x00000000U, 0x00000000U, 0xFFFE0000U,
1126 0xFFFFFFFFU, 0x001FFFFFU, 0x00000000U, 0x00000000U,
1127 0xFFFFFFFEU, 0x3FFFFFFFU, 0x00000000U, 0x00000000U,
1128 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1129 0xFFFFFFEFU, 0x0AF7FE96U, 0xAA96EA84U, 0x5EF7F796U,
1130 0x0FFFFBFFU, 0x0FFFFBEEU, 0x00000000U, 0x00030000U,
1131 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1132 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1133 0xFFFFFFFFU, 0xFFFF0FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1134 0x000FFFFFU, 0xFFFE7FFFU, 0xFFFEFFFEU, 0x003FFFFFU,
1135 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1136 0xFFFFFFFFU, 0x00003FFFU, 0x00000000U, 0xFFFFFFC0U,
1137 0xFFFF0007U, 0x0FFFFFFFU, 0x000301FFU, 0x0000003FU,
1138 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1139 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1140 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1141 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1142 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF1FFFFFFU, 0x1FFF1FFFU,
1143 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1144 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00010FFFU,
1145 0xFFFF0FFFU, 0xFFFFFFFFU, 0x03FF00FFU, 0xFFFFFFFFU,
1146 0xFFFF00FFU, 0x0FFF3FFFU, 0x01FF0003U, 0x00000000U,
1147 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1148 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1149 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU, 0x1FFF3FFFU,
1150 0xFFFFC7FFU, 0xFFFFFFFFU, 0x9FFFE17FU, 0x01FF87FFU,
1151 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1152 0xFFF7FFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU,
1153 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1154 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U,
1155 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1156 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1157 0x3FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1158 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1159 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1160 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1161 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1162 0xFFFFFFFFU, 0xFFFF3FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1163 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1164 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1165 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1166 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1167 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1168 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF0001U,
1169 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x00000000U,
1170 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1171 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1172 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1173 0x3FFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
1174 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1175 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1176 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1177 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1178 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1179 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF07FFU, 0xFFFFFFFFU,
1180 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1181 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU,
1182 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1183 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1184 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1185 0x00000002U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1186 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1187 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1188 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU,
1189 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1190 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1191 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1192 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU
1193 }
1194};
diff --git a/gl/unictype/ctype_lower.c b/gl/unictype/ctype_lower.c
new file mode 100644
index 00000000..b113106f
--- /dev/null
+++ b/gl/unictype/ctype_lower.c
@@ -0,0 +1,32 @@
1/* ISO C <ctype.h> like properties of Unicode characters.
2 Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2002.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#include <config.h>
19
20/* Specification. */
21#include "unictype.h"
22
23#include "bitmap.h"
24
25/* Define u_is_lower table. */
26#include "ctype_lower.h"
27
28bool
29uc_is_lower (ucs4_t uc)
30{
31 return bitmap_lookup (&u_is_lower, uc);
32}
diff --git a/gl/unictype/ctype_lower.h b/gl/unictype/ctype_lower.h
new file mode 100644
index 00000000..aae2e4cc
--- /dev/null
+++ b/gl/unictype/ctype_lower.h
@@ -0,0 +1,371 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* ISO C <ctype.h> like properties of Unicode characters. */
3/* Generated automatically by gen-uni-tables.c for Unicode 17.0.0. */
4
5/* Copyright (C) 2000-2025 Free Software Foundation, Inc.
6
7 This file is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
11
12 This file is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19
20#define header_0 16
21#define header_2 9
22#define header_3 127
23#define header_4 15
24static const
25struct
26 {
27 int header[1];
28 int level1[2];
29 short level2[2 << 7];
30 unsigned int level3[18 << 4];
31 }
32u_is_lower =
33{
34 { 2 },
35 {
36 3 * sizeof (int) / sizeof (short) + 0,
37 3 * sizeof (int) / sizeof (short) + 128
38 },
39 {
40 3 + 256 * sizeof (short) / sizeof (int) + 0,
41 3 + 256 * sizeof (short) / sizeof (int) + 16,
42 3 + 256 * sizeof (short) / sizeof (int) + 32,
43 -1,
44 -1,
45 -1,
46 -1,
47 -1,
48 3 + 256 * sizeof (short) / sizeof (int) + 48,
49 3 + 256 * sizeof (short) / sizeof (int) + 64,
50 -1,
51 -1,
52 -1,
53 -1,
54 3 + 256 * sizeof (short) / sizeof (int) + 80,
55 3 + 256 * sizeof (short) / sizeof (int) + 96,
56 3 + 256 * sizeof (short) / sizeof (int) + 112,
57 -1,
58 3 + 256 * sizeof (short) / sizeof (int) + 128,
59 -1,
60 -1,
61 -1,
62 3 + 256 * sizeof (short) / sizeof (int) + 144,
63 -1,
64 -1,
65 -1,
66 -1,
67 -1,
68 -1,
69 -1,
70 -1,
71 -1,
72 -1,
73 -1,
74 -1,
75 -1,
76 -1,
77 -1,
78 -1,
79 -1,
80 -1,
81 -1,
82 -1,
83 -1,
84 -1,
85 -1,
86 -1,
87 -1,
88 -1,
89 -1,
90 -1,
91 -1,
92 -1,
93 -1,
94 -1,
95 -1,
96 -1,
97 -1,
98 -1,
99 -1,
100 -1,
101 -1,
102 -1,
103 -1,
104 -1,
105 -1,
106 -1,
107 -1,
108 -1,
109 -1,
110 -1,
111 -1,
112 -1,
113 -1,
114 -1,
115 -1,
116 -1,
117 -1,
118 -1,
119 -1,
120 -1,
121 -1,
122 -1,
123 3 + 256 * sizeof (short) / sizeof (int) + 160,
124 -1,
125 3 + 256 * sizeof (short) / sizeof (int) + 176,
126 -1,
127 -1,
128 -1,
129 -1,
130 -1,
131 -1,
132 -1,
133 -1,
134 -1,
135 -1,
136 -1,
137 -1,
138 -1,
139 -1,
140 -1,
141 -1,
142 -1,
143 -1,
144 -1,
145 -1,
146 -1,
147 -1,
148 -1,
149 -1,
150 -1,
151 -1,
152 -1,
153 -1,
154 -1,
155 -1,
156 -1,
157 -1,
158 -1,
159 -1,
160 -1,
161 -1,
162 -1,
163 -1,
164 -1,
165 -1,
166 -1,
167 3 + 256 * sizeof (short) / sizeof (int) + 192,
168 -1,
169 -1,
170 3 + 256 * sizeof (short) / sizeof (int) + 208,
171 -1,
172 -1,
173 -1,
174 3 + 256 * sizeof (short) / sizeof (int) + 224,
175 -1,
176 -1,
177 -1,
178 -1,
179 -1,
180 3 + 256 * sizeof (short) / sizeof (int) + 240,
181 -1,
182 -1,
183 -1,
184 -1,
185 -1,
186 -1,
187 -1,
188 -1,
189 -1,
190 -1,
191 -1,
192 -1,
193 -1,
194 -1,
195 -1,
196 -1,
197 -1,
198 -1,
199 -1,
200 -1,
201 -1,
202 -1,
203 -1,
204 -1,
205 -1,
206 -1,
207 -1,
208 -1,
209 -1,
210 -1,
211 -1,
212 -1,
213 -1,
214 -1,
215 -1,
216 -1,
217 -1,
218 -1,
219 -1,
220 -1,
221 -1,
222 -1,
223 3 + 256 * sizeof (short) / sizeof (int) + 256,
224 -1,
225 -1,
226 -1,
227 -1,
228 -1,
229 -1,
230 -1,
231 -1,
232 -1,
233 -1,
234 -1,
235 -1,
236 -1,
237 -1,
238 -1,
239 -1,
240 -1,
241 -1,
242 -1,
243 -1,
244 -1,
245 -1,
246 -1,
247 -1,
248 -1,
249 -1,
250 -1,
251 -1,
252 -1,
253 -1,
254 -1,
255 -1,
256 -1,
257 -1,
258 -1,
259 -1,
260 -1,
261 -1,
262 -1,
263 -1,
264 -1,
265 -1,
266 -1,
267 -1,
268 -1,
269 -1,
270 -1,
271 -1,
272 -1,
273 -1,
274 -1,
275 -1,
276 -1,
277 -1,
278 -1,
279 -1,
280 -1,
281 -1,
282 -1,
283 -1,
284 3 + 256 * sizeof (short) / sizeof (int) + 272,
285 -1,
286 -1,
287 -1,
288 -1,
289 -1,
290 -1,
291 -1,
292 -1,
293 -1,
294 -1,
295 -1
296 },
297 {
298 0x00000000U, 0x00000000U, 0x00000000U, 0x07FFFFFEU,
299 0x00000000U, 0x00200000U, 0x80000000U, 0xFF7FFFFFU,
300 0xAAAAAAAAU, 0x54AAAAAAU, 0xAAAAA955U, 0xD4AAAAAAU,
301 0x4E241129U, 0xA251212AU, 0xB5555B60U, 0xAA2CAAAAU,
302 0xAAAAAAAAU, 0x900AAAA8U, 0x1ADFAA85U, 0x20269F7BU,
303 0x60041F8DU, 0x00000000U, 0x00000000U, 0x00000000U,
304 0x00000000U, 0x00000000U, 0x00000020U, 0x388A0000U,
305 0x00000000U, 0xFFFEF000U, 0xAAE37FFFU, 0x092FAAAAU,
306 0x00000000U, 0xFFFF0000U, 0xFFFFFFFFU, 0xAAAAAAAAU,
307 0xAAAAA802U, 0xAAAAAAAAU, 0xAAAAD554U, 0xAAAAAAAAU,
308 0xAAAAAAAAU, 0x0000AAAAU, 0x00000000U, 0xFFFFFFFEU,
309 0x0000007FU, 0x00000000U, 0x00000000U, 0x00000000U,
310 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
311 0x00000000U, 0x00000000U, 0xFFFF0000U, 0xE7FFFFFFU,
312 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
313 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
314 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
315 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
316 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
317 0x00000000U, 0x00000000U, 0x00000000U, 0x3F000000U,
318 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
319 0x000005FFU, 0x00000000U, 0x00000000U, 0x00000000U,
320 0x00000000U, 0x00000000U, 0x00000000U, 0x22000000U,
321 0x00004000U, 0x00000000U, 0x00000000U, 0x00000000U,
322 0xAAAAAAAAU, 0xAAAAAAAAU, 0xAAAAAAAAU, 0xAAAAAAAAU,
323 0x082AAAAAU, 0xAAAAAAAAU, 0xAAAAAAAAU, 0xAAAAAAAAU,
324 0x003F00FFU, 0x00FF00FFU, 0x00AA003FU, 0x3FFF00FFU,
325 0x00FF00FFU, 0x400B00FFU, 0x00030008U, 0x00080023U,
326 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
327 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
328 0x00000000U, 0x00000000U, 0x00004000U, 0xFFFF0000U,
329 0x00000010U, 0x00000000U, 0x00000000U, 0x00000000U,
330 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
331 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x000003FFU,
332 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
333 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
334 0x00000000U, 0xFFFF0000U, 0xFFFFFFFFU, 0x00481562U,
335 0xAAAAAAAAU, 0xAAAAAAAAU, 0xAAAAAAAAU, 0x0008500AU,
336 0xFFFFFFFFU, 0x000020BFU, 0x00000000U, 0x00000000U,
337 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
338 0x00000000U, 0x00000000U, 0xAAAAAAAAU, 0x00002AAAU,
339 0x0AAAAAAAU, 0x00000000U, 0x00000000U, 0x00000000U,
340 0x00000000U, 0xAAA8AAA8U, 0xAAAAAAAAU, 0x9400AAAAU,
341 0xAA9A10AAU, 0xAAA002AAU, 0x0AAAA50AU, 0x00400000U,
342 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
343 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
344 0x00000000U, 0x00000000U, 0x00080000U, 0xFFFF0000U,
345 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, 0x00000000U,
346 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
347 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
348 0x00000000U, 0x00000000U, 0x07FFFFFEU, 0x00000000U,
349 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
350 0x00000000U, 0xFFFFFF00U, 0x0000FFFFU, 0x00000000U,
351 0x00000000U, 0x00000000U, 0xFF000000U, 0x0FFFFFFFU,
352 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
353 0xFF800000U, 0x1BFBFFFBU, 0x00000000U, 0x00000000U,
354 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
355 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x0007FFFFU,
356 0x00000000U, 0x00000000U, 0x00000000U, 0xFFFF0000U,
357 0x0000003FU, 0x00000000U, 0x00000000U, 0x00000000U,
358 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
359 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x00000000U,
360 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
361 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
362 0x00000000U, 0x00000000U, 0x00000000U, 0xFFFFFFFFU,
363 0x00000000U, 0xF8000000U, 0x000FFFFFU, 0x00000000U,
364 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
365 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
366 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
367 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
368 0x00000000U, 0xFFFFFFFCU, 0x0000000FU, 0x00000000U,
369 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U
370 }
371};
diff --git a/gl/unictype/ctype_print.c b/gl/unictype/ctype_print.c
new file mode 100644
index 00000000..f689b0ad
--- /dev/null
+++ b/gl/unictype/ctype_print.c
@@ -0,0 +1,32 @@
1/* ISO C <ctype.h> like properties of Unicode characters.
2 Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2002.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#include <config.h>
19
20/* Specification. */
21#include "unictype.h"
22
23#include "bitmap.h"
24
25/* Define u_is_print table. */
26#include "ctype_print.h"
27
28bool
29uc_is_print (ucs4_t uc)
30{
31 return bitmap_lookup (&u_is_print, uc);
32}
diff --git a/gl/unictype/ctype_print.h b/gl/unictype/ctype_print.h
new file mode 100644
index 00000000..e2c34597
--- /dev/null
+++ b/gl/unictype/ctype_print.h
@@ -0,0 +1,1194 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* ISO C <ctype.h> like properties of Unicode characters. */
3/* Generated automatically by gen-uni-tables.c for Unicode 17.0.0. */
4
5/* Copyright (C) 2000-2025 Free Software Foundation, Inc.
6
7 This file is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
11
12 This file is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19
20#define header_0 16
21#define header_2 9
22#define header_3 127
23#define header_4 15
24static const
25struct
26 {
27 int header[1];
28 int level1[17];
29 short level2[6 << 7];
30 unsigned int level3[92 << 4];
31 }
32u_is_print =
33{
34 { 17 },
35 {
36 18 * sizeof (int) / sizeof (short) + 0,
37 18 * sizeof (int) / sizeof (short) + 128,
38 18 * sizeof (int) / sizeof (short) + 256,
39 18 * sizeof (int) / sizeof (short) + 384,
40 -1,
41 -1,
42 -1,
43 -1,
44 -1,
45 -1,
46 -1,
47 -1,
48 -1,
49 -1,
50 18 * sizeof (int) / sizeof (short) + 512,
51 18 * sizeof (int) / sizeof (short) + 640,
52 18 * sizeof (int) / sizeof (short) + 640
53 },
54 {
55 18 + 768 * sizeof (short) / sizeof (int) + 0,
56 18 + 768 * sizeof (short) / sizeof (int) + 16,
57 18 + 768 * sizeof (short) / sizeof (int) + 32,
58 18 + 768 * sizeof (short) / sizeof (int) + 48,
59 18 + 768 * sizeof (short) / sizeof (int) + 64,
60 18 + 768 * sizeof (short) / sizeof (int) + 80,
61 18 + 768 * sizeof (short) / sizeof (int) + 96,
62 18 + 768 * sizeof (short) / sizeof (int) + 112,
63 18 + 768 * sizeof (short) / sizeof (int) + 128,
64 18 + 768 * sizeof (short) / sizeof (int) + 144,
65 18 + 768 * sizeof (short) / sizeof (int) + 160,
66 18 + 768 * sizeof (short) / sizeof (int) + 176,
67 18 + 768 * sizeof (short) / sizeof (int) + 192,
68 18 + 768 * sizeof (short) / sizeof (int) + 208,
69 18 + 768 * sizeof (short) / sizeof (int) + 224,
70 18 + 768 * sizeof (short) / sizeof (int) + 240,
71 18 + 768 * sizeof (short) / sizeof (int) + 256,
72 18 + 768 * sizeof (short) / sizeof (int) + 160,
73 18 + 768 * sizeof (short) / sizeof (int) + 272,
74 18 + 768 * sizeof (short) / sizeof (int) + 160,
75 18 + 768 * sizeof (short) / sizeof (int) + 160,
76 18 + 768 * sizeof (short) / sizeof (int) + 288,
77 18 + 768 * sizeof (short) / sizeof (int) + 304,
78 18 + 768 * sizeof (short) / sizeof (int) + 320,
79 18 + 768 * sizeof (short) / sizeof (int) + 336,
80 18 + 768 * sizeof (short) / sizeof (int) + 352,
81 18 + 768 * sizeof (short) / sizeof (int) + 160,
82 18 + 768 * sizeof (short) / sizeof (int) + 160,
83 18 + 768 * sizeof (short) / sizeof (int) + 160,
84 18 + 768 * sizeof (short) / sizeof (int) + 160,
85 18 + 768 * sizeof (short) / sizeof (int) + 160,
86 18 + 768 * sizeof (short) / sizeof (int) + 160,
87 18 + 768 * sizeof (short) / sizeof (int) + 160,
88 18 + 768 * sizeof (short) / sizeof (int) + 160,
89 18 + 768 * sizeof (short) / sizeof (int) + 160,
90 18 + 768 * sizeof (short) / sizeof (int) + 160,
91 18 + 768 * sizeof (short) / sizeof (int) + 160,
92 18 + 768 * sizeof (short) / sizeof (int) + 160,
93 18 + 768 * sizeof (short) / sizeof (int) + 160,
94 18 + 768 * sizeof (short) / sizeof (int) + 160,
95 18 + 768 * sizeof (short) / sizeof (int) + 160,
96 18 + 768 * sizeof (short) / sizeof (int) + 160,
97 18 + 768 * sizeof (short) / sizeof (int) + 160,
98 18 + 768 * sizeof (short) / sizeof (int) + 160,
99 18 + 768 * sizeof (short) / sizeof (int) + 160,
100 18 + 768 * sizeof (short) / sizeof (int) + 160,
101 18 + 768 * sizeof (short) / sizeof (int) + 160,
102 18 + 768 * sizeof (short) / sizeof (int) + 160,
103 18 + 768 * sizeof (short) / sizeof (int) + 160,
104 18 + 768 * sizeof (short) / sizeof (int) + 160,
105 18 + 768 * sizeof (short) / sizeof (int) + 160,
106 18 + 768 * sizeof (short) / sizeof (int) + 160,
107 18 + 768 * sizeof (short) / sizeof (int) + 160,
108 18 + 768 * sizeof (short) / sizeof (int) + 160,
109 18 + 768 * sizeof (short) / sizeof (int) + 160,
110 18 + 768 * sizeof (short) / sizeof (int) + 160,
111 18 + 768 * sizeof (short) / sizeof (int) + 160,
112 18 + 768 * sizeof (short) / sizeof (int) + 160,
113 18 + 768 * sizeof (short) / sizeof (int) + 160,
114 18 + 768 * sizeof (short) / sizeof (int) + 160,
115 18 + 768 * sizeof (short) / sizeof (int) + 160,
116 18 + 768 * sizeof (short) / sizeof (int) + 160,
117 18 + 768 * sizeof (short) / sizeof (int) + 160,
118 18 + 768 * sizeof (short) / sizeof (int) + 160,
119 18 + 768 * sizeof (short) / sizeof (int) + 160,
120 18 + 768 * sizeof (short) / sizeof (int) + 160,
121 18 + 768 * sizeof (short) / sizeof (int) + 160,
122 18 + 768 * sizeof (short) / sizeof (int) + 160,
123 18 + 768 * sizeof (short) / sizeof (int) + 160,
124 18 + 768 * sizeof (short) / sizeof (int) + 160,
125 18 + 768 * sizeof (short) / sizeof (int) + 160,
126 18 + 768 * sizeof (short) / sizeof (int) + 160,
127 18 + 768 * sizeof (short) / sizeof (int) + 160,
128 18 + 768 * sizeof (short) / sizeof (int) + 160,
129 18 + 768 * sizeof (short) / sizeof (int) + 160,
130 18 + 768 * sizeof (short) / sizeof (int) + 160,
131 18 + 768 * sizeof (short) / sizeof (int) + 160,
132 18 + 768 * sizeof (short) / sizeof (int) + 160,
133 18 + 768 * sizeof (short) / sizeof (int) + 160,
134 18 + 768 * sizeof (short) / sizeof (int) + 160,
135 18 + 768 * sizeof (short) / sizeof (int) + 160,
136 18 + 768 * sizeof (short) / sizeof (int) + 160,
137 18 + 768 * sizeof (short) / sizeof (int) + 368,
138 18 + 768 * sizeof (short) / sizeof (int) + 384,
139 18 + 768 * sizeof (short) / sizeof (int) + 400,
140 18 + 768 * sizeof (short) / sizeof (int) + 416,
141 18 + 768 * sizeof (short) / sizeof (int) + 160,
142 18 + 768 * sizeof (short) / sizeof (int) + 160,
143 18 + 768 * sizeof (short) / sizeof (int) + 160,
144 18 + 768 * sizeof (short) / sizeof (int) + 160,
145 18 + 768 * sizeof (short) / sizeof (int) + 160,
146 18 + 768 * sizeof (short) / sizeof (int) + 160,
147 18 + 768 * sizeof (short) / sizeof (int) + 160,
148 18 + 768 * sizeof (short) / sizeof (int) + 160,
149 18 + 768 * sizeof (short) / sizeof (int) + 160,
150 18 + 768 * sizeof (short) / sizeof (int) + 160,
151 18 + 768 * sizeof (short) / sizeof (int) + 160,
152 18 + 768 * sizeof (short) / sizeof (int) + 160,
153 18 + 768 * sizeof (short) / sizeof (int) + 160,
154 18 + 768 * sizeof (short) / sizeof (int) + 160,
155 18 + 768 * sizeof (short) / sizeof (int) + 160,
156 18 + 768 * sizeof (short) / sizeof (int) + 160,
157 18 + 768 * sizeof (short) / sizeof (int) + 160,
158 18 + 768 * sizeof (short) / sizeof (int) + 160,
159 18 + 768 * sizeof (short) / sizeof (int) + 160,
160 18 + 768 * sizeof (short) / sizeof (int) + 160,
161 18 + 768 * sizeof (short) / sizeof (int) + 160,
162 18 + 768 * sizeof (short) / sizeof (int) + 432,
163 -1,
164 -1,
165 -1,
166 -1,
167 18 + 768 * sizeof (short) / sizeof (int) + 160,
168 18 + 768 * sizeof (short) / sizeof (int) + 160,
169 18 + 768 * sizeof (short) / sizeof (int) + 160,
170 18 + 768 * sizeof (short) / sizeof (int) + 160,
171 18 + 768 * sizeof (short) / sizeof (int) + 160,
172 18 + 768 * sizeof (short) / sizeof (int) + 160,
173 18 + 768 * sizeof (short) / sizeof (int) + 160,
174 18 + 768 * sizeof (short) / sizeof (int) + 160,
175 18 + 768 * sizeof (short) / sizeof (int) + 160,
176 18 + 768 * sizeof (short) / sizeof (int) + 160,
177 18 + 768 * sizeof (short) / sizeof (int) + 160,
178 18 + 768 * sizeof (short) / sizeof (int) + 160,
179 18 + 768 * sizeof (short) / sizeof (int) + 160,
180 18 + 768 * sizeof (short) / sizeof (int) + 448,
181 18 + 768 * sizeof (short) / sizeof (int) + 464,
182 18 + 768 * sizeof (short) / sizeof (int) + 480,
183 18 + 768 * sizeof (short) / sizeof (int) + 496,
184 18 + 768 * sizeof (short) / sizeof (int) + 512,
185 18 + 768 * sizeof (short) / sizeof (int) + 528,
186 18 + 768 * sizeof (short) / sizeof (int) + 544,
187 18 + 768 * sizeof (short) / sizeof (int) + 560,
188 18 + 768 * sizeof (short) / sizeof (int) + 576,
189 18 + 768 * sizeof (short) / sizeof (int) + 592,
190 18 + 768 * sizeof (short) / sizeof (int) + 608,
191 18 + 768 * sizeof (short) / sizeof (int) + 624,
192 18 + 768 * sizeof (short) / sizeof (int) + 640,
193 18 + 768 * sizeof (short) / sizeof (int) + 656,
194 18 + 768 * sizeof (short) / sizeof (int) + 672,
195 18 + 768 * sizeof (short) / sizeof (int) + 688,
196 18 + 768 * sizeof (short) / sizeof (int) + 704,
197 18 + 768 * sizeof (short) / sizeof (int) + 720,
198 18 + 768 * sizeof (short) / sizeof (int) + 736,
199 18 + 768 * sizeof (short) / sizeof (int) + 160,
200 18 + 768 * sizeof (short) / sizeof (int) + 752,
201 18 + 768 * sizeof (short) / sizeof (int) + 768,
202 -1,
203 -1,
204 -1,
205 -1,
206 18 + 768 * sizeof (short) / sizeof (int) + 784,
207 18 + 768 * sizeof (short) / sizeof (int) + 160,
208 18 + 768 * sizeof (short) / sizeof (int) + 160,
209 18 + 768 * sizeof (short) / sizeof (int) + 800,
210 18 + 768 * sizeof (short) / sizeof (int) + 160,
211 18 + 768 * sizeof (short) / sizeof (int) + 160,
212 18 + 768 * sizeof (short) / sizeof (int) + 160,
213 18 + 768 * sizeof (short) / sizeof (int) + 160,
214 18 + 768 * sizeof (short) / sizeof (int) + 160,
215 18 + 768 * sizeof (short) / sizeof (int) + 160,
216 18 + 768 * sizeof (short) / sizeof (int) + 816,
217 18 + 768 * sizeof (short) / sizeof (int) + 160,
218 18 + 768 * sizeof (short) / sizeof (int) + 832,
219 -1,
220 -1,
221 -1,
222 -1,
223 -1,
224 -1,
225 -1,
226 -1,
227 -1,
228 -1,
229 -1,
230 -1,
231 18 + 768 * sizeof (short) / sizeof (int) + 848,
232 -1,
233 -1,
234 -1,
235 18 + 768 * sizeof (short) / sizeof (int) + 160,
236 18 + 768 * sizeof (short) / sizeof (int) + 864,
237 18 + 768 * sizeof (short) / sizeof (int) + 880,
238 18 + 768 * sizeof (short) / sizeof (int) + 896,
239 18 + 768 * sizeof (short) / sizeof (int) + 160,
240 18 + 768 * sizeof (short) / sizeof (int) + 160,
241 18 + 768 * sizeof (short) / sizeof (int) + 160,
242 18 + 768 * sizeof (short) / sizeof (int) + 160,
243 18 + 768 * sizeof (short) / sizeof (int) + 160,
244 18 + 768 * sizeof (short) / sizeof (int) + 160,
245 18 + 768 * sizeof (short) / sizeof (int) + 160,
246 18 + 768 * sizeof (short) / sizeof (int) + 160,
247 18 + 768 * sizeof (short) / sizeof (int) + 160,
248 18 + 768 * sizeof (short) / sizeof (int) + 160,
249 18 + 768 * sizeof (short) / sizeof (int) + 160,
250 18 + 768 * sizeof (short) / sizeof (int) + 160,
251 18 + 768 * sizeof (short) / sizeof (int) + 160,
252 18 + 768 * sizeof (short) / sizeof (int) + 160,
253 18 + 768 * sizeof (short) / sizeof (int) + 912,
254 -1,
255 -1,
256 -1,
257 -1,
258 -1,
259 -1,
260 -1,
261 -1,
262 -1,
263 -1,
264 -1,
265 -1,
266 -1,
267 -1,
268 -1,
269 -1,
270 18 + 768 * sizeof (short) / sizeof (int) + 928,
271 18 + 768 * sizeof (short) / sizeof (int) + 944,
272 18 + 768 * sizeof (short) / sizeof (int) + 960,
273 -1,
274 -1,
275 -1,
276 -1,
277 18 + 768 * sizeof (short) / sizeof (int) + 976,
278 -1,
279 -1,
280 -1,
281 -1,
282 -1,
283 -1,
284 -1,
285 18 + 768 * sizeof (short) / sizeof (int) + 992,
286 18 + 768 * sizeof (short) / sizeof (int) + 1008,
287 18 + 768 * sizeof (short) / sizeof (int) + 1024,
288 18 + 768 * sizeof (short) / sizeof (int) + 1040,
289 18 + 768 * sizeof (short) / sizeof (int) + 1056,
290 18 + 768 * sizeof (short) / sizeof (int) + 1072,
291 18 + 768 * sizeof (short) / sizeof (int) + 160,
292 18 + 768 * sizeof (short) / sizeof (int) + 1088,
293 -1,
294 18 + 768 * sizeof (short) / sizeof (int) + 1104,
295 18 + 768 * sizeof (short) / sizeof (int) + 1120,
296 18 + 768 * sizeof (short) / sizeof (int) + 1136,
297 18 + 768 * sizeof (short) / sizeof (int) + 1152,
298 18 + 768 * sizeof (short) / sizeof (int) + 1168,
299 18 + 768 * sizeof (short) / sizeof (int) + 1184,
300 -1,
301 18 + 768 * sizeof (short) / sizeof (int) + 1200,
302 18 + 768 * sizeof (short) / sizeof (int) + 1216,
303 18 + 768 * sizeof (short) / sizeof (int) + 1232,
304 18 + 768 * sizeof (short) / sizeof (int) + 1248,
305 18 + 768 * sizeof (short) / sizeof (int) + 160,
306 18 + 768 * sizeof (short) / sizeof (int) + 1264,
307 18 + 768 * sizeof (short) / sizeof (int) + 1280,
308 18 + 768 * sizeof (short) / sizeof (int) + 1296,
309 -1,
310 -1,
311 18 + 768 * sizeof (short) / sizeof (int) + 160,
312 18 + 768 * sizeof (short) / sizeof (int) + 160,
313 18 + 768 * sizeof (short) / sizeof (int) + 160,
314 18 + 768 * sizeof (short) / sizeof (int) + 160,
315 18 + 768 * sizeof (short) / sizeof (int) + 160,
316 18 + 768 * sizeof (short) / sizeof (int) + 160,
317 18 + 768 * sizeof (short) / sizeof (int) + 160,
318 18 + 768 * sizeof (short) / sizeof (int) + 160,
319 18 + 768 * sizeof (short) / sizeof (int) + 160,
320 18 + 768 * sizeof (short) / sizeof (int) + 160,
321 18 + 768 * sizeof (short) / sizeof (int) + 160,
322 18 + 768 * sizeof (short) / sizeof (int) + 160,
323 18 + 768 * sizeof (short) / sizeof (int) + 160,
324 18 + 768 * sizeof (short) / sizeof (int) + 160,
325 18 + 768 * sizeof (short) / sizeof (int) + 160,
326 18 + 768 * sizeof (short) / sizeof (int) + 160,
327 18 + 768 * sizeof (short) / sizeof (int) + 160,
328 18 + 768 * sizeof (short) / sizeof (int) + 160,
329 18 + 768 * sizeof (short) / sizeof (int) + 160,
330 18 + 768 * sizeof (short) / sizeof (int) + 160,
331 18 + 768 * sizeof (short) / sizeof (int) + 160,
332 18 + 768 * sizeof (short) / sizeof (int) + 160,
333 18 + 768 * sizeof (short) / sizeof (int) + 160,
334 18 + 768 * sizeof (short) / sizeof (int) + 160,
335 18 + 768 * sizeof (short) / sizeof (int) + 160,
336 18 + 768 * sizeof (short) / sizeof (int) + 160,
337 18 + 768 * sizeof (short) / sizeof (int) + 160,
338 18 + 768 * sizeof (short) / sizeof (int) + 160,
339 18 + 768 * sizeof (short) / sizeof (int) + 160,
340 18 + 768 * sizeof (short) / sizeof (int) + 160,
341 18 + 768 * sizeof (short) / sizeof (int) + 160,
342 18 + 768 * sizeof (short) / sizeof (int) + 160,
343 18 + 768 * sizeof (short) / sizeof (int) + 160,
344 18 + 768 * sizeof (short) / sizeof (int) + 160,
345 18 + 768 * sizeof (short) / sizeof (int) + 160,
346 18 + 768 * sizeof (short) / sizeof (int) + 160,
347 18 + 768 * sizeof (short) / sizeof (int) + 160,
348 18 + 768 * sizeof (short) / sizeof (int) + 160,
349 18 + 768 * sizeof (short) / sizeof (int) + 160,
350 18 + 768 * sizeof (short) / sizeof (int) + 160,
351 18 + 768 * sizeof (short) / sizeof (int) + 160,
352 18 + 768 * sizeof (short) / sizeof (int) + 160,
353 18 + 768 * sizeof (short) / sizeof (int) + 160,
354 18 + 768 * sizeof (short) / sizeof (int) + 160,
355 18 + 768 * sizeof (short) / sizeof (int) + 160,
356 18 + 768 * sizeof (short) / sizeof (int) + 160,
357 18 + 768 * sizeof (short) / sizeof (int) + 160,
358 18 + 768 * sizeof (short) / sizeof (int) + 160,
359 18 + 768 * sizeof (short) / sizeof (int) + 160,
360 18 + 768 * sizeof (short) / sizeof (int) + 160,
361 18 + 768 * sizeof (short) / sizeof (int) + 160,
362 18 + 768 * sizeof (short) / sizeof (int) + 160,
363 18 + 768 * sizeof (short) / sizeof (int) + 160,
364 18 + 768 * sizeof (short) / sizeof (int) + 160,
365 18 + 768 * sizeof (short) / sizeof (int) + 160,
366 18 + 768 * sizeof (short) / sizeof (int) + 160,
367 18 + 768 * sizeof (short) / sizeof (int) + 160,
368 18 + 768 * sizeof (short) / sizeof (int) + 160,
369 18 + 768 * sizeof (short) / sizeof (int) + 160,
370 18 + 768 * sizeof (short) / sizeof (int) + 160,
371 18 + 768 * sizeof (short) / sizeof (int) + 160,
372 18 + 768 * sizeof (short) / sizeof (int) + 160,
373 18 + 768 * sizeof (short) / sizeof (int) + 160,
374 18 + 768 * sizeof (short) / sizeof (int) + 160,
375 18 + 768 * sizeof (short) / sizeof (int) + 160,
376 18 + 768 * sizeof (short) / sizeof (int) + 160,
377 18 + 768 * sizeof (short) / sizeof (int) + 160,
378 18 + 768 * sizeof (short) / sizeof (int) + 160,
379 18 + 768 * sizeof (short) / sizeof (int) + 160,
380 18 + 768 * sizeof (short) / sizeof (int) + 160,
381 18 + 768 * sizeof (short) / sizeof (int) + 160,
382 18 + 768 * sizeof (short) / sizeof (int) + 160,
383 18 + 768 * sizeof (short) / sizeof (int) + 160,
384 18 + 768 * sizeof (short) / sizeof (int) + 160,
385 18 + 768 * sizeof (short) / sizeof (int) + 160,
386 18 + 768 * sizeof (short) / sizeof (int) + 160,
387 18 + 768 * sizeof (short) / sizeof (int) + 160,
388 18 + 768 * sizeof (short) / sizeof (int) + 160,
389 18 + 768 * sizeof (short) / sizeof (int) + 160,
390 18 + 768 * sizeof (short) / sizeof (int) + 160,
391 18 + 768 * sizeof (short) / sizeof (int) + 160,
392 18 + 768 * sizeof (short) / sizeof (int) + 160,
393 18 + 768 * sizeof (short) / sizeof (int) + 160,
394 18 + 768 * sizeof (short) / sizeof (int) + 1312,
395 18 + 768 * sizeof (short) / sizeof (int) + 160,
396 18 + 768 * sizeof (short) / sizeof (int) + 160,
397 18 + 768 * sizeof (short) / sizeof (int) + 160,
398 18 + 768 * sizeof (short) / sizeof (int) + 160,
399 18 + 768 * sizeof (short) / sizeof (int) + 160,
400 18 + 768 * sizeof (short) / sizeof (int) + 160,
401 18 + 768 * sizeof (short) / sizeof (int) + 160,
402 18 + 768 * sizeof (short) / sizeof (int) + 160,
403 18 + 768 * sizeof (short) / sizeof (int) + 1328,
404 18 + 768 * sizeof (short) / sizeof (int) + 160,
405 18 + 768 * sizeof (short) / sizeof (int) + 160,
406 18 + 768 * sizeof (short) / sizeof (int) + 160,
407 18 + 768 * sizeof (short) / sizeof (int) + 160,
408 18 + 768 * sizeof (short) / sizeof (int) + 160,
409 18 + 768 * sizeof (short) / sizeof (int) + 160,
410 18 + 768 * sizeof (short) / sizeof (int) + 160,
411 18 + 768 * sizeof (short) / sizeof (int) + 160,
412 18 + 768 * sizeof (short) / sizeof (int) + 160,
413 18 + 768 * sizeof (short) / sizeof (int) + 160,
414 18 + 768 * sizeof (short) / sizeof (int) + 1344,
415 18 + 768 * sizeof (short) / sizeof (int) + 160,
416 18 + 768 * sizeof (short) / sizeof (int) + 160,
417 18 + 768 * sizeof (short) / sizeof (int) + 160,
418 18 + 768 * sizeof (short) / sizeof (int) + 160,
419 18 + 768 * sizeof (short) / sizeof (int) + 160,
420 18 + 768 * sizeof (short) / sizeof (int) + 160,
421 18 + 768 * sizeof (short) / sizeof (int) + 160,
422 18 + 768 * sizeof (short) / sizeof (int) + 160,
423 18 + 768 * sizeof (short) / sizeof (int) + 160,
424 18 + 768 * sizeof (short) / sizeof (int) + 160,
425 18 + 768 * sizeof (short) / sizeof (int) + 160,
426 18 + 768 * sizeof (short) / sizeof (int) + 160,
427 18 + 768 * sizeof (short) / sizeof (int) + 160,
428 18 + 768 * sizeof (short) / sizeof (int) + 1360,
429 18 + 768 * sizeof (short) / sizeof (int) + 160,
430 18 + 768 * sizeof (short) / sizeof (int) + 1376,
431 -1,
432 -1,
433 -1,
434 -1,
435 18 + 768 * sizeof (short) / sizeof (int) + 160,
436 18 + 768 * sizeof (short) / sizeof (int) + 1392,
437 -1,
438 -1,
439 18 + 768 * sizeof (short) / sizeof (int) + 160,
440 18 + 768 * sizeof (short) / sizeof (int) + 160,
441 18 + 768 * sizeof (short) / sizeof (int) + 160,
442 18 + 768 * sizeof (short) / sizeof (int) + 160,
443 18 + 768 * sizeof (short) / sizeof (int) + 160,
444 18 + 768 * sizeof (short) / sizeof (int) + 160,
445 18 + 768 * sizeof (short) / sizeof (int) + 160,
446 18 + 768 * sizeof (short) / sizeof (int) + 160,
447 18 + 768 * sizeof (short) / sizeof (int) + 160,
448 18 + 768 * sizeof (short) / sizeof (int) + 1408,
449 18 + 768 * sizeof (short) / sizeof (int) + 160,
450 18 + 768 * sizeof (short) / sizeof (int) + 160,
451 18 + 768 * sizeof (short) / sizeof (int) + 160,
452 18 + 768 * sizeof (short) / sizeof (int) + 160,
453 18 + 768 * sizeof (short) / sizeof (int) + 160,
454 18 + 768 * sizeof (short) / sizeof (int) + 160,
455 18 + 768 * sizeof (short) / sizeof (int) + 160,
456 18 + 768 * sizeof (short) / sizeof (int) + 160,
457 18 + 768 * sizeof (short) / sizeof (int) + 160,
458 18 + 768 * sizeof (short) / sizeof (int) + 160,
459 18 + 768 * sizeof (short) / sizeof (int) + 160,
460 18 + 768 * sizeof (short) / sizeof (int) + 160,
461 18 + 768 * sizeof (short) / sizeof (int) + 160,
462 18 + 768 * sizeof (short) / sizeof (int) + 160,
463 18 + 768 * sizeof (short) / sizeof (int) + 160,
464 18 + 768 * sizeof (short) / sizeof (int) + 160,
465 18 + 768 * sizeof (short) / sizeof (int) + 1424,
466 -1,
467 -1,
468 -1,
469 -1,
470 -1,
471 -1,
472 -1,
473 -1,
474 -1,
475 -1,
476 -1,
477 -1,
478 -1,
479 -1,
480 -1,
481 -1,
482 -1,
483 -1,
484 -1,
485 -1,
486 -1,
487 -1,
488 -1,
489 -1,
490 -1,
491 -1,
492 -1,
493 -1,
494 -1,
495 -1,
496 -1,
497 -1,
498 -1,
499 -1,
500 -1,
501 -1,
502 -1,
503 -1,
504 -1,
505 -1,
506 -1,
507 -1,
508 -1,
509 -1,
510 -1,
511 -1,
512 -1,
513 -1,
514 -1,
515 -1,
516 -1,
517 -1,
518 -1,
519 -1,
520 -1,
521 -1,
522 -1,
523 -1,
524 -1,
525 -1,
526 -1,
527 -1,
528 -1,
529 -1,
530 -1,
531 -1,
532 -1,
533 -1,
534 -1,
535 -1,
536 -1,
537 -1,
538 -1,
539 -1,
540 -1,
541 -1,
542 -1,
543 -1,
544 -1,
545 -1,
546 -1,
547 -1,
548 -1,
549 -1,
550 -1,
551 -1,
552 -1,
553 -1,
554 -1,
555 -1,
556 -1,
557 -1,
558 -1,
559 -1,
560 -1,
561 -1,
562 -1,
563 -1,
564 -1,
565 -1,
566 -1,
567 18 + 768 * sizeof (short) / sizeof (int) + 1440,
568 -1,
569 -1,
570 -1,
571 -1,
572 -1,
573 -1,
574 -1,
575 -1,
576 -1,
577 -1,
578 -1,
579 -1,
580 -1,
581 -1,
582 -1,
583 -1,
584 -1,
585 -1,
586 -1,
587 -1,
588 -1,
589 -1,
590 -1,
591 -1,
592 -1,
593 -1,
594 -1,
595 -1,
596 -1,
597 -1,
598 -1,
599 -1,
600 -1,
601 -1,
602 -1,
603 -1,
604 -1,
605 -1,
606 -1,
607 -1,
608 -1,
609 -1,
610 -1,
611 -1,
612 -1,
613 -1,
614 -1,
615 -1,
616 -1,
617 -1,
618 -1,
619 -1,
620 -1,
621 -1,
622 -1,
623 -1,
624 -1,
625 -1,
626 -1,
627 -1,
628 -1,
629 -1,
630 -1,
631 -1,
632 -1,
633 -1,
634 -1,
635 -1,
636 -1,
637 -1,
638 -1,
639 -1,
640 -1,
641 -1,
642 -1,
643 -1,
644 -1,
645 -1,
646 -1,
647 -1,
648 -1,
649 -1,
650 -1,
651 -1,
652 -1,
653 -1,
654 -1,
655 -1,
656 -1,
657 -1,
658 -1,
659 -1,
660 -1,
661 -1,
662 -1,
663 -1,
664 -1,
665 -1,
666 -1,
667 -1,
668 -1,
669 -1,
670 -1,
671 -1,
672 -1,
673 -1,
674 -1,
675 -1,
676 -1,
677 -1,
678 -1,
679 -1,
680 -1,
681 -1,
682 -1,
683 -1,
684 -1,
685 -1,
686 -1,
687 -1,
688 -1,
689 -1,
690 -1,
691 -1,
692 -1,
693 -1,
694 -1,
695 18 + 768 * sizeof (short) / sizeof (int) + 160,
696 18 + 768 * sizeof (short) / sizeof (int) + 160,
697 18 + 768 * sizeof (short) / sizeof (int) + 160,
698 18 + 768 * sizeof (short) / sizeof (int) + 160,
699 18 + 768 * sizeof (short) / sizeof (int) + 160,
700 18 + 768 * sizeof (short) / sizeof (int) + 160,
701 18 + 768 * sizeof (short) / sizeof (int) + 160,
702 18 + 768 * sizeof (short) / sizeof (int) + 160,
703 18 + 768 * sizeof (short) / sizeof (int) + 160,
704 18 + 768 * sizeof (short) / sizeof (int) + 160,
705 18 + 768 * sizeof (short) / sizeof (int) + 160,
706 18 + 768 * sizeof (short) / sizeof (int) + 160,
707 18 + 768 * sizeof (short) / sizeof (int) + 160,
708 18 + 768 * sizeof (short) / sizeof (int) + 160,
709 18 + 768 * sizeof (short) / sizeof (int) + 160,
710 18 + 768 * sizeof (short) / sizeof (int) + 160,
711 18 + 768 * sizeof (short) / sizeof (int) + 160,
712 18 + 768 * sizeof (short) / sizeof (int) + 160,
713 18 + 768 * sizeof (short) / sizeof (int) + 160,
714 18 + 768 * sizeof (short) / sizeof (int) + 160,
715 18 + 768 * sizeof (short) / sizeof (int) + 160,
716 18 + 768 * sizeof (short) / sizeof (int) + 160,
717 18 + 768 * sizeof (short) / sizeof (int) + 160,
718 18 + 768 * sizeof (short) / sizeof (int) + 160,
719 18 + 768 * sizeof (short) / sizeof (int) + 160,
720 18 + 768 * sizeof (short) / sizeof (int) + 160,
721 18 + 768 * sizeof (short) / sizeof (int) + 160,
722 18 + 768 * sizeof (short) / sizeof (int) + 160,
723 18 + 768 * sizeof (short) / sizeof (int) + 160,
724 18 + 768 * sizeof (short) / sizeof (int) + 160,
725 18 + 768 * sizeof (short) / sizeof (int) + 160,
726 18 + 768 * sizeof (short) / sizeof (int) + 160,
727 18 + 768 * sizeof (short) / sizeof (int) + 160,
728 18 + 768 * sizeof (short) / sizeof (int) + 160,
729 18 + 768 * sizeof (short) / sizeof (int) + 160,
730 18 + 768 * sizeof (short) / sizeof (int) + 160,
731 18 + 768 * sizeof (short) / sizeof (int) + 160,
732 18 + 768 * sizeof (short) / sizeof (int) + 160,
733 18 + 768 * sizeof (short) / sizeof (int) + 160,
734 18 + 768 * sizeof (short) / sizeof (int) + 160,
735 18 + 768 * sizeof (short) / sizeof (int) + 160,
736 18 + 768 * sizeof (short) / sizeof (int) + 160,
737 18 + 768 * sizeof (short) / sizeof (int) + 160,
738 18 + 768 * sizeof (short) / sizeof (int) + 160,
739 18 + 768 * sizeof (short) / sizeof (int) + 160,
740 18 + 768 * sizeof (short) / sizeof (int) + 160,
741 18 + 768 * sizeof (short) / sizeof (int) + 160,
742 18 + 768 * sizeof (short) / sizeof (int) + 160,
743 18 + 768 * sizeof (short) / sizeof (int) + 160,
744 18 + 768 * sizeof (short) / sizeof (int) + 160,
745 18 + 768 * sizeof (short) / sizeof (int) + 160,
746 18 + 768 * sizeof (short) / sizeof (int) + 160,
747 18 + 768 * sizeof (short) / sizeof (int) + 160,
748 18 + 768 * sizeof (short) / sizeof (int) + 160,
749 18 + 768 * sizeof (short) / sizeof (int) + 160,
750 18 + 768 * sizeof (short) / sizeof (int) + 160,
751 18 + 768 * sizeof (short) / sizeof (int) + 160,
752 18 + 768 * sizeof (short) / sizeof (int) + 160,
753 18 + 768 * sizeof (short) / sizeof (int) + 160,
754 18 + 768 * sizeof (short) / sizeof (int) + 160,
755 18 + 768 * sizeof (short) / sizeof (int) + 160,
756 18 + 768 * sizeof (short) / sizeof (int) + 160,
757 18 + 768 * sizeof (short) / sizeof (int) + 160,
758 18 + 768 * sizeof (short) / sizeof (int) + 160,
759 18 + 768 * sizeof (short) / sizeof (int) + 160,
760 18 + 768 * sizeof (short) / sizeof (int) + 160,
761 18 + 768 * sizeof (short) / sizeof (int) + 160,
762 18 + 768 * sizeof (short) / sizeof (int) + 160,
763 18 + 768 * sizeof (short) / sizeof (int) + 160,
764 18 + 768 * sizeof (short) / sizeof (int) + 160,
765 18 + 768 * sizeof (short) / sizeof (int) + 160,
766 18 + 768 * sizeof (short) / sizeof (int) + 160,
767 18 + 768 * sizeof (short) / sizeof (int) + 160,
768 18 + 768 * sizeof (short) / sizeof (int) + 160,
769 18 + 768 * sizeof (short) / sizeof (int) + 160,
770 18 + 768 * sizeof (short) / sizeof (int) + 160,
771 18 + 768 * sizeof (short) / sizeof (int) + 160,
772 18 + 768 * sizeof (short) / sizeof (int) + 160,
773 18 + 768 * sizeof (short) / sizeof (int) + 160,
774 18 + 768 * sizeof (short) / sizeof (int) + 160,
775 18 + 768 * sizeof (short) / sizeof (int) + 160,
776 18 + 768 * sizeof (short) / sizeof (int) + 160,
777 18 + 768 * sizeof (short) / sizeof (int) + 160,
778 18 + 768 * sizeof (short) / sizeof (int) + 160,
779 18 + 768 * sizeof (short) / sizeof (int) + 160,
780 18 + 768 * sizeof (short) / sizeof (int) + 160,
781 18 + 768 * sizeof (short) / sizeof (int) + 160,
782 18 + 768 * sizeof (short) / sizeof (int) + 160,
783 18 + 768 * sizeof (short) / sizeof (int) + 160,
784 18 + 768 * sizeof (short) / sizeof (int) + 160,
785 18 + 768 * sizeof (short) / sizeof (int) + 160,
786 18 + 768 * sizeof (short) / sizeof (int) + 160,
787 18 + 768 * sizeof (short) / sizeof (int) + 160,
788 18 + 768 * sizeof (short) / sizeof (int) + 160,
789 18 + 768 * sizeof (short) / sizeof (int) + 160,
790 18 + 768 * sizeof (short) / sizeof (int) + 160,
791 18 + 768 * sizeof (short) / sizeof (int) + 160,
792 18 + 768 * sizeof (short) / sizeof (int) + 160,
793 18 + 768 * sizeof (short) / sizeof (int) + 160,
794 18 + 768 * sizeof (short) / sizeof (int) + 160,
795 18 + 768 * sizeof (short) / sizeof (int) + 160,
796 18 + 768 * sizeof (short) / sizeof (int) + 160,
797 18 + 768 * sizeof (short) / sizeof (int) + 160,
798 18 + 768 * sizeof (short) / sizeof (int) + 160,
799 18 + 768 * sizeof (short) / sizeof (int) + 160,
800 18 + 768 * sizeof (short) / sizeof (int) + 160,
801 18 + 768 * sizeof (short) / sizeof (int) + 160,
802 18 + 768 * sizeof (short) / sizeof (int) + 160,
803 18 + 768 * sizeof (short) / sizeof (int) + 160,
804 18 + 768 * sizeof (short) / sizeof (int) + 160,
805 18 + 768 * sizeof (short) / sizeof (int) + 160,
806 18 + 768 * sizeof (short) / sizeof (int) + 160,
807 18 + 768 * sizeof (short) / sizeof (int) + 160,
808 18 + 768 * sizeof (short) / sizeof (int) + 160,
809 18 + 768 * sizeof (short) / sizeof (int) + 160,
810 18 + 768 * sizeof (short) / sizeof (int) + 160,
811 18 + 768 * sizeof (short) / sizeof (int) + 160,
812 18 + 768 * sizeof (short) / sizeof (int) + 160,
813 18 + 768 * sizeof (short) / sizeof (int) + 160,
814 18 + 768 * sizeof (short) / sizeof (int) + 160,
815 18 + 768 * sizeof (short) / sizeof (int) + 160,
816 18 + 768 * sizeof (short) / sizeof (int) + 160,
817 18 + 768 * sizeof (short) / sizeof (int) + 160,
818 18 + 768 * sizeof (short) / sizeof (int) + 160,
819 18 + 768 * sizeof (short) / sizeof (int) + 160,
820 18 + 768 * sizeof (short) / sizeof (int) + 160,
821 18 + 768 * sizeof (short) / sizeof (int) + 160,
822 18 + 768 * sizeof (short) / sizeof (int) + 1456
823 },
824 {
825 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x7FFFFFFFU,
826 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
827 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
828 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
829 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
830 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
831 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFCFFFFFFU,
832 0xFFFFD7F0U, 0xFFFFFFFBU, 0xFFFFFFFFU, 0xFFFFFFFFU,
833 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
834 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
835 0xFFFFFFFFU, 0xFFFEFFFFU, 0xFE7FFFFFU, 0xFFFFFFFFU,
836 0xFFFEE7FFU, 0xFFFFFFFFU, 0xFFFF00FFU, 0x001F87FFU,
837 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
838 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
839 0xFFFFBFFFU, 0xFFFFFFFFU, 0xFFFFE7FFU, 0xFFFFFFFFU,
840 0xFFFFFFFFU, 0x0003FFFFU, 0xFFFFFFFFU, 0xE7FFFFFFU,
841 0xFFFFFFFFU, 0x7FFF3FFFU, 0x4FFFFFFFU, 0xFFFF07FFU,
842 0xFF83FFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
843 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
844 0xFFF99FEFU, 0xF3C5FDFFU, 0xB080799FU, 0x7FFFFFCFU,
845 0xFFF987EEU, 0xD36DFDFFU, 0x5E023987U, 0x007FFFC0U,
846 0xFFFBBFEEU, 0xF3EDFDFFU, 0x00013BBFU, 0xFE03FFCFU,
847 0xFFF99FEEU, 0xF3EDFDFFU, 0xB0E0399FU, 0x00FFFFCFU,
848 0xD63DC7ECU, 0xC3FFC718U, 0x00813DC7U, 0x07FFFFC0U,
849 0xFFFDDFFFU, 0xF3FFFDFFU, 0x37603DDFU, 0xFF80FFCFU,
850 0xFFFDDFFFU, 0xF3EFFDFFU, 0x70603DDFU, 0x000EFFCFU,
851 0xFFFDDFFFU, 0xFFFFFFFFU, 0xFFF0FDDFU, 0xFFFFFFCFU,
852 0xFC7FFFEEU, 0x2FFBFFFFU, 0xFF5F847FU, 0x001CFFC0U,
853 0xFFFFFFFEU, 0x87FFFFFFU, 0x0FFFFFFFU, 0x00000000U,
854 0xFFFFF7D6U, 0x3FFFFFAFU, 0xF3FF7F5FU, 0x00000000U,
855 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFEFFU, 0xFFFE1FFFU,
856 0xFEFFFFFFU, 0xDFFFFFFFU, 0x07FFDFFFU, 0x00000000U,
857 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
858 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF20BFU, 0xFFFFFFFFU,
859 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
860 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
861 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3D7F3DFFU, 0xFFFFFFFFU,
862 0xFFFF3DFFU, 0x7F3DFFFFU, 0xFF7FFF3DU, 0xFFFFFFFFU,
863 0xFF3DFFFFU, 0xFFFFFFFFU, 0xE7FFFFFFU, 0x1FFFFFFFU,
864 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3F3FFFFFU,
865 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
866 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
867 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
868 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
869 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
870 0x1FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFFFFFU,
871 0x803FFFFFU, 0x007FFFFFU, 0x000FFFFFU, 0x000DDFFFU,
872 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x03FF03FFU,
873 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x01FFFFFFU,
874 0xFFFFFFFFU, 0xFFFF07FFU, 0xFFFFFFFFU, 0x003FFFFFU,
875 0x7FFFFFFFU, 0x0FFF0FFFU, 0xFFFFFFF1U, 0x001F3FFFU,
876 0xFFFFFFFFU, 0xFFFF0FFFU, 0xC7FF03FFU, 0xFFFFFFFFU,
877 0xCFFFFFFFU, 0xFFFFFFFFU, 0x7FFFFFFFU, 0x9FFFFFFFU,
878 0x03FF03FFU, 0xFFFF3FFFU, 0x3FFFFFFFU, 0x00000FFFU,
879 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFDFFFU, 0xFFFFFFFFU,
880 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF00FFFFFU,
881 0xFFFFFFFFU, 0xF8FFFFFFU, 0xFFFFE3FFU, 0xFFFFFFFFU,
882 0xFFFF07FFU, 0xE7FFFFFFU, 0xFFFF00FFU, 0x07FFFFFFU,
883 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
884 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
885 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
886 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
887 0x3F3FFFFFU, 0xFFFFFFFFU, 0xAAFF3F3FU, 0x3FFFFFFFU,
888 0xFFFFFFFFU, 0xFFDFFFFFU, 0xEFCFFFDFU, 0x7FDCFFFFU,
889 0xFFFFFFFFU, 0xFFFFFCFFU, 0xFFFFFFFFU, 0xFFF3FFDFU,
890 0x1FFF7FFFU, 0xFFFFFFFFU, 0xFFFF0003U, 0x0001FFFFU,
891 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
892 0xFFFF0FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
893 0xFFFFFFFFU, 0x000003FFU, 0x000007FFU, 0xFFFFFFFFU,
894 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
895 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
896 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
897 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
898 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
899 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFCFFFFFU,
900 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
901 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
902 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFE0FFFFFU,
903 0xFFFFFFFFU, 0xFFFF20BFU, 0xFFFFFFFFU, 0x800180FFU,
904 0x007FFFFFU, 0x7F7F7F7FU, 0x7F7F7F7FU, 0xFFFFFFFFU,
905 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x00000000U,
906 0xFBFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000FFFFFU,
907 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
908 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0xFFFF0000U,
909 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFEU, 0xFFFFFFFFU,
910 0xFE7FFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
911 0xFFFFFFE0U, 0xFFFEFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
912 0xFFFF7FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF803FU,
913 0x7FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
914 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
915 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
916 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
917 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
918 0xFFFF1FFFU, 0xFFFFFFFFU, 0xFFFF007FU, 0xFFFFFFFFU,
919 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
920 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
921 0xFFFFFFFFU, 0x00000FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
922 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU,
923 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
924 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFFFFFFU, 0xFFFE0000U,
925 0xFFFFFFFFU, 0x03FF1FFFU, 0xFFFFFFFFU, 0x00FFFFFFU,
926 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFC03FU, 0xFFFFFFFFU,
927 0xFFFFFFFFU, 0xFFFFFFFFU, 0x800FFFFFU, 0x1FFFFFFFU,
928 0xFFFFFFFFU, 0xFFFFFFFFU, 0xC3FFBFFFU, 0x7FFFFFFFU,
929 0xFFFFFFFFU, 0x007FFFFFU, 0xF3FF3FFFU, 0xFFFFFFFFU,
930 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF8000007U, 0x007FFFFFU,
931 0x007E7E7EU, 0xFFFF7F7FU, 0xFFFFFFFFU, 0xFFFF0FFFU,
932 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF3FFFU,
933 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
934 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
935 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
936 0xFFFFFFFFU, 0xFFFF000FU, 0xFFFFF87FU, 0x0FFFFFFFU,
937 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF3FFFU,
938 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00000000U,
939 0xE0F8007FU, 0x5F7FFFFFU, 0xFFFFFFDBU, 0xFFFFFFFFU,
940 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
941 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
942 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
943 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
944 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU, 0xFFFF0000U,
945 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFF7FFFFU, 0xFFDF0F7FU,
946 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x9FFFFFFFU,
947 0xFFFFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
948 0xFFFFFFFFU, 0x7FFFFFFFU, 0x1CFCFCFCU, 0x3E007F7FU,
949 0xFFFFEFFFU, 0xB7FFFF7FU, 0x3FFF3FFFU, 0x00000000U,
950 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU,
951 0xFFFFFF87U, 0xFF8FFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
952 0x1FFF7FFFU, 0x00000001U, 0xFFFF0000U, 0x3FFFFFFFU,
953 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
954 0x1FFFFFFFU, 0xFFFFFFFFU, 0x0001FFFFU, 0x0FFFFFFFU,
955 0xFFFFFFFFU, 0xFFFFE00FU, 0xFFFF07FFU, 0x07FFFFFFU,
956 0xBFFFFFFFU, 0xFFFFFFFFU, 0x003FFF0FU, 0x00000000U,
957 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
958 0x3FFFFFFFU, 0xFFFF03FFU, 0xFF0FFFFFU, 0x0FFFFFFFU,
959 0xFFFFFFFFU, 0xFFFF00FFU, 0xFFFFFFFFU, 0xF7FF800FU,
960 0xFFB7F7FFU, 0x1BFBFFFBU, 0xFFFFFFFFU, 0x000FFFFFU,
961 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
962 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
963 0xFFFFFFFFU, 0x007FFFFFU, 0x003FFFFFU, 0x000000FFU,
964 0xFFFFFFBFU, 0x07FDFFFFU, 0x00000000U, 0x00000000U,
965 0xFFFFFD3FU, 0x91BFFFFFU, 0xFFBFFFFFU, 0xFFFFFFFFU,
966 0x7FFFFFFFU, 0x0000FF80U, 0x00000000U, 0xF837FFFFU,
967 0x8FFFFFFFU, 0x83FFFFFFU, 0x03FFFFFFU, 0x00000000U,
968 0xFFFFFFFFU, 0xF0FFFFFFU, 0xFFFCFFFFU, 0xFFFFFFFFU,
969 0xFEEFF06FU, 0x873FFFFFU, 0x01FF01FFU, 0xFFFFFFFFU,
970 0xFFFFFFFFU, 0x00000000U, 0xFFFFFFFFU, 0x007FF87FU,
971 0xFFFFFFFFU, 0xFE3FFFFFU, 0xFF3FFFFFU, 0xFF07FFFFU,
972 0x1E03FFFFU, 0x0000FE00U, 0x00000000U, 0x00000000U,
973 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000001FFU, 0x00000000U,
974 0xFFFFFFFFU, 0x0007FFFFU, 0xFFFFFFFFU, 0xFC07FFFFU,
975 0xFFFFFFFFU, 0x03FF00FFU, 0xFFFFFFFFU, 0xFFFFFE3FU,
976 0x0000C03FU, 0x00000000U, 0x00000000U, 0x00000000U,
977 0x00000000U, 0x00000000U, 0x00000000U, 0x7FFFFFFFU,
978 0xFFFFFFFFU, 0x00033BFFU, 0x01FF00FCU, 0xFC000000U,
979 0xFFFFFFFFU, 0xFFFF00FFU, 0x03FFFFFFU, 0xFFFF0000U,
980 0x000003FFU, 0xFFFF0000U, 0x00000FFFU, 0x007FFFFFU,
981 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFC3FFFU, 0x803FFFFFU,
982 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF2007U, 0x03FF01FFU,
983 0xFFFFFFFFU, 0xFFDFFFFFU, 0xFFFF00FFU, 0x007FFFFFU,
984 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x001FFFFEU,
985 0xFFFBFFFFU, 0xFFFFFFFFU, 0x00000003U, 0x00000000U,
986 0xBFFFBD7FU, 0xFFFF03FFU, 0xFFFFFFFFU, 0x03FF07FFU,
987 0xFFF99FEFU, 0xFBEDFDFFU, 0xE081399FU, 0x001F1FCFU,
988 0xFFFF4BFFU, 0xFFBFFFFFU, 0x01BFF7A5U, 0x00000006U,
989 0xFFFFFFFFU, 0xFFFFFFFFU, 0xEFFFFFFFU, 0x00000003U,
990 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF00FFU, 0x00000000U,
991 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
992 0xFFFFFFFFU, 0xFF3FFFFFU, 0x3FFFFFFFU, 0x00000000U,
993 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF001FU, 0x00001FFFU,
994 0xFFFFFFFFU, 0x03FFFFFFU, 0xFFFF03FFU, 0x0000000FU,
995 0xE7FFFFFFU, 0xFFFF0FFFU, 0x0000007FU, 0x00000000U,
996 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
997 0xFFFFFFFFU, 0x0FFFFFFFU, 0x00000000U, 0x00000000U,
998 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x8007FFFFU,
999 0xFF6FF27FU, 0xF9BFFFFFU, 0x03FF007FU, 0x00000000U,
1000 0x00000000U, 0xFFFFFCFFU, 0xFCFFFFFFU, 0x0000001FU,
1001 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF00FFU, 0xFFFFFFFFU,
1002 0xFFFFFFFFU, 0xFFFF0007U, 0xFFFFFFFFU, 0x01FFFFFFU,
1003 0x000003FFU, 0x00000000U, 0x00000000U, 0x000000FFU,
1004 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x03FF0003U,
1005 0xFFFFFDFFU, 0xFF7FFFFFU, 0xFFFF003FU, 0xFFFF1FFFU,
1006 0xFFFCFFFFU, 0x007FFEFFU, 0x00000000U, 0x00000000U,
1007 0xFFFFFB7FU, 0xB47FFFFFU, 0x03FF00FFU, 0xFFFFFDBFU,
1008 0x01FB7FFFU, 0xFFFF03FFU, 0x0FFFFFFFU, 0x000003FFU,
1009 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1010 0x00000000U, 0x00000000U, 0x00000000U, 0x01FFFFFFU,
1011 0xFFFDFFFFU, 0xC7FFFFFFU, 0x07FFFFFFU, 0x00000000U,
1012 0x00000000U, 0x00010000U, 0xFFFFFFFFU, 0x8003FFFFU,
1013 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1014 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1015 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1016 0x03FFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
1017 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x001F7FFFU,
1018 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1019 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U,
1020 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1021 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1022 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1023 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1024 0xFFFF0000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0007FFFFU,
1025 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0xFFFFFFFFU,
1026 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1027 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1028 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1029 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1030 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1031 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1032 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU,
1033 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000007FU, 0x00000000U,
1034 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1035 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1036 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1037 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1038 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1039 0xFFFFFFFFU, 0x03FFFFFFU, 0x00000000U, 0x00000000U,
1040 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1041 0xFFFFFFFFU, 0x01FFFFFFU, 0x7FFFFFFFU, 0xFFFFC3FFU,
1042 0xFFFFFFFFU, 0x7FFFFFFFU, 0xFFFF03FFU, 0x003F3FFFU,
1043 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFBFF003FU, 0xE0FFFFFBU,
1044 0x0000FFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
1045 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1046 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1047 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x03FFFFFFU,
1048 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1049 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU,
1050 0x07FFFFFFU, 0xF9FFFFFFU, 0x000FFFFFU, 0x00000000U,
1051 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF87FFU, 0xFFFFFFFFU,
1052 0xFFFF80FFU, 0x00000000U, 0x00000000U, 0x007F001FU,
1053 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1054 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x80000000U,
1055 0x7FFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
1056 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0007FFFFU,
1057 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1058 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1059 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1060 0x00000000U, 0x00000000U, 0x00000000U, 0x6FEF0000U,
1061 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1062 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1063 0xFFFFFFFFU, 0x00040007U, 0x00270000U, 0xFFFF00F0U,
1064 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1065 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1066 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0FFFFFFFU,
1067 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1068 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1069 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFF07FFU,
1070 0xF3FF01FFU, 0x0000000FU, 0x00000000U, 0x00000000U,
1071 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1072 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1073 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1074 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFFFFFFU,
1075 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1076 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1077 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1078 0xFFFFFFFFU, 0xFC0FFFFFU, 0x0001FFFFU, 0x0001FFFFU,
1079 0xFFFFFFFFU, 0xFFFF3FFFU, 0xFFFF007FU, 0xFFFFFFFFU,
1080 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U,
1081 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1082 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU,
1083 0xFFFFFFFFU, 0xFFFFFE7FU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1084 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000007FFU,
1085 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000003FU, 0x00000000U,
1086 0x00000000U, 0x00000000U, 0x000FFFFFU, 0x000FFFFFU,
1087 0xFFFFFFFFU, 0xFFFFFFFFU, 0x007FFFFFU, 0x01FFFFFFU,
1088 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1089 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFDFFFFFU, 0xFFFFFFFFU,
1090 0xDFFFFFFFU, 0xEBFFDE64U, 0xFFFFFFEFU, 0xFFFFFFFFU,
1091 0xDFDFE7BFU, 0x7BFFFFFFU, 0xFFFDFC5FU, 0xFFFFFFFFU,
1092 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1093 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1094 0xFFFFFFFFU, 0xFFFFFF3FU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1095 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1096 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFCFFFU, 0xFFFFFFFFU,
1097 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1098 0xF8000FFFU, 0x0000FFFEU, 0x00000000U, 0x00000000U,
1099 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1100 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1101 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1102 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1103 0x7FFFFFFFU, 0x000007E0U, 0x00000000U, 0x00000000U,
1104 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1105 0xF9FFFF7FU, 0xFFFF07DBU, 0xFFFFFFFFU, 0x00003FFFU,
1106 0x00008000U, 0x00000000U, 0x00000000U, 0x00000000U,
1107 0xFFFFFFFFU, 0x3FFF1FFFU, 0x0000C3FFU, 0x00000000U,
1108 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1109 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1110 0xFFFF0000U, 0x00007FFFU, 0xFFFFFFFFU, 0x83FFFFFFU,
1111 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1112 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1113 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1114 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x03FFFFFFU,
1115 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1116 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x87FFFFFFU,
1117 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1118 0x00000000U, 0x00000000U, 0x7FFFFFFFU, 0xC03FFFFFU,
1119 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1120 0x00000000U, 0x00000000U, 0x00000000U, 0x7FFF6F7FU,
1121 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1122 0xFFFFFFFFU, 0xFFFFFFFFU, 0x007FFF9FU, 0x00000000U,
1123 0xFFFFFFFFU, 0xFFFFFFFFU, 0xC3FF0FFFU, 0x00000000U,
1124 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1125 0x00000000U, 0x00000000U, 0x00000000U, 0xFFFE0000U,
1126 0xFFFFFFFFU, 0x001FFFFFU, 0x00000000U, 0x00000000U,
1127 0xFFFFFFFEU, 0x3FFFFFFFU, 0x00000000U, 0x00000000U,
1128 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1129 0xFFFFFFEFU, 0x0AF7FE96U, 0xAA96EA84U, 0x5EF7F796U,
1130 0x0FFFFBFFU, 0x0FFFFBEEU, 0x00000000U, 0x00030000U,
1131 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1132 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1133 0xFFFFFFFFU, 0xFFFF0FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1134 0x000FFFFFU, 0xFFFE7FFFU, 0xFFFEFFFEU, 0x003FFFFFU,
1135 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1136 0xFFFFFFFFU, 0x00003FFFU, 0x00000000U, 0xFFFFFFC0U,
1137 0xFFFF0007U, 0x0FFFFFFFU, 0x000301FFU, 0x0000003FU,
1138 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1139 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1140 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1141 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1142 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF1FFFFFFU, 0x1FFF1FFFU,
1143 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1144 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00010FFFU,
1145 0xFFFF0FFFU, 0xFFFFFFFFU, 0x03FF00FFU, 0xFFFFFFFFU,
1146 0xFFFF00FFU, 0x0FFF3FFFU, 0x01FF0003U, 0x00000000U,
1147 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1148 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1149 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU, 0x1FFF3FFFU,
1150 0xFFFFC7FFU, 0xFFFFFFFFU, 0x9FFFE17FU, 0x01FF87FFU,
1151 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1152 0xFFF7FFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x07FFFFFFU,
1153 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1154 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U,
1155 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1156 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1157 0x3FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1158 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1159 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1160 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1161 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1162 0xFFFFFFFFU, 0xFFFF3FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1163 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1164 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1165 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1166 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1167 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1168 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF0001U,
1169 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x00000000U,
1170 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1171 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1172 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1173 0x3FFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
1174 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1175 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1176 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1177 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1178 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1179 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF07FFU, 0xFFFFFFFFU,
1180 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1181 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU,
1182 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1183 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1184 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1185 0x00000002U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1186 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1187 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1188 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU,
1189 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1190 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1191 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1192 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU
1193 }
1194};
diff --git a/gl/unictype/ctype_punct.c b/gl/unictype/ctype_punct.c
new file mode 100644
index 00000000..3c30ba70
--- /dev/null
+++ b/gl/unictype/ctype_punct.c
@@ -0,0 +1,32 @@
1/* ISO C <ctype.h> like properties of Unicode characters.
2 Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2002.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#include <config.h>
19
20/* Specification. */
21#include "unictype.h"
22
23#include "bitmap.h"
24
25/* Define u_is_punct table. */
26#include "ctype_punct.h"
27
28bool
29uc_is_punct (ucs4_t uc)
30{
31 return bitmap_lookup (&u_is_punct, uc);
32}
diff --git a/gl/unictype/ctype_punct.h b/gl/unictype/ctype_punct.h
new file mode 100644
index 00000000..28fc905e
--- /dev/null
+++ b/gl/unictype/ctype_punct.h
@@ -0,0 +1,874 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* ISO C <ctype.h> like properties of Unicode characters. */
3/* Generated automatically by gen-uni-tables.c for Unicode 17.0.0. */
4
5/* Copyright (C) 2000-2025 Free Software Foundation, Inc.
6
7 This file is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
11
12 This file is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19
20#define header_0 16
21#define header_2 9
22#define header_3 127
23#define header_4 15
24static const
25struct
26 {
27 int header[1];
28 int level1[17];
29 short level2[4 << 7];
30 unsigned int level3[76 << 4];
31 }
32u_is_punct =
33{
34 { 17 },
35 {
36 18 * sizeof (int) / sizeof (short) + 0,
37 18 * sizeof (int) / sizeof (short) + 128,
38 -1,
39 -1,
40 -1,
41 -1,
42 -1,
43 -1,
44 -1,
45 -1,
46 -1,
47 -1,
48 -1,
49 -1,
50 18 * sizeof (int) / sizeof (short) + 256,
51 18 * sizeof (int) / sizeof (short) + 384,
52 18 * sizeof (int) / sizeof (short) + 384
53 },
54 {
55 18 + 512 * sizeof (short) / sizeof (int) + 0,
56 18 + 512 * sizeof (short) / sizeof (int) + 16,
57 18 + 512 * sizeof (short) / sizeof (int) + 32,
58 18 + 512 * sizeof (short) / sizeof (int) + 48,
59 18 + 512 * sizeof (short) / sizeof (int) + 64,
60 18 + 512 * sizeof (short) / sizeof (int) + 80,
61 18 + 512 * sizeof (short) / sizeof (int) + 96,
62 18 + 512 * sizeof (short) / sizeof (int) + 112,
63 18 + 512 * sizeof (short) / sizeof (int) + 128,
64 18 + 512 * sizeof (short) / sizeof (int) + 144,
65 18 + 512 * sizeof (short) / sizeof (int) + 160,
66 18 + 512 * sizeof (short) / sizeof (int) + 176,
67 18 + 512 * sizeof (short) / sizeof (int) + 192,
68 18 + 512 * sizeof (short) / sizeof (int) + 208,
69 18 + 512 * sizeof (short) / sizeof (int) + 224,
70 18 + 512 * sizeof (short) / sizeof (int) + 240,
71 18 + 512 * sizeof (short) / sizeof (int) + 256,
72 18 + 512 * sizeof (short) / sizeof (int) + 272,
73 18 + 512 * sizeof (short) / sizeof (int) + 288,
74 18 + 512 * sizeof (short) / sizeof (int) + 272,
75 18 + 512 * sizeof (short) / sizeof (int) + 272,
76 18 + 512 * sizeof (short) / sizeof (int) + 304,
77 18 + 512 * sizeof (short) / sizeof (int) + 320,
78 18 + 512 * sizeof (short) / sizeof (int) + 336,
79 18 + 512 * sizeof (short) / sizeof (int) + 352,
80 18 + 512 * sizeof (short) / sizeof (int) + 368,
81 -1,
82 -1,
83 -1,
84 -1,
85 -1,
86 -1,
87 -1,
88 -1,
89 -1,
90 -1,
91 -1,
92 -1,
93 18 + 512 * sizeof (short) / sizeof (int) + 384,
94 -1,
95 -1,
96 -1,
97 -1,
98 -1,
99 -1,
100 -1,
101 -1,
102 -1,
103 -1,
104 -1,
105 -1,
106 -1,
107 -1,
108 -1,
109 -1,
110 -1,
111 -1,
112 -1,
113 -1,
114 -1,
115 -1,
116 -1,
117 -1,
118 -1,
119 -1,
120 -1,
121 -1,
122 -1,
123 -1,
124 -1,
125 -1,
126 -1,
127 -1,
128 -1,
129 -1,
130 -1,
131 -1,
132 -1,
133 -1,
134 -1,
135 -1,
136 -1,
137 18 + 512 * sizeof (short) / sizeof (int) + 400,
138 18 + 512 * sizeof (short) / sizeof (int) + 416,
139 18 + 512 * sizeof (short) / sizeof (int) + 432,
140 18 + 512 * sizeof (short) / sizeof (int) + 448,
141 -1,
142 -1,
143 -1,
144 -1,
145 -1,
146 -1,
147 -1,
148 -1,
149 -1,
150 -1,
151 -1,
152 -1,
153 -1,
154 -1,
155 -1,
156 -1,
157 -1,
158 -1,
159 -1,
160 -1,
161 -1,
162 -1,
163 -1,
164 -1,
165 -1,
166 -1,
167 18 + 512 * sizeof (short) / sizeof (int) + 272,
168 18 + 512 * sizeof (short) / sizeof (int) + 272,
169 18 + 512 * sizeof (short) / sizeof (int) + 272,
170 18 + 512 * sizeof (short) / sizeof (int) + 272,
171 18 + 512 * sizeof (short) / sizeof (int) + 272,
172 18 + 512 * sizeof (short) / sizeof (int) + 272,
173 18 + 512 * sizeof (short) / sizeof (int) + 272,
174 18 + 512 * sizeof (short) / sizeof (int) + 272,
175 18 + 512 * sizeof (short) / sizeof (int) + 272,
176 18 + 512 * sizeof (short) / sizeof (int) + 272,
177 18 + 512 * sizeof (short) / sizeof (int) + 272,
178 18 + 512 * sizeof (short) / sizeof (int) + 272,
179 18 + 512 * sizeof (short) / sizeof (int) + 464,
180 18 + 512 * sizeof (short) / sizeof (int) + 480,
181 18 + 512 * sizeof (short) / sizeof (int) + 496,
182 18 + 512 * sizeof (short) / sizeof (int) + 512,
183 18 + 512 * sizeof (short) / sizeof (int) + 528,
184 18 + 512 * sizeof (short) / sizeof (int) + 544,
185 18 + 512 * sizeof (short) / sizeof (int) + 560,
186 -1,
187 18 + 512 * sizeof (short) / sizeof (int) + 576,
188 18 + 512 * sizeof (short) / sizeof (int) + 592,
189 18 + 512 * sizeof (short) / sizeof (int) + 608,
190 18 + 512 * sizeof (short) / sizeof (int) + 624,
191 18 + 512 * sizeof (short) / sizeof (int) + 640,
192 18 + 512 * sizeof (short) / sizeof (int) + 656,
193 18 + 512 * sizeof (short) / sizeof (int) + 672,
194 18 + 512 * sizeof (short) / sizeof (int) + 688,
195 18 + 512 * sizeof (short) / sizeof (int) + 704,
196 18 + 512 * sizeof (short) / sizeof (int) + 720,
197 18 + 512 * sizeof (short) / sizeof (int) + 736,
198 18 + 512 * sizeof (short) / sizeof (int) + 752,
199 -1,
200 -1,
201 18 + 512 * sizeof (short) / sizeof (int) + 768,
202 -1,
203 -1,
204 -1,
205 -1,
206 18 + 512 * sizeof (short) / sizeof (int) + 784,
207 -1,
208 -1,
209 18 + 512 * sizeof (short) / sizeof (int) + 800,
210 -1,
211 -1,
212 -1,
213 -1,
214 -1,
215 -1,
216 -1,
217 -1,
218 -1,
219 -1,
220 -1,
221 -1,
222 -1,
223 -1,
224 -1,
225 -1,
226 -1,
227 -1,
228 -1,
229 -1,
230 -1,
231 18 + 512 * sizeof (short) / sizeof (int) + 816,
232 -1,
233 -1,
234 -1,
235 -1,
236 18 + 512 * sizeof (short) / sizeof (int) + 832,
237 18 + 512 * sizeof (short) / sizeof (int) + 848,
238 18 + 512 * sizeof (short) / sizeof (int) + 864,
239 -1,
240 -1,
241 -1,
242 -1,
243 -1,
244 -1,
245 -1,
246 -1,
247 -1,
248 -1,
249 -1,
250 -1,
251 -1,
252 -1,
253 -1,
254 -1,
255 -1,
256 -1,
257 -1,
258 -1,
259 -1,
260 -1,
261 -1,
262 -1,
263 -1,
264 -1,
265 -1,
266 -1,
267 -1,
268 -1,
269 -1,
270 -1,
271 -1,
272 -1,
273 -1,
274 -1,
275 -1,
276 -1,
277 18 + 512 * sizeof (short) / sizeof (int) + 880,
278 -1,
279 -1,
280 -1,
281 -1,
282 -1,
283 -1,
284 -1,
285 18 + 512 * sizeof (short) / sizeof (int) + 896,
286 18 + 512 * sizeof (short) / sizeof (int) + 912,
287 18 + 512 * sizeof (short) / sizeof (int) + 928,
288 18 + 512 * sizeof (short) / sizeof (int) + 944,
289 -1,
290 18 + 512 * sizeof (short) / sizeof (int) + 960,
291 18 + 512 * sizeof (short) / sizeof (int) + 272,
292 18 + 512 * sizeof (short) / sizeof (int) + 976,
293 -1,
294 -1,
295 18 + 512 * sizeof (short) / sizeof (int) + 992,
296 18 + 512 * sizeof (short) / sizeof (int) + 1008,
297 18 + 512 * sizeof (short) / sizeof (int) + 1024,
298 18 + 512 * sizeof (short) / sizeof (int) + 1040,
299 18 + 512 * sizeof (short) / sizeof (int) + 1056,
300 -1,
301 18 + 512 * sizeof (short) / sizeof (int) + 1072,
302 18 + 512 * sizeof (short) / sizeof (int) + 1088,
303 18 + 512 * sizeof (short) / sizeof (int) + 1104,
304 18 + 512 * sizeof (short) / sizeof (int) + 1120,
305 18 + 512 * sizeof (short) / sizeof (int) + 272,
306 18 + 512 * sizeof (short) / sizeof (int) + 1136,
307 18 + 512 * sizeof (short) / sizeof (int) + 1152,
308 18 + 512 * sizeof (short) / sizeof (int) + 1168,
309 -1,
310 -1,
311 18 + 512 * sizeof (short) / sizeof (int) + 1184,
312 -1,
313 -1,
314 -1,
315 -1,
316 -1,
317 -1,
318 -1,
319 -1,
320 -1,
321 -1,
322 -1,
323 -1,
324 -1,
325 -1,
326 -1,
327 -1,
328 -1,
329 -1,
330 -1,
331 -1,
332 -1,
333 -1,
334 -1,
335 -1,
336 -1,
337 -1,
338 -1,
339 -1,
340 -1,
341 -1,
342 -1,
343 -1,
344 -1,
345 -1,
346 -1,
347 -1,
348 -1,
349 -1,
350 -1,
351 -1,
352 -1,
353 -1,
354 -1,
355 -1,
356 -1,
357 -1,
358 -1,
359 -1,
360 -1,
361 -1,
362 -1,
363 -1,
364 -1,
365 -1,
366 -1,
367 -1,
368 -1,
369 -1,
370 -1,
371 -1,
372 -1,
373 -1,
374 -1,
375 -1,
376 -1,
377 -1,
378 -1,
379 -1,
380 -1,
381 -1,
382 -1,
383 -1,
384 -1,
385 -1,
386 -1,
387 -1,
388 -1,
389 -1,
390 -1,
391 -1,
392 -1,
393 -1,
394 -1,
395 -1,
396 -1,
397 -1,
398 -1,
399 -1,
400 -1,
401 -1,
402 -1,
403 -1,
404 -1,
405 -1,
406 -1,
407 -1,
408 -1,
409 -1,
410 -1,
411 -1,
412 -1,
413 -1,
414 -1,
415 -1,
416 -1,
417 -1,
418 -1,
419 -1,
420 -1,
421 -1,
422 -1,
423 -1,
424 -1,
425 -1,
426 -1,
427 -1,
428 -1,
429 -1,
430 -1,
431 -1,
432 -1,
433 -1,
434 -1,
435 -1,
436 -1,
437 -1,
438 -1,
439 18 + 512 * sizeof (short) / sizeof (int) + 272,
440 18 + 512 * sizeof (short) / sizeof (int) + 272,
441 18 + 512 * sizeof (short) / sizeof (int) + 272,
442 18 + 512 * sizeof (short) / sizeof (int) + 272,
443 18 + 512 * sizeof (short) / sizeof (int) + 272,
444 18 + 512 * sizeof (short) / sizeof (int) + 272,
445 18 + 512 * sizeof (short) / sizeof (int) + 272,
446 18 + 512 * sizeof (short) / sizeof (int) + 272,
447 18 + 512 * sizeof (short) / sizeof (int) + 272,
448 18 + 512 * sizeof (short) / sizeof (int) + 272,
449 18 + 512 * sizeof (short) / sizeof (int) + 272,
450 18 + 512 * sizeof (short) / sizeof (int) + 272,
451 18 + 512 * sizeof (short) / sizeof (int) + 272,
452 18 + 512 * sizeof (short) / sizeof (int) + 272,
453 18 + 512 * sizeof (short) / sizeof (int) + 272,
454 18 + 512 * sizeof (short) / sizeof (int) + 272,
455 18 + 512 * sizeof (short) / sizeof (int) + 272,
456 18 + 512 * sizeof (short) / sizeof (int) + 272,
457 18 + 512 * sizeof (short) / sizeof (int) + 272,
458 18 + 512 * sizeof (short) / sizeof (int) + 272,
459 18 + 512 * sizeof (short) / sizeof (int) + 272,
460 18 + 512 * sizeof (short) / sizeof (int) + 272,
461 18 + 512 * sizeof (short) / sizeof (int) + 272,
462 18 + 512 * sizeof (short) / sizeof (int) + 272,
463 18 + 512 * sizeof (short) / sizeof (int) + 272,
464 18 + 512 * sizeof (short) / sizeof (int) + 272,
465 18 + 512 * sizeof (short) / sizeof (int) + 272,
466 18 + 512 * sizeof (short) / sizeof (int) + 272,
467 18 + 512 * sizeof (short) / sizeof (int) + 272,
468 18 + 512 * sizeof (short) / sizeof (int) + 272,
469 18 + 512 * sizeof (short) / sizeof (int) + 272,
470 18 + 512 * sizeof (short) / sizeof (int) + 272,
471 18 + 512 * sizeof (short) / sizeof (int) + 272,
472 18 + 512 * sizeof (short) / sizeof (int) + 272,
473 18 + 512 * sizeof (short) / sizeof (int) + 272,
474 18 + 512 * sizeof (short) / sizeof (int) + 272,
475 18 + 512 * sizeof (short) / sizeof (int) + 272,
476 18 + 512 * sizeof (short) / sizeof (int) + 272,
477 18 + 512 * sizeof (short) / sizeof (int) + 272,
478 18 + 512 * sizeof (short) / sizeof (int) + 272,
479 18 + 512 * sizeof (short) / sizeof (int) + 272,
480 18 + 512 * sizeof (short) / sizeof (int) + 272,
481 18 + 512 * sizeof (short) / sizeof (int) + 272,
482 18 + 512 * sizeof (short) / sizeof (int) + 272,
483 18 + 512 * sizeof (short) / sizeof (int) + 272,
484 18 + 512 * sizeof (short) / sizeof (int) + 272,
485 18 + 512 * sizeof (short) / sizeof (int) + 272,
486 18 + 512 * sizeof (short) / sizeof (int) + 272,
487 18 + 512 * sizeof (short) / sizeof (int) + 272,
488 18 + 512 * sizeof (short) / sizeof (int) + 272,
489 18 + 512 * sizeof (short) / sizeof (int) + 272,
490 18 + 512 * sizeof (short) / sizeof (int) + 272,
491 18 + 512 * sizeof (short) / sizeof (int) + 272,
492 18 + 512 * sizeof (short) / sizeof (int) + 272,
493 18 + 512 * sizeof (short) / sizeof (int) + 272,
494 18 + 512 * sizeof (short) / sizeof (int) + 272,
495 18 + 512 * sizeof (short) / sizeof (int) + 272,
496 18 + 512 * sizeof (short) / sizeof (int) + 272,
497 18 + 512 * sizeof (short) / sizeof (int) + 272,
498 18 + 512 * sizeof (short) / sizeof (int) + 272,
499 18 + 512 * sizeof (short) / sizeof (int) + 272,
500 18 + 512 * sizeof (short) / sizeof (int) + 272,
501 18 + 512 * sizeof (short) / sizeof (int) + 272,
502 18 + 512 * sizeof (short) / sizeof (int) + 272,
503 18 + 512 * sizeof (short) / sizeof (int) + 272,
504 18 + 512 * sizeof (short) / sizeof (int) + 272,
505 18 + 512 * sizeof (short) / sizeof (int) + 272,
506 18 + 512 * sizeof (short) / sizeof (int) + 272,
507 18 + 512 * sizeof (short) / sizeof (int) + 272,
508 18 + 512 * sizeof (short) / sizeof (int) + 272,
509 18 + 512 * sizeof (short) / sizeof (int) + 272,
510 18 + 512 * sizeof (short) / sizeof (int) + 272,
511 18 + 512 * sizeof (short) / sizeof (int) + 272,
512 18 + 512 * sizeof (short) / sizeof (int) + 272,
513 18 + 512 * sizeof (short) / sizeof (int) + 272,
514 18 + 512 * sizeof (short) / sizeof (int) + 272,
515 18 + 512 * sizeof (short) / sizeof (int) + 272,
516 18 + 512 * sizeof (short) / sizeof (int) + 272,
517 18 + 512 * sizeof (short) / sizeof (int) + 272,
518 18 + 512 * sizeof (short) / sizeof (int) + 272,
519 18 + 512 * sizeof (short) / sizeof (int) + 272,
520 18 + 512 * sizeof (short) / sizeof (int) + 272,
521 18 + 512 * sizeof (short) / sizeof (int) + 272,
522 18 + 512 * sizeof (short) / sizeof (int) + 272,
523 18 + 512 * sizeof (short) / sizeof (int) + 272,
524 18 + 512 * sizeof (short) / sizeof (int) + 272,
525 18 + 512 * sizeof (short) / sizeof (int) + 272,
526 18 + 512 * sizeof (short) / sizeof (int) + 272,
527 18 + 512 * sizeof (short) / sizeof (int) + 272,
528 18 + 512 * sizeof (short) / sizeof (int) + 272,
529 18 + 512 * sizeof (short) / sizeof (int) + 272,
530 18 + 512 * sizeof (short) / sizeof (int) + 272,
531 18 + 512 * sizeof (short) / sizeof (int) + 272,
532 18 + 512 * sizeof (short) / sizeof (int) + 272,
533 18 + 512 * sizeof (short) / sizeof (int) + 272,
534 18 + 512 * sizeof (short) / sizeof (int) + 272,
535 18 + 512 * sizeof (short) / sizeof (int) + 272,
536 18 + 512 * sizeof (short) / sizeof (int) + 272,
537 18 + 512 * sizeof (short) / sizeof (int) + 272,
538 18 + 512 * sizeof (short) / sizeof (int) + 272,
539 18 + 512 * sizeof (short) / sizeof (int) + 272,
540 18 + 512 * sizeof (short) / sizeof (int) + 272,
541 18 + 512 * sizeof (short) / sizeof (int) + 272,
542 18 + 512 * sizeof (short) / sizeof (int) + 272,
543 18 + 512 * sizeof (short) / sizeof (int) + 272,
544 18 + 512 * sizeof (short) / sizeof (int) + 272,
545 18 + 512 * sizeof (short) / sizeof (int) + 272,
546 18 + 512 * sizeof (short) / sizeof (int) + 272,
547 18 + 512 * sizeof (short) / sizeof (int) + 272,
548 18 + 512 * sizeof (short) / sizeof (int) + 272,
549 18 + 512 * sizeof (short) / sizeof (int) + 272,
550 18 + 512 * sizeof (short) / sizeof (int) + 272,
551 18 + 512 * sizeof (short) / sizeof (int) + 272,
552 18 + 512 * sizeof (short) / sizeof (int) + 272,
553 18 + 512 * sizeof (short) / sizeof (int) + 272,
554 18 + 512 * sizeof (short) / sizeof (int) + 272,
555 18 + 512 * sizeof (short) / sizeof (int) + 272,
556 18 + 512 * sizeof (short) / sizeof (int) + 272,
557 18 + 512 * sizeof (short) / sizeof (int) + 272,
558 18 + 512 * sizeof (short) / sizeof (int) + 272,
559 18 + 512 * sizeof (short) / sizeof (int) + 272,
560 18 + 512 * sizeof (short) / sizeof (int) + 272,
561 18 + 512 * sizeof (short) / sizeof (int) + 272,
562 18 + 512 * sizeof (short) / sizeof (int) + 272,
563 18 + 512 * sizeof (short) / sizeof (int) + 272,
564 18 + 512 * sizeof (short) / sizeof (int) + 272,
565 18 + 512 * sizeof (short) / sizeof (int) + 272,
566 18 + 512 * sizeof (short) / sizeof (int) + 1200
567 },
568 {
569 0x00000000U, 0xFC00FFFEU, 0xF8000001U, 0x78000001U,
570 0x00000000U, 0xFBDFFBFFU, 0x00800000U, 0x00800000U,
571 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
572 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
573 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
574 0x00000000U, 0x00000000U, 0xFFFC003CU, 0xFFFFAFE0U,
575 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFDFU, 0x4020FFFFU,
576 0x000000B0U, 0x00000000U, 0x00000000U, 0x00400000U,
577 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
578 0x000003FCU, 0x00000000U, 0x00000000U, 0x00000000U,
579 0x00000000U, 0x00000000U, 0xFC000000U, 0x00000000U,
580 0xFFFEE600U, 0xFFFFFFFFU, 0x000000FFU, 0x00180000U,
581 0xFFFFFFFFU, 0x00000000U, 0xFFFFF800U, 0x00013C00U,
582 0x00000000U, 0x00000000U, 0xFFD00000U, 0x60003F9FU,
583 0x0002BFFFU, 0xFFFF0000U, 0x000007FFU, 0x00000000U,
584 0x00000000U, 0x0001FFC0U, 0x00000000U, 0xE3CFF800U,
585 0xFBC00000U, 0x7FFF3EEFU, 0x4E000000U, 0x00000000U,
586 0xFF830100U, 0x00000000U, 0xFFFFFC00U, 0xFFFFFFFFU,
587 0x0000000FU, 0xDC000000U, 0x00FEFFFFU, 0x0001003CU,
588 0x0000000EU, 0xD0000000U, 0x0080399FU, 0x6FFC000CU,
589 0x0000000EU, 0xD0000000U, 0x00023987U, 0x00630000U,
590 0x0000000EU, 0xD0000000U, 0x00003BBFU, 0xFC03000CU,
591 0x0000000EU, 0xD0000000U, 0x00E0399FU, 0x00FD000CU,
592 0x00000004U, 0xC0000000U, 0x00803DC7U, 0x07FF0000U,
593 0x0000001FU, 0xD0000000U, 0x00603DDFU, 0xFF80000CU,
594 0x0000001EU, 0xD0000000U, 0x00603DDFU, 0x0008000CU,
595 0x0000000FU, 0xD8000000U, 0x7F80BDDFU, 0x03FF000CU,
596 0x0000000EU, 0x00000000U, 0xFF5F8400U, 0x001C0000U,
597 0x00000000U, 0x80008000U, 0x0C008040U, 0x00000000U,
598 0x00000000U, 0x1FF20000U, 0x00007F00U, 0x00000000U,
599 0xFFFFFFFEU, 0xFFFFFC00U, 0x00000000U, 0xFFFE0000U,
600 0xFEFFE0FFU, 0xDFFFFFFFU, 0x07FFDFFFU, 0x00000000U,
601 0x00000000U, 0x7FFFF800U, 0xC3C0FC00U, 0x001E3F9DU,
602 0xFC00BFFCU, 0x00000000U, 0x00000000U, 0x08000000U,
603 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
604 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
605 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
606 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
607 0x00000000U, 0x00000000U, 0xE0000000U, 0x1FFFFFFFU,
608 0x03FF0000U, 0x00000000U, 0x00000000U, 0x00000000U,
609 0x00000001U, 0x00000000U, 0x00000000U, 0x00000000U,
610 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
611 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
612 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
613 0x00000000U, 0x00000000U, 0x00000000U, 0x00006000U,
614 0x18000000U, 0x00000000U, 0x00000000U, 0x00003800U,
615 0x003C0000U, 0x007C0000U, 0x000C0000U, 0x000C0000U,
616 0x00000000U, 0xFFF00000U, 0x2F7FFFFFU, 0x03FF0000U,
617 0x0000FFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
618 0x00000060U, 0x00000200U, 0x00000000U, 0x00000000U,
619 0x00000000U, 0x0FFF0FFFU, 0x00000031U, 0x00000000U,
620 0x00000000U, 0x00000000U, 0xC4000000U, 0xFFFFFFFFU,
621 0xCF800000U, 0x00000000U, 0x7FE00000U, 0x9FFFFFFFU,
622 0x00000000U, 0xFFFF3F7FU, 0x3FFFFFFFU, 0x00000FFFU,
623 0x0000001FU, 0xFFF00000U, 0xFC00C01FU, 0xFFFFFFFFU,
624 0x00000007U, 0x00003FFEU, 0x00000000U, 0xF00FFFC0U,
625 0x00000000U, 0xF8FFFFF0U, 0x00000000U, 0xC0000000U,
626 0x00000000U, 0x00000000U, 0xFFFF00FFU, 0x039021FFU,
627 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
628 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU,
629 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
630 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
631 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
632 0x00000000U, 0xA0000000U, 0xE000E003U, 0x6000E000U,
633 0xFFFFF880U, 0xFFFFFCFFU, 0x7FFFFFFFU, 0x7FF1FFDFU,
634 0x00007FFFU, 0xFFFFFFFFU, 0xFFFF0003U, 0x0001FFFFU,
635 0xC1D0037BU, 0x0C0040AFU, 0xFFFFBC1FU, 0x00000000U,
636 0xFFFF0E00U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
637 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
638 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
639 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
640 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
641 0xFFFFFFFFU, 0x000003FFU, 0x000007FFU, 0xFFFFFFFFU,
642 0x0FFFFFFFU, 0x00000000U, 0x00000000U, 0xFFFFFC00U,
643 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
644 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
645 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
646 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
647 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFCFFFFFU,
648 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
649 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
650 0x00000000U, 0x00000000U, 0x00000000U, 0xFE0387E0U,
651 0x00000000U, 0x00000000U, 0x00000000U, 0x80010000U,
652 0x00000000U, 0x00000000U, 0x00000000U, 0xFFFFFFFFU,
653 0xFFFFFFFFU, 0xFFFF7FFFU, 0x3FFFFFFFU, 0x00000000U,
654 0xFBFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000FFFFFU,
655 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
656 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0xFFFF0000U,
657 0xFFFFFF1EU, 0xE0C1FC01U, 0x00000000U, 0x00000000U,
658 0x1E000000U, 0x00000001U, 0x00000000U, 0x08000000U,
659 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
660 0xFFFF0000U, 0x00000000U, 0xFFFFFFFFU, 0x0000803FU,
661 0x7FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
662 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
663 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
664 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
665 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
666 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
667 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
668 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU,
669 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
670 0xFFFF0000U, 0xFFFFFFFFU, 0x0000007FU, 0xC0000000U,
671 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
672 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
673 0x0000E000U, 0x00000000U, 0x00000000U, 0x7FFF8000U,
674 0xC0000000U, 0x00000000U, 0x00000000U, 0x00FF0000U,
675 0x007FFFFFU, 0x00000003U, 0x00000000U, 0x00000000U,
676 0x00000600U, 0x00000000U, 0x00000000U, 0x00000000U,
677 0x00000844U, 0x03FF1FF8U, 0x00000000U, 0x00F00000U,
678 0x00000003U, 0xFFF00000U, 0x0000C03FU, 0x9703FFFFU,
679 0x00000000U, 0x0000FFC0U, 0x800FFF80U, 0x00000000U,
680 0x0000000FU, 0xFFF80000U, 0xC0003FFFU, 0x00000020U,
681 0x00000000U, 0x007FFE00U, 0xF0003008U, 0x3B800000U,
682 0x00000000U, 0xC19D0000U, 0xC0000002U, 0x0063F800U,
683 0x00000000U, 0x00000000U, 0x08000000U, 0x00000C00U,
684 0x00000000U, 0x00000000U, 0x00000000U, 0x00003FF8U,
685 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
686 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
687 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
688 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
689 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
690 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
691 0x40000000U, 0x00000200U, 0x00000000U, 0x00000000U,
692 0x00000000U, 0xFFFC0000U, 0x0007FFFFU, 0x00000000U,
693 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
694 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
695 0x00000000U, 0xC0000000U, 0x0000FFFFU, 0x00000000U,
696 0x00030000U, 0x00000000U, 0x0000FF00U, 0xF0000000U,
697 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFF7FFFFU, 0x00000F7FU,
698 0x00000000U, 0x00000000U, 0x00000000U, 0x80000000U,
699 0xFC00FFFEU, 0xF8000001U, 0xF8000001U, 0x0000003FU,
700 0x00000000U, 0x00000000U, 0x00000000U, 0x3E007F7FU,
701 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
702 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
703 0xFFFFFF87U, 0xFF8FFFFFU, 0x00000000U, 0xFFE00000U,
704 0x1FFF7FFFU, 0x00000001U, 0xFFFF0000U, 0x3FFFFFFFU,
705 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
706 0x00000000U, 0x00000000U, 0x00000000U, 0x0FFFFFFFU,
707 0x00000000U, 0x0000000FU, 0x00000000U, 0x07C00000U,
708 0x80000000U, 0x00000000U, 0x00010000U, 0x00000000U,
709 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
710 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
711 0x00000000U, 0x00000000U, 0x00000000U, 0x00008000U,
712 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
713 0x00000000U, 0x00000000U, 0xFF800000U, 0xFF800000U,
714 0x00000000U, 0x0000FF80U, 0x00000000U, 0xF8000000U,
715 0x8FC00000U, 0x80000000U, 0x00000000U, 0x00000000U,
716 0x00000000U, 0x30000000U, 0xFFFCFFFFU, 0xFFFFFFFFU,
717 0x0000F06EU, 0x87000000U, 0x01FF01FFU, 0xE0000000U,
718 0xE0000000U, 0x00000000U, 0x00000100U, 0x007FF860U,
719 0x00000000U, 0xFE000000U, 0xFF000000U, 0xFF000000U,
720 0x1E000000U, 0x0000FE00U, 0x00000000U, 0x00000000U,
721 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
722 0x00000000U, 0x00000000U, 0x00000000U, 0xFC000000U,
723 0x00000000U, 0x000000F0U, 0x00000000U, 0x00007E00U,
724 0x0000C000U, 0x00000000U, 0x00000000U, 0x00000000U,
725 0x00000000U, 0x00000000U, 0x00000000U, 0x7FFFFFFFU,
726 0x00000000U, 0x00003800U, 0x01FF0000U, 0xFC000000U,
727 0xE0000000U, 0x0000007FU, 0x03FFFFC0U, 0x00000000U,
728 0x000003FCU, 0x00000000U, 0x00000FE0U, 0x00000000U,
729 0x00000007U, 0xFF000000U, 0xFFFC3FFFU, 0x8019003FU,
730 0x00000007U, 0xFFFF0000U, 0x00002007U, 0x00000000U,
731 0x00000007U, 0x001FFF80U, 0x0000006FU, 0x00380000U,
732 0x00000007U, 0xFFF80000U, 0xE800FFE1U, 0x001FFFFEU,
733 0x00000000U, 0x7FFFF000U, 0x00000002U, 0x00000000U,
734 0x00000000U, 0x00000200U, 0x80000000U, 0x000007FFU,
735 0x0000000FU, 0xD8000000U, 0x0080399FU, 0x001F1FCCU,
736 0x00000000U, 0xFF000000U, 0x01B5F7A5U, 0x00000006U,
737 0x00000000U, 0xFFE00000U, 0x6C00F87FU, 0x00000000U,
738 0x00000000U, 0xFFFF0000U, 0x0000004FU, 0x00000000U,
739 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
740 0x00000000U, 0xFF3F8000U, 0x30FFFFFFU, 0x00000000U,
741 0x00000000U, 0xFFFF0000U, 0x0000000FU, 0x00001FFFU,
742 0x00000000U, 0x02FFF800U, 0x00000000U, 0x00000000U,
743 0xE0000000U, 0xFC000FFFU, 0x00000000U, 0x00000000U,
744 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
745 0x00000000U, 0x0FFFF000U, 0x00000000U, 0x00000000U,
746 0x00000000U, 0x00000000U, 0x00000000U, 0x0007FC00U,
747 0x00000000U, 0x79BF0000U, 0x0000007DU, 0x00000000U,
748 0x00000000U, 0x00000000U, 0xFCFE0000U, 0x00000015U,
749 0x000007FEU, 0xFBF80000U, 0x0FFE00FFU, 0x00000000U,
750 0xDFFFFC00U, 0x00000007U, 0x00000000U, 0x00000000U,
751 0x000003FFU, 0x00000000U, 0x00000000U, 0x000000FFU,
752 0x00000000U, 0x00000000U, 0x00000000U, 0x00000002U,
753 0x00000000U, 0xFF7F8000U, 0xFC00003EU, 0x00031FFFU,
754 0xFFFC0000U, 0x007FFEFFU, 0x00000000U, 0x00000000U,
755 0x00000000U, 0xB47E0000U, 0x000000BFU, 0x00000000U,
756 0x00FB7C00U, 0x00000000U, 0x00000000U, 0x00000000U,
757 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
758 0x00000000U, 0x00000000U, 0x00000000U, 0x01F80000U,
759 0x0000000BU, 0xC7F00000U, 0x0400FFFFU, 0x00000000U,
760 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x8003FFFFU,
761 0x00000000U, 0x00000000U, 0x00000000U, 0x001F0000U,
762 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
763 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
764 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
765 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
766 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
767 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
768 0x00000000U, 0x00000000U, 0x00000000U, 0x00060000U,
769 0x00000000U, 0xFFFF0000U, 0x003FFF81U, 0x00000000U,
770 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
771 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
772 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
773 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
774 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
775 0xC0000000U, 0x0000FFFFU, 0x00000000U, 0x00000000U,
776 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
777 0x00000000U, 0x00000000U, 0x00000000U, 0x0000C000U,
778 0x00000000U, 0x00000000U, 0x00000000U, 0x003F0000U,
779 0x00000000U, 0xFFFF0000U, 0xF8000030U, 0x00000003U,
780 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
781 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
782 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
783 0x00000000U, 0x00000000U, 0x00000000U, 0x0000E000U,
784 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
785 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
786 0x07FFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
787 0x00000000U, 0x00000000U, 0xFFFE8000U, 0xFFFFFFFFU,
788 0x000780FFU, 0x00000000U, 0x00000000U, 0x00030014U,
789 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
790 0xF0000000U, 0x0000000FU, 0x00000000U, 0x00000000U,
791 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
792 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
793 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
794 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x1C000000U,
795 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
796 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
797 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
798 0xFFFFFFFFU, 0xFC0FFFFFU, 0x0001FFFFU, 0x0001FFFFU,
799 0xFFFFFFFFU, 0xFFFF3FFFU, 0xFFFF007FU, 0xFFFFFFFFU,
800 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U,
801 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
802 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU,
803 0xFFFFFFFFU, 0xFFFFFE7FU, 0xFFFFFFFFU, 0xFFFFFFFFU,
804 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000007FFU,
805 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000003FU, 0x00000000U,
806 0x00000000U, 0x00000000U, 0x000FFFFFU, 0x000FFFFFU,
807 0xFFFFFFFFU, 0xFFFFFFFFU, 0x007FFFFFU, 0x01FFFFFFU,
808 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
809 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
810 0x00000000U, 0x00000000U, 0x08000002U, 0x08000000U,
811 0x00200000U, 0x00200000U, 0x00008000U, 0x00008000U,
812 0x00000200U, 0x00000200U, 0x00000008U, 0x00000000U,
813 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
814 0xF8000FFFU, 0x0000FFFEU, 0x00000000U, 0x00000000U,
815 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
816 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
817 0xF9FFFF7FU, 0x000007DBU, 0x00000000U, 0x00000000U,
818 0x00008000U, 0x00000000U, 0x00000000U, 0x00000000U,
819 0x00000000U, 0x007F0000U, 0x00008000U, 0x00000000U,
820 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
821 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
822 0x00000000U, 0x00004000U, 0x00000000U, 0x8000F000U,
823 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
824 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
825 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
826 0x00000000U, 0x00000000U, 0x00000000U, 0x0000F000U,
827 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
828 0x00000000U, 0x00000000U, 0x00000000U, 0x8000C000U,
829 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
830 0x00000000U, 0x00000000U, 0x00000000U, 0x0020C048U,
831 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
832 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
833 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
834 0x00000000U, 0x00000000U, 0x007FFF80U, 0x00000000U,
835 0x00000000U, 0x00000000U, 0xC00007F0U, 0x00000000U,
836 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
837 0x00000000U, 0x00000000U, 0x00000000U, 0xFFFE0000U,
838 0xFFFFFFFFU, 0x001FFFFFU, 0x00000000U, 0x00000000U,
839 0xFFFFFFFEU, 0x3FFFFFFFU, 0x00000000U, 0x00000000U,
840 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
841 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
842 0x00000000U, 0x00000000U, 0x00000000U, 0x00030000U,
843 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
844 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
845 0xFFFFFFFFU, 0xFFFF0FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
846 0x000FFFFFU, 0xFFFE7FFFU, 0xFFFEFFFEU, 0x003FFFFFU,
847 0x0000FFFFU, 0x0000E000U, 0x0000FC00U, 0x0000FC00U,
848 0xFFFFF800U, 0x00003FDFU, 0x00000000U, 0x00000000U,
849 0xFFFF0007U, 0x0FFFFFFFU, 0x000301FFU, 0x0000003FU,
850 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
851 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
852 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
853 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
854 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF1FFFFFFU, 0x1FFF1FFFU,
855 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
856 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00010FFFU,
857 0xFFFF0FFFU, 0xFFFFFFFFU, 0x03FF00FFU, 0xFFFFFFFFU,
858 0xFFFF00FFU, 0x0FFF3FFFU, 0x01FF0003U, 0x00000000U,
859 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
860 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
861 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU, 0x1FFF3FFFU,
862 0xFFFFC7FFU, 0xFFFFFFFFU, 0x9FFFE17FU, 0x01FF87FFU,
863 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
864 0xFFF7FFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0400FFFFU,
865 0x00000002U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
866 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
867 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
868 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU,
869 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
870 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
871 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
872 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU
873 }
874};
diff --git a/gl/unictype/ctype_space.c b/gl/unictype/ctype_space.c
new file mode 100644
index 00000000..ee9ce3fd
--- /dev/null
+++ b/gl/unictype/ctype_space.c
@@ -0,0 +1,32 @@
1/* ISO C <ctype.h> like properties of Unicode characters.
2 Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2002.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#include <config.h>
19
20/* Specification. */
21#include "unictype.h"
22
23#include "bitmap.h"
24
25/* Define u_is_space table. */
26#include "ctype_space.h"
27
28bool
29uc_is_space (ucs4_t uc)
30{
31 return bitmap_lookup (&u_is_space, uc);
32}
diff --git a/gl/unictype/ctype_space.h b/gl/unictype/ctype_space.h
new file mode 100644
index 00000000..1a72bd6d
--- /dev/null
+++ b/gl/unictype/ctype_space.h
@@ -0,0 +1,184 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* ISO C <ctype.h> like properties of Unicode characters. */
3/* Generated automatically by gen-uni-tables.c for Unicode 17.0.0. */
4
5/* Copyright (C) 2000-2025 Free Software Foundation, Inc.
6
7 This file is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
11
12 This file is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19
20#define header_0 16
21#define header_2 9
22#define header_3 127
23#define header_4 15
24static const
25struct
26 {
27 int header[1];
28 int level1[1];
29 short level2[1 << 7];
30 unsigned int level3[4 << 4];
31 }
32u_is_space =
33{
34 { 1 },
35 { 2 * sizeof (int) / sizeof (short) + 0 },
36 {
37 2 + 128 * sizeof (short) / sizeof (int) + 0,
38 -1,
39 -1,
40 -1,
41 -1,
42 -1,
43 -1,
44 -1,
45 -1,
46 -1,
47 -1,
48 2 + 128 * sizeof (short) / sizeof (int) + 16,
49 -1,
50 -1,
51 -1,
52 -1,
53 2 + 128 * sizeof (short) / sizeof (int) + 32,
54 -1,
55 -1,
56 -1,
57 -1,
58 -1,
59 -1,
60 -1,
61 2 + 128 * sizeof (short) / sizeof (int) + 48,
62 -1,
63 -1,
64 -1,
65 -1,
66 -1,
67 -1,
68 -1,
69 -1,
70 -1,
71 -1,
72 -1,
73 -1,
74 -1,
75 -1,
76 -1,
77 -1,
78 -1,
79 -1,
80 -1,
81 -1,
82 -1,
83 -1,
84 -1,
85 -1,
86 -1,
87 -1,
88 -1,
89 -1,
90 -1,
91 -1,
92 -1,
93 -1,
94 -1,
95 -1,
96 -1,
97 -1,
98 -1,
99 -1,
100 -1,
101 -1,
102 -1,
103 -1,
104 -1,
105 -1,
106 -1,
107 -1,
108 -1,
109 -1,
110 -1,
111 -1,
112 -1,
113 -1,
114 -1,
115 -1,
116 -1,
117 -1,
118 -1,
119 -1,
120 -1,
121 -1,
122 -1,
123 -1,
124 -1,
125 -1,
126 -1,
127 -1,
128 -1,
129 -1,
130 -1,
131 -1,
132 -1,
133 -1,
134 -1,
135 -1,
136 -1,
137 -1,
138 -1,
139 -1,
140 -1,
141 -1,
142 -1,
143 -1,
144 -1,
145 -1,
146 -1,
147 -1,
148 -1,
149 -1,
150 -1,
151 -1,
152 -1,
153 -1,
154 -1,
155 -1,
156 -1,
157 -1,
158 -1,
159 -1,
160 -1,
161 -1,
162 -1,
163 -1,
164 -1
165 },
166 {
167 0x00003E00U, 0x00000001U, 0x00000000U, 0x00000000U,
168 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
169 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
170 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
171 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
172 0x00000001U, 0x00000000U, 0x00000000U, 0x00000000U,
173 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
174 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
175 0x0000077FU, 0x00000300U, 0x80000000U, 0x00000000U,
176 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
177 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
178 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
179 0x00000001U, 0x00000000U, 0x00000000U, 0x00000000U,
180 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
181 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
182 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U
183 }
184};
diff --git a/gl/unictype/ctype_upper.c b/gl/unictype/ctype_upper.c
new file mode 100644
index 00000000..31210804
--- /dev/null
+++ b/gl/unictype/ctype_upper.c
@@ -0,0 +1,32 @@
1/* ISO C <ctype.h> like properties of Unicode characters.
2 Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2002.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#include <config.h>
19
20/* Specification. */
21#include "unictype.h"
22
23#include "bitmap.h"
24
25/* Define u_is_upper table. */
26#include "ctype_upper.h"
27
28bool
29uc_is_upper (ucs4_t uc)
30{
31 return bitmap_lookup (&u_is_upper, uc);
32}
diff --git a/gl/unictype/ctype_upper.h b/gl/unictype/ctype_upper.h
new file mode 100644
index 00000000..f0773306
--- /dev/null
+++ b/gl/unictype/ctype_upper.h
@@ -0,0 +1,367 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* ISO C <ctype.h> like properties of Unicode characters. */
3/* Generated automatically by gen-uni-tables.c for Unicode 17.0.0. */
4
5/* Copyright (C) 2000-2025 Free Software Foundation, Inc.
6
7 This file is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
11
12 This file is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19
20#define header_0 16
21#define header_2 9
22#define header_3 127
23#define header_4 15
24static const
25struct
26 {
27 int header[1];
28 int level1[2];
29 short level2[2 << 7];
30 unsigned int level3[17 << 4];
31 }
32u_is_upper =
33{
34 { 2 },
35 {
36 3 * sizeof (int) / sizeof (short) + 0,
37 3 * sizeof (int) / sizeof (short) + 128
38 },
39 {
40 3 + 256 * sizeof (short) / sizeof (int) + 0,
41 3 + 256 * sizeof (short) / sizeof (int) + 16,
42 3 + 256 * sizeof (short) / sizeof (int) + 32,
43 -1,
44 -1,
45 -1,
46 -1,
47 -1,
48 3 + 256 * sizeof (short) / sizeof (int) + 48,
49 3 + 256 * sizeof (short) / sizeof (int) + 64,
50 -1,
51 -1,
52 -1,
53 -1,
54 3 + 256 * sizeof (short) / sizeof (int) + 80,
55 3 + 256 * sizeof (short) / sizeof (int) + 96,
56 3 + 256 * sizeof (short) / sizeof (int) + 112,
57 -1,
58 3 + 256 * sizeof (short) / sizeof (int) + 128,
59 -1,
60 -1,
61 -1,
62 3 + 256 * sizeof (short) / sizeof (int) + 144,
63 -1,
64 -1,
65 -1,
66 -1,
67 -1,
68 -1,
69 -1,
70 -1,
71 -1,
72 -1,
73 -1,
74 -1,
75 -1,
76 -1,
77 -1,
78 -1,
79 -1,
80 -1,
81 -1,
82 -1,
83 -1,
84 -1,
85 -1,
86 -1,
87 -1,
88 -1,
89 -1,
90 -1,
91 -1,
92 -1,
93 -1,
94 -1,
95 -1,
96 -1,
97 -1,
98 -1,
99 -1,
100 -1,
101 -1,
102 -1,
103 -1,
104 -1,
105 -1,
106 -1,
107 -1,
108 -1,
109 -1,
110 -1,
111 -1,
112 -1,
113 -1,
114 -1,
115 -1,
116 -1,
117 -1,
118 -1,
119 -1,
120 -1,
121 -1,
122 -1,
123 3 + 256 * sizeof (short) / sizeof (int) + 160,
124 -1,
125 -1,
126 -1,
127 -1,
128 -1,
129 -1,
130 -1,
131 -1,
132 -1,
133 -1,
134 -1,
135 -1,
136 -1,
137 -1,
138 -1,
139 -1,
140 -1,
141 -1,
142 -1,
143 -1,
144 -1,
145 -1,
146 -1,
147 -1,
148 -1,
149 -1,
150 -1,
151 -1,
152 -1,
153 -1,
154 -1,
155 -1,
156 -1,
157 -1,
158 -1,
159 -1,
160 -1,
161 -1,
162 -1,
163 -1,
164 -1,
165 -1,
166 -1,
167 3 + 256 * sizeof (short) / sizeof (int) + 176,
168 -1,
169 -1,
170 3 + 256 * sizeof (short) / sizeof (int) + 192,
171 -1,
172 -1,
173 -1,
174 3 + 256 * sizeof (short) / sizeof (int) + 208,
175 -1,
176 -1,
177 -1,
178 -1,
179 -1,
180 3 + 256 * sizeof (short) / sizeof (int) + 224,
181 -1,
182 -1,
183 -1,
184 -1,
185 -1,
186 -1,
187 -1,
188 -1,
189 -1,
190 -1,
191 -1,
192 -1,
193 -1,
194 -1,
195 -1,
196 -1,
197 -1,
198 -1,
199 -1,
200 -1,
201 -1,
202 -1,
203 -1,
204 -1,
205 -1,
206 -1,
207 -1,
208 -1,
209 -1,
210 -1,
211 -1,
212 -1,
213 -1,
214 -1,
215 -1,
216 -1,
217 -1,
218 -1,
219 -1,
220 -1,
221 -1,
222 -1,
223 3 + 256 * sizeof (short) / sizeof (int) + 240,
224 -1,
225 -1,
226 -1,
227 -1,
228 -1,
229 -1,
230 -1,
231 -1,
232 -1,
233 -1,
234 -1,
235 -1,
236 -1,
237 -1,
238 -1,
239 -1,
240 -1,
241 -1,
242 -1,
243 -1,
244 -1,
245 -1,
246 -1,
247 -1,
248 -1,
249 -1,
250 -1,
251 -1,
252 -1,
253 -1,
254 -1,
255 -1,
256 -1,
257 -1,
258 -1,
259 -1,
260 -1,
261 -1,
262 -1,
263 -1,
264 -1,
265 -1,
266 -1,
267 -1,
268 -1,
269 -1,
270 -1,
271 -1,
272 -1,
273 -1,
274 -1,
275 -1,
276 -1,
277 -1,
278 -1,
279 -1,
280 -1,
281 -1,
282 -1,
283 -1,
284 3 + 256 * sizeof (short) / sizeof (int) + 256,
285 -1,
286 -1,
287 -1,
288 -1,
289 -1,
290 -1,
291 -1,
292 -1,
293 -1,
294 -1,
295 -1
296 },
297 {
298 0x00000000U, 0x00000000U, 0x07FFFFFEU, 0x00000000U,
299 0x00000000U, 0x00000000U, 0x7F7FFFFFU, 0x00000000U,
300 0x55555555U, 0xAA555555U, 0x555554AAU, 0x2B555555U,
301 0xB1DBCED6U, 0x11AED2D5U, 0x4AAAADB0U, 0x55D65555U,
302 0x55555555U, 0x6C055555U, 0x0000557AU, 0x00000000U,
303 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
304 0x00000000U, 0x00000000U, 0x00000000U, 0x80450000U,
305 0xFFFED740U, 0x00000FFBU, 0x55008000U, 0xE6905555U,
306 0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U, 0x55555555U,
307 0x55555401U, 0x55555555U, 0x55552AABU, 0x55555555U,
308 0x55555555U, 0xFFFE5555U, 0x007FFFFFU, 0x00000000U,
309 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
310 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
311 0x00000000U, 0xFFFFFFFFU, 0x000020BFU, 0x00000000U,
312 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
313 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
314 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
315 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
316 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
317 0x00000000U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU,
318 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
319 0xFFFF0200U, 0xE7FFFFFFU, 0x00000000U, 0x00000000U,
320 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
321 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
322 0x55555555U, 0x55555555U, 0x55555555U, 0x55555555U,
323 0x40155555U, 0x55555555U, 0x55555555U, 0x55555555U,
324 0x3F00FF00U, 0xFF00FF00U, 0xAA003F00U, 0x0000FF00U,
325 0xFF00FF00U, 0x1F00FF00U, 0x0F001F00U, 0x1F001F00U,
326 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
327 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
328 0x00000000U, 0x00040C40U, 0x00000000U, 0x0000FFFFU,
329 0x00000008U, 0x00000000U, 0x00000000U, 0x00000000U,
330 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
331 0x00000000U, 0xFFC00000U, 0x0000FFFFU, 0x00000000U,
332 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
333 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
334 0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U, 0xC025EA9DU,
335 0x55555555U, 0x55555555U, 0x55555555U, 0x00042805U,
336 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
337 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
338 0x00000000U, 0x00000000U, 0x55555555U, 0x00001555U,
339 0x05555555U, 0x00000000U, 0x00000000U, 0x00000000U,
340 0x00000000U, 0x55545554U, 0x55555555U, 0x6A005555U,
341 0x55452855U, 0x555F7D55U, 0x15555AF5U, 0x00200000U,
342 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
343 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
344 0x00000000U, 0x07FFFFFEU, 0x00000000U, 0x00000000U,
345 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
346 0xFFFFFFFFU, 0x000000FFU, 0x00000000U, 0x00000000U,
347 0x00000000U, 0xFFFF0000U, 0x000FFFFFU, 0x00000000U,
348 0x00000000U, 0x00000000U, 0x00000000U, 0xF7FF0000U,
349 0x0037F7FFU, 0x00000000U, 0x00000000U, 0x00000000U,
350 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
351 0xFFFFFFFFU, 0x0007FFFFU, 0x00000000U, 0x00000000U,
352 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x0000003FU,
353 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
354 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
355 0x00000000U, 0xFFFFFFFFU, 0x00000000U, 0x00000000U,
356 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
357 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
358 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x00000000U,
359 0x00000000U, 0x01FFFFFFU, 0x00000000U, 0x00000000U,
360 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
361 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
362 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
363 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
364 0xFFFFFFFFU, 0x00000003U, 0x00000000U, 0x00000000U,
365 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U
366 }
367};
diff --git a/gl/unictype/ctype_xdigit.c b/gl/unictype/ctype_xdigit.c
new file mode 100644
index 00000000..bea31a1b
--- /dev/null
+++ b/gl/unictype/ctype_xdigit.c
@@ -0,0 +1,32 @@
1/* ISO C <ctype.h> like properties of Unicode characters.
2 Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2002.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#include <config.h>
19
20/* Specification. */
21#include "unictype.h"
22
23#include "bitmap.h"
24
25/* Define u_is_xdigit table. */
26#include "ctype_xdigit.h"
27
28bool
29uc_is_xdigit (ucs4_t uc)
30{
31 return bitmap_lookup (&u_is_xdigit, uc);
32}
diff --git a/gl/unictype/ctype_xdigit.h b/gl/unictype/ctype_xdigit.h
new file mode 100644
index 00000000..508c3ed7
--- /dev/null
+++ b/gl/unictype/ctype_xdigit.h
@@ -0,0 +1,172 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* ISO C <ctype.h> like properties of Unicode characters. */
3/* Generated automatically by gen-uni-tables.c for Unicode 17.0.0. */
4
5/* Copyright (C) 2000-2025 Free Software Foundation, Inc.
6
7 This file is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
11
12 This file is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19
20#define header_0 16
21#define header_2 9
22#define header_3 127
23#define header_4 15
24static const
25struct
26 {
27 int header[1];
28 int level1[1];
29 short level2[1 << 7];
30 unsigned int level3[1 << 4];
31 }
32u_is_xdigit =
33{
34 { 1 },
35 { 2 * sizeof (int) / sizeof (short) + 0 },
36 {
37 2 + 128 * sizeof (short) / sizeof (int) + 0,
38 -1,
39 -1,
40 -1,
41 -1,
42 -1,
43 -1,
44 -1,
45 -1,
46 -1,
47 -1,
48 -1,
49 -1,
50 -1,
51 -1,
52 -1,
53 -1,
54 -1,
55 -1,
56 -1,
57 -1,
58 -1,
59 -1,
60 -1,
61 -1,
62 -1,
63 -1,
64 -1,
65 -1,
66 -1,
67 -1,
68 -1,
69 -1,
70 -1,
71 -1,
72 -1,
73 -1,
74 -1,
75 -1,
76 -1,
77 -1,
78 -1,
79 -1,
80 -1,
81 -1,
82 -1,
83 -1,
84 -1,
85 -1,
86 -1,
87 -1,
88 -1,
89 -1,
90 -1,
91 -1,
92 -1,
93 -1,
94 -1,
95 -1,
96 -1,
97 -1,
98 -1,
99 -1,
100 -1,
101 -1,
102 -1,
103 -1,
104 -1,
105 -1,
106 -1,
107 -1,
108 -1,
109 -1,
110 -1,
111 -1,
112 -1,
113 -1,
114 -1,
115 -1,
116 -1,
117 -1,
118 -1,
119 -1,
120 -1,
121 -1,
122 -1,
123 -1,
124 -1,
125 -1,
126 -1,
127 -1,
128 -1,
129 -1,
130 -1,
131 -1,
132 -1,
133 -1,
134 -1,
135 -1,
136 -1,
137 -1,
138 -1,
139 -1,
140 -1,
141 -1,
142 -1,
143 -1,
144 -1,
145 -1,
146 -1,
147 -1,
148 -1,
149 -1,
150 -1,
151 -1,
152 -1,
153 -1,
154 -1,
155 -1,
156 -1,
157 -1,
158 -1,
159 -1,
160 -1,
161 -1,
162 -1,
163 -1,
164 -1
165 },
166 {
167 0x00000000U, 0x03FF0000U, 0x0000007EU, 0x0000007EU,
168 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
169 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
170 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U
171 }
172};
diff --git a/gl/uninorm.in.h b/gl/uninorm.in.h
new file mode 100644
index 00000000..8d84f78a
--- /dev/null
+++ b/gl/uninorm.in.h
@@ -0,0 +1,255 @@
1/* Normalization forms (composition and decomposition) of Unicode strings.
2 Copyright (C) 2001-2002, 2009-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2009.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#ifndef _UNINORM_H
19#define _UNINORM_H
20
21/* Get size_t. */
22#include <stddef.h>
23
24#include "unitypes.h"
25
26#if @HAVE_UNISTRING_WOE32DLL_H@
27# include <unistring/woe32dll.h>
28#else
29# define LIBUNISTRING_DLL_VARIABLE
30#endif
31
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37
38/* Conventions:
39
40 All functions prefixed with u8_ operate on UTF-8 encoded strings.
41 Their unit is an uint8_t (1 byte).
42
43 All functions prefixed with u16_ operate on UTF-16 encoded strings.
44 Their unit is an uint16_t (a 2-byte word).
45
46 All functions prefixed with u32_ operate on UCS-4 encoded strings.
47 Their unit is an uint32_t (a 4-byte word).
48
49 All argument pairs (s, n) denote a Unicode string s[0..n-1] with exactly
50 n units.
51
52 Functions returning a string result take a (resultbuf, lengthp) argument
53 pair. If resultbuf is not NULL and the result fits into *lengthp units,
54 it is put in resultbuf, and resultbuf is returned. Otherwise, a freshly
55 allocated string is returned. In both cases, *lengthp is set to the
56 length (number of units) of the returned string. In case of error,
57 NULL is returned and errno is set. */
58
59
60enum
61{
62 UC_DECOMP_CANONICAL,/* Canonical decomposition. */
63 UC_DECOMP_FONT, /* <font> A font variant (e.g. a blackletter form). */
64 UC_DECOMP_NOBREAK, /* <noBreak> A no-break version of a space or hyphen. */
65 UC_DECOMP_INITIAL, /* <initial> An initial presentation form (Arabic). */
66 UC_DECOMP_MEDIAL, /* <medial> A medial presentation form (Arabic). */
67 UC_DECOMP_FINAL, /* <final> A final presentation form (Arabic). */
68 UC_DECOMP_ISOLATED,/* <isolated> An isolated presentation form (Arabic). */
69 UC_DECOMP_CIRCLE, /* <circle> An encircled form. */
70 UC_DECOMP_SUPER, /* <super> A superscript form. */
71 UC_DECOMP_SUB, /* <sub> A subscript form. */
72 UC_DECOMP_VERTICAL,/* <vertical> A vertical layout presentation form. */
73 UC_DECOMP_WIDE, /* <wide> A wide (or zenkaku) compatibility character. */
74 UC_DECOMP_NARROW, /* <narrow> A narrow (or hankaku) compatibility character. */
75 UC_DECOMP_SMALL, /* <small> A small variant form (CNS compatibility). */
76 UC_DECOMP_SQUARE, /* <square> A CJK squared font variant. */
77 UC_DECOMP_FRACTION,/* <fraction> A vulgar fraction form. */
78 UC_DECOMP_COMPAT /* <compat> Otherwise unspecified compatibility character. */
79};
80
81/* Maximum size of decomposition of a single Unicode character. */
82#define UC_DECOMPOSITION_MAX_LENGTH 32
83
84/* Return the character decomposition mapping of a Unicode character.
85 DECOMPOSITION must point to an array of at least UC_DECOMPOSITION_MAX_LENGTH
86 ucs_t elements.
87 When a decomposition exists, DECOMPOSITION[0..N-1] and *DECOMP_TAG are
88 filled and N is returned. Otherwise -1 is returned. */
89extern int
90 uc_decomposition (ucs4_t uc, int *decomp_tag, ucs4_t *decomposition);
91
92/* Return the canonical character decomposition mapping of a Unicode character.
93 DECOMPOSITION must point to an array of at least UC_DECOMPOSITION_MAX_LENGTH
94 ucs_t elements.
95 When a decomposition exists, DECOMPOSITION[0..N-1] is filled and N is
96 returned. Otherwise -1 is returned. */
97extern int
98 uc_canonical_decomposition (ucs4_t uc, ucs4_t *decomposition);
99
100
101/* Attempt to combine the Unicode characters uc1, uc2.
102 uc1 is known to have canonical combining class 0.
103 Return the combination of uc1 and uc2, if it exists.
104 Return 0 otherwise.
105 Not all decompositions can be recombined using this function. See the
106 Unicode file CompositionExclusions.txt for details. */
107extern ucs4_t
108 uc_composition (ucs4_t uc1, ucs4_t uc2)
109 _UC_ATTRIBUTE_CONST;
110
111
112/* An object of type uninorm_t denotes a Unicode normalization form. */
113struct unicode_normalization_form;
114typedef const struct unicode_normalization_form *uninorm_t;
115
116/* UNINORM_NFD: Normalization form D: canonical decomposition. */
117extern @GNULIB_UNINORM_NFD_DLL_VARIABLE@ const struct unicode_normalization_form uninorm_nfd;
118#define UNINORM_NFD (&uninorm_nfd)
119
120/* UNINORM_NFC: Normalization form C: canonical decomposition, then
121 canonical composition. */
122extern @GNULIB_UNINORM_NFC_DLL_VARIABLE@ const struct unicode_normalization_form uninorm_nfc;
123#define UNINORM_NFC (&uninorm_nfc)
124
125/* UNINORM_NFKD: Normalization form KD: compatibility decomposition. */
126extern @GNULIB_UNINORM_NFKD_DLL_VARIABLE@ const struct unicode_normalization_form uninorm_nfkd;
127#define UNINORM_NFKD (&uninorm_nfkd)
128
129/* UNINORM_NFKC: Normalization form KC: compatibility decomposition, then
130 canonical composition. */
131extern @GNULIB_UNINORM_NFKC_DLL_VARIABLE@ const struct unicode_normalization_form uninorm_nfkc;
132#define UNINORM_NFKC (&uninorm_nfkc)
133
134/* Test whether a normalization form does compatibility decomposition. */
135#define uninorm_is_compat_decomposing(nf) \
136 ((* (const unsigned int *) (nf) >> 0) & 1)
137
138/* Test whether a normalization form includes canonical composition. */
139#define uninorm_is_composing(nf) \
140 ((* (const unsigned int *) (nf) >> 1) & 1)
141
142/* Return the decomposing variant of a normalization form.
143 This maps NFC,NFD -> NFD and NFKC,NFKD -> NFKD. */
144extern uninorm_t
145 uninorm_decomposing_form (uninorm_t nf)
146 _UC_ATTRIBUTE_PURE;
147
148
149/* Return the specified normalization form of a string. */
150extern uint8_t *
151 u8_normalize (uninorm_t nf, const uint8_t *s, size_t n,
152 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
153extern uint16_t *
154 u16_normalize (uninorm_t nf, const uint16_t *s, size_t n,
155 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
156extern uint32_t *
157 u32_normalize (uninorm_t nf, const uint32_t *s, size_t n,
158 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
159
160
161/* Compare S1 and S2, ignoring differences in normalization.
162 NF must be either UNINORM_NFD or UNINORM_NFKD.
163 If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2, and
164 return 0. Upon failure, return -1 with errno set. */
165extern int
166 u8_normcmp (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2,
167 uninorm_t nf, int *resultp);
168extern int
169 u16_normcmp (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2,
170 uninorm_t nf, int *resultp);
171extern int
172 u32_normcmp (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2,
173 uninorm_t nf, int *resultp);
174
175
176/* Converts the string S of length N to a NUL-terminated byte sequence, in such
177 a way that comparing uN_normxfrm (S1) and uN_normxfrm (S2) with uN_cmp2() is
178 equivalent to comparing S1 and S2 with uN_normcoll().
179 NF must be either UNINORM_NFC or UNINORM_NFKC. */
180extern char *
181 u8_normxfrm (const uint8_t *s, size_t n, uninorm_t nf,
182 char *resultbuf, size_t *lengthp);
183extern char *
184 u16_normxfrm (const uint16_t *s, size_t n, uninorm_t nf,
185 char *resultbuf, size_t *lengthp);
186extern char *
187 u32_normxfrm (const uint32_t *s, size_t n, uninorm_t nf,
188 char *resultbuf, size_t *lengthp);
189
190
191/* Compare S1 and S2, ignoring differences in normalization, using the
192 collation rules of the current locale.
193 NF must be either UNINORM_NFC or UNINORM_NFKC.
194 If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2, and
195 return 0. Upon failure, return -1 with errno set. */
196extern int
197 u8_normcoll (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2,
198 uninorm_t nf, int *resultp);
199extern int
200 u16_normcoll (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2,
201 uninorm_t nf, int *resultp);
202extern int
203 u32_normcoll (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2,
204 uninorm_t nf, int *resultp);
205
206
207/* Normalization of a stream of Unicode characters.
208
209 A "stream of Unicode characters" is essentially a function that accepts an
210 ucs4_t argument repeatedly, optionally combined with a function that
211 "flushes" the stream. */
212
213/* Data type of a stream of Unicode characters that normalizes its input
214 according to a given normalization form and passes the normalized character
215 sequence to the encapsulated stream of Unicode characters. */
216struct uninorm_filter;
217
218/* Bring data buffered in the filter to its destination, the encapsulated
219 stream, then close and free the filter.
220 Return 0 if successful, or -1 with errno set upon failure. */
221extern int
222 uninorm_filter_free (struct uninorm_filter *filter);
223
224/* Create and return a normalization filter for Unicode characters.
225 The pair (stream_func, stream_data) is the encapsulated stream.
226 stream_func (stream_data, uc) receives the Unicode character uc
227 and returns 0 if successful, or -1 with errno set upon failure.
228 Return the new filter, or NULL with errno set upon failure. */
229extern struct uninorm_filter *
230 uninorm_filter_create (uninorm_t nf,
231 int (*stream_func) (void *stream_data, ucs4_t uc),
232 void *stream_data)
233 _GL_ATTRIBUTE_DEALLOC (uninorm_filter_free, 1);
234
235/* Stuff a Unicode character into a normalizing filter.
236 Return 0 if successful, or -1 with errno set upon failure. */
237extern int
238 uninorm_filter_write (struct uninorm_filter *filter, ucs4_t uc);
239
240/* Bring data buffered in the filter to its destination, the encapsulated
241 stream.
242 Return 0 if successful, or -1 with errno set upon failure.
243 Note! If after calling this function, additional characters are written
244 into the filter, the resulting character sequence in the encapsulated stream
245 will not necessarily be normalized. */
246extern int
247 uninorm_filter_flush (struct uninorm_filter *filter);
248
249
250#ifdef __cplusplus
251}
252#endif
253
254
255#endif /* _UNINORM_H */
diff --git a/gl/unistd.c b/gl/unistd.c
index f3b3f7bd..414dce9a 100644
--- a/gl/unistd.c
+++ b/gl/unistd.c
@@ -1,6 +1,6 @@
1/* Inline functions for <unistd.h>. 1/* Inline functions for <unistd.h>.
2 2
3 Copyright (C) 2012-2024 Free Software Foundation, Inc. 3 Copyright (C) 2012-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -15,8 +15,8 @@
15 You should have received a copy of the GNU Lesser General Public License 15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 17
18#define _GL_UNISTD_INLINE _GL_EXTERN_INLINE
18#include <config.h> 19#include <config.h>
19 20
20#define _GL_UNISTD_INLINE _GL_EXTERN_INLINE
21#include <unistd.h> 21#include <unistd.h>
22typedef int dummy; 22typedef int dummy;
diff --git a/gl/unistd.in.h b/gl/unistd.in.h
index b4129663..f7e4450c 100644
--- a/gl/unistd.in.h
+++ b/gl/unistd.in.h
@@ -1,5 +1,5 @@
1/* Substitute for and wrapper around <unistd.h>. 1/* Substitute for and wrapper around <unistd.h>.
2 Copyright (C) 2003-2024 Free Software Foundation, Inc. 2 Copyright (C) 2003-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -69,8 +69,8 @@
69#if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H 69#if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
70#define _@GUARD_PREFIX@_UNISTD_H 70#define _@GUARD_PREFIX@_UNISTD_H
71 71
72/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, GNULIB_POSIXCHECK, 72/* This file uses _GL_ATTRIBUTE_NODISCARD, _GL_INLINE_HEADER_BEGIN, _GL_INLINE,
73 HAVE_RAW_DECL_*. */ 73 GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
74#if !_GL_CONFIG_H_INCLUDED 74#if !_GL_CONFIG_H_INCLUDED
75 #error "Please include config.h first." 75 #error "Please include config.h first."
76#endif 76#endif
@@ -95,12 +95,21 @@
95# include <stdio.h> 95# include <stdio.h>
96#endif 96#endif
97 97
98/* Native Windows platforms declare _chdir, _getcwd, _rmdir in
99 <io.h> and/or <direct.h>, not in <unistd.h>.
100 They also declare _access(), _chmod(), _close(), _dup(), _dup2(), _isatty(),
101 _lseek(), _read(), _unlink(), _write() in <io.h>. */
102#if defined _WIN32 && !defined __CYGWIN__
103# include <io.h>
104# include <direct.h>
105#endif
106
98/* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in 107/* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in
99 <unistd.h>. */ 108 <unistd.h>. */
100/* But avoid namespace pollution on glibc systems. */ 109/* But avoid namespace pollution on glibc systems. */
101#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \ 110#if ((@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \
102 && (defined __CYGWIN__ || defined __ANDROID__) \ 111 && (defined __CYGWIN__ || defined __ANDROID__) \
103 && ! defined __GLIBC__ 112 && ! defined __GLIBC__)
104# include <fcntl.h> 113# include <fcntl.h>
105#endif 114#endif
106 115
@@ -108,33 +117,22 @@
108/* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in 117/* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
109 <unistd.h>. */ 118 <unistd.h>. */
110/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */ 119/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
111/* OSF Tru64 Unix cannot see gnulib rpl_strtod when system <stdlib.h> is
112 included here. */
113/* But avoid namespace pollution on glibc systems. */ 120/* But avoid namespace pollution on glibc systems. */
114#if !defined __GLIBC__ && !defined __osf__ 121#if !defined __GLIBC__
115# define __need_system_stdlib_h 122# define __need_system_stdlib_h
116# include <stdlib.h> 123# include <stdlib.h>
117# undef __need_system_stdlib_h 124# undef __need_system_stdlib_h
118#endif 125#endif
119 126
120/* Native Windows platforms declare _chdir, _getcwd, _rmdir in
121 <io.h> and/or <direct.h>, not in <unistd.h>.
122 They also declare _access(), _chmod(), _close(), _dup(), _dup2(), _isatty(),
123 _lseek(), _read(), _unlink(), _write() in <io.h>. */
124#if defined _WIN32 && !defined __CYGWIN__
125# include <io.h>
126# include <direct.h>
127#endif
128
129/* Native Windows platforms declare _execl*, _execv* in <process.h>. */ 127/* Native Windows platforms declare _execl*, _execv* in <process.h>. */
130#if defined _WIN32 && !defined __CYGWIN__ 128#if defined _WIN32 && !defined __CYGWIN__
131# include <process.h> 129# include <process.h>
132#endif 130#endif
133 131
134/* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>. 132/* AIX declares getdomainname in <netdb.h>, not in <unistd.h>.
135 NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */ 133 NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */
136/* But avoid namespace pollution on glibc systems. */ 134/* But avoid namespace pollution on glibc systems. */
137#if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \ 135#if ((@GNULIB_GETDOMAINNAME@ && defined _AIX) \
138 || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \ 136 || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \
139 && !defined __GLIBC__ 137 && !defined __GLIBC__
140# include <netdb.h> 138# include <netdb.h>
@@ -159,8 +157,9 @@
159#endif 157#endif
160 158
161/* MSVC defines off_t in <sys/types.h>. 159/* MSVC defines off_t in <sys/types.h>.
162 May also define off_t to a 64-bit type on native Windows. */ 160 May also define off_t to a 64-bit type on native Windows.
163/* Get off_t, ssize_t, mode_t. */ 161 Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku. */
162/* Get off_t, off64_t, ssize_t, mode_t. */
164#include <sys/types.h> 163#include <sys/types.h>
165 164
166/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 165/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -180,6 +179,9 @@ _GL_INLINE_HEADER_BEGIN
180#ifndef _GL_UNISTD_INLINE 179#ifndef _GL_UNISTD_INLINE
181# define _GL_UNISTD_INLINE _GL_INLINE 180# define _GL_UNISTD_INLINE _GL_INLINE
182#endif 181#endif
182#ifndef _GL_GETPAGESIZE_INLINE
183# define _GL_GETPAGESIZE_INLINE _GL_INLINE
184#endif
183 185
184/* Hide some function declarations from <winsock2.h>. */ 186/* Hide some function declarations from <winsock2.h>. */
185 187
@@ -286,7 +288,7 @@ _GL_INLINE_HEADER_BEGIN
286# undef access 288# undef access
287# define access rpl_access 289# define access rpl_access
288# endif 290# endif
289_GL_FUNCDECL_RPL (access, int, (const char *file, int mode) 291_GL_FUNCDECL_RPL (access, int, (const char *file, int mode),
290 _GL_ARG_NONNULL ((1))); 292 _GL_ARG_NONNULL ((1)));
291_GL_CXXALIAS_RPL (access, int, (const char *file, int mode)); 293_GL_CXXALIAS_RPL (access, int, (const char *file, int mode));
292# elif defined _WIN32 && !defined __CYGWIN__ 294# elif defined _WIN32 && !defined __CYGWIN__
@@ -300,7 +302,6 @@ _GL_CXXALIAS_SYS (access, int, (const char *file, int mode));
300# endif 302# endif
301_GL_CXXALIASWARN (access); 303_GL_CXXALIASWARN (access);
302#elif defined GNULIB_POSIXCHECK 304#elif defined GNULIB_POSIXCHECK
303# undef access
304# if HAVE_RAW_DECL_ACCESS 305# if HAVE_RAW_DECL_ACCESS
305/* The access() function is a security risk. */ 306/* The access() function is a security risk. */
306_GL_WARN_ON_USE (access, "access does not always support X_OK - " 307_GL_WARN_ON_USE (access, "access does not always support X_OK - "
@@ -337,9 +338,8 @@ _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
337# endif 338# endif
338_GL_CXXALIASWARN (chdir); 339_GL_CXXALIASWARN (chdir);
339#elif defined GNULIB_POSIXCHECK 340#elif defined GNULIB_POSIXCHECK
340# undef chdir
341# if HAVE_RAW_DECL_CHDIR 341# if HAVE_RAW_DECL_CHDIR
342_GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - " 342_GL_WARN_ON_USE (chdir, "chdir is not always in <unistd.h> - "
343 "use gnulib module chdir for portability"); 343 "use gnulib module chdir for portability");
344# endif 344# endif
345#elif @GNULIB_MDA_CHDIR@ 345#elif @GNULIB_MDA_CHDIR@
@@ -370,19 +370,18 @@ _GL_CXXALIASWARN (chdir);
370# undef chown 370# undef chown
371# define chown rpl_chown 371# define chown rpl_chown
372# endif 372# endif
373_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid) 373_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid),
374 _GL_ARG_NONNULL ((1))); 374 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
375_GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)); 375_GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
376# else 376# else
377# if !@HAVE_CHOWN@ 377# if !@HAVE_CHOWN@
378_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid) 378_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid),
379 _GL_ARG_NONNULL ((1))); 379 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
380# endif 380# endif
381_GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)); 381_GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
382# endif 382# endif
383_GL_CXXALIASWARN (chown); 383_GL_CXXALIASWARN (chown);
384#elif defined GNULIB_POSIXCHECK 384#elif defined GNULIB_POSIXCHECK
385# undef chown
386# if HAVE_RAW_DECL_CHOWN 385# if HAVE_RAW_DECL_CHOWN
387_GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and " 386_GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
388 "doesn't treat a uid or gid of -1 on some systems - " 387 "doesn't treat a uid or gid of -1 on some systems - "
@@ -398,7 +397,7 @@ _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
398# undef close 397# undef close
399# define close rpl_close 398# define close rpl_close
400# endif 399# endif
401_GL_FUNCDECL_RPL (close, int, (int fd)); 400_GL_FUNCDECL_RPL (close, int, (int fd), );
402_GL_CXXALIAS_RPL (close, int, (int fd)); 401_GL_CXXALIAS_RPL (close, int, (int fd));
403# elif defined _WIN32 && !defined __CYGWIN__ 402# elif defined _WIN32 && !defined __CYGWIN__
404# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 403# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -411,10 +410,11 @@ _GL_CXXALIAS_SYS (close, int, (int fd));
411# endif 410# endif
412_GL_CXXALIASWARN (close); 411_GL_CXXALIASWARN (close);
413#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ 412#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
414# undef close 413# if !GNULIB_CLOSE
415# define close close_used_without_requesting_gnulib_module_close 414# undef close
415# define close close_used_without_requesting_gnulib_module_close
416# endif
416#elif defined GNULIB_POSIXCHECK 417#elif defined GNULIB_POSIXCHECK
417# undef close
418/* Assume close is always declared. */ 418/* Assume close is always declared. */
419_GL_WARN_ON_USE (close, "close does not portably work on sockets - " 419_GL_WARN_ON_USE (close, "close does not portably work on sockets - "
420 "use gnulib module close for portability"); 420 "use gnulib module close for portability");
@@ -443,7 +443,7 @@ _GL_CXXALIASWARN (close);
443# endif 443# endif
444_GL_FUNCDECL_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos, 444_GL_FUNCDECL_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos,
445 int ofd, off_t *opos, 445 int ofd, off_t *opos,
446 size_t len, unsigned flags)); 446 size_t len, unsigned flags), );
447_GL_CXXALIAS_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos, 447_GL_CXXALIAS_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos,
448 int ofd, off_t *opos, 448 int ofd, off_t *opos,
449 size_t len, unsigned flags)); 449 size_t len, unsigned flags));
@@ -451,15 +451,16 @@ _GL_CXXALIAS_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos,
451# if !@HAVE_COPY_FILE_RANGE@ 451# if !@HAVE_COPY_FILE_RANGE@
452_GL_FUNCDECL_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, 452_GL_FUNCDECL_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
453 int ofd, off_t *opos, 453 int ofd, off_t *opos,
454 size_t len, unsigned flags)); 454 size_t len, unsigned flags), );
455# endif 455# endif
456_GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, 456_GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
457 int ofd, off_t *opos, 457 int ofd, off_t *opos,
458 size_t len, unsigned flags)); 458 size_t len, unsigned flags));
459# endif 459# endif
460# if __GLIBC__ >= 2
460_GL_CXXALIASWARN (copy_file_range); 461_GL_CXXALIASWARN (copy_file_range);
462# endif
461#elif defined GNULIB_POSIXCHECK 463#elif defined GNULIB_POSIXCHECK
462# undef copy_file_range
463# if HAVE_RAW_DECL_COPY_FILE_RANGE 464# if HAVE_RAW_DECL_COPY_FILE_RANGE
464_GL_WARN_ON_USE (copy_file_range, 465_GL_WARN_ON_USE (copy_file_range,
465 "copy_file_range is unportable - " 466 "copy_file_range is unportable - "
@@ -473,7 +474,7 @@ _GL_WARN_ON_USE (copy_file_range,
473# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 474# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
474# define dup rpl_dup 475# define dup rpl_dup
475# endif 476# endif
476_GL_FUNCDECL_RPL (dup, int, (int oldfd)); 477_GL_FUNCDECL_RPL (dup, int, (int oldfd), _GL_ATTRIBUTE_NODISCARD);
477_GL_CXXALIAS_RPL (dup, int, (int oldfd)); 478_GL_CXXALIAS_RPL (dup, int, (int oldfd));
478# elif defined _WIN32 && !defined __CYGWIN__ 479# elif defined _WIN32 && !defined __CYGWIN__
479# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 480# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -486,7 +487,6 @@ _GL_CXXALIAS_SYS (dup, int, (int oldfd));
486# endif 487# endif
487_GL_CXXALIASWARN (dup); 488_GL_CXXALIASWARN (dup);
488#elif defined GNULIB_POSIXCHECK 489#elif defined GNULIB_POSIXCHECK
489# undef dup
490# if HAVE_RAW_DECL_DUP 490# if HAVE_RAW_DECL_DUP
491_GL_WARN_ON_USE (dup, "dup is unportable - " 491_GL_WARN_ON_USE (dup, "dup is unportable - "
492 "use gnulib module dup for portability"); 492 "use gnulib module dup for portability");
@@ -518,7 +518,7 @@ _GL_CXXALIASWARN (dup);
518# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 518# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
519# define dup2 rpl_dup2 519# define dup2 rpl_dup2
520# endif 520# endif
521_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd)); 521_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd), );
522_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd)); 522_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
523# elif defined _WIN32 && !defined __CYGWIN__ 523# elif defined _WIN32 && !defined __CYGWIN__
524# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 524# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -531,7 +531,6 @@ _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
531# endif 531# endif
532_GL_CXXALIASWARN (dup2); 532_GL_CXXALIASWARN (dup2);
533#elif defined GNULIB_POSIXCHECK 533#elif defined GNULIB_POSIXCHECK
534# undef dup2
535# if HAVE_RAW_DECL_DUP2 534# if HAVE_RAW_DECL_DUP2
536_GL_WARN_ON_USE (dup2, "dup2 is unportable - " 535_GL_WARN_ON_USE (dup2, "dup2 is unportable - "
537 "use gnulib module dup2 for portability"); 536 "use gnulib module dup2 for portability");
@@ -567,11 +566,11 @@ _GL_CXXALIASWARN (dup2);
567# undef dup3 566# undef dup3
568# define dup3 rpl_dup3 567# define dup3 rpl_dup3
569# endif 568# endif
570_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags)); 569_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags), );
571_GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags)); 570_GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
572# else 571# else
573# if !@HAVE_DUP3@ 572# if !@HAVE_DUP3@
574_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags)); 573_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags), );
575# endif 574# endif
576_GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags)); 575_GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
577# endif 576# endif
@@ -579,7 +578,6 @@ _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
579_GL_CXXALIASWARN (dup3); 578_GL_CXXALIASWARN (dup3);
580# endif 579# endif
581#elif defined GNULIB_POSIXCHECK 580#elif defined GNULIB_POSIXCHECK
582# undef dup3
583# if HAVE_RAW_DECL_DUP3 581# if HAVE_RAW_DECL_DUP3
584_GL_WARN_ON_USE (dup3, "dup3 is unportable - " 582_GL_WARN_ON_USE (dup3, "dup3 is unportable - "
585 "use gnulib module dup3 for portability"); 583 "use gnulib module dup3 for portability");
@@ -636,7 +634,7 @@ rpl_environ (void)
636/* Like access(), except that it uses the effective user id and group id of 634/* Like access(), except that it uses the effective user id and group id of
637 the current process. */ 635 the current process. */
638# if !@HAVE_EUIDACCESS@ 636# if !@HAVE_EUIDACCESS@
639_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode) 637_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode),
640 _GL_ARG_NONNULL ((1))); 638 _GL_ARG_NONNULL ((1)));
641# endif 639# endif
642_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode)); 640_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
@@ -647,7 +645,6 @@ _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
647 "use the gnulib module faccessat instead"); 645 "use the gnulib module faccessat instead");
648# endif 646# endif
649#elif defined GNULIB_POSIXCHECK 647#elif defined GNULIB_POSIXCHECK
650# undef euidaccess
651# if HAVE_RAW_DECL_EUIDACCESS 648# if HAVE_RAW_DECL_EUIDACCESS
652_GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - " 649_GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
653 "use gnulib module euidaccess for portability"); 650 "use gnulib module euidaccess for portability");
@@ -661,7 +658,7 @@ _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
661# undef execl 658# undef execl
662# define execl rpl_execl 659# define execl rpl_execl
663# endif 660# endif
664_GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...) 661_GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...),
665 _GL_ARG_NONNULL ((1))); 662 _GL_ARG_NONNULL ((1)));
666_GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...)); 663_GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...));
667# else 664# else
@@ -669,7 +666,6 @@ _GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...));
669# endif 666# endif
670_GL_CXXALIASWARN (execl); 667_GL_CXXALIASWARN (execl);
671#elif defined GNULIB_POSIXCHECK 668#elif defined GNULIB_POSIXCHECK
672# undef execl
673# if HAVE_RAW_DECL_EXECL 669# if HAVE_RAW_DECL_EXECL
674_GL_WARN_ON_USE (execl, "execl behaves very differently on mingw - " 670_GL_WARN_ON_USE (execl, "execl behaves very differently on mingw - "
675 "use gnulib module execl for portability"); 671 "use gnulib module execl for portability");
@@ -696,7 +692,7 @@ _GL_CXXALIASWARN (execl);
696# undef execle 692# undef execle
697# define execle rpl_execle 693# define execle rpl_execle
698# endif 694# endif
699_GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...) 695_GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...),
700 _GL_ARG_NONNULL ((1))); 696 _GL_ARG_NONNULL ((1)));
701_GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...)); 697_GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...));
702# else 698# else
@@ -704,7 +700,6 @@ _GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...));
704# endif 700# endif
705_GL_CXXALIASWARN (execle); 701_GL_CXXALIASWARN (execle);
706#elif defined GNULIB_POSIXCHECK 702#elif defined GNULIB_POSIXCHECK
707# undef execle
708# if HAVE_RAW_DECL_EXECLE 703# if HAVE_RAW_DECL_EXECLE
709_GL_WARN_ON_USE (execle, "execle behaves very differently on mingw - " 704_GL_WARN_ON_USE (execle, "execle behaves very differently on mingw - "
710 "use gnulib module execle for portability"); 705 "use gnulib module execle for portability");
@@ -732,7 +727,7 @@ _GL_CXXALIASWARN (execle);
732# undef execlp 727# undef execlp
733# define execlp rpl_execlp 728# define execlp rpl_execlp
734# endif 729# endif
735_GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...) 730_GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...),
736 _GL_ARG_NONNULL ((1))); 731 _GL_ARG_NONNULL ((1)));
737_GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...)); 732_GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...));
738# else 733# else
@@ -740,7 +735,6 @@ _GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...));
740# endif 735# endif
741_GL_CXXALIASWARN (execlp); 736_GL_CXXALIASWARN (execlp);
742#elif defined GNULIB_POSIXCHECK 737#elif defined GNULIB_POSIXCHECK
743# undef execlp
744# if HAVE_RAW_DECL_EXECLP 738# if HAVE_RAW_DECL_EXECLP
745_GL_WARN_ON_USE (execlp, "execlp behaves very differently on mingw - " 739_GL_WARN_ON_USE (execlp, "execlp behaves very differently on mingw - "
746 "use gnulib module execlp for portability"); 740 "use gnulib module execlp for portability");
@@ -769,7 +763,7 @@ _GL_CXXALIASWARN (execlp);
769# undef execv 763# undef execv
770# define execv rpl_execv 764# define execv rpl_execv
771# endif 765# endif
772_GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv) 766_GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv),
773 _GL_ARG_NONNULL ((1, 2))); 767 _GL_ARG_NONNULL ((1, 2)));
774_GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv)); 768_GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv));
775# else 769# else
@@ -777,7 +771,6 @@ _GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv));
777# endif 771# endif
778_GL_CXXALIASWARN (execv); 772_GL_CXXALIASWARN (execv);
779#elif defined GNULIB_POSIXCHECK 773#elif defined GNULIB_POSIXCHECK
780# undef execv
781# if HAVE_RAW_DECL_EXECV 774# if HAVE_RAW_DECL_EXECV
782_GL_WARN_ON_USE (execv, "execv behaves very differently on mingw - " 775_GL_WARN_ON_USE (execv, "execv behaves very differently on mingw - "
783 "use gnulib module execv for portability"); 776 "use gnulib module execv for portability");
@@ -806,7 +799,7 @@ _GL_CXXALIASWARN (execv);
806# define execve rpl_execve 799# define execve rpl_execve
807# endif 800# endif
808_GL_FUNCDECL_RPL (execve, int, 801_GL_FUNCDECL_RPL (execve, int,
809 (const char *program, char * const *argv, char * const *env) 802 (const char *program, char * const *argv, char * const *env),
810 _GL_ARG_NONNULL ((1, 2))); 803 _GL_ARG_NONNULL ((1, 2)));
811_GL_CXXALIAS_RPL (execve, int, 804_GL_CXXALIAS_RPL (execve, int,
812 (const char *program, char * const *argv, char * const *env)); 805 (const char *program, char * const *argv, char * const *env));
@@ -816,7 +809,6 @@ _GL_CXXALIAS_SYS (execve, int,
816# endif 809# endif
817_GL_CXXALIASWARN (execve); 810_GL_CXXALIASWARN (execve);
818#elif defined GNULIB_POSIXCHECK 811#elif defined GNULIB_POSIXCHECK
819# undef execve
820# if HAVE_RAW_DECL_EXECVE 812# if HAVE_RAW_DECL_EXECVE
821_GL_WARN_ON_USE (execve, "execve behaves very differently on mingw - " 813_GL_WARN_ON_USE (execve, "execve behaves very differently on mingw - "
822 "use gnulib module execve for portability"); 814 "use gnulib module execve for portability");
@@ -846,7 +838,7 @@ _GL_CXXALIASWARN (execve);
846# undef execvp 838# undef execvp
847# define execvp rpl_execvp 839# define execvp rpl_execvp
848# endif 840# endif
849_GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv) 841_GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv),
850 _GL_ARG_NONNULL ((1, 2))); 842 _GL_ARG_NONNULL ((1, 2)));
851_GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv)); 843_GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv));
852# else 844# else
@@ -854,7 +846,6 @@ _GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv));
854# endif 846# endif
855_GL_CXXALIASWARN (execvp); 847_GL_CXXALIASWARN (execvp);
856#elif defined GNULIB_POSIXCHECK 848#elif defined GNULIB_POSIXCHECK
857# undef execvp
858# if HAVE_RAW_DECL_EXECVP 849# if HAVE_RAW_DECL_EXECVP
859_GL_WARN_ON_USE (execvp, "execvp behaves very differently on mingw - " 850_GL_WARN_ON_USE (execvp, "execvp behaves very differently on mingw - "
860 "use gnulib module execvp for portability"); 851 "use gnulib module execvp for portability");
@@ -883,14 +874,14 @@ _GL_CXXALIASWARN (execvp);
883# define execvpe rpl_execvpe 874# define execvpe rpl_execvpe
884# endif 875# endif
885_GL_FUNCDECL_RPL (execvpe, int, 876_GL_FUNCDECL_RPL (execvpe, int,
886 (const char *program, char * const *argv, char * const *env) 877 (const char *program, char * const *argv, char * const *env),
887 _GL_ARG_NONNULL ((1, 2))); 878 _GL_ARG_NONNULL ((1, 2)));
888_GL_CXXALIAS_RPL (execvpe, int, 879_GL_CXXALIAS_RPL (execvpe, int,
889 (const char *program, char * const *argv, char * const *env)); 880 (const char *program, char * const *argv, char * const *env));
890# else 881# else
891# if !@HAVE_DECL_EXECVPE@ 882# if !@HAVE_DECL_EXECVPE@
892_GL_FUNCDECL_SYS (execvpe, int, 883_GL_FUNCDECL_SYS (execvpe, int,
893 (const char *program, char * const *argv, char * const *env) 884 (const char *program, char * const *argv, char * const *env),
894 _GL_ARG_NONNULL ((1, 2))); 885 _GL_ARG_NONNULL ((1, 2)));
895# endif 886# endif
896_GL_CXXALIAS_SYS (execvpe, int, 887_GL_CXXALIAS_SYS (execvpe, int,
@@ -900,7 +891,6 @@ _GL_CXXALIAS_SYS (execvpe, int,
900_GL_CXXALIASWARN (execvpe); 891_GL_CXXALIASWARN (execvpe);
901# endif 892# endif
902#elif defined GNULIB_POSIXCHECK 893#elif defined GNULIB_POSIXCHECK
903# undef execvpe
904# if HAVE_RAW_DECL_EXECVPE 894# if HAVE_RAW_DECL_EXECVPE
905_GL_WARN_ON_USE (execvpe, "execvpe behaves very differently on mingw - " 895_GL_WARN_ON_USE (execvpe, "execvpe behaves very differently on mingw - "
906 "use gnulib module execvpe for portability"); 896 "use gnulib module execvpe for portability");
@@ -921,7 +911,7 @@ _GL_CXXALIAS_MDA_CAST (execvpe, intptr_t,
921# elif @HAVE_EXECVPE@ 911# elif @HAVE_EXECVPE@
922# if !@HAVE_DECL_EXECVPE@ 912# if !@HAVE_DECL_EXECVPE@
923_GL_FUNCDECL_SYS (execvpe, int, 913_GL_FUNCDECL_SYS (execvpe, int,
924 (const char *program, char * const *argv, char * const *env) 914 (const char *program, char * const *argv, char * const *env),
925 _GL_ARG_NONNULL ((1, 2))); 915 _GL_ARG_NONNULL ((1, 2)));
926# endif 916# endif
927_GL_CXXALIAS_SYS (execvpe, int, 917_GL_CXXALIAS_SYS (execvpe, int,
@@ -940,15 +930,15 @@ _GL_CXXALIASWARN (execvpe);
940# define faccessat rpl_faccessat 930# define faccessat rpl_faccessat
941# endif 931# endif
942_GL_FUNCDECL_RPL (faccessat, int, 932_GL_FUNCDECL_RPL (faccessat, int,
943 (int fd, char const *name, int mode, int flag) 933 (int fd, char const *name, int mode, int flag),
944 _GL_ARG_NONNULL ((2))); 934 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
945_GL_CXXALIAS_RPL (faccessat, int, 935_GL_CXXALIAS_RPL (faccessat, int,
946 (int fd, char const *name, int mode, int flag)); 936 (int fd, char const *name, int mode, int flag));
947# else 937# else
948# if !@HAVE_FACCESSAT@ 938# if !@HAVE_FACCESSAT@
949_GL_FUNCDECL_SYS (faccessat, int, 939_GL_FUNCDECL_SYS (faccessat, int,
950 (int fd, char const *file, int mode, int flag) 940 (int fd, char const *file, int mode, int flag),
951 _GL_ARG_NONNULL ((2))); 941 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
952# endif 942# endif
953_GL_CXXALIAS_SYS (faccessat, int, 943_GL_CXXALIAS_SYS (faccessat, int,
954 (int fd, char const *file, int mode, int flag)); 944 (int fd, char const *file, int mode, int flag));
@@ -957,7 +947,6 @@ _GL_CXXALIAS_SYS (faccessat, int,
957_GL_CXXALIASWARN (faccessat); 947_GL_CXXALIASWARN (faccessat);
958# endif 948# endif
959#elif defined GNULIB_POSIXCHECK 949#elif defined GNULIB_POSIXCHECK
960# undef faccessat
961# if HAVE_RAW_DECL_FACCESSAT 950# if HAVE_RAW_DECL_FACCESSAT
962_GL_WARN_ON_USE (faccessat, "faccessat is not portable - " 951_GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
963 "use gnulib module faccessat for portability"); 952 "use gnulib module faccessat for portability");
@@ -976,11 +965,11 @@ _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
976# undef fchdir 965# undef fchdir
977# define fchdir rpl_fchdir 966# define fchdir rpl_fchdir
978# endif 967# endif
979_GL_FUNCDECL_RPL (fchdir, int, (int /*fd*/)); 968_GL_FUNCDECL_RPL (fchdir, int, (int /*fd*/), _GL_ATTRIBUTE_NODISCARD);
980_GL_CXXALIAS_RPL (fchdir, int, (int /*fd*/)); 969_GL_CXXALIAS_RPL (fchdir, int, (int /*fd*/));
981# else 970# else
982# if !@HAVE_FCHDIR@ || !@HAVE_DECL_FCHDIR@ 971# if !@HAVE_FCHDIR@ || !@HAVE_DECL_FCHDIR@
983_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); 972_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/), _GL_ATTRIBUTE_NODISCARD);
984# endif 973# endif
985_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); 974_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
986# endif 975# endif
@@ -994,7 +983,6 @@ _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
994_GL_EXTERN_C const char *_gl_directory_name (int fd); 983_GL_EXTERN_C const char *_gl_directory_name (int fd);
995# endif 984# endif
996#elif defined GNULIB_POSIXCHECK 985#elif defined GNULIB_POSIXCHECK
997# undef fchdir
998# if HAVE_RAW_DECL_FCHDIR 986# if HAVE_RAW_DECL_FCHDIR
999_GL_WARN_ON_USE (fchdir, "fchdir is unportable - " 987_GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
1000 "use gnulib module fchdir for portability"); 988 "use gnulib module fchdir for portability");
@@ -1009,22 +997,21 @@ _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
1009# define fchownat rpl_fchownat 997# define fchownat rpl_fchownat
1010# endif 998# endif
1011_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file, 999_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
1012 uid_t owner, gid_t group, int flag) 1000 uid_t owner, gid_t group, int flag),
1013 _GL_ARG_NONNULL ((2))); 1001 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1014_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file, 1002_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
1015 uid_t owner, gid_t group, int flag)); 1003 uid_t owner, gid_t group, int flag));
1016# else 1004# else
1017# if !@HAVE_FCHOWNAT@ 1005# if !@HAVE_FCHOWNAT@
1018_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file, 1006_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
1019 uid_t owner, gid_t group, int flag) 1007 uid_t owner, gid_t group, int flag),
1020 _GL_ARG_NONNULL ((2))); 1008 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1021# endif 1009# endif
1022_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file, 1010_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
1023 uid_t owner, gid_t group, int flag)); 1011 uid_t owner, gid_t group, int flag));
1024# endif 1012# endif
1025_GL_CXXALIASWARN (fchownat); 1013_GL_CXXALIASWARN (fchownat);
1026#elif defined GNULIB_POSIXCHECK 1014#elif defined GNULIB_POSIXCHECK
1027# undef fchownat
1028# if HAVE_RAW_DECL_FCHOWNAT 1015# if HAVE_RAW_DECL_FCHOWNAT
1029_GL_WARN_ON_USE (fchownat, "fchownat is not portable - " 1016_GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
1030 "use gnulib module fchownat for portability"); 1017 "use gnulib module fchownat for portability");
@@ -1042,11 +1029,11 @@ _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
1042# undef fdatasync 1029# undef fdatasync
1043# define fdatasync rpl_fdatasync 1030# define fdatasync rpl_fdatasync
1044# endif 1031# endif
1045_GL_FUNCDECL_RPL (fdatasync, int, (int fd)); 1032_GL_FUNCDECL_RPL (fdatasync, int, (int fd), );
1046_GL_CXXALIAS_RPL (fdatasync, int, (int fd)); 1033_GL_CXXALIAS_RPL (fdatasync, int, (int fd));
1047# else 1034# else
1048# if !@HAVE_FDATASYNC@|| !@HAVE_DECL_FDATASYNC@ 1035# if !@HAVE_FDATASYNC@|| !@HAVE_DECL_FDATASYNC@
1049_GL_FUNCDECL_SYS (fdatasync, int, (int fd)); 1036_GL_FUNCDECL_SYS (fdatasync, int, (int fd), );
1050# endif 1037# endif
1051_GL_CXXALIAS_SYS (fdatasync, int, (int fd)); 1038_GL_CXXALIAS_SYS (fdatasync, int, (int fd));
1052# endif 1039# endif
@@ -1054,7 +1041,6 @@ _GL_CXXALIAS_SYS (fdatasync, int, (int fd));
1054_GL_CXXALIASWARN (fdatasync); 1041_GL_CXXALIASWARN (fdatasync);
1055# endif 1042# endif
1056#elif defined GNULIB_POSIXCHECK 1043#elif defined GNULIB_POSIXCHECK
1057# undef fdatasync
1058# if HAVE_RAW_DECL_FDATASYNC 1044# if HAVE_RAW_DECL_FDATASYNC
1059_GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - " 1045_GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
1060 "use gnulib module fdatasync for portability"); 1046 "use gnulib module fdatasync for portability");
@@ -1068,12 +1054,11 @@ _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
1068 See POSIX:2008 specification 1054 See POSIX:2008 specification
1069 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */ 1055 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
1070# if !@HAVE_FSYNC@ 1056# if !@HAVE_FSYNC@
1071_GL_FUNCDECL_SYS (fsync, int, (int fd)); 1057_GL_FUNCDECL_SYS (fsync, int, (int fd), );
1072# endif 1058# endif
1073_GL_CXXALIAS_SYS (fsync, int, (int fd)); 1059_GL_CXXALIAS_SYS (fsync, int, (int fd));
1074_GL_CXXALIASWARN (fsync); 1060_GL_CXXALIASWARN (fsync);
1075#elif defined GNULIB_POSIXCHECK 1061#elif defined GNULIB_POSIXCHECK
1076# undef fsync
1077# if HAVE_RAW_DECL_FSYNC 1062# if HAVE_RAW_DECL_FSYNC
1078_GL_WARN_ON_USE (fsync, "fsync is unportable - " 1063_GL_WARN_ON_USE (fsync, "fsync is unportable - "
1079 "use gnulib module fsync for portability"); 1064 "use gnulib module fsync for portability");
@@ -1091,19 +1076,22 @@ _GL_WARN_ON_USE (fsync, "fsync is unportable - "
1091# undef ftruncate 1076# undef ftruncate
1092# define ftruncate rpl_ftruncate 1077# define ftruncate rpl_ftruncate
1093# endif 1078# endif
1094_GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length)); 1079_GL_FUNCDECL_RPL (ftruncate, int,
1095_GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length)); 1080 (int fd, off_t length), _GL_ATTRIBUTE_NODISCARD);
1081_GL_CXXALIAS_RPL (ftruncate, int,
1082 (int fd, off_t length));
1096# else 1083# else
1097# if !@HAVE_FTRUNCATE@ 1084# if !@HAVE_FTRUNCATE@
1098_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); 1085_GL_FUNCDECL_SYS (ftruncate, int,
1086 (int fd, off_t length), _GL_ATTRIBUTE_NODISCARD);
1099# endif 1087# endif
1100_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); 1088_GL_CXXALIAS_SYS (ftruncate, int,
1089 (int fd, off_t length));
1101# endif 1090# endif
1102# if __GLIBC__ >= 2 1091# if __GLIBC__ >= 2
1103_GL_CXXALIASWARN (ftruncate); 1092_GL_CXXALIASWARN (ftruncate);
1104# endif 1093# endif
1105#elif defined GNULIB_POSIXCHECK 1094#elif defined GNULIB_POSIXCHECK
1106# undef ftruncate
1107# if HAVE_RAW_DECL_FTRUNCATE 1095# if HAVE_RAW_DECL_FTRUNCATE
1108_GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " 1096_GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
1109 "use gnulib module ftruncate for portability"); 1097 "use gnulib module ftruncate for portability");
@@ -1126,7 +1114,8 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
1126# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1114# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1127# define getcwd rpl_getcwd 1115# define getcwd rpl_getcwd
1128# endif 1116# endif
1129_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size)); 1117_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size),
1118 _GL_ATTRIBUTE_NODISCARD);
1130_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size)); 1119_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
1131# elif defined _WIN32 && !defined __CYGWIN__ 1120# elif defined _WIN32 && !defined __CYGWIN__
1132# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1121# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1141,7 +1130,6 @@ _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
1141# endif 1130# endif
1142_GL_CXXALIASWARN (getcwd); 1131_GL_CXXALIASWARN (getcwd);
1143#elif defined GNULIB_POSIXCHECK 1132#elif defined GNULIB_POSIXCHECK
1144# undef getcwd
1145# if HAVE_RAW_DECL_GETCWD 1133# if HAVE_RAW_DECL_GETCWD
1146_GL_WARN_ON_USE (getcwd, "getcwd is unportable - " 1134_GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
1147 "use gnulib module getcwd for portability"); 1135 "use gnulib module getcwd for portability");
@@ -1181,21 +1169,24 @@ _GL_CXXALIASWARN (getcwd);
1181# undef getdomainname 1169# undef getdomainname
1182# define getdomainname rpl_getdomainname 1170# define getdomainname rpl_getdomainname
1183# endif 1171# endif
1184_GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len) 1172_GL_FUNCDECL_RPL (getdomainname, int,
1185 _GL_ARG_NONNULL ((1))); 1173 (char *name, size_t len),
1186_GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len)); 1174 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1175_GL_CXXALIAS_RPL (getdomainname, int,
1176 (char *name, size_t len));
1187# else 1177# else
1188# if !@HAVE_DECL_GETDOMAINNAME@ 1178# if !@HAVE_DECL_GETDOMAINNAME@
1189_GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len) 1179_GL_FUNCDECL_SYS (getdomainname, int,
1190 _GL_ARG_NONNULL ((1))); 1180 (char *name, size_t len),
1181 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1191# endif 1182# endif
1192_GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len)); 1183_GL_CXXALIAS_SYS (getdomainname, int,
1184 (char *name, size_t len));
1193# endif 1185# endif
1194# if __GLIBC__ >= 2 1186# if __GLIBC__ >= 2
1195_GL_CXXALIASWARN (getdomainname); 1187_GL_CXXALIASWARN (getdomainname);
1196# endif 1188# endif
1197#elif defined GNULIB_POSIXCHECK 1189#elif defined GNULIB_POSIXCHECK
1198# undef getdomainname
1199# if HAVE_RAW_DECL_GETDOMAINNAME 1190# if HAVE_RAW_DECL_GETDOMAINNAME
1200_GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - " 1191_GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
1201 "use gnulib module getdomainname for portability"); 1192 "use gnulib module getdomainname for portability");
@@ -1211,11 +1202,11 @@ _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
1211# undef getdtablesize 1202# undef getdtablesize
1212# define getdtablesize rpl_getdtablesize 1203# define getdtablesize rpl_getdtablesize
1213# endif 1204# endif
1214_GL_FUNCDECL_RPL (getdtablesize, int, (void)); 1205_GL_FUNCDECL_RPL (getdtablesize, int, (void), );
1215_GL_CXXALIAS_RPL (getdtablesize, int, (void)); 1206_GL_CXXALIAS_RPL (getdtablesize, int, (void));
1216# else 1207# else
1217# if !@HAVE_GETDTABLESIZE@ 1208# if !@HAVE_GETDTABLESIZE@
1218_GL_FUNCDECL_SYS (getdtablesize, int, (void)); 1209_GL_FUNCDECL_SYS (getdtablesize, int, (void), );
1219# endif 1210# endif
1220/* Need to cast, because on AIX, the parameter list is 1211/* Need to cast, because on AIX, the parameter list is
1221 (...). */ 1212 (...). */
@@ -1223,7 +1214,6 @@ _GL_CXXALIAS_SYS_CAST (getdtablesize, int, (void));
1223# endif 1214# endif
1224_GL_CXXALIASWARN (getdtablesize); 1215_GL_CXXALIASWARN (getdtablesize);
1225#elif defined GNULIB_POSIXCHECK 1216#elif defined GNULIB_POSIXCHECK
1226# undef getdtablesize
1227# if HAVE_RAW_DECL_GETDTABLESIZE 1217# if HAVE_RAW_DECL_GETDTABLESIZE
1228_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - " 1218_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
1229 "use gnulib module getdtablesize for portability"); 1219 "use gnulib module getdtablesize for portability");
@@ -1238,19 +1228,22 @@ _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
1238# undef getentropy 1228# undef getentropy
1239# define getentropy rpl_getentropy 1229# define getentropy rpl_getentropy
1240# endif 1230# endif
1241_GL_FUNCDECL_RPL (getentropy, int, (void *buffer, size_t length)); 1231_GL_FUNCDECL_RPL (getentropy, int,
1242_GL_CXXALIAS_RPL (getentropy, int, (void *buffer, size_t length)); 1232 (void *buffer, size_t length), _GL_ATTRIBUTE_NODISCARD);
1233_GL_CXXALIAS_RPL (getentropy, int,
1234 (void *buffer, size_t length));
1243# else 1235# else
1244# if !@HAVE_GETENTROPY@ 1236# if !@HAVE_GETENTROPY@
1245_GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length)); 1237_GL_FUNCDECL_SYS (getentropy, int,
1238 (void *buffer, size_t length), _GL_ATTRIBUTE_NODISCARD);
1246# endif 1239# endif
1247_GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length)); 1240_GL_CXXALIAS_SYS (getentropy, int,
1241 (void *buffer, size_t length));
1248# endif 1242# endif
1249# if __GLIBC__ >= 2 1243# if __GLIBC__ >= 2
1250_GL_CXXALIASWARN (getentropy); 1244_GL_CXXALIASWARN (getentropy);
1251# endif 1245# endif
1252#elif defined GNULIB_POSIXCHECK 1246#elif defined GNULIB_POSIXCHECK
1253# undef getentropy
1254# if HAVE_RAW_DECL_GETENTROPY 1247# if HAVE_RAW_DECL_GETENTROPY
1255_GL_WARN_ON_USE (getentropy, "getentropy is unportable - " 1248_GL_WARN_ON_USE (getentropy, "getentropy is unportable - "
1256 "use gnulib module getentropy for portability"); 1249 "use gnulib module getentropy for portability");
@@ -1269,17 +1262,20 @@ _GL_WARN_ON_USE (getentropy, "getentropy is unportable - "
1269# undef getgroups 1262# undef getgroups
1270# define getgroups rpl_getgroups 1263# define getgroups rpl_getgroups
1271# endif 1264# endif
1272_GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups)); 1265_GL_FUNCDECL_RPL (getgroups, int,
1273_GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups)); 1266 (int n, gid_t *groups), _GL_ATTRIBUTE_NODISCARD);
1267_GL_CXXALIAS_RPL (getgroups, int,
1268 (int n, gid_t *groups));
1274# else 1269# else
1275# if !@HAVE_GETGROUPS@ 1270# if !@HAVE_GETGROUPS@
1276_GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups)); 1271_GL_FUNCDECL_SYS (getgroups, int,
1272 (int n, gid_t *groups), _GL_ATTRIBUTE_NODISCARD);
1277# endif 1273# endif
1278_GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups)); 1274_GL_CXXALIAS_SYS (getgroups, int,
1275 (int n, gid_t *groups));
1279# endif 1276# endif
1280_GL_CXXALIASWARN (getgroups); 1277_GL_CXXALIASWARN (getgroups);
1281#elif defined GNULIB_POSIXCHECK 1278#elif defined GNULIB_POSIXCHECK
1282# undef getgroups
1283# if HAVE_RAW_DECL_GETGROUPS 1279# if HAVE_RAW_DECL_GETGROUPS
1284_GL_WARN_ON_USE (getgroups, "getgroups is unportable - " 1280_GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
1285 "use gnulib module getgroups for portability"); 1281 "use gnulib module getgroups for portability");
@@ -1300,25 +1296,25 @@ _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
1300# undef gethostname 1296# undef gethostname
1301# define gethostname rpl_gethostname 1297# define gethostname rpl_gethostname
1302# endif 1298# endif
1303_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len) 1299_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len),
1304 _GL_ARG_NONNULL ((1))); 1300 _GL_ARG_NONNULL ((1)));
1305_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len)); 1301_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
1306# else 1302# else
1307# if !@HAVE_GETHOSTNAME@ 1303# if !@HAVE_GETHOSTNAME@
1308_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len) 1304_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len),
1309 _GL_ARG_NONNULL ((1))); 1305 _GL_ARG_NONNULL ((1)));
1310# endif 1306# endif
1311/* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second 1307/* Need to cast, because on Solaris 10 systems, the second parameter is
1312 parameter is
1313 int len. */ 1308 int len. */
1314_GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len)); 1309_GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
1315# endif 1310# endif
1316_GL_CXXALIASWARN (gethostname); 1311_GL_CXXALIASWARN (gethostname);
1317#elif @UNISTD_H_HAVE_WINSOCK2_H@ 1312#elif @UNISTD_H_HAVE_WINSOCK2_H@
1318# undef gethostname 1313# if !GNULIB_GETHOSTNAME
1319# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname 1314# undef gethostname
1315# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
1316# endif
1320#elif defined GNULIB_POSIXCHECK 1317#elif defined GNULIB_POSIXCHECK
1321# undef gethostname
1322# if HAVE_RAW_DECL_GETHOSTNAME 1318# if HAVE_RAW_DECL_GETHOSTNAME
1323_GL_WARN_ON_USE (gethostname, "gethostname is unportable - " 1319_GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
1324 "use gnulib module gethostname for portability"); 1320 "use gnulib module gethostname for portability");
@@ -1337,13 +1333,22 @@ _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
1337 ${LOGNAME-$USER} on Unix platforms, 1333 ${LOGNAME-$USER} on Unix platforms,
1338 $USERNAME on native Windows platforms. 1334 $USERNAME on native Windows platforms.
1339 */ 1335 */
1340# if !@HAVE_DECL_GETLOGIN@ 1336# if @REPLACE_GETLOGIN@
1341_GL_FUNCDECL_SYS (getlogin, char *, (void)); 1337# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1342# endif 1338# define getlogin rpl_getlogin
1339# endif
1340_GL_FUNCDECL_RPL (getlogin, char *, (void), );
1341_GL_CXXALIAS_RPL (getlogin, char *, (void));
1342# else
1343# if !@HAVE_DECL_GETLOGIN@
1344_GL_FUNCDECL_SYS (getlogin, char *, (void), );
1345# endif
1343_GL_CXXALIAS_SYS (getlogin, char *, (void)); 1346_GL_CXXALIAS_SYS (getlogin, char *, (void));
1347# endif
1348# if __GLIBC__ >= 2
1344_GL_CXXALIASWARN (getlogin); 1349_GL_CXXALIASWARN (getlogin);
1350# endif
1345#elif defined GNULIB_POSIXCHECK 1351#elif defined GNULIB_POSIXCHECK
1346# undef getlogin
1347# if HAVE_RAW_DECL_GETLOGIN 1352# if HAVE_RAW_DECL_GETLOGIN
1348_GL_WARN_ON_USE (getlogin, "getlogin is unportable - " 1353_GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
1349 "use gnulib module getlogin for portability"); 1354 "use gnulib module getlogin for portability");
@@ -1370,12 +1375,12 @@ _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
1370# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1375# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1371# define getlogin_r rpl_getlogin_r 1376# define getlogin_r rpl_getlogin_r
1372# endif 1377# endif
1373_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size) 1378_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size),
1374 _GL_ARG_NONNULL ((1))); 1379 _GL_ARG_NONNULL ((1)));
1375_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size)); 1380_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
1376# else 1381# else
1377# if !@HAVE_DECL_GETLOGIN_R@ 1382# if !@HAVE_DECL_GETLOGIN_R@
1378_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) 1383_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size),
1379 _GL_ARG_NONNULL ((1))); 1384 _GL_ARG_NONNULL ((1)));
1380# endif 1385# endif
1381/* Need to cast, because on Solaris 10 systems, the second argument is 1386/* Need to cast, because on Solaris 10 systems, the second argument is
@@ -1386,7 +1391,6 @@ _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
1386_GL_CXXALIASWARN (getlogin_r); 1391_GL_CXXALIASWARN (getlogin_r);
1387# endif 1392# endif
1388#elif defined GNULIB_POSIXCHECK 1393#elif defined GNULIB_POSIXCHECK
1389# undef getlogin_r
1390# if HAVE_RAW_DECL_GETLOGIN_R 1394# if HAVE_RAW_DECL_GETLOGIN_R
1391_GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - " 1395_GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
1392 "use gnulib module getlogin_r for portability"); 1396 "use gnulib module getlogin_r for portability");
@@ -1399,13 +1403,13 @@ _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
1399# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1403# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1400# define getpagesize rpl_getpagesize 1404# define getpagesize rpl_getpagesize
1401# endif 1405# endif
1402_GL_FUNCDECL_RPL (getpagesize, int, (void)); 1406_GL_FUNCDECL_RPL (getpagesize, int, (void), );
1403_GL_CXXALIAS_RPL (getpagesize, int, (void)); 1407_GL_CXXALIAS_RPL (getpagesize, int, (void));
1404# else 1408# else
1405/* On HP-UX, getpagesize exists, but it is not declared in <unistd.h> even if 1409/* On HP-UX, getpagesize exists, but it is not declared in <unistd.h> even if
1406 the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */ 1410 the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */
1407# if defined __hpux 1411# if defined __hpux
1408_GL_FUNCDECL_SYS (getpagesize, int, (void)); 1412_GL_FUNCDECL_SYS (getpagesize, int, (void), );
1409# endif 1413# endif
1410# if !@HAVE_GETPAGESIZE@ 1414# if !@HAVE_GETPAGESIZE@
1411# if !defined getpagesize 1415# if !defined getpagesize
@@ -1456,7 +1460,7 @@ _GL_FUNCDECL_SYS (getpagesize, int, (void));
1456# define getpagesize() _gl_getpagesize () 1460# define getpagesize() _gl_getpagesize ()
1457# else 1461# else
1458# if !GNULIB_defined_getpagesize_function 1462# if !GNULIB_defined_getpagesize_function
1459_GL_UNISTD_INLINE int 1463_GL_GETPAGESIZE_INLINE int
1460getpagesize () 1464getpagesize ()
1461{ 1465{
1462 return _gl_getpagesize (); 1466 return _gl_getpagesize ();
@@ -1473,7 +1477,6 @@ _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
1473_GL_CXXALIASWARN (getpagesize); 1477_GL_CXXALIASWARN (getpagesize);
1474# endif 1478# endif
1475#elif defined GNULIB_POSIXCHECK 1479#elif defined GNULIB_POSIXCHECK
1476# undef getpagesize
1477# if HAVE_RAW_DECL_GETPAGESIZE 1480# if HAVE_RAW_DECL_GETPAGESIZE
1478_GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - " 1481_GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
1479 "use gnulib module getpagesize for portability"); 1482 "use gnulib module getpagesize for portability");
@@ -1492,19 +1495,18 @@ _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
1492# undef getpass 1495# undef getpass
1493# define getpass rpl_getpass 1496# define getpass rpl_getpass
1494# endif 1497# endif
1495_GL_FUNCDECL_RPL (getpass, char *, (const char *prompt) 1498_GL_FUNCDECL_RPL (getpass, char *, (const char *prompt),
1496 _GL_ARG_NONNULL ((1))); 1499 _GL_ARG_NONNULL ((1)));
1497_GL_CXXALIAS_RPL (getpass, char *, (const char *prompt)); 1500_GL_CXXALIAS_RPL (getpass, char *, (const char *prompt));
1498# else 1501# else
1499# if !@HAVE_GETPASS@ 1502# if !@HAVE_GETPASS@
1500_GL_FUNCDECL_SYS (getpass, char *, (const char *prompt) 1503_GL_FUNCDECL_SYS (getpass, char *, (const char *prompt),
1501 _GL_ARG_NONNULL ((1))); 1504 _GL_ARG_NONNULL ((1)));
1502# endif 1505# endif
1503_GL_CXXALIAS_SYS (getpass, char *, (const char *prompt)); 1506_GL_CXXALIAS_SYS (getpass, char *, (const char *prompt));
1504# endif 1507# endif
1505_GL_CXXALIASWARN (getpass); 1508_GL_CXXALIASWARN (getpass);
1506#elif defined GNULIB_POSIXCHECK 1509#elif defined GNULIB_POSIXCHECK
1507# undef getpass
1508# if HAVE_RAW_DECL_GETPASS 1510# if HAVE_RAW_DECL_GETPASS
1509_GL_WARN_ON_USE (getpass, "getpass is unportable - " 1511_GL_WARN_ON_USE (getpass, "getpass is unportable - "
1510 "use gnulib module getpass or getpass-gnu for portability"); 1512 "use gnulib module getpass or getpass-gnu for portability");
@@ -1530,15 +1532,23 @@ _GL_CXXALIASWARN (getpid);
1530 1532
1531 1533
1532#if @GNULIB_GETUSERSHELL@ 1534#if @GNULIB_GETUSERSHELL@
1535# if @REPLACE_GETUSERSHELL@
1533/* Return the next valid login shell on the system, or NULL when the end of 1536/* Return the next valid login shell on the system, or NULL when the end of
1534 the list has been reached. */ 1537 the list has been reached. */
1535# if !@HAVE_DECL_GETUSERSHELL@ 1538# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1536_GL_FUNCDECL_SYS (getusershell, char *, (void)); 1539# undef getusershell
1537# endif 1540# define getusershell rpl_getusershell
1541# endif
1542_GL_FUNCDECL_RPL (getusershell, char *, (void), );
1543_GL_CXXALIAS_RPL (getusershell, char *, (void));
1544# else
1545# if !@HAVE_DECL_GETUSERSHELL@
1546_GL_FUNCDECL_SYS (getusershell, char *, (void), );
1547# endif
1538_GL_CXXALIAS_SYS (getusershell, char *, (void)); 1548_GL_CXXALIAS_SYS (getusershell, char *, (void));
1549# endif
1539_GL_CXXALIASWARN (getusershell); 1550_GL_CXXALIASWARN (getusershell);
1540#elif defined GNULIB_POSIXCHECK 1551#elif defined GNULIB_POSIXCHECK
1541# undef getusershell
1542# if HAVE_RAW_DECL_GETUSERSHELL 1552# if HAVE_RAW_DECL_GETUSERSHELL
1543_GL_WARN_ON_USE (getusershell, "getusershell is unportable - " 1553_GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
1544 "use gnulib module getusershell for portability"); 1554 "use gnulib module getusershell for portability");
@@ -1547,13 +1557,21 @@ _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
1547 1557
1548#if @GNULIB_GETUSERSHELL@ 1558#if @GNULIB_GETUSERSHELL@
1549/* Rewind to pointer that is advanced at each getusershell() call. */ 1559/* Rewind to pointer that is advanced at each getusershell() call. */
1550# if !@HAVE_DECL_GETUSERSHELL@ 1560# if @REPLACE_GETUSERSHELL@
1551_GL_FUNCDECL_SYS (setusershell, void, (void)); 1561# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1552# endif 1562# undef setusershell
1563# define setusershell rpl_setusershell
1564# endif
1565_GL_FUNCDECL_RPL (setusershell, void, (void), );
1566_GL_CXXALIAS_RPL (setusershell, void, (void));
1567# else
1568# if !@HAVE_DECL_GETUSERSHELL@
1569_GL_FUNCDECL_SYS (setusershell, void, (void), );
1570# endif
1553_GL_CXXALIAS_SYS (setusershell, void, (void)); 1571_GL_CXXALIAS_SYS (setusershell, void, (void));
1572# endif
1554_GL_CXXALIASWARN (setusershell); 1573_GL_CXXALIASWARN (setusershell);
1555#elif defined GNULIB_POSIXCHECK 1574#elif defined GNULIB_POSIXCHECK
1556# undef setusershell
1557# if HAVE_RAW_DECL_SETUSERSHELL 1575# if HAVE_RAW_DECL_SETUSERSHELL
1558_GL_WARN_ON_USE (setusershell, "setusershell is unportable - " 1576_GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
1559 "use gnulib module getusershell for portability"); 1577 "use gnulib module getusershell for portability");
@@ -1563,13 +1581,21 @@ _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
1563#if @GNULIB_GETUSERSHELL@ 1581#if @GNULIB_GETUSERSHELL@
1564/* Free the pointer that is advanced at each getusershell() call and 1582/* Free the pointer that is advanced at each getusershell() call and
1565 associated resources. */ 1583 associated resources. */
1566# if !@HAVE_DECL_GETUSERSHELL@ 1584# if @REPLACE_GETUSERSHELL@
1567_GL_FUNCDECL_SYS (endusershell, void, (void)); 1585# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1568# endif 1586# undef endusershell
1587# define endusershell rpl_endusershell
1588# endif
1589_GL_FUNCDECL_RPL (endusershell, void, (void), );
1590_GL_CXXALIAS_RPL (endusershell, void, (void));
1591# else
1592# if !@HAVE_DECL_GETUSERSHELL@
1593_GL_FUNCDECL_SYS (endusershell, void, (void), );
1594# endif
1569_GL_CXXALIAS_SYS (endusershell, void, (void)); 1595_GL_CXXALIAS_SYS (endusershell, void, (void));
1596# endif
1570_GL_CXXALIASWARN (endusershell); 1597_GL_CXXALIASWARN (endusershell);
1571#elif defined GNULIB_POSIXCHECK 1598#elif defined GNULIB_POSIXCHECK
1572# undef endusershell
1573# if HAVE_RAW_DECL_ENDUSERSHELL 1599# if HAVE_RAW_DECL_ENDUSERSHELL
1574_GL_WARN_ON_USE (endusershell, "endusershell is unportable - " 1600_GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
1575 "use gnulib module getusershell for portability"); 1601 "use gnulib module getusershell for portability");
@@ -1580,12 +1606,11 @@ _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
1580#if @GNULIB_GROUP_MEMBER@ 1606#if @GNULIB_GROUP_MEMBER@
1581/* Determine whether group id is in calling user's group list. */ 1607/* Determine whether group id is in calling user's group list. */
1582# if !@HAVE_GROUP_MEMBER@ 1608# if !@HAVE_GROUP_MEMBER@
1583_GL_FUNCDECL_SYS (group_member, int, (gid_t gid)); 1609_GL_FUNCDECL_SYS (group_member, int, (gid_t gid), );
1584# endif 1610# endif
1585_GL_CXXALIAS_SYS (group_member, int, (gid_t gid)); 1611_GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
1586_GL_CXXALIASWARN (group_member); 1612_GL_CXXALIASWARN (group_member);
1587#elif defined GNULIB_POSIXCHECK 1613#elif defined GNULIB_POSIXCHECK
1588# undef group_member
1589# if HAVE_RAW_DECL_GROUP_MEMBER 1614# if HAVE_RAW_DECL_GROUP_MEMBER
1590_GL_WARN_ON_USE (group_member, "group_member is unportable - " 1615_GL_WARN_ON_USE (group_member, "group_member is unportable - "
1591 "use gnulib module group-member for portability"); 1616 "use gnulib module group-member for portability");
@@ -1600,7 +1625,7 @@ _GL_WARN_ON_USE (group_member, "group_member is unportable - "
1600# define isatty rpl_isatty 1625# define isatty rpl_isatty
1601# endif 1626# endif
1602# define GNULIB_defined_isatty 1 1627# define GNULIB_defined_isatty 1
1603_GL_FUNCDECL_RPL (isatty, int, (int fd)); 1628_GL_FUNCDECL_RPL (isatty, int, (int fd), );
1604_GL_CXXALIAS_RPL (isatty, int, (int fd)); 1629_GL_CXXALIAS_RPL (isatty, int, (int fd));
1605# elif defined _WIN32 && !defined __CYGWIN__ 1630# elif defined _WIN32 && !defined __CYGWIN__
1606# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1631# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1613,7 +1638,6 @@ _GL_CXXALIAS_SYS (isatty, int, (int fd));
1613# endif 1638# endif
1614_GL_CXXALIASWARN (isatty); 1639_GL_CXXALIASWARN (isatty);
1615#elif defined GNULIB_POSIXCHECK 1640#elif defined GNULIB_POSIXCHECK
1616# undef isatty
1617# if HAVE_RAW_DECL_ISATTY 1641# if HAVE_RAW_DECL_ISATTY
1618_GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - " 1642_GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
1619 "use gnulib module isatty for portability"); 1643 "use gnulib module isatty for portability");
@@ -1646,19 +1670,18 @@ _GL_CXXALIASWARN (isatty);
1646# undef lchown 1670# undef lchown
1647# define lchown rpl_lchown 1671# define lchown rpl_lchown
1648# endif 1672# endif
1649_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group) 1673_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group),
1650 _GL_ARG_NONNULL ((1))); 1674 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1651_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)); 1675_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
1652# else 1676# else
1653# if !@HAVE_LCHOWN@ 1677# if !@HAVE_LCHOWN@
1654_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group) 1678_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group),
1655 _GL_ARG_NONNULL ((1))); 1679 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1656# endif 1680# endif
1657_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)); 1681_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
1658# endif 1682# endif
1659_GL_CXXALIASWARN (lchown); 1683_GL_CXXALIASWARN (lchown);
1660#elif defined GNULIB_POSIXCHECK 1684#elif defined GNULIB_POSIXCHECK
1661# undef lchown
1662# if HAVE_RAW_DECL_LCHOWN 1685# if HAVE_RAW_DECL_LCHOWN
1663_GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - " 1686_GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
1664 "use gnulib module lchown for portability"); 1687 "use gnulib module lchown for portability");
@@ -1675,19 +1698,18 @@ _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
1675# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1698# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1676# define link rpl_link 1699# define link rpl_link
1677# endif 1700# endif
1678_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2) 1701_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2),
1679 _GL_ARG_NONNULL ((1, 2))); 1702 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1680_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2)); 1703_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
1681# else 1704# else
1682# if !@HAVE_LINK@ 1705# if !@HAVE_LINK@
1683_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2) 1706_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2),
1684 _GL_ARG_NONNULL ((1, 2))); 1707 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1685# endif 1708# endif
1686_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2)); 1709_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
1687# endif 1710# endif
1688_GL_CXXALIASWARN (link); 1711_GL_CXXALIASWARN (link);
1689#elif defined GNULIB_POSIXCHECK 1712#elif defined GNULIB_POSIXCHECK
1690# undef link
1691# if HAVE_RAW_DECL_LINK 1713# if HAVE_RAW_DECL_LINK
1692_GL_WARN_ON_USE (link, "link is unportable - " 1714_GL_WARN_ON_USE (link, "link is unportable - "
1693 "use gnulib module link for portability"); 1715 "use gnulib module link for portability");
@@ -1706,8 +1728,8 @@ _GL_WARN_ON_USE (link, "link is unportable - "
1706# endif 1728# endif
1707_GL_FUNCDECL_RPL (linkat, int, 1729_GL_FUNCDECL_RPL (linkat, int,
1708 (int fd1, const char *path1, int fd2, const char *path2, 1730 (int fd1, const char *path1, int fd2, const char *path2,
1709 int flag) 1731 int flag),
1710 _GL_ARG_NONNULL ((2, 4))); 1732 _GL_ARG_NONNULL ((2, 4)) _GL_ATTRIBUTE_NODISCARD);
1711_GL_CXXALIAS_RPL (linkat, int, 1733_GL_CXXALIAS_RPL (linkat, int,
1712 (int fd1, const char *path1, int fd2, const char *path2, 1734 (int fd1, const char *path1, int fd2, const char *path2,
1713 int flag)); 1735 int flag));
@@ -1715,8 +1737,8 @@ _GL_CXXALIAS_RPL (linkat, int,
1715# if !@HAVE_LINKAT@ 1737# if !@HAVE_LINKAT@
1716_GL_FUNCDECL_SYS (linkat, int, 1738_GL_FUNCDECL_SYS (linkat, int,
1717 (int fd1, const char *path1, int fd2, const char *path2, 1739 (int fd1, const char *path1, int fd2, const char *path2,
1718 int flag) 1740 int flag),
1719 _GL_ARG_NONNULL ((2, 4))); 1741 _GL_ARG_NONNULL ((2, 4)) _GL_ATTRIBUTE_NODISCARD);
1720# endif 1742# endif
1721_GL_CXXALIAS_SYS (linkat, int, 1743_GL_CXXALIAS_SYS (linkat, int,
1722 (int fd1, const char *path1, int fd2, const char *path2, 1744 (int fd1, const char *path1, int fd2, const char *path2,
@@ -1726,7 +1748,6 @@ _GL_CXXALIAS_SYS (linkat, int,
1726_GL_CXXALIASWARN (linkat); 1748_GL_CXXALIASWARN (linkat);
1727# endif 1749# endif
1728#elif defined GNULIB_POSIXCHECK 1750#elif defined GNULIB_POSIXCHECK
1729# undef linkat
1730# if HAVE_RAW_DECL_LINKAT 1751# if HAVE_RAW_DECL_LINKAT
1731_GL_WARN_ON_USE (linkat, "linkat is unportable - " 1752_GL_WARN_ON_USE (linkat, "linkat is unportable - "
1732 "use gnulib module linkat for portability"); 1753 "use gnulib module linkat for portability");
@@ -1743,7 +1764,7 @@ _GL_WARN_ON_USE (linkat, "linkat is unportable - "
1743# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1764# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1744# define lseek rpl_lseek 1765# define lseek rpl_lseek
1745# endif 1766# endif
1746_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence)); 1767_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence), );
1747_GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence)); 1768_GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
1748# elif defined _WIN32 && !defined __CYGWIN__ 1769# elif defined _WIN32 && !defined __CYGWIN__
1749# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1770# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1756,7 +1777,6 @@ _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
1756# endif 1777# endif
1757_GL_CXXALIASWARN (lseek); 1778_GL_CXXALIASWARN (lseek);
1758#elif defined GNULIB_POSIXCHECK 1779#elif defined GNULIB_POSIXCHECK
1759# undef lseek
1760# if HAVE_RAW_DECL_LSEEK 1780# if HAVE_RAW_DECL_LSEEK
1761_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some " 1781_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
1762 "systems - use gnulib module lseek for portability"); 1782 "systems - use gnulib module lseek for portability");
@@ -1783,12 +1803,12 @@ _GL_CXXALIASWARN (lseek);
1783 Store the read-end as fd[0] and the write-end as fd[1]. 1803 Store the read-end as fd[0] and the write-end as fd[1].
1784 Return 0 upon success, or -1 with errno set upon failure. */ 1804 Return 0 upon success, or -1 with errno set upon failure. */
1785# if !@HAVE_PIPE@ 1805# if !@HAVE_PIPE@
1786_GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1))); 1806_GL_FUNCDECL_SYS (pipe, int, (int fd[2]),
1807 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1787# endif 1808# endif
1788_GL_CXXALIAS_SYS (pipe, int, (int fd[2])); 1809_GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
1789_GL_CXXALIASWARN (pipe); 1810_GL_CXXALIASWARN (pipe);
1790#elif defined GNULIB_POSIXCHECK 1811#elif defined GNULIB_POSIXCHECK
1791# undef pipe
1792# if HAVE_RAW_DECL_PIPE 1812# if HAVE_RAW_DECL_PIPE
1793_GL_WARN_ON_USE (pipe, "pipe is unportable - " 1813_GL_WARN_ON_USE (pipe, "pipe is unportable - "
1794 "use gnulib module pipe-posix for portability"); 1814 "use gnulib module pipe-posix for portability");
@@ -1810,17 +1830,18 @@ _GL_WARN_ON_USE (pipe, "pipe is unportable - "
1810# undef pipe2 1830# undef pipe2
1811# define pipe2 rpl_pipe2 1831# define pipe2 rpl_pipe2
1812# endif 1832# endif
1813_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); 1833_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags),
1834 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1814_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags)); 1835_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
1815# else 1836# else
1816_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); 1837_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags),
1838 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1817_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags)); 1839_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
1818# endif 1840# endif
1819# if __GLIBC__ >= 2 1841# if __GLIBC__ >= 2
1820_GL_CXXALIASWARN (pipe2); 1842_GL_CXXALIASWARN (pipe2);
1821# endif 1843# endif
1822#elif defined GNULIB_POSIXCHECK 1844#elif defined GNULIB_POSIXCHECK
1823# undef pipe2
1824# if HAVE_RAW_DECL_PIPE2 1845# if HAVE_RAW_DECL_PIPE2
1825_GL_WARN_ON_USE (pipe2, "pipe2 is unportable - " 1846_GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
1826 "use gnulib module pipe2 for portability"); 1847 "use gnulib module pipe2 for portability");
@@ -1840,15 +1861,15 @@ _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
1840# define pread rpl_pread 1861# define pread rpl_pread
1841# endif 1862# endif
1842_GL_FUNCDECL_RPL (pread, ssize_t, 1863_GL_FUNCDECL_RPL (pread, ssize_t,
1843 (int fd, void *buf, size_t bufsize, off_t offset) 1864 (int fd, void *buf, size_t bufsize, off_t offset),
1844 _GL_ARG_NONNULL ((2))); 1865 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1845_GL_CXXALIAS_RPL (pread, ssize_t, 1866_GL_CXXALIAS_RPL (pread, ssize_t,
1846 (int fd, void *buf, size_t bufsize, off_t offset)); 1867 (int fd, void *buf, size_t bufsize, off_t offset));
1847# else 1868# else
1848# if !@HAVE_PREAD@ 1869# if !@HAVE_PREAD@
1849_GL_FUNCDECL_SYS (pread, ssize_t, 1870_GL_FUNCDECL_SYS (pread, ssize_t,
1850 (int fd, void *buf, size_t bufsize, off_t offset) 1871 (int fd, void *buf, size_t bufsize, off_t offset),
1851 _GL_ARG_NONNULL ((2))); 1872 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1852# endif 1873# endif
1853_GL_CXXALIAS_SYS (pread, ssize_t, 1874_GL_CXXALIAS_SYS (pread, ssize_t,
1854 (int fd, void *buf, size_t bufsize, off_t offset)); 1875 (int fd, void *buf, size_t bufsize, off_t offset));
@@ -1857,7 +1878,6 @@ _GL_CXXALIAS_SYS (pread, ssize_t,
1857_GL_CXXALIASWARN (pread); 1878_GL_CXXALIASWARN (pread);
1858# endif 1879# endif
1859#elif defined GNULIB_POSIXCHECK 1880#elif defined GNULIB_POSIXCHECK
1860# undef pread
1861# if HAVE_RAW_DECL_PREAD 1881# if HAVE_RAW_DECL_PREAD
1862_GL_WARN_ON_USE (pread, "pread is unportable - " 1882_GL_WARN_ON_USE (pread, "pread is unportable - "
1863 "use gnulib module pread for portability"); 1883 "use gnulib module pread for portability");
@@ -1877,15 +1897,15 @@ _GL_WARN_ON_USE (pread, "pread is unportable - "
1877# define pwrite rpl_pwrite 1897# define pwrite rpl_pwrite
1878# endif 1898# endif
1879_GL_FUNCDECL_RPL (pwrite, ssize_t, 1899_GL_FUNCDECL_RPL (pwrite, ssize_t,
1880 (int fd, const void *buf, size_t bufsize, off_t offset) 1900 (int fd, const void *buf, size_t bufsize, off_t offset),
1881 _GL_ARG_NONNULL ((2))); 1901 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1882_GL_CXXALIAS_RPL (pwrite, ssize_t, 1902_GL_CXXALIAS_RPL (pwrite, ssize_t,
1883 (int fd, const void *buf, size_t bufsize, off_t offset)); 1903 (int fd, const void *buf, size_t bufsize, off_t offset));
1884# else 1904# else
1885# if !@HAVE_PWRITE@ 1905# if !@HAVE_PWRITE@
1886_GL_FUNCDECL_SYS (pwrite, ssize_t, 1906_GL_FUNCDECL_SYS (pwrite, ssize_t,
1887 (int fd, const void *buf, size_t bufsize, off_t offset) 1907 (int fd, const void *buf, size_t bufsize, off_t offset),
1888 _GL_ARG_NONNULL ((2))); 1908 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1889# endif 1909# endif
1890_GL_CXXALIAS_SYS (pwrite, ssize_t, 1910_GL_CXXALIAS_SYS (pwrite, ssize_t,
1891 (int fd, const void *buf, size_t bufsize, off_t offset)); 1911 (int fd, const void *buf, size_t bufsize, off_t offset));
@@ -1894,7 +1914,6 @@ _GL_CXXALIAS_SYS (pwrite, ssize_t,
1894_GL_CXXALIASWARN (pwrite); 1914_GL_CXXALIASWARN (pwrite);
1895# endif 1915# endif
1896#elif defined GNULIB_POSIXCHECK 1916#elif defined GNULIB_POSIXCHECK
1897# undef pwrite
1898# if HAVE_RAW_DECL_PWRITE 1917# if HAVE_RAW_DECL_PWRITE
1899_GL_WARN_ON_USE (pwrite, "pwrite is unportable - " 1918_GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1900 "use gnulib module pwrite for portability"); 1919 "use gnulib module pwrite for portability");
@@ -1911,8 +1930,9 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1911# undef read 1930# undef read
1912# define read rpl_read 1931# define read rpl_read
1913# endif 1932# endif
1914_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count) 1933
1915 _GL_ARG_NONNULL ((2))); 1934_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count),
1935 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1916_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count)); 1936_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
1917# elif defined _WIN32 && !defined __CYGWIN__ 1937# elif defined _WIN32 && !defined __CYGWIN__
1918# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1938# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1933,11 +1953,7 @@ _GL_CXXALIASWARN (read);
1933# undef read 1953# undef read
1934# define read _read 1954# define read _read
1935# endif 1955# endif
1936# ifdef __MINGW32__ 1956_GL_CXXALIAS_MDA_CAST (read, ssize_t, (int fd, void *buf, unsigned int count));
1937_GL_CXXALIAS_MDA (read, int, (int fd, void *buf, unsigned int count));
1938# else
1939_GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, unsigned int count));
1940# endif
1941# else 1957# else
1942_GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count)); 1958_GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count));
1943# endif 1959# endif
@@ -1957,8 +1973,8 @@ _GL_CXXALIASWARN (read);
1957# endif 1973# endif
1958_GL_FUNCDECL_RPL (readlink, ssize_t, 1974_GL_FUNCDECL_RPL (readlink, ssize_t,
1959 (const char *restrict file, 1975 (const char *restrict file,
1960 char *restrict buf, size_t bufsize) 1976 char *restrict buf, size_t bufsize),
1961 _GL_ARG_NONNULL ((1, 2))); 1977 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1962_GL_CXXALIAS_RPL (readlink, ssize_t, 1978_GL_CXXALIAS_RPL (readlink, ssize_t,
1963 (const char *restrict file, 1979 (const char *restrict file,
1964 char *restrict buf, size_t bufsize)); 1980 char *restrict buf, size_t bufsize));
@@ -1966,8 +1982,8 @@ _GL_CXXALIAS_RPL (readlink, ssize_t,
1966# if !@HAVE_READLINK@ 1982# if !@HAVE_READLINK@
1967_GL_FUNCDECL_SYS (readlink, ssize_t, 1983_GL_FUNCDECL_SYS (readlink, ssize_t,
1968 (const char *restrict file, 1984 (const char *restrict file,
1969 char *restrict buf, size_t bufsize) 1985 char *restrict buf, size_t bufsize),
1970 _GL_ARG_NONNULL ((1, 2))); 1986 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1971# endif 1987# endif
1972_GL_CXXALIAS_SYS (readlink, ssize_t, 1988_GL_CXXALIAS_SYS (readlink, ssize_t,
1973 (const char *restrict file, 1989 (const char *restrict file,
@@ -1975,7 +1991,6 @@ _GL_CXXALIAS_SYS (readlink, ssize_t,
1975# endif 1991# endif
1976_GL_CXXALIASWARN (readlink); 1992_GL_CXXALIASWARN (readlink);
1977#elif defined GNULIB_POSIXCHECK 1993#elif defined GNULIB_POSIXCHECK
1978# undef readlink
1979# if HAVE_RAW_DECL_READLINK 1994# if HAVE_RAW_DECL_READLINK
1980_GL_WARN_ON_USE (readlink, "readlink is unportable - " 1995_GL_WARN_ON_USE (readlink, "readlink is unportable - "
1981 "use gnulib module readlink for portability"); 1996 "use gnulib module readlink for portability");
@@ -1990,8 +2005,8 @@ _GL_WARN_ON_USE (readlink, "readlink is unportable - "
1990# endif 2005# endif
1991_GL_FUNCDECL_RPL (readlinkat, ssize_t, 2006_GL_FUNCDECL_RPL (readlinkat, ssize_t,
1992 (int fd, char const *restrict file, 2007 (int fd, char const *restrict file,
1993 char *restrict buf, size_t len) 2008 char *restrict buf, size_t len),
1994 _GL_ARG_NONNULL ((2, 3))); 2009 _GL_ARG_NONNULL ((2, 3)) _GL_ATTRIBUTE_NODISCARD);
1995_GL_CXXALIAS_RPL (readlinkat, ssize_t, 2010_GL_CXXALIAS_RPL (readlinkat, ssize_t,
1996 (int fd, char const *restrict file, 2011 (int fd, char const *restrict file,
1997 char *restrict buf, size_t len)); 2012 char *restrict buf, size_t len));
@@ -1999,8 +2014,8 @@ _GL_CXXALIAS_RPL (readlinkat, ssize_t,
1999# if !@HAVE_READLINKAT@ 2014# if !@HAVE_READLINKAT@
2000_GL_FUNCDECL_SYS (readlinkat, ssize_t, 2015_GL_FUNCDECL_SYS (readlinkat, ssize_t,
2001 (int fd, char const *restrict file, 2016 (int fd, char const *restrict file,
2002 char *restrict buf, size_t len) 2017 char *restrict buf, size_t len),
2003 _GL_ARG_NONNULL ((2, 3))); 2018 _GL_ARG_NONNULL ((2, 3)) _GL_ATTRIBUTE_NODISCARD);
2004# endif 2019# endif
2005_GL_CXXALIAS_SYS (readlinkat, ssize_t, 2020_GL_CXXALIAS_SYS (readlinkat, ssize_t,
2006 (int fd, char const *restrict file, 2021 (int fd, char const *restrict file,
@@ -2010,7 +2025,6 @@ _GL_CXXALIAS_SYS (readlinkat, ssize_t,
2010_GL_CXXALIASWARN (readlinkat); 2025_GL_CXXALIASWARN (readlinkat);
2011# endif 2026# endif
2012#elif defined GNULIB_POSIXCHECK 2027#elif defined GNULIB_POSIXCHECK
2013# undef readlinkat
2014# if HAVE_RAW_DECL_READLINKAT 2028# if HAVE_RAW_DECL_READLINKAT
2015_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - " 2029_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
2016 "use gnulib module readlinkat for portability"); 2030 "use gnulib module readlinkat for portability");
@@ -2024,7 +2038,7 @@ _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
2024# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2038# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2025# define rmdir rpl_rmdir 2039# define rmdir rpl_rmdir
2026# endif 2040# endif
2027_GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1))); 2041_GL_FUNCDECL_RPL (rmdir, int, (char const *name), _GL_ARG_NONNULL ((1)));
2028_GL_CXXALIAS_RPL (rmdir, int, (char const *name)); 2042_GL_CXXALIAS_RPL (rmdir, int, (char const *name));
2029# elif defined _WIN32 && !defined __CYGWIN__ 2043# elif defined _WIN32 && !defined __CYGWIN__
2030# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2044# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -2037,7 +2051,6 @@ _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
2037# endif 2051# endif
2038_GL_CXXALIASWARN (rmdir); 2052_GL_CXXALIASWARN (rmdir);
2039#elif defined GNULIB_POSIXCHECK 2053#elif defined GNULIB_POSIXCHECK
2040# undef rmdir
2041# if HAVE_RAW_DECL_RMDIR 2054# if HAVE_RAW_DECL_RMDIR
2042_GL_WARN_ON_USE (rmdir, "rmdir is unportable - " 2055_GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
2043 "use gnulib module rmdir for portability"); 2056 "use gnulib module rmdir for portability");
@@ -2073,24 +2086,27 @@ _GL_CXXALIASWARN (rmdir);
2073# undef sethostname 2086# undef sethostname
2074# define sethostname rpl_sethostname 2087# define sethostname rpl_sethostname
2075# endif 2088# endif
2076_GL_FUNCDECL_RPL (sethostname, int, (const char *name, size_t len) 2089_GL_FUNCDECL_RPL (sethostname, int,
2077 _GL_ARG_NONNULL ((1))); 2090 (const char *name, size_t len),
2078_GL_CXXALIAS_RPL (sethostname, int, (const char *name, size_t len)); 2091 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2092_GL_CXXALIAS_RPL (sethostname, int,
2093 (const char *name, size_t len));
2079# else 2094# else
2080# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@ 2095# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
2081_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len) 2096_GL_FUNCDECL_SYS (sethostname, int,
2082 _GL_ARG_NONNULL ((1))); 2097 (const char *name, size_t len),
2098 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2083# endif 2099# endif
2084/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5 2100/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, and FreeBSD 6.4
2085 and FreeBSD 6.4 the second parameter is int. On Solaris 11 2101 the second parameter is int. On Solaris 11 2011-10, the first parameter is
2086 2011-10, the first parameter is not const. */ 2102 not const. */
2087_GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len)); 2103_GL_CXXALIAS_SYS_CAST (sethostname, int,
2104 (const char *name, size_t len));
2088# endif 2105# endif
2089# if __GLIBC__ >= 2 2106# if __GLIBC__ >= 2
2090_GL_CXXALIASWARN (sethostname); 2107_GL_CXXALIASWARN (sethostname);
2091# endif 2108# endif
2092#elif defined GNULIB_POSIXCHECK 2109#elif defined GNULIB_POSIXCHECK
2093# undef sethostname
2094# if HAVE_RAW_DECL_SETHOSTNAME 2110# if HAVE_RAW_DECL_SETHOSTNAME
2095_GL_WARN_ON_USE (sethostname, "sethostname is unportable - " 2111_GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
2096 "use gnulib module sethostname for portability"); 2112 "use gnulib module sethostname for portability");
@@ -2108,17 +2124,16 @@ _GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
2108# undef sleep 2124# undef sleep
2109# define sleep rpl_sleep 2125# define sleep rpl_sleep
2110# endif 2126# endif
2111_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n)); 2127_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n), );
2112_GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n)); 2128_GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
2113# else 2129# else
2114# if !@HAVE_SLEEP@ 2130# if !@HAVE_SLEEP@
2115_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n)); 2131_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n), );
2116# endif 2132# endif
2117_GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n)); 2133_GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
2118# endif 2134# endif
2119_GL_CXXALIASWARN (sleep); 2135_GL_CXXALIASWARN (sleep);
2120#elif defined GNULIB_POSIXCHECK 2136#elif defined GNULIB_POSIXCHECK
2121# undef sleep
2122# if HAVE_RAW_DECL_SLEEP 2137# if HAVE_RAW_DECL_SLEEP
2123_GL_WARN_ON_USE (sleep, "sleep is unportable - " 2138_GL_WARN_ON_USE (sleep, "sleep is unportable - "
2124 "use gnulib module sleep for portability"); 2139 "use gnulib module sleep for portability");
@@ -2157,19 +2172,22 @@ _GL_CXXALIASWARN (swab);
2157# undef symlink 2172# undef symlink
2158# define symlink rpl_symlink 2173# define symlink rpl_symlink
2159# endif 2174# endif
2160_GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file) 2175_GL_FUNCDECL_RPL (symlink, int,
2161 _GL_ARG_NONNULL ((1, 2))); 2176 (char const *contents, char const *file),
2162_GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file)); 2177 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
2178_GL_CXXALIAS_RPL (symlink, int,
2179 (char const *contents, char const *file));
2163# else 2180# else
2164# if !@HAVE_SYMLINK@ 2181# if !@HAVE_SYMLINK@
2165_GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file) 2182_GL_FUNCDECL_SYS (symlink, int,
2166 _GL_ARG_NONNULL ((1, 2))); 2183 (char const *contents, char const *file),
2184 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
2167# endif 2185# endif
2168_GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file)); 2186_GL_CXXALIAS_SYS (symlink, int,
2187 (char const *contents, char const *file));
2169# endif 2188# endif
2170_GL_CXXALIASWARN (symlink); 2189_GL_CXXALIASWARN (symlink);
2171#elif defined GNULIB_POSIXCHECK 2190#elif defined GNULIB_POSIXCHECK
2172# undef symlink
2173# if HAVE_RAW_DECL_SYMLINK 2191# if HAVE_RAW_DECL_SYMLINK
2174_GL_WARN_ON_USE (symlink, "symlink is not portable - " 2192_GL_WARN_ON_USE (symlink, "symlink is not portable - "
2175 "use gnulib module symlink for portability"); 2193 "use gnulib module symlink for portability");
@@ -2184,15 +2202,15 @@ _GL_WARN_ON_USE (symlink, "symlink is not portable - "
2184# define symlinkat rpl_symlinkat 2202# define symlinkat rpl_symlinkat
2185# endif 2203# endif
2186_GL_FUNCDECL_RPL (symlinkat, int, 2204_GL_FUNCDECL_RPL (symlinkat, int,
2187 (char const *contents, int fd, char const *file) 2205 (char const *contents, int fd, char const *file),
2188 _GL_ARG_NONNULL ((1, 3))); 2206 _GL_ARG_NONNULL ((1, 3)) _GL_ATTRIBUTE_NODISCARD);
2189_GL_CXXALIAS_RPL (symlinkat, int, 2207_GL_CXXALIAS_RPL (symlinkat, int,
2190 (char const *contents, int fd, char const *file)); 2208 (char const *contents, int fd, char const *file));
2191# else 2209# else
2192# if !@HAVE_SYMLINKAT@ 2210# if !@HAVE_SYMLINKAT@
2193_GL_FUNCDECL_SYS (symlinkat, int, 2211_GL_FUNCDECL_SYS (symlinkat, int,
2194 (char const *contents, int fd, char const *file) 2212 (char const *contents, int fd, char const *file),
2195 _GL_ARG_NONNULL ((1, 3))); 2213 _GL_ARG_NONNULL ((1, 3)) _GL_ATTRIBUTE_NODISCARD);
2196# endif 2214# endif
2197_GL_CXXALIAS_SYS (symlinkat, int, 2215_GL_CXXALIAS_SYS (symlinkat, int,
2198 (char const *contents, int fd, char const *file)); 2216 (char const *contents, int fd, char const *file));
@@ -2201,7 +2219,6 @@ _GL_CXXALIAS_SYS (symlinkat, int,
2201_GL_CXXALIASWARN (symlinkat); 2219_GL_CXXALIASWARN (symlinkat);
2202# endif 2220# endif
2203#elif defined GNULIB_POSIXCHECK 2221#elif defined GNULIB_POSIXCHECK
2204# undef symlinkat
2205# if HAVE_RAW_DECL_SYMLINKAT 2222# if HAVE_RAW_DECL_SYMLINKAT
2206_GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - " 2223_GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
2207 "use gnulib module symlinkat for portability"); 2224 "use gnulib module symlinkat for portability");
@@ -2219,13 +2236,13 @@ _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
2219# undef truncate 2236# undef truncate
2220# define truncate rpl_truncate 2237# define truncate rpl_truncate
2221# endif 2238# endif
2222_GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length) 2239_GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length),
2223 _GL_ARG_NONNULL ((1))); 2240 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2224_GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length)); 2241_GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length));
2225# else 2242# else
2226# if !@HAVE_DECL_TRUNCATE@ 2243# if !@HAVE_DECL_TRUNCATE@
2227_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length) 2244_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length),
2228 _GL_ARG_NONNULL ((1))); 2245 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2229# endif 2246# endif
2230_GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length)); 2247_GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length));
2231# endif 2248# endif
@@ -2233,7 +2250,6 @@ _GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length));
2233_GL_CXXALIASWARN (truncate); 2250_GL_CXXALIASWARN (truncate);
2234# endif 2251# endif
2235#elif defined GNULIB_POSIXCHECK 2252#elif defined GNULIB_POSIXCHECK
2236# undef truncate
2237# if HAVE_RAW_DECL_TRUNCATE 2253# if HAVE_RAW_DECL_TRUNCATE
2238_GL_WARN_ON_USE (truncate, "truncate is unportable - " 2254_GL_WARN_ON_USE (truncate, "truncate is unportable - "
2239 "use gnulib module truncate for portability"); 2255 "use gnulib module truncate for portability");
@@ -2250,13 +2266,15 @@ _GL_WARN_ON_USE (truncate, "truncate is unportable - "
2250# define ttyname_r rpl_ttyname_r 2266# define ttyname_r rpl_ttyname_r
2251# endif 2267# endif
2252_GL_FUNCDECL_RPL (ttyname_r, int, 2268_GL_FUNCDECL_RPL (ttyname_r, int,
2253 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); 2269 (int fd, char *buf, size_t buflen),
2270 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
2254_GL_CXXALIAS_RPL (ttyname_r, int, 2271_GL_CXXALIAS_RPL (ttyname_r, int,
2255 (int fd, char *buf, size_t buflen)); 2272 (int fd, char *buf, size_t buflen));
2256# else 2273# else
2257# if !@HAVE_DECL_TTYNAME_R@ 2274# if !@HAVE_DECL_TTYNAME_R@
2258_GL_FUNCDECL_SYS (ttyname_r, int, 2275_GL_FUNCDECL_SYS (ttyname_r, int,
2259 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); 2276 (int fd, char *buf, size_t buflen),
2277 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
2260# endif 2278# endif
2261_GL_CXXALIAS_SYS (ttyname_r, int, 2279_GL_CXXALIAS_SYS (ttyname_r, int,
2262 (int fd, char *buf, size_t buflen)); 2280 (int fd, char *buf, size_t buflen));
@@ -2265,7 +2283,6 @@ _GL_CXXALIAS_SYS (ttyname_r, int,
2265_GL_CXXALIASWARN (ttyname_r); 2283_GL_CXXALIASWARN (ttyname_r);
2266# endif 2284# endif
2267#elif defined GNULIB_POSIXCHECK 2285#elif defined GNULIB_POSIXCHECK
2268# undef ttyname_r
2269# if HAVE_RAW_DECL_TTYNAME_R 2286# if HAVE_RAW_DECL_TTYNAME_R
2270_GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - " 2287_GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
2271 "use gnulib module ttyname_r for portability"); 2288 "use gnulib module ttyname_r for portability");
@@ -2279,7 +2296,7 @@ _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
2279# undef unlink 2296# undef unlink
2280# define unlink rpl_unlink 2297# define unlink rpl_unlink
2281# endif 2298# endif
2282_GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1))); 2299_GL_FUNCDECL_RPL (unlink, int, (char const *file), _GL_ARG_NONNULL ((1)));
2283_GL_CXXALIAS_RPL (unlink, int, (char const *file)); 2300_GL_CXXALIAS_RPL (unlink, int, (char const *file));
2284# elif defined _WIN32 && !defined __CYGWIN__ 2301# elif defined _WIN32 && !defined __CYGWIN__
2285# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2302# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -2292,7 +2309,6 @@ _GL_CXXALIAS_SYS (unlink, int, (char const *file));
2292# endif 2309# endif
2293_GL_CXXALIASWARN (unlink); 2310_GL_CXXALIASWARN (unlink);
2294#elif defined GNULIB_POSIXCHECK 2311#elif defined GNULIB_POSIXCHECK
2295# undef unlink
2296# if HAVE_RAW_DECL_UNLINK 2312# if HAVE_RAW_DECL_UNLINK
2297_GL_WARN_ON_USE (unlink, "unlink is not portable - " 2313_GL_WARN_ON_USE (unlink, "unlink is not portable - "
2298 "use gnulib module unlink for portability"); 2314 "use gnulib module unlink for portability");
@@ -2320,19 +2336,18 @@ _GL_CXXALIASWARN (unlink);
2320# undef unlinkat 2336# undef unlinkat
2321# define unlinkat rpl_unlinkat 2337# define unlinkat rpl_unlinkat
2322# endif 2338# endif
2323_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag) 2339_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag),
2324 _GL_ARG_NONNULL ((2))); 2340 _GL_ARG_NONNULL ((2)));
2325_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag)); 2341_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
2326# else 2342# else
2327# if !@HAVE_UNLINKAT@ 2343# if !@HAVE_UNLINKAT@
2328_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag) 2344_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag),
2329 _GL_ARG_NONNULL ((2))); 2345 _GL_ARG_NONNULL ((2)));
2330# endif 2346# endif
2331_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag)); 2347_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
2332# endif 2348# endif
2333_GL_CXXALIASWARN (unlinkat); 2349_GL_CXXALIASWARN (unlinkat);
2334#elif defined GNULIB_POSIXCHECK 2350#elif defined GNULIB_POSIXCHECK
2335# undef unlinkat
2336# if HAVE_RAW_DECL_UNLINKAT 2351# if HAVE_RAW_DECL_UNLINKAT
2337_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " 2352_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
2338 "use gnulib module unlinkat for portability"); 2353 "use gnulib module unlinkat for portability");
@@ -2343,18 +2358,18 @@ _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
2343#if @GNULIB_USLEEP@ 2358#if @GNULIB_USLEEP@
2344/* Pause the execution of the current thread for N microseconds. 2359/* Pause the execution of the current thread for N microseconds.
2345 Returns 0 on completion, or -1 on range error. 2360 Returns 0 on completion, or -1 on range error.
2346 See the POSIX:2001 specification 2361 See the POSIX.1-2004 specification
2347 <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */ 2362 <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */
2348# if @REPLACE_USLEEP@ 2363# if @REPLACE_USLEEP@
2349# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2364# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2350# undef usleep 2365# undef usleep
2351# define usleep rpl_usleep 2366# define usleep rpl_usleep
2352# endif 2367# endif
2353_GL_FUNCDECL_RPL (usleep, int, (useconds_t n)); 2368_GL_FUNCDECL_RPL (usleep, int, (useconds_t n), );
2354_GL_CXXALIAS_RPL (usleep, int, (useconds_t n)); 2369_GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
2355# else 2370# else
2356# if !@HAVE_USLEEP@ 2371# if !@HAVE_USLEEP@
2357_GL_FUNCDECL_SYS (usleep, int, (useconds_t n)); 2372_GL_FUNCDECL_SYS (usleep, int, (useconds_t n), );
2358# endif 2373# endif
2359/* Need to cast, because on Haiku, the first parameter is 2374/* Need to cast, because on Haiku, the first parameter is
2360 unsigned int n. */ 2375 unsigned int n. */
@@ -2362,7 +2377,6 @@ _GL_CXXALIAS_SYS_CAST (usleep, int, (useconds_t n));
2362# endif 2377# endif
2363_GL_CXXALIASWARN (usleep); 2378_GL_CXXALIASWARN (usleep);
2364#elif defined GNULIB_POSIXCHECK 2379#elif defined GNULIB_POSIXCHECK
2365# undef usleep
2366# if HAVE_RAW_DECL_USLEEP 2380# if HAVE_RAW_DECL_USLEEP
2367_GL_WARN_ON_USE (usleep, "usleep is unportable - " 2381_GL_WARN_ON_USE (usleep, "usleep is unportable - "
2368 "use gnulib module usleep for portability"); 2382 "use gnulib module usleep for portability");
@@ -2379,17 +2393,21 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - "
2379# undef write 2393# undef write
2380# define write rpl_write 2394# define write rpl_write
2381# endif 2395# endif
2382_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count) 2396_GL_FUNCDECL_RPL (write, ssize_t,
2383 _GL_ARG_NONNULL ((2))); 2397 (int fd, const void *buf, size_t count),
2384_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count)); 2398 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
2399_GL_CXXALIAS_RPL (write, ssize_t,
2400 (int fd, const void *buf, size_t count));
2385# elif defined _WIN32 && !defined __CYGWIN__ 2401# elif defined _WIN32 && !defined __CYGWIN__
2386# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2402# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2387# undef write 2403# undef write
2388# define write _write 2404# define write _write
2389# endif 2405# endif
2390_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count)); 2406_GL_CXXALIAS_MDA (write, ssize_t,
2407 (int fd, const void *buf, size_t count));
2391# else 2408# else
2392_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count)); 2409_GL_CXXALIAS_SYS (write, ssize_t,
2410 (int fd, const void *buf, size_t count));
2393# endif 2411# endif
2394_GL_CXXALIASWARN (write); 2412_GL_CXXALIASWARN (write);
2395#elif @GNULIB_MDA_WRITE@ 2413#elif @GNULIB_MDA_WRITE@
@@ -2401,19 +2419,29 @@ _GL_CXXALIASWARN (write);
2401# undef write 2419# undef write
2402# define write _write 2420# define write _write
2403# endif 2421# endif
2404# ifdef __MINGW32__ 2422_GL_CXXALIAS_MDA_CAST (write, ssize_t,
2405_GL_CXXALIAS_MDA (write, int, (int fd, const void *buf, unsigned int count)); 2423 (int fd, const void *buf, unsigned int count));
2406# else
2407_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, unsigned int count));
2408# endif
2409# else 2424# else
2410_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count)); 2425_GL_CXXALIAS_SYS (write, ssize_t,
2426 (int fd, const void *buf, size_t count));
2411# endif 2427# endif
2412_GL_CXXALIASWARN (write); 2428_GL_CXXALIASWARN (write);
2413#endif 2429#endif
2414 2430
2415_GL_INLINE_HEADER_END 2431_GL_INLINE_HEADER_END
2416 2432
2433
2434/* Includes that provide only macros that don't need to be overridden.
2435 (Includes that are needed for type definitions and function declarations
2436 have their place above, before the function overrides.) */
2437
2438/* FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, Solaris 11.4, and glibc 2.41
2439 do not define O_CLOEXEC in <unistd.h>. */
2440#if ! defined O_CLOEXEC
2441# include <fcntl.h>
2442#endif
2443
2444
2417#endif /* _@GUARD_PREFIX@_UNISTD_H */ 2445#endif /* _@GUARD_PREFIX@_UNISTD_H */
2418#endif /* _GL_INCLUDING_UNISTD_H */ 2446#endif /* _GL_INCLUDING_UNISTD_H */
2419#endif /* _@GUARD_PREFIX@_UNISTD_H */ 2447#endif /* _@GUARD_PREFIX@_UNISTD_H */
diff --git a/gl/unitypes.in.h b/gl/unitypes.in.h
new file mode 100644
index 00000000..6d54baa8
--- /dev/null
+++ b/gl/unitypes.in.h
@@ -0,0 +1,71 @@
1/* Elementary types and macros for the GNU UniString library.
2 Copyright (C) 2002, 2005-2006, 2009-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#ifndef _UNITYPES_H
18#define _UNITYPES_H
19
20/* Get uint8_t, uint16_t, uint32_t. */
21#include <stdint.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27
28/* Type representing a Unicode character. */
29typedef uint32_t ucs4_t;
30
31/* Attribute of a function whose result depends only on the arguments
32 (not pointers!) and which has no side effects. */
33#ifndef _UC_ATTRIBUTE_CONST
34# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) || defined __clang__
35# define _UC_ATTRIBUTE_CONST __attribute__ ((__const__))
36# else
37# define _UC_ATTRIBUTE_CONST
38# endif
39#endif
40
41/* Attribute of a function whose result depends only on the arguments
42 (possibly pointers) and global memory, and which has no side effects. */
43#ifndef _UC_ATTRIBUTE_PURE
44# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
45# define _UC_ATTRIBUTE_PURE __attribute__ ((__pure__))
46# else
47# define _UC_ATTRIBUTE_PURE
48# endif
49#endif
50
51/* Qualifier in a function declaration, that asserts that the caller must
52 pass a pointer to a different object in the specified pointer argument
53 than in the other pointer arguments. */
54#ifndef _UC_RESTRICT
55# if defined __restrict \
56 || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \
57 || __clang_major__ >= 3
58# define _UC_RESTRICT __restrict
59# elif 199901L <= __STDC_VERSION__ || defined restrict
60# define _UC_RESTRICT restrict
61# else
62# define _UC_RESTRICT
63# endif
64#endif
65
66
67#ifdef __cplusplus
68}
69#endif
70
71#endif /* _UNITYPES_H */
diff --git a/gl/uniwidth.in.h b/gl/uniwidth.in.h
new file mode 100644
index 00000000..dad496fd
--- /dev/null
+++ b/gl/uniwidth.in.h
@@ -0,0 +1,72 @@
1/* Display width functions.
2 Copyright (C) 2001-2002, 2005, 2007, 2009-2026 Free Software Foundation,
3 Inc.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#ifndef _UNIWIDTH_H
19#define _UNIWIDTH_H
20
21#include "unitypes.h"
22
23/* Get size_t. */
24#include <stddef.h>
25
26/* Get locale_charset() declaration. */
27#include "localcharset.h"
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33
34/* Display width. */
35
36/* These functions are locale dependent. The encoding argument identifies
37 the encoding (e.g. "ISO-8859-2" for Polish). */
38
39/* Determine number of column positions required for UC. */
40extern int
41 uc_width (ucs4_t uc, const char *encoding)
42 _UC_ATTRIBUTE_PURE;
43
44/* Determine number of column positions required for first N units
45 (or fewer if S ends before this) in S. */
46extern int
47 u8_width (const uint8_t *s, size_t n, const char *encoding)
48 _UC_ATTRIBUTE_PURE;
49extern int
50 u16_width (const uint16_t *s, size_t n, const char *encoding)
51 _UC_ATTRIBUTE_PURE;
52extern int
53 u32_width (const uint32_t *s, size_t n, const char *encoding)
54 _UC_ATTRIBUTE_PURE;
55
56/* Determine number of column positions required for S. */
57extern int
58 u8_strwidth (const uint8_t *s, const char *encoding)
59 _UC_ATTRIBUTE_PURE;
60extern int
61 u16_strwidth (const uint16_t *s, const char *encoding)
62 _UC_ATTRIBUTE_PURE;
63extern int
64 u32_strwidth (const uint32_t *s, const char *encoding)
65 _UC_ATTRIBUTE_PURE;
66
67
68#ifdef __cplusplus
69}
70#endif
71
72#endif /* _UNIWIDTH_H */
diff --git a/gl/uniwidth/.dirstamp b/gl/uniwidth/.dirstamp
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/gl/uniwidth/.dirstamp
diff --git a/gl/uniwidth/cjk.h b/gl/uniwidth/cjk.h
new file mode 100644
index 00000000..bcd49fbf
--- /dev/null
+++ b/gl/uniwidth/cjk.h
@@ -0,0 +1,37 @@
1/* Test for CJK encoding.
2 Copyright (C) 2001-2002, 2005-2007, 2009-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2002.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#include "streq.h"
19
20static int
21is_cjk_encoding (const char *encoding)
22{
23 if (0
24 /* Legacy Japanese encodings */
25 || STREQ_OPT (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0)
26 /* Legacy Chinese encodings */
27 || STREQ_OPT (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0)
28 || STREQ_OPT (encoding, "GBK", 'G', 'B', 'K', 0, 0, 0, 0, 0, 0)
29 || STREQ_OPT (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0)
30 || STREQ_OPT (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0)
31 /* Legacy Korean encodings */
32 || STREQ_OPT (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
33 || STREQ_OPT (encoding, "CP949", 'C', 'P', '9', '4', '9', 0, 0, 0, 0)
34 || STREQ_OPT (encoding, "JOHAB", 'J', 'O', 'H', 'A', 'B', 0, 0, 0, 0))
35 return 1;
36 return 0;
37}
diff --git a/gl/uniwidth/width.c b/gl/uniwidth/width.c
new file mode 100644
index 00000000..683f5513
--- /dev/null
+++ b/gl/uniwidth/width.c
@@ -0,0 +1,95 @@
1/* Determine display width of Unicode character.
2 Copyright (C) 2001-2002, 2006-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2002.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#include <config.h>
19
20/* Specification. */
21#include "uniwidth.h"
22
23#include "cjk.h"
24
25/* The non-spacing attribute table consists of:
26 * Non-spacing characters; generated from PropList.txt or
27 "grep '^[^;]*;[^;]*;[^;]*;[^;]*;NSM;' UnicodeData.txt"
28 * Format control characters; generated from
29 "grep '^[^;]*;[^;]*;Cf;' UnicodeData.txt"
30 * Zero width characters; generated from
31 "grep '^[^;]*;ZERO WIDTH ' UnicodeData.txt"
32 * Hangul Jamo characters that have conjoining behaviour:
33 - jungseong = syllable-middle vowels
34 - jongseong = syllable-final consonants
35 Rationale:
36 1) These characters act like combining characters. They have no
37 equivalent in legacy character sets. Therefore the EastAsianWidth.txt
38 file does not really matter for them; UAX #11 East Asian Width
39 <https://www.unicode.org/reports/tr11/> makes it clear that it focus
40 is on compatibility with traditional Japanese layout.
41 By contrast, the same glyphs without conjoining behaviour are available
42 in the U+3130..U+318F block, and these characters are mapped to legacy
43 character sets, and traditional Japanese layout matters for them.
44 2) glibc does the same thing, see
45 <https://sourceware.org/PR21750>
46 <https://sourceware.org/PR26120>
47 */
48#include "uniwidth/width0.h"
49
50#include "uniwidth/width2.h"
51#include "unictype/bitmap.h"
52
53#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
54
55
56/* Determine number of column positions required for UC. */
57int
58uc_width (ucs4_t uc, const char *encoding)
59{
60 /* Test for non-spacing or control character. */
61 if ((uc >> 9) < SIZEOF (nonspacing_table_ind))
62 {
63 int ind = nonspacing_table_ind[uc >> 9];
64 if (ind >= 0)
65 if ((nonspacing_table_data[64*ind + ((uc >> 3) & 63)] >> (uc & 7)) & 1)
66 {
67 if (uc > 0 && uc < 0xa0)
68 return -1;
69 else
70 return 0;
71 }
72 }
73 else if ((uc >> 9) == (0xe0000 >> 9))
74 {
75 if (uc >= 0xe0100)
76 {
77 if (uc <= 0xe01ef)
78 return 0;
79 }
80 else
81 {
82 if (uc >= 0xe0020 ? uc <= 0xe007f : uc == 0xe0001)
83 return 0;
84 }
85 }
86 /* Test for double-width character. */
87 if (bitmap_lookup (&u_width2, uc))
88 return 2;
89 /* In ancient CJK encodings, Cyrillic and most other characters are
90 double-width as well. */
91 if (uc >= 0x00A1 && uc < 0xFF61 && uc != 0x20A9
92 && is_cjk_encoding (encoding))
93 return 2;
94 return 1;
95}
diff --git a/gl/uniwidth/width0.h b/gl/uniwidth/width0.h
new file mode 100644
index 00000000..d05286b7
--- /dev/null
+++ b/gl/uniwidth/width0.h
@@ -0,0 +1,504 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* Table of non-spacing or control characters. */
3/* Generated automatically by gen-uni-tables.c for Unicode 17.0.0. */
4
5/* Copyright (C) 2000-2025 Free Software Foundation, Inc.
6
7 This file is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
11
12 This file is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19
20static const unsigned char nonspacing_table_data[50*64] = {
21 /* 0x0000-0x01ff */
22 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, /* 0x0000-0x003f */
23 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0x0040-0x007f */
24 0xff, 0xff, 0xff, 0xff, 0x00, 0x20, 0x00, 0x00, /* 0x0080-0x00bf */
25 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00c0-0x00ff */
26 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0100-0x013f */
27 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0140-0x017f */
28 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0180-0x01bf */
29 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x01c0-0x01ff */
30 /* 0x0200-0x03ff */
31 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0200-0x023f */
32 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0240-0x027f */
33 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0280-0x02bf */
34 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x02c0-0x02ff */
35 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x0300-0x033f */
36 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, /* 0x0340-0x037f */
37 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0380-0x03bf */
38 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x03c0-0x03ff */
39 /* 0x0400-0x05ff */
40 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0400-0x043f */
41 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0440-0x047f */
42 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0480-0x04bf */
43 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x04c0-0x04ff */
44 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0500-0x053f */
45 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0540-0x057f */
46 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xbf, /* 0x0580-0x05bf */
47 0xb6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x05c0-0x05ff */
48 /* 0x0600-0x07ff */
49 0x00, 0x00, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, /* 0x0600-0x063f */
50 0x00, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x01, 0x00, /* 0x0640-0x067f */
51 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0680-0x06bf */
52 0x00, 0x00, 0xc0, 0x9f, 0x9f, 0x3d, 0x00, 0x00, /* 0x06c0-0x06ff */
53 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, /* 0x0700-0x073f */
54 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0740-0x077f */
55 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x01, 0x00, /* 0x0780-0x07bf */
56 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f, 0x20, /* 0x07c0-0x07ff */
57 /* 0x0800-0x09ff */
58 0x00, 0x00, 0xc0, 0xfb, 0xef, 0x3e, 0x00, 0x00, /* 0x0800-0x083f */
59 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, /* 0x0840-0x087f */
60 0x00, 0x00, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00, /* 0x0880-0x08bf */
61 0x00, 0xfc, 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, /* 0x08c0-0x08ff */
62 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, /* 0x0900-0x093f */
63 0xfe, 0x21, 0xfe, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0940-0x097f */
64 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0980-0x09bf */
65 0x1e, 0x20, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x40, /* 0x09c0-0x09ff */
66 /* 0x0a00-0x0bff */
67 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0a00-0x0a3f */
68 0x86, 0x39, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, /* 0x0a40-0x0a7f */
69 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0a80-0x0abf */
70 0xbe, 0x21, 0x00, 0x00, 0x0c, 0x00, 0x00, 0xfc, /* 0x0ac0-0x0aff */
71 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, /* 0x0b00-0x0b3f */
72 0x1e, 0x20, 0x60, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0b40-0x0b7f */
73 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0b80-0x0bbf */
74 0x01, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0bc0-0x0bff */
75 /* 0x0c00-0x0dff */
76 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, /* 0x0c00-0x0c3f */
77 0xc1, 0x3d, 0x60, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0c40-0x0c7f */
78 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0c80-0x0cbf */
79 0x00, 0x30, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0cc0-0x0cff */
80 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, /* 0x0d00-0x0d3f */
81 0x1e, 0x20, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0d40-0x0d7f */
82 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0d80-0x0dbf */
83 0x00, 0x04, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0dc0-0x0dff */
84 /* 0x0e00-0x0fff */
85 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x07, /* 0x0e00-0x0e3f */
86 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0e40-0x0e7f */
87 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x1f, /* 0x0e80-0x0ebf */
88 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0ec0-0x0eff */
89 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0xa0, 0x02, /* 0x0f00-0x0f3f */
90 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x7f, /* 0x0f40-0x0f7f */
91 0xdf, 0xe0, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x1f, /* 0x0f80-0x0fbf */
92 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0fc0-0x0fff */
93 /* 0x1000-0x11ff */
94 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xfd, 0x66, /* 0x1000-0x103f */
95 0x00, 0x00, 0x00, 0xc3, 0x01, 0x00, 0x1e, 0x00, /* 0x1040-0x107f */
96 0x64, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, /* 0x1080-0x10bf */
97 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10c0-0x10ff */
98 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1100-0x113f */
99 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, /* 0x1140-0x117f */
100 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x1180-0x11bf */
101 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x11c0-0x11ff */
102 /* 0x1200-0x13ff */
103 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1200-0x123f */
104 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1240-0x127f */
105 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1280-0x12bf */
106 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x12c0-0x12ff */
107 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1300-0x133f */
108 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, /* 0x1340-0x137f */
109 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1380-0x13bf */
110 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13c0-0x13ff */
111 /* 0x1600-0x17ff */
112 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1600-0x163f */
113 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1640-0x167f */
114 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1680-0x16bf */
115 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16c0-0x16ff */
116 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x0c, 0x00, /* 0x1700-0x173f */
117 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x00, /* 0x1740-0x177f */
118 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x3f, /* 0x1780-0x17bf */
119 0x40, 0xfe, 0x0f, 0x20, 0x00, 0x00, 0x00, 0x00, /* 0x17c0-0x17ff */
120 /* 0x1800-0x19ff */
121 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1800-0x183f */
122 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1840-0x187f */
123 0x60, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, /* 0x1880-0x18bf */
124 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18c0-0x18ff */
125 0x00, 0x00, 0x00, 0x00, 0x87, 0x01, 0x04, 0x0e, /* 0x1900-0x193f */
126 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1940-0x197f */
127 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1980-0x19bf */
128 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x19c0-0x19ff */
129 /* 0x1a00-0x1bff */
130 0x00, 0x00, 0x80, 0x09, 0x00, 0x00, 0x00, 0x00, /* 0x1a00-0x1a3f */
131 0x00, 0x00, 0x40, 0x7f, 0xe5, 0x1f, 0xf8, 0x9f, /* 0x1a40-0x1a7f */
132 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, /* 0x1a80-0x1abf */
133 0xff, 0xff, 0xff, 0x3f, 0xff, 0x0f, 0x00, 0x00, /* 0x1ac0-0x1aff */
134 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x17, /* 0x1b00-0x1b3f */
135 0x04, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f, 0x00, /* 0x1b40-0x1b7f */
136 0x03, 0x00, 0x00, 0x00, 0x3c, 0x3b, 0x00, 0x00, /* 0x1b80-0x1bbf */
137 0x00, 0x00, 0x00, 0x00, 0x40, 0xa3, 0x03, 0x00, /* 0x1bc0-0x1bff */
138 /* 0x1c00-0x1dff */
139 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xcf, 0x00, /* 0x1c00-0x1c3f */
140 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1c40-0x1c7f */
141 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1c80-0x1cbf */
142 0x00, 0x00, 0xf7, 0xff, 0xfd, 0x21, 0x10, 0x03, /* 0x1cc0-0x1cff */
143 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d00-0x1d3f */
144 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d40-0x1d7f */
145 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d80-0x1dbf */
146 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x1dc0-0x1dff */
147 /* 0x2000-0x21ff */
148 0x00, 0xf8, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, /* 0x2000-0x203f */
149 0x00, 0x00, 0x00, 0x00, 0xdf, 0xff, 0x00, 0x00, /* 0x2040-0x207f */
150 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2080-0x20bf */
151 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, /* 0x20c0-0x20ff */
152 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2100-0x213f */
153 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2140-0x217f */
154 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2180-0x21bf */
155 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x21c0-0x21ff */
156 /* 0x2c00-0x2dff */
157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2c00-0x2c3f */
158 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2c40-0x2c7f */
159 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2c80-0x2cbf */
160 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, /* 0x2cc0-0x2cff */
161 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2d00-0x2d3f */
162 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0x2d40-0x2d7f */
163 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2d80-0x2dbf */
164 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, /* 0x2dc0-0x2dff */
165 /* 0x3000-0x31ff */
166 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, /* 0x3000-0x303f */
167 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3040-0x307f */
168 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, /* 0x3080-0x30bf */
169 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30c0-0x30ff */
170 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3100-0x313f */
171 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3140-0x317f */
172 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x3180-0x31bf */
173 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x31c0-0x31ff */
174 /* 0xa600-0xa7ff */
175 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa600-0xa63f */
176 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xf7, 0x3f, /* 0xa640-0xa67f */
177 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, /* 0xa680-0xa6bf */
178 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, /* 0xa6c0-0xa6ff */
179 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa700-0xa73f */
180 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa740-0xa77f */
181 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa780-0xa7bf */
182 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa7c0-0xa7ff */
183 /* 0xa800-0xa9ff */
184 0x44, 0x08, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, /* 0xa800-0xa83f */
185 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa840-0xa87f */
186 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa880-0xa8bf */
187 0x30, 0x00, 0x00, 0x00, 0xff, 0xff, 0x03, 0x80, /* 0xa8c0-0xa8ff */
188 0x00, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, /* 0xa900-0xa93f */
189 0x80, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa940-0xa97f */
190 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x33, /* 0xa980-0xa9bf */
191 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, /* 0xa9c0-0xa9ff */
192 /* 0xaa00-0xabff */
193 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x66, 0x00, /* 0xaa00-0xaa3f */
194 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0xaa40-0xaa7f */
195 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9d, 0xc1, /* 0xaa80-0xaabf */
196 0x02, 0x00, 0x00, 0x00, 0x00, 0x30, 0x40, 0x00, /* 0xaac0-0xaaff */
197 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab00-0xab3f */
198 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab40-0xab7f */
199 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab80-0xabbf */
200 0x00, 0x00, 0x00, 0x00, 0x20, 0x21, 0x00, 0x00, /* 0xabc0-0xabff */
201 /* 0xd600-0xd7ff */
202 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd600-0xd63f */
203 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd640-0xd67f */
204 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd680-0xd6bf */
205 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd6c0-0xd6ff */
206 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd700-0xd73f */
207 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd740-0xd77f */
208 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, /* 0xd780-0xd7bf */
209 0x7f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, /* 0xd7c0-0xd7ff */
210 /* 0xfa00-0xfbff */
211 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa00-0xfa3f */
212 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa40-0xfa7f */
213 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa80-0xfabf */
214 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfac0-0xfaff */
215 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, /* 0xfb00-0xfb3f */
216 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfb40-0xfb7f */
217 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfb80-0xfbbf */
218 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfbc0-0xfbff */
219 /* 0xfe00-0xffff */
220 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, /* 0xfe00-0xfe3f */
221 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfe40-0xfe7f */
222 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfe80-0xfebf */
223 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0xfec0-0xfeff */
224 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff00-0xff3f */
225 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff40-0xff7f */
226 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff80-0xffbf */
227 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, /* 0xffc0-0xffff */
228 /* 0x10000-0x101ff */
229 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10000-0x1003f */
230 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10040-0x1007f */
231 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10080-0x100bf */
232 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x100c0-0x100ff */
233 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10100-0x1013f */
234 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10140-0x1017f */
235 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10180-0x101bf */
236 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, /* 0x101c0-0x101ff */
237 /* 0x10200-0x103ff */
238 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10200-0x1023f */
239 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10240-0x1027f */
240 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10280-0x102bf */
241 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, /* 0x102c0-0x102ff */
242 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10300-0x1033f */
243 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, /* 0x10340-0x1037f */
244 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10380-0x103bf */
245 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x103c0-0x103ff */
246 /* 0x10a00-0x10bff */
247 0x6e, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, /* 0x10a00-0x10a3f */
248 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10a40-0x10a7f */
249 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10a80-0x10abf */
250 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, /* 0x10ac0-0x10aff */
251 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b00-0x10b3f */
252 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b40-0x10b7f */
253 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b80-0x10bbf */
254 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10bc0-0x10bff */
255 /* 0x10c00-0x10dff */
256 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10c00-0x10c3f */
257 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10c40-0x10c7f */
258 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10c80-0x10cbf */
259 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10cc0-0x10cff */
260 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, /* 0x10d00-0x10d3f */
261 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, /* 0x10d40-0x10d7f */
262 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10d80-0x10dbf */
263 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10dc0-0x10dff */
264 /* 0x10e00-0x10fff */
265 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10e00-0x10e3f */
266 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10e40-0x10e7f */
267 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, /* 0x10e80-0x10ebf */
268 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, /* 0x10ec0-0x10eff */
269 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10f00-0x10f3f */
270 0xc0, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10f40-0x10f7f */
271 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10f80-0x10fbf */
272 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10fc0-0x10fff */
273 /* 0x11000-0x111ff */
274 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* 0x11000-0x1103f */
275 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x80, /* 0x11040-0x1107f */
276 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x06, /* 0x11080-0x110bf */
277 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x110c0-0x110ff */
278 0x07, 0x00, 0x00, 0x00, 0x80, 0xef, 0x1f, 0x00, /* 0x11100-0x1113f */
279 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, /* 0x11140-0x1117f */
280 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x7f, /* 0x11180-0x111bf */
281 0x00, 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x111c0-0x111ff */
282 /* 0x11200-0x113ff */
283 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xd3, 0x40, /* 0x11200-0x1123f */
284 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11240-0x1127f */
285 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11280-0x112bf */
286 0x00, 0x00, 0x00, 0x80, 0xf8, 0x07, 0x00, 0x00, /* 0x112c0-0x112ff */
287 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, /* 0x11300-0x1133f */
288 0x01, 0x00, 0x00, 0x00, 0xc0, 0x1f, 0x1f, 0x00, /* 0x11340-0x1137f */
289 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, /* 0x11380-0x113bf */
290 0x01, 0x40, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, /* 0x113c0-0x113ff */
291 /* 0x11400-0x115ff */
292 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* 0x11400-0x1143f */
293 0x5c, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, /* 0x11440-0x1147f */
294 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x85, /* 0x11480-0x114bf */
295 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x114c0-0x114ff */
296 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11500-0x1153f */
297 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11540-0x1157f */
298 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0xb0, /* 0x11580-0x115bf */
299 0x01, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, /* 0x115c0-0x115ff */
300 /* 0x11600-0x117ff */
301 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xa7, /* 0x11600-0x1163f */
302 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11640-0x1167f */
303 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0xbf, 0x00, /* 0x11680-0x116bf */
304 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x116c0-0x116ff */
305 0x00, 0x00, 0x00, 0xa0, 0xbc, 0x0f, 0x00, 0x00, /* 0x11700-0x1173f */
306 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11740-0x1177f */
307 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11780-0x117bf */
308 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x117c0-0x117ff */
309 /* 0x11800-0x119ff */
310 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x06, /* 0x11800-0x1183f */
311 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11840-0x1187f */
312 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11880-0x118bf */
313 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x118c0-0x118ff */
314 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, /* 0x11900-0x1193f */
315 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11940-0x1197f */
316 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11980-0x119bf */
317 0x00, 0x00, 0xf0, 0x0c, 0x01, 0x00, 0x00, 0x00, /* 0x119c0-0x119ff */
318 /* 0x11a00-0x11bff */
319 0x7e, 0x06, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x79, /* 0x11a00-0x11a3f */
320 0x80, 0x00, 0x7e, 0x0e, 0x00, 0x00, 0x00, 0x00, /* 0x11a40-0x11a7f */
321 0x00, 0xfc, 0x7f, 0x03, 0x00, 0x00, 0x00, 0x00, /* 0x11a80-0x11abf */
322 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11ac0-0x11aff */
323 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11b00-0x11b3f */
324 0x00, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, /* 0x11b40-0x11b7f */
325 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11b80-0x11bbf */
326 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11bc0-0x11bff */
327 /* 0x11c00-0x11dff */
328 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x3f, /* 0x11c00-0x11c3f */
329 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11c40-0x11c7f */
330 0x00, 0x00, 0xfc, 0xff, 0xff, 0xfc, 0x6d, 0x00, /* 0x11c80-0x11cbf */
331 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11cc0-0x11cff */
332 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xb4, /* 0x11d00-0x11d3f */
333 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11d40-0x11d7f */
334 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11d80-0x11dbf */
335 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11dc0-0x11dff */
336 /* 0x11e00-0x11fff */
337 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11e00-0x11e3f */
338 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11e40-0x11e7f */
339 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11e80-0x11ebf */
340 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, /* 0x11ec0-0x11eff */
341 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, /* 0x11f00-0x11f3f */
342 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, /* 0x11f40-0x11f7f */
343 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11f80-0x11fbf */
344 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11fc0-0x11fff */
345 /* 0x13400-0x135ff */
346 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, /* 0x13400-0x1343f */
347 0x81, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13440-0x1347f */
348 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13480-0x134bf */
349 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x134c0-0x134ff */
350 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13500-0x1353f */
351 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13540-0x1357f */
352 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13580-0x135bf */
353 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x135c0-0x135ff */
354 /* 0x16000-0x161ff */
355 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16000-0x1603f */
356 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16040-0x1607f */
357 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16080-0x160bf */
358 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x160c0-0x160ff */
359 0x00, 0x00, 0x00, 0xc0, 0xff, 0xe3, 0x00, 0x00, /* 0x16100-0x1613f */
360 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16140-0x1617f */
361 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16180-0x161bf */
362 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x161c0-0x161ff */
363 /* 0x16a00-0x16bff */
364 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16a00-0x16a3f */
365 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16a40-0x16a7f */
366 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16a80-0x16abf */
367 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, /* 0x16ac0-0x16aff */
368 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, /* 0x16b00-0x16b3f */
369 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16b40-0x16b7f */
370 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16b80-0x16bbf */
371 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16bc0-0x16bff */
372 /* 0x16e00-0x16fff */
373 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16e00-0x16e3f */
374 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16e40-0x16e7f */
375 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16e80-0x16ebf */
376 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16ec0-0x16eff */
377 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16f00-0x16f3f */
378 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16f40-0x16f7f */
379 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x16f80-0x16fbf */
380 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, /* 0x16fc0-0x16fff */
381 /* 0x1bc00-0x1bdff */
382 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bc00-0x1bc3f */
383 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bc40-0x1bc7f */
384 0x00, 0x00, 0x00, 0x60, 0x0f, 0x00, 0x00, 0x00, /* 0x1bc80-0x1bcbf */
385 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bcc0-0x1bcff */
386 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bd00-0x1bd3f */
387 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bd40-0x1bd7f */
388 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bd80-0x1bdbf */
389 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bdc0-0x1bdff */
390 /* 0x1ce00-0x1cfff */
391 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1ce00-0x1ce3f */
392 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1ce40-0x1ce7f */
393 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1ce80-0x1cebf */
394 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1cec0-0x1ceff */
395 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, /* 0x1cf00-0x1cf3f */
396 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1cf40-0x1cf7f */
397 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1cf80-0x1cfbf */
398 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1cfc0-0x1cfff */
399 /* 0x1d000-0x1d1ff */
400 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d000-0x1d03f */
401 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d040-0x1d07f */
402 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d080-0x1d0bf */
403 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d0c0-0x1d0ff */
404 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d100-0x1d13f */
405 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0xf8, 0xff, /* 0x1d140-0x1d17f */
406 0xe7, 0x0f, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, /* 0x1d180-0x1d1bf */
407 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d1c0-0x1d1ff */
408 /* 0x1d200-0x1d3ff */
409 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d200-0x1d23f */
410 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d240-0x1d27f */
411 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d280-0x1d2bf */
412 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d2c0-0x1d2ff */
413 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d300-0x1d33f */
414 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d340-0x1d37f */
415 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d380-0x1d3bf */
416 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d3c0-0x1d3ff */
417 /* 0x1da00-0x1dbff */
418 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xf8, /* 0x1da00-0x1da3f */
419 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x20, 0x00, /* 0x1da40-0x1da7f */
420 0x10, 0x00, 0x00, 0xf8, 0xfe, 0xff, 0x00, 0x00, /* 0x1da80-0x1dabf */
421 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1dac0-0x1daff */
422 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1db00-0x1db3f */
423 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1db40-0x1db7f */
424 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1db80-0x1dbbf */
425 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1dbc0-0x1dbff */
426 /* 0x1e000-0x1e1ff */
427 0x7f, 0xff, 0xff, 0xf9, 0xdb, 0x07, 0x00, 0x00, /* 0x1e000-0x1e03f */
428 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e040-0x1e07f */
429 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e080-0x1e0bf */
430 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e0c0-0x1e0ff */
431 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, /* 0x1e100-0x1e13f */
432 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e140-0x1e17f */
433 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e180-0x1e1bf */
434 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e1c0-0x1e1ff */
435 /* 0x1e200-0x1e3ff */
436 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e200-0x1e23f */
437 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e240-0x1e27f */
438 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, /* 0x1e280-0x1e2bf */
439 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, /* 0x1e2c0-0x1e2ff */
440 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e300-0x1e33f */
441 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e340-0x1e37f */
442 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e380-0x1e3bf */
443 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e3c0-0x1e3ff */
444 /* 0x1e400-0x1e5ff */
445 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e400-0x1e43f */
446 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e440-0x1e47f */
447 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e480-0x1e4bf */
448 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, /* 0x1e4c0-0x1e4ff */
449 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e500-0x1e53f */
450 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e540-0x1e57f */
451 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e580-0x1e5bf */
452 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, /* 0x1e5c0-0x1e5ff */
453 /* 0x1e600-0x1e7ff */
454 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e600-0x1e63f */
455 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e640-0x1e67f */
456 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e680-0x1e6bf */
457 0x00, 0x00, 0x00, 0x00, 0x48, 0xc0, 0x20, 0x00, /* 0x1e6c0-0x1e6ff */
458 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e700-0x1e73f */
459 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e740-0x1e77f */
460 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e780-0x1e7bf */
461 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e7c0-0x1e7ff */
462 /* 0x1e800-0x1e9ff */
463 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e800-0x1e83f */
464 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e840-0x1e87f */
465 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e880-0x1e8bf */
466 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e8c0-0x1e8ff */
467 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e900-0x1e93f */
468 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e940-0x1e97f */
469 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e980-0x1e9bf */
470 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0x1e9c0-0x1e9ff */
471};
472static const signed char nonspacing_table_ind[248] = {
473 0, 1, 2, 3, 4, 5, 6, 7, /* 0x0000-0x0fff */
474 8, 9, -1, 10, 11, 12, 13, -1, /* 0x1000-0x1fff */
475 14, -1, -1, -1, -1, -1, 15, -1, /* 0x2000-0x2fff */
476 16, -1, -1, -1, -1, -1, -1, -1, /* 0x3000-0x3fff */
477 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x4000-0x4fff */
478 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x5000-0x5fff */
479 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x6000-0x6fff */
480 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x7000-0x7fff */
481 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x8000-0x8fff */
482 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x9000-0x9fff */
483 -1, -1, -1, 17, 18, 19, -1, -1, /* 0xa000-0xafff */
484 -1, -1, -1, -1, -1, -1, -1, -1, /* 0xb000-0xbfff */
485 -1, -1, -1, -1, -1, -1, -1, -1, /* 0xc000-0xcfff */
486 -1, -1, -1, 20, -1, -1, -1, -1, /* 0xd000-0xdfff */
487 -1, -1, -1, -1, -1, -1, -1, -1, /* 0xe000-0xefff */
488 -1, -1, -1, -1, -1, 21, -1, 22, /* 0xf000-0xffff */
489 23, 24, -1, -1, -1, 25, 26, 27, /* 0x10000-0x10fff */
490 28, 29, 30, 31, 32, 33, 34, 35, /* 0x11000-0x11fff */
491 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x12000-0x12fff */
492 -1, -1, 36, -1, -1, -1, -1, -1, /* 0x13000-0x13fff */
493 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x14000-0x14fff */
494 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x15000-0x15fff */
495 37, -1, -1, -1, -1, 38, -1, 39, /* 0x16000-0x16fff */
496 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x17000-0x17fff */
497 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x18000-0x18fff */
498 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x19000-0x19fff */
499 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1a000-0x1afff */
500 -1, -1, -1, -1, -1, -1, 40, -1, /* 0x1b000-0x1bfff */
501 -1, -1, -1, -1, -1, -1, -1, 41, /* 0x1c000-0x1cfff */
502 42, 43, -1, -1, -1, 44, -1, -1, /* 0x1d000-0x1dfff */
503 45, 46, 47, 48, 49, -1, -1, -1 /* 0x1e000-0x1efff */
504};
diff --git a/gl/uniwidth/width2.h b/gl/uniwidth/width2.h
new file mode 100644
index 00000000..70bb049c
--- /dev/null
+++ b/gl/uniwidth/width2.h
@@ -0,0 +1,541 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* Width 2 property of Unicode characters. */
3/* Generated automatically by gen-uni-tables.c for Unicode 17.0.0. */
4
5/* Copyright (C) 2000-2025 Free Software Foundation, Inc.
6
7 This file is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
11
12 This file is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19
20#define header_0 16
21#define header_2 9
22#define header_3 127
23#define header_4 15
24static const
25struct
26 {
27 int header[1];
28 int level1[4];
29 short level2[3 << 7];
30 unsigned int level3[28 << 4];
31 }
32u_width2 =
33{
34 { 4 },
35 {
36 5 * sizeof (int) / sizeof (short) + 0,
37 5 * sizeof (int) / sizeof (short) + 128,
38 5 * sizeof (int) / sizeof (short) + 256,
39 5 * sizeof (int) / sizeof (short) + 256
40 },
41 {
42 -1,
43 -1,
44 -1,
45 -1,
46 -1,
47 -1,
48 -1,
49 -1,
50 5 + 384 * sizeof (short) / sizeof (int) + 0,
51 -1,
52 -1,
53 -1,
54 -1,
55 -1,
56 -1,
57 -1,
58 -1,
59 5 + 384 * sizeof (short) / sizeof (int) + 16,
60 5 + 384 * sizeof (short) / sizeof (int) + 32,
61 5 + 384 * sizeof (short) / sizeof (int) + 48,
62 -1,
63 5 + 384 * sizeof (short) / sizeof (int) + 64,
64 -1,
65 5 + 384 * sizeof (short) / sizeof (int) + 80,
66 5 + 384 * sizeof (short) / sizeof (int) + 96,
67 5 + 384 * sizeof (short) / sizeof (int) + 112,
68 5 + 384 * sizeof (short) / sizeof (int) + 128,
69 5 + 384 * sizeof (short) / sizeof (int) + 128,
70 5 + 384 * sizeof (short) / sizeof (int) + 128,
71 5 + 384 * sizeof (short) / sizeof (int) + 128,
72 5 + 384 * sizeof (short) / sizeof (int) + 128,
73 5 + 384 * sizeof (short) / sizeof (int) + 128,
74 5 + 384 * sizeof (short) / sizeof (int) + 128,
75 5 + 384 * sizeof (short) / sizeof (int) + 128,
76 5 + 384 * sizeof (short) / sizeof (int) + 128,
77 5 + 384 * sizeof (short) / sizeof (int) + 128,
78 5 + 384 * sizeof (short) / sizeof (int) + 128,
79 5 + 384 * sizeof (short) / sizeof (int) + 128,
80 5 + 384 * sizeof (short) / sizeof (int) + 144,
81 5 + 384 * sizeof (short) / sizeof (int) + 128,
82 5 + 384 * sizeof (short) / sizeof (int) + 128,
83 5 + 384 * sizeof (short) / sizeof (int) + 128,
84 5 + 384 * sizeof (short) / sizeof (int) + 128,
85 5 + 384 * sizeof (short) / sizeof (int) + 128,
86 5 + 384 * sizeof (short) / sizeof (int) + 128,
87 5 + 384 * sizeof (short) / sizeof (int) + 128,
88 5 + 384 * sizeof (short) / sizeof (int) + 128,
89 5 + 384 * sizeof (short) / sizeof (int) + 128,
90 5 + 384 * sizeof (short) / sizeof (int) + 128,
91 5 + 384 * sizeof (short) / sizeof (int) + 128,
92 5 + 384 * sizeof (short) / sizeof (int) + 128,
93 5 + 384 * sizeof (short) / sizeof (int) + 128,
94 5 + 384 * sizeof (short) / sizeof (int) + 128,
95 5 + 384 * sizeof (short) / sizeof (int) + 128,
96 5 + 384 * sizeof (short) / sizeof (int) + 128,
97 5 + 384 * sizeof (short) / sizeof (int) + 128,
98 5 + 384 * sizeof (short) / sizeof (int) + 128,
99 5 + 384 * sizeof (short) / sizeof (int) + 128,
100 5 + 384 * sizeof (short) / sizeof (int) + 128,
101 5 + 384 * sizeof (short) / sizeof (int) + 128,
102 5 + 384 * sizeof (short) / sizeof (int) + 128,
103 5 + 384 * sizeof (short) / sizeof (int) + 128,
104 5 + 384 * sizeof (short) / sizeof (int) + 128,
105 5 + 384 * sizeof (short) / sizeof (int) + 128,
106 5 + 384 * sizeof (short) / sizeof (int) + 128,
107 5 + 384 * sizeof (short) / sizeof (int) + 128,
108 5 + 384 * sizeof (short) / sizeof (int) + 128,
109 5 + 384 * sizeof (short) / sizeof (int) + 128,
110 5 + 384 * sizeof (short) / sizeof (int) + 128,
111 5 + 384 * sizeof (short) / sizeof (int) + 128,
112 5 + 384 * sizeof (short) / sizeof (int) + 128,
113 5 + 384 * sizeof (short) / sizeof (int) + 128,
114 5 + 384 * sizeof (short) / sizeof (int) + 128,
115 5 + 384 * sizeof (short) / sizeof (int) + 128,
116 5 + 384 * sizeof (short) / sizeof (int) + 128,
117 5 + 384 * sizeof (short) / sizeof (int) + 128,
118 5 + 384 * sizeof (short) / sizeof (int) + 128,
119 5 + 384 * sizeof (short) / sizeof (int) + 128,
120 5 + 384 * sizeof (short) / sizeof (int) + 128,
121 5 + 384 * sizeof (short) / sizeof (int) + 128,
122 5 + 384 * sizeof (short) / sizeof (int) + 128,
123 5 + 384 * sizeof (short) / sizeof (int) + 128,
124 5 + 384 * sizeof (short) / sizeof (int) + 160,
125 -1,
126 5 + 384 * sizeof (short) / sizeof (int) + 176,
127 -1,
128 5 + 384 * sizeof (short) / sizeof (int) + 128,
129 5 + 384 * sizeof (short) / sizeof (int) + 128,
130 5 + 384 * sizeof (short) / sizeof (int) + 128,
131 5 + 384 * sizeof (short) / sizeof (int) + 128,
132 5 + 384 * sizeof (short) / sizeof (int) + 128,
133 5 + 384 * sizeof (short) / sizeof (int) + 128,
134 5 + 384 * sizeof (short) / sizeof (int) + 128,
135 5 + 384 * sizeof (short) / sizeof (int) + 128,
136 5 + 384 * sizeof (short) / sizeof (int) + 128,
137 5 + 384 * sizeof (short) / sizeof (int) + 128,
138 5 + 384 * sizeof (short) / sizeof (int) + 128,
139 5 + 384 * sizeof (short) / sizeof (int) + 128,
140 5 + 384 * sizeof (short) / sizeof (int) + 128,
141 5 + 384 * sizeof (short) / sizeof (int) + 128,
142 5 + 384 * sizeof (short) / sizeof (int) + 128,
143 5 + 384 * sizeof (short) / sizeof (int) + 128,
144 5 + 384 * sizeof (short) / sizeof (int) + 128,
145 5 + 384 * sizeof (short) / sizeof (int) + 128,
146 5 + 384 * sizeof (short) / sizeof (int) + 128,
147 5 + 384 * sizeof (short) / sizeof (int) + 128,
148 5 + 384 * sizeof (short) / sizeof (int) + 128,
149 5 + 384 * sizeof (short) / sizeof (int) + 192,
150 -1,
151 -1,
152 -1,
153 -1,
154 -1,
155 -1,
156 -1,
157 -1,
158 -1,
159 -1,
160 -1,
161 -1,
162 -1,
163 -1,
164 -1,
165 -1,
166 5 + 384 * sizeof (short) / sizeof (int) + 208,
167 5 + 384 * sizeof (short) / sizeof (int) + 224,
168 -1,
169 5 + 384 * sizeof (short) / sizeof (int) + 240,
170 -1,
171 -1,
172 -1,
173 -1,
174 -1,
175 -1,
176 -1,
177 -1,
178 -1,
179 -1,
180 -1,
181 -1,
182 -1,
183 -1,
184 -1,
185 -1,
186 -1,
187 -1,
188 -1,
189 -1,
190 -1,
191 -1,
192 -1,
193 -1,
194 -1,
195 -1,
196 -1,
197 -1,
198 -1,
199 -1,
200 -1,
201 -1,
202 -1,
203 -1,
204 -1,
205 -1,
206 -1,
207 -1,
208 -1,
209 -1,
210 -1,
211 -1,
212 -1,
213 -1,
214 -1,
215 -1,
216 -1,
217 -1,
218 -1,
219 -1,
220 -1,
221 -1,
222 -1,
223 -1,
224 -1,
225 5 + 384 * sizeof (short) / sizeof (int) + 256,
226 5 + 384 * sizeof (short) / sizeof (int) + 128,
227 5 + 384 * sizeof (short) / sizeof (int) + 128,
228 5 + 384 * sizeof (short) / sizeof (int) + 128,
229 5 + 384 * sizeof (short) / sizeof (int) + 128,
230 5 + 384 * sizeof (short) / sizeof (int) + 128,
231 5 + 384 * sizeof (short) / sizeof (int) + 128,
232 5 + 384 * sizeof (short) / sizeof (int) + 128,
233 5 + 384 * sizeof (short) / sizeof (int) + 128,
234 5 + 384 * sizeof (short) / sizeof (int) + 128,
235 5 + 384 * sizeof (short) / sizeof (int) + 128,
236 5 + 384 * sizeof (short) / sizeof (int) + 128,
237 5 + 384 * sizeof (short) / sizeof (int) + 272,
238 5 + 384 * sizeof (short) / sizeof (int) + 128,
239 5 + 384 * sizeof (short) / sizeof (int) + 128,
240 5 + 384 * sizeof (short) / sizeof (int) + 288,
241 -1,
242 -1,
243 -1,
244 -1,
245 -1,
246 -1,
247 -1,
248 -1,
249 -1,
250 -1,
251 -1,
252 -1,
253 -1,
254 -1,
255 -1,
256 -1,
257 5 + 384 * sizeof (short) / sizeof (int) + 304,
258 5 + 384 * sizeof (short) / sizeof (int) + 320,
259 5 + 384 * sizeof (short) / sizeof (int) + 336,
260 -1,
261 -1,
262 -1,
263 -1,
264 -1,
265 -1,
266 -1,
267 -1,
268 -1,
269 -1,
270 -1,
271 -1,
272 -1,
273 -1,
274 -1,
275 -1,
276 -1,
277 -1,
278 -1,
279 -1,
280 -1,
281 -1,
282 -1,
283 -1,
284 -1,
285 -1,
286 -1,
287 -1,
288 -1,
289 -1,
290 5 + 384 * sizeof (short) / sizeof (int) + 352,
291 5 + 384 * sizeof (short) / sizeof (int) + 368,
292 5 + 384 * sizeof (short) / sizeof (int) + 384,
293 5 + 384 * sizeof (short) / sizeof (int) + 400,
294 5 + 384 * sizeof (short) / sizeof (int) + 416,
295 5 + 384 * sizeof (short) / sizeof (int) + 432,
296 -1,
297 -1,
298 5 + 384 * sizeof (short) / sizeof (int) + 128,
299 5 + 384 * sizeof (short) / sizeof (int) + 128,
300 5 + 384 * sizeof (short) / sizeof (int) + 128,
301 5 + 384 * sizeof (short) / sizeof (int) + 128,
302 5 + 384 * sizeof (short) / sizeof (int) + 128,
303 5 + 384 * sizeof (short) / sizeof (int) + 128,
304 5 + 384 * sizeof (short) / sizeof (int) + 128,
305 5 + 384 * sizeof (short) / sizeof (int) + 128,
306 5 + 384 * sizeof (short) / sizeof (int) + 128,
307 5 + 384 * sizeof (short) / sizeof (int) + 128,
308 5 + 384 * sizeof (short) / sizeof (int) + 128,
309 5 + 384 * sizeof (short) / sizeof (int) + 128,
310 5 + 384 * sizeof (short) / sizeof (int) + 128,
311 5 + 384 * sizeof (short) / sizeof (int) + 128,
312 5 + 384 * sizeof (short) / sizeof (int) + 128,
313 5 + 384 * sizeof (short) / sizeof (int) + 128,
314 5 + 384 * sizeof (short) / sizeof (int) + 128,
315 5 + 384 * sizeof (short) / sizeof (int) + 128,
316 5 + 384 * sizeof (short) / sizeof (int) + 128,
317 5 + 384 * sizeof (short) / sizeof (int) + 128,
318 5 + 384 * sizeof (short) / sizeof (int) + 128,
319 5 + 384 * sizeof (short) / sizeof (int) + 128,
320 5 + 384 * sizeof (short) / sizeof (int) + 128,
321 5 + 384 * sizeof (short) / sizeof (int) + 128,
322 5 + 384 * sizeof (short) / sizeof (int) + 128,
323 5 + 384 * sizeof (short) / sizeof (int) + 128,
324 5 + 384 * sizeof (short) / sizeof (int) + 128,
325 5 + 384 * sizeof (short) / sizeof (int) + 128,
326 5 + 384 * sizeof (short) / sizeof (int) + 128,
327 5 + 384 * sizeof (short) / sizeof (int) + 128,
328 5 + 384 * sizeof (short) / sizeof (int) + 128,
329 5 + 384 * sizeof (short) / sizeof (int) + 128,
330 5 + 384 * sizeof (short) / sizeof (int) + 128,
331 5 + 384 * sizeof (short) / sizeof (int) + 128,
332 5 + 384 * sizeof (short) / sizeof (int) + 128,
333 5 + 384 * sizeof (short) / sizeof (int) + 128,
334 5 + 384 * sizeof (short) / sizeof (int) + 128,
335 5 + 384 * sizeof (short) / sizeof (int) + 128,
336 5 + 384 * sizeof (short) / sizeof (int) + 128,
337 5 + 384 * sizeof (short) / sizeof (int) + 128,
338 5 + 384 * sizeof (short) / sizeof (int) + 128,
339 5 + 384 * sizeof (short) / sizeof (int) + 128,
340 5 + 384 * sizeof (short) / sizeof (int) + 128,
341 5 + 384 * sizeof (short) / sizeof (int) + 128,
342 5 + 384 * sizeof (short) / sizeof (int) + 128,
343 5 + 384 * sizeof (short) / sizeof (int) + 128,
344 5 + 384 * sizeof (short) / sizeof (int) + 128,
345 5 + 384 * sizeof (short) / sizeof (int) + 128,
346 5 + 384 * sizeof (short) / sizeof (int) + 128,
347 5 + 384 * sizeof (short) / sizeof (int) + 128,
348 5 + 384 * sizeof (short) / sizeof (int) + 128,
349 5 + 384 * sizeof (short) / sizeof (int) + 128,
350 5 + 384 * sizeof (short) / sizeof (int) + 128,
351 5 + 384 * sizeof (short) / sizeof (int) + 128,
352 5 + 384 * sizeof (short) / sizeof (int) + 128,
353 5 + 384 * sizeof (short) / sizeof (int) + 128,
354 5 + 384 * sizeof (short) / sizeof (int) + 128,
355 5 + 384 * sizeof (short) / sizeof (int) + 128,
356 5 + 384 * sizeof (short) / sizeof (int) + 128,
357 5 + 384 * sizeof (short) / sizeof (int) + 128,
358 5 + 384 * sizeof (short) / sizeof (int) + 128,
359 5 + 384 * sizeof (short) / sizeof (int) + 128,
360 5 + 384 * sizeof (short) / sizeof (int) + 128,
361 5 + 384 * sizeof (short) / sizeof (int) + 128,
362 5 + 384 * sizeof (short) / sizeof (int) + 128,
363 5 + 384 * sizeof (short) / sizeof (int) + 128,
364 5 + 384 * sizeof (short) / sizeof (int) + 128,
365 5 + 384 * sizeof (short) / sizeof (int) + 128,
366 5 + 384 * sizeof (short) / sizeof (int) + 128,
367 5 + 384 * sizeof (short) / sizeof (int) + 128,
368 5 + 384 * sizeof (short) / sizeof (int) + 128,
369 5 + 384 * sizeof (short) / sizeof (int) + 128,
370 5 + 384 * sizeof (short) / sizeof (int) + 128,
371 5 + 384 * sizeof (short) / sizeof (int) + 128,
372 5 + 384 * sizeof (short) / sizeof (int) + 128,
373 5 + 384 * sizeof (short) / sizeof (int) + 128,
374 5 + 384 * sizeof (short) / sizeof (int) + 128,
375 5 + 384 * sizeof (short) / sizeof (int) + 128,
376 5 + 384 * sizeof (short) / sizeof (int) + 128,
377 5 + 384 * sizeof (short) / sizeof (int) + 128,
378 5 + 384 * sizeof (short) / sizeof (int) + 128,
379 5 + 384 * sizeof (short) / sizeof (int) + 128,
380 5 + 384 * sizeof (short) / sizeof (int) + 128,
381 5 + 384 * sizeof (short) / sizeof (int) + 128,
382 5 + 384 * sizeof (short) / sizeof (int) + 128,
383 5 + 384 * sizeof (short) / sizeof (int) + 128,
384 5 + 384 * sizeof (short) / sizeof (int) + 128,
385 5 + 384 * sizeof (short) / sizeof (int) + 128,
386 5 + 384 * sizeof (short) / sizeof (int) + 128,
387 5 + 384 * sizeof (short) / sizeof (int) + 128,
388 5 + 384 * sizeof (short) / sizeof (int) + 128,
389 5 + 384 * sizeof (short) / sizeof (int) + 128,
390 5 + 384 * sizeof (short) / sizeof (int) + 128,
391 5 + 384 * sizeof (short) / sizeof (int) + 128,
392 5 + 384 * sizeof (short) / sizeof (int) + 128,
393 5 + 384 * sizeof (short) / sizeof (int) + 128,
394 5 + 384 * sizeof (short) / sizeof (int) + 128,
395 5 + 384 * sizeof (short) / sizeof (int) + 128,
396 5 + 384 * sizeof (short) / sizeof (int) + 128,
397 5 + 384 * sizeof (short) / sizeof (int) + 128,
398 5 + 384 * sizeof (short) / sizeof (int) + 128,
399 5 + 384 * sizeof (short) / sizeof (int) + 128,
400 5 + 384 * sizeof (short) / sizeof (int) + 128,
401 5 + 384 * sizeof (short) / sizeof (int) + 128,
402 5 + 384 * sizeof (short) / sizeof (int) + 128,
403 5 + 384 * sizeof (short) / sizeof (int) + 128,
404 5 + 384 * sizeof (short) / sizeof (int) + 128,
405 5 + 384 * sizeof (short) / sizeof (int) + 128,
406 5 + 384 * sizeof (short) / sizeof (int) + 128,
407 5 + 384 * sizeof (short) / sizeof (int) + 128,
408 5 + 384 * sizeof (short) / sizeof (int) + 128,
409 5 + 384 * sizeof (short) / sizeof (int) + 128,
410 5 + 384 * sizeof (short) / sizeof (int) + 128,
411 5 + 384 * sizeof (short) / sizeof (int) + 128,
412 5 + 384 * sizeof (short) / sizeof (int) + 128,
413 5 + 384 * sizeof (short) / sizeof (int) + 128,
414 5 + 384 * sizeof (short) / sizeof (int) + 128,
415 5 + 384 * sizeof (short) / sizeof (int) + 128,
416 5 + 384 * sizeof (short) / sizeof (int) + 128,
417 5 + 384 * sizeof (short) / sizeof (int) + 128,
418 5 + 384 * sizeof (short) / sizeof (int) + 128,
419 5 + 384 * sizeof (short) / sizeof (int) + 128,
420 5 + 384 * sizeof (short) / sizeof (int) + 128,
421 5 + 384 * sizeof (short) / sizeof (int) + 128,
422 5 + 384 * sizeof (short) / sizeof (int) + 128,
423 5 + 384 * sizeof (short) / sizeof (int) + 128,
424 5 + 384 * sizeof (short) / sizeof (int) + 128,
425 5 + 384 * sizeof (short) / sizeof (int) + 128
426 },
427 {
428 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
429 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
430 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U,
431 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
432 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
433 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
434 0x0C000000U, 0x00000600U, 0x00000000U, 0x00000000U,
435 0x00000000U, 0x00000000U, 0x00000000U, 0x00091E00U,
436 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
437 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
438 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
439 0x00000000U, 0x00000000U, 0x00000000U, 0x60000000U,
440 0x00300000U, 0x00000000U, 0x000FFF00U, 0x80000000U,
441 0x00080000U, 0x60000C02U, 0x00104030U, 0x242C0400U,
442 0x00000C20U, 0x00000100U, 0x00B85000U, 0x00000000U,
443 0x00E00000U, 0x80010000U, 0x00000000U, 0x00000000U,
444 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
445 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
446 0x18000000U, 0x00000000U, 0x00210000U, 0x00000000U,
447 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
448 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
449 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
450 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
451 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
452 0xFFFFFFFFU, 0x7FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
453 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
454 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
455 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
456 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF00FFU, 0xFFFFFFFFU,
457 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
458 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
459 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
460 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
461 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
462 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
463 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
464 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
465 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
466 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
467 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U, 0x00000000U,
468 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
469 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U,
470 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
471 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
472 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
473 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
474 0x00000000U, 0x00000000U, 0x00000000U, 0x1FFFFFFFU,
475 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
476 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
477 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
478 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
479 0xFFFFFFFFU, 0x0000000FU, 0x00000000U, 0x00000000U,
480 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
481 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
482 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
483 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
484 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
485 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
486 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
487 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
488 0xFFFF0000U, 0xFFFF0000U, 0xFFFFFFFFU, 0x0000FFFFU,
489 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
490 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000001U,
491 0x00000000U, 0x00000000U, 0x00000000U, 0x0000007FU,
492 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
493 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
494 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
495 0x00000000U, 0x00000000U, 0x00000000U, 0x0003000FU,
496 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
497 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
498 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
499 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU,
500 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
501 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x00000000U,
502 0x000001FFU, 0x00000000U, 0x00000000U, 0x00000000U,
503 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
504 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
505 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
506 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
507 0x00000000U, 0x00000000U, 0x00000000U, 0x6FEF0000U,
508 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
509 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
510 0xFFFFFFFFU, 0x00000007U, 0x00070000U, 0xFFFF00F0U,
511 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
512 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
513 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0FFFFFFFU,
514 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
515 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
516 0x00000010U, 0x00000000U, 0x00000000U, 0x00000000U,
517 0x00000000U, 0x00000000U, 0x00008000U, 0x00000000U,
518 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
519 0x07FE4000U, 0x00000000U, 0x00000000U, 0x00000000U,
520 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
521 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
522 0xFFFFFFFFU, 0xFFBFE001U, 0xFFFFFFFFU, 0xDFFFFFFFU,
523 0x000FFFFFU, 0xFFFFFFFFU, 0x000F87FFU, 0xFF11FFFFU,
524 0xFFFFFFFFU, 0x7FFFFFFFU, 0xFFFFFFFDU, 0xFFFFFFFFU,
525 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x9FFFFFFFU,
526 0xFFFFFFFFU, 0x3FFFFFFFU, 0xFFFF7800U, 0x040000FFU,
527 0x00600000U, 0x00000010U, 0x00000000U, 0xF8000000U,
528 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U,
529 0xFFFFFFFFU, 0xFFFFFFFFU, 0xE0E7103FU, 0x1FF01800U,
530 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
531 0x00000000U, 0x00000000U, 0x00000000U, 0x00010FFFU,
532 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
533 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
534 0xFFFFF000U, 0xF7FFFFFFU, 0xFFFFFFBFU, 0xFFFFFFFFU,
535 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
536 0x00000000U, 0x00000000U, 0x00000000U, 0x1F1F0000U,
537 0xFFFF007FU, 0x07FF1FFFU, 0x03FF003FU, 0x007F00FFU,
538 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
539 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U
540 }
541};
diff --git a/gl/unlocked-io.h b/gl/unlocked-io.h
index 0cd9bbf3..2b0d13e3 100644
--- a/gl/unlocked-io.h
+++ b/gl/unlocked-io.h
@@ -1,6 +1,6 @@
1/* Prefer faster, non-thread-safe stdio functions if available. 1/* Prefer faster, non-thread-safe stdio functions if available.
2 2
3 Copyright (C) 2001-2004, 2009-2024 Free Software Foundation, Inc. 3 Copyright (C) 2001-2004, 2009-2026 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
@@ -73,6 +73,13 @@
73# define fgets_unlocked(x,y,z) fgets (x,y,z) 73# define fgets_unlocked(x,y,z) fgets (x,y,z)
74# endif 74# endif
75 75
76# if HAVE_DECL_FILENO_UNLOCKED || defined fileno_unlocked
77# undef fileno
78# define fileno(x) fileno_unlocked (x)
79# else
80# define fileno_unlocked(x) fileno (x)
81# endif
82
76# if HAVE_DECL_FPUTC_UNLOCKED || defined fputc_unlocked 83# if HAVE_DECL_FPUTC_UNLOCKED || defined fputc_unlocked
77# undef fputc 84# undef fputc
78# define fputc(x,y) fputc_unlocked (x,y) 85# define fputc(x,y) fputc_unlocked (x,y)
diff --git a/gl/unsetenv.c b/gl/unsetenv.c
index d8ada2aa..dab1b90c 100644
--- a/gl/unsetenv.c
+++ b/gl/unsetenv.c
@@ -1,4 +1,4 @@
1/* Copyright (C) 1992, 1995-2002, 2005-2024 Free Software Foundation, Inc. 1/* Copyright (C) 1992, 1995-2002, 2005-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library. 2 This file is part of the GNU C Library.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
@@ -56,20 +56,44 @@ __libc_lock_define_initialized (static, envlock)
56int 56int
57unsetenv (const char *name) 57unsetenv (const char *name)
58{ 58{
59 size_t len;
60 char **ep;
61
62 if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) 59 if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
63 { 60 {
64 __set_errno (EINVAL); 61 __set_errno (EINVAL);
65 return -1; 62 return -1;
66 } 63 }
67 64
68 len = strlen (name); 65 size_t len = strlen (name);
66
67#if HAVE_DECL__PUTENV /* native Windows */
68 /* The Microsoft documentation
69 <https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/putenv-wputenv>
70 says:
71 "Don't change an environment entry directly: instead,
72 use _putenv or _wputenv to change it."
73 Note: Microsoft's _putenv updates not only the contents of _environ but
74 also the contents of _wenviron, so that both are in kept in sync.
75
76 The way to remove an environment variable is to pass to _putenv a string
77 of the form "NAME=". (NB: This is a different convention than with glibc
78 putenv, which expects a string of the form "NAME"!) */
79 {
80 char *name_ = malloc (len + 2);
81 if (name_ == NULL)
82 return -1;
83 memcpy (name_, name, len);
84 name_[len] = '=';
85 name_[len + 1] = 0;
86 int putenv_result = _putenv (name_);
87 /* In this particular case it is OK to free() the argument passed to
88 _putenv. */
89 free (name_);
90 return putenv_result;
91 }
92#else
69 93
70 LOCK; 94 LOCK;
71 95
72 ep = __environ; 96 char **ep = __environ;
73 while (*ep != NULL) 97 while (*ep != NULL)
74 if (!strncmp (*ep, name, len) && (*ep)[len] == '=') 98 if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
75 { 99 {
@@ -87,6 +111,7 @@ unsetenv (const char *name)
87 UNLOCK; 111 UNLOCK;
88 112
89 return 0; 113 return 0;
114#endif
90} 115}
91 116
92#ifdef _LIBC 117#ifdef _LIBC
@@ -110,12 +135,12 @@ extern int unsetenv (const char *);
110int 135int
111rpl_unsetenv (const char *name) 136rpl_unsetenv (const char *name)
112{ 137{
113 int result = 0;
114 if (!name || !*name || strchr (name, '=')) 138 if (!name || !*name || strchr (name, '='))
115 { 139 {
116 errno = EINVAL; 140 errno = EINVAL;
117 return -1; 141 return -1;
118 } 142 }
143 int result = 0;
119 while (getenv (name)) 144 while (getenv (name))
120# if !VOID_UNSETENV 145# if !VOID_UNSETENV
121 result = 146 result =
diff --git a/gl/vasnprintf.c b/gl/vasnprintf.c
index de204458..85e30b90 100644
--- a/gl/vasnprintf.c
+++ b/gl/vasnprintf.c
@@ -1,5 +1,5 @@
1/* vsprintf with automatic memory allocation. 1/* vsprintf with automatic memory allocation.
2 Copyright (C) 1999, 2002-2024 Free Software Foundation, Inc. 2 Copyright (C) 1999, 2002-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -29,6 +29,7 @@
29 Depends on FCHAR_T. 29 Depends on FCHAR_T.
30 DCHAR_CPY memcpy like function for DCHAR_T[] arrays. 30 DCHAR_CPY memcpy like function for DCHAR_T[] arrays.
31 DCHAR_SET memset like function for DCHAR_T[] arrays. 31 DCHAR_SET memset like function for DCHAR_T[] arrays.
32 DCHAR_STRLEN strlen like function for DCHAR_T[] arrays.
32 DCHAR_MBSNLEN mbsnlen like function for DCHAR_T[] arrays. 33 DCHAR_MBSNLEN mbsnlen like function for DCHAR_T[] arrays.
33 SNPRINTF The system's snprintf (or similar) function. 34 SNPRINTF The system's snprintf (or similar) function.
34 This may be either snprintf or swprintf. 35 This may be either snprintf or swprintf.
@@ -64,7 +65,7 @@
64/* As of GCC 11.2.1, gcc -Wanalyzer-too-complex reports that main's 65/* As of GCC 11.2.1, gcc -Wanalyzer-too-complex reports that main's
65 use of CHECK macros expands to code that is too complicated for gcc 66 use of CHECK macros expands to code that is too complicated for gcc
66 -fanalyzer. Suppress the resulting bogus warnings. */ 67 -fanalyzer. Suppress the resulting bogus warnings. */
67#if 10 <= __GNUC__ 68#if _GL_GNUC_PREREQ (10, 0)
68# pragma GCC diagnostic ignored "-Wanalyzer-null-argument" 69# pragma GCC diagnostic ignored "-Wanalyzer-null-argument"
69#endif 70#endif
70 71
@@ -80,14 +81,15 @@
80#endif 81#endif
81 82
82#include <locale.h> /* localeconv() */ 83#include <locale.h> /* localeconv() */
84#include <stdint.h> /* PTRDIFF_MAX */
83#include <stdio.h> /* snprintf(), sprintf() */ 85#include <stdio.h> /* snprintf(), sprintf() */
84#include <stdlib.h> /* abort(), malloc(), realloc(), free() */ 86#include <stdlib.h> /* abort(), malloc(), realloc(), free() */
85#include <string.h> /* memcpy(), strlen() */ 87#include <string.h> /* memcpy(), strlen() */
86#include <wchar.h> /* mbstate_t, mbrtowc(), mbrlen(), wcrtomb(), mbszero() */ 88#include <wchar.h> /* mbstate_t, mbrtowc(), mbrlen(), wcrtomb(), mbszero() */
87#include <errno.h> /* errno */ 89#include <errno.h> /* errno */
88#include <limits.h> /* CHAR_BIT, INT_WIDTH, LONG_WIDTH */ 90#include <limits.h> /* CHAR_BIT, INT_MAX, INT_WIDTH, LONG_WIDTH */
89#include <float.h> /* DBL_MAX_EXP, LDBL_MAX_EXP */ 91#include <float.h> /* DBL_MAX_EXP, LDBL_MAX_EXP, LDBL_MANT_DIG */
90#if HAVE_NL_LANGINFO 92#if HAVE_NL_LANGINFO || __GLIBC__ >= 2 || defined __CYGWIN__
91# include <langinfo.h> 93# include <langinfo.h>
92#endif 94#endif
93#ifndef VASNPRINTF 95#ifndef VASNPRINTF
@@ -178,10 +180,24 @@
178# define SNPRINTF swprintf 180# define SNPRINTF swprintf
179# endif 181# endif
180# else 182# else
181 /* Old platforms such as NetBSD 3.0, OpenBSD 3.8, HP-UX 11.00, IRIX 6.5. */ 183 /* Old platforms such as NetBSD 3.0, OpenBSD 3.8, HP-UX 11.00. */
182# define TCHAR_T char 184# define TCHAR_T char
183# endif 185# endif
184#endif 186#endif
187#ifndef DCHAR_STRLEN
188# if WIDE_CHAR_VERSION
189# define DCHAR_STRLEN local_wcslen
190# else
191# define DCHAR_STRLEN strlen
192# endif
193#endif
194#ifndef DCHAR_MBSNLEN
195# if WIDE_CHAR_VERSION
196# define DCHAR_MBSNLEN wcsnlen
197# else
198# define DCHAR_MBSNLEN mbsnlen
199# endif
200#endif
185#if !WIDE_CHAR_VERSION || !DCHAR_IS_TCHAR 201#if !WIDE_CHAR_VERSION || !DCHAR_IS_TCHAR
186 /* TCHAR_T is char. */ 202 /* TCHAR_T is char. */
187 /* Use snprintf if it exists under the name 'snprintf' or '_snprintf'. 203 /* Use snprintf if it exists under the name 'snprintf' or '_snprintf'.
@@ -216,6 +232,12 @@
216/* Here we need to call the native sprintf, not rpl_sprintf. */ 232/* Here we need to call the native sprintf, not rpl_sprintf. */
217#undef sprintf 233#undef sprintf
218 234
235/* macOS 12's "warning: 'sprintf' is deprecated" is pointless,
236 as sprintf is used safely here. */
237#if defined __APPLE__ && defined __MACH__ && _GL_GNUC_PREREQ (4, 2)
238# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
239#endif
240
219/* GCC >= 4.0 with -Wall emits unjustified "... may be used uninitialized" 241/* GCC >= 4.0 with -Wall emits unjustified "... may be used uninitialized"
220 warnings in this file. Use -Dlint to suppress them. */ 242 warnings in this file. Use -Dlint to suppress them. */
221#if defined GCC_LINT || defined lint 243#if defined GCC_LINT || defined lint
@@ -224,6 +246,11 @@
224# define IF_LINT(Code) /* empty */ 246# define IF_LINT(Code) /* empty */
225#endif 247#endif
226 248
249/* Here we need only the most basic fields of 'struct lconv', and can
250 therefore use the system's localeconv() function, without needing a
251 dependency on module 'localeconv'. */
252#undef localeconv
253
227/* Avoid some warnings from "gcc -Wshadow". 254/* Avoid some warnings from "gcc -Wshadow".
228 This file doesn't use the exp() and remainder() functions. */ 255 This file doesn't use the exp() and remainder() functions. */
229#undef exp 256#undef exp
@@ -231,7 +258,7 @@
231#undef remainder 258#undef remainder
232#define remainder rem 259#define remainder rem
233 260
234#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF) && !WIDE_CHAR_VERSION 261#if (!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (PTRDIFF_MAX > INT_MAX)) && !WIDE_CHAR_VERSION
235# if (HAVE_STRNLEN && !defined _AIX) 262# if (HAVE_STRNLEN && !defined _AIX)
236# define local_strnlen strnlen 263# define local_strnlen strnlen
237# else 264# else
@@ -247,7 +274,7 @@ local_strnlen (const char *string, size_t maxlen)
247# endif 274# endif
248#endif 275#endif
249 276
250#if (((!USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_WPRINTF_DIRECTIVE_LC) && WIDE_CHAR_VERSION) || ((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS) && !WIDE_CHAR_VERSION && DCHAR_IS_TCHAR)) && HAVE_WCHAR_T 277#if ((!USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (PTRDIFF_MAX > INT_MAX) || !DCHAR_IS_TCHAR || NEED_WPRINTF_DIRECTIVE_LC) && WIDE_CHAR_VERSION) || ((!USE_SNPRINTF || (PTRDIFF_MAX > INT_MAX) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS) && !WIDE_CHAR_VERSION && DCHAR_IS_TCHAR)
251# if HAVE_WCSLEN 278# if HAVE_WCSLEN
252# define local_wcslen wcslen 279# define local_wcslen wcslen
253# else 280# else
@@ -270,7 +297,7 @@ local_wcslen (const wchar_t *s)
270# endif 297# endif
271#endif 298#endif
272 299
273#if (!USE_SNPRINTF || (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF) && HAVE_WCHAR_T && WIDE_CHAR_VERSION 300#if (!USE_SNPRINTF || (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF) && WIDE_CHAR_VERSION
274# if HAVE_WCSNLEN && HAVE_DECL_WCSNLEN 301# if HAVE_WCSNLEN && HAVE_DECL_WCSNLEN
275# define local_wcsnlen wcsnlen 302# define local_wcsnlen wcsnlen
276# else 303# else
@@ -289,7 +316,7 @@ local_wcsnlen (const wchar_t *s, size_t maxlen)
289# endif 316# endif
290#endif 317#endif
291 318
292#if (((!USE_SNPRINTF || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS || ENABLE_WCHAR_FALLBACK) && HAVE_WCHAR_T) || ((NEED_PRINTF_DIRECTIVE_LC || ENABLE_WCHAR_FALLBACK) && HAVE_WINT_T)) && !WIDE_CHAR_VERSION 319#if ((!USE_SNPRINTF || (PTRDIFF_MAX > INT_MAX) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS || ENABLE_WCHAR_FALLBACK) || ((NEED_PRINTF_DIRECTIVE_LC || ENABLE_WCHAR_FALLBACK) && HAVE_WINT_T)) && !WIDE_CHAR_VERSION
293# if ENABLE_WCHAR_FALLBACK 320# if ENABLE_WCHAR_FALLBACK
294static size_t 321static size_t
295wctomb_fallback (char *s, wchar_t wc) 322wctomb_fallback (char *s, wchar_t wc)
@@ -357,7 +384,7 @@ local_wctomb (char *s, wchar_t wc)
357# endif 384# endif
358#endif 385#endif
359 386
360#if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE || (NEED_WPRINTF_DIRECTIVE_LA && WIDE_CHAR_VERSION) 387#if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE || (NEED_WPRINTF_DIRECTIVE_LA && WIDE_CHAR_VERSION) || (NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION || NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT)
361/* Determine the decimal-point character according to the current locale. */ 388/* Determine the decimal-point character according to the current locale. */
362# ifndef decimal_point_char_defined 389# ifndef decimal_point_char_defined
363# define decimal_point_char_defined 1 390# define decimal_point_char_defined 1
@@ -384,6 +411,217 @@ decimal_point_char (void)
384# endif 411# endif
385#endif 412#endif
386 413
414#if (!WIDE_CHAR_VERSION && (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE)) || ((!WIDE_CHAR_VERSION || !DCHAR_IS_TCHAR) && (NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION || NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT))
415/* Determine the thousands-separator character according to the current
416 locale.
417 It is a single multibyte character.
418 In glibc: 35x ".", 90x ",", 23x U+202F, 1x U+2019, 1x U+066C, on other
419 systems also U+00A0. */
420# ifndef thousands_separator_char_defined
421# define thousands_separator_char_defined 1
422static const char *
423thousands_separator_char (char stackbuf[10])
424{
425 /* Determine it in a multithread-safe way.
426 We know nl_langinfo is multithread-safe on glibc systems, on Mac OS X
427 systems, and on NetBSD, but is not required to be multithread-safe by
428 POSIX.
429 localeconv() is not guaranteed to be multithread-safe by POSIX either;
430 however, on native Windows it is (cf. test-localeconv-mt).
431 sprintf(), however, is multithread-safe. */
432# if HAVE_NL_LANGINFO && (__GLIBC__ || defined __UCLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __NetBSD__)
433 return nl_langinfo (THOUSEP);
434# elif defined _WIN32 && !defined __CYGWIN__
435 return localeconv () -> thousands_sep;
436# else
437 sprintf (stackbuf, "%'.0f", 1000.0);
438 /* Now stackbuf = "1<thousep>000". */
439 stackbuf[strlen (stackbuf) - 3] = '\0';
440# if defined __sun
441 /* Solaris specific hack: Replace wrong result (0xC2 means U+00A0). */
442 if (streq (&stackbuf[1], "\302"))
443 strcpy (&stackbuf[1], MB_CUR_MAX > 1 ? "\302\240" : "\240");
444# endif
445 return &stackbuf[1];
446# endif
447}
448# endif
449#endif
450#if !WIDE_CHAR_VERSION && defined DCHAR_CONV_FROM_ENCODING && (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE)
451/* Determine the thousands-separator character, as a DCHAR_T[] array,
452 according to the current locale.
453 It is a single Unicode character. */
454# ifndef thousands_separator_DCHAR_defined
455# define thousands_separator_DCHAR_defined 1
456static const DCHAR_T *
457thousands_separator_DCHAR (DCHAR_T stackbuf[10])
458{
459 /* Determine it in a multithread-safe way. */
460 char tmpbuf[10];
461 const char *tmp = thousands_separator_char (tmpbuf);
462 if (*tmp != '\0')
463 {
464 /* Convert it from char[] to DCHAR_T[]. */
465 size_t converted_len = 10;
466 DCHAR_T *converted =
467 DCHAR_CONV_FROM_ENCODING (locale_charset (),
468 iconveh_question_mark,
469 tmp, strlen (tmp) + 1,
470 NULL,
471 stackbuf, &converted_len);
472 if (converted != NULL)
473 {
474 if (converted != stackbuf)
475 /* It should not be so long. */
476 abort ();
477 return stackbuf;
478 }
479 }
480 stackbuf[0] = 0;
481 return stackbuf;
482}
483# endif
484#endif
485/* Maximum number of 'char' in the char[] or DCHAR_T[] representation of the
486 thousands separator. */
487#define THOUSEP_CHAR_MAXLEN 3
488
489#if WIDE_CHAR_VERSION && ((NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE) || ((NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION || NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT) && DCHAR_IS_TCHAR))
490/* Determine the thousands-separator character, as a wide character, according
491 to the current locale.
492 It is a single wide character. */
493# ifndef thousands_separator_wchar_defined
494# define thousands_separator_wchar_defined 1
495static const wchar_t *
496thousands_separator_wchar (wchar_t stackbuf[10])
497{
498# if __GLIBC__ >= 2 || defined __CYGWIN__
499 /* On glibc, in the unibyte locale fr_FR, the *wprintf routines use U+202F
500 as separator, which cannot be represented in the locale encoding. */
501 stackbuf[0] =
502 (wchar_t) (unsigned long) nl_langinfo (_NL_NUMERIC_THOUSANDS_SEP_WC);
503 stackbuf[1] = L'\0';
504 return stackbuf;
505# elif defined _WIN32 && !defined __CYGWIN__
506 const char *tmp = localeconv () -> thousands_sep;
507 if (*tmp != '\0')
508 {
509 mbstate_t state;
510 mbszero (&state);
511 if ((int) mbrtowc (&stackbuf[0], tmp, strlen (tmp), &state) > 0)
512 stackbuf[1] = L'\0';
513 else
514 stackbuf[0] = L'\0';
515 }
516 else
517 stackbuf[0] = L'\0';
518 return stackbuf;
519# elif defined __sun
520 /* Use sprintf, because swprintf retrieves a wrong value for the
521 thousands-separator wide character (e.g. (wchar_t) 0xffffffa0). */
522 char tmp[10];
523 sprintf (tmp, "%'.0f", 1000.0);
524 /* Now tmp = L"1<thousep>000". */
525 tmp[strlen (tmp) - 3] = '\0';
526 /* Solaris specific hack: Replace wrong result (0xC2 means U+00A0). */
527 if (streq (&tmp[1], "\302"))
528 strcpy (&tmp[1], MB_CUR_MAX > 1 ? "\302\240" : "\240");
529 if (tmp[1] != '\0')
530 {
531 mbstate_t state;
532 mbszero (&state);
533 if ((int) mbrtowc (&stackbuf[0], &tmp[1], strlen (&tmp[1]), &state) > 0)
534 stackbuf[1] = L'\0';
535 else
536 stackbuf[0] = L'\0';
537 }
538 else
539 stackbuf[0] = L'\0';
540 return stackbuf;
541# else
542 swprintf (stackbuf, 10, L"%'.0f", 1000.0);
543 /* Now stackbuf = L"1<thousep>000". */
544 stackbuf[local_wcslen (stackbuf) - 3] = '\0';
545 return &stackbuf[1];
546# endif
547}
548# endif
549#endif
550/* Maximum number of 'wchar_t' in the wchar_t[] representation of the thousands
551 separator. */
552#define THOUSEP_WCHAR_MAXLEN 1
553
554#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE) || (NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION || NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT)
555# ifndef grouping_rule_defined
556# define grouping_rule_defined 1
557/* Determine the grouping rule.
558 * As specified in POSIX
559 * <https://pubs.opengroup.org/onlinepubs/9799919799/functions/localeconv.html>
560 * <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap07.html#tag_07_03_04>
561 * it is a string whose elements are 'signed char' values, where
562 * "Each integer specifies the number of digits in each group, with the initial
563 * integer defining the size of the group immediately preceding the decimal
564 * delimiter, and the following integers defining the preceding groups. If
565 * the last integer is not -1, then the size of the previous group (if any)
566 * shall be repeatedly used for the remainder of the digits. If the last
567 * integer is -1, then no further grouping shall be performed."
568 * Platforms that have locales with grouping:
569 * glibc, FreeBSD, NetBSD, AIX, Solaris, Cygwin, Haiku.
570 * Platforms that don't:
571 * musl libc, macOS, OpenBSD, Android, mingw, MSVC.
572 * Typical grouping rules on glibc:
573 * 136x 3 (fr_FR etc.)
574 * 4x 4 (cmn_TW etc.)
575 * 9x 3;2 (ta_IN etc.)
576 * 1x 2;2;2;3 (umn_US)
577 * 21x -1 (C etc.)
578 */
579static const signed char *
580grouping_rule (void)
581{
582 /* We know nl_langinfo is multithread-safe on glibc systems and on Cygwin,
583 but is not required to be multithread-safe by POSIX.
584 localeconv() is not guaranteed to be multithread-safe by POSIX either;
585 however, on all known systems it is (cf. test-localeconv-mt). */
586# if __GLIBC__ >= 2
587 return (const signed char *) nl_langinfo (GROUPING);
588# elif defined __CYGWIN__
589 return (const signed char *) nl_langinfo (_NL_NUMERIC_GROUPING);
590# else
591 return (const signed char *) localeconv () -> grouping;
592# endif
593}
594/* Determines the number of thousands-separators to be inserted in a digit
595 sequence with ndigits digits (before the decimal point). */
596static size_t
597num_thousands_separators (const signed char *grouping, size_t ndigits)
598{
599 const signed char *g = grouping;
600 int h = *g;
601 if (h <= 0 || ndigits == 0)
602 return 0;
603 size_t insert = 0;
604 for (;;)
605 {
606 /* Invariant: here h == *g, h > 0, ndigits > 0. */
607 if (g[1] == 0)
608 /* h repeats endlessly. */
609 return insert + (ndigits - 1) / h;
610 /* h does not repeat. */
611 if (ndigits <= h)
612 return insert;
613 ndigits -= h;
614 insert++;
615 g++;
616 h = *g;
617 if (h < 0)
618 /* No further grouping. */
619 return insert;
620 }
621}
622# endif
623#endif
624
387#if NEED_PRINTF_INFINITE_DOUBLE && !NEED_PRINTF_DOUBLE 625#if NEED_PRINTF_INFINITE_DOUBLE && !NEED_PRINTF_DOUBLE
388 626
389/* Equivalent to !isfinite(x) || x == 0, but does not require libm. */ 627/* Equivalent to !isfinite(x) || x == 0, but does not require libm. */
@@ -406,8 +644,45 @@ is_infinite_or_zerol (long double x)
406 644
407#endif 645#endif
408 646
647#if NEED_PRINTF_LONG_DOUBLE
648
649/* Like frexpl, except that it supports even "unsupported" numbers. */
650# if (LDBL_MANT_DIG == 64 && (defined __ia64 || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_))) && (defined __APPLE__ && defined __MACH__)
651/* Don't assume that frexpl can handle pseudo-denormals; it does not on
652 macOS 12/x86_64. Therefore test for a pseudo-denormal explicitly. */
653
654static
655long double safe_frexpl (long double x, int *exp)
656{
657 union
658 {
659 long double value;
660 struct { unsigned int mant_word[2]; unsigned short sign_exp_word; } r;
661 }
662 u;
663 u.value = x;
664 if (u.r.sign_exp_word == 0 && (u.r.mant_word[1] & 0x80000000u) != 0)
665 {
666 /* Pseudo-Denormal. */
667 *exp = LDBL_MIN_EXP;
668 u.r.sign_exp_word = 1 - LDBL_MIN_EXP;
669 return u.value;
670 }
671 else
672 return frexpl (x, exp);
673}
674
675# else
676# define safe_frexpl frexpl
677# endif
678
679#endif
680
409#if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE 681#if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE
410 682
683/* An indicator for a failed memory allocation. */
684# define NOMEM_PTR ((void *) (-1))
685
411/* Converting 'long double' to decimal without rare rounding bugs requires 686/* Converting 'long double' to decimal without rare rounding bugs requires
412 real bignums. We use the naming conventions of GNU gmp, but vastly simpler 687 real bignums. We use the naming conventions of GNU gmp, but vastly simpler
413 (and slower) algorithms. */ 688 (and slower) algorithms. */
@@ -428,8 +703,8 @@ typedef struct
428} mpn_t; 703} mpn_t;
429 704
430/* Compute the product of two bignums >= 0. 705/* Compute the product of two bignums >= 0.
431 Return the allocated memory in case of success, NULL in case of memory 706 Return the allocated memory (possibly NULL) in case of success, NOMEM_PTR
432 allocation failure. */ 707 in case of memory allocation failure. */
433static void * 708static void *
434multiply (mpn_t src1, mpn_t src2, mpn_t *dest) 709multiply (mpn_t src1, mpn_t src2, mpn_t *dest)
435{ 710{
@@ -457,26 +732,25 @@ multiply (mpn_t src1, mpn_t src2, mpn_t *dest)
457 { 732 {
458 /* src1 or src2 is zero. */ 733 /* src1 or src2 is zero. */
459 dest->nlimbs = 0; 734 dest->nlimbs = 0;
460 dest->limbs = (mp_limb_t *) malloc (1); 735 dest->limbs = NULL;
461 } 736 }
462 else 737 else
463 { 738 {
464 /* Here 1 <= len1 <= len2. */ 739 /* Here 1 <= len1 <= len2. */
465 size_t dlen; 740 size_t dlen;
466 mp_limb_t *dp; 741 mp_limb_t *dp;
467 size_t k, i, j;
468 742
469 dlen = len1 + len2; 743 dlen = len1 + len2;
470 dp = (mp_limb_t *) malloc (dlen * sizeof (mp_limb_t)); 744 dp = (mp_limb_t *) malloc (dlen * sizeof (mp_limb_t));
471 if (dp == NULL) 745 if (dp == NULL)
472 return NULL; 746 return NOMEM_PTR;
473 for (k = len2; k > 0; ) 747 for (size_t k = len2; k > 0; )
474 dp[--k] = 0; 748 dp[--k] = 0;
475 for (i = 0; i < len1; i++) 749 for (size_t i = 0; i < len1; i++)
476 { 750 {
477 mp_limb_t digit1 = p1[i]; 751 mp_limb_t digit1 = p1[i];
478 mp_twolimb_t carry = 0; 752 mp_twolimb_t carry = 0;
479 for (j = 0; j < len2; j++) 753 for (size_t j = 0; j < len2; j++)
480 { 754 {
481 mp_limb_t digit2 = p2[j]; 755 mp_limb_t digit2 = p2[j];
482 carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2; 756 carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
@@ -500,8 +774,8 @@ multiply (mpn_t src1, mpn_t src2, mpn_t *dest)
500 the remainder. 774 the remainder.
501 Finally, round-to-even is performed: If r > b/2 or if r = b/2 and q is odd, 775 Finally, round-to-even is performed: If r > b/2 or if r = b/2 and q is odd,
502 q is incremented. 776 q is incremented.
503 Return the allocated memory in case of success, NULL in case of memory 777 Return the allocated memory (possibly NULL) in case of success, NOMEM_PTR
504 allocation failure. */ 778 in case of memory allocation failure. */
505static void * 779static void *
506divide (mpn_t a, mpn_t b, mpn_t *q) 780divide (mpn_t a, mpn_t b, mpn_t *q)
507{ 781{
@@ -560,7 +834,6 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
560 size_t a_len = a.nlimbs; 834 size_t a_len = a.nlimbs;
561 const mp_limb_t *b_ptr = b.limbs; 835 const mp_limb_t *b_ptr = b.limbs;
562 size_t b_len = b.nlimbs; 836 size_t b_len = b.nlimbs;
563 mp_limb_t *roomptr;
564 mp_limb_t *tmp_roomptr = NULL; 837 mp_limb_t *tmp_roomptr = NULL;
565 mp_limb_t *q_ptr; 838 mp_limb_t *q_ptr;
566 size_t q_len; 839 size_t q_len;
@@ -570,9 +843,9 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
570 /* Allocate room for a_len+2 digits. 843 /* Allocate room for a_len+2 digits.
571 (Need a_len+1 digits for the real division and 1 more digit for the 844 (Need a_len+1 digits for the real division and 1 more digit for the
572 final rounding of q.) */ 845 final rounding of q.) */
573 roomptr = (mp_limb_t *) malloc ((a_len + 2) * sizeof (mp_limb_t)); 846 mp_limb_t *roomptr = (mp_limb_t *) malloc ((a_len + 2) * sizeof (mp_limb_t));
574 if (roomptr == NULL) 847 if (roomptr == NULL)
575 return NULL; 848 return NOMEM_PTR;
576 849
577 /* Normalise a. */ 850 /* Normalise a. */
578 while (a_len > 0 && a_ptr[a_len - 1] == 0) 851 while (a_len > 0 && a_ptr[a_len - 1] == 0)
@@ -612,8 +885,7 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
612 mp_limb_t remainder = 0; 885 mp_limb_t remainder = 0;
613 const mp_limb_t *sourceptr = a_ptr + a_len; 886 const mp_limb_t *sourceptr = a_ptr + a_len;
614 mp_limb_t *destptr = q_ptr + a_len; 887 mp_limb_t *destptr = q_ptr + a_len;
615 size_t count; 888 for (size_t count = a_len; count > 0; count--)
616 for (count = a_len; count > 0; count--)
617 { 889 {
618 mp_twolimb_t num = 890 mp_twolimb_t num =
619 ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--sourceptr; 891 ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--sourceptr;
@@ -708,14 +980,13 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
708 if (tmp_roomptr == NULL) 980 if (tmp_roomptr == NULL)
709 { 981 {
710 free (roomptr); 982 free (roomptr);
711 return NULL; 983 return NOMEM_PTR;
712 } 984 }
713 { 985 {
714 const mp_limb_t *sourceptr = b_ptr; 986 const mp_limb_t *sourceptr = b_ptr;
715 mp_limb_t *destptr = tmp_roomptr; 987 mp_limb_t *destptr = tmp_roomptr;
716 mp_twolimb_t accu = 0; 988 mp_twolimb_t accu = 0;
717 size_t count; 989 for (size_t count = b_len; count > 0; count--)
718 for (count = b_len; count > 0; count--)
719 { 990 {
720 accu += (mp_twolimb_t) *sourceptr++ << s; 991 accu += (mp_twolimb_t) *sourceptr++ << s;
721 *destptr++ = (mp_limb_t) accu; 992 *destptr++ = (mp_limb_t) accu;
@@ -742,8 +1013,7 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
742 const mp_limb_t *sourceptr = a_ptr; 1013 const mp_limb_t *sourceptr = a_ptr;
743 mp_limb_t *destptr = r_ptr; 1014 mp_limb_t *destptr = r_ptr;
744 mp_twolimb_t accu = 0; 1015 mp_twolimb_t accu = 0;
745 size_t count; 1016 for (size_t count = a_len; count > 0; count--)
746 for (count = a_len; count > 0; count--)
747 { 1017 {
748 accu += (mp_twolimb_t) *sourceptr++ << s; 1018 accu += (mp_twolimb_t) *sourceptr++ << s;
749 *destptr++ = (mp_limb_t) accu; 1019 *destptr++ = (mp_limb_t) accu;
@@ -819,8 +1089,7 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
819 const mp_limb_t *sourceptr = b_ptr; 1089 const mp_limb_t *sourceptr = b_ptr;
820 mp_limb_t *destptr = r_ptr + j; 1090 mp_limb_t *destptr = r_ptr + j;
821 mp_twolimb_t carry = 0; 1091 mp_twolimb_t carry = 0;
822 size_t count; 1092 for (size_t count = b_len; count > 0; count--)
823 for (count = b_len; count > 0; count--)
824 { 1093 {
825 /* Here 0 <= carry <= q*. */ 1094 /* Here 0 <= carry <= q*. */
826 carry = 1095 carry =
@@ -844,8 +1113,7 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
844 const mp_limb_t *sourceptr = b_ptr; 1113 const mp_limb_t *sourceptr = b_ptr;
845 mp_limb_t *destptr = r_ptr + j; 1114 mp_limb_t *destptr = r_ptr + j;
846 mp_limb_t carry = 0; 1115 mp_limb_t carry = 0;
847 size_t count; 1116 for (size_t count = b_len; count > 0; count--)
848 for (count = b_len; count > 0; count--)
849 { 1117 {
850 mp_limb_t source1 = *sourceptr++; 1118 mp_limb_t source1 = *sourceptr++;
851 mp_limb_t source2 = *destptr; 1119 mp_limb_t source2 = *destptr;
@@ -877,8 +1145,7 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
877 { 1145 {
878 mp_limb_t ptr = r_ptr + r_len; 1146 mp_limb_t ptr = r_ptr + r_len;
879 mp_twolimb_t accu = 0; 1147 mp_twolimb_t accu = 0;
880 size_t count; 1148 for (size_t count = r_len; count > 0; count--)
881 for (count = r_len; count > 0; count--)
882 { 1149 {
883 accu = (mp_twolimb_t) (mp_limb_t) accu << GMP_LIMB_BITS; 1150 accu = (mp_twolimb_t) (mp_limb_t) accu << GMP_LIMB_BITS;
884 accu += (mp_twolimb_t) *--ptr << (GMP_LIMB_BITS - s); 1151 accu += (mp_twolimb_t) *--ptr << (GMP_LIMB_BITS - s);
@@ -893,29 +1160,25 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
893 /* Compare r << 1 with b. */ 1160 /* Compare r << 1 with b. */
894 if (r_len > b_len) 1161 if (r_len > b_len)
895 goto increment_q; 1162 goto increment_q;
896 { 1163 for (size_t i = b_len;;)
897 size_t i; 1164 {
898 for (i = b_len;;) 1165 mp_limb_t r_i =
899 { 1166 (i <= r_len && i > 0 ? r_ptr[i - 1] >> (GMP_LIMB_BITS - 1) : 0)
900 mp_limb_t r_i = 1167 | (i < r_len ? r_ptr[i] << 1 : 0);
901 (i <= r_len && i > 0 ? r_ptr[i - 1] >> (GMP_LIMB_BITS - 1) : 0) 1168 mp_limb_t b_i = (i < b_len ? b_ptr[i] : 0);
902 | (i < r_len ? r_ptr[i] << 1 : 0); 1169 if (r_i > b_i)
903 mp_limb_t b_i = (i < b_len ? b_ptr[i] : 0); 1170 goto increment_q;
904 if (r_i > b_i) 1171 if (r_i < b_i)
905 goto increment_q; 1172 goto keep_q;
906 if (r_i < b_i) 1173 if (i == 0)
907 goto keep_q; 1174 break;
908 if (i == 0) 1175 i--;
909 break; 1176 }
910 i--;
911 }
912 }
913 if (q_len > 0 && ((q_ptr[0] & 1) != 0)) 1177 if (q_len > 0 && ((q_ptr[0] & 1) != 0))
914 /* q is odd. */ 1178 /* q is odd. */
915 increment_q: 1179 increment_q:
916 { 1180 {
917 size_t i; 1181 for (size_t i = 0; i < q_len; i++)
918 for (i = 0; i < q_len; i++)
919 if (++(q_ptr[i]) != 0) 1182 if (++(q_ptr[i]) != 0)
920 goto keep_q; 1183 goto keep_q;
921 q_ptr[q_len++] = 1; 1184 q_ptr[q_len++] = 1;
@@ -930,7 +1193,7 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
930/* Avoid pointless GCC warning "argument 1 value '18446744073709551615' exceeds 1193/* Avoid pointless GCC warning "argument 1 value '18446744073709551615' exceeds
931 maximum object size 9223372036854775807", triggered by the use of xsum as 1194 maximum object size 9223372036854775807", triggered by the use of xsum as
932 argument of malloc. */ 1195 argument of malloc. */
933# if __GNUC__ >= 7 1196# if _GL_GNUC_PREREQ (7, 0)
934# pragma GCC diagnostic push 1197# pragma GCC diagnostic push
935# pragma GCC diagnostic ignored "-Walloc-size-larger-than=" 1198# pragma GCC diagnostic ignored "-Walloc-size-larger-than="
936# endif 1199# endif
@@ -961,8 +1224,7 @@ convert_to_decimal (mpn_t a, size_t extra_zeroes)
961 /* Divide a by 10^9, in-place. */ 1224 /* Divide a by 10^9, in-place. */
962 mp_limb_t remainder = 0; 1225 mp_limb_t remainder = 0;
963 mp_limb_t *ptr = a_ptr + a_len; 1226 mp_limb_t *ptr = a_ptr + a_len;
964 size_t count; 1227 for (size_t count = a_len; count > 0; count--)
965 for (count = a_len; count > 0; count--)
966 { 1228 {
967 mp_twolimb_t num = 1229 mp_twolimb_t num =
968 ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--ptr; 1230 ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--ptr;
@@ -970,7 +1232,7 @@ convert_to_decimal (mpn_t a, size_t extra_zeroes)
970 remainder = num % 1000000000; 1232 remainder = num % 1000000000;
971 } 1233 }
972 /* Store the remainder as 9 decimal digits. */ 1234 /* Store the remainder as 9 decimal digits. */
973 for (count = 9; count > 0; count--) 1235 for (size_t count = 9; count > 0; count--)
974 { 1236 {
975 *d_ptr++ = '0' + (remainder % 10); 1237 *d_ptr++ = '0' + (remainder % 10);
976 remainder = remainder / 10; 1238 remainder = remainder / 10;
@@ -991,7 +1253,7 @@ convert_to_decimal (mpn_t a, size_t extra_zeroes)
991 return c_ptr; 1253 return c_ptr;
992} 1254}
993 1255
994# if __GNUC__ >= 7 1256# if _GL_GNUC_PREREQ (7, 0)
995# pragma GCC diagnostic pop 1257# pragma GCC diagnostic pop
996# endif 1258# endif
997 1259
@@ -1004,18 +1266,15 @@ convert_to_decimal (mpn_t a, size_t extra_zeroes)
1004static void * 1266static void *
1005decode_long_double (long double x, int *ep, mpn_t *mp) 1267decode_long_double (long double x, int *ep, mpn_t *mp)
1006{ 1268{
1007 mpn_t m;
1008 int exp;
1009 long double y;
1010 size_t i;
1011
1012 /* Allocate memory for result. */ 1269 /* Allocate memory for result. */
1270 mpn_t m;
1013 m.nlimbs = (LDBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS; 1271 m.nlimbs = (LDBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
1014 m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t)); 1272 m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t));
1015 if (m.limbs == NULL) 1273 if (m.limbs == NULL)
1016 return NULL; 1274 return NULL;
1017 /* Split into exponential part and mantissa. */ 1275 /* Split into exponential part and mantissa. */
1018 y = frexpl (x, &exp); 1276 int exp;
1277 long double y = safe_frexpl (x, &exp);
1019 if (!(y >= 0.0L && y < 1.0L)) 1278 if (!(y >= 0.0L && y < 1.0L))
1020 abort (); 1279 abort ();
1021 /* x = 2^exp * y = 2^(exp - LDBL_MANT_BIT) * (y * 2^LDBL_MANT_BIT), and the 1280 /* x = 2^exp * y = 2^(exp - LDBL_MANT_BIT) * (y * 2^LDBL_MANT_BIT), and the
@@ -1053,7 +1312,7 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
1053 } 1312 }
1054# endif 1313# endif
1055# endif 1314# endif
1056 for (i = LDBL_MANT_BIT / GMP_LIMB_BITS; i > 0; ) 1315 for (size_t i = LDBL_MANT_BIT / GMP_LIMB_BITS; i > 0; )
1057 { 1316 {
1058 mp_limb_t hi, lo; 1317 mp_limb_t hi, lo;
1059 y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); 1318 y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
@@ -1092,18 +1351,15 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
1092static void * 1351static void *
1093decode_double (double x, int *ep, mpn_t *mp) 1352decode_double (double x, int *ep, mpn_t *mp)
1094{ 1353{
1095 mpn_t m;
1096 int exp;
1097 double y;
1098 size_t i;
1099
1100 /* Allocate memory for result. */ 1354 /* Allocate memory for result. */
1355 mpn_t m;
1101 m.nlimbs = (DBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS; 1356 m.nlimbs = (DBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
1102 m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t)); 1357 m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t));
1103 if (m.limbs == NULL) 1358 if (m.limbs == NULL)
1104 return NULL; 1359 return NULL;
1105 /* Split into exponential part and mantissa. */ 1360 /* Split into exponential part and mantissa. */
1106 y = frexp (x, &exp); 1361 int exp;
1362 double y = frexp (x, &exp);
1107 if (!(y >= 0.0 && y < 1.0)) 1363 if (!(y >= 0.0 && y < 1.0))
1108 abort (); 1364 abort ();
1109 /* x = 2^exp * y = 2^(exp - DBL_MANT_BIT) * (y * 2^DBL_MANT_BIT), and the 1365 /* x = 2^exp * y = 2^(exp - DBL_MANT_BIT) * (y * 2^DBL_MANT_BIT), and the
@@ -1141,7 +1397,7 @@ decode_double (double x, int *ep, mpn_t *mp)
1141 } 1397 }
1142# endif 1398# endif
1143# endif 1399# endif
1144 for (i = DBL_MANT_BIT / GMP_LIMB_BITS; i > 0; ) 1400 for (size_t i = DBL_MANT_BIT / GMP_LIMB_BITS; i > 0; )
1145 { 1401 {
1146 mp_limb_t hi, lo; 1402 mp_limb_t hi, lo;
1147 y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); 1403 y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
@@ -1176,24 +1432,11 @@ decode_double (double x, int *ep, mpn_t *mp)
1176static char * 1432static char *
1177scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n) 1433scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
1178{ 1434{
1179 int s;
1180 size_t extra_zeroes;
1181 unsigned int abs_n;
1182 unsigned int abs_s;
1183 mp_limb_t *pow5_ptr;
1184 size_t pow5_len;
1185 unsigned int s_limbs;
1186 unsigned int s_bits;
1187 mpn_t pow5;
1188 mpn_t z;
1189 void *z_memory;
1190 char *digits;
1191
1192 /* x = 2^e * m, hence 1435 /* x = 2^e * m, hence
1193 y = round (2^e * 10^n * m) = round (2^(e+n) * 5^n * m) 1436 y = round (2^e * 10^n * m) = round (2^(e+n) * 5^n * m)
1194 = round (2^s * 5^n * m). */ 1437 = round (2^s * 5^n * m). */
1195 s = e + n; 1438 int s = e + n;
1196 extra_zeroes = 0; 1439 size_t extra_zeroes = 0;
1197 /* Factor out a common power of 10 if possible. */ 1440 /* Factor out a common power of 10 if possible. */
1198 if (s > 0 && n > 0) 1441 if (s > 0 && n > 0)
1199 { 1442 {
@@ -1206,11 +1449,12 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
1206 z = round (2^s * 5^n * m). */ 1449 z = round (2^s * 5^n * m). */
1207 /* Compute 5^|n|, possibly shifted by |s| bits if n and s have the same 1450 /* Compute 5^|n|, possibly shifted by |s| bits if n and s have the same
1208 sign. 2.322 is slightly larger than log(5)/log(2). */ 1451 sign. 2.322 is slightly larger than log(5)/log(2). */
1209 abs_n = (n >= 0 ? n : -n); 1452 unsigned int abs_n = (n >= 0 ? n : -n);
1210 abs_s = (s >= 0 ? s : -s); 1453 unsigned int abs_s = (s >= 0 ? s : -s);
1211 pow5_ptr = (mp_limb_t *) malloc (((int)(abs_n * (2.322f / GMP_LIMB_BITS)) + 1 1454 mp_limb_t *pow5_ptr =
1212 + abs_s / GMP_LIMB_BITS + 1) 1455 (mp_limb_t *) malloc (((int)(abs_n * (2.322f / GMP_LIMB_BITS)) + 1
1213 * sizeof (mp_limb_t)); 1456 + abs_s / GMP_LIMB_BITS + 1)
1457 * sizeof (mp_limb_t));
1214 if (pow5_ptr == NULL) 1458 if (pow5_ptr == NULL)
1215 { 1459 {
1216 free (memory); 1460 free (memory);
@@ -1218,7 +1462,7 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
1218 } 1462 }
1219 /* Initialize with 1. */ 1463 /* Initialize with 1. */
1220 pow5_ptr[0] = 1; 1464 pow5_ptr[0] = 1;
1221 pow5_len = 1; 1465 size_t pow5_len = 1;
1222 /* Multiply with 5^|n|. */ 1466 /* Multiply with 5^|n|. */
1223 if (abs_n > 0) 1467 if (abs_n > 0)
1224 { 1468 {
@@ -1227,13 +1471,11 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
1227 1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625, 1471 1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625,
1228 48828125, 244140625, 1220703125 1472 48828125, 244140625, 1220703125
1229 }; 1473 };
1230 unsigned int n13; 1474 for (unsigned int n13 = 0; n13 <= abs_n; n13 += 13)
1231 for (n13 = 0; n13 <= abs_n; n13 += 13)
1232 { 1475 {
1233 mp_limb_t digit1 = small_pow5[n13 + 13 <= abs_n ? 13 : abs_n - n13]; 1476 mp_limb_t digit1 = small_pow5[n13 + 13 <= abs_n ? 13 : abs_n - n13];
1234 size_t j;
1235 mp_twolimb_t carry = 0; 1477 mp_twolimb_t carry = 0;
1236 for (j = 0; j < pow5_len; j++) 1478 for (size_t j = 0; j < pow5_len; j++)
1237 { 1479 {
1238 mp_limb_t digit2 = pow5_ptr[j]; 1480 mp_limb_t digit2 = pow5_ptr[j];
1239 carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2; 1481 carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2;
@@ -1244,8 +1486,11 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
1244 pow5_ptr[pow5_len++] = (mp_limb_t) carry; 1486 pow5_ptr[pow5_len++] = (mp_limb_t) carry;
1245 } 1487 }
1246 } 1488 }
1247 s_limbs = abs_s / GMP_LIMB_BITS; 1489 unsigned int s_limbs = abs_s / GMP_LIMB_BITS;
1248 s_bits = abs_s % GMP_LIMB_BITS; 1490 unsigned int s_bits = abs_s % GMP_LIMB_BITS;
1491 mpn_t pow5;
1492 mpn_t z;
1493 void *z_memory;
1249 if (n >= 0 ? s >= 0 : s <= 0) 1494 if (n >= 0 ? s >= 0 : s <= 0)
1250 { 1495 {
1251 /* Multiply with 2^|s|. */ 1496 /* Multiply with 2^|s|. */
@@ -1253,8 +1498,7 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
1253 { 1498 {
1254 mp_limb_t *ptr = pow5_ptr; 1499 mp_limb_t *ptr = pow5_ptr;
1255 mp_twolimb_t accu = 0; 1500 mp_twolimb_t accu = 0;
1256 size_t count; 1501 for (size_t count = pow5_len; count > 0; count--)
1257 for (count = pow5_len; count > 0; count--)
1258 { 1502 {
1259 accu += (mp_twolimb_t) *ptr << s_bits; 1503 accu += (mp_twolimb_t) *ptr << s_bits;
1260 *ptr++ = (mp_limb_t) accu; 1504 *ptr++ = (mp_limb_t) accu;
@@ -1268,13 +1512,12 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
1268 } 1512 }
1269 if (s_limbs > 0) 1513 if (s_limbs > 0)
1270 { 1514 {
1271 size_t count; 1515 for (size_t count = pow5_len; count > 0;)
1272 for (count = pow5_len; count > 0;)
1273 { 1516 {
1274 count--; 1517 count--;
1275 pow5_ptr[s_limbs + count] = pow5_ptr[count]; 1518 pow5_ptr[s_limbs + count] = pow5_ptr[count];
1276 } 1519 }
1277 for (count = s_limbs; count > 0;) 1520 for (size_t count = s_limbs; count > 0;)
1278 { 1521 {
1279 count--; 1522 count--;
1280 pow5_ptr[count] = 0; 1523 pow5_ptr[count] = 0;
@@ -1306,7 +1549,7 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
1306 mpn_t denominator; 1549 mpn_t denominator;
1307 void *tmp_memory; 1550 void *tmp_memory;
1308 tmp_memory = multiply (m, pow5, &numerator); 1551 tmp_memory = multiply (m, pow5, &numerator);
1309 if (tmp_memory == NULL) 1552 if (tmp_memory == NOMEM_PTR)
1310 { 1553 {
1311 free (pow5_ptr); 1554 free (pow5_ptr);
1312 free (memory); 1555 free (memory);
@@ -1315,8 +1558,7 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
1315 /* Construct 2^|s|. */ 1558 /* Construct 2^|s|. */
1316 { 1559 {
1317 mp_limb_t *ptr = pow5_ptr + pow5_len; 1560 mp_limb_t *ptr = pow5_ptr + pow5_len;
1318 size_t i; 1561 for (size_t i = 0; i < s_limbs; i++)
1319 for (i = 0; i < s_limbs; i++)
1320 ptr[i] = 0; 1562 ptr[i] = 0;
1321 ptr[s_limbs] = (mp_limb_t) 1 << s_bits; 1563 ptr[s_limbs] = (mp_limb_t) 1 << s_bits;
1322 denominator.limbs = ptr; 1564 denominator.limbs = ptr;
@@ -1341,17 +1583,13 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
1341 } 1583 }
1342 { 1584 {
1343 mp_limb_t *destptr = num_ptr; 1585 mp_limb_t *destptr = num_ptr;
1344 { 1586 for (size_t i = 0; i < s_limbs; i++)
1345 size_t i; 1587 *destptr++ = 0;
1346 for (i = 0; i < s_limbs; i++)
1347 *destptr++ = 0;
1348 }
1349 if (s_bits > 0) 1588 if (s_bits > 0)
1350 { 1589 {
1351 const mp_limb_t *sourceptr = m.limbs; 1590 const mp_limb_t *sourceptr = m.limbs;
1352 mp_twolimb_t accu = 0; 1591 mp_twolimb_t accu = 0;
1353 size_t count; 1592 for (size_t count = m.nlimbs; count > 0; count--)
1354 for (count = m.nlimbs; count > 0; count--)
1355 { 1593 {
1356 accu += (mp_twolimb_t) *sourceptr++ << s_bits; 1594 accu += (mp_twolimb_t) *sourceptr++ << s_bits;
1357 *destptr++ = (mp_limb_t) accu; 1595 *destptr++ = (mp_limb_t) accu;
@@ -1363,8 +1601,7 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
1363 else 1601 else
1364 { 1602 {
1365 const mp_limb_t *sourceptr = m.limbs; 1603 const mp_limb_t *sourceptr = m.limbs;
1366 size_t count; 1604 for (size_t count = m.nlimbs; count > 0; count--)
1367 for (count = m.nlimbs; count > 0; count--)
1368 *destptr++ = *sourceptr++; 1605 *destptr++ = *sourceptr++;
1369 } 1606 }
1370 numerator.limbs = num_ptr; 1607 numerator.limbs = num_ptr;
@@ -1379,9 +1616,9 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
1379 1616
1380 /* Here y = round (x * 10^n) = z * 10^extra_zeroes. */ 1617 /* Here y = round (x * 10^n) = z * 10^extra_zeroes. */
1381 1618
1382 if (z_memory == NULL) 1619 if (z_memory == NOMEM_PTR)
1383 return NULL; 1620 return NULL;
1384 digits = convert_to_decimal (z, extra_zeroes); 1621 char *digits = convert_to_decimal (z, extra_zeroes);
1385 free (z_memory); 1622 free (z_memory);
1386 return digits; 1623 return digits;
1387} 1624}
@@ -1436,13 +1673,9 @@ scale10_round_decimal_double (double x, int n)
1436static int 1673static int
1437floorlog10l (long double x) 1674floorlog10l (long double x)
1438{ 1675{
1439 int exp;
1440 long double y;
1441 double z;
1442 double l;
1443
1444 /* Split into exponential part and mantissa. */ 1676 /* Split into exponential part and mantissa. */
1445 y = frexpl (x, &exp); 1677 int exp;
1678 long double y = safe_frexpl (x, &exp);
1446 if (!(y >= 0.0L && y < 1.0L)) 1679 if (!(y >= 0.0L && y < 1.0L))
1447 abort (); 1680 abort ();
1448 if (y == 0.0L) 1681 if (y == 0.0L)
@@ -1483,8 +1716,8 @@ floorlog10l (long double x)
1483 if (!(y >= 0.5L && y < 1.0L)) 1716 if (!(y >= 0.5L && y < 1.0L))
1484 abort (); 1717 abort ();
1485 /* Compute an approximation for l = log2(x) = exp + log2(y). */ 1718 /* Compute an approximation for l = log2(x) = exp + log2(y). */
1486 l = exp; 1719 double l = exp;
1487 z = y; 1720 double z = y;
1488 if (z < 0.70710678118654752444) 1721 if (z < 0.70710678118654752444)
1489 { 1722 {
1490 z *= 1.4142135623730950488; 1723 z *= 1.4142135623730950488;
@@ -1527,13 +1760,9 @@ floorlog10l (long double x)
1527static int 1760static int
1528floorlog10 (double x) 1761floorlog10 (double x)
1529{ 1762{
1530 int exp;
1531 double y;
1532 double z;
1533 double l;
1534
1535 /* Split into exponential part and mantissa. */ 1763 /* Split into exponential part and mantissa. */
1536 y = frexp (x, &exp); 1764 int exp;
1765 double y = frexp (x, &exp);
1537 if (!(y >= 0.0 && y < 1.0)) 1766 if (!(y >= 0.0 && y < 1.0))
1538 abort (); 1767 abort ();
1539 if (y == 0.0) 1768 if (y == 0.0)
@@ -1574,8 +1803,8 @@ floorlog10 (double x)
1574 if (!(y >= 0.5 && y < 1.0)) 1803 if (!(y >= 0.5 && y < 1.0))
1575 abort (); 1804 abort ();
1576 /* Compute an approximation for l = log2(x) = exp + log2(y). */ 1805 /* Compute an approximation for l = log2(x) = exp + log2(y). */
1577 l = exp; 1806 double l = exp;
1578 z = y; 1807 double z = y;
1579 if (z < 0.70710678118654752444) 1808 if (z < 0.70710678118654752444)
1580 { 1809 {
1581 z *= 1.4142135623730950488; 1810 z *= 1.4142135623730950488;
@@ -1801,8 +2030,17 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion,
1801 } 2030 }
1802 if (tmp_length < precision) 2031 if (tmp_length < precision)
1803 tmp_length = precision; 2032 tmp_length = precision;
1804 /* Multiply by 2, as an estimate for FLAG_GROUP. */ 2033 /* Account for thousands separators. */
1805 tmp_length = xsum (tmp_length, tmp_length); 2034 if (flags & FLAG_GROUP)
2035 {
2036 /* A thousands separator needs to be inserted at most every 2 digits.
2037 This is the case in the ta_IN locale. */
2038# if WIDE_CHAR_VERSION
2039 tmp_length = xsum (tmp_length, tmp_length / 2 * THOUSEP_WCHAR_MAXLEN);
2040# else
2041 tmp_length = xsum (tmp_length, tmp_length / 2 * THOUSEP_CHAR_MAXLEN);
2042# endif
2043 }
1806 /* Add 1, to account for a leading sign. */ 2044 /* Add 1, to account for a leading sign. */
1807 tmp_length = xsum (tmp_length, 1); 2045 tmp_length = xsum (tmp_length, 1);
1808 break; 2046 break;
@@ -2050,12 +2288,18 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion,
2050 tmp_length = xsum (tmp_length, 2); 2288 tmp_length = xsum (tmp_length, 2);
2051 break; 2289 break;
2052 2290
2291 case 'e': case 'E':
2292 tmp_length =
2293 12; /* sign, decimal point, exponent etc. */
2294 tmp_length = xsum (tmp_length, precision);
2295 break;
2296
2053 case 'f': case 'F': 2297 case 'f': case 'F':
2054 if (type == TYPE_LONGDOUBLE) 2298 if (type == TYPE_LONGDOUBLE)
2055 tmp_length = 2299 tmp_length =
2056 (unsigned int) (LDBL_MAX_EXP 2300 (unsigned int) (LDBL_MAX_EXP
2057 * 0.30103 /* binary -> decimal */ 2301 * 0.30103 /* binary -> decimal */
2058 * 2 /* estimate for FLAG_GROUP */ 2302 * 0.5 * 3 /* estimate for FLAG_GROUP */
2059 ) 2303 )
2060 + 1 /* turn floor into ceil */ 2304 + 1 /* turn floor into ceil */
2061 + 10; /* sign, decimal point etc. */ 2305 + 10; /* sign, decimal point etc. */
@@ -2063,17 +2307,20 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion,
2063 tmp_length = 2307 tmp_length =
2064 (unsigned int) (DBL_MAX_EXP 2308 (unsigned int) (DBL_MAX_EXP
2065 * 0.30103 /* binary -> decimal */ 2309 * 0.30103 /* binary -> decimal */
2066 * 2 /* estimate for FLAG_GROUP */ 2310 * 0.5 * 3 /* estimate for FLAG_GROUP */
2067 ) 2311 )
2068 + 1 /* turn floor into ceil */ 2312 + 1 /* turn floor into ceil */
2069 + 10; /* sign, decimal point etc. */ 2313 + 10; /* sign, decimal point etc. */
2070 tmp_length = xsum (tmp_length, precision); 2314 tmp_length = xsum (tmp_length, precision);
2071 break; 2315 break;
2072 2316
2073 case 'e': case 'E': case 'g': case 'G': 2317 case 'g': case 'G':
2074 tmp_length = 2318 tmp_length =
2075 12; /* sign, decimal point, exponent etc. */ 2319 12; /* sign, decimal point, exponent etc. */
2076 tmp_length = xsum (tmp_length, precision); 2320 tmp_length = xsum (tmp_length,
2321 precision
2322 * 0.5 * 3 /* estimate for FLAG_GROUP */
2323 );
2077 break; 2324 break;
2078 2325
2079 case 'a': case 'A': 2326 case 'a': case 'A':
@@ -2111,10 +2358,9 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion,
2111 break; 2358 break;
2112 2359
2113 case 's': 2360 case 's':
2114# if HAVE_WCHAR_T
2115 if (type == TYPE_WIDE_STRING) 2361 if (type == TYPE_WIDE_STRING)
2116 { 2362 {
2117# if WIDE_CHAR_VERSION 2363# if WIDE_CHAR_VERSION
2118 /* ISO C says about %ls in fwprintf: 2364 /* ISO C says about %ls in fwprintf:
2119 "If the precision is not specified or is greater than the size 2365 "If the precision is not specified or is greater than the size
2120 of the array, the array shall contain a null wide character." 2366 of the array, the array shall contain a null wide character."
@@ -2125,7 +2371,7 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion,
2125 tmp_length = local_wcsnlen (arg, precision); 2371 tmp_length = local_wcsnlen (arg, precision);
2126 else 2372 else
2127 tmp_length = local_wcslen (arg); 2373 tmp_length = local_wcslen (arg);
2128# else 2374# else
2129 /* ISO C says about %ls in fprintf: 2375 /* ISO C says about %ls in fprintf:
2130 "If a precision is specified, no more than that many bytes are 2376 "If a precision is specified, no more than that many bytes are
2131 written (including shift sequences, if any), and the array 2377 written (including shift sequences, if any), and the array
@@ -2136,10 +2382,9 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion,
2136 So if there is a precision, we must not use wcslen. */ 2382 So if there is a precision, we must not use wcslen. */
2137 /* This case has already been handled separately in VASNPRINTF. */ 2383 /* This case has already been handled separately in VASNPRINTF. */
2138 abort (); 2384 abort ();
2139# endif 2385# endif
2140 } 2386 }
2141 else 2387 else
2142# endif
2143 { 2388 {
2144# if WIDE_CHAR_VERSION 2389# if WIDE_CHAR_VERSION
2145 /* ISO C says about %s in fwprintf: 2390 /* ISO C says about %s in fwprintf:
@@ -2222,21 +2467,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2222 goto fail_1_with_EINVAL; 2467 goto fail_1_with_EINVAL;
2223 2468
2224 { 2469 {
2225 size_t buf_neededlength;
2226 TCHAR_T *buf;
2227 TCHAR_T *buf_malloced;
2228 const FCHAR_T *cp;
2229 size_t i;
2230 DIRECTIVE *dp;
2231 /* Output string accumulator. */
2232 DCHAR_T *result;
2233 size_t allocated;
2234 size_t length;
2235
2236 /* Allocate a small buffer that will hold a directive passed to 2470 /* Allocate a small buffer that will hold a directive passed to
2237 sprintf or snprintf. */ 2471 sprintf or snprintf. */
2238 buf_neededlength = 2472 size_t buf_neededlength =
2239 xsum4 (7, d.max_width_length, d.max_precision_length, 6); 2473 xsum4 (7, d.max_width_length, d.max_precision_length, 6);
2474 TCHAR_T *buf;
2475 TCHAR_T *buf_malloced;
2240#if HAVE_ALLOCA 2476#if HAVE_ALLOCA
2241 if (buf_neededlength < 4000 / sizeof (TCHAR_T)) 2477 if (buf_neededlength < 4000 / sizeof (TCHAR_T))
2242 { 2478 {
@@ -2255,9 +2491,11 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2255 buf_malloced = buf; 2491 buf_malloced = buf;
2256 } 2492 }
2257 2493
2258 result = resultbuf; 2494 /* Output string accumulator. */
2259 allocated = (resultbuf != NULL ? *lengthp : 0); 2495 DCHAR_T *result = resultbuf;
2260 length = 0; 2496 size_t allocated = (resultbuf != NULL ? *lengthp : 0);
2497 size_t length = 0;
2498
2261 /* Invariants: 2499 /* Invariants:
2262 result is either == resultbuf or malloc-allocated. 2500 result is either == resultbuf or malloc-allocated.
2263 If result == NULL, resultbuf is == NULL as well. 2501 If result == NULL, resultbuf is == NULL as well.
@@ -2268,15 +2506,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2268#define ENSURE_ALLOCATION_ELSE(needed, oom_statement) \ 2506#define ENSURE_ALLOCATION_ELSE(needed, oom_statement) \
2269 if ((needed) > allocated) \ 2507 if ((needed) > allocated) \
2270 { \ 2508 { \
2271 size_t memory_size; \
2272 DCHAR_T *memory; \
2273 \
2274 allocated = (allocated > 0 ? xtimes (allocated, 2) : 12); \ 2509 allocated = (allocated > 0 ? xtimes (allocated, 2) : 12); \
2275 if ((needed) > allocated) \ 2510 if ((needed) > allocated) \
2276 allocated = (needed); \ 2511 allocated = (needed); \
2277 memory_size = xtimes (allocated, sizeof (DCHAR_T)); \ 2512 size_t memory_size = xtimes (allocated, sizeof (DCHAR_T)); \
2278 if (size_overflow_p (memory_size)) \ 2513 if (size_overflow_p (memory_size)) \
2279 oom_statement \ 2514 oom_statement \
2515 DCHAR_T *memory; \
2280 if (result == resultbuf) \ 2516 if (result == resultbuf) \
2281 memory = (DCHAR_T *) malloc (memory_size); \ 2517 memory = (DCHAR_T *) malloc (memory_size); \
2282 else \ 2518 else \
@@ -2290,7 +2526,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2290#define ENSURE_ALLOCATION(needed) \ 2526#define ENSURE_ALLOCATION(needed) \
2291 ENSURE_ALLOCATION_ELSE((needed), goto out_of_memory; ) 2527 ENSURE_ALLOCATION_ELSE((needed), goto out_of_memory; )
2292 2528
2293 for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++) 2529 const FCHAR_T *cp;
2530 size_t di;
2531 DIRECTIVE *dp;
2532 for (cp = format, di = 0, dp = &d.dir[0]; ; cp = dp->dir_end, di++, dp++)
2294 { 2533 {
2295 if (cp != dp->dir_start) 2534 if (cp != dp->dir_start)
2296 { 2535 {
@@ -2313,7 +2552,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2313 while (--n > 0); 2552 while (--n > 0);
2314 } 2553 }
2315 } 2554 }
2316 if (i == d.count) 2555 if (di == d.count)
2317 break; 2556 break;
2318 2557
2319 /* Execute a single directive. */ 2558 /* Execute a single directive. */
@@ -2390,22 +2629,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2390 { 2629 {
2391 arg_type type = a.arg[dp->arg_index].type; 2630 arg_type type = a.arg[dp->arg_index].type;
2392 int flags = dp->flags; 2631 int flags = dp->flags;
2393 int has_width;
2394 size_t width;
2395 int has_precision;
2396 size_t precision;
2397 2632
2398 has_width = 0; 2633 int has_width = 0;
2399 width = 0; 2634 size_t width = 0;
2400 if (dp->width_start != dp->width_end) 2635 if (dp->width_start != dp->width_end)
2401 { 2636 {
2402 if (dp->width_arg_index != ARG_NONE) 2637 if (dp->width_arg_index != ARG_NONE)
2403 { 2638 {
2404 int arg;
2405
2406 if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) 2639 if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
2407 abort (); 2640 abort ();
2408 arg = a.arg[dp->width_arg_index].a.a_int; 2641 int arg = a.arg[dp->width_arg_index].a.a_int;
2409 width = arg; 2642 width = arg;
2410 if (arg < 0) 2643 if (arg < 0)
2411 { 2644 {
@@ -2423,20 +2656,20 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2423 width = xsum (xtimes (width, 10), *digitp++ - '0'); 2656 width = xsum (xtimes (width, 10), *digitp++ - '0');
2424 while (digitp != dp->width_end); 2657 while (digitp != dp->width_end);
2425 } 2658 }
2659 if (width > (size_t) INT_MAX)
2660 goto overflow;
2426 has_width = 1; 2661 has_width = 1;
2427 } 2662 }
2428 2663
2429 has_precision = 0; 2664 int has_precision = 0;
2430 precision = 0; 2665 size_t precision = 0;
2431 if (dp->precision_start != dp->precision_end) 2666 if (dp->precision_start != dp->precision_end)
2432 { 2667 {
2433 if (dp->precision_arg_index != ARG_NONE) 2668 if (dp->precision_arg_index != ARG_NONE)
2434 { 2669 {
2435 int arg;
2436
2437 if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) 2670 if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
2438 abort (); 2671 abort ();
2439 arg = a.arg[dp->precision_arg_index].a.a_int; 2672 int arg = a.arg[dp->precision_arg_index].a.a_int;
2440 /* "A negative precision is taken as if the precision 2673 /* "A negative precision is taken as if the precision
2441 were omitted." */ 2674 were omitted." */
2442 if (arg >= 0) 2675 if (arg >= 0)
@@ -2501,7 +2734,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2501 { 2734 {
2502 /* Use the entire string. */ 2735 /* Use the entire string. */
2503 arg_end = arg + u8_strlen (arg); 2736 arg_end = arg + u8_strlen (arg);
2504 /* The number of characters doesn't matter. */ 2737 /* The number of characters doesn't matter,
2738 because !has_width and therefore width==0. */
2505 characters = 0; 2739 characters = 0;
2506 } 2740 }
2507 2741
@@ -2542,7 +2776,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2542 if (converted != result + length) 2776 if (converted != result + length)
2543 { 2777 {
2544 ENSURE_ALLOCATION_ELSE (xsum (length, converted_len), 2778 ENSURE_ALLOCATION_ELSE (xsum (length, converted_len),
2545 { free (converted); goto out_of_memory; }); 2779 { free (converted); goto out_of_memory; });
2546 DCHAR_CPY (result + length, converted, converted_len); 2780 DCHAR_CPY (result + length, converted, converted_len);
2547 free (converted); 2781 free (converted);
2548 } 2782 }
@@ -2603,7 +2837,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2603 { 2837 {
2604 /* Use the entire string. */ 2838 /* Use the entire string. */
2605 arg_end = arg + u16_strlen (arg); 2839 arg_end = arg + u16_strlen (arg);
2606 /* The number of characters doesn't matter. */ 2840 /* The number of characters doesn't matter,
2841 because !has_width and therefore width==0. */
2607 characters = 0; 2842 characters = 0;
2608 } 2843 }
2609 2844
@@ -2644,7 +2879,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2644 if (converted != result + length) 2879 if (converted != result + length)
2645 { 2880 {
2646 ENSURE_ALLOCATION_ELSE (xsum (length, converted_len), 2881 ENSURE_ALLOCATION_ELSE (xsum (length, converted_len),
2647 { free (converted); goto out_of_memory; }); 2882 { free (converted); goto out_of_memory; });
2648 DCHAR_CPY (result + length, converted, converted_len); 2883 DCHAR_CPY (result + length, converted, converted_len);
2649 free (converted); 2884 free (converted);
2650 } 2885 }
@@ -2705,7 +2940,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2705 { 2940 {
2706 /* Use the entire string. */ 2941 /* Use the entire string. */
2707 arg_end = arg + u32_strlen (arg); 2942 arg_end = arg + u32_strlen (arg);
2708 /* The number of characters doesn't matter. */ 2943 /* The number of characters doesn't matter,
2944 because !has_width and therefore width==0. */
2709 characters = 0; 2945 characters = 0;
2710 } 2946 }
2711 2947
@@ -2746,7 +2982,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2746 if (converted != result + length) 2982 if (converted != result + length)
2747 { 2983 {
2748 ENSURE_ALLOCATION_ELSE (xsum (length, converted_len), 2984 ENSURE_ALLOCATION_ELSE (xsum (length, converted_len),
2749 { free (converted); goto out_of_memory; }); 2985 { free (converted); goto out_of_memory; });
2750 DCHAR_CPY (result + length, converted, converted_len); 2986 DCHAR_CPY (result + length, converted, converted_len);
2751 free (converted); 2987 free (converted);
2752 } 2988 }
@@ -2769,7 +3005,178 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2769 } 3005 }
2770 } 3006 }
2771#endif 3007#endif
2772#if WIDE_CHAR_VERSION && (!DCHAR_IS_TCHAR || NEED_WPRINTF_DIRECTIVE_LC) 3008#if !WIDE_CHAR_VERSION && (PTRDIFF_MAX > INT_MAX)
3009 else if (dp->conversion == 's'
3010 && a.arg[dp->arg_index].type != TYPE_WIDE_STRING)
3011 {
3012 /* %s in vasnprintf. See the specification of fprintf.
3013 We handle it ourselves here, because the string may be longer
3014 than INT_MAX characters, whence snprintf or sprintf would
3015 fail to process it. */
3016 int flags = dp->flags;
3017
3018 int has_width = 0;
3019 size_t width = 0;
3020 if (dp->width_start != dp->width_end)
3021 {
3022 if (dp->width_arg_index != ARG_NONE)
3023 {
3024 if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
3025 abort ();
3026 int arg = a.arg[dp->width_arg_index].a.a_int;
3027 width = arg;
3028 if (arg < 0)
3029 {
3030 /* "A negative field width is taken as a '-' flag
3031 followed by a positive field width." */
3032 flags |= FLAG_LEFT;
3033 width = -width;
3034 }
3035 }
3036 else
3037 {
3038 const FCHAR_T *digitp = dp->width_start;
3039
3040 do
3041 width = xsum (xtimes (width, 10), *digitp++ - '0');
3042 while (digitp != dp->width_end);
3043 }
3044 if (width > (size_t) INT_MAX)
3045 goto overflow;
3046 has_width = 1;
3047 }
3048
3049 int has_precision = 0;
3050 size_t precision = 6;
3051 if (dp->precision_start != dp->precision_end)
3052 {
3053 if (dp->precision_arg_index != ARG_NONE)
3054 {
3055 if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
3056 abort ();
3057 int arg = a.arg[dp->precision_arg_index].a.a_int;
3058 /* "A negative precision is taken as if the precision
3059 were omitted." */
3060 if (arg >= 0)
3061 {
3062 precision = arg;
3063 has_precision = 1;
3064 }
3065 }
3066 else
3067 {
3068 const FCHAR_T *digitp = dp->precision_start + 1;
3069
3070 precision = 0;
3071 while (digitp != dp->precision_end)
3072 precision = xsum (xtimes (precision, 10), *digitp++ - '0');
3073 has_precision = 1;
3074 }
3075 }
3076
3077 {
3078 const char *arg = a.arg[dp->arg_index].a.a_string;
3079
3080 size_t bytes;
3081 if (has_precision)
3082 {
3083 /* Use only at most PRECISION bytes, from the left. */
3084 bytes = local_strnlen (arg, precision);
3085 }
3086 else
3087 {
3088 /* Use the entire string, and count the number of
3089 bytes. */
3090 bytes = strlen (arg);
3091 }
3092
3093# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
3094 size_t characters;
3095 if (has_width)
3096 characters = mbsnlen (arg, bytes);
3097 else
3098 {
3099 /* The number of characters doesn't matter,
3100 because !has_width and therefore width==0. */
3101 characters = 0;
3102 }
3103# endif
3104
3105# if !DCHAR_IS_TCHAR
3106 /* This code assumes that TCHAR_T is 'char'. */
3107 static_assert (sizeof (TCHAR_T) == 1);
3108 DCHAR_T *tmpdst;
3109 size_t tmpdst_len;
3110 /* Convert from TCHAR_T[] to DCHAR_T[]. */
3111 tmpdst =
3112 DCHAR_CONV_FROM_ENCODING (locale_charset (),
3113 iconveh_question_mark,
3114 arg, bytes,
3115 NULL,
3116 NULL, &tmpdst_len);
3117 if (tmpdst == NULL)
3118 goto fail_with_errno;
3119# endif
3120
3121 size_t w;
3122 if (has_width)
3123 {
3124# if ENABLE_UNISTDIO
3125 /* Outside POSIX, it's preferable to compare the width
3126 against the number of _characters_ of the converted
3127 value. */
3128# if DCHAR_IS_TCHAR
3129 w = characters;
3130# else
3131 w = DCHAR_MBSNLEN (tmpdst, tmpdst_len);
3132# endif
3133# else
3134 /* The width is compared against the number of _bytes_
3135 of the converted value, says POSIX. */
3136 w = bytes;
3137# endif
3138 }
3139 else
3140 /* w doesn't matter. */
3141 w = 0;
3142
3143 {
3144# if DCHAR_IS_TCHAR
3145 size_t total = bytes + (w < width ? width - w : 0);
3146 ENSURE_ALLOCATION (xsum (length, total));
3147# else
3148 size_t total = tmpdst_len + (w < width ? width - w : 0);
3149 ENSURE_ALLOCATION_ELSE (xsum (length, total),
3150 { free (tmpdst); goto out_of_memory; });
3151# endif
3152
3153 if (w < width && !(flags & FLAG_LEFT))
3154 {
3155 size_t n = width - w;
3156 DCHAR_SET (result + length, ' ', n);
3157 length += n;
3158 }
3159
3160# if DCHAR_IS_TCHAR
3161 memcpy (result + length, arg, bytes);
3162 length += bytes;
3163# else
3164 DCHAR_CPY (result + length, tmpdst, tmpdst_len);
3165 free (tmpdst);
3166 length += tmpdst_len;
3167# endif
3168
3169 if (w < width && (flags & FLAG_LEFT))
3170 {
3171 size_t n = width - w;
3172 DCHAR_SET (result + length, ' ', n);
3173 length += n;
3174 }
3175 }
3176 }
3177 }
3178#endif
3179#if WIDE_CHAR_VERSION && ((PTRDIFF_MAX > INT_MAX) || !DCHAR_IS_TCHAR || NEED_WPRINTF_DIRECTIVE_LC)
2773 else if ((dp->conversion == 's' 3180 else if ((dp->conversion == 's'
2774 && a.arg[dp->arg_index].type == TYPE_WIDE_STRING) 3181 && a.arg[dp->arg_index].type == TYPE_WIDE_STRING)
2775 || (dp->conversion == 'c' 3182 || (dp->conversion == 'c'
@@ -2781,18 +3188,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2781 convert back the result from a char[] to a wchar_t[]. 3188 convert back the result from a char[] to a wchar_t[].
2782 Instead, just copy the argument wchar_t[] to the result. */ 3189 Instead, just copy the argument wchar_t[] to the result. */
2783 int flags = dp->flags; 3190 int flags = dp->flags;
2784 size_t width;
2785 3191
2786 width = 0; 3192 size_t width = 0;
2787 if (dp->width_start != dp->width_end) 3193 if (dp->width_start != dp->width_end)
2788 { 3194 {
2789 if (dp->width_arg_index != ARG_NONE) 3195 if (dp->width_arg_index != ARG_NONE)
2790 { 3196 {
2791 int arg;
2792
2793 if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) 3197 if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
2794 abort (); 3198 abort ();
2795 arg = a.arg[dp->width_arg_index].a.a_int; 3199 int arg = a.arg[dp->width_arg_index].a.a_int;
2796 width = arg; 3200 width = arg;
2797 if (arg < 0) 3201 if (arg < 0)
2798 { 3202 {
@@ -2810,6 +3214,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2810 width = xsum (xtimes (width, 10), *digitp++ - '0'); 3214 width = xsum (xtimes (width, 10), *digitp++ - '0');
2811 while (digitp != dp->width_end); 3215 while (digitp != dp->width_end);
2812 } 3216 }
3217 if (width > (size_t) INT_MAX)
3218 goto overflow;
2813 } 3219 }
2814 3220
2815 { 3221 {
@@ -2819,20 +3225,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2819 3225
2820 if (dp->conversion == 's') 3226 if (dp->conversion == 's')
2821 { 3227 {
2822 int has_precision; 3228 int has_precision = 0;
2823 size_t precision; 3229 size_t precision = 6;
2824
2825 has_precision = 0;
2826 precision = 6;
2827 if (dp->precision_start != dp->precision_end) 3230 if (dp->precision_start != dp->precision_end)
2828 { 3231 {
2829 if (dp->precision_arg_index != ARG_NONE) 3232 if (dp->precision_arg_index != ARG_NONE)
2830 { 3233 {
2831 int arg;
2832
2833 if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) 3234 if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
2834 abort (); 3235 abort ();
2835 arg = a.arg[dp->precision_arg_index].a.a_int; 3236 int arg = a.arg[dp->precision_arg_index].a.a_int;
2836 /* "A negative precision is taken as if the precision 3237 /* "A negative precision is taken as if the precision
2837 were omitted." */ 3238 were omitted." */
2838 if (arg >= 0) 3239 if (arg >= 0)
@@ -2858,9 +3259,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2858 { 3259 {
2859 /* Use only at most PRECISION wide characters, from 3260 /* Use only at most PRECISION wide characters, from
2860 the left. */ 3261 the left. */
2861 const wchar_t *ls_arg_end; 3262 const wchar_t *ls_arg_end = ls_arg;
2862
2863 ls_arg_end = ls_arg;
2864 characters = 0; 3263 characters = 0;
2865 for (; precision > 0; precision--) 3264 for (; precision > 0; precision--)
2866 { 3265 {
@@ -2912,7 +3311,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2912 } 3311 }
2913 } 3312 }
2914#endif 3313#endif
2915#if (!USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS || ENABLE_WCHAR_FALLBACK) && HAVE_WCHAR_T 3314#if WIDE_CHAR_VERSION || !USE_SNPRINTF || (PTRDIFF_MAX > INT_MAX) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS || ENABLE_WCHAR_FALLBACK
2916 else if (dp->conversion == 's' 3315 else if (dp->conversion == 's'
2917# if WIDE_CHAR_VERSION 3316# if WIDE_CHAR_VERSION
2918 && a.arg[dp->arg_index].type != TYPE_WIDE_STRING 3317 && a.arg[dp->arg_index].type != TYPE_WIDE_STRING
@@ -2932,22 +3331,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2932 such bugs, we implement the entire processing of the 's' 3331 such bugs, we implement the entire processing of the 's'
2933 directive ourselves. */ 3332 directive ourselves. */
2934 int flags = dp->flags; 3333 int flags = dp->flags;
2935 int has_width;
2936 size_t width;
2937 int has_precision;
2938 size_t precision;
2939 3334
2940 has_width = 0; 3335 int has_width = 0;
2941 width = 0; 3336 size_t width = 0;
2942 if (dp->width_start != dp->width_end) 3337 if (dp->width_start != dp->width_end)
2943 { 3338 {
2944 if (dp->width_arg_index != ARG_NONE) 3339 if (dp->width_arg_index != ARG_NONE)
2945 { 3340 {
2946 int arg;
2947
2948 if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) 3341 if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
2949 abort (); 3342 abort ();
2950 arg = a.arg[dp->width_arg_index].a.a_int; 3343 int arg = a.arg[dp->width_arg_index].a.a_int;
2951 width = arg; 3344 width = arg;
2952 if (arg < 0) 3345 if (arg < 0)
2953 { 3346 {
@@ -2965,20 +3358,20 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2965 width = xsum (xtimes (width, 10), *digitp++ - '0'); 3358 width = xsum (xtimes (width, 10), *digitp++ - '0');
2966 while (digitp != dp->width_end); 3359 while (digitp != dp->width_end);
2967 } 3360 }
3361 if (width > (size_t) INT_MAX)
3362 goto overflow;
2968 has_width = 1; 3363 has_width = 1;
2969 } 3364 }
2970 3365
2971 has_precision = 0; 3366 int has_precision = 0;
2972 precision = 6; 3367 size_t precision = 6;
2973 if (dp->precision_start != dp->precision_end) 3368 if (dp->precision_start != dp->precision_end)
2974 { 3369 {
2975 if (dp->precision_arg_index != ARG_NONE) 3370 if (dp->precision_arg_index != ARG_NONE)
2976 { 3371 {
2977 int arg;
2978
2979 if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) 3372 if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
2980 abort (); 3373 abort ();
2981 arg = a.arg[dp->precision_arg_index].a.a_int; 3374 int arg = a.arg[dp->precision_arg_index].a.a_int;
2982 /* "A negative precision is taken as if the precision 3375 /* "A negative precision is taken as if the precision
2983 were omitted." */ 3376 were omitted." */
2984 if (arg >= 0) 3377 if (arg >= 0)
@@ -3080,13 +3473,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3080 if (has_precision || has_width) 3473 if (has_precision || has_width)
3081 { 3474 {
3082 /* We know the number of wide characters in advance. */ 3475 /* We know the number of wide characters in advance. */
3083 size_t remaining;
3084# if HAVE_MBRTOWC 3476# if HAVE_MBRTOWC
3085 mbstate_t state; 3477 mbstate_t state;
3086 mbszero (&state); 3478 mbszero (&state);
3087# endif 3479# endif
3088 ENSURE_ALLOCATION (xsum (length, characters)); 3480 ENSURE_ALLOCATION (xsum (length, characters));
3089 for (remaining = characters; remaining > 0; remaining--) 3481 for (size_t remaining = characters; remaining > 0; remaining--)
3090 { 3482 {
3091 wchar_t wc; 3483 wchar_t wc;
3092 int count; 3484 int count;
@@ -3145,11 +3537,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3145 { 3537 {
3146 const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string; 3538 const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
3147 const wchar_t *arg_end; 3539 const wchar_t *arg_end;
3540 size_t bytes;
3541# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
3148 size_t characters; 3542 size_t characters;
3543# endif
3149# if !DCHAR_IS_TCHAR 3544# if !DCHAR_IS_TCHAR
3150 /* This code assumes that TCHAR_T is 'char'. */ 3545 /* This code assumes that TCHAR_T is 'char'. */
3151 static_assert (sizeof (TCHAR_T) == 1); 3546 static_assert (sizeof (TCHAR_T) == 1);
3152 TCHAR_T *tmpsrc;
3153 DCHAR_T *tmpdst; 3547 DCHAR_T *tmpdst;
3154 size_t tmpdst_len; 3548 size_t tmpdst_len;
3155# endif 3549# endif
@@ -3164,23 +3558,27 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3164 mbszero (&state); 3558 mbszero (&state);
3165# endif 3559# endif
3166 arg_end = arg; 3560 arg_end = arg;
3561 bytes = 0;
3562# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
3167 characters = 0; 3563 characters = 0;
3564# endif
3168 while (precision > 0) 3565 while (precision > 0)
3169 { 3566 {
3170 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
3171 int count;
3172
3173 if (*arg_end == 0) 3567 if (*arg_end == 0)
3174 /* Found the terminating null wide character. */ 3568 /* Found the terminating null wide character. */
3175 break; 3569 break;
3176 count = local_wcrtomb (cbuf, *arg_end, &state); 3570 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
3571 int count = local_wcrtomb (cbuf, *arg_end, &state);
3177 if (count < 0) 3572 if (count < 0)
3178 /* Cannot convert. */ 3573 /* Cannot convert. */
3179 goto fail_with_EILSEQ; 3574 goto fail_with_EILSEQ;
3180 if (precision < (unsigned int) count) 3575 if (precision < (unsigned int) count)
3181 break; 3576 break;
3182 arg_end++; 3577 arg_end++;
3183 characters += count; 3578 bytes += count;
3579# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
3580 characters += mbsnlen (cbuf, count);
3581# endif
3184 precision -= count; 3582 precision -= count;
3185 } 3583 }
3186 } 3584 }
@@ -3197,21 +3595,25 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3197 mbszero (&state); 3595 mbszero (&state);
3198# endif 3596# endif
3199 arg_end = arg; 3597 arg_end = arg;
3598 bytes = 0;
3599# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
3200 characters = 0; 3600 characters = 0;
3601# endif
3201 for (;;) 3602 for (;;)
3202 { 3603 {
3203 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
3204 int count;
3205
3206 if (*arg_end == 0) 3604 if (*arg_end == 0)
3207 /* Found the terminating null wide character. */ 3605 /* Found the terminating null wide character. */
3208 break; 3606 break;
3209 count = local_wcrtomb (cbuf, *arg_end, &state); 3607 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
3608 int count = local_wcrtomb (cbuf, *arg_end, &state);
3210 if (count < 0) 3609 if (count < 0)
3211 /* Cannot convert. */ 3610 /* Cannot convert. */
3212 goto fail_with_EILSEQ; 3611 goto fail_with_EILSEQ;
3213 arg_end++; 3612 arg_end++;
3214 characters += count; 3613 bytes += count;
3614# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
3615 characters += mbsnlen (cbuf, count);
3616# endif
3215 } 3617 }
3216 } 3618 }
3217# if DCHAR_IS_TCHAR 3619# if DCHAR_IS_TCHAR
@@ -3219,56 +3621,59 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3219 { 3621 {
3220 /* Use the entire string. */ 3622 /* Use the entire string. */
3221 arg_end = arg + local_wcslen (arg); 3623 arg_end = arg + local_wcslen (arg);
3222 /* The number of bytes doesn't matter. */ 3624 /* The number of bytes and characters doesn't matter,
3625 because !has_width and therefore width==0. */
3626 bytes = 0;
3627# if ENABLE_UNISTDIO
3223 characters = 0; 3628 characters = 0;
3629# endif
3224 } 3630 }
3225# endif 3631# endif
3226 3632
3227# if !DCHAR_IS_TCHAR 3633# if !DCHAR_IS_TCHAR
3228 /* Convert the string into a piece of temporary memory. */
3229 tmpsrc = (TCHAR_T *) malloc (characters * sizeof (TCHAR_T));
3230 if (tmpsrc == NULL)
3231 goto out_of_memory;
3232 { 3634 {
3233 TCHAR_T *tmpptr = tmpsrc; 3635 /* Convert the string into a piece of temporary memory. */
3234 size_t remaining; 3636 TCHAR_T *tmpsrc = (TCHAR_T *) malloc (bytes * sizeof (TCHAR_T));
3637 if (tmpsrc == NULL)
3638 goto out_of_memory;
3639 {
3640 TCHAR_T *tmpptr = tmpsrc;
3235# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t 3641# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
3236 mbstate_t state; 3642 mbstate_t state;
3237 mbszero (&state); 3643 mbszero (&state);
3238# endif 3644# endif
3239 for (remaining = characters; remaining > 0; ) 3645 for (size_t remaining = bytes; remaining > 0; )
3240 { 3646 {
3241 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ 3647 if (*arg == 0)
3242 int count; 3648 abort ();
3649 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
3650 int count = local_wcrtomb (cbuf, *arg, &state);
3651 if (count <= 0)
3652 /* Inconsistency. */
3653 abort ();
3654 memcpy (tmpptr, cbuf, count);
3655 tmpptr += count;
3656 arg++;
3657 remaining -= count;
3658 }
3659 if (!(arg == arg_end))
3660 abort ();
3661 }
3243 3662
3244 if (*arg == 0) 3663 /* Convert from TCHAR_T[] to DCHAR_T[]. */
3245 abort (); 3664 tmpdst =
3246 count = local_wcrtomb (cbuf, *arg, &state); 3665 DCHAR_CONV_FROM_ENCODING (locale_charset (),
3247 if (count <= 0) 3666 iconveh_question_mark,
3248 /* Inconsistency. */ 3667 tmpsrc, bytes,
3249 abort (); 3668 NULL,
3250 memcpy (tmpptr, cbuf, count); 3669 NULL, &tmpdst_len);
3251 tmpptr += count; 3670 if (tmpdst == NULL)
3252 arg++; 3671 {
3253 remaining -= count; 3672 free (tmpsrc);
3673 goto fail_with_errno;
3254 } 3674 }
3255 if (!(arg == arg_end)) 3675 free (tmpsrc);
3256 abort ();
3257 } 3676 }
3258
3259 /* Convert from TCHAR_T[] to DCHAR_T[]. */
3260 tmpdst =
3261 DCHAR_CONV_FROM_ENCODING (locale_charset (),
3262 iconveh_question_mark,
3263 tmpsrc, characters,
3264 NULL,
3265 NULL, &tmpdst_len);
3266 if (tmpdst == NULL)
3267 {
3268 free (tmpsrc);
3269 goto fail_with_errno;
3270 }
3271 free (tmpsrc);
3272# endif 3677# endif
3273 3678
3274 if (has_width) 3679 if (has_width)
@@ -3277,11 +3682,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3277 /* Outside POSIX, it's preferable to compare the width 3682 /* Outside POSIX, it's preferable to compare the width
3278 against the number of _characters_ of the converted 3683 against the number of _characters_ of the converted
3279 value. */ 3684 value. */
3280 w = DCHAR_MBSNLEN (result + length, characters); 3685# if DCHAR_IS_TCHAR
3686 w = characters;
3687# else
3688 w = DCHAR_MBSNLEN (tmpdst, tmpdst_len);
3689# endif
3281# else 3690# else
3282 /* The width is compared against the number of _bytes_ 3691 /* The width is compared against the number of _bytes_
3283 of the converted value, says POSIX. */ 3692 of the converted value, says POSIX. */
3284 w = characters; 3693 w = bytes;
3285# endif 3694# endif
3286 } 3695 }
3287 else 3696 else
@@ -3291,7 +3700,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3291 if (w < width && !(flags & FLAG_LEFT)) 3700 if (w < width && !(flags & FLAG_LEFT))
3292 { 3701 {
3293 size_t n = width - w; 3702 size_t n = width - w;
3703# if DCHAR_IS_TCHAR
3294 ENSURE_ALLOCATION (xsum (length, n)); 3704 ENSURE_ALLOCATION (xsum (length, n));
3705# else
3706 ENSURE_ALLOCATION_ELSE (xsum (length, n),
3707 { free (tmpdst); goto out_of_memory; });
3708# endif
3295 DCHAR_SET (result + length, ' ', n); 3709 DCHAR_SET (result + length, ' ', n);
3296 length += n; 3710 length += n;
3297 } 3711 }
@@ -3300,20 +3714,17 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3300 if (has_precision || has_width) 3714 if (has_precision || has_width)
3301 { 3715 {
3302 /* We know the number of bytes in advance. */ 3716 /* We know the number of bytes in advance. */
3303 size_t remaining;
3304# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t 3717# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
3305 mbstate_t state; 3718 mbstate_t state;
3306 mbszero (&state); 3719 mbszero (&state);
3307# endif 3720# endif
3308 ENSURE_ALLOCATION (xsum (length, characters)); 3721 ENSURE_ALLOCATION (xsum (length, bytes));
3309 for (remaining = characters; remaining > 0; ) 3722 for (size_t remaining = bytes; remaining > 0; )
3310 { 3723 {
3311 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
3312 int count;
3313
3314 if (*arg == 0) 3724 if (*arg == 0)
3315 abort (); 3725 abort ();
3316 count = local_wcrtomb (cbuf, *arg, &state); 3726 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
3727 int count = local_wcrtomb (cbuf, *arg, &state);
3317 if (count <= 0) 3728 if (count <= 0)
3318 /* Inconsistency. */ 3729 /* Inconsistency. */
3319 abort (); 3730 abort ();
@@ -3333,12 +3744,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3333# endif 3744# endif
3334 while (arg < arg_end) 3745 while (arg < arg_end)
3335 { 3746 {
3336 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
3337 int count;
3338
3339 if (*arg == 0) 3747 if (*arg == 0)
3340 abort (); 3748 abort ();
3341 count = local_wcrtomb (cbuf, *arg, &state); 3749 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
3750 int count = local_wcrtomb (cbuf, *arg, &state);
3342 if (count <= 0) 3751 if (count <= 0)
3343 /* Cannot convert. */ 3752 /* Cannot convert. */
3344 goto fail_with_EILSEQ; 3753 goto fail_with_EILSEQ;
@@ -3350,7 +3759,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3350 } 3759 }
3351# else 3760# else
3352 ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len), 3761 ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len),
3353 { free (tmpdst); goto out_of_memory; }); 3762 { free (tmpdst); goto out_of_memory; });
3354 DCHAR_CPY (result + length, tmpdst, tmpdst_len); 3763 DCHAR_CPY (result + length, tmpdst, tmpdst_len);
3355 free (tmpdst); 3764 free (tmpdst);
3356 length += tmpdst_len; 3765 length += tmpdst_len;
@@ -3375,20 +3784,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3375 a correct behaviour for the null wint_t argument and/or the 3784 a correct behaviour for the null wint_t argument and/or the
3376 fallback that avoids EILSEQ. */ 3785 fallback that avoids EILSEQ. */
3377 int flags = dp->flags; 3786 int flags = dp->flags;
3378 int has_width;
3379 size_t width;
3380 3787
3381 has_width = 0; 3788 int has_width = 0;
3382 width = 0; 3789 size_t width = 0;
3383 if (dp->width_start != dp->width_end) 3790 if (dp->width_start != dp->width_end)
3384 { 3791 {
3385 if (dp->width_arg_index != ARG_NONE) 3792 if (dp->width_arg_index != ARG_NONE)
3386 { 3793 {
3387 int arg;
3388
3389 if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) 3794 if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
3390 abort (); 3795 abort ();
3391 arg = a.arg[dp->width_arg_index].a.a_int; 3796 int arg = a.arg[dp->width_arg_index].a.a_int;
3392 width = arg; 3797 width = arg;
3393 if (arg < 0) 3798 if (arg < 0)
3394 { 3799 {
@@ -3406,17 +3811,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3406 width = xsum (xtimes (width, 10), *digitp++ - '0'); 3811 width = xsum (xtimes (width, 10), *digitp++ - '0');
3407 while (digitp != dp->width_end); 3812 while (digitp != dp->width_end);
3408 } 3813 }
3814 if (width > (size_t) INT_MAX)
3815 goto overflow;
3409 has_width = 1; 3816 has_width = 1;
3410 } 3817 }
3411 3818
3412 /* %lc in vasnprintf. See the specification of fprintf. */ 3819 /* %lc in vasnprintf. See the specification of fprintf. */
3413 { 3820 {
3414 wchar_t arg = (wchar_t) a.arg[dp->arg_index].a.a_wide_char; 3821 wchar_t arg = (wchar_t) a.arg[dp->arg_index].a.a_wide_char;
3822 size_t bytes;
3823# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
3415 size_t characters; 3824 size_t characters;
3825# endif
3416# if !DCHAR_IS_TCHAR 3826# if !DCHAR_IS_TCHAR
3417 /* This code assumes that TCHAR_T is 'char'. */ 3827 /* This code assumes that TCHAR_T is 'char'. */
3418 static_assert (sizeof (TCHAR_T) == 1); 3828 static_assert (sizeof (TCHAR_T) == 1);
3419 TCHAR_T tmpsrc[64]; /* Assume MB_CUR_MAX <= 64. */
3420 DCHAR_T *tmpdst; 3829 DCHAR_T *tmpdst;
3421 size_t tmpdst_len; 3830 size_t tmpdst_len;
3422# endif 3831# endif
@@ -3427,55 +3836,63 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3427# endif 3836# endif
3428 { 3837 {
3429 /* Count the number of bytes. */ 3838 /* Count the number of bytes. */
3430 characters = 0;
3431 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
3432 int count;
3433# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t 3839# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
3434 mbstate_t state; 3840 mbstate_t state;
3435 mbszero (&state); 3841 mbszero (&state);
3436# endif 3842# endif
3437 3843
3438 count = local_wcrtomb (cbuf, arg, &state); 3844 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
3845 int count = local_wcrtomb (cbuf, arg, &state);
3439 if (count < 0) 3846 if (count < 0)
3440 /* Cannot convert. */ 3847 /* Cannot convert. */
3441 goto fail_with_EILSEQ; 3848 goto fail_with_EILSEQ;
3442 characters = count; 3849 bytes = count;
3850# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
3851 characters = mbsnlen (cbuf, count);
3852# endif
3443 } 3853 }
3444# if DCHAR_IS_TCHAR 3854# if DCHAR_IS_TCHAR
3445 else 3855 else
3446 { 3856 {
3447 /* The number of bytes doesn't matter. */ 3857 /* The number of bytes and characters doesn't matter,
3858 because !has_width and therefore width==0. */
3859 bytes = 0;
3860# if ENABLE_UNISTDIO
3448 characters = 0; 3861 characters = 0;
3862# endif
3449 } 3863 }
3450# endif 3864# endif
3451 3865
3452# if !DCHAR_IS_TCHAR 3866# if !DCHAR_IS_TCHAR
3453 /* Convert the string into a piece of temporary memory. */ 3867 {
3454 if (characters > 0) 3868 TCHAR_T tmpsrc[64]; /* Assume MB_CUR_MAX <= 64. */
3455 { 3869
3456 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ 3870 /* Convert the string into a piece of temporary memory. */
3457 int count; 3871 if (bytes > 0)
3872 {
3458# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t 3873# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
3459 mbstate_t state; 3874 mbstate_t state;
3460 mbszero (&state); 3875 mbszero (&state);
3461# endif 3876# endif
3462 3877
3463 count = local_wcrtomb (cbuf, arg, &state); 3878 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
3464 if (count <= 0) 3879 int count = local_wcrtomb (cbuf, arg, &state);
3465 /* Inconsistency. */ 3880 if (count <= 0)
3466 abort (); 3881 /* Inconsistency. */
3467 memcpy (tmpsrc, cbuf, count); 3882 abort ();
3468 } 3883 memcpy (tmpsrc, cbuf, count);
3884 }
3469 3885
3470 /* Convert from TCHAR_T[] to DCHAR_T[]. */ 3886 /* Convert from TCHAR_T[] to DCHAR_T[]. */
3471 tmpdst = 3887 tmpdst =
3472 DCHAR_CONV_FROM_ENCODING (locale_charset (), 3888 DCHAR_CONV_FROM_ENCODING (locale_charset (),
3473 iconveh_question_mark, 3889 iconveh_question_mark,
3474 tmpsrc, characters, 3890 tmpsrc, bytes,
3475 NULL, 3891 NULL,
3476 NULL, &tmpdst_len); 3892 NULL, &tmpdst_len);
3477 if (tmpdst == NULL) 3893 if (tmpdst == NULL)
3478 goto fail_with_errno; 3894 goto fail_with_errno;
3895 }
3479# endif 3896# endif
3480 3897
3481 if (has_width) 3898 if (has_width)
@@ -3484,11 +3901,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3484 /* Outside POSIX, it's preferable to compare the width 3901 /* Outside POSIX, it's preferable to compare the width
3485 against the number of _characters_ of the converted 3902 against the number of _characters_ of the converted
3486 value. */ 3903 value. */
3487 w = DCHAR_MBSNLEN (result + length, characters); 3904# if DCHAR_IS_TCHAR
3905 w = characters;
3906# else
3907 w = DCHAR_MBSNLEN (tmpdst, tmpdst_len);
3908# endif
3488# else 3909# else
3489 /* The width is compared against the number of _bytes_ 3910 /* The width is compared against the number of _bytes_
3490 of the converted value, says POSIX. */ 3911 of the converted value, says POSIX. */
3491 w = characters; 3912 w = bytes;
3492# endif 3913# endif
3493 } 3914 }
3494 else 3915 else
@@ -3498,7 +3919,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3498 if (w < width && !(flags & FLAG_LEFT)) 3919 if (w < width && !(flags & FLAG_LEFT))
3499 { 3920 {
3500 size_t n = width - w; 3921 size_t n = width - w;
3922# if DCHAR_IS_TCHAR
3501 ENSURE_ALLOCATION (xsum (length, n)); 3923 ENSURE_ALLOCATION (xsum (length, n));
3924# else
3925 ENSURE_ALLOCATION_ELSE (xsum (length, n),
3926 { free (tmpdst); goto out_of_memory; });
3927# endif
3502 DCHAR_SET (result + length, ' ', n); 3928 DCHAR_SET (result + length, ' ', n);
3503 length += n; 3929 length += n;
3504 } 3930 }
@@ -3507,16 +3933,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3507 if (has_width) 3933 if (has_width)
3508 { 3934 {
3509 /* We know the number of bytes in advance. */ 3935 /* We know the number of bytes in advance. */
3510 ENSURE_ALLOCATION (xsum (length, characters)); 3936 ENSURE_ALLOCATION (xsum (length, bytes));
3511 if (characters > 0) 3937 if (bytes > 0)
3512 { 3938 {
3513 int count;
3514# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t 3939# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
3515 mbstate_t state; 3940 mbstate_t state;
3516 mbszero (&state); 3941 mbszero (&state);
3517# endif 3942# endif
3518 3943
3519 count = local_wcrtomb (result + length, arg, &state); 3944 int count = local_wcrtomb (result + length, arg, &state);
3520 if (count <= 0) 3945 if (count <= 0)
3521 /* Inconsistency. */ 3946 /* Inconsistency. */
3522 abort (); 3947 abort ();
@@ -3525,14 +3950,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3525 } 3950 }
3526 else 3951 else
3527 { 3952 {
3528 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
3529 int count;
3530# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t 3953# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
3531 mbstate_t state; 3954 mbstate_t state;
3532 mbszero (&state); 3955 mbszero (&state);
3533# endif 3956# endif
3534 3957
3535 count = local_wcrtomb (cbuf, arg, &state); 3958 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
3959 int count = local_wcrtomb (cbuf, arg, &state);
3536 if (count < 0) 3960 if (count < 0)
3537 /* Cannot convert. */ 3961 /* Cannot convert. */
3538 goto fail_with_EILSEQ; 3962 goto fail_with_EILSEQ;
@@ -3542,7 +3966,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3542 } 3966 }
3543# else 3967# else
3544 ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len), 3968 ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len),
3545 { free (tmpdst); goto out_of_memory; }); 3969 { free (tmpdst); goto out_of_memory; });
3546 DCHAR_CPY (result + length, tmpdst, tmpdst_len); 3970 DCHAR_CPY (result + length, tmpdst, tmpdst_len);
3547 free (tmpdst); 3971 free (tmpdst);
3548 length += tmpdst_len; 3972 length += tmpdst_len;
@@ -3565,18 +3989,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3565 /* Implement the 'c' directive ourselves, in order to avoid 3989 /* Implement the 'c' directive ourselves, in order to avoid
3566 EILSEQ in the "C" locale. */ 3990 EILSEQ in the "C" locale. */
3567 int flags = dp->flags; 3991 int flags = dp->flags;
3568 size_t width;
3569 3992
3570 width = 0; 3993 size_t width = 0;
3571 if (dp->width_start != dp->width_end) 3994 if (dp->width_start != dp->width_end)
3572 { 3995 {
3573 if (dp->width_arg_index != ARG_NONE) 3996 if (dp->width_arg_index != ARG_NONE)
3574 { 3997 {
3575 int arg;
3576
3577 if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) 3998 if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
3578 abort (); 3999 abort ();
3579 arg = a.arg[dp->width_arg_index].a.a_int; 4000 int arg = a.arg[dp->width_arg_index].a.a_int;
3580 width = arg; 4001 width = arg;
3581 if (arg < 0) 4002 if (arg < 0)
3582 { 4003 {
@@ -3594,38 +4015,42 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3594 width = xsum (xtimes (width, 10), *digitp++ - '0'); 4015 width = xsum (xtimes (width, 10), *digitp++ - '0');
3595 while (digitp != dp->width_end); 4016 while (digitp != dp->width_end);
3596 } 4017 }
4018 if (width > (size_t) INT_MAX)
4019 goto overflow;
3597 } 4020 }
3598 4021
3599 /* %c in vasnwprintf. See the specification of fwprintf. */ 4022 /* %c in vasnwprintf. See the specification of fwprintf. */
3600 { 4023 {
3601 char arg = (char) a.arg[dp->arg_index].a.a_char; 4024 char arg = (char) a.arg[dp->arg_index].a.a_char;
3602 mbstate_t state; 4025 mbstate_t state;
3603 wchar_t wc;
3604
3605 mbszero (&state); 4026 mbszero (&state);
4027
4028 wchar_t wc;
3606 int count = mbrtowc (&wc, &arg, 1, &state); 4029 int count = mbrtowc (&wc, &arg, 1, &state);
3607 if (count < 0) 4030 if (count < 0)
3608 /* Invalid or incomplete multibyte character. */ 4031 /* Invalid or incomplete multibyte character. */
3609 goto fail_with_EILSEQ; 4032 goto fail_with_EILSEQ;
3610 4033
3611 if (1 < width && !(flags & FLAG_LEFT)) 4034 {
3612 { 4035 size_t total = (1 < width ? width : 1);
3613 size_t n = width - 1; 4036 ENSURE_ALLOCATION (xsum (length, total));
3614 ENSURE_ALLOCATION (xsum (length, n));
3615 DCHAR_SET (result + length, ' ', n);
3616 length += n;
3617 }
3618 4037
3619 ENSURE_ALLOCATION (xsum (length, 1)); 4038 if (1 < width && !(flags & FLAG_LEFT))
3620 result[length++] = wc; 4039 {
4040 size_t n = width - 1;
4041 DCHAR_SET (result + length, ' ', n);
4042 length += n;
4043 }
3621 4044
3622 if (1 < width && (flags & FLAG_LEFT)) 4045 result[length++] = wc;
3623 { 4046
3624 size_t n = width - 1; 4047 if (1 < width && (flags & FLAG_LEFT))
3625 ENSURE_ALLOCATION (xsum (length, n)); 4048 {
3626 DCHAR_SET (result + length, ' ', n); 4049 size_t n = width - 1;
3627 length += n; 4050 DCHAR_SET (result + length, ' ', n);
3628 } 4051 length += n;
4052 }
4053 }
3629 } 4054 }
3630 } 4055 }
3631#endif 4056#endif
@@ -3641,30 +4066,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3641 { 4066 {
3642 arg_type type = a.arg[dp->arg_index].type; 4067 arg_type type = a.arg[dp->arg_index].type;
3643 int flags = dp->flags; 4068 int flags = dp->flags;
3644 int has_width;
3645 size_t width;
3646 int has_precision;
3647 size_t precision;
3648 size_t tmp_length;
3649 size_t count;
3650 DCHAR_T tmpbuf[700];
3651 DCHAR_T *tmp;
3652 DCHAR_T *tmp_end;
3653 DCHAR_T *tmp_start;
3654 DCHAR_T *pad_ptr;
3655 DCHAR_T *p;
3656 4069
3657 has_width = 0; 4070 int has_width = 0;
3658 width = 0; 4071 size_t width = 0;
3659 if (dp->width_start != dp->width_end) 4072 if (dp->width_start != dp->width_end)
3660 { 4073 {
3661 if (dp->width_arg_index != ARG_NONE) 4074 if (dp->width_arg_index != ARG_NONE)
3662 { 4075 {
3663 int arg;
3664
3665 if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) 4076 if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
3666 abort (); 4077 abort ();
3667 arg = a.arg[dp->width_arg_index].a.a_int; 4078 int arg = a.arg[dp->width_arg_index].a.a_int;
3668 width = arg; 4079 width = arg;
3669 if (arg < 0) 4080 if (arg < 0)
3670 { 4081 {
@@ -3682,20 +4093,20 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3682 width = xsum (xtimes (width, 10), *digitp++ - '0'); 4093 width = xsum (xtimes (width, 10), *digitp++ - '0');
3683 while (digitp != dp->width_end); 4094 while (digitp != dp->width_end);
3684 } 4095 }
4096 if (width > (size_t) INT_MAX)
4097 goto overflow;
3685 has_width = 1; 4098 has_width = 1;
3686 } 4099 }
3687 4100
3688 has_precision = 0; 4101 int has_precision = 0;
3689 precision = 1; 4102 size_t precision = 1;
3690 if (dp->precision_start != dp->precision_end) 4103 if (dp->precision_start != dp->precision_end)
3691 { 4104 {
3692 if (dp->precision_arg_index != ARG_NONE) 4105 if (dp->precision_arg_index != ARG_NONE)
3693 { 4106 {
3694 int arg;
3695
3696 if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) 4107 if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
3697 abort (); 4108 abort ();
3698 arg = a.arg[dp->precision_arg_index].a.a_int; 4109 int arg = a.arg[dp->precision_arg_index].a.a_int;
3699 /* "A negative precision is taken as if the precision 4110 /* "A negative precision is taken as if the precision
3700 were omitted." */ 4111 were omitted." */
3701 if (arg >= 0) 4112 if (arg >= 0)
@@ -3716,6 +4127,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3716 } 4127 }
3717 4128
3718 /* Allocate a temporary buffer of sufficient size. */ 4129 /* Allocate a temporary buffer of sufficient size. */
4130 size_t tmp_length;
3719 switch (type) 4131 switch (type)
3720 { 4132 {
3721 default: 4133 default:
@@ -3782,6 +4194,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3782 if (tmp_length < width) 4194 if (tmp_length < width)
3783 tmp_length = width; 4195 tmp_length = width;
3784 4196
4197 DCHAR_T tmpbuf[700];
4198 DCHAR_T *tmp;
3785 if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T)) 4199 if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
3786 tmp = tmpbuf; 4200 tmp = tmpbuf;
3787 else 4201 else
@@ -3797,7 +4211,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3797 goto out_of_memory; 4211 goto out_of_memory;
3798 } 4212 }
3799 4213
3800 tmp_end = tmp + tmp_length; 4214 DCHAR_T *tmp_end = tmp + tmp_length;
3801 4215
3802 unsigned long long arg; 4216 unsigned long long arg;
3803 switch (type) 4217 switch (type)
@@ -3846,7 +4260,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3846 } 4260 }
3847 int need_prefix = ((flags & FLAG_ALT) && arg != 0); 4261 int need_prefix = ((flags & FLAG_ALT) && arg != 0);
3848 4262
3849 p = tmp_end; 4263 DCHAR_T *p = tmp_end;
3850 /* "The result of converting a zero value with a precision 4264 /* "The result of converting a zero value with a precision
3851 of zero is no characters." */ 4265 of zero is no characters." */
3852 if (!(has_precision && precision == 0 && arg == 0)) 4266 if (!(has_precision && precision == 0 && arg == 0))
@@ -3866,7 +4280,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3866 *--p = '0'; 4280 *--p = '0';
3867 } 4281 }
3868 4282
3869 pad_ptr = p; 4283 DCHAR_T *pad_ptr = p;
3870 4284
3871 if (need_prefix) 4285 if (need_prefix)
3872 { 4286 {
@@ -3879,12 +4293,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3879# endif 4293# endif
3880 *--p = '0'; 4294 *--p = '0';
3881 } 4295 }
3882 tmp_start = p; 4296 DCHAR_T *tmp_start = p;
3883 4297
3884 /* The generated string now extends from tmp_start to tmp_end, 4298 /* The generated string now extends from tmp_start to tmp_end,
3885 with the zero padding insertion point being at pad_ptr, 4299 with the zero padding insertion point being at pad_ptr,
3886 tmp_start <= pad_ptr <= tmp_end. */ 4300 tmp_start <= pad_ptr <= tmp_end. */
3887 count = tmp_end - tmp_start; 4301 size_t count = tmp_end - tmp_start;
3888 4302
3889 if (count < width) 4303 if (count < width)
3890 { 4304 {
@@ -3933,7 +4347,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3933 { 4347 {
3934 size_t n = xsum (length, count); 4348 size_t n = xsum (length, count);
3935 4349
3936 ENSURE_ALLOCATION (n); 4350 ENSURE_ALLOCATION_ELSE (n,
4351 { if (tmp != tmpbuf) free (tmp); goto out_of_memory; });
3937 } 4352 }
3938 4353
3939 /* Append the result. */ 4354 /* Append the result. */
@@ -3959,26 +4374,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3959 { 4374 {
3960 arg_type type = a.arg[dp->arg_index].type; 4375 arg_type type = a.arg[dp->arg_index].type;
3961 int flags = dp->flags; 4376 int flags = dp->flags;
3962 size_t width;
3963 int has_precision;
3964 size_t precision;
3965 size_t tmp_length;
3966 size_t count;
3967 DCHAR_T tmpbuf[700];
3968 DCHAR_T *tmp;
3969 DCHAR_T *pad_ptr;
3970 DCHAR_T *p;
3971 4377
3972 width = 0; 4378 size_t width = 0;
3973 if (dp->width_start != dp->width_end) 4379 if (dp->width_start != dp->width_end)
3974 { 4380 {
3975 if (dp->width_arg_index != ARG_NONE) 4381 if (dp->width_arg_index != ARG_NONE)
3976 { 4382 {
3977 int arg;
3978
3979 if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) 4383 if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
3980 abort (); 4384 abort ();
3981 arg = a.arg[dp->width_arg_index].a.a_int; 4385 int arg = a.arg[dp->width_arg_index].a.a_int;
3982 width = arg; 4386 width = arg;
3983 if (arg < 0) 4387 if (arg < 0)
3984 { 4388 {
@@ -3996,19 +4400,19 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3996 width = xsum (xtimes (width, 10), *digitp++ - '0'); 4400 width = xsum (xtimes (width, 10), *digitp++ - '0');
3997 while (digitp != dp->width_end); 4401 while (digitp != dp->width_end);
3998 } 4402 }
4403 if (width > (size_t) INT_MAX)
4404 goto overflow;
3999 } 4405 }
4000 4406
4001 has_precision = 0; 4407 int has_precision = 0;
4002 precision = 0; 4408 size_t precision = 0;
4003 if (dp->precision_start != dp->precision_end) 4409 if (dp->precision_start != dp->precision_end)
4004 { 4410 {
4005 if (dp->precision_arg_index != ARG_NONE) 4411 if (dp->precision_arg_index != ARG_NONE)
4006 { 4412 {
4007 int arg;
4008
4009 if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) 4413 if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
4010 abort (); 4414 abort ();
4011 arg = a.arg[dp->precision_arg_index].a.a_int; 4415 int arg = a.arg[dp->precision_arg_index].a.a_int;
4012 /* "A negative precision is taken as if the precision 4416 /* "A negative precision is taken as if the precision
4013 were omitted." */ 4417 were omitted." */
4014 if (arg >= 0) 4418 if (arg >= 0)
@@ -4029,6 +4433,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4029 } 4433 }
4030 4434
4031 /* Allocate a temporary buffer of sufficient size. */ 4435 /* Allocate a temporary buffer of sufficient size. */
4436 size_t tmp_length;
4032 if (type == TYPE_LONGDOUBLE) 4437 if (type == TYPE_LONGDOUBLE)
4033 tmp_length = 4438 tmp_length =
4034 (unsigned int) ((LDBL_DIG + 1) 4439 (unsigned int) ((LDBL_DIG + 1)
@@ -4051,6 +4456,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4051 4456
4052 tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ 4457 tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
4053 4458
4459 DCHAR_T tmpbuf[700];
4460 DCHAR_T *tmp;
4054 if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T)) 4461 if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
4055 tmp = tmpbuf; 4462 tmp = tmpbuf;
4056 else 4463 else
@@ -4066,8 +4473,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4066 goto out_of_memory; 4473 goto out_of_memory;
4067 } 4474 }
4068 4475
4069 pad_ptr = NULL; 4476 DCHAR_T *pad_ptr = NULL;
4070 p = tmp; 4477 DCHAR_T *p = tmp;
4071 if (type == TYPE_LONGDOUBLE) 4478 if (type == TYPE_LONGDOUBLE)
4072 { 4479 {
4073# if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || (NEED_WPRINTF_DIRECTIVE_LA && WIDE_CHAR_VERSION) 4480# if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || (NEED_WPRINTF_DIRECTIVE_LA && WIDE_CHAR_VERSION)
@@ -4086,11 +4493,11 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4086 } 4493 }
4087 else 4494 else
4088 { 4495 {
4089 int sign = 0;
4090 DECL_LONG_DOUBLE_ROUNDING 4496 DECL_LONG_DOUBLE_ROUNDING
4091 4497
4092 BEGIN_LONG_DOUBLE_ROUNDING (); 4498 BEGIN_LONG_DOUBLE_ROUNDING ();
4093 4499
4500 int sign = 0;
4094 if (signbit (arg)) /* arg < 0.0L or negative zero */ 4501 if (signbit (arg)) /* arg < 0.0L or negative zero */
4095 { 4502 {
4096 sign = -1; 4503 sign = -1;
@@ -4119,7 +4526,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4119 { 4526 {
4120 int exponent; 4527 int exponent;
4121 long double mantissa; 4528 long double mantissa;
4122
4123 if (arg > 0.0L) 4529 if (arg > 0.0L)
4124 mantissa = printf_frexpl (arg, &exponent); 4530 mantissa = printf_frexpl (arg, &exponent);
4125 else 4531 else
@@ -4133,9 +4539,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4133 { 4539 {
4134 /* Round the mantissa. */ 4540 /* Round the mantissa. */
4135 long double tail = mantissa; 4541 long double tail = mantissa;
4136 size_t q;
4137 4542
4138 for (q = precision; ; q--) 4543 for (size_t q = precision; ; q--)
4139 { 4544 {
4140 int digit = (int) tail; 4545 int digit = (int) tail;
4141 tail -= digit; 4546 tail -= digit;
@@ -4150,7 +4555,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4150 tail *= 16.0L; 4555 tail *= 16.0L;
4151 } 4556 }
4152 if (tail != 0.0L) 4557 if (tail != 0.0L)
4153 for (q = precision; q > 0; q--) 4558 for (size_t q = precision; q > 0; q--)
4154 tail *= 0.0625L; 4559 tail *= 0.0625L;
4155 mantissa += tail; 4560 mantissa += tail;
4156 } 4561 }
@@ -4159,9 +4564,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4159 *p++ = dp->conversion - 'A' + 'X'; 4564 *p++ = dp->conversion - 'A' + 'X';
4160 pad_ptr = p; 4565 pad_ptr = p;
4161 { 4566 {
4162 int digit; 4567 int digit = (int) mantissa;
4163
4164 digit = (int) mantissa;
4165 mantissa -= digit; 4568 mantissa -= digit;
4166 *p++ = '0' + digit; 4569 *p++ = '0' + digit;
4167 if ((flags & FLAG_ALT) 4570 if ((flags & FLAG_ALT)
@@ -4208,9 +4611,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4208 else 4611 else
4209 { 4612 {
4210 char expbuf[6 + 1]; 4613 char expbuf[6 + 1];
4211 const char *ep;
4212 sprintf (expbuf, "%+d", exponent); 4614 sprintf (expbuf, "%+d", exponent);
4213 for (ep = expbuf; (*p = *ep) != '\0'; ep++) 4615 for (const char *ep = expbuf; (*p = *ep) != '\0'; ep++)
4214 p++; 4616 p++;
4215 } 4617 }
4216# endif 4618# endif
@@ -4241,7 +4643,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4241 else 4643 else
4242 { 4644 {
4243 int sign = 0; 4645 int sign = 0;
4244
4245 if (signbit (arg)) /* arg < 0.0 or negative zero */ 4646 if (signbit (arg)) /* arg < 0.0 or negative zero */
4246 { 4647 {
4247 sign = -1; 4648 sign = -1;
@@ -4270,7 +4671,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4270 { 4671 {
4271 int exponent; 4672 int exponent;
4272 double mantissa; 4673 double mantissa;
4273
4274 if (arg > 0.0) 4674 if (arg > 0.0)
4275 mantissa = printf_frexp (arg, &exponent); 4675 mantissa = printf_frexp (arg, &exponent);
4276 else 4676 else
@@ -4284,9 +4684,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4284 { 4684 {
4285 /* Round the mantissa. */ 4685 /* Round the mantissa. */
4286 double tail = mantissa; 4686 double tail = mantissa;
4287 size_t q;
4288 4687
4289 for (q = precision; ; q--) 4688 for (size_t q = precision; ; q--)
4290 { 4689 {
4291 int digit = (int) tail; 4690 int digit = (int) tail;
4292 tail -= digit; 4691 tail -= digit;
@@ -4301,7 +4700,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4301 tail *= 16.0; 4700 tail *= 16.0;
4302 } 4701 }
4303 if (tail != 0.0) 4702 if (tail != 0.0)
4304 for (q = precision; q > 0; q--) 4703 for (size_t q = precision; q > 0; q--)
4305 tail *= 0.0625; 4704 tail *= 0.0625;
4306 mantissa += tail; 4705 mantissa += tail;
4307 } 4706 }
@@ -4310,9 +4709,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4310 *p++ = dp->conversion - 'A' + 'X'; 4709 *p++ = dp->conversion - 'A' + 'X';
4311 pad_ptr = p; 4710 pad_ptr = p;
4312 { 4711 {
4313 int digit; 4712 int digit = (int) mantissa;
4314
4315 digit = (int) mantissa;
4316 mantissa -= digit; 4713 mantissa -= digit;
4317 *p++ = '0' + digit; 4714 *p++ = '0' + digit;
4318 if ((flags & FLAG_ALT) 4715 if ((flags & FLAG_ALT)
@@ -4359,9 +4756,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4359 else 4756 else
4360 { 4757 {
4361 char expbuf[6 + 1]; 4758 char expbuf[6 + 1];
4362 const char *ep;
4363 sprintf (expbuf, "%+d", exponent); 4759 sprintf (expbuf, "%+d", exponent);
4364 for (ep = expbuf; (*p = *ep) != '\0'; ep++) 4760 for (const char *ep = expbuf; (*p = *ep) != '\0'; ep++)
4365 p++; 4761 p++;
4366 } 4762 }
4367# endif 4763# endif
@@ -4374,7 +4770,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4374 4770
4375 /* The generated string now extends from tmp to p, with the 4771 /* The generated string now extends from tmp to p, with the
4376 zero padding insertion point being at pad_ptr. */ 4772 zero padding insertion point being at pad_ptr. */
4377 count = p - tmp; 4773 size_t count = p - tmp;
4378 4774
4379 if (count < width) 4775 if (count < width)
4380 { 4776 {
@@ -4423,7 +4819,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4423 { 4819 {
4424 size_t n = xsum (length, count); 4820 size_t n = xsum (length, count);
4425 4821
4426 ENSURE_ALLOCATION (n); 4822 ENSURE_ALLOCATION_ELSE (n,
4823 { if (tmp != tmpbuf) free (tmp); goto out_of_memory; });
4427 } 4824 }
4428 4825
4429 /* Append the result. */ 4826 /* Append the result. */
@@ -4454,8 +4851,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4454 || (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE 4851 || (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
4455 /* Some systems produce wrong output for Inf, 4852 /* Some systems produce wrong output for Inf,
4456 -Inf, and NaN. Some systems in this category 4853 -Inf, and NaN. Some systems in this category
4457 (IRIX 5.3) also do so for -0.0. Therefore we 4854 also do so for -0.0. Therefore we treat this
4458 treat this case here as well. */ 4855 case here as well. */
4459 && is_infinite_or_zerol (a.arg[dp->arg_index].a.a_longdouble)) 4856 && is_infinite_or_zerol (a.arg[dp->arg_index].a.a_longdouble))
4460# endif 4857# endif
4461 )) 4858 ))
@@ -4464,26 +4861,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4464 arg_type type = a.arg[dp->arg_index].type; 4861 arg_type type = a.arg[dp->arg_index].type;
4465# endif 4862# endif
4466 int flags = dp->flags; 4863 int flags = dp->flags;
4467 size_t width;
4468 size_t count;
4469 int has_precision;
4470 size_t precision;
4471 size_t tmp_length;
4472 DCHAR_T tmpbuf[700];
4473 DCHAR_T *tmp;
4474 DCHAR_T *pad_ptr;
4475 DCHAR_T *p;
4476 4864
4477 width = 0; 4865 size_t width = 0;
4478 if (dp->width_start != dp->width_end) 4866 if (dp->width_start != dp->width_end)
4479 { 4867 {
4480 if (dp->width_arg_index != ARG_NONE) 4868 if (dp->width_arg_index != ARG_NONE)
4481 { 4869 {
4482 int arg;
4483
4484 if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) 4870 if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
4485 abort (); 4871 abort ();
4486 arg = a.arg[dp->width_arg_index].a.a_int; 4872 int arg = a.arg[dp->width_arg_index].a.a_int;
4487 width = arg; 4873 width = arg;
4488 if (arg < 0) 4874 if (arg < 0)
4489 { 4875 {
@@ -4501,19 +4887,19 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4501 width = xsum (xtimes (width, 10), *digitp++ - '0'); 4887 width = xsum (xtimes (width, 10), *digitp++ - '0');
4502 while (digitp != dp->width_end); 4888 while (digitp != dp->width_end);
4503 } 4889 }
4890 if (width > (size_t) INT_MAX)
4891 goto overflow;
4504 } 4892 }
4505 4893
4506 has_precision = 0; 4894 int has_precision = 0;
4507 precision = 0; 4895 size_t precision = 0;
4508 if (dp->precision_start != dp->precision_end) 4896 if (dp->precision_start != dp->precision_end)
4509 { 4897 {
4510 if (dp->precision_arg_index != ARG_NONE) 4898 if (dp->precision_arg_index != ARG_NONE)
4511 { 4899 {
4512 int arg;
4513
4514 if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) 4900 if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
4515 abort (); 4901 abort ();
4516 arg = a.arg[dp->precision_arg_index].a.a_int; 4902 int arg = a.arg[dp->precision_arg_index].a.a_int;
4517 /* "A negative precision is taken as if the precision 4903 /* "A negative precision is taken as if the precision
4518 were omitted." */ 4904 were omitted." */
4519 if (arg >= 0) 4905 if (arg >= 0)
@@ -4542,6 +4928,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4542 precision = 6; 4928 precision = 6;
4543 4929
4544 /* Allocate a temporary buffer of sufficient size. */ 4930 /* Allocate a temporary buffer of sufficient size. */
4931 size_t tmp_length;
4545# if NEED_PRINTF_DOUBLE && NEED_PRINTF_LONG_DOUBLE 4932# if NEED_PRINTF_DOUBLE && NEED_PRINTF_LONG_DOUBLE
4546 tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : DBL_DIG + 1); 4933 tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : DBL_DIG + 1);
4547# elif NEED_PRINTF_INFINITE_DOUBLE && NEED_PRINTF_LONG_DOUBLE 4934# elif NEED_PRINTF_INFINITE_DOUBLE && NEED_PRINTF_LONG_DOUBLE
@@ -4587,6 +4974,17 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4587 } 4974 }
4588 } 4975 }
4589# endif 4976# endif
4977 /* Account for thousands separators. */
4978 if (flags & FLAG_GROUP)
4979 {
4980 /* A thousands separator needs to be inserted at most every 2 digits.
4981 This is the case in the ta_IN locale. */
4982# if WIDE_CHAR_VERSION
4983 tmp_length = xsum (tmp_length, tmp_length / 2 * THOUSEP_WCHAR_MAXLEN);
4984# else
4985 tmp_length = xsum (tmp_length, tmp_length / 2 * THOUSEP_CHAR_MAXLEN);
4986# endif
4987 }
4590 /* Account for sign, decimal point etc. */ 4988 /* Account for sign, decimal point etc. */
4591 tmp_length = xsum (tmp_length, 12); 4989 tmp_length = xsum (tmp_length, 12);
4592 4990
@@ -4595,6 +4993,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4595 4993
4596 tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ 4994 tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
4597 4995
4996 DCHAR_T tmpbuf[700];
4997 DCHAR_T *tmp;
4598 if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T)) 4998 if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T))
4599 tmp = tmpbuf; 4999 tmp = tmpbuf;
4600 else 5000 else
@@ -4610,8 +5010,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4610 goto out_of_memory; 5010 goto out_of_memory;
4611 } 5011 }
4612 5012
4613 pad_ptr = NULL; 5013 DCHAR_T *pad_ptr = NULL;
4614 p = tmp; 5014 DCHAR_T *p = tmp;
4615 5015
4616# if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE 5016# if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE
4617# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE 5017# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
@@ -4633,11 +5033,11 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4633 } 5033 }
4634 else 5034 else
4635 { 5035 {
4636 int sign = 0;
4637 DECL_LONG_DOUBLE_ROUNDING 5036 DECL_LONG_DOUBLE_ROUNDING
4638 5037
4639 BEGIN_LONG_DOUBLE_ROUNDING (); 5038 BEGIN_LONG_DOUBLE_ROUNDING ();
4640 5039
5040 int sign = 0;
4641 if (signbit (arg)) /* arg < 0.0L or negative zero */ 5041 if (signbit (arg)) /* arg < 0.0L or negative zero */
4642 { 5042 {
4643 sign = -1; 5043 sign = -1;
@@ -4669,25 +5069,94 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4669 5069
4670 if (dp->conversion == 'f' || dp->conversion == 'F') 5070 if (dp->conversion == 'f' || dp->conversion == 'F')
4671 { 5071 {
4672 char *digits; 5072 char *digits =
4673 size_t ndigits;
4674
4675 digits =
4676 scale10_round_decimal_long_double (arg, precision); 5073 scale10_round_decimal_long_double (arg, precision);
4677 if (digits == NULL) 5074 if (digits == NULL)
4678 { 5075 {
4679 END_LONG_DOUBLE_ROUNDING (); 5076 END_LONG_DOUBLE_ROUNDING ();
4680 goto out_of_memory; 5077 goto out_of_memory;
4681 } 5078 }
4682 ndigits = strlen (digits); 5079 size_t ndigits = strlen (digits);
4683 5080
4684 if (ndigits > precision) 5081 if (ndigits > precision)
4685 do 5082 {
4686 { 5083 /* Number of digits before the decimal point. */
4687 --ndigits; 5084 size_t intpart_digits = ndigits - precision;
4688 *p++ = digits[ndigits]; 5085
4689 } 5086 const DCHAR_T *thousep = NULL;
4690 while (ndigits > precision); 5087 DCHAR_T thousep_buf[10];
5088# if !WIDE_CHAR_VERSION
5089 size_t thousep_len = 0;
5090# endif
5091 const signed char *grouping;
5092 size_t insert = 0;
5093
5094 if ((flags & FLAG_GROUP) && (intpart_digits > 1))
5095 {
5096 /* Determine the thousands separator and
5097 the grouping rule of the current locale. */
5098# if WIDE_CHAR_VERSION
5099 /* DCHAR_T is wchar_t. */
5100 thousep = thousands_separator_wchar (thousep_buf);
5101# define thousep_len 1
5102# elif defined DCHAR_CONV_FROM_ENCODING
5103 /* DCHAR_T is uintN_t. */
5104 thousep = thousands_separator_DCHAR (thousep_buf);
5105 thousep_len = DCHAR_STRLEN (thousep);
5106# else
5107 /* DCHAR_T is char. */
5108 thousep = thousands_separator_char (thousep_buf);
5109 thousep_len = strlen (thousep);
5110# endif
5111 if (*thousep == 0)
5112 thousep = NULL;
5113 if (thousep != NULL)
5114 {
5115 grouping = grouping_rule ();
5116 insert =
5117 num_thousands_separators (grouping, intpart_digits);
5118 }
5119 }
5120
5121 const char *digitp = digits + precision;
5122 DCHAR_T *p_before_intpart = p;
5123 p += intpart_digits + insert * thousep_len;
5124 DCHAR_T *p_after_intpart = p;
5125 if (insert > 0) /* implies (flag & FLAG_GROUP) && (thousep != NULL) */
5126 {
5127 const signed char *g = grouping;
5128 for (;;)
5129 {
5130 int h = *g;
5131 if (h <= 0)
5132 abort ();
5133 int i = h;
5134 do
5135 *--p = *digitp++;
5136 while (--i > 0);
5137# if WIDE_CHAR_VERSION
5138 *--p = thousep[0];
5139# else
5140 p -= thousep_len;
5141 DCHAR_CPY (p, thousep, thousep_len);
5142# endif
5143 insert--;
5144 if (insert == 0)
5145 break;
5146 if (g[1] != 0)
5147 g++;
5148 }
5149 }
5150 for (;;)
5151 {
5152 *--p = *digitp++;
5153 if (p == p_before_intpart)
5154 break;
5155 }
5156 p = p_after_intpart;
5157 ndigits = precision;
5158# undef thousep_len
5159 }
4691 else 5160 else
4692 *p++ = '0'; 5161 *p++ = '0';
4693 /* Here ndigits <= precision. */ 5162 /* Here ndigits <= precision. */
@@ -4723,12 +5192,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4723 else 5192 else
4724 { 5193 {
4725 /* arg > 0.0L. */ 5194 /* arg > 0.0L. */
4726 int adjusted; 5195 exponent = floorlog10l (arg);
5196 int adjusted = 0;
4727 char *digits; 5197 char *digits;
4728 size_t ndigits; 5198 size_t ndigits;
4729
4730 exponent = floorlog10l (arg);
4731 adjusted = 0;
4732 for (;;) 5199 for (;;)
4733 { 5200 {
4734 digits = 5201 digits =
@@ -4819,9 +5286,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4819 else 5286 else
4820 { 5287 {
4821 char expbuf[6 + 1]; 5288 char expbuf[6 + 1];
4822 const char *ep;
4823 sprintf (expbuf, "%+.2d", exponent); 5289 sprintf (expbuf, "%+.2d", exponent);
4824 for (ep = expbuf; (*p = *ep) != '\0'; ep++) 5290 for (const char *ep = expbuf; (*p = *ep) != '\0'; ep++)
4825 p++; 5291 p++;
4826 } 5292 }
4827# endif 5293# endif
@@ -4857,14 +5323,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4857 else 5323 else
4858 { 5324 {
4859 /* arg > 0.0L. */ 5325 /* arg > 0.0L. */
4860 int exponent; 5326 int exponent = floorlog10l (arg);
4861 int adjusted; 5327 int adjusted = 0;
4862 char *digits; 5328 char *digits;
4863 size_t ndigits; 5329 size_t ndigits;
4864 size_t nzeroes;
4865
4866 exponent = floorlog10l (arg);
4867 adjusted = 0;
4868 for (;;) 5330 for (;;)
4869 { 5331 {
4870 digits = 5332 digits =
@@ -4924,7 +5386,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4924 5386
4925 /* Determine the number of trailing zeroes 5387 /* Determine the number of trailing zeroes
4926 that have to be dropped. */ 5388 that have to be dropped. */
4927 nzeroes = 0; 5389 size_t nzeroes = 0;
4928 if ((flags & FLAG_ALT) == 0) 5390 if ((flags & FLAG_ALT) == 0)
4929 while (nzeroes < ndigits 5391 while (nzeroes < ndigits
4930 && digits[nzeroes] == '0') 5392 && digits[nzeroes] == '0')
@@ -4940,10 +5402,84 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4940 digits without trailing zeroes. */ 5402 digits without trailing zeroes. */
4941 if (exponent >= 0) 5403 if (exponent >= 0)
4942 { 5404 {
4943 size_t ecount = exponent + 1; 5405 /* Number of digits before the decimal point. */
4944 /* Note: count <= precision = ndigits. */ 5406 size_t intpart_digits = exponent + 1;
4945 for (; ecount > 0; ecount--) 5407 /* Note: intpart_digits <= precision = ndigits. */
4946 *p++ = digits[--ndigits]; 5408
5409 const DCHAR_T *thousep = NULL;
5410 DCHAR_T thousep_buf[10];
5411# if !WIDE_CHAR_VERSION
5412 size_t thousep_len = 0;
5413# endif
5414 const signed char *grouping;
5415 size_t insert = 0;
5416
5417 if ((flags & FLAG_GROUP) && (intpart_digits > 1))
5418 {
5419 /* Determine the thousands separator and
5420 the grouping rule of the current locale. */
5421# if WIDE_CHAR_VERSION
5422 /* DCHAR_T is wchar_t. */
5423 thousep = thousands_separator_wchar (thousep_buf);
5424# define thousep_len 1
5425# elif defined DCHAR_CONV_FROM_ENCODING
5426 /* DCHAR_T is uintN_t. */
5427 thousep = thousands_separator_DCHAR (thousep_buf);
5428 thousep_len = DCHAR_STRLEN (thousep);
5429# else
5430 /* DCHAR_T is char. */
5431 thousep = thousands_separator_char (thousep_buf);
5432 thousep_len = strlen (thousep);
5433# endif
5434 if (*thousep == 0)
5435 thousep = NULL;
5436 if (thousep != NULL)
5437 {
5438 grouping = grouping_rule ();
5439 insert =
5440 num_thousands_separators (grouping, intpart_digits);
5441 }
5442 }
5443
5444 const char *digitp = digits + ndigits - intpart_digits;
5445 DCHAR_T *p_before_intpart = p;
5446 p += intpart_digits + insert * thousep_len;
5447 DCHAR_T *p_after_intpart = p;
5448 if (insert > 0) /* implies (flag & FLAG_GROUP) && (thousep != NULL) */
5449 {
5450 const signed char *g = grouping;
5451 for (;;)
5452 {
5453 int h = *g;
5454 if (h <= 0)
5455 abort ();
5456 int i = h;
5457 do
5458 *--p = *digitp++;
5459 while (--i > 0);
5460# if WIDE_CHAR_VERSION
5461 *--p = thousep[0];
5462# else
5463 p -= thousep_len;
5464 DCHAR_CPY (p, thousep, thousep_len);
5465# endif
5466 insert--;
5467 if (insert == 0)
5468 break;
5469 if (g[1] != 0)
5470 g++;
5471 }
5472 }
5473 for (;;)
5474 {
5475 *--p = *digitp++;
5476 if (p == p_before_intpart)
5477 break;
5478 }
5479 p = p_after_intpart;
5480 ndigits -= intpart_digits;
5481# undef thousep_len
5482
4947 if ((flags & FLAG_ALT) || ndigits > nzeroes) 5483 if ((flags & FLAG_ALT) || ndigits > nzeroes)
4948 { 5484 {
4949 *p++ = decimal_point_char (); 5485 *p++ = decimal_point_char ();
@@ -5000,9 +5536,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5000 else 5536 else
5001 { 5537 {
5002 char expbuf[6 + 1]; 5538 char expbuf[6 + 1];
5003 const char *ep;
5004 sprintf (expbuf, "%+.2d", exponent); 5539 sprintf (expbuf, "%+.2d", exponent);
5005 for (ep = expbuf; (*p = *ep) != '\0'; ep++) 5540 for (const char *ep = expbuf; (*p = *ep) != '\0'; ep++)
5006 p++; 5541 p++;
5007 } 5542 }
5008# endif 5543# endif
@@ -5102,7 +5637,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5102 else 5637 else
5103 { 5638 {
5104 int sign = 0; 5639 int sign = 0;
5105
5106 if (signbit (arg)) /* arg < 0.0 or negative zero */ 5640 if (signbit (arg)) /* arg < 0.0 or negative zero */
5107 { 5641 {
5108 sign = -1; 5642 sign = -1;
@@ -5134,22 +5668,91 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5134 5668
5135 if (dp->conversion == 'f' || dp->conversion == 'F') 5669 if (dp->conversion == 'f' || dp->conversion == 'F')
5136 { 5670 {
5137 char *digits; 5671 char *digits =
5138 size_t ndigits;
5139
5140 digits =
5141 scale10_round_decimal_double (arg, precision); 5672 scale10_round_decimal_double (arg, precision);
5142 if (digits == NULL) 5673 if (digits == NULL)
5143 goto out_of_memory; 5674 goto out_of_memory;
5144 ndigits = strlen (digits); 5675 size_t ndigits = strlen (digits);
5145 5676
5146 if (ndigits > precision) 5677 if (ndigits > precision)
5147 do 5678 {
5148 { 5679 /* Number of digits before the decimal point. */
5149 --ndigits; 5680 size_t intpart_digits = ndigits - precision;
5150 *p++ = digits[ndigits]; 5681
5151 } 5682 const DCHAR_T *thousep = NULL;
5152 while (ndigits > precision); 5683 DCHAR_T thousep_buf[10];
5684# if !WIDE_CHAR_VERSION
5685 size_t thousep_len = 0;
5686# endif
5687 const signed char *grouping;
5688 size_t insert = 0;
5689
5690 if ((flags & FLAG_GROUP) && (intpart_digits > 1))
5691 {
5692 /* Determine the thousands separator and
5693 the grouping rule of the current locale. */
5694# if WIDE_CHAR_VERSION
5695 /* DCHAR_T is wchar_t. */
5696 thousep = thousands_separator_wchar (thousep_buf);
5697# define thousep_len 1
5698# elif defined DCHAR_CONV_FROM_ENCODING
5699 /* DCHAR_T is uintN_t. */
5700 thousep = thousands_separator_DCHAR (thousep_buf);
5701 thousep_len = DCHAR_STRLEN (thousep);
5702# else
5703 /* DCHAR_T is char. */
5704 thousep = thousands_separator_char (thousep_buf);
5705 thousep_len = strlen (thousep);
5706# endif
5707 if (*thousep == 0)
5708 thousep = NULL;
5709 if (thousep != NULL)
5710 {
5711 grouping = grouping_rule ();
5712 insert =
5713 num_thousands_separators (grouping, intpart_digits);
5714 }
5715 }
5716
5717 const char *digitp = digits + precision;
5718 DCHAR_T *p_before_intpart = p;
5719 p += intpart_digits + insert * thousep_len;
5720 DCHAR_T *p_after_intpart = p;
5721 if (insert > 0) /* implies (flag & FLAG_GROUP) && (thousep != NULL) */
5722 {
5723 const signed char *g = grouping;
5724 for (;;)
5725 {
5726 int h = *g;
5727 if (h <= 0)
5728 abort ();
5729 int i = h;
5730 do
5731 *--p = *digitp++;
5732 while (--i > 0);
5733# if WIDE_CHAR_VERSION
5734 *--p = thousep[0];
5735# else
5736 p -= thousep_len;
5737 DCHAR_CPY (p, thousep, thousep_len);
5738# endif
5739 insert--;
5740 if (insert == 0)
5741 break;
5742 if (g[1] != 0)
5743 g++;
5744 }
5745 }
5746 for (;;)
5747 {
5748 *--p = *digitp++;
5749 if (p == p_before_intpart)
5750 break;
5751 }
5752 p = p_after_intpart;
5753 ndigits = precision;
5754# undef thousep_len
5755 }
5153 else 5756 else
5154 *p++ = '0'; 5757 *p++ = '0';
5155 /* Here ndigits <= precision. */ 5758 /* Here ndigits <= precision. */
@@ -5185,12 +5788,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5185 else 5788 else
5186 { 5789 {
5187 /* arg > 0.0. */ 5790 /* arg > 0.0. */
5188 int adjusted; 5791 exponent = floorlog10 (arg);
5792 int adjusted = 0;
5189 char *digits; 5793 char *digits;
5190 size_t ndigits; 5794 size_t ndigits;
5191
5192 exponent = floorlog10 (arg);
5193 adjusted = 0;
5194 for (;;) 5795 for (;;)
5195 { 5796 {
5196 digits = 5797 digits =
@@ -5292,9 +5893,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5292 else 5893 else
5293 { 5894 {
5294 char expbuf[6 + 1]; 5895 char expbuf[6 + 1];
5295 const char *ep;
5296 sprintf (expbuf, decimal_format, exponent); 5896 sprintf (expbuf, decimal_format, exponent);
5297 for (ep = expbuf; (*p = *ep) != '\0'; ep++) 5897 for (const char *ep = expbuf; (*p = *ep) != '\0'; ep++)
5298 p++; 5898 p++;
5299 } 5899 }
5300 } 5900 }
@@ -5331,14 +5931,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5331 else 5931 else
5332 { 5932 {
5333 /* arg > 0.0. */ 5933 /* arg > 0.0. */
5334 int exponent; 5934 int exponent = floorlog10 (arg);
5335 int adjusted; 5935 int adjusted = 0;
5336 char *digits; 5936 char *digits;
5337 size_t ndigits; 5937 size_t ndigits;
5338 size_t nzeroes;
5339
5340 exponent = floorlog10 (arg);
5341 adjusted = 0;
5342 for (;;) 5938 for (;;)
5343 { 5939 {
5344 digits = 5940 digits =
@@ -5394,7 +5990,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5394 5990
5395 /* Determine the number of trailing zeroes 5991 /* Determine the number of trailing zeroes
5396 that have to be dropped. */ 5992 that have to be dropped. */
5397 nzeroes = 0; 5993 size_t nzeroes = 0;
5398 if ((flags & FLAG_ALT) == 0) 5994 if ((flags & FLAG_ALT) == 0)
5399 while (nzeroes < ndigits 5995 while (nzeroes < ndigits
5400 && digits[nzeroes] == '0') 5996 && digits[nzeroes] == '0')
@@ -5410,10 +6006,84 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5410 digits without trailing zeroes. */ 6006 digits without trailing zeroes. */
5411 if (exponent >= 0) 6007 if (exponent >= 0)
5412 { 6008 {
5413 size_t ecount = exponent + 1; 6009 /* Number of digits before the decimal point. */
5414 /* Note: ecount <= precision = ndigits. */ 6010 size_t intpart_digits = exponent + 1;
5415 for (; ecount > 0; ecount--) 6011 /* Note: intpart_digits <= precision = ndigits. */
5416 *p++ = digits[--ndigits]; 6012
6013 const DCHAR_T *thousep = NULL;
6014 DCHAR_T thousep_buf[10];
6015# if !WIDE_CHAR_VERSION
6016 size_t thousep_len = 0;
6017# endif
6018 const signed char *grouping;
6019 size_t insert = 0;
6020
6021 if ((flags & FLAG_GROUP) && (intpart_digits > 1))
6022 {
6023 /* Determine the thousands separator and
6024 the grouping rule of the current locale. */
6025# if WIDE_CHAR_VERSION
6026 /* DCHAR_T is wchar_t. */
6027 thousep = thousands_separator_wchar (thousep_buf);
6028# define thousep_len 1
6029# elif defined DCHAR_CONV_FROM_ENCODING
6030 /* DCHAR_T is uintN_t. */
6031 thousep = thousands_separator_DCHAR (thousep_buf);
6032 thousep_len = DCHAR_STRLEN (thousep);
6033# else
6034 /* DCHAR_T is char. */
6035 thousep = thousands_separator_char (thousep_buf);
6036 thousep_len = strlen (thousep);
6037# endif
6038 if (*thousep == 0)
6039 thousep = NULL;
6040 if (thousep != NULL)
6041 {
6042 grouping = grouping_rule ();
6043 insert =
6044 num_thousands_separators (grouping, intpart_digits);
6045 }
6046 }
6047
6048 const char *digitp = digits + ndigits - intpart_digits;
6049 DCHAR_T *p_before_intpart = p;
6050 p += intpart_digits + insert * thousep_len;
6051 DCHAR_T *p_after_intpart = p;
6052 if (insert > 0) /* implies (flag & FLAG_GROUP) && (thousep != NULL) */
6053 {
6054 const signed char *g = grouping;
6055 for (;;)
6056 {
6057 int h = *g;
6058 if (h <= 0)
6059 abort ();
6060 int i = h;
6061 do
6062 *--p = *digitp++;
6063 while (--i > 0);
6064# if WIDE_CHAR_VERSION
6065 *--p = thousep[0];
6066# else
6067 p -= thousep_len;
6068 DCHAR_CPY (p, thousep, thousep_len);
6069# endif
6070 insert--;
6071 if (insert == 0)
6072 break;
6073 if (g[1] != 0)
6074 g++;
6075 }
6076 }
6077 for (;;)
6078 {
6079 *--p = *digitp++;
6080 if (p == p_before_intpart)
6081 break;
6082 }
6083 p = p_after_intpart;
6084 ndigits -= intpart_digits;
6085# undef thousep_len
6086
5417 if ((flags & FLAG_ALT) || ndigits > nzeroes) 6087 if ((flags & FLAG_ALT) || ndigits > nzeroes)
5418 { 6088 {
5419 *p++ = decimal_point_char (); 6089 *p++ = decimal_point_char ();
@@ -5485,9 +6155,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5485 else 6155 else
5486 { 6156 {
5487 char expbuf[6 + 1]; 6157 char expbuf[6 + 1];
5488 const char *ep;
5489 sprintf (expbuf, decimal_format, exponent); 6158 sprintf (expbuf, decimal_format, exponent);
5490 for (ep = expbuf; (*p = *ep) != '\0'; ep++) 6159 for (const char *ep = expbuf; (*p = *ep) != '\0'; ep++)
5491 p++; 6160 p++;
5492 } 6161 }
5493 } 6162 }
@@ -5557,7 +6226,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5557 6226
5558 /* The generated string now extends from tmp to p, with the 6227 /* The generated string now extends from tmp to p, with the
5559 zero padding insertion point being at pad_ptr. */ 6228 zero padding insertion point being at pad_ptr. */
5560 count = p - tmp; 6229 size_t count = p - tmp;
5561 6230
5562 if (count < width) 6231 if (count < width)
5563 { 6232 {
@@ -5606,7 +6275,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5606 { 6275 {
5607 size_t n = xsum (length, count); 6276 size_t n = xsum (length, count);
5608 6277
5609 ENSURE_ALLOCATION (n); 6278 ENSURE_ALLOCATION_ELSE (n,
6279 { if (tmp != tmpbuf) free (tmp); goto out_of_memory; });
5610 } 6280 }
5611 6281
5612 /* Append the result. */ 6282 /* Append the result. */
@@ -5620,24 +6290,19 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5620 { 6290 {
5621 arg_type type = a.arg[dp->arg_index].type; 6291 arg_type type = a.arg[dp->arg_index].type;
5622 int flags = dp->flags; 6292 int flags = dp->flags;
5623#if (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
5624 int has_width;
5625#endif
5626#if !USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
5627 size_t width;
5628#endif
5629#if !USE_SNPRINTF || (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
5630 int has_precision;
5631 size_t precision;
5632#endif
5633#if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION 6293#if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
5634 int prec_ourselves; 6294 int prec_ourselves;
5635#else 6295#else
5636# define prec_ourselves 0 6296# define prec_ourselves 0
5637#endif 6297#endif
6298#if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION || NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT
6299 int group_ourselves;
6300#else
6301# define group_ourselves 0
6302#endif
5638#if (WIDE_CHAR_VERSION && MUSL_LIBC) || NEED_PRINTF_FLAG_LEFTADJUST 6303#if (WIDE_CHAR_VERSION && MUSL_LIBC) || NEED_PRINTF_FLAG_LEFTADJUST
5639# define pad_ourselves 1 6304# define pad_ourselves 1
5640#elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION 6305#elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION || NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT
5641 int pad_ourselves; 6306 int pad_ourselves;
5642#else 6307#else
5643# define pad_ourselves 0 6308# define pad_ourselves 0
@@ -5652,20 +6317,18 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5652 TCHAR_T *tmp; 6317 TCHAR_T *tmp;
5653#endif 6318#endif
5654 6319
5655#if (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION 6320#if (WIDE_CHAR_VERSION && MUSL_LIBC) || NEED_PRINTF_FLAG_LEFTADJUST || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION || NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT
5656 has_width = 0; 6321 int has_width = 0;
5657#endif 6322#endif
5658#if !USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION 6323#if !USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_FLAG_LEFTADJUST || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION || NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT
5659 width = 0; 6324 size_t width = 0;
5660 if (dp->width_start != dp->width_end) 6325 if (dp->width_start != dp->width_end)
5661 { 6326 {
5662 if (dp->width_arg_index != ARG_NONE) 6327 if (dp->width_arg_index != ARG_NONE)
5663 { 6328 {
5664 int arg;
5665
5666 if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) 6329 if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
5667 abort (); 6330 abort ();
5668 arg = a.arg[dp->width_arg_index].a.a_int; 6331 int arg = a.arg[dp->width_arg_index].a.a_int;
5669 width = arg; 6332 width = arg;
5670 if (arg < 0) 6333 if (arg < 0)
5671 { 6334 {
@@ -5683,24 +6346,25 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5683 width = xsum (xtimes (width, 10), *digitp++ - '0'); 6346 width = xsum (xtimes (width, 10), *digitp++ - '0');
5684 while (digitp != dp->width_end); 6347 while (digitp != dp->width_end);
5685 } 6348 }
5686# if (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION 6349 if (width > (size_t) INT_MAX)
6350 goto overflow;
6351# define WIDTH_IS_CHECKED 1
6352# if (WIDE_CHAR_VERSION && MUSL_LIBC) || NEED_PRINTF_FLAG_LEFTADJUST || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION || NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT
5687 has_width = 1; 6353 has_width = 1;
5688# endif 6354# endif
5689 } 6355 }
5690#endif 6356#endif
5691 6357
5692#if !USE_SNPRINTF || (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION 6358#if !USE_SNPRINTF || (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (WIDE_CHAR_VERSION && MUSL_LIBC) || NEED_PRINTF_FLAG_LEFTADJUST || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION || NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT
5693 has_precision = 0; 6359 int has_precision = 0;
5694 precision = 6; 6360 size_t precision = 6;
5695 if (dp->precision_start != dp->precision_end) 6361 if (dp->precision_start != dp->precision_end)
5696 { 6362 {
5697 if (dp->precision_arg_index != ARG_NONE) 6363 if (dp->precision_arg_index != ARG_NONE)
5698 { 6364 {
5699 int arg;
5700
5701 if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) 6365 if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
5702 abort (); 6366 abort ();
5703 arg = a.arg[dp->precision_arg_index].a.a_int; 6367 int arg = a.arg[dp->precision_arg_index].a.a_int;
5704 /* "A negative precision is taken as if the precision 6368 /* "A negative precision is taken as if the precision
5705 were omitted." */ 6369 were omitted." */
5706 if (arg >= 0) 6370 if (arg >= 0)
@@ -5754,25 +6418,56 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5754 } 6418 }
5755#endif 6419#endif
5756 6420
6421 /* Decide whether to add the thousands separators ourselves. */
6422#if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION || NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT
6423 if (flags & FLAG_GROUP)
6424 {
6425 switch (dp->conversion)
6426 {
6427 case 'd': case 'i': case 'u':
6428# if NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT
6429 group_ourselves = 1;
6430# else
6431 group_ourselves = prec_ourselves;
6432# endif
6433 break;
6434 case 'f': case 'F': case 'g': case 'G':
6435# if NEED_PRINTF_FLAG_GROUPING
6436 group_ourselves = 1;
6437# else
6438 group_ourselves = prec_ourselves;
6439# endif
6440 break;
6441 default:
6442 group_ourselves = 0;
6443 break;
6444 }
6445 }
6446 else
6447 group_ourselves = 0;
6448#endif
6449
5757 /* Decide whether to perform the padding ourselves. */ 6450 /* Decide whether to perform the padding ourselves. */
5758#if !((WIDE_CHAR_VERSION && MUSL_LIBC) || NEED_PRINTF_FLAG_LEFTADJUST) && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION) 6451#if !((WIDE_CHAR_VERSION && MUSL_LIBC) || NEED_PRINTF_FLAG_LEFTADJUST) && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION || NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT)
5759 switch (dp->conversion) 6452 switch (dp->conversion)
5760 { 6453 {
5761# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO 6454# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO
6455# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
5762 /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need 6456 /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need
5763 to perform the padding after this conversion. Functions 6457 to perform the padding after this conversion. Functions
5764 with unistdio extensions perform the padding based on 6458 with unistdio extensions perform the padding based on
5765 character count rather than element count. */ 6459 character count rather than element count. */
5766 case 'c': case 's': 6460 case 'c': case 's':
5767# endif 6461# endif
5768# if NEED_PRINTF_FLAG_ZERO 6462# if NEED_PRINTF_FLAG_ZERO
5769 case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': 6463 case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
5770 case 'a': case 'A': 6464 case 'a': case 'A':
5771# endif 6465# endif
5772 pad_ourselves = 1; 6466 pad_ourselves = 1;
5773 break; 6467 break;
6468# endif
5774 default: 6469 default:
5775 pad_ourselves = prec_ourselves; 6470 pad_ourselves = prec_ourselves | group_ourselves;
5776 break; 6471 break;
5777 } 6472 }
5778#endif 6473#endif
@@ -5805,14 +6500,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5805 sprintf. */ 6500 sprintf. */
5806 fbp = buf; 6501 fbp = buf;
5807 *fbp++ = '%'; 6502 *fbp++ = '%';
5808#if NEED_PRINTF_FLAG_GROUPING 6503 if ((flags & FLAG_GROUP) && !group_ourselves)
5809 /* The underlying implementation doesn't support the ' flag.
5810 Produce no grouping characters in this case; this is
5811 acceptable because the grouping is locale dependent. */
5812#else
5813 if (flags & FLAG_GROUP)
5814 *fbp++ = '\''; 6504 *fbp++ = '\'';
5815#endif
5816 if (flags & FLAG_LEFT) 6505 if (flags & FLAG_LEFT)
5817 *fbp++ = '-'; 6506 *fbp++ = '-';
5818 if (flags & FLAG_SHOWSIGN) 6507 if (flags & FLAG_SHOWSIGN)
@@ -5832,6 +6521,41 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5832 if (dp->width_start != dp->width_end) 6521 if (dp->width_start != dp->width_end)
5833 { 6522 {
5834 size_t n = dp->width_end - dp->width_start; 6523 size_t n = dp->width_end - dp->width_start;
6524#if !WIDTH_IS_CHECKED
6525 size_t width;
6526 /* Reject an out-of-range width.
6527 The underlying SNPRINTF already does this on some
6528 platforms (glibc, musl, macOS, FreeBSD, NetBSD,
6529 OpenBSD, Cygwin, Solaris, MSVC). However, on others
6530 (AIX, mingw), it doesn't; thus this vasnprintf
6531 invocation would succeed and produce a wrong result.
6532 So, this is redundant on some platforms, but it's a
6533 quick check anyway. */
6534 if (dp->width_arg_index != ARG_NONE)
6535 {
6536 if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
6537 abort ();
6538 int arg = a.arg[dp->width_arg_index].a.a_int;
6539 width = arg;
6540 if (arg < 0)
6541 {
6542 /* "A negative field width is taken as a '-' flag
6543 followed by a positive field width." */
6544 width = -width;
6545 }
6546 }
6547 else
6548 {
6549 const FCHAR_T *digitp = dp->width_start;
6550
6551 width = 0;
6552 do
6553 width = xsum (xtimes (width, 10), *digitp++ - '0');
6554 while (digitp != dp->width_end);
6555 }
6556 if (width > (size_t) INT_MAX)
6557 goto overflow;
6558#endif
5835 /* The width specification is known to consist only 6559 /* The width specification is known to consist only
5836 of standard ASCII characters. */ 6560 of standard ASCII characters. */
5837 if (sizeof (FCHAR_T) == sizeof (TCHAR_T)) 6561 if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
@@ -5870,7 +6594,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5870 } 6594 }
5871 } 6595 }
5872 6596
5873 switch (type) 6597 switch (+type)
5874 { 6598 {
5875 case TYPE_LONGLONGINT: 6599 case TYPE_LONGLONGINT:
5876 case TYPE_ULONGLONGINT: 6600 case TYPE_ULONGLONGINT:
@@ -5984,9 +6708,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5984 #if HAVE_WINT_T 6708 #if HAVE_WINT_T
5985 case TYPE_WIDE_CHAR: 6709 case TYPE_WIDE_CHAR:
5986 #endif 6710 #endif
5987 #if HAVE_WCHAR_T
5988 case TYPE_WIDE_STRING: 6711 case TYPE_WIDE_STRING:
5989 #endif
5990 *fbp++ = 'l'; 6712 *fbp++ = 'l';
5991 break; 6713 break;
5992 case TYPE_LONGDOUBLE: 6714 case TYPE_LONGDOUBLE:
@@ -6038,7 +6760,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6038 /* The following platforms forbid %n: 6760 /* The following platforms forbid %n:
6039 - On glibc2 systems from 2004-10-18 or newer, the use of 6761 - On glibc2 systems from 2004-10-18 or newer, the use of
6040 %n in format strings in writable memory may crash the 6762 %n in format strings in writable memory may crash the
6041 program (if compiled with _FORTIFY_SOURCE=2). 6763 program (if compiled with _FORTIFY_SOURCE >= 2).
6042 - On macOS 10.13 or newer, the use of %n in format 6764 - On macOS 10.13 or newer, the use of %n in format
6043 strings in writable memory by default crashes the 6765 strings in writable memory by default crashes the
6044 program. 6766 program.
@@ -6071,7 +6793,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6071 on musl libc because we would run into an swprintf() bug. 6793 on musl libc because we would run into an swprintf() bug.
6072 See <https://www.openwall.com/lists/musl/2023/03/19/1>. */ 6794 See <https://www.openwall.com/lists/musl/2023/03/19/1>. */
6073 fbp[1] = '\0'; 6795 fbp[1] = '\0';
6074# else /* AIX <= 5.1, HP-UX, IRIX, OSF/1, Solaris <= 9, BeOS */ 6796# else /* AIX <= 5.1, HP-UX, Solaris <= 9, BeOS */
6075 fbp[1] = '%'; 6797 fbp[1] = '%';
6076 fbp[2] = 'n'; 6798 fbp[2] = 'n';
6077 fbp[3] = '\0'; 6799 fbp[3] = '\0';
@@ -6168,7 +6890,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6168#endif 6890#endif
6169 6891
6170 errno = 0; 6892 errno = 0;
6171 switch (type) 6893 switch (+type)
6172 { 6894 {
6173 case TYPE_SCHAR: 6895 case TYPE_SCHAR:
6174 { 6896 {
@@ -6358,14 +7080,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6358 SNPRINTF_BUF (arg); 7080 SNPRINTF_BUF (arg);
6359 } 7081 }
6360 break; 7082 break;
6361#if HAVE_WCHAR_T
6362 case TYPE_WIDE_STRING: 7083 case TYPE_WIDE_STRING:
6363 { 7084 {
6364 const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string; 7085 const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
6365 SNPRINTF_BUF (arg); 7086 SNPRINTF_BUF (arg);
6366 } 7087 }
6367 break; 7088 break;
6368#endif
6369 case TYPE_POINTER: 7089 case TYPE_POINTER:
6370 { 7090 {
6371 void *arg = a.arg[dp->arg_index].a.a_pointer; 7091 void *arg = a.arg[dp->arg_index].a.a_pointer;
@@ -6539,10 +7259,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6539 || *prec_ptr == ' ')) 7259 || *prec_ptr == ' '))
6540 prefix_count = 1; 7260 prefix_count = 1;
6541 /* Put the additional zeroes after the 0x prefix if 7261 /* Put the additional zeroes after the 0x prefix if
6542 (flags & FLAG_ALT) || (dp->conversion == 'p'). */ 7262 (flags & FLAG_ALT) || (dp->conversion == 'p'), or
7263 after the 0b prefix if (flags & FLAG_ALT). */
6543 else if (count >= 2 7264 else if (count >= 2
6544 && prec_ptr[0] == '0' 7265 && prec_ptr[0] == '0'
6545 && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X')) 7266 && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X'
7267 || prec_ptr[1] == 'b'
7268 || prec_ptr[1] == 'B'))
6546 prefix_count = 2; 7269 prefix_count = 2;
6547 7270
6548 move = count - prefix_count; 7271 move = count - prefix_count;
@@ -6591,6 +7314,135 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6591 } 7314 }
6592#endif 7315#endif
6593 7316
7317#if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION || NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT
7318 if (group_ourselves) /* implies (flags & FLAG_GROUP) */
7319 /* Handle the grouping. */
7320 switch (dp->conversion)
7321 {
7322 /* These are the only conversion to which grouping
7323 applies. */
7324 case 'd': case 'i': case 'u':
7325 case 'f': case 'F': case 'g': case 'G':
7326 {
7327 /* Determine the thousands separator of the current
7328 locale. */
7329 const TCHAR_T *thousep;
7330 TCHAR_T thousep_buf[10];
7331
7332# if WIDE_CHAR_VERSION && DCHAR_IS_TCHAR
7333 /* TCHAR_T is wchar_t. */
7334 thousep = thousands_separator_wchar (thousep_buf);
7335# else
7336 /* TCHAR_T is char. */
7337 thousep = thousands_separator_char (thousep_buf);
7338# endif
7339
7340 /* Nothing to do in locales where thousep is the empty
7341 string. */
7342 if (*thousep != 0)
7343 {
7344 /* Since FLAG_LOCALIZED is only supported on glibc
7345 systems, here we can assume that all digits are
7346 the ASCII digits '0'..'9'. */
7347 TCHAR_T *number_ptr =
7348# if USE_SNPRINTF
7349 (TCHAR_T *) (result + length);
7350# else
7351 tmp;
7352# endif
7353 TCHAR_T *end_ptr = number_ptr + count;
7354
7355 /* Find where the leading digits start. */
7356 TCHAR_T *digits_ptr = number_ptr;
7357 if (count >= 1
7358 && (*digits_ptr == '-' || *digits_ptr == '+'
7359 || *digits_ptr == ' '))
7360 digits_ptr++;
7361
7362 /* Find where the leading digits end. */
7363 TCHAR_T *digits_end_ptr;
7364 switch (dp->conversion)
7365 {
7366 case 'd': case 'i': case 'u':
7367 digits_end_ptr = end_ptr;
7368 break;
7369 case 'f': case 'F': case 'g': case 'G':
7370 {
7371 TCHAR_T decimal_point = decimal_point_char ();
7372 for (digits_end_ptr = digits_ptr;
7373 digits_end_ptr < end_ptr;
7374 digits_end_ptr++)
7375 if (*digits_end_ptr == decimal_point
7376 || *digits_end_ptr == 'e')
7377 break;
7378 }
7379 break;
7380 }
7381
7382 /* Determine the number of thousands separators
7383 to insert. */
7384 const signed char *grouping = grouping_rule ();
7385 size_t insert =
7386 num_thousands_separators (grouping, digits_end_ptr - digits_ptr);
7387 if (insert > 0)
7388 {
7389# if WIDE_CHAR_VERSION && DCHAR_IS_TCHAR
7390# define thousep_len 1
7391# else
7392 size_t thousep_len = strlen (thousep);
7393# endif
7394# if USE_SNPRINTF
7395 size_t digits_offset = digits_ptr - number_ptr;
7396 size_t digits_end_offset = digits_end_ptr - number_ptr;
7397 size_t n =
7398 xsum (length,
7399 (count + insert * thousep_len + TCHARS_PER_DCHAR - 1)
7400 / TCHARS_PER_DCHAR);
7401 length += (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR;
7402 ENSURE_ALLOCATION (n);
7403 length -= (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR;
7404 number_ptr = (TCHAR_T *) (result + length);
7405 end_ptr = number_ptr + count;
7406 digits_ptr = number_ptr + digits_offset;
7407 digits_end_ptr = number_ptr + digits_end_offset;
7408# endif
7409
7410 count += insert * thousep_len;
7411
7412 const TCHAR_T *p = end_ptr;
7413 TCHAR_T *q = end_ptr + insert * thousep_len;
7414 while (p > digits_end_ptr)
7415 *--q = *--p;
7416 const signed char *g = grouping;
7417 for (;;)
7418 {
7419 int h = *g;
7420 if (h <= 0)
7421 abort ();
7422 int i = h;
7423 do
7424 *--q = *--p;
7425 while (--i > 0);
7426# if WIDE_CHAR_VERSION && DCHAR_IS_TCHAR
7427 *--q = *thousep;
7428# else
7429 q -= thousep_len;
7430 memcpy (q, thousep, thousep_len);
7431# endif
7432 insert--;
7433 if (insert == 0)
7434 break;
7435 if (g[1] != 0)
7436 g++;
7437 }
7438 /* Here q == p. Done with the insertions. */
7439 }
7440 }
7441 }
7442 break;
7443 }
7444#endif
7445
6594#if !USE_SNPRINTF 7446#if !USE_SNPRINTF
6595 if (count >= tmp_length) 7447 if (count >= tmp_length)
6596 /* tmp_length was incorrectly calculated - fix the 7448 /* tmp_length was incorrectly calculated - fix the
@@ -6601,22 +7453,23 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6601#if !DCHAR_IS_TCHAR 7453#if !DCHAR_IS_TCHAR
6602 /* Convert from TCHAR_T[] to DCHAR_T[]. */ 7454 /* Convert from TCHAR_T[] to DCHAR_T[]. */
6603 if (dp->conversion == 'c' || dp->conversion == 's' 7455 if (dp->conversion == 'c' || dp->conversion == 's'
7456 || (flags & FLAG_GROUP)
6604# if __GLIBC__ >= 2 && !defined __UCLIBC__ 7457# if __GLIBC__ >= 2 && !defined __UCLIBC__
6605 || (flags & FLAG_LOCALIZED) 7458 || (flags & FLAG_LOCALIZED)
6606# endif 7459# endif
6607 ) 7460 )
6608 { 7461 {
6609 /* The result string is not guaranteed to be ASCII. */ 7462 /* The result string is not guaranteed to be ASCII. */
6610 const TCHAR_T *tmpsrc;
6611 DCHAR_T *tmpdst;
6612 size_t tmpdst_len;
6613 /* This code assumes that TCHAR_T is 'char'. */ 7463 /* This code assumes that TCHAR_T is 'char'. */
6614 static_assert (sizeof (TCHAR_T) == 1); 7464 static_assert (sizeof (TCHAR_T) == 1);
7465 const TCHAR_T *tmpsrc;
6615# if USE_SNPRINTF 7466# if USE_SNPRINTF
6616 tmpsrc = (TCHAR_T *) (result + length); 7467 tmpsrc = (TCHAR_T *) (result + length);
6617# else 7468# else
6618 tmpsrc = tmp; 7469 tmpsrc = tmp;
6619# endif 7470# endif
7471 DCHAR_T *tmpdst;
7472 size_t tmpdst_len;
6620# if WIDE_CHAR_VERSION 7473# if WIDE_CHAR_VERSION
6621 /* Convert tmpsrc[0..count-1] to a freshly allocated 7474 /* Convert tmpsrc[0..count-1] to a freshly allocated
6622 wide character array. */ 7475 wide character array. */
@@ -6677,7 +7530,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6677 goto fail_with_errno; 7530 goto fail_with_errno;
6678# endif 7531# endif
6679 ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len), 7532 ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len),
6680 { free (tmpdst); goto out_of_memory; }); 7533 { free (tmpdst); goto out_of_memory; });
6681 DCHAR_CPY (result + length, tmpdst, tmpdst_len); 7534 DCHAR_CPY (result + length, tmpdst, tmpdst_len);
6682 free (tmpdst); 7535 free (tmpdst);
6683 count = tmpdst_len; 7536 count = tmpdst_len;
@@ -6694,9 +7547,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6694# endif 7547# endif
6695 { 7548 {
6696 const TCHAR_T *tmpsrc; 7549 const TCHAR_T *tmpsrc;
6697 DCHAR_T *tmpdst;
6698 size_t n;
6699
6700# if USE_SNPRINTF 7550# if USE_SNPRINTF
6701 if (result == resultbuf) 7551 if (result == resultbuf)
6702 { 7552 {
@@ -6716,11 +7566,11 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6716 tmpsrc = tmp; 7566 tmpsrc = tmp;
6717 ENSURE_ALLOCATION (xsum (length, count)); 7567 ENSURE_ALLOCATION (xsum (length, count));
6718# endif 7568# endif
6719 tmpdst = result + length; 7569 DCHAR_T *tmpdst = result + length;
6720 /* Copy backwards, because of overlapping. */ 7570 /* Copy backwards, because of overlapping. */
6721 tmpsrc += count; 7571 tmpsrc += count;
6722 tmpdst += count; 7572 tmpdst += count;
6723 for (n = count; n > 0; n--) 7573 for (size_t n = count; n > 0; n--)
6724 *--tmpdst = *--tmpsrc; 7574 *--tmpdst = *--tmpsrc;
6725 } 7575 }
6726 } 7576 }
@@ -6742,7 +7592,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6742 /* Here count <= allocated - length. */ 7592 /* Here count <= allocated - length. */
6743 7593
6744 /* Perform padding. */ 7594 /* Perform padding. */
6745#if (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION 7595#if (WIDE_CHAR_VERSION && MUSL_LIBC) || NEED_PRINTF_FLAG_LEFTADJUST || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION || NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT
6746 if (pad_ourselves && has_width) 7596 if (pad_ourselves && has_width)
6747 { 7597 {
6748 size_t w; 7598 size_t w;
@@ -6751,6 +7601,23 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6751 against the number of _characters_ of the converted 7601 against the number of _characters_ of the converted
6752 value. */ 7602 value. */
6753 w = DCHAR_MBSNLEN (result + length, count); 7603 w = DCHAR_MBSNLEN (result + length, count);
7604# elif __GLIBC__ >= 2
7605 /* glibc prefers to compare the width against the number
7606 of characters as well, but only for numeric conversion
7607 specifiers. See
7608 <https://sourceware.org/PR28943>
7609 <https://sourceware.org/PR30883>
7610 <https://sourceware.org/PR31542> */
7611 switch (dp->conversion)
7612 {
7613 case 'd': case 'i': case 'u':
7614 case 'f': case 'F': case 'g': case 'G':
7615 w = DCHAR_MBSNLEN (result + length, count);
7616 break;
7617 default:
7618 w = count;
7619 break;
7620 }
6754# else 7621# else
6755 /* The width is compared against the number of _bytes_ 7622 /* The width is compared against the number of _bytes_
6756 of the converted value, says POSIX. */ 7623 of the converted value, says POSIX. */
@@ -6888,8 +7755,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6888 { 7755 {
6889 /* Convert the %f result to upper case for %F. */ 7756 /* Convert the %f result to upper case for %F. */
6890 DCHAR_T *rp = result + length; 7757 DCHAR_T *rp = result + length;
6891 size_t rc; 7758 for (size_t rc = count; rc > 0; rc--, rp++)
6892 for (rc = count; rc > 0; rc--, rp++)
6893 if (*rp >= 'a' && *rp <= 'z') 7759 if (*rp >= 'a' && *rp <= 'z')
6894 *rp = *rp - 'a' + 'A'; 7760 *rp = *rp - 'a' + 'A';
6895 } 7761 }
@@ -6912,9 +7778,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6912 if (result != resultbuf && length + 1 < allocated) 7778 if (result != resultbuf && length + 1 < allocated)
6913 { 7779 {
6914 /* Shrink the allocated memory if possible. */ 7780 /* Shrink the allocated memory if possible. */
6915 DCHAR_T *memory; 7781 DCHAR_T *memory =
6916 7782 (DCHAR_T *) realloc (result, (length + 1) * sizeof (DCHAR_T));
6917 memory = (DCHAR_T *) realloc (result, (length + 1) * sizeof (DCHAR_T));
6918 if (memory != NULL) 7783 if (memory != NULL)
6919 result = memory; 7784 result = memory;
6920 } 7785 }
@@ -6929,17 +7794,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6929 not have this limitation. */ 7794 not have this limitation. */
6930 return result; 7795 return result;
6931 7796
6932#if USE_SNPRINTF
6933 overflow: 7797 overflow:
6934 errno = EOVERFLOW; 7798 errno = EOVERFLOW;
6935 goto fail_with_errno; 7799 goto fail_with_errno;
6936#endif
6937 7800
6938 out_of_memory: 7801 out_of_memory:
6939 errno = ENOMEM; 7802 errno = ENOMEM;
6940 goto fail_with_errno; 7803 goto fail_with_errno;
6941 7804
6942#if ENABLE_UNISTDIO || ((!USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS || ENABLE_WCHAR_FALLBACK) && HAVE_WCHAR_T) || ((NEED_PRINTF_DIRECTIVE_LC || ENABLE_WCHAR_FALLBACK) && HAVE_WINT_T && !WIDE_CHAR_VERSION) || (NEED_WPRINTF_DIRECTIVE_C && WIDE_CHAR_VERSION) 7805#if ENABLE_UNISTDIO || (WIDE_CHAR_VERSION || !USE_SNPRINTF || (PTRDIFF_MAX > INT_MAX) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || NEED_PRINTF_DIRECTIVE_LS || ENABLE_WCHAR_FALLBACK) || ((NEED_PRINTF_DIRECTIVE_LC || ENABLE_WCHAR_FALLBACK) && HAVE_WINT_T && !WIDE_CHAR_VERSION) || (NEED_WPRINTF_DIRECTIVE_C && WIDE_CHAR_VERSION)
6943 fail_with_EILSEQ: 7806 fail_with_EILSEQ:
6944 errno = EILSEQ; 7807 errno = EILSEQ;
6945 goto fail_with_errno; 7808 goto fail_with_errno;
diff --git a/gl/vasnprintf.h b/gl/vasnprintf.h
index 7ed9145c..27b9585b 100644
--- a/gl/vasnprintf.h
+++ b/gl/vasnprintf.h
@@ -1,5 +1,5 @@
1/* vsprintf with automatic memory allocation. 1/* vsprintf with automatic memory allocation.
2 Copyright (C) 2002-2004, 2007-2024 Free Software Foundation, Inc. 2 Copyright (C) 2002-2004, 2007-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/vasprintf.c b/gl/vasprintf.c
index e52aaca5..a22305b8 100644
--- a/gl/vasprintf.c
+++ b/gl/vasprintf.c
@@ -1,5 +1,5 @@
1/* Formatted output to strings. 1/* Formatted output to strings.
2 Copyright (C) 1999, 2002, 2006-2024 Free Software Foundation, Inc. 2 Copyright (C) 1999, 2002, 2006-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -25,6 +25,7 @@
25 25
26#include <errno.h> 26#include <errno.h>
27#include <limits.h> 27#include <limits.h>
28#include <stdint.h>
28#include <stdlib.h> 29#include <stdlib.h>
29 30
30#include "vasnprintf.h" 31#include "vasnprintf.h"
@@ -37,12 +38,21 @@ vasprintf (char **resultp, const char *format, va_list args)
37 if (result == NULL) 38 if (result == NULL)
38 return -1; 39 return -1;
39 40
41#if PTRDIFF_MAX > INT_MAX
40 if (length > INT_MAX) 42 if (length > INT_MAX)
41 { 43 {
42 free (result); 44 free (result);
43 errno = EOVERFLOW; 45 errno = (length > PTRDIFF_MAX ? ENOMEM : EOVERFLOW);
44 return -1; 46 return -1;
45 } 47 }
48#else
49 if (length > PTRDIFF_MAX)
50 {
51 free (result);
52 errno = ENOMEM;
53 return -1;
54 }
55#endif
46 56
47 *resultp = result; 57 *resultp = result;
48 /* Return the number of resulting bytes, excluding the trailing NUL. */ 58 /* Return the number of resulting bytes, excluding the trailing NUL. */
diff --git a/gl/verify.h b/gl/verify.h
index 08268c24..ad45c39d 100644
--- a/gl/verify.h
+++ b/gl/verify.h
@@ -1,6 +1,6 @@
1/* Compile-time assert-like macros. 1/* Compile-time assert-like macros.
2 2
3 Copyright (C) 2005-2006, 2009-2024 Free Software Foundation, Inc. 3 Copyright (C) 2005-2006, 2009-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -34,11 +34,12 @@
34#ifndef __cplusplus 34#ifndef __cplusplus
35# if (201112 <= __STDC_VERSION__ \ 35# if (201112 <= __STDC_VERSION__ \
36 || (!defined __STRICT_ANSI__ \ 36 || (!defined __STRICT_ANSI__ \
37 && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || 5 <= __clang_major__))) 37 && ((4 < __GNUC__ + (6 <= __GNUC_MINOR__) && !defined __clang__) \
38 || 5 <= __clang_major__)))
38# define _GL_HAVE__STATIC_ASSERT 1 39# define _GL_HAVE__STATIC_ASSERT 1
39# endif 40# endif
40# if (202311 <= __STDC_VERSION__ \ 41# if (202311 <= __STDC_VERSION__ \
41 || (!defined __STRICT_ANSI__ && 9 <= __GNUC__)) 42 || (!defined __STRICT_ANSI__ && 9 <= __GNUC__ && !defined __clang__))
42# define _GL_HAVE__STATIC_ASSERT1 1 43# define _GL_HAVE__STATIC_ASSERT1 1
43# endif 44# endif
44#endif 45#endif
@@ -156,9 +157,10 @@
156#define _GL_CONCAT0(x, y) x##y 157#define _GL_CONCAT0(x, y) x##y
157 158
158/* _GL_COUNTER is an integer, preferably one that changes each time we 159/* _GL_COUNTER is an integer, preferably one that changes each time we
159 use it. Use __COUNTER__ if it works, falling back on __LINE__ 160 use it. Use __COUNTER__ if it works (it does so with most compilers,
160 otherwise. __LINE__ isn't perfect, but it's better than a 161 see <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3457.htm>),
161 constant. */ 162 falling back on __LINE__ otherwise. __LINE__ isn't perfect, but it's
163 better than a constant. */
162#if defined __COUNTER__ && __COUNTER__ != __COUNTER__ 164#if defined __COUNTER__ && __COUNTER__ != __COUNTER__
163# define _GL_COUNTER __COUNTER__ 165# define _GL_COUNTER __COUNTER__
164#else 166#else
@@ -215,7 +217,7 @@ template <int w>
215# define _GL_VERIFY(R, DIAGNOSTIC, ...) \ 217# define _GL_VERIFY(R, DIAGNOSTIC, ...) \
216 extern int (*_GL_GENSYM (_gl_verify_function) (void)) \ 218 extern int (*_GL_GENSYM (_gl_verify_function) (void)) \
217 [_GL_VERIFY_TRUE (R, DIAGNOSTIC)] 219 [_GL_VERIFY_TRUE (R, DIAGNOSTIC)]
218# if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) 220# if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) && !defined __clang__
219# pragma GCC diagnostic ignored "-Wnested-externs" 221# pragma GCC diagnostic ignored "-Wnested-externs"
220# endif 222# endif
221#endif 223#endif
@@ -254,16 +256,32 @@ template <int w>
254# endif 256# endif
255# endif 257# endif
256/* Define static_assert if needed. */ 258/* Define static_assert if needed. */
259# if defined __cplusplus && defined __clang__ && __clang_major__ < 9
260/* clang++ before commit 5c739665a8721228cf6143fd4ef95870a59f55ae had a
261 two-arguments static_assert but not the one-argument static_assert. */
262# undef static_assert
263# endif
257# if (!defined static_assert \ 264# if (!defined static_assert \
258 && __STDC_VERSION__ < 202311 \ 265 && __STDC_VERSION__ < 202311 \
259 && (!defined __cplusplus \ 266 && (!defined __cplusplus \
260 || (__cpp_static_assert < 201411 \ 267 || (__cpp_static_assert < 201411 \
261 && __GNUG__ < 6 && __clang_major__ < 6 && _MSC_VER < 1910))) 268 && __GNUG__ < 6 && __clang_major__ < 6 && _MSC_VER < 1910)))
262# if defined __cplusplus && _MSC_VER >= 1900 && !defined __clang__ 269# if (defined __cplusplus && defined __GNUG__ && __GNUG__ < 6 \
270 && __cplusplus == 201103L && !defined __clang__)
271/* g++ >= 4.7, < 6 with option -std=c++11 or -std=gnu++11 supports the
272 two-arguments static_assert but not the one-argument static_assert, and
273 it does not support _Static_assert.
274 We have to play preprocessor tricks to distinguish the two cases. */
275# define _GL_SA1(a1) static_assert ((a1), "static assertion failed")
276# define _GL_SA2 static_assert
277# define _GL_SA3 static_assert
278# define _GL_SA_PICK(x1,x2,x3,x4,...) x4
279# define static_assert(...) _GL_SA_PICK(__VA_ARGS__,_GL_SA3,_GL_SA2,_GL_SA1) (__VA_ARGS__)
280# elif defined __cplusplus && _MSC_VER >= 1900 && !defined __clang__
263/* MSVC 14 in C++ mode supports the two-arguments static_assert but not 281/* MSVC 14 in C++ mode supports the two-arguments static_assert but not
264 the one-argument static_assert, and it does not support _Static_assert. 282 the one-argument static_assert, and it does not support _Static_assert.
265 We have to play preprocessor tricks to distinguish the two cases. 283 We have to play preprocessor tricks to distinguish the two cases.
266 Since the MSVC preprocessor is not ISO C compliant (see above),. 284 Since the MSVC preprocessor is not ISO C compliant (see above),
267 the solution is specific to MSVC. */ 285 the solution is specific to MSVC. */
268# define _GL_EXPAND(x) x 286# define _GL_EXPAND(x) x
269# define _GL_SA1(a1) static_assert ((a1), "static assertion failed") 287# define _GL_SA1(a1) static_assert ((a1), "static assertion failed")
@@ -294,7 +312,7 @@ template <int w>
294#ifndef _GL_HAS_BUILTIN_UNREACHABLE 312#ifndef _GL_HAS_BUILTIN_UNREACHABLE
295# if defined __clang_major__ && __clang_major__ < 5 313# if defined __clang_major__ && __clang_major__ < 5
296# define _GL_HAS_BUILTIN_UNREACHABLE 0 314# define _GL_HAS_BUILTIN_UNREACHABLE 0
297# elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__) 315# elif 4 < __GNUC__ + (5 <= __GNUC_MINOR__) && !defined __clang__
298# define _GL_HAS_BUILTIN_UNREACHABLE 1 316# define _GL_HAS_BUILTIN_UNREACHABLE 1
299# elif defined __has_builtin 317# elif defined __has_builtin
300# define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable) 318# define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable)
diff --git a/gl/vsnprintf.c b/gl/vsnprintf.c
index e6676a1f..444562e6 100644
--- a/gl/vsnprintf.c
+++ b/gl/vsnprintf.c
@@ -1,6 +1,5 @@
1/* Formatted output to strings. 1/* Formatted output to strings.
2 Copyright (C) 2004, 2006-2024 Free Software Foundation, Inc. 2 Copyright (C) 2004, 2006-2026 Free Software Foundation, Inc.
3 Written by Simon Josefsson and Yoann Vandoorselaere <yoann@prelude-ids.org>.
4 3
5 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -25,46 +24,20 @@
25#include <errno.h> 24#include <errno.h>
26#include <limits.h> 25#include <limits.h>
27#include <stdarg.h> 26#include <stdarg.h>
28#include <stdlib.h> 27#include <stdint.h>
29#include <string.h>
30 28
31#include "vasnprintf.h"
32
33/* Print formatted output to string STR. Similar to vsprintf, but
34 additional length SIZE limit how much is written into STR. Returns
35 string length of formatted string (which may be larger than SIZE).
36 STR may be NULL, in which case nothing will be written. On error,
37 return a negative value. */
38int 29int
39vsnprintf (char *str, size_t size, const char *format, va_list args) 30vsnprintf (char *str, size_t size, const char *format, va_list args)
40{ 31{
41 char *output; 32 ptrdiff_t ret = vsnzprintf (str, size, format, args);
42 size_t len;
43 size_t lenbuf = size;
44
45 output = vasnprintf (str, &lenbuf, format, args);
46 len = lenbuf;
47
48 if (!output)
49 return -1;
50
51 if (output != str)
52 {
53 if (size)
54 {
55 size_t pruned_len = (len < size ? len : size - 1);
56 memcpy (str, output, pruned_len);
57 str[pruned_len] = '\0';
58 }
59
60 free (output);
61 }
62 33
63 if (len > INT_MAX) 34#if PTRDIFF_MAX > INT_MAX
35 if (ret > INT_MAX)
64 { 36 {
65 errno = EOVERFLOW; 37 errno = EOVERFLOW;
66 return -1; 38 return -1;
67 } 39 }
40#endif
68 41
69 return len; 42 return ret;
70} 43}
diff --git a/gl/vsnzprintf.c b/gl/vsnzprintf.c
new file mode 100644
index 00000000..0d35195f
--- /dev/null
+++ b/gl/vsnzprintf.c
@@ -0,0 +1,62 @@
1/* Formatted output to strings.
2 Copyright (C) 2004, 2006-2026 Free Software Foundation, Inc.
3 Written by Simon Josefsson and Yoann Vandoorselaere <yoann@prelude-ids.org>.
4
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17
18#ifdef HAVE_CONFIG_H
19# include <config.h>
20#endif
21
22/* Specification. */
23#include <stdio.h>
24
25#include <errno.h>
26#include <stdarg.h>
27#include <stdint.h>
28#include <stdlib.h>
29#include <string.h>
30
31#include "vasnprintf.h"
32
33ptrdiff_t
34vsnzprintf (char *str, size_t size, const char *format, va_list args)
35{
36 size_t lenbuf = size;
37 char *output = vasnprintf (str, &lenbuf, format, args);
38 size_t len = lenbuf;
39
40 if (!output)
41 return -1;
42
43 if (output != str)
44 {
45 if (size)
46 {
47 size_t pruned_len = (len < size ? len : size - 1);
48 memcpy (str, output, pruned_len);
49 str[pruned_len] = '\0';
50 }
51
52 free (output);
53 }
54
55 if (len > PTRDIFF_MAX)
56 {
57 errno = ENOMEM;
58 return -1;
59 }
60
61 return len;
62}
diff --git a/gl/w32sock.h b/gl/w32sock.h
index 166a5f77..a3201ad9 100644
--- a/gl/w32sock.h
+++ b/gl/w32sock.h
@@ -1,6 +1,6 @@
1/* w32sock.h --- internal auxiliary functions for Windows socket functions 1/* w32sock.h --- internal auxiliary functions for Windows socket functions
2 2
3 Copyright (C) 2008-2024 Free Software Foundation, Inc. 3 Copyright (C) 2008-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/warn-on-use.h b/gl/warn-on-use.h
index 701013a0..97f36ea2 100644
--- a/gl/warn-on-use.h
+++ b/gl/warn-on-use.h
@@ -1,5 +1,5 @@
1/* A C macro for emitting warnings if a function is used. 1/* A C macro for emitting warnings if a function is used.
2 Copyright (C) 2010-2024 Free Software Foundation, Inc. 2 Copyright (C) 2010-2026 Free Software Foundation, Inc.
3 3
4 This program is free software: you can redistribute it and/or modify it 4 This program is free software: you can redistribute it and/or modify it
5 under the terms of the GNU Lesser General Public License as published 5 under the terms of the GNU Lesser General Public License as published
@@ -85,7 +85,7 @@
85 */ 85 */
86#ifndef _GL_WARN_ON_USE 86#ifndef _GL_WARN_ON_USE
87 87
88# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 88# if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__
89/* A compiler attribute is available in gcc versions 4.3.0 and later. */ 89/* A compiler attribute is available in gcc versions 4.3.0 and later. */
90# define _GL_WARN_ON_USE(function, message) \ 90# define _GL_WARN_ON_USE(function, message) \
91_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message))) 91_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message)))
@@ -98,7 +98,7 @@ _GL_WARN_EXTERN_C __typeof__ (function) function \
98 __attribute__ ((__diagnose_if__ (1, message, "warning"))) 98 __attribute__ ((__diagnose_if__ (1, message, "warning")))
99# define _GL_WARN_ON_USE_ATTRIBUTE(message) \ 99# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
100 __attribute__ ((__diagnose_if__ (1, message, "warning"))) 100 __attribute__ ((__diagnose_if__ (1, message, "warning")))
101# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 101# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING
102/* Verify the existence of the function. */ 102/* Verify the existence of the function. */
103# define _GL_WARN_ON_USE(function, message) \ 103# define _GL_WARN_ON_USE(function, message) \
104_GL_WARN_EXTERN_C __typeof__ (function) function 104_GL_WARN_EXTERN_C __typeof__ (function) function
@@ -121,7 +121,7 @@ _GL_WARN_EXTERN_C int _gl_warn_on_use
121# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 121# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
122 _GL_WARN_ON_USE (function, msg) 122 _GL_WARN_ON_USE (function, msg)
123# else 123# else
124# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 124# if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__
125/* A compiler attribute is available in gcc versions 4.3.0 and later. */ 125/* A compiler attribute is available in gcc versions 4.3.0 and later. */
126# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 126# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
127extern rettype_gcc function parameters_and_attributes \ 127extern rettype_gcc function parameters_and_attributes \
@@ -131,7 +131,7 @@ extern rettype_gcc function parameters_and_attributes \
131# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 131# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
132extern rettype_clang function parameters_and_attributes \ 132extern rettype_clang function parameters_and_attributes \
133 __attribute__ ((__diagnose_if__ (1, msg, "warning"))) 133 __attribute__ ((__diagnose_if__ (1, msg, "warning")))
134# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 134# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING
135/* Verify the existence of the function. */ 135/* Verify the existence of the function. */
136# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ 136# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
137extern rettype_gcc function parameters_and_attributes 137extern rettype_gcc function parameters_and_attributes
diff --git a/gl/wchar.in.h b/gl/wchar.in.h
index a33a10f7..a60a4dfc 100644
--- a/gl/wchar.in.h
+++ b/gl/wchar.in.h
@@ -1,6 +1,6 @@
1/* A substitute for ISO C99 <wchar.h>, for platforms that have issues. 1/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
2 2
3 Copyright (C) 2007-2024 Free Software Foundation, Inc. 3 Copyright (C) 2007-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -36,8 +36,7 @@
36 && ((defined _INTTYPES_INCLUDED \ 36 && ((defined _INTTYPES_INCLUDED \
37 && !defined _GL_FINISHED_INCLUDING_SYSTEM_INTTYPES_H) \ 37 && !defined _GL_FINISHED_INCLUDING_SYSTEM_INTTYPES_H) \
38 || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) \ 38 || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) \
39 || (defined __MINGW32__ && defined __STRING_H_SOURCED__) \ 39 || (defined __MINGW32__ && defined __STRING_H_SOURCED__))
40 || defined _GL_ALREADY_INCLUDING_WCHAR_H)
41/* Special invocation convention: 40/* Special invocation convention:
42 - Inside glibc and uClibc header files, but not MinGW. 41 - Inside glibc and uClibc header files, but not MinGW.
43 - On HP-UX 11.00 we have a sequence of nested includes 42 - On HP-UX 11.00 we have a sequence of nested includes
@@ -47,20 +46,18 @@
47 therefore we cannot provide the function overrides; instead include only 46 therefore we cannot provide the function overrides; instead include only
48 the system's <wchar.h>. 47 the system's <wchar.h>.
49 - With MinGW 3.22, when <string.h> includes <wchar.h>, only some part of 48 - With MinGW 3.22, when <string.h> includes <wchar.h>, only some part of
50 <wchar.h> is actually processed, and that doesn't include 'mbstate_t'. 49 <wchar.h> is actually processed, and that doesn't include 'mbstate_t'. */
51 - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and
52 the latter includes <wchar.h>. But here, we have no way to detect whether
53 <wctype.h> is completely included or is still being included. */
54 50
55#@INCLUDE_NEXT@ @NEXT_WCHAR_H@ 51#@INCLUDE_NEXT@ @NEXT_WCHAR_H@
52/* The glibc 2.5 /usr/include/wchar.h defines __need_wint_t but never undefines
53 it. We need to do that here. */
54#undef __need_wint_t
56 55
57#else 56#else
58/* Normal invocation convention. */ 57/* Normal invocation convention. */
59 58
60#ifndef _@GUARD_PREFIX@_WCHAR_H 59#ifndef _@GUARD_PREFIX@_WCHAR_H
61 60
62#define _GL_ALREADY_INCLUDING_WCHAR_H
63
64#if @HAVE_FEATURES_H@ 61#if @HAVE_FEATURES_H@
65# include <features.h> /* for __GLIBC__ */ 62# include <features.h> /* for __GLIBC__ */
66#endif 63#endif
@@ -79,8 +76,6 @@
79# @INCLUDE_NEXT@ @NEXT_WCHAR_H@ 76# @INCLUDE_NEXT@ @NEXT_WCHAR_H@
80#endif 77#endif
81 78
82#undef _GL_ALREADY_INCLUDING_WCHAR_H
83
84#ifndef _@GUARD_PREFIX@_WCHAR_H 79#ifndef _@GUARD_PREFIX@_WCHAR_H
85#define _@GUARD_PREFIX@_WCHAR_H 80#define _@GUARD_PREFIX@_WCHAR_H
86 81
@@ -95,7 +90,7 @@
95 that can be freed by passing them as the Ith argument to the 90 that can be freed by passing them as the Ith argument to the
96 function F. */ 91 function F. */
97#ifndef _GL_ATTRIBUTE_DEALLOC 92#ifndef _GL_ATTRIBUTE_DEALLOC
98# if __GNUC__ >= 11 93# if __GNUC__ >= 11 && !defined __clang__
99# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) 94# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
100# else 95# else
101# define _GL_ATTRIBUTE_DEALLOC(f, i) 96# define _GL_ATTRIBUTE_DEALLOC(f, i)
@@ -107,7 +102,7 @@
107/* Applies to: functions. Cannot be used on inline functions. */ 102/* Applies to: functions. Cannot be used on inline functions. */
108#ifndef _GL_ATTRIBUTE_DEALLOC_FREE 103#ifndef _GL_ATTRIBUTE_DEALLOC_FREE
109# if defined __cplusplus && defined __GNUC__ && !defined __clang__ 104# if defined __cplusplus && defined __GNUC__ && !defined __clang__
110/* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231> */ 105/* Work around GCC bug <https://gcc.gnu.org/PR108231> */
111# define _GL_ATTRIBUTE_DEALLOC_FREE \ 106# define _GL_ATTRIBUTE_DEALLOC_FREE \
112 _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1) 107 _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1)
113# else 108# else
@@ -137,11 +132,23 @@
137# endif 132# endif
138#endif 133#endif
139 134
135/* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP
136 (a pointer) must not be NULL if the argument NI (an integer) is != 0. */
137/* Applies to: functions. */
138#ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO
139# if __GNUC__ >= 15 && !defined __clang__
140# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) \
141 __attribute__ ((__nonnull_if_nonzero__ (np, ni)))
142# else
143# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni)
144# endif
145#endif
146
140/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. 147/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
141 */ 148 */
142#ifndef _GL_ATTRIBUTE_NOTHROW 149#ifndef _GL_ATTRIBUTE_NOTHROW
143# if defined __cplusplus 150# if defined __cplusplus
144# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 151# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
145# if __cplusplus >= 201103L 152# if __cplusplus >= 201103L
146# define _GL_ATTRIBUTE_NOTHROW noexcept (true) 153# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
147# else 154# else
@@ -196,17 +203,11 @@ typedef unsigned int rpl_wint_t;
196 203
197 204
198/* Override mbstate_t if it is too small. 205/* Override mbstate_t if it is too small.
199 On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for 206 On AIX, MSVC, and OpenBSD 6.0, mbrtowc needs to be overridden, but
200 implementing mbrtowc for encodings like UTF-8. 207 mbstate_t exists and is large enough and overriding it would cause problems
201 On AIX and MSVC, mbrtowc needs to be overridden, but mbstate_t exists and is 208 in C++ mode. */
202 large enough and overriding it would cause problems in C++ mode. */
203#if !(((defined _WIN32 && !defined __CYGWIN__) || @HAVE_MBSINIT@) && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@ 209#if !(((defined _WIN32 && !defined __CYGWIN__) || @HAVE_MBSINIT@) && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
204# if !GNULIB_defined_mbstate_t 210# if !GNULIB_defined_mbstate_t
205# if !(defined _AIX || defined _MSC_VER)
206typedef int rpl_mbstate_t;
207# undef mbstate_t
208# define mbstate_t rpl_mbstate_t
209# endif
210# define GNULIB_defined_mbstate_t 1 211# define GNULIB_defined_mbstate_t 1
211# endif 212# endif
212#endif 213#endif
@@ -262,6 +263,55 @@ _GL_EXTERN_C void free (void *);
262#endif 263#endif
263 264
264 265
266/* Declarations for ISO C N3322. */
267#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
268_GL_EXTERN_C wchar_t *wmemcpy (wchar_t *__dest, const wchar_t *__src, size_t __n)
269# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
270 _GL_ATTRIBUTE_NOTHROW
271# endif
272 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
273 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
274_GL_EXTERN_C wchar_t *wmemmove (wchar_t *__dest, const wchar_t *__src, size_t __n)
275# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
276 _GL_ATTRIBUTE_NOTHROW
277# endif
278 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
279 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
280_GL_EXTERN_C wchar_t *wcsncpy (wchar_t *__dest, const wchar_t *__src, size_t __n)
281# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
282 _GL_ATTRIBUTE_NOTHROW
283# endif
284 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
285 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
286_GL_EXTERN_C wchar_t *wcsncat (wchar_t *__dest, const wchar_t *__src, size_t __n)
287# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
288 _GL_ATTRIBUTE_NOTHROW
289# endif
290 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
291_GL_EXTERN_C int wmemcmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
292# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
293 _GL_ATTRIBUTE_NOTHROW
294# endif
295 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
296 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
297_GL_EXTERN_C int wcsncmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
298# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
299 _GL_ATTRIBUTE_NOTHROW
300# endif
301 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
302 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
303# ifndef __cplusplus
304_GL_EXTERN_C wchar_t *(wmemchr) (const wchar_t *__s, wchar_t __wc, size_t __n)
305 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3);
306# endif
307_GL_EXTERN_C wchar_t *wmemset (wchar_t *__s, wchar_t __wc, size_t __n)
308# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
309 _GL_ATTRIBUTE_NOTHROW
310# endif
311 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3);
312#endif
313
314
265/* Convert a single-byte character to a wide character. */ 315/* Convert a single-byte character to a wide character. */
266#if @GNULIB_BTOWC@ 316#if @GNULIB_BTOWC@
267# if @REPLACE_BTOWC@ 317# if @REPLACE_BTOWC@
@@ -269,11 +319,11 @@ _GL_EXTERN_C void free (void *);
269# undef btowc 319# undef btowc
270# define btowc rpl_btowc 320# define btowc rpl_btowc
271# endif 321# endif
272_GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); 322_GL_FUNCDECL_RPL (btowc, wint_t, (int c), _GL_ATTRIBUTE_PURE);
273_GL_CXXALIAS_RPL (btowc, wint_t, (int c)); 323_GL_CXXALIAS_RPL (btowc, wint_t, (int c));
274# else 324# else
275# if !@HAVE_BTOWC@ 325# if !@HAVE_BTOWC@
276_GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); 326_GL_FUNCDECL_SYS (btowc, wint_t, (int c), _GL_ATTRIBUTE_PURE);
277# endif 327# endif
278/* Need to cast, because on mingw, the return type is 'unsigned short'. */ 328/* Need to cast, because on mingw, the return type is 'unsigned short'. */
279_GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c)); 329_GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c));
@@ -282,7 +332,6 @@ _GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c));
282_GL_CXXALIASWARN (btowc); 332_GL_CXXALIASWARN (btowc);
283# endif 333# endif
284#elif defined GNULIB_POSIXCHECK 334#elif defined GNULIB_POSIXCHECK
285# undef btowc
286# if HAVE_RAW_DECL_BTOWC 335# if HAVE_RAW_DECL_BTOWC
287_GL_WARN_ON_USE (btowc, "btowc is unportable - " 336_GL_WARN_ON_USE (btowc, "btowc is unportable - "
288 "use gnulib module btowc for portability"); 337 "use gnulib module btowc for portability");
@@ -297,12 +346,12 @@ _GL_WARN_ON_USE (btowc, "btowc is unportable - "
297# undef wctob 346# undef wctob
298# define wctob rpl_wctob 347# define wctob rpl_wctob
299# endif 348# endif
300_GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE); 349_GL_FUNCDECL_RPL (wctob, int, (wint_t wc), _GL_ATTRIBUTE_PURE);
301_GL_CXXALIAS_RPL (wctob, int, (wint_t wc)); 350_GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
302# else 351# else
303# if !defined wctob && !@HAVE_DECL_WCTOB@ 352# if !defined wctob && !@HAVE_WCTOB@
304/* wctob is provided by gnulib, or wctob exists but is not declared. */ 353/* wctob is provided by gnulib. */
305_GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE); 354_GL_FUNCDECL_SYS (wctob, int, (wint_t wc), _GL_ATTRIBUTE_PURE);
306# endif 355# endif
307_GL_CXXALIAS_SYS (wctob, int, (wint_t wc)); 356_GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
308# endif 357# endif
@@ -310,7 +359,6 @@ _GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
310_GL_CXXALIASWARN (wctob); 359_GL_CXXALIASWARN (wctob);
311# endif 360# endif
312#elif defined GNULIB_POSIXCHECK 361#elif defined GNULIB_POSIXCHECK
313# undef wctob
314# if HAVE_RAW_DECL_WCTOB 362# if HAVE_RAW_DECL_WCTOB
315_GL_WARN_ON_USE (wctob, "wctob is unportable - " 363_GL_WARN_ON_USE (wctob, "wctob is unportable - "
316 "use gnulib module wctob for portability"); 364 "use gnulib module wctob for portability");
@@ -325,11 +373,11 @@ _GL_WARN_ON_USE (wctob, "wctob is unportable - "
325# undef mbsinit 373# undef mbsinit
326# define mbsinit rpl_mbsinit 374# define mbsinit rpl_mbsinit
327# endif 375# endif
328_GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps)); 376_GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps), );
329_GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps)); 377_GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps));
330# else 378# else
331# if !@HAVE_MBSINIT@ 379# if !@HAVE_MBSINIT@
332_GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps)); 380_GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps), );
333# endif 381# endif
334_GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps)); 382_GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
335# endif 383# endif
@@ -337,7 +385,6 @@ _GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
337_GL_CXXALIASWARN (mbsinit); 385_GL_CXXALIASWARN (mbsinit);
338# endif 386# endif
339#elif defined GNULIB_POSIXCHECK 387#elif defined GNULIB_POSIXCHECK
340# undef mbsinit
341# if HAVE_RAW_DECL_MBSINIT 388# if HAVE_RAW_DECL_MBSINIT
342_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - " 389_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
343 "use gnulib module mbsinit for portability"); 390 "use gnulib module mbsinit for portability");
@@ -378,7 +425,7 @@ _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
378 without considering what mbsinit() does, we get test failures such as 425 without considering what mbsinit() does, we get test failures such as
379 assertion "mbsinit (&iter->state)" failed 426 assertion "mbsinit (&iter->state)" failed
380 */ 427 */
381# if GNULIB_defined_mbstate_t /* AIX, IRIX */ 428# if GNULIB_defined_mbstate_t /* AIX */
382/* mbstate_t has at least 4 bytes. They are used as coded in 429/* mbstate_t has at least 4 bytes. They are used as coded in
383 gnulib/lib/mbrtowc.c. */ 430 gnulib/lib/mbrtowc.c. */
384# define _GL_MBSTATE_INIT_SIZE 1 431# define _GL_MBSTATE_INIT_SIZE 1
@@ -531,16 +578,19 @@ _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
531# define _GL_MBSTATE_ZERO_SIZE sizeof (mbstate_t) 578# define _GL_MBSTATE_ZERO_SIZE sizeof (mbstate_t)
532# endif 579# endif
533_GL_BEGIN_C_LINKAGE 580_GL_BEGIN_C_LINKAGE
534# if defined IN_MBSZERO 581# if !GNULIB_defined_mbszero
582# if defined IN_MBSZERO
535_GL_EXTERN_INLINE 583_GL_EXTERN_INLINE
536# else 584# else
537_GL_INLINE 585_GL_INLINE
538# endif 586# endif
539_GL_ARG_NONNULL ((1)) void 587_GL_ARG_NONNULL ((1)) void
540mbszero (mbstate_t *ps) 588mbszero (mbstate_t *ps)
541{ 589{
542 memset (ps, 0, _GL_MBSTATE_ZERO_SIZE); 590 memset (ps, 0, _GL_MBSTATE_ZERO_SIZE);
543} 591}
592# define GNULIB_defined_mbszero 1
593# endif
544_GL_END_C_LINKAGE 594_GL_END_C_LINKAGE
545_GL_CXXALIAS_SYS (mbszero, void, (mbstate_t *ps)); 595_GL_CXXALIAS_SYS (mbszero, void, (mbstate_t *ps));
546_GL_CXXALIASWARN (mbszero); 596_GL_CXXALIASWARN (mbszero);
@@ -556,7 +606,7 @@ _GL_CXXALIASWARN (mbszero);
556# endif 606# endif
557_GL_FUNCDECL_RPL (mbrtowc, size_t, 607_GL_FUNCDECL_RPL (mbrtowc, size_t,
558 (wchar_t *restrict pwc, const char *restrict s, size_t n, 608 (wchar_t *restrict pwc, const char *restrict s, size_t n,
559 mbstate_t *restrict ps)); 609 mbstate_t *restrict ps), );
560_GL_CXXALIAS_RPL (mbrtowc, size_t, 610_GL_CXXALIAS_RPL (mbrtowc, size_t,
561 (wchar_t *restrict pwc, const char *restrict s, size_t n, 611 (wchar_t *restrict pwc, const char *restrict s, size_t n,
562 mbstate_t *restrict ps)); 612 mbstate_t *restrict ps));
@@ -564,7 +614,7 @@ _GL_CXXALIAS_RPL (mbrtowc, size_t,
564# if !@HAVE_MBRTOWC@ 614# if !@HAVE_MBRTOWC@
565_GL_FUNCDECL_SYS (mbrtowc, size_t, 615_GL_FUNCDECL_SYS (mbrtowc, size_t,
566 (wchar_t *restrict pwc, const char *restrict s, size_t n, 616 (wchar_t *restrict pwc, const char *restrict s, size_t n,
567 mbstate_t *restrict ps)); 617 mbstate_t *restrict ps), );
568# endif 618# endif
569_GL_CXXALIAS_SYS (mbrtowc, size_t, 619_GL_CXXALIAS_SYS (mbrtowc, size_t,
570 (wchar_t *restrict pwc, const char *restrict s, size_t n, 620 (wchar_t *restrict pwc, const char *restrict s, size_t n,
@@ -574,7 +624,6 @@ _GL_CXXALIAS_SYS (mbrtowc, size_t,
574_GL_CXXALIASWARN (mbrtowc); 624_GL_CXXALIASWARN (mbrtowc);
575# endif 625# endif
576#elif defined GNULIB_POSIXCHECK 626#elif defined GNULIB_POSIXCHECK
577# undef mbrtowc
578# if HAVE_RAW_DECL_MBRTOWC 627# if HAVE_RAW_DECL_MBRTOWC
579_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - " 628_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
580 "use gnulib module mbrtowc for portability"); 629 "use gnulib module mbrtowc for portability");
@@ -590,13 +639,13 @@ _GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
590# define mbrlen rpl_mbrlen 639# define mbrlen rpl_mbrlen
591# endif 640# endif
592_GL_FUNCDECL_RPL (mbrlen, size_t, 641_GL_FUNCDECL_RPL (mbrlen, size_t,
593 (const char *restrict s, size_t n, mbstate_t *restrict ps)); 642 (const char *restrict s, size_t n, mbstate_t *restrict ps), );
594_GL_CXXALIAS_RPL (mbrlen, size_t, 643_GL_CXXALIAS_RPL (mbrlen, size_t,
595 (const char *restrict s, size_t n, mbstate_t *restrict ps)); 644 (const char *restrict s, size_t n, mbstate_t *restrict ps));
596# else 645# else
597# if !@HAVE_MBRLEN@ 646# if !@HAVE_MBRLEN@
598_GL_FUNCDECL_SYS (mbrlen, size_t, 647_GL_FUNCDECL_SYS (mbrlen, size_t,
599 (const char *restrict s, size_t n, mbstate_t *restrict ps)); 648 (const char *restrict s, size_t n, mbstate_t *restrict ps), );
600# endif 649# endif
601_GL_CXXALIAS_SYS (mbrlen, size_t, 650_GL_CXXALIAS_SYS (mbrlen, size_t,
602 (const char *restrict s, size_t n, mbstate_t *restrict ps)); 651 (const char *restrict s, size_t n, mbstate_t *restrict ps));
@@ -605,7 +654,6 @@ _GL_CXXALIAS_SYS (mbrlen, size_t,
605_GL_CXXALIASWARN (mbrlen); 654_GL_CXXALIASWARN (mbrlen);
606# endif 655# endif
607#elif defined GNULIB_POSIXCHECK 656#elif defined GNULIB_POSIXCHECK
608# undef mbrlen
609# if HAVE_RAW_DECL_MBRLEN 657# if HAVE_RAW_DECL_MBRLEN
610_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - " 658_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
611 "use gnulib module mbrlen for portability"); 659 "use gnulib module mbrlen for portability");
@@ -623,7 +671,7 @@ _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
623_GL_FUNCDECL_RPL (mbsrtowcs, size_t, 671_GL_FUNCDECL_RPL (mbsrtowcs, size_t,
624 (wchar_t *restrict dest, 672 (wchar_t *restrict dest,
625 const char **restrict srcp, size_t len, 673 const char **restrict srcp, size_t len,
626 mbstate_t *restrict ps) 674 mbstate_t *restrict ps),
627 _GL_ARG_NONNULL ((2))); 675 _GL_ARG_NONNULL ((2)));
628_GL_CXXALIAS_RPL (mbsrtowcs, size_t, 676_GL_CXXALIAS_RPL (mbsrtowcs, size_t,
629 (wchar_t *restrict dest, 677 (wchar_t *restrict dest,
@@ -634,7 +682,7 @@ _GL_CXXALIAS_RPL (mbsrtowcs, size_t,
634_GL_FUNCDECL_SYS (mbsrtowcs, size_t, 682_GL_FUNCDECL_SYS (mbsrtowcs, size_t,
635 (wchar_t *restrict dest, 683 (wchar_t *restrict dest,
636 const char **restrict srcp, size_t len, 684 const char **restrict srcp, size_t len,
637 mbstate_t *restrict ps) 685 mbstate_t *restrict ps),
638 _GL_ARG_NONNULL ((2))); 686 _GL_ARG_NONNULL ((2)));
639# endif 687# endif
640_GL_CXXALIAS_SYS (mbsrtowcs, size_t, 688_GL_CXXALIAS_SYS (mbsrtowcs, size_t,
@@ -646,7 +694,6 @@ _GL_CXXALIAS_SYS (mbsrtowcs, size_t,
646_GL_CXXALIASWARN (mbsrtowcs); 694_GL_CXXALIASWARN (mbsrtowcs);
647# endif 695# endif
648#elif defined GNULIB_POSIXCHECK 696#elif defined GNULIB_POSIXCHECK
649# undef mbsrtowcs
650# if HAVE_RAW_DECL_MBSRTOWCS 697# if HAVE_RAW_DECL_MBSRTOWCS
651_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - " 698_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
652 "use gnulib module mbsrtowcs for portability"); 699 "use gnulib module mbsrtowcs for portability");
@@ -664,7 +711,7 @@ _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
664_GL_FUNCDECL_RPL (mbsnrtowcs, size_t, 711_GL_FUNCDECL_RPL (mbsnrtowcs, size_t,
665 (wchar_t *restrict dest, 712 (wchar_t *restrict dest,
666 const char **restrict srcp, size_t srclen, size_t len, 713 const char **restrict srcp, size_t srclen, size_t len,
667 mbstate_t *restrict ps) 714 mbstate_t *restrict ps),
668 _GL_ARG_NONNULL ((2))); 715 _GL_ARG_NONNULL ((2)));
669_GL_CXXALIAS_RPL (mbsnrtowcs, size_t, 716_GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
670 (wchar_t *restrict dest, 717 (wchar_t *restrict dest,
@@ -675,7 +722,7 @@ _GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
675_GL_FUNCDECL_SYS (mbsnrtowcs, size_t, 722_GL_FUNCDECL_SYS (mbsnrtowcs, size_t,
676 (wchar_t *restrict dest, 723 (wchar_t *restrict dest,
677 const char **restrict srcp, size_t srclen, size_t len, 724 const char **restrict srcp, size_t srclen, size_t len,
678 mbstate_t *restrict ps) 725 mbstate_t *restrict ps),
679 _GL_ARG_NONNULL ((2))); 726 _GL_ARG_NONNULL ((2)));
680# endif 727# endif
681_GL_CXXALIAS_SYS (mbsnrtowcs, size_t, 728_GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
@@ -687,7 +734,6 @@ _GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
687_GL_CXXALIASWARN (mbsnrtowcs); 734_GL_CXXALIASWARN (mbsnrtowcs);
688# endif 735# endif
689#elif defined GNULIB_POSIXCHECK 736#elif defined GNULIB_POSIXCHECK
690# undef mbsnrtowcs
691# if HAVE_RAW_DECL_MBSNRTOWCS 737# if HAVE_RAW_DECL_MBSNRTOWCS
692_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - " 738_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
693 "use gnulib module mbsnrtowcs for portability"); 739 "use gnulib module mbsnrtowcs for portability");
@@ -703,13 +749,13 @@ _GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
703# define wcrtomb rpl_wcrtomb 749# define wcrtomb rpl_wcrtomb
704# endif 750# endif
705_GL_FUNCDECL_RPL (wcrtomb, size_t, 751_GL_FUNCDECL_RPL (wcrtomb, size_t,
706 (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); 752 (char *restrict s, wchar_t wc, mbstate_t *restrict ps), );
707_GL_CXXALIAS_RPL (wcrtomb, size_t, 753_GL_CXXALIAS_RPL (wcrtomb, size_t,
708 (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); 754 (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
709# else 755# else
710# if !@HAVE_WCRTOMB@ 756# if !@HAVE_WCRTOMB@
711_GL_FUNCDECL_SYS (wcrtomb, size_t, 757_GL_FUNCDECL_SYS (wcrtomb, size_t,
712 (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); 758 (char *restrict s, wchar_t wc, mbstate_t *restrict ps), );
713# endif 759# endif
714_GL_CXXALIAS_SYS (wcrtomb, size_t, 760_GL_CXXALIAS_SYS (wcrtomb, size_t,
715 (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); 761 (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
@@ -718,7 +764,6 @@ _GL_CXXALIAS_SYS (wcrtomb, size_t,
718_GL_CXXALIASWARN (wcrtomb); 764_GL_CXXALIASWARN (wcrtomb);
719# endif 765# endif
720#elif defined GNULIB_POSIXCHECK 766#elif defined GNULIB_POSIXCHECK
721# undef wcrtomb
722# if HAVE_RAW_DECL_WCRTOMB 767# if HAVE_RAW_DECL_WCRTOMB
723_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - " 768_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
724 "use gnulib module wcrtomb for portability"); 769 "use gnulib module wcrtomb for portability");
@@ -736,7 +781,7 @@ _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
736_GL_FUNCDECL_RPL (wcsrtombs, size_t, 781_GL_FUNCDECL_RPL (wcsrtombs, size_t,
737 (char *restrict dest, const wchar_t **restrict srcp, 782 (char *restrict dest, const wchar_t **restrict srcp,
738 size_t len, 783 size_t len,
739 mbstate_t *restrict ps) 784 mbstate_t *restrict ps),
740 _GL_ARG_NONNULL ((2))); 785 _GL_ARG_NONNULL ((2)));
741_GL_CXXALIAS_RPL (wcsrtombs, size_t, 786_GL_CXXALIAS_RPL (wcsrtombs, size_t,
742 (char *restrict dest, const wchar_t **restrict srcp, 787 (char *restrict dest, const wchar_t **restrict srcp,
@@ -747,7 +792,7 @@ _GL_CXXALIAS_RPL (wcsrtombs, size_t,
747_GL_FUNCDECL_SYS (wcsrtombs, size_t, 792_GL_FUNCDECL_SYS (wcsrtombs, size_t,
748 (char *restrict dest, const wchar_t **restrict srcp, 793 (char *restrict dest, const wchar_t **restrict srcp,
749 size_t len, 794 size_t len,
750 mbstate_t *restrict ps) 795 mbstate_t *restrict ps),
751 _GL_ARG_NONNULL ((2))); 796 _GL_ARG_NONNULL ((2)));
752# endif 797# endif
753_GL_CXXALIAS_SYS (wcsrtombs, size_t, 798_GL_CXXALIAS_SYS (wcsrtombs, size_t,
@@ -759,7 +804,6 @@ _GL_CXXALIAS_SYS (wcsrtombs, size_t,
759_GL_CXXALIASWARN (wcsrtombs); 804_GL_CXXALIASWARN (wcsrtombs);
760# endif 805# endif
761#elif defined GNULIB_POSIXCHECK 806#elif defined GNULIB_POSIXCHECK
762# undef wcsrtombs
763# if HAVE_RAW_DECL_WCSRTOMBS 807# if HAVE_RAW_DECL_WCSRTOMBS
764_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - " 808_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
765 "use gnulib module wcsrtombs for portability"); 809 "use gnulib module wcsrtombs for portability");
@@ -778,7 +822,7 @@ _GL_FUNCDECL_RPL (wcsnrtombs, size_t,
778 (char *restrict dest, 822 (char *restrict dest,
779 const wchar_t **restrict srcp, size_t srclen, 823 const wchar_t **restrict srcp, size_t srclen,
780 size_t len, 824 size_t len,
781 mbstate_t *restrict ps) 825 mbstate_t *restrict ps),
782 _GL_ARG_NONNULL ((2))); 826 _GL_ARG_NONNULL ((2)));
783_GL_CXXALIAS_RPL (wcsnrtombs, size_t, 827_GL_CXXALIAS_RPL (wcsnrtombs, size_t,
784 (char *restrict dest, 828 (char *restrict dest,
@@ -791,7 +835,7 @@ _GL_FUNCDECL_SYS (wcsnrtombs, size_t,
791 (char *restrict dest, 835 (char *restrict dest,
792 const wchar_t **restrict srcp, size_t srclen, 836 const wchar_t **restrict srcp, size_t srclen,
793 size_t len, 837 size_t len,
794 mbstate_t *restrict ps) 838 mbstate_t *restrict ps),
795 _GL_ARG_NONNULL ((2))); 839 _GL_ARG_NONNULL ((2)));
796# endif 840# endif
797_GL_CXXALIAS_SYS (wcsnrtombs, size_t, 841_GL_CXXALIAS_SYS (wcsnrtombs, size_t,
@@ -804,7 +848,6 @@ _GL_CXXALIAS_SYS (wcsnrtombs, size_t,
804_GL_CXXALIASWARN (wcsnrtombs); 848_GL_CXXALIASWARN (wcsnrtombs);
805# endif 849# endif
806#elif defined GNULIB_POSIXCHECK 850#elif defined GNULIB_POSIXCHECK
807# undef wcsnrtombs
808# if HAVE_RAW_DECL_WCSNRTOMBS 851# if HAVE_RAW_DECL_WCSNRTOMBS
809_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - " 852_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
810 "use gnulib module wcsnrtombs for portability"); 853 "use gnulib module wcsnrtombs for portability");
@@ -819,12 +862,12 @@ _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
819# undef wcwidth 862# undef wcwidth
820# define wcwidth rpl_wcwidth 863# define wcwidth rpl_wcwidth
821# endif 864# endif
822_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); 865_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t), _GL_ATTRIBUTE_PURE);
823_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t)); 866_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
824# else 867# else
825# if !@HAVE_DECL_WCWIDTH@ 868# if !@HAVE_DECL_WCWIDTH@
826/* wcwidth exists but is not declared. */ 869/* wcwidth exists but is not declared. */
827_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); 870_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t), _GL_ATTRIBUTE_PURE);
828# endif 871# endif
829_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t)); 872_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
830# endif 873# endif
@@ -832,7 +875,6 @@ _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
832_GL_CXXALIASWARN (wcwidth); 875_GL_CXXALIASWARN (wcwidth);
833# endif 876# endif
834#elif defined GNULIB_POSIXCHECK 877#elif defined GNULIB_POSIXCHECK
835# undef wcwidth
836# if HAVE_RAW_DECL_WCWIDTH 878# if HAVE_RAW_DECL_WCWIDTH
837_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - " 879_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
838 "use gnulib module wcwidth for portability"); 880 "use gnulib module wcwidth for portability");
@@ -843,8 +885,9 @@ _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
843/* Search N wide characters of S for C. */ 885/* Search N wide characters of S for C. */
844#if @GNULIB_WMEMCHR@ 886#if @GNULIB_WMEMCHR@
845# if !@HAVE_WMEMCHR@ 887# if !@HAVE_WMEMCHR@
846_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n) 888_GL_FUNCDECL_SYS (wmemchr, wchar_t *,
847 _GL_ATTRIBUTE_PURE); 889 (const wchar_t *s, wchar_t c, size_t n),
890 _GL_ATTRIBUTE_PURE _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3));
848# endif 891# endif
849 /* On some systems, this function is defined as an overloaded function: 892 /* On some systems, this function is defined as an overloaded function:
850 extern "C++" { 893 extern "C++" {
@@ -855,15 +898,15 @@ _GL_CXXALIAS_SYS_CAST2 (wmemchr,
855 wchar_t *, (const wchar_t *, wchar_t, size_t), 898 wchar_t *, (const wchar_t *, wchar_t, size_t),
856 const wchar_t *, (const wchar_t *, wchar_t, size_t)); 899 const wchar_t *, (const wchar_t *, wchar_t, size_t));
857# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 900# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
858 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 901 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) \
902 && !defined __clang__
859_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); 903_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
860_GL_CXXALIASWARN1 (wmemchr, const wchar_t *, 904_GL_CXXALIASWARN1 (wmemchr, const wchar_t *,
861 (const wchar_t *s, wchar_t c, size_t n)); 905 (const wchar_t *s, wchar_t c, size_t n));
862# elif __GLIBC__ >= 2 906# elif __GLIBC__ >= 2 && !defined __CORRECT_ISO_CPP_WCHAR_H_PROTO
863_GL_CXXALIASWARN (wmemchr); 907_GL_CXXALIASWARN (wmemchr);
864# endif 908# endif
865#elif defined GNULIB_POSIXCHECK 909#elif defined GNULIB_POSIXCHECK
866# undef wmemchr
867# if HAVE_RAW_DECL_WMEMCHR 910# if HAVE_RAW_DECL_WMEMCHR
868_GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - " 911_GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
869 "use gnulib module wmemchr for portability"); 912 "use gnulib module wmemchr for portability");
@@ -879,15 +922,19 @@ _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
879# define wmemcmp rpl_wmemcmp 922# define wmemcmp rpl_wmemcmp
880# endif 923# endif
881_GL_FUNCDECL_RPL (wmemcmp, int, 924_GL_FUNCDECL_RPL (wmemcmp, int,
882 (const wchar_t *s1, const wchar_t *s2, size_t n) 925 (const wchar_t *s1, const wchar_t *s2, size_t n),
883 _GL_ATTRIBUTE_PURE); 926 _GL_ATTRIBUTE_PURE
927 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
928 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
884_GL_CXXALIAS_RPL (wmemcmp, int, 929_GL_CXXALIAS_RPL (wmemcmp, int,
885 (const wchar_t *s1, const wchar_t *s2, size_t n)); 930 (const wchar_t *s1, const wchar_t *s2, size_t n));
886# else 931# else
887# if !@HAVE_WMEMCMP@ 932# if !@HAVE_WMEMCMP@
888_GL_FUNCDECL_SYS (wmemcmp, int, 933_GL_FUNCDECL_SYS (wmemcmp, int,
889 (const wchar_t *s1, const wchar_t *s2, size_t n) 934 (const wchar_t *s1, const wchar_t *s2, size_t n),
890 _GL_ATTRIBUTE_PURE); 935 _GL_ATTRIBUTE_PURE
936 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
937 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
891# endif 938# endif
892_GL_CXXALIAS_SYS (wmemcmp, int, 939_GL_CXXALIAS_SYS (wmemcmp, int,
893 (const wchar_t *s1, const wchar_t *s2, size_t n)); 940 (const wchar_t *s1, const wchar_t *s2, size_t n));
@@ -896,7 +943,6 @@ _GL_CXXALIAS_SYS (wmemcmp, int,
896_GL_CXXALIASWARN (wmemcmp); 943_GL_CXXALIASWARN (wmemcmp);
897# endif 944# endif
898#elif defined GNULIB_POSIXCHECK 945#elif defined GNULIB_POSIXCHECK
899# undef wmemcmp
900# if HAVE_RAW_DECL_WMEMCMP 946# if HAVE_RAW_DECL_WMEMCMP
901_GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - " 947_GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
902 "use gnulib module wmemcmp for portability"); 948 "use gnulib module wmemcmp for portability");
@@ -909,7 +955,9 @@ _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
909# if !@HAVE_WMEMCPY@ 955# if !@HAVE_WMEMCPY@
910_GL_FUNCDECL_SYS (wmemcpy, wchar_t *, 956_GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
911 (wchar_t *restrict dest, 957 (wchar_t *restrict dest,
912 const wchar_t *restrict src, size_t n)); 958 const wchar_t *restrict src, size_t n),
959 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
960 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
913# endif 961# endif
914_GL_CXXALIAS_SYS (wmemcpy, wchar_t *, 962_GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
915 (wchar_t *restrict dest, 963 (wchar_t *restrict dest,
@@ -918,7 +966,6 @@ _GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
918_GL_CXXALIASWARN (wmemcpy); 966_GL_CXXALIASWARN (wmemcpy);
919# endif 967# endif
920#elif defined GNULIB_POSIXCHECK 968#elif defined GNULIB_POSIXCHECK
921# undef wmemcpy
922# if HAVE_RAW_DECL_WMEMCPY 969# if HAVE_RAW_DECL_WMEMCPY
923_GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - " 970_GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - "
924 "use gnulib module wmemcpy for portability"); 971 "use gnulib module wmemcpy for portability");
@@ -931,7 +978,9 @@ _GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - "
931#if @GNULIB_WMEMMOVE@ 978#if @GNULIB_WMEMMOVE@
932# if !@HAVE_WMEMMOVE@ 979# if !@HAVE_WMEMMOVE@
933_GL_FUNCDECL_SYS (wmemmove, wchar_t *, 980_GL_FUNCDECL_SYS (wmemmove, wchar_t *,
934 (wchar_t *dest, const wchar_t *src, size_t n)); 981 (wchar_t *dest, const wchar_t *src, size_t n),
982 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
983 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
935# endif 984# endif
936_GL_CXXALIAS_SYS (wmemmove, wchar_t *, 985_GL_CXXALIAS_SYS (wmemmove, wchar_t *,
937 (wchar_t *dest, const wchar_t *src, size_t n)); 986 (wchar_t *dest, const wchar_t *src, size_t n));
@@ -939,7 +988,6 @@ _GL_CXXALIAS_SYS (wmemmove, wchar_t *,
939_GL_CXXALIASWARN (wmemmove); 988_GL_CXXALIASWARN (wmemmove);
940# endif 989# endif
941#elif defined GNULIB_POSIXCHECK 990#elif defined GNULIB_POSIXCHECK
942# undef wmemmove
943# if HAVE_RAW_DECL_WMEMMOVE 991# if HAVE_RAW_DECL_WMEMMOVE
944_GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - " 992_GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
945 "use gnulib module wmemmove for portability"); 993 "use gnulib module wmemmove for portability");
@@ -957,7 +1005,7 @@ _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
957# endif 1005# endif
958_GL_FUNCDECL_RPL (wmempcpy, wchar_t *, 1006_GL_FUNCDECL_RPL (wmempcpy, wchar_t *,
959 (wchar_t *restrict dest, 1007 (wchar_t *restrict dest,
960 const wchar_t *restrict src, size_t n)); 1008 const wchar_t *restrict src, size_t n), );
961_GL_CXXALIAS_RPL (wmempcpy, wchar_t *, 1009_GL_CXXALIAS_RPL (wmempcpy, wchar_t *,
962 (wchar_t *restrict dest, 1010 (wchar_t *restrict dest,
963 const wchar_t *restrict src, size_t n)); 1011 const wchar_t *restrict src, size_t n));
@@ -965,7 +1013,7 @@ _GL_CXXALIAS_RPL (wmempcpy, wchar_t *,
965# if !@HAVE_WMEMPCPY@ 1013# if !@HAVE_WMEMPCPY@
966_GL_FUNCDECL_SYS (wmempcpy, wchar_t *, 1014_GL_FUNCDECL_SYS (wmempcpy, wchar_t *,
967 (wchar_t *restrict dest, 1015 (wchar_t *restrict dest,
968 const wchar_t *restrict src, size_t n)); 1016 const wchar_t *restrict src, size_t n), );
969# endif 1017# endif
970_GL_CXXALIAS_SYS (wmempcpy, wchar_t *, 1018_GL_CXXALIAS_SYS (wmempcpy, wchar_t *,
971 (wchar_t *restrict dest, 1019 (wchar_t *restrict dest,
@@ -975,7 +1023,6 @@ _GL_CXXALIAS_SYS (wmempcpy, wchar_t *,
975_GL_CXXALIASWARN (wmempcpy); 1023_GL_CXXALIASWARN (wmempcpy);
976# endif 1024# endif
977#elif defined GNULIB_POSIXCHECK 1025#elif defined GNULIB_POSIXCHECK
978# undef wmempcpy
979# if HAVE_RAW_DECL_WMEMPCPY 1026# if HAVE_RAW_DECL_WMEMPCPY
980_GL_WARN_ON_USE (wmempcpy, "wmempcpy is unportable - " 1027_GL_WARN_ON_USE (wmempcpy, "wmempcpy is unportable - "
981 "use gnulib module wmempcpy for portability"); 1028 "use gnulib module wmempcpy for portability");
@@ -986,14 +1033,14 @@ _GL_WARN_ON_USE (wmempcpy, "wmempcpy is unportable - "
986/* Set N wide characters of S to C. */ 1033/* Set N wide characters of S to C. */
987#if @GNULIB_WMEMSET@ 1034#if @GNULIB_WMEMSET@
988# if !@HAVE_WMEMSET@ 1035# if !@HAVE_WMEMSET@
989_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); 1036_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n),
1037 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3));
990# endif 1038# endif
991_GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); 1039_GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
992# if __GLIBC__ >= 2 1040# if __GLIBC__ >= 2
993_GL_CXXALIASWARN (wmemset); 1041_GL_CXXALIASWARN (wmemset);
994# endif 1042# endif
995#elif defined GNULIB_POSIXCHECK 1043#elif defined GNULIB_POSIXCHECK
996# undef wmemset
997# if HAVE_RAW_DECL_WMEMSET 1044# if HAVE_RAW_DECL_WMEMSET
998_GL_WARN_ON_USE (wmemset, "wmemset is unportable - " 1045_GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
999 "use gnulib module wmemset for portability"); 1046 "use gnulib module wmemset for portability");
@@ -1004,14 +1051,13 @@ _GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
1004/* Return the number of wide characters in S. */ 1051/* Return the number of wide characters in S. */
1005#if @GNULIB_WCSLEN@ 1052#if @GNULIB_WCSLEN@
1006# if !@HAVE_WCSLEN@ 1053# if !@HAVE_WCSLEN@
1007_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE); 1054_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s), _GL_ATTRIBUTE_PURE);
1008# endif 1055# endif
1009_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s)); 1056_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
1010# if __GLIBC__ >= 2 1057# if __GLIBC__ >= 2
1011_GL_CXXALIASWARN (wcslen); 1058_GL_CXXALIASWARN (wcslen);
1012# endif 1059# endif
1013#elif defined GNULIB_POSIXCHECK 1060#elif defined GNULIB_POSIXCHECK
1014# undef wcslen
1015# if HAVE_RAW_DECL_WCSLEN 1061# if HAVE_RAW_DECL_WCSLEN
1016_GL_WARN_ON_USE (wcslen, "wcslen is unportable - " 1062_GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
1017 "use gnulib module wcslen for portability"); 1063 "use gnulib module wcslen for portability");
@@ -1025,13 +1071,12 @@ _GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
1025 namespace, not in the global namespace. So, force a declaration in 1071 namespace, not in the global namespace. So, force a declaration in
1026 the global namespace. */ 1072 the global namespace. */
1027# if !@HAVE_WCSNLEN@ || (defined __sun && defined __cplusplus) 1073# if !@HAVE_WCSNLEN@ || (defined __sun && defined __cplusplus)
1028_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen) 1074_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen),
1029 _GL_ATTRIBUTE_PURE); 1075 _GL_ATTRIBUTE_PURE);
1030# endif 1076# endif
1031_GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)); 1077_GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
1032_GL_CXXALIASWARN (wcsnlen); 1078_GL_CXXALIASWARN (wcsnlen);
1033#elif defined GNULIB_POSIXCHECK 1079#elif defined GNULIB_POSIXCHECK
1034# undef wcsnlen
1035# if HAVE_RAW_DECL_WCSNLEN 1080# if HAVE_RAW_DECL_WCSNLEN
1036_GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - " 1081_GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
1037 "use gnulib module wcsnlen for portability"); 1082 "use gnulib module wcsnlen for portability");
@@ -1043,7 +1088,7 @@ _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
1043#if @GNULIB_WCSCPY@ 1088#if @GNULIB_WCSCPY@
1044# if !@HAVE_WCSCPY@ 1089# if !@HAVE_WCSCPY@
1045_GL_FUNCDECL_SYS (wcscpy, wchar_t *, 1090_GL_FUNCDECL_SYS (wcscpy, wchar_t *,
1046 (wchar_t *restrict dest, const wchar_t *restrict src)); 1091 (wchar_t *restrict dest, const wchar_t *restrict src), );
1047# endif 1092# endif
1048_GL_CXXALIAS_SYS (wcscpy, wchar_t *, 1093_GL_CXXALIAS_SYS (wcscpy, wchar_t *,
1049 (wchar_t *restrict dest, const wchar_t *restrict src)); 1094 (wchar_t *restrict dest, const wchar_t *restrict src));
@@ -1051,7 +1096,6 @@ _GL_CXXALIAS_SYS (wcscpy, wchar_t *,
1051_GL_CXXALIASWARN (wcscpy); 1096_GL_CXXALIASWARN (wcscpy);
1052# endif 1097# endif
1053#elif defined GNULIB_POSIXCHECK 1098#elif defined GNULIB_POSIXCHECK
1054# undef wcscpy
1055# if HAVE_RAW_DECL_WCSCPY 1099# if HAVE_RAW_DECL_WCSCPY
1056_GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - " 1100_GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
1057 "use gnulib module wcscpy for portability"); 1101 "use gnulib module wcscpy for portability");
@@ -1066,13 +1110,12 @@ _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
1066 the global namespace. */ 1110 the global namespace. */
1067# if !@HAVE_WCPCPY@ || (defined __sun && defined __cplusplus) 1111# if !@HAVE_WCPCPY@ || (defined __sun && defined __cplusplus)
1068_GL_FUNCDECL_SYS (wcpcpy, wchar_t *, 1112_GL_FUNCDECL_SYS (wcpcpy, wchar_t *,
1069 (wchar_t *restrict dest, const wchar_t *restrict src)); 1113 (wchar_t *restrict dest, const wchar_t *restrict src), );
1070# endif 1114# endif
1071_GL_CXXALIAS_SYS (wcpcpy, wchar_t *, 1115_GL_CXXALIAS_SYS (wcpcpy, wchar_t *,
1072 (wchar_t *restrict dest, const wchar_t *restrict src)); 1116 (wchar_t *restrict dest, const wchar_t *restrict src));
1073_GL_CXXALIASWARN (wcpcpy); 1117_GL_CXXALIASWARN (wcpcpy);
1074#elif defined GNULIB_POSIXCHECK 1118#elif defined GNULIB_POSIXCHECK
1075# undef wcpcpy
1076# if HAVE_RAW_DECL_WCPCPY 1119# if HAVE_RAW_DECL_WCPCPY
1077_GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - " 1120_GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
1078 "use gnulib module wcpcpy for portability"); 1121 "use gnulib module wcpcpy for portability");
@@ -1085,7 +1128,9 @@ _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
1085# if !@HAVE_WCSNCPY@ 1128# if !@HAVE_WCSNCPY@
1086_GL_FUNCDECL_SYS (wcsncpy, wchar_t *, 1129_GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
1087 (wchar_t *restrict dest, 1130 (wchar_t *restrict dest,
1088 const wchar_t *restrict src, size_t n)); 1131 const wchar_t *restrict src, size_t n),
1132 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
1133 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
1089# endif 1134# endif
1090_GL_CXXALIAS_SYS (wcsncpy, wchar_t *, 1135_GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
1091 (wchar_t *restrict dest, 1136 (wchar_t *restrict dest,
@@ -1094,7 +1139,6 @@ _GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
1094_GL_CXXALIASWARN (wcsncpy); 1139_GL_CXXALIASWARN (wcsncpy);
1095# endif 1140# endif
1096#elif defined GNULIB_POSIXCHECK 1141#elif defined GNULIB_POSIXCHECK
1097# undef wcsncpy
1098# if HAVE_RAW_DECL_WCSNCPY 1142# if HAVE_RAW_DECL_WCSNCPY
1099_GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - " 1143_GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
1100 "use gnulib module wcsncpy for portability"); 1144 "use gnulib module wcsncpy for portability");
@@ -1111,14 +1155,13 @@ _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
1111# if !@HAVE_WCPNCPY@ || (defined __sun && defined __cplusplus) 1155# if !@HAVE_WCPNCPY@ || (defined __sun && defined __cplusplus)
1112_GL_FUNCDECL_SYS (wcpncpy, wchar_t *, 1156_GL_FUNCDECL_SYS (wcpncpy, wchar_t *,
1113 (wchar_t *restrict dest, 1157 (wchar_t *restrict dest,
1114 const wchar_t *restrict src, size_t n)); 1158 const wchar_t *restrict src, size_t n), );
1115# endif 1159# endif
1116_GL_CXXALIAS_SYS (wcpncpy, wchar_t *, 1160_GL_CXXALIAS_SYS (wcpncpy, wchar_t *,
1117 (wchar_t *restrict dest, 1161 (wchar_t *restrict dest,
1118 const wchar_t *restrict src, size_t n)); 1162 const wchar_t *restrict src, size_t n));
1119_GL_CXXALIASWARN (wcpncpy); 1163_GL_CXXALIASWARN (wcpncpy);
1120#elif defined GNULIB_POSIXCHECK 1164#elif defined GNULIB_POSIXCHECK
1121# undef wcpncpy
1122# if HAVE_RAW_DECL_WCPNCPY 1165# if HAVE_RAW_DECL_WCPNCPY
1123_GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - " 1166_GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
1124 "use gnulib module wcpncpy for portability"); 1167 "use gnulib module wcpncpy for portability");
@@ -1130,7 +1173,7 @@ _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
1130#if @GNULIB_WCSCAT@ 1173#if @GNULIB_WCSCAT@
1131# if !@HAVE_WCSCAT@ 1174# if !@HAVE_WCSCAT@
1132_GL_FUNCDECL_SYS (wcscat, wchar_t *, 1175_GL_FUNCDECL_SYS (wcscat, wchar_t *,
1133 (wchar_t *restrict dest, const wchar_t *restrict src)); 1176 (wchar_t *restrict dest, const wchar_t *restrict src), );
1134# endif 1177# endif
1135_GL_CXXALIAS_SYS (wcscat, wchar_t *, 1178_GL_CXXALIAS_SYS (wcscat, wchar_t *,
1136 (wchar_t *restrict dest, const wchar_t *restrict src)); 1179 (wchar_t *restrict dest, const wchar_t *restrict src));
@@ -1138,7 +1181,6 @@ _GL_CXXALIAS_SYS (wcscat, wchar_t *,
1138_GL_CXXALIASWARN (wcscat); 1181_GL_CXXALIASWARN (wcscat);
1139# endif 1182# endif
1140#elif defined GNULIB_POSIXCHECK 1183#elif defined GNULIB_POSIXCHECK
1141# undef wcscat
1142# if HAVE_RAW_DECL_WCSCAT 1184# if HAVE_RAW_DECL_WCSCAT
1143_GL_WARN_ON_USE (wcscat, "wcscat is unportable - " 1185_GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
1144 "use gnulib module wcscat for portability"); 1186 "use gnulib module wcscat for portability");
@@ -1148,19 +1190,35 @@ _GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
1148 1190
1149/* Append no more than N wide characters of SRC onto DEST. */ 1191/* Append no more than N wide characters of SRC onto DEST. */
1150#if @GNULIB_WCSNCAT@ 1192#if @GNULIB_WCSNCAT@
1151# if !@HAVE_WCSNCAT@ 1193# if @REPLACE_WCSNCAT@
1152_GL_FUNCDECL_SYS (wcsncat, wchar_t *, 1194# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1195# undef wcsncat
1196# define wcsncat rpl_wcsncat
1197# endif
1198_GL_FUNCDECL_RPL (wcsncat, wchar_t *,
1199 (wchar_t *restrict dest, const wchar_t *restrict src,
1200 size_t n),
1201 _GL_ARG_NONNULL ((1))
1202 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
1203_GL_CXXALIAS_RPL (wcsncat, wchar_t *,
1153 (wchar_t *restrict dest, const wchar_t *restrict src, 1204 (wchar_t *restrict dest, const wchar_t *restrict src,
1154 size_t n)); 1205 size_t n));
1155# endif 1206# else
1207# if !@HAVE_WCSNCAT@
1208_GL_FUNCDECL_SYS (wcsncat, wchar_t *,
1209 (wchar_t *restrict dest, const wchar_t *restrict src,
1210 size_t n),
1211 _GL_ARG_NONNULL ((1))
1212 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
1213# endif
1156_GL_CXXALIAS_SYS (wcsncat, wchar_t *, 1214_GL_CXXALIAS_SYS (wcsncat, wchar_t *,
1157 (wchar_t *restrict dest, const wchar_t *restrict src, 1215 (wchar_t *restrict dest, const wchar_t *restrict src,
1158 size_t n)); 1216 size_t n));
1217# endif
1159# if __GLIBC__ >= 2 1218# if __GLIBC__ >= 2
1160_GL_CXXALIASWARN (wcsncat); 1219_GL_CXXALIASWARN (wcsncat);
1161# endif 1220# endif
1162#elif defined GNULIB_POSIXCHECK 1221#elif defined GNULIB_POSIXCHECK
1163# undef wcsncat
1164# if HAVE_RAW_DECL_WCSNCAT 1222# if HAVE_RAW_DECL_WCSNCAT
1165_GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - " 1223_GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
1166 "use gnulib module wcsncat for portability"); 1224 "use gnulib module wcsncat for portability");
@@ -1175,12 +1233,12 @@ _GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
1175# undef wcscmp 1233# undef wcscmp
1176# define wcscmp rpl_wcscmp 1234# define wcscmp rpl_wcscmp
1177# endif 1235# endif
1178_GL_FUNCDECL_RPL (wcscmp, int, (const wchar_t *s1, const wchar_t *s2) 1236_GL_FUNCDECL_RPL (wcscmp, int, (const wchar_t *s1, const wchar_t *s2),
1179 _GL_ATTRIBUTE_PURE); 1237 _GL_ATTRIBUTE_PURE);
1180_GL_CXXALIAS_RPL (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); 1238_GL_CXXALIAS_RPL (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
1181# else 1239# else
1182# if !@HAVE_WCSCMP@ 1240# if !@HAVE_WCSCMP@
1183_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2) 1241_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2),
1184 _GL_ATTRIBUTE_PURE); 1242 _GL_ATTRIBUTE_PURE);
1185# endif 1243# endif
1186_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); 1244_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
@@ -1189,7 +1247,6 @@ _GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
1189_GL_CXXALIASWARN (wcscmp); 1247_GL_CXXALIASWARN (wcscmp);
1190# endif 1248# endif
1191#elif defined GNULIB_POSIXCHECK 1249#elif defined GNULIB_POSIXCHECK
1192# undef wcscmp
1193# if HAVE_RAW_DECL_WCSCMP 1250# if HAVE_RAW_DECL_WCSCMP
1194_GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - " 1251_GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
1195 "use gnulib module wcscmp for portability"); 1252 "use gnulib module wcscmp for portability");
@@ -1205,15 +1262,19 @@ _GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
1205# define wcsncmp rpl_wcsncmp 1262# define wcsncmp rpl_wcsncmp
1206# endif 1263# endif
1207_GL_FUNCDECL_RPL (wcsncmp, int, 1264_GL_FUNCDECL_RPL (wcsncmp, int,
1208 (const wchar_t *s1, const wchar_t *s2, size_t n) 1265 (const wchar_t *s1, const wchar_t *s2, size_t n),
1209 _GL_ATTRIBUTE_PURE); 1266 _GL_ATTRIBUTE_PURE
1267 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
1268 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
1210_GL_CXXALIAS_RPL (wcsncmp, int, 1269_GL_CXXALIAS_RPL (wcsncmp, int,
1211 (const wchar_t *s1, const wchar_t *s2, size_t n)); 1270 (const wchar_t *s1, const wchar_t *s2, size_t n));
1212# else 1271# else
1213# if !@HAVE_WCSNCMP@ 1272# if !@HAVE_WCSNCMP@
1214_GL_FUNCDECL_SYS (wcsncmp, int, 1273_GL_FUNCDECL_SYS (wcsncmp, int,
1215 (const wchar_t *s1, const wchar_t *s2, size_t n) 1274 (const wchar_t *s1, const wchar_t *s2, size_t n),
1216 _GL_ATTRIBUTE_PURE); 1275 _GL_ATTRIBUTE_PURE
1276 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
1277 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
1217# endif 1278# endif
1218_GL_CXXALIAS_SYS (wcsncmp, int, 1279_GL_CXXALIAS_SYS (wcsncmp, int,
1219 (const wchar_t *s1, const wchar_t *s2, size_t n)); 1280 (const wchar_t *s1, const wchar_t *s2, size_t n));
@@ -1222,7 +1283,6 @@ _GL_CXXALIAS_SYS (wcsncmp, int,
1222_GL_CXXALIASWARN (wcsncmp); 1283_GL_CXXALIASWARN (wcsncmp);
1223# endif 1284# endif
1224#elif defined GNULIB_POSIXCHECK 1285#elif defined GNULIB_POSIXCHECK
1225# undef wcsncmp
1226# if HAVE_RAW_DECL_WCSNCMP 1286# if HAVE_RAW_DECL_WCSNCMP
1227_GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - " 1287_GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
1228 "use gnulib module wcsncmp for portability"); 1288 "use gnulib module wcsncmp for portability");
@@ -1236,13 +1296,12 @@ _GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
1236 namespace, not in the global namespace. So, force a declaration in 1296 namespace, not in the global namespace. So, force a declaration in
1237 the global namespace. */ 1297 the global namespace. */
1238# if !@HAVE_WCSCASECMP@ || (defined __sun && defined __cplusplus) 1298# if !@HAVE_WCSCASECMP@ || (defined __sun && defined __cplusplus)
1239_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2) 1299_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2),
1240 _GL_ATTRIBUTE_PURE); 1300 _GL_ATTRIBUTE_PURE);
1241# endif 1301# endif
1242_GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)); 1302_GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
1243_GL_CXXALIASWARN (wcscasecmp); 1303_GL_CXXALIASWARN (wcscasecmp);
1244#elif defined GNULIB_POSIXCHECK 1304#elif defined GNULIB_POSIXCHECK
1245# undef wcscasecmp
1246# if HAVE_RAW_DECL_WCSCASECMP 1305# if HAVE_RAW_DECL_WCSCASECMP
1247_GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - " 1306_GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
1248 "use gnulib module wcscasecmp for portability"); 1307 "use gnulib module wcscasecmp for portability");
@@ -1257,14 +1316,13 @@ _GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
1257 the global namespace. */ 1316 the global namespace. */
1258# if !@HAVE_WCSNCASECMP@ || (defined __sun && defined __cplusplus) 1317# if !@HAVE_WCSNCASECMP@ || (defined __sun && defined __cplusplus)
1259_GL_FUNCDECL_SYS (wcsncasecmp, int, 1318_GL_FUNCDECL_SYS (wcsncasecmp, int,
1260 (const wchar_t *s1, const wchar_t *s2, size_t n) 1319 (const wchar_t *s1, const wchar_t *s2, size_t n),
1261 _GL_ATTRIBUTE_PURE); 1320 _GL_ATTRIBUTE_PURE);
1262# endif 1321# endif
1263_GL_CXXALIAS_SYS (wcsncasecmp, int, 1322_GL_CXXALIAS_SYS (wcsncasecmp, int,
1264 (const wchar_t *s1, const wchar_t *s2, size_t n)); 1323 (const wchar_t *s1, const wchar_t *s2, size_t n));
1265_GL_CXXALIASWARN (wcsncasecmp); 1324_GL_CXXALIASWARN (wcsncasecmp);
1266#elif defined GNULIB_POSIXCHECK 1325#elif defined GNULIB_POSIXCHECK
1267# undef wcsncasecmp
1268# if HAVE_RAW_DECL_WCSNCASECMP 1326# if HAVE_RAW_DECL_WCSNCASECMP
1269_GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - " 1327_GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
1270 "use gnulib module wcsncasecmp for portability"); 1328 "use gnulib module wcsncasecmp for portability");
@@ -1276,14 +1334,13 @@ _GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
1276 category of the current locale. */ 1334 category of the current locale. */
1277#if @GNULIB_WCSCOLL@ 1335#if @GNULIB_WCSCOLL@
1278# if !@HAVE_WCSCOLL@ 1336# if !@HAVE_WCSCOLL@
1279_GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); 1337_GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2), );
1280# endif 1338# endif
1281_GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); 1339_GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
1282# if __GLIBC__ >= 2 1340# if __GLIBC__ >= 2
1283_GL_CXXALIASWARN (wcscoll); 1341_GL_CXXALIASWARN (wcscoll);
1284# endif 1342# endif
1285#elif defined GNULIB_POSIXCHECK 1343#elif defined GNULIB_POSIXCHECK
1286# undef wcscoll
1287# if HAVE_RAW_DECL_WCSCOLL 1344# if HAVE_RAW_DECL_WCSCOLL
1288_GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - " 1345_GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
1289 "use gnulib module wcscoll for portability"); 1346 "use gnulib module wcscoll for portability");
@@ -1297,7 +1354,7 @@ _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
1297#if @GNULIB_WCSXFRM@ 1354#if @GNULIB_WCSXFRM@
1298# if !@HAVE_WCSXFRM@ 1355# if !@HAVE_WCSXFRM@
1299_GL_FUNCDECL_SYS (wcsxfrm, size_t, 1356_GL_FUNCDECL_SYS (wcsxfrm, size_t,
1300 (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n)); 1357 (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n), );
1301# endif 1358# endif
1302_GL_CXXALIAS_SYS (wcsxfrm, size_t, 1359_GL_CXXALIAS_SYS (wcsxfrm, size_t,
1303 (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n)); 1360 (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n));
@@ -1305,7 +1362,6 @@ _GL_CXXALIAS_SYS (wcsxfrm, size_t,
1305_GL_CXXALIASWARN (wcsxfrm); 1362_GL_CXXALIASWARN (wcsxfrm);
1306# endif 1363# endif
1307#elif defined GNULIB_POSIXCHECK 1364#elif defined GNULIB_POSIXCHECK
1308# undef wcsxfrm
1309# if HAVE_RAW_DECL_WCSXFRM 1365# if HAVE_RAW_DECL_WCSXFRM
1310_GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - " 1366_GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - "
1311 "use gnulib module wcsxfrm for portability"); 1367 "use gnulib module wcsxfrm for portability");
@@ -1325,15 +1381,16 @@ _GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s));
1325/* On Solaris 11.3, the header files declare the function in the std:: 1381/* On Solaris 11.3, the header files declare the function in the std::
1326 namespace, not in the global namespace. So, force a declaration in 1382 namespace, not in the global namespace. So, force a declaration in
1327 the global namespace. */ 1383 the global namespace. */
1328# if !@HAVE_WCSDUP@ || (defined __sun && defined __cplusplus) || __GNUC__ >= 11 1384# if !@HAVE_WCSDUP@ || (defined __sun && defined __cplusplus) \
1385 || (__GNUC__ >= 11 && !defined __clang__)
1329# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 1386# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
1330_GL_FUNCDECL_SYS (wcsdup, wchar_t *, 1387_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1331 (const wchar_t *s) 1388 (const wchar_t *s),
1332 _GL_ATTRIBUTE_NOTHROW 1389 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
1333 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 1390 _GL_ATTRIBUTE_NOTHROW;
1334# else 1391# else
1335_GL_FUNCDECL_SYS (wcsdup, wchar_t *, 1392_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1336 (const wchar_t *s) 1393 (const wchar_t *s),
1337 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 1394 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
1338# endif 1395# endif
1339# endif 1396# endif
@@ -1341,21 +1398,20 @@ _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
1341# endif 1398# endif
1342_GL_CXXALIASWARN (wcsdup); 1399_GL_CXXALIASWARN (wcsdup);
1343#else 1400#else
1344# if __GNUC__ >= 11 && !defined wcsdup 1401# if (__GNUC__ >= 11 && !defined __clang__) && !defined wcsdup
1345/* For -Wmismatched-dealloc: Associate wcsdup with free or rpl_free. */ 1402/* For -Wmismatched-dealloc: Associate wcsdup with free or rpl_free. */
1346# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 1403# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
1347_GL_FUNCDECL_SYS (wcsdup, wchar_t *, 1404_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1348 (const wchar_t *s) 1405 (const wchar_t *s),
1349 _GL_ATTRIBUTE_NOTHROW 1406 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
1350 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 1407 _GL_ATTRIBUTE_NOTHROW;
1351# else 1408# else
1352_GL_FUNCDECL_SYS (wcsdup, wchar_t *, 1409_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1353 (const wchar_t *s) 1410 (const wchar_t *s),
1354 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 1411 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
1355# endif 1412# endif
1356# endif 1413# endif
1357# if defined GNULIB_POSIXCHECK 1414# if defined GNULIB_POSIXCHECK
1358# undef wcsdup
1359# if HAVE_RAW_DECL_WCSDUP 1415# if HAVE_RAW_DECL_WCSDUP
1360_GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - " 1416_GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
1361 "use gnulib module wcsdup for portability"); 1417 "use gnulib module wcsdup for portability");
@@ -1373,12 +1429,12 @@ _GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s));
1373# else 1429# else
1374# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 1430# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
1375_GL_FUNCDECL_SYS (wcsdup, wchar_t *, 1431_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1376 (const wchar_t *s) 1432 (const wchar_t *s),
1377 _GL_ATTRIBUTE_NOTHROW 1433 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
1378 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 1434 _GL_ATTRIBUTE_NOTHROW;
1379# else 1435# else
1380_GL_FUNCDECL_SYS (wcsdup, wchar_t *, 1436_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1381 (const wchar_t *s) 1437 (const wchar_t *s),
1382 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 1438 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
1383# endif 1439# endif
1384# if @HAVE_DECL_WCSDUP@ 1440# if @HAVE_DECL_WCSDUP@
@@ -1395,7 +1451,7 @@ _GL_CXXALIASWARN (wcsdup);
1395/* Find the first occurrence of WC in WCS. */ 1451/* Find the first occurrence of WC in WCS. */
1396#if @GNULIB_WCSCHR@ 1452#if @GNULIB_WCSCHR@
1397# if !@HAVE_WCSCHR@ 1453# if !@HAVE_WCSCHR@
1398_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc) 1454_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc),
1399 _GL_ATTRIBUTE_PURE); 1455 _GL_ATTRIBUTE_PURE);
1400# endif 1456# endif
1401 /* On some systems, this function is defined as an overloaded function: 1457 /* On some systems, this function is defined as an overloaded function:
@@ -1407,14 +1463,14 @@ _GL_CXXALIAS_SYS_CAST2 (wcschr,
1407 wchar_t *, (const wchar_t *, wchar_t), 1463 wchar_t *, (const wchar_t *, wchar_t),
1408 const wchar_t *, (const wchar_t *, wchar_t)); 1464 const wchar_t *, (const wchar_t *, wchar_t));
1409# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1465# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1410 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1466 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) \
1467 && !defined __clang__
1411_GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc)); 1468_GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc));
1412_GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); 1469_GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
1413# elif __GLIBC__ >= 2 1470# elif __GLIBC__ >= 2 && !defined __CORRECT_ISO_CPP_WCHAR_H_PROTO
1414_GL_CXXALIASWARN (wcschr); 1471_GL_CXXALIASWARN (wcschr);
1415# endif 1472# endif
1416#elif defined GNULIB_POSIXCHECK 1473#elif defined GNULIB_POSIXCHECK
1417# undef wcschr
1418# if HAVE_RAW_DECL_WCSCHR 1474# if HAVE_RAW_DECL_WCSCHR
1419_GL_WARN_ON_USE (wcschr, "wcschr is unportable - " 1475_GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
1420 "use gnulib module wcschr for portability"); 1476 "use gnulib module wcschr for portability");
@@ -1425,7 +1481,7 @@ _GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
1425/* Find the last occurrence of WC in WCS. */ 1481/* Find the last occurrence of WC in WCS. */
1426#if @GNULIB_WCSRCHR@ 1482#if @GNULIB_WCSRCHR@
1427# if !@HAVE_WCSRCHR@ 1483# if !@HAVE_WCSRCHR@
1428_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc) 1484_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc),
1429 _GL_ATTRIBUTE_PURE); 1485 _GL_ATTRIBUTE_PURE);
1430# endif 1486# endif
1431 /* On some systems, this function is defined as an overloaded function: 1487 /* On some systems, this function is defined as an overloaded function:
@@ -1437,14 +1493,14 @@ _GL_CXXALIAS_SYS_CAST2 (wcsrchr,
1437 wchar_t *, (const wchar_t *, wchar_t), 1493 wchar_t *, (const wchar_t *, wchar_t),
1438 const wchar_t *, (const wchar_t *, wchar_t)); 1494 const wchar_t *, (const wchar_t *, wchar_t));
1439# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1495# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1440 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1496 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) \
1497 && !defined __clang__
1441_GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc)); 1498_GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc));
1442_GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc)); 1499_GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
1443# elif __GLIBC__ >= 2 1500# elif __GLIBC__ >= 2 && !defined __CORRECT_ISO_CPP_WCHAR_H_PROTO
1444_GL_CXXALIASWARN (wcsrchr); 1501_GL_CXXALIASWARN (wcsrchr);
1445# endif 1502# endif
1446#elif defined GNULIB_POSIXCHECK 1503#elif defined GNULIB_POSIXCHECK
1447# undef wcsrchr
1448# if HAVE_RAW_DECL_WCSRCHR 1504# if HAVE_RAW_DECL_WCSRCHR
1449_GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - " 1505_GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
1450 "use gnulib module wcsrchr for portability"); 1506 "use gnulib module wcsrchr for portability");
@@ -1456,7 +1512,7 @@ _GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
1456 of wide characters not in REJECT. */ 1512 of wide characters not in REJECT. */
1457#if @GNULIB_WCSCSPN@ 1513#if @GNULIB_WCSCSPN@
1458# if !@HAVE_WCSCSPN@ 1514# if !@HAVE_WCSCSPN@
1459_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject) 1515_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject),
1460 _GL_ATTRIBUTE_PURE); 1516 _GL_ATTRIBUTE_PURE);
1461# endif 1517# endif
1462_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)); 1518_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
@@ -1464,7 +1520,6 @@ _GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
1464_GL_CXXALIASWARN (wcscspn); 1520_GL_CXXALIASWARN (wcscspn);
1465# endif 1521# endif
1466#elif defined GNULIB_POSIXCHECK 1522#elif defined GNULIB_POSIXCHECK
1467# undef wcscspn
1468# if HAVE_RAW_DECL_WCSCSPN 1523# if HAVE_RAW_DECL_WCSCSPN
1469_GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - " 1524_GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
1470 "use gnulib module wcscspn for portability"); 1525 "use gnulib module wcscspn for portability");
@@ -1476,7 +1531,7 @@ _GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
1476 of wide characters in ACCEPT. */ 1531 of wide characters in ACCEPT. */
1477#if @GNULIB_WCSSPN@ 1532#if @GNULIB_WCSSPN@
1478# if !@HAVE_WCSSPN@ 1533# if !@HAVE_WCSSPN@
1479_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept) 1534_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept),
1480 _GL_ATTRIBUTE_PURE); 1535 _GL_ATTRIBUTE_PURE);
1481# endif 1536# endif
1482_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)); 1537_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
@@ -1484,7 +1539,6 @@ _GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
1484_GL_CXXALIASWARN (wcsspn); 1539_GL_CXXALIASWARN (wcsspn);
1485# endif 1540# endif
1486#elif defined GNULIB_POSIXCHECK 1541#elif defined GNULIB_POSIXCHECK
1487# undef wcsspn
1488# if HAVE_RAW_DECL_WCSSPN 1542# if HAVE_RAW_DECL_WCSSPN
1489_GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - " 1543_GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
1490 "use gnulib module wcsspn for portability"); 1544 "use gnulib module wcsspn for portability");
@@ -1496,7 +1550,7 @@ _GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
1496#if @GNULIB_WCSPBRK@ 1550#if @GNULIB_WCSPBRK@
1497# if !@HAVE_WCSPBRK@ 1551# if !@HAVE_WCSPBRK@
1498_GL_FUNCDECL_SYS (wcspbrk, wchar_t *, 1552_GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
1499 (const wchar_t *wcs, const wchar_t *accept) 1553 (const wchar_t *wcs, const wchar_t *accept),
1500 _GL_ATTRIBUTE_PURE); 1554 _GL_ATTRIBUTE_PURE);
1501# endif 1555# endif
1502 /* On some systems, this function is defined as an overloaded function: 1556 /* On some systems, this function is defined as an overloaded function:
@@ -1508,16 +1562,16 @@ _GL_CXXALIAS_SYS_CAST2 (wcspbrk,
1508 wchar_t *, (const wchar_t *, const wchar_t *), 1562 wchar_t *, (const wchar_t *, const wchar_t *),
1509 const wchar_t *, (const wchar_t *, const wchar_t *)); 1563 const wchar_t *, (const wchar_t *, const wchar_t *));
1510# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1564# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1511 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1565 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) \
1566 && !defined __clang__
1512_GL_CXXALIASWARN1 (wcspbrk, wchar_t *, 1567_GL_CXXALIASWARN1 (wcspbrk, wchar_t *,
1513 (wchar_t *wcs, const wchar_t *accept)); 1568 (wchar_t *wcs, const wchar_t *accept));
1514_GL_CXXALIASWARN1 (wcspbrk, const wchar_t *, 1569_GL_CXXALIASWARN1 (wcspbrk, const wchar_t *,
1515 (const wchar_t *wcs, const wchar_t *accept)); 1570 (const wchar_t *wcs, const wchar_t *accept));
1516# elif __GLIBC__ >= 2 1571# elif __GLIBC__ >= 2 && !defined __CORRECT_ISO_CPP_WCHAR_H_PROTO
1517_GL_CXXALIASWARN (wcspbrk); 1572_GL_CXXALIASWARN (wcspbrk);
1518# endif 1573# endif
1519#elif defined GNULIB_POSIXCHECK 1574#elif defined GNULIB_POSIXCHECK
1520# undef wcspbrk
1521# if HAVE_RAW_DECL_WCSPBRK 1575# if HAVE_RAW_DECL_WCSPBRK
1522_GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - " 1576_GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
1523 "use gnulib module wcspbrk for portability"); 1577 "use gnulib module wcspbrk for portability");
@@ -1534,7 +1588,7 @@ _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
1534# endif 1588# endif
1535_GL_FUNCDECL_RPL (wcsstr, wchar_t *, 1589_GL_FUNCDECL_RPL (wcsstr, wchar_t *,
1536 (const wchar_t *restrict haystack, 1590 (const wchar_t *restrict haystack,
1537 const wchar_t *restrict needle) 1591 const wchar_t *restrict needle),
1538 _GL_ATTRIBUTE_PURE); 1592 _GL_ATTRIBUTE_PURE);
1539_GL_CXXALIAS_RPL (wcsstr, wchar_t *, 1593_GL_CXXALIAS_RPL (wcsstr, wchar_t *,
1540 (const wchar_t *restrict haystack, 1594 (const wchar_t *restrict haystack,
@@ -1543,7 +1597,7 @@ _GL_CXXALIAS_RPL (wcsstr, wchar_t *,
1543# if !@HAVE_WCSSTR@ 1597# if !@HAVE_WCSSTR@
1544_GL_FUNCDECL_SYS (wcsstr, wchar_t *, 1598_GL_FUNCDECL_SYS (wcsstr, wchar_t *,
1545 (const wchar_t *restrict haystack, 1599 (const wchar_t *restrict haystack,
1546 const wchar_t *restrict needle) 1600 const wchar_t *restrict needle),
1547 _GL_ATTRIBUTE_PURE); 1601 _GL_ATTRIBUTE_PURE);
1548# endif 1602# endif
1549 /* On some systems, this function is defined as an overloaded function: 1603 /* On some systems, this function is defined as an overloaded function:
@@ -1558,18 +1612,18 @@ _GL_CXXALIAS_SYS_CAST2 (wcsstr,
1558 (const wchar_t *restrict, const wchar_t *restrict)); 1612 (const wchar_t *restrict, const wchar_t *restrict));
1559# endif 1613# endif
1560# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1614# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1561 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1615 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) \
1616 && !defined __clang__
1562_GL_CXXALIASWARN1 (wcsstr, wchar_t *, 1617_GL_CXXALIASWARN1 (wcsstr, wchar_t *,
1563 (wchar_t *restrict haystack, 1618 (wchar_t *restrict haystack,
1564 const wchar_t *restrict needle)); 1619 const wchar_t *restrict needle));
1565_GL_CXXALIASWARN1 (wcsstr, const wchar_t *, 1620_GL_CXXALIASWARN1 (wcsstr, const wchar_t *,
1566 (const wchar_t *restrict haystack, 1621 (const wchar_t *restrict haystack,
1567 const wchar_t *restrict needle)); 1622 const wchar_t *restrict needle));
1568# elif __GLIBC__ >= 2 1623# elif __GLIBC__ >= 2 && !defined __CORRECT_ISO_CPP_WCHAR_H_PROTO
1569_GL_CXXALIASWARN (wcsstr); 1624_GL_CXXALIASWARN (wcsstr);
1570# endif 1625# endif
1571#elif defined GNULIB_POSIXCHECK 1626#elif defined GNULIB_POSIXCHECK
1572# undef wcsstr
1573# if HAVE_RAW_DECL_WCSSTR 1627# if HAVE_RAW_DECL_WCSSTR
1574_GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - " 1628_GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
1575 "use gnulib module wcsstr for portability"); 1629 "use gnulib module wcsstr for portability");
@@ -1586,7 +1640,7 @@ _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
1586# endif 1640# endif
1587_GL_FUNCDECL_RPL (wcstok, wchar_t *, 1641_GL_FUNCDECL_RPL (wcstok, wchar_t *,
1588 (wchar_t *restrict wcs, const wchar_t *restrict delim, 1642 (wchar_t *restrict wcs, const wchar_t *restrict delim,
1589 wchar_t **restrict ptr)); 1643 wchar_t **restrict ptr), );
1590_GL_CXXALIAS_RPL (wcstok, wchar_t *, 1644_GL_CXXALIAS_RPL (wcstok, wchar_t *,
1591 (wchar_t *restrict wcs, const wchar_t *restrict delim, 1645 (wchar_t *restrict wcs, const wchar_t *restrict delim,
1592 wchar_t **restrict ptr)); 1646 wchar_t **restrict ptr));
@@ -1594,7 +1648,7 @@ _GL_CXXALIAS_RPL (wcstok, wchar_t *,
1594# if !@HAVE_WCSTOK@ 1648# if !@HAVE_WCSTOK@
1595_GL_FUNCDECL_SYS (wcstok, wchar_t *, 1649_GL_FUNCDECL_SYS (wcstok, wchar_t *,
1596 (wchar_t *restrict wcs, const wchar_t *restrict delim, 1650 (wchar_t *restrict wcs, const wchar_t *restrict delim,
1597 wchar_t **restrict ptr)); 1651 wchar_t **restrict ptr), );
1598# endif 1652# endif
1599_GL_CXXALIAS_SYS (wcstok, wchar_t *, 1653_GL_CXXALIAS_SYS (wcstok, wchar_t *,
1600 (wchar_t *restrict wcs, const wchar_t *restrict delim, 1654 (wchar_t *restrict wcs, const wchar_t *restrict delim,
@@ -1604,7 +1658,6 @@ _GL_CXXALIAS_SYS (wcstok, wchar_t *,
1604_GL_CXXALIASWARN (wcstok); 1658_GL_CXXALIASWARN (wcstok);
1605# endif 1659# endif
1606#elif defined GNULIB_POSIXCHECK 1660#elif defined GNULIB_POSIXCHECK
1607# undef wcstok
1608# if HAVE_RAW_DECL_WCSTOK 1661# if HAVE_RAW_DECL_WCSTOK
1609_GL_WARN_ON_USE (wcstok, "wcstok is unportable - " 1662_GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
1610 "use gnulib module wcstok for portability"); 1663 "use gnulib module wcstok for portability");
@@ -1620,12 +1673,12 @@ _GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
1620# undef wcswidth 1673# undef wcswidth
1621# define wcswidth rpl_wcswidth 1674# define wcswidth rpl_wcswidth
1622# endif 1675# endif
1623_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n) 1676_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n),
1624 _GL_ATTRIBUTE_PURE); 1677 _GL_ATTRIBUTE_PURE);
1625_GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n)); 1678_GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n));
1626# else 1679# else
1627# if !@HAVE_WCSWIDTH@ 1680# if !@HAVE_WCSWIDTH@
1628_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n) 1681_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n),
1629 _GL_ATTRIBUTE_PURE); 1682 _GL_ATTRIBUTE_PURE);
1630# endif 1683# endif
1631_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n)); 1684_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
@@ -1634,7 +1687,6 @@ _GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
1634_GL_CXXALIASWARN (wcswidth); 1687_GL_CXXALIASWARN (wcswidth);
1635# endif 1688# endif
1636#elif defined GNULIB_POSIXCHECK 1689#elif defined GNULIB_POSIXCHECK
1637# undef wcswidth
1638# if HAVE_RAW_DECL_WCSWIDTH 1690# if HAVE_RAW_DECL_WCSWIDTH
1639_GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - " 1691_GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
1640 "use gnulib module wcswidth for portability"); 1692 "use gnulib module wcswidth for portability");
@@ -1653,7 +1705,7 @@ _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
1653_GL_FUNCDECL_RPL (wcsftime, size_t, 1705_GL_FUNCDECL_RPL (wcsftime, size_t,
1654 (wchar_t *restrict __buf, size_t __bufsize, 1706 (wchar_t *restrict __buf, size_t __bufsize,
1655 const wchar_t *restrict __fmt, 1707 const wchar_t *restrict __fmt,
1656 const struct tm *restrict __tp) 1708 const struct tm *restrict __tp),
1657 _GL_ARG_NONNULL ((1, 3, 4))); 1709 _GL_ARG_NONNULL ((1, 3, 4)));
1658_GL_CXXALIAS_RPL (wcsftime, size_t, 1710_GL_CXXALIAS_RPL (wcsftime, size_t,
1659 (wchar_t *restrict __buf, size_t __bufsize, 1711 (wchar_t *restrict __buf, size_t __bufsize,
@@ -1664,7 +1716,7 @@ _GL_CXXALIAS_RPL (wcsftime, size_t,
1664_GL_FUNCDECL_SYS (wcsftime, size_t, 1716_GL_FUNCDECL_SYS (wcsftime, size_t,
1665 (wchar_t *restrict __buf, size_t __bufsize, 1717 (wchar_t *restrict __buf, size_t __bufsize,
1666 const wchar_t *restrict __fmt, 1718 const wchar_t *restrict __fmt,
1667 const struct tm *restrict __tp) 1719 const struct tm *restrict __tp),
1668 _GL_ARG_NONNULL ((1, 3, 4))); 1720 _GL_ARG_NONNULL ((1, 3, 4)));
1669# endif 1721# endif
1670_GL_CXXALIAS_SYS (wcsftime, size_t, 1722_GL_CXXALIAS_SYS (wcsftime, size_t,
@@ -1676,7 +1728,6 @@ _GL_CXXALIAS_SYS (wcsftime, size_t,
1676_GL_CXXALIASWARN (wcsftime); 1728_GL_CXXALIASWARN (wcsftime);
1677# endif 1729# endif
1678#elif defined GNULIB_POSIXCHECK 1730#elif defined GNULIB_POSIXCHECK
1679# undef wcsftime
1680# if HAVE_RAW_DECL_WCSFTIME 1731# if HAVE_RAW_DECL_WCSFTIME
1681_GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - " 1732_GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - "
1682 "use gnulib module wcsftime for portability"); 1733 "use gnulib module wcsftime for portability");
@@ -1698,7 +1749,7 @@ _GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - "
1698 Possible errno values include: 1749 Possible errno values include:
1699 - ERANGE if SIZE is too small. 1750 - ERANGE if SIZE is too small.
1700 - ENOMEM if the memory could no be allocated. */ 1751 - ENOMEM if the memory could no be allocated. */
1701_GL_FUNCDECL_SYS (wgetcwd, wchar_t *, (wchar_t *buf, size_t size)); 1752_GL_FUNCDECL_SYS (wgetcwd, wchar_t *, (wchar_t *buf, size_t size), );
1702#endif 1753#endif
1703 1754
1704 1755
diff --git a/gl/wcrtomb.c b/gl/wcrtomb.c
index 197b020e..a9b8de78 100644
--- a/gl/wcrtomb.c
+++ b/gl/wcrtomb.c
@@ -1,5 +1,5 @@
1/* Convert wide character to multibyte character. 1/* Convert wide character to multibyte character.
2 Copyright (C) 2008-2024 Free Software Foundation, Inc. 2 Copyright (C) 2008-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2008. 3 Written by Bruno Haible <bruno@clisp.org>, 2008.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
@@ -36,7 +36,7 @@ wcrtomb (char *s, wchar_t wc, mbstate_t *ps)
36 return (size_t)(-1); 36 return (size_t)(-1);
37 } 37 }
38 38
39#if !HAVE_WCRTOMB /* IRIX 6.5 */ \ 39#if !HAVE_WCRTOMB /* HP-UX 11.00, mingw */ \
40 || WCRTOMB_RETVAL_BUG /* Solaris 11.3, MSVC */ \ 40 || WCRTOMB_RETVAL_BUG /* Solaris 11.3, MSVC */ \
41 || WCRTOMB_C_LOCALE_BUG /* Android */ 41 || WCRTOMB_C_LOCALE_BUG /* Android */
42 if (s == NULL) 42 if (s == NULL)
@@ -62,7 +62,7 @@ wcrtomb (char *s, wchar_t wc, mbstate_t *ps)
62# else 62# else
63 return wcrtomb (s, wc, ps); 63 return wcrtomb (s, wc, ps);
64# endif 64# endif
65#else /* IRIX 6.5 */ 65#else /* HP-UX 11.00, mingw */
66 /* Fallback for platforms that don't have wcrtomb(). 66 /* Fallback for platforms that don't have wcrtomb().
67 Implement on top of wctomb(). 67 Implement on top of wctomb().
68 This code is not multithread-safe. */ 68 This code is not multithread-safe. */
diff --git a/gl/wctype-h.c b/gl/wctype-h.c
index 7e4ff13a..f773d0cb 100644
--- a/gl/wctype-h.c
+++ b/gl/wctype-h.c
@@ -1,6 +1,6 @@
1/* Inline functions for <wctype.h>. 1/* Inline functions for <wctype.h>.
2 2
3 Copyright (C) 2012-2024 Free Software Foundation, Inc. 3 Copyright (C) 2012-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -17,7 +17,7 @@
17 17
18/* Normally this would be wctype.c, but that name's already taken. */ 18/* Normally this would be wctype.c, but that name's already taken. */
19 19
20#define _GL_WCTYPE_INLINE _GL_EXTERN_INLINE
20#include <config.h> 21#include <config.h>
21 22
22#define _GL_WCTYPE_INLINE _GL_EXTERN_INLINE
23#include <wctype.h> 23#include <wctype.h>
diff --git a/gl/wctype-impl.h b/gl/wctype-impl.h
index 26d68b41..675ea31c 100644
--- a/gl/wctype-impl.h
+++ b/gl/wctype-impl.h
@@ -1,5 +1,5 @@
1/* Get descriptor for a wide character property. 1/* Get descriptor for a wide character property.
2 Copyright (C) 2011-2024 Free Software Foundation, Inc. 2 Copyright (C) 2011-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2011. 3 Written by Bruno Haible <bruno@clisp.org>, 2011.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
@@ -27,11 +27,11 @@ wctype (const char* name)
27 switch (name[2]) 27 switch (name[2])
28 { 28 {
29 case 'n': 29 case 'n':
30 if (strcmp (name + 3, "um") == 0) 30 if (streq (name + 3, "um"))
31 return (wctype_t) iswalnum; 31 return (wctype_t) iswalnum;
32 break; 32 break;
33 case 'p': 33 case 'p':
34 if (strcmp (name + 3, "ha") == 0) 34 if (streq (name + 3, "ha"))
35 return (wctype_t) iswalpha; 35 return (wctype_t) iswalpha;
36 break; 36 break;
37 default: 37 default:
@@ -43,34 +43,34 @@ wctype (const char* name)
43 } 43 }
44 break; 44 break;
45 case 'b': 45 case 'b':
46 if (strcmp (name + 1, "lank") == 0) 46 if (streq (name + 1, "lank"))
47 return (wctype_t) iswblank; 47 return (wctype_t) iswblank;
48 break; 48 break;
49 case 'c': 49 case 'c':
50 if (strcmp (name + 1, "ntrl") == 0) 50 if (streq (name + 1, "ntrl"))
51 return (wctype_t) iswcntrl; 51 return (wctype_t) iswcntrl;
52 break; 52 break;
53 case 'd': 53 case 'd':
54 if (strcmp (name + 1, "igit") == 0) 54 if (streq (name + 1, "igit"))
55 return (wctype_t) iswdigit; 55 return (wctype_t) iswdigit;
56 break; 56 break;
57 case 'g': 57 case 'g':
58 if (strcmp (name + 1, "raph") == 0) 58 if (streq (name + 1, "raph"))
59 return (wctype_t) iswgraph; 59 return (wctype_t) iswgraph;
60 break; 60 break;
61 case 'l': 61 case 'l':
62 if (strcmp (name + 1, "ower") == 0) 62 if (streq (name + 1, "ower"))
63 return (wctype_t) iswlower; 63 return (wctype_t) iswlower;
64 break; 64 break;
65 case 'p': 65 case 'p':
66 switch (name[1]) 66 switch (name[1])
67 { 67 {
68 case 'r': 68 case 'r':
69 if (strcmp (name + 2, "int") == 0) 69 if (streq (name + 2, "int"))
70 return (wctype_t) iswprint; 70 return (wctype_t) iswprint;
71 break; 71 break;
72 case 'u': 72 case 'u':
73 if (strcmp (name + 2, "nct") == 0) 73 if (streq (name + 2, "nct"))
74 return (wctype_t) iswpunct; 74 return (wctype_t) iswpunct;
75 break; 75 break;
76 default: 76 default:
@@ -78,15 +78,15 @@ wctype (const char* name)
78 } 78 }
79 break; 79 break;
80 case 's': 80 case 's':
81 if (strcmp (name + 1, "pace") == 0) 81 if (streq (name + 1, "pace"))
82 return (wctype_t) iswspace; 82 return (wctype_t) iswspace;
83 break; 83 break;
84 case 'u': 84 case 'u':
85 if (strcmp (name + 1, "pper") == 0) 85 if (streq (name + 1, "pper"))
86 return (wctype_t) iswupper; 86 return (wctype_t) iswupper;
87 break; 87 break;
88 case 'x': 88 case 'x':
89 if (strcmp (name + 1, "digit") == 0) 89 if (streq (name + 1, "digit"))
90 return (wctype_t) iswxdigit; 90 return (wctype_t) iswxdigit;
91 break; 91 break;
92 default: 92 default:
diff --git a/gl/wctype.c b/gl/wctype.c
index 914f6847..205b244c 100644
--- a/gl/wctype.c
+++ b/gl/wctype.c
@@ -1,5 +1,5 @@
1/* Get descriptor for a wide character property. 1/* Get descriptor for a wide character property.
2 Copyright (C) 2011-2024 Free Software Foundation, Inc. 2 Copyright (C) 2011-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2011. 3 Written by Bruno Haible <bruno@clisp.org>, 2011.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
diff --git a/gl/wctype.in.h b/gl/wctype.in.h
index 851c4f4e..15f310ce 100644
--- a/gl/wctype.in.h
+++ b/gl/wctype.in.h
@@ -1,6 +1,6 @@
1/* A substitute for ISO C99 <wctype.h>, for platforms that lack it. 1/* A substitute for ISO C99 <wctype.h>, for platforms that lack it.
2 2
3 Copyright (C) 2006-2024 Free Software Foundation, Inc. 3 Copyright (C) 2006-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -264,27 +264,7 @@ rpl_towupper (wint_t wc)
264 264
265# else 265# else
266 266
267/* IRIX 5.3 has macros but no functions, its isw* macros refer to an 267/* On some old platforms the functions are broken. */
268 undefined variable _ctmp_ and to <ctype.h> macros like _P, and they
269 refer to system functions like _iswctype that are not in the
270 standard C library. Rather than try to get ancient buggy
271 implementations like this to work, just disable them. */
272# undef iswalnum
273# undef iswalpha
274# undef iswblank
275# undef iswcntrl
276# undef iswdigit
277# undef iswgraph
278# undef iswlower
279# undef iswprint
280# undef iswpunct
281# undef iswspace
282# undef iswupper
283# undef iswxdigit
284# undef towlower
285# undef towupper
286
287/* Linux libc5 has <wctype.h> and the functions but they are broken. */
288# if @REPLACE_ISWCNTRL@ 268# if @REPLACE_ISWCNTRL@
289# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 269# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
290# define iswalnum rpl_iswalnum 270# define iswalnum rpl_iswalnum
@@ -478,9 +458,9 @@ towupper
478# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 458# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
479# define iswblank rpl_iswblank 459# define iswblank rpl_iswblank
480# endif 460# endif
481_GL_FUNCDECL_RPL (iswblank, int, (wint_t wc)); 461_GL_FUNCDECL_RPL (iswblank, int, (wint_t wc), );
482# else 462# else
483_GL_FUNCDECL_SYS (iswblank, int, (wint_t wc)); 463_GL_FUNCDECL_SYS (iswblank, int, (wint_t wc), );
484# endif 464# endif
485# endif 465# endif
486 466
@@ -490,7 +470,7 @@ _GL_FUNCDECL_SYS (iswblank, int, (wint_t wc));
490# undef iswdigit 470# undef iswdigit
491# define iswdigit rpl_iswdigit 471# define iswdigit rpl_iswdigit
492# endif 472# endif
493_GL_FUNCDECL_RPL (iswdigit, int, (wint_t wc)); 473_GL_FUNCDECL_RPL (iswdigit, int, (wint_t wc), );
494# endif 474# endif
495# endif 475# endif
496 476
@@ -500,7 +480,7 @@ _GL_FUNCDECL_RPL (iswdigit, int, (wint_t wc));
500# undef iswpunct 480# undef iswpunct
501# define iswpunct rpl_iswpunct 481# define iswpunct rpl_iswpunct
502# endif 482# endif
503_GL_FUNCDECL_RPL (iswpunct, int, (wint_t wc)); 483_GL_FUNCDECL_RPL (iswpunct, int, (wint_t wc), );
504# endif 484# endif
505# endif 485# endif
506 486
@@ -510,7 +490,7 @@ _GL_FUNCDECL_RPL (iswpunct, int, (wint_t wc));
510# undef iswxdigit 490# undef iswxdigit
511# define iswxdigit rpl_iswxdigit 491# define iswxdigit rpl_iswxdigit
512# endif 492# endif
513_GL_FUNCDECL_RPL (iswxdigit, int, (wint_t wc)); 493_GL_FUNCDECL_RPL (iswxdigit, int, (wint_t wc), );
514# endif 494# endif
515# endif 495# endif
516 496
@@ -659,12 +639,12 @@ typedef void *rpl_wctype_t;
659# undef wctype 639# undef wctype
660# define wctype rpl_wctype 640# define wctype rpl_wctype
661# endif 641# endif
662_GL_FUNCDECL_RPL (wctype, wctype_t, (const char *name) 642_GL_FUNCDECL_RPL (wctype, wctype_t, (const char *name),
663 _GL_ARG_NONNULL ((1))); 643 _GL_ARG_NONNULL ((1)));
664_GL_CXXALIAS_RPL (wctype, wctype_t, (const char *name)); 644_GL_CXXALIAS_RPL (wctype, wctype_t, (const char *name));
665# else 645# else
666# if !@HAVE_WCTYPE_T@ 646# if !@HAVE_WCTYPE_T@
667_GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name) 647_GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name),
668 _GL_ARG_NONNULL ((1))); 648 _GL_ARG_NONNULL ((1)));
669# endif 649# endif
670_GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name)); 650_GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name));
@@ -673,7 +653,6 @@ _GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name));
673_GL_CXXALIASWARN (wctype); 653_GL_CXXALIASWARN (wctype);
674# endif 654# endif
675#elif defined GNULIB_POSIXCHECK 655#elif defined GNULIB_POSIXCHECK
676# undef wctype
677# if HAVE_RAW_DECL_WCTYPE 656# if HAVE_RAW_DECL_WCTYPE
678_GL_WARN_ON_USE (wctype, "wctype is unportable - " 657_GL_WARN_ON_USE (wctype, "wctype is unportable - "
679 "use gnulib module wctype for portability"); 658 "use gnulib module wctype for portability");
@@ -689,11 +668,11 @@ _GL_WARN_ON_USE (wctype, "wctype is unportable - "
689# undef iswctype 668# undef iswctype
690# define iswctype rpl_iswctype 669# define iswctype rpl_iswctype
691# endif 670# endif
692_GL_FUNCDECL_RPL (iswctype, int, (wint_t wc, wctype_t desc)); 671_GL_FUNCDECL_RPL (iswctype, int, (wint_t wc, wctype_t desc), );
693_GL_CXXALIAS_RPL (iswctype, int, (wint_t wc, wctype_t desc)); 672_GL_CXXALIAS_RPL (iswctype, int, (wint_t wc, wctype_t desc));
694# else 673# else
695# if !@HAVE_WCTYPE_T@ 674# if !@HAVE_WCTYPE_T@
696_GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc)); 675_GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc), );
697# endif 676# endif
698_GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc)); 677_GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc));
699# endif 678# endif
@@ -701,7 +680,6 @@ _GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc));
701_GL_CXXALIASWARN (iswctype); 680_GL_CXXALIASWARN (iswctype);
702# endif 681# endif
703#elif defined GNULIB_POSIXCHECK 682#elif defined GNULIB_POSIXCHECK
704# undef iswctype
705# if HAVE_RAW_DECL_ISWCTYPE 683# if HAVE_RAW_DECL_ISWCTYPE
706_GL_WARN_ON_USE (iswctype, "iswctype is unportable - " 684_GL_WARN_ON_USE (iswctype, "iswctype is unportable - "
707 "use gnulib module iswctype for portability"); 685 "use gnulib module iswctype for portability");
@@ -741,12 +719,12 @@ typedef void *rpl_wctrans_t;
741# undef wctrans 719# undef wctrans
742# define wctrans rpl_wctrans 720# define wctrans rpl_wctrans
743# endif 721# endif
744_GL_FUNCDECL_RPL (wctrans, wctrans_t, (const char *name) 722_GL_FUNCDECL_RPL (wctrans, wctrans_t, (const char *name),
745 _GL_ARG_NONNULL ((1))); 723 _GL_ARG_NONNULL ((1)));
746_GL_CXXALIAS_RPL (wctrans, wctrans_t, (const char *name)); 724_GL_CXXALIAS_RPL (wctrans, wctrans_t, (const char *name));
747# else 725# else
748# if !@HAVE_WCTRANS_T@ 726# if !@HAVE_WCTRANS_T@
749_GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name) 727_GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name),
750 _GL_ARG_NONNULL ((1))); 728 _GL_ARG_NONNULL ((1)));
751# endif 729# endif
752_GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name)); 730_GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name));
@@ -755,7 +733,6 @@ _GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name));
755_GL_CXXALIASWARN (wctrans); 733_GL_CXXALIASWARN (wctrans);
756# endif 734# endif
757#elif defined GNULIB_POSIXCHECK 735#elif defined GNULIB_POSIXCHECK
758# undef wctrans
759# if HAVE_RAW_DECL_WCTRANS 736# if HAVE_RAW_DECL_WCTRANS
760_GL_WARN_ON_USE (wctrans, "wctrans is unportable - " 737_GL_WARN_ON_USE (wctrans, "wctrans is unportable - "
761 "use gnulib module wctrans for portability"); 738 "use gnulib module wctrans for portability");
@@ -771,11 +748,11 @@ _GL_WARN_ON_USE (wctrans, "wctrans is unportable - "
771# undef towctrans 748# undef towctrans
772# define towctrans rpl_towctrans 749# define towctrans rpl_towctrans
773# endif 750# endif
774_GL_FUNCDECL_RPL (towctrans, wint_t, (wint_t wc, wctrans_t desc)); 751_GL_FUNCDECL_RPL (towctrans, wint_t, (wint_t wc, wctrans_t desc), );
775_GL_CXXALIAS_RPL (towctrans, wint_t, (wint_t wc, wctrans_t desc)); 752_GL_CXXALIAS_RPL (towctrans, wint_t, (wint_t wc, wctrans_t desc));
776# else 753# else
777# if !@HAVE_WCTRANS_T@ 754# if !@HAVE_WCTRANS_T@
778_GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); 755_GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc), );
779# endif 756# endif
780_GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); 757_GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc));
781# endif 758# endif
@@ -783,7 +760,6 @@ _GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc));
783_GL_CXXALIASWARN (towctrans); 760_GL_CXXALIASWARN (towctrans);
784# endif 761# endif
785#elif defined GNULIB_POSIXCHECK 762#elif defined GNULIB_POSIXCHECK
786# undef towctrans
787# if HAVE_RAW_DECL_TOWCTRANS 763# if HAVE_RAW_DECL_TOWCTRANS
788_GL_WARN_ON_USE (towctrans, "towctrans is unportable - " 764_GL_WARN_ON_USE (towctrans, "towctrans is unportable - "
789 "use gnulib module towctrans for portability"); 765 "use gnulib module towctrans for portability");
diff --git a/gl/wcwidth.c b/gl/wcwidth.c
new file mode 100644
index 00000000..ffcc9778
--- /dev/null
+++ b/gl/wcwidth.c
@@ -0,0 +1,73 @@
1/* Determine the number of screen columns needed for a character.
2 Copyright (C) 2006-2007, 2010-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#include <config.h>
18
19/* Specification. */
20#include <wchar.h>
21
22/* Get iswprint. */
23#include <wctype.h>
24
25#include "localcharset.h"
26#include "streq.h"
27#include "uniwidth.h"
28
29/* Returns 1 if the current locale is an UTF-8 locale, 0 otherwise. */
30static inline int
31is_locale_utf8 (void)
32{
33 const char *encoding = locale_charset ();
34 return STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0);
35}
36
37#if GNULIB_WCHAR_SINGLE_LOCALE
38/* When we know that the locale does not change, provide a speedup by
39 caching the value of is_locale_utf8. */
40static int cached_is_locale_utf8 = -1;
41static inline int
42is_locale_utf8_cached (void)
43{
44 if (cached_is_locale_utf8 < 0)
45 cached_is_locale_utf8 = is_locale_utf8 ();
46 return cached_is_locale_utf8;
47}
48#else
49/* By default, don't make assumptions, hence no caching. */
50# define is_locale_utf8_cached is_locale_utf8
51#endif
52
53int
54wcwidth (wchar_t wc)
55#undef wcwidth
56{
57 /* In UTF-8 locales, use a Unicode aware width function. */
58 if (is_locale_utf8_cached ())
59 {
60 /* We assume that in a UTF-8 locale, a wide character is the same as a
61 Unicode character. */
62 return uc_width (wc, "UTF-8");
63 }
64 else
65 {
66 /* Otherwise, fall back to the system's wcwidth function. */
67#if HAVE_WCWIDTH
68 return wcwidth (wc);
69#else
70 return wc == 0 ? 0 : iswprint (wc) ? 1 : -1;
71#endif
72 }
73}
diff --git a/gl/windows-initguard.h b/gl/windows-initguard.h
index 6bace3f0..e7da4735 100644
--- a/gl/windows-initguard.h
+++ b/gl/windows-initguard.h
@@ -1,5 +1,5 @@
1/* Init guards, somewhat like spinlocks (native Windows implementation). 1/* Init guards, somewhat like spinlocks (native Windows implementation).
2 Copyright (C) 2005-2024 Free Software Foundation, Inc. 2 Copyright (C) 2005-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/windows-mutex.c b/gl/windows-mutex.c
index b112e13b..a8460fab 100644
--- a/gl/windows-mutex.c
+++ b/gl/windows-mutex.c
@@ -1,5 +1,5 @@
1/* Plain mutexes (native Windows implementation). 1/* Plain mutexes (native Windows implementation).
2 Copyright (C) 2005-2024 Free Software Foundation, Inc. 2 Copyright (C) 2005-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -23,10 +23,12 @@
23#include "windows-mutex.h" 23#include "windows-mutex.h"
24 24
25#include <errno.h> 25#include <errno.h>
26#include <stdlib.h>
26 27
27void 28void
28glwthread_mutex_init (glwthread_mutex_t *mutex) 29glwthread_mutex_init (glwthread_mutex_t *mutex)
29{ 30{
31 mutex->owner = 0;
30 InitializeCriticalSection (&mutex->lock); 32 InitializeCriticalSection (&mutex->lock);
31 mutex->guard.done = 1; 33 mutex->guard.done = 1;
32} 34}
@@ -49,7 +51,13 @@ glwthread_mutex_lock (glwthread_mutex_t *mutex)
49 Sleep (0); 51 Sleep (0);
50 } 52 }
51 } 53 }
54 /* If this thread already owns the mutex, POSIX pthread_mutex_lock() is
55 required to deadlock here. But let's not do that on purpose. */
52 EnterCriticalSection (&mutex->lock); 56 EnterCriticalSection (&mutex->lock);
57 {
58 DWORD self = GetCurrentThreadId ();
59 mutex->owner = self;
60 }
53 return 0; 61 return 0;
54} 62}
55 63
@@ -72,6 +80,21 @@ glwthread_mutex_trylock (glwthread_mutex_t *mutex)
72 } 80 }
73 if (!TryEnterCriticalSection (&mutex->lock)) 81 if (!TryEnterCriticalSection (&mutex->lock))
74 return EBUSY; 82 return EBUSY;
83 {
84 DWORD self = GetCurrentThreadId ();
85 /* TryEnterCriticalSection succeeded. This means that the mutex was either
86 previously unlocked (and thus mutex->owner == 0) or previously locked by
87 this thread (and thus mutex->owner == self). Since the mutex is meant to
88 be plain, we need to fail in the latter case. */
89 if (mutex->owner == self)
90 {
91 LeaveCriticalSection (&mutex->lock);
92 return EBUSY;
93 }
94 if (mutex->owner != 0)
95 abort ();
96 mutex->owner = self;
97 }
75 return 0; 98 return 0;
76} 99}
77 100
@@ -80,6 +103,7 @@ glwthread_mutex_unlock (glwthread_mutex_t *mutex)
80{ 103{
81 if (!mutex->guard.done) 104 if (!mutex->guard.done)
82 return EINVAL; 105 return EINVAL;
106 mutex->owner = 0;
83 LeaveCriticalSection (&mutex->lock); 107 LeaveCriticalSection (&mutex->lock);
84 return 0; 108 return 0;
85} 109}
diff --git a/gl/windows-mutex.h b/gl/windows-mutex.h
index 88de4bdc..38eab652 100644
--- a/gl/windows-mutex.h
+++ b/gl/windows-mutex.h
@@ -1,5 +1,5 @@
1/* Plain mutexes (native Windows implementation). 1/* Plain mutexes (native Windows implementation).
2 Copyright (C) 2005-2024 Free Software Foundation, Inc. 2 Copyright (C) 2005-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -28,6 +28,7 @@
28typedef struct 28typedef struct
29 { 29 {
30 glwthread_initguard_t guard; /* protects the initialization */ 30 glwthread_initguard_t guard; /* protects the initialization */
31 DWORD owner;
31 CRITICAL_SECTION lock; 32 CRITICAL_SECTION lock;
32 } 33 }
33 glwthread_mutex_t; 34 glwthread_mutex_t;
diff --git a/gl/windows-once.c b/gl/windows-once.c
index 17854f5c..b3c8a982 100644
--- a/gl/windows-once.c
+++ b/gl/windows-once.c
@@ -1,5 +1,5 @@
1/* Once-only control (native Windows implementation). 1/* Once-only control (native Windows implementation).
2 Copyright (C) 2005-2024 Free Software Foundation, Inc. 2 Copyright (C) 2005-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -29,7 +29,9 @@ glwthread_once (glwthread_once_t *once_control, void (*initfunction) (void))
29{ 29{
30 if (once_control->inited <= 0) 30 if (once_control->inited <= 0)
31 { 31 {
32 if (InterlockedIncrement (&once_control->started) == 0) 32 InterlockedIncrement (&once_control->num_threads);
33 /* If once_control->started is == -1, set it to 0. */
34 if (InterlockedCompareExchange (&once_control->started, 0, -1) < 0)
33 { 35 {
34 /* This thread is the first one to come to this once_control. */ 36 /* This thread is the first one to come to this once_control. */
35 InitializeCriticalSection (&once_control->lock); 37 InitializeCriticalSection (&once_control->lock);
@@ -41,8 +43,6 @@ glwthread_once (glwthread_once_t *once_control, void (*initfunction) (void))
41 } 43 }
42 else 44 else
43 { 45 {
44 /* Don't let once_control->started grow and wrap around. */
45 InterlockedDecrement (&once_control->started);
46 /* Some other thread has already started the initialization. 46 /* Some other thread has already started the initialization.
47 Yield the CPU while waiting for the other thread to finish 47 Yield the CPU while waiting for the other thread to finish
48 initializing and taking the lock. */ 48 initializing and taking the lock. */
@@ -58,5 +58,48 @@ glwthread_once (glwthread_once_t *once_control, void (*initfunction) (void))
58 abort (); 58 abort ();
59 } 59 }
60 } 60 }
61 /* Here once_control->started == 0 and once_control->inited > 0. */
62 if (InterlockedDecrement (&once_control->num_threads) == 0)
63 /* once_control->num_threads is now zero, and
64 once_control->started == 0 and once_control->inited > 0.
65 No other thread will need to use the lock.
66 We can therefore destroy the lock, to free resources. */
67 /* If once_control->inited is == 1, set it to 2. */
68 if (InterlockedCompareExchange (&once_control->inited, 2, 1) == 1)
69 DeleteCriticalSection (&once_control->lock);
61 } 70 }
71 /* Proof of correctness:
72 * num_threads is incremented and then decremented by some threads.
73 Therefore, num_threads always stays >= 0, and is == 0 at the end.
74 * The first thread to go through the once_control->started fence
75 initializes the lock and moves inited from <= 0 to > 0. The other
76 threads don't move inited from <= 0 to > 0.
77 * started, once == 0, stays == 0.
78 * inited, once > 0, stays > 0 (since at the place where it is assigned 0,
79 it cannot be > 0).
80 * inited does not change any more once it is 2.
81 Therefore, it can be changed from 1 to 2 only once.
82 * DeleteCriticalSection gets invoked right after inited has been changed
83 from 1 to 2. Therefore, DeleteCriticalSection gets invoked only once.
84 * After a moment where num_threads was 0 and started was 0 and
85 inited was > 0, no thread can reach an InitializeCriticalSection or
86 EnterCriticalSection invocation. Proof:
87 - At such a moment, no thread is in the code range between
88 InterlockedIncrement (&once_control->num_threads)
89 and
90 InterlockedDecrement (&once_control->num_threads)
91 - After such a moment, some thread can increment num_threads, but from
92 there they cannot reach the InitializeCriticalSection invocation,
93 because the once_control->started test prevents that, and they cannot
94 reach the EnterCriticalSection invocation in the other branch because
95 the
96 if (once_control->inited <= 0)
97 test prevents that.
98 * From this it follows that:
99 - DeleteCriticalSection cannot be executed while the lock is taken
100 (because DeleteCriticalSection is only executed after a moment where
101 num_threads was 0 and started was 0 and inited was > 0).
102 - Once DeleteCriticalSection has been executed, the lock is not used any
103 more.
104 */
62} 105}
diff --git a/gl/windows-once.h b/gl/windows-once.h
index c5bbcd57..886ddb45 100644
--- a/gl/windows-once.h
+++ b/gl/windows-once.h
@@ -1,5 +1,5 @@
1/* Once-only control (native Windows implementation). 1/* Once-only control (native Windows implementation).
2 Copyright (C) 2005-2024 Free Software Foundation, Inc. 2 Copyright (C) 2005-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -25,13 +25,14 @@
25 25
26typedef struct 26typedef struct
27 { 27 {
28 volatile int inited; 28 volatile LONG inited;
29 volatile LONG num_threads;
29 volatile LONG started; 30 volatile LONG started;
30 CRITICAL_SECTION lock; 31 CRITICAL_SECTION lock;
31 } 32 }
32 glwthread_once_t; 33 glwthread_once_t;
33 34
34#define GLWTHREAD_ONCE_INIT { -1, -1 } 35#define GLWTHREAD_ONCE_INIT { -1, 0, -1 }
35 36
36#ifdef __cplusplus 37#ifdef __cplusplus
37extern "C" { 38extern "C" {
diff --git a/gl/windows-recmutex.c b/gl/windows-recmutex.c
index e5672baf..fd6f04db 100644
--- a/gl/windows-recmutex.c
+++ b/gl/windows-recmutex.c
@@ -1,5 +1,5 @@
1/* Plain recursive mutexes (native Windows implementation). 1/* Plain recursive mutexes (native Windows implementation).
2 Copyright (C) 2005-2024 Free Software Foundation, Inc. 2 Copyright (C) 2005-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/windows-recmutex.h b/gl/windows-recmutex.h
index 9fa445b3..1b5773c1 100644
--- a/gl/windows-recmutex.h
+++ b/gl/windows-recmutex.h
@@ -1,5 +1,5 @@
1/* Plain recursive mutexes (native Windows implementation). 1/* Plain recursive mutexes (native Windows implementation).
2 Copyright (C) 2005-2024 Free Software Foundation, Inc. 2 Copyright (C) 2005-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/windows-rwlock.c b/gl/windows-rwlock.c
index e60c4efc..4a5fbfc2 100644
--- a/gl/windows-rwlock.c
+++ b/gl/windows-rwlock.c
@@ -1,5 +1,5 @@
1/* Read-write locks (native Windows implementation). 1/* Read-write locks (native Windows implementation).
2 Copyright (C) 2005-2024 Free Software Foundation, Inc. 2 Copyright (C) 2005-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -46,9 +46,6 @@ glwthread_waitqueue_init (glwthread_waitqueue_t *wq)
46static HANDLE 46static HANDLE
47glwthread_waitqueue_add (glwthread_waitqueue_t *wq) 47glwthread_waitqueue_add (glwthread_waitqueue_t *wq)
48{ 48{
49 HANDLE event;
50 unsigned int index;
51
52 if (wq->count == wq->alloc) 49 if (wq->count == wq->alloc)
53 { 50 {
54 unsigned int new_alloc = 2 * wq->alloc + 1; 51 unsigned int new_alloc = 2 * wq->alloc + 1;
@@ -64,14 +61,13 @@ glwthread_waitqueue_add (glwthread_waitqueue_t *wq)
64 unsigned int old_count = wq->count; 61 unsigned int old_count = wq->count;
65 unsigned int old_alloc = wq->alloc; 62 unsigned int old_alloc = wq->alloc;
66 unsigned int old_offset = wq->offset; 63 unsigned int old_offset = wq->offset;
67 unsigned int i;
68 if (old_offset + old_count > old_alloc) 64 if (old_offset + old_count > old_alloc)
69 { 65 {
70 unsigned int limit = old_offset + old_count - old_alloc; 66 unsigned int limit = old_offset + old_count - old_alloc;
71 for (i = 0; i < limit; i++) 67 for (unsigned int i = 0; i < limit; i++)
72 new_array[old_alloc + i] = new_array[i]; 68 new_array[old_alloc + i] = new_array[i];
73 } 69 }
74 for (i = 0; i < old_count; i++) 70 for (unsigned int i = 0; i < old_count; i++)
75 new_array[i] = new_array[old_offset + i]; 71 new_array[i] = new_array[old_offset + i];
76 wq->offset = 0; 72 wq->offset = 0;
77 } 73 }
@@ -80,11 +76,11 @@ glwthread_waitqueue_add (glwthread_waitqueue_t *wq)
80 } 76 }
81 /* Whether the created event is a manual-reset one or an auto-reset one, 77 /* Whether the created event is a manual-reset one or an auto-reset one,
82 does not matter, since we will wait on it only once. */ 78 does not matter, since we will wait on it only once. */
83 event = CreateEvent (NULL, TRUE, FALSE, NULL); 79 HANDLE event = CreateEvent (NULL, TRUE, FALSE, NULL);
84 if (event == INVALID_HANDLE_VALUE) 80 if (event == INVALID_HANDLE_VALUE)
85 /* No way to allocate an event. */ 81 /* No way to allocate an event. */
86 return INVALID_HANDLE_VALUE; 82 return INVALID_HANDLE_VALUE;
87 index = wq->offset + wq->count; 83 unsigned int index = wq->offset + wq->count;
88 if (index >= wq->alloc) 84 if (index >= wq->alloc)
89 index -= wq->alloc; 85 index -= wq->alloc;
90 wq->array[index] = event; 86 wq->array[index] = event;
@@ -107,9 +103,7 @@ glwthread_waitqueue_notify_first (glwthread_waitqueue_t *wq)
107static void 103static void
108glwthread_waitqueue_notify_all (glwthread_waitqueue_t *wq) 104glwthread_waitqueue_notify_all (glwthread_waitqueue_t *wq)
109{ 105{
110 unsigned int i; 106 for (unsigned int i = 0; i < wq->count; i++)
111
112 for (i = 0; i < wq->count; i++)
113 { 107 {
114 unsigned int index = wq->offset + i; 108 unsigned int index = wq->offset + i;
115 if (index >= wq->alloc) 109 if (index >= wq->alloc)
@@ -160,10 +154,9 @@ glwthread_rwlock_rdlock (glwthread_rwlock_t *lock)
160 HANDLE event = glwthread_waitqueue_add (&lock->waiting_readers); 154 HANDLE event = glwthread_waitqueue_add (&lock->waiting_readers);
161 if (event != INVALID_HANDLE_VALUE) 155 if (event != INVALID_HANDLE_VALUE)
162 { 156 {
163 DWORD result;
164 LeaveCriticalSection (&lock->lock); 157 LeaveCriticalSection (&lock->lock);
165 /* Wait until another thread signals this event. */ 158 /* Wait until another thread signals this event. */
166 result = WaitForSingleObject (event, INFINITE); 159 DWORD result = WaitForSingleObject (event, INFINITE);
167 if (result == WAIT_FAILED || result == WAIT_TIMEOUT) 160 if (result == WAIT_FAILED || result == WAIT_TIMEOUT)
168 abort (); 161 abort ();
169 CloseHandle (event); 162 CloseHandle (event);
@@ -217,10 +210,9 @@ glwthread_rwlock_wrlock (glwthread_rwlock_t *lock)
217 HANDLE event = glwthread_waitqueue_add (&lock->waiting_writers); 210 HANDLE event = glwthread_waitqueue_add (&lock->waiting_writers);
218 if (event != INVALID_HANDLE_VALUE) 211 if (event != INVALID_HANDLE_VALUE)
219 { 212 {
220 DWORD result;
221 LeaveCriticalSection (&lock->lock); 213 LeaveCriticalSection (&lock->lock);
222 /* Wait until another thread signals this event. */ 214 /* Wait until another thread signals this event. */
223 result = WaitForSingleObject (event, INFINITE); 215 DWORD result = WaitForSingleObject (event, INFINITE);
224 if (result == WAIT_FAILED || result == WAIT_TIMEOUT) 216 if (result == WAIT_FAILED || result == WAIT_TIMEOUT)
225 abort (); 217 abort ();
226 CloseHandle (event); 218 CloseHandle (event);
diff --git a/gl/windows-rwlock.h b/gl/windows-rwlock.h
index 08d67750..5b0a6613 100644
--- a/gl/windows-rwlock.h
+++ b/gl/windows-rwlock.h
@@ -1,5 +1,5 @@
1/* Read-write locks (native Windows implementation). 1/* Read-write locks (native Windows implementation).
2 Copyright (C) 2005-2024 Free Software Foundation, Inc. 2 Copyright (C) 2005-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
diff --git a/gl/xalloc-die.c b/gl/xalloc-die.c
index c053c7a8..1a51976e 100644
--- a/gl/xalloc-die.c
+++ b/gl/xalloc-die.c
@@ -1,6 +1,6 @@
1/* Report a memory allocation failure and exit. 1/* Report a memory allocation failure and exit.
2 2
3 Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2024 Free Software 3 Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2026 Free Software
4 Foundation, Inc. 4 Foundation, Inc.
5 5
6 This program is free software: you can redistribute it and/or modify 6 This program is free software: you can redistribute it and/or modify
@@ -26,7 +26,7 @@
26#include "exitfail.h" 26#include "exitfail.h"
27 27
28#include "gettext.h" 28#include "gettext.h"
29#define _(msgid) gettext (msgid) 29#define _(msgid) dgettext (GNULIB_TEXT_DOMAIN, msgid)
30 30
31void 31void
32xalloc_die (void) 32xalloc_die (void)
diff --git a/gl/xalloc-oversized.h b/gl/xalloc-oversized.h
index 7f30f83e..cecdaec5 100644
--- a/gl/xalloc-oversized.h
+++ b/gl/xalloc-oversized.h
@@ -1,6 +1,6 @@
1/* xalloc-oversized.h -- memory allocation size checking 1/* xalloc-oversized.h -- memory allocation size checking
2 2
3 Copyright (C) 1990-2000, 2003-2004, 2006-2024 Free Software Foundation, Inc. 3 Copyright (C) 1990-2000, 2003-2004, 2006-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -47,7 +47,8 @@
47#if 7 <= __GNUC__ && !defined __clang__ && PTRDIFF_MAX < SIZE_MAX 47#if 7 <= __GNUC__ && !defined __clang__ && PTRDIFF_MAX < SIZE_MAX
48# define xalloc_oversized(n, s) \ 48# define xalloc_oversized(n, s) \
49 __builtin_mul_overflow_p (n, s, (ptrdiff_t) 1) 49 __builtin_mul_overflow_p (n, s, (ptrdiff_t) 1)
50#elif 5 <= __GNUC__ && !defined __ICC && PTRDIFF_MAX < SIZE_MAX 50#elif 5 <= __GNUC__ && !defined __clang__ && !defined __ICC \
51 && PTRDIFF_MAX < SIZE_MAX
51# define xalloc_oversized(n, s) \ 52# define xalloc_oversized(n, s) \
52 (__builtin_constant_p (n) && __builtin_constant_p (s) \ 53 (__builtin_constant_p (n) && __builtin_constant_p (s) \
53 ? __xalloc_oversized (n, s) \ 54 ? __xalloc_oversized (n, s) \
diff --git a/gl/xalloc.h b/gl/xalloc.h
index 75a5db30..d3948270 100644
--- a/gl/xalloc.h
+++ b/gl/xalloc.h
@@ -1,6 +1,6 @@
1/* xalloc.h -- malloc with out-of-memory checking 1/* xalloc.h -- malloc with out-of-memory checking
2 2
3 Copyright (C) 1990-2000, 2003-2004, 2006-2024 Free Software Foundation, Inc. 3 Copyright (C) 1990-2000, 2003-2004, 2006-2026 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
diff --git a/gl/xmalloc.c b/gl/xmalloc.c
index 5befdab7..6adc43c0 100644
--- a/gl/xmalloc.c
+++ b/gl/xmalloc.c
@@ -1,6 +1,6 @@
1/* xmalloc.c -- malloc with out of memory checking 1/* xmalloc.c -- malloc with out of memory checking
2 2
3 Copyright (C) 1990-2000, 2002-2006, 2008-2024 Free Software Foundation, Inc. 3 Copyright (C) 1990-2000, 2002-2006, 2008-2026 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
@@ -15,10 +15,8 @@
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 17
18#include <config.h>
19
20#define XALLOC_INLINE _GL_EXTERN_INLINE 18#define XALLOC_INLINE _GL_EXTERN_INLINE
21 19#include <config.h>
22#include "xalloc.h" 20#include "xalloc.h"
23 21
24#include "ialloc.h" 22#include "ialloc.h"
@@ -29,7 +27,13 @@
29#include <stdint.h> 27#include <stdint.h>
30#include <string.h> 28#include <string.h>
31 29
32static void * _GL_ATTRIBUTE_PURE 30/* Pacify GCC up to at least 15.2, which otherwise would incorrectly
31 complain about check_nonnull. */
32#if _GL_GNUC_PREREQ (4, 6)
33# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
34#endif
35
36static void *
33check_nonnull (void *p) 37check_nonnull (void *p)
34{ 38{
35 if (!p) 39 if (!p)
@@ -64,7 +68,7 @@ void *
64xrealloc (void *p, size_t s) 68xrealloc (void *p, size_t s)
65{ 69{
66 void *r = realloc (p, s); 70 void *r = realloc (p, s);
67 if (!r && (!p || s)) 71 if (!r)
68 xalloc_die (); 72 xalloc_die ();
69 return r; 73 return r;
70} 74}
@@ -82,7 +86,7 @@ void *
82xreallocarray (void *p, size_t n, size_t s) 86xreallocarray (void *p, size_t n, size_t s)
83{ 87{
84 void *r = reallocarray (p, n, s); 88 void *r = reallocarray (p, n, s);
85 if (!r && (!p || (n && s))) 89 if (!r)
86 xalloc_die (); 90 xalloc_die ();
87 return r; 91 return r;
88} 92}
@@ -224,13 +228,13 @@ x2nrealloc (void *p, size_t *pn, size_t s)
224void * 228void *
225xpalloc (void *pa, idx_t *pn, idx_t n_incr_min, ptrdiff_t n_max, idx_t s) 229xpalloc (void *pa, idx_t *pn, idx_t n_incr_min, ptrdiff_t n_max, idx_t s)
226{ 230{
227 idx_t n0 = *pn;
228
229 /* The approximate size to use for initial small allocation 231 /* The approximate size to use for initial small allocation
230 requests. This is the largest "small" request for the GNU C 232 requests. This is the largest "small" request for the GNU C
231 library malloc. */ 233 library malloc. */
232 enum { DEFAULT_MXFAST = 64 * sizeof (size_t) / 4 }; 234 enum { DEFAULT_MXFAST = 64 * sizeof (size_t) / 4 };
233 235
236 idx_t n0 = *pn;
237
234 /* If the array is tiny, grow it to about (but no greater than) 238 /* If the array is tiny, grow it to about (but no greater than)
235 DEFAULT_MXFAST bytes. Otherwise, grow it by about 50%. 239 DEFAULT_MXFAST bytes. Otherwise, grow it by about 50%.
236 Adjust the growth according to three constraints: N_INCR_MIN, 240 Adjust the growth according to three constraints: N_INCR_MIN,
diff --git a/gl/xsize.c b/gl/xsize.c
index 87744675..22856eb6 100644
--- a/gl/xsize.c
+++ b/gl/xsize.c
@@ -1,6 +1,6 @@
1/* Checked size_t computations. 1/* Checked size_t computations.
2 2
3 Copyright (C) 2012-2024 Free Software Foundation, Inc. 3 Copyright (C) 2012-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -15,7 +15,6 @@
15 You should have received a copy of the GNU Lesser General Public License 15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 17
18#include <config.h>
19
20#define XSIZE_INLINE _GL_EXTERN_INLINE 18#define XSIZE_INLINE _GL_EXTERN_INLINE
19#include <config.h>
21#include "xsize.h" 20#include "xsize.h"
diff --git a/gl/xsize.h b/gl/xsize.h
index 619c0edc..b76cf49f 100644
--- a/gl/xsize.h
+++ b/gl/xsize.h
@@ -1,6 +1,6 @@
1/* xsize.h -- Checked size_t computations. 1/* xsize.h -- Checked size_t computations.
2 2
3 Copyright (C) 2003, 2008-2024 Free Software Foundation, Inc. 3 Copyright (C) 2003, 2008-2026 Free Software Foundation, Inc.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as 6 it under the terms of the GNU Lesser General Public License as
@@ -26,7 +26,7 @@
26/* Get size_t. */ 26/* Get size_t. */
27#include <stddef.h> 27#include <stddef.h>
28 28
29/* Get SIZE_MAX. */ 29/* Get INT_MAX, SIZE_MAX. */
30#include <limits.h> 30#include <limits.h>
31#if HAVE_STDINT_H 31#if HAVE_STDINT_H
32# include <stdint.h> 32# include <stdint.h>
@@ -61,7 +61,8 @@ extern "C" {
61 void *p = (size_in_bounds_p (size) ? malloc (size) : NULL); 61 void *p = (size_in_bounds_p (size) ? malloc (size) : NULL);
62*/ 62*/
63 63
64/* Convert an arbitrary value >= 0 to type size_t. */ 64/* Convert an arbitrary N >= 0 to type size_t.
65 N should not have side effects. */
65#define xcast_size_t(N) \ 66#define xcast_size_t(N) \
66 ((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX) 67 ((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX)
67 68
@@ -69,8 +70,15 @@ extern "C" {
69XSIZE_INLINE size_t ATTRIBUTE_PURE 70XSIZE_INLINE size_t ATTRIBUTE_PURE
70xsum (size_t size1, size_t size2) 71xsum (size_t size1, size_t size2)
71{ 72{
72 size_t sum = size1 + size2; 73 if (INT_MAX < SIZE_MAX)
73 return (sum >= size1 ? sum : SIZE_MAX); 74 {
75 /* Optimize for the common case where size_t arithmetic wraps
76 around without undefined behavior. */
77 size_t sum = size1 + size2;
78 return size1 <= sum ? sum : SIZE_MAX;
79 }
80
81 return size1 <= SIZE_MAX - size2 ? size1 + size2 : SIZE_MAX;
74} 82}
75 83
76/* Sum of three sizes, with overflow check. */ 84/* Sum of three sizes, with overflow check. */
@@ -98,6 +106,8 @@ xmax (size_t size1, size_t size2)
98 106
99/* Multiplication of a count with an element size, with overflow check. 107/* Multiplication of a count with an element size, with overflow check.
100 The count must be >= 0 and the element size must be > 0. 108 The count must be >= 0 and the element size must be > 0.
109 Arguments should not have side effects.
110 The element size's type should be no wider than size_t.
101 This is a macro, not a function, so that it works correctly even 111 This is a macro, not a function, so that it works correctly even
102 when N is of a wider type and N > SIZE_MAX. */ 112 when N is of a wider type and N > SIZE_MAX. */
103#define xtimes(N, ELSIZE) \ 113#define xtimes(N, ELSIZE) \