summaryrefslogtreecommitdiffstats
path: root/gl
diff options
context:
space:
mode:
Diffstat (limited to 'gl')
-rw-r--r--gl/Makefile.am1040
-rw-r--r--gl/_Noreturn.h41
-rw-r--r--gl/af_alg.c2
-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.c21
-rw-r--r--gl/arpa_inet.in.h58
-rw-r--r--gl/asnprintf.c2
-rw-r--r--gl/asprintf.c2
-rw-r--r--gl/assert.in.h2
-rw-r--r--gl/attribute.h132
-rw-r--r--gl/base64.c8
-rw-r--r--gl/base64.h4
-rw-r--r--gl/basename-lgpl.c2
-rw-r--r--gl/basename-lgpl.h2
-rw-r--r--gl/basename.c2
-rw-r--r--gl/btowc.c2
-rw-r--r--gl/byteswap.c21
-rw-r--r--gl/byteswap.in.h106
-rw-r--r--gl/c++defs.h50
-rw-r--r--gl/c-ctype.c21
-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.c17
-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.c2
-rw-r--r--gl/dirname.c2
-rw-r--r--gl/dirname.h2
-rw-r--r--gl/dup2.c2
-rw-r--r--gl/dynarray.h2
-rw-r--r--gl/errno.in.h11
-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.c47
-rw-r--r--gl/fcntl.in.h41
-rw-r--r--gl/fd-hook.c2
-rw-r--r--gl/fd-hook.h2
-rw-r--r--gl/fflush.c15
-rw-r--r--gl/filename.h2
-rw-r--r--gl/float+.h2
-rw-r--r--gl/float.c99
-rw-r--r--gl/float.in.h221
-rw-r--r--gl/floor.c2
-rw-r--r--gl/floorf.c2
-rw-r--r--gl/fopen.c6
-rw-r--r--gl/fpurge.c8
-rw-r--r--gl/freading.c8
-rw-r--r--gl/freading.h2
-rw-r--r--gl/free.c2
-rw-r--r--gl/fseek.c2
-rw-r--r--gl/fseeko.c24
-rw-r--r--gl/fseterr.c84
-rw-r--r--gl/fseterr.h55
-rw-r--r--gl/fstat.c2
-rw-r--r--gl/fsusage.c2
-rw-r--r--gl/fsusage.h2
-rw-r--r--gl/ftell.c2
-rw-r--r--gl/ftello.c11
-rw-r--r--gl/gai_strerror.c6
-rw-r--r--gl/getaddrinfo.c74
-rw-r--r--gl/getdelim.c2
-rw-r--r--gl/getdtablesize.c2
-rw-r--r--gl/gethostname.c2
-rw-r--r--gl/getline.c2
-rw-r--r--gl/getloadavg.c48
-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.c8
-rw-r--r--gl/getopt.in.h7
-rw-r--r--gl/getopt1.c2
-rw-r--r--gl/getopt_int.h2
-rw-r--r--gl/getprogname.c2
-rw-r--r--gl/getprogname.h2
-rw-r--r--gl/gettext.h114
-rw-r--r--gl/gl_openssl.h2
-rw-r--r--gl/glthread/lock.c46
-rw-r--r--gl/glthread/lock.h153
-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.c2
-rw-r--r--gl/hard-locale.h2
-rw-r--r--gl/ialloc.c2
-rw-r--r--gl/ialloc.h39
-rw-r--r--gl/idpriv-droptemp.c14
-rw-r--r--gl/idpriv.h2
-rw-r--r--gl/idx.h2
-rw-r--r--gl/inet_ntop.c4
-rw-r--r--gl/inet_pton.c268
-rw-r--r--gl/intprops-internal.h27
-rw-r--r--gl/intprops.h10
-rw-r--r--gl/inttypes.in.h18
-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.h49
-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.h8
-rw-r--r--gl/localcharset.c10
-rw-r--r--gl/localcharset.h2
-rw-r--r--gl/locale.in.h195
-rw-r--r--gl/localeconv.c2
-rw-r--r--gl/lseek.c2
-rw-r--r--gl/lstat.c104
-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.m476
-rw-r--r--gl/m4/base64.m43
-rw-r--r--gl/m4/btowc.m413
-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.m413
-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.m43
-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.m43
-rw-r--r--gl/m4/fflush.m414
-rw-r--r--gl/m4/float_h.m430
-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.m43
-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.m44
-rw-r--r--gl/m4/ftell.m43
-rw-r--r--gl/m4/ftello.m49
-rw-r--r--gl/m4/getaddrinfo.m446
-rw-r--r--gl/m4/getdelim.m43
-rw-r--r--gl/m4/getdtablesize.m43
-rw-r--r--gl/m4/gethostname.m43
-rw-r--r--gl/m4/getline.m43
-rw-r--r--gl/m4/getloadavg.m45
-rw-r--r--gl/m4/getopt.m416
-rw-r--r--gl/m4/getprogname.m43
-rw-r--r--gl/m4/gl-openssl.m43
-rw-r--r--gl/m4/gnulib-cache.m42
-rw-r--r--gl/m4/gnulib-common.m4457
-rw-r--r--gl/m4/gnulib-comp.m4517
-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.m43
-rw-r--r--gl/m4/inet_pton.m472
-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.m420
-rw-r--r--gl/m4/largefile.m411
-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.m425
-rw-r--r--gl/m4/locale-ja.m410
-rw-r--r--gl/m4/locale-zh.m424
-rw-r--r--gl/m4/locale_h.m452
-rw-r--r--gl/m4/localeconv.m43
-rw-r--r--gl/m4/lock.m43
-rw-r--r--gl/m4/lseek.m43
-rw-r--r--gl/m4/lstat.m482
-rw-r--r--gl/m4/malloc.m4139
-rw-r--r--gl/m4/malloca.m47
-rw-r--r--gl/m4/math_h.m414
-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.m437
-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.m47
-rw-r--r--gl/m4/minmax.m43
-rw-r--r--gl/m4/mktime.m46
-rw-r--r--gl/m4/mmap-anon.m43
-rw-r--r--gl/m4/mode_t.m43
-rw-r--r--gl/m4/mountlist.m418
-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.m413
-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.m4288
-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.m43
-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.m47
-rw-r--r--gl/m4/setlocale_null.m47
-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.m43
-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.m427
-rw-r--r--gl/m4/stdalign.m418
-rw-r--r--gl/m4/stdckdint_h.m4136
-rw-r--r--gl/m4/stddef_h.m463
-rw-r--r--gl/m4/stdint.m47
-rw-r--r--gl/m4/stdint_h.m43
-rw-r--r--gl/m4/stdio_h.m417
-rw-r--r--gl/m4/stdlib_h.m466
-rw-r--r--gl/m4/strcasecmp.m467
-rw-r--r--gl/m4/strcasestr.m47
-rw-r--r--gl/m4/strerror.m43
-rw-r--r--gl/m4/string_h.m419
-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.m47
-rw-r--r--gl/m4/sys_cdefs_h.m426
-rw-r--r--gl/m4/sys_socket_h.m448
-rw-r--r--gl/m4/sys_stat_h.m43
-rw-r--r--gl/m4/sys_types_h.m416
-rw-r--r--gl/m4/sys_uio_h.m43
-rw-r--r--gl/m4/threadlib.m4376
-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.m43
-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.m46
-rw-r--r--gl/m4/wchar_t.m425
-rw-r--r--gl/m4/wcrtomb.m413
-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.h487
-rw-r--r--gl/mbchar.c23
-rw-r--r--gl/mbchar.h383
-rw-r--r--gl/mbiterf.c21
-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.h2
-rw-r--r--gl/mbrtowc.c2
-rw-r--r--gl/mbsinit.c2
-rw-r--r--gl/mbsnlen.c60
-rw-r--r--gl/mbszero.c2
-rw-r--r--gl/mbtowc-impl.h2
-rw-r--r--gl/mbtowc-lock.c2
-rw-r--r--gl/mbtowc-lock.h2
-rw-r--r--gl/mbtowc.c2
-rw-r--r--gl/memchr.c2
-rw-r--r--gl/memchr.valgrind2
-rw-r--r--gl/minmax.h2
-rw-r--r--gl/mktime-internal.h16
-rw-r--r--gl/mktime.c163
-rw-r--r--gl/mountlist.c244
-rw-r--r--gl/mountlist.h7
-rw-r--r--gl/msvc-inval.c2
-rw-r--r--gl/msvc-inval.h2
-rw-r--r--gl/msvc-nothrow.c2
-rw-r--r--gl/msvc-nothrow.h2
-rw-r--r--gl/netdb.in.h33
-rw-r--r--gl/netinet_in.in.h2
-rw-r--r--gl/nl_langinfo-lock.c2
-rw-r--r--gl/nl_langinfo.c105
-rw-r--r--gl/open.c121
-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.c8
-rw-r--r--gl/printf-parse.h2
-rw-r--r--gl/pthread-once.c148
-rw-r--r--gl/pthread.h2571
-rw-r--r--gl/pthread.in.h2032
-rw-r--r--gl/realloc.c73
-rw-r--r--gl/reallocarray.c4
-rw-r--r--gl/regcomp.c67
-rw-r--r--gl/regex.c2
-rw-r--r--gl/regex.h51
-rw-r--r--gl/regex_internal.c9
-rw-r--r--gl/regex_internal.h12
-rw-r--r--gl/regexec.c18
-rw-r--r--gl/sched.h631
-rw-r--r--gl/sched.in.h111
-rw-r--r--gl/setenv.c97
-rw-r--r--gl/setlocale-lock.c2
-rw-r--r--gl/setlocale_null-unlocked.c2
-rw-r--r--gl/setlocale_null.c2
-rw-r--r--gl/setlocale_null.h2
-rw-r--r--gl/sha256-stream.c12
-rw-r--r--gl/sha256.c2
-rw-r--r--gl/sha256.h2
-rw-r--r--gl/size_max.h2
-rw-r--r--gl/snprintf.c41
-rw-r--r--gl/sockets.c2
-rw-r--r--gl/sockets.h4
-rw-r--r--gl/stat-time.c2
-rw-r--r--gl/stat-time.h45
-rw-r--r--gl/stat-w32.c2
-rw-r--r--gl/stat-w32.h2
-rw-r--r--gl/stat.c6
-rw-r--r--gl/stdckdint.in.h41
-rw-r--r--gl/stddef.in.h103
-rw-r--r--gl/stdint.in.h13
-rw-r--r--gl/stdio-consolesafe.c199
-rw-r--r--gl/stdio-impl.h116
-rw-r--r--gl/stdio-read.c2
-rw-r--r--gl/stdio-write.c8
-rw-r--r--gl/stdio.in.h587
-rw-r--r--gl/stdlib.c21
-rw-r--r--gl/stdlib.in.h497
-rw-r--r--gl/str-two-way.h2
-rw-r--r--gl/strcasecmp.c6
-rw-r--r--gl/strcasestr.c2
-rw-r--r--gl/streq.h4
-rw-r--r--gl/strerror-override.c7
-rw-r--r--gl/strerror-override.h5
-rw-r--r--gl/strerror.c8
-rw-r--r--gl/string.in.h483
-rw-r--r--gl/strings.in.h150
-rw-r--r--gl/stripslash.c2
-rw-r--r--gl/strncasecmp.c6
-rw-r--r--gl/strncpy.c38
-rw-r--r--gl/strsep.c2
-rw-r--r--gl/strstr.c2
-rw-r--r--gl/sys-limits.h2
-rw-r--r--gl/sys_socket.c4
-rw-r--r--gl/sys_socket.in.h127
-rw-r--r--gl/sys_stat.in.h104
-rw-r--r--gl/sys_types.in.h27
-rw-r--r--gl/sys_uio.in.h2
-rw-r--r--gl/time.in.h116
-rw-r--r--gl/time_r.c2
-rw-r--r--gl/timegm.c5
-rw-r--r--gl/uchar.h1456
-rw-r--r--gl/uchar.in.h912
-rw-r--r--gl/unicase.h472
-rw-r--r--gl/unicase.in.h471
-rw-r--r--gl/unicase/.deps/.dirstamp0
-rw-r--r--gl/unicase/.deps/libgnu_a-tolower.Po49
-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.h743
-rw-r--r--gl/unictype.h1148
-rw-r--r--gl/unictype.in.h1146
-rw-r--r--gl/unictype/.deps/.dirstamp0
-rw-r--r--gl/unictype/.deps/libgnu_a-ctype_alnum.Po48
-rw-r--r--gl/unictype/.deps/libgnu_a-ctype_alpha.Po48
-rw-r--r--gl/unictype/.deps/libgnu_a-ctype_blank.Po48
-rw-r--r--gl/unictype/.deps/libgnu_a-ctype_cntrl.Po48
-rw-r--r--gl/unictype/.deps/libgnu_a-ctype_digit.Po48
-rw-r--r--gl/unictype/.deps/libgnu_a-ctype_graph.Po48
-rw-r--r--gl/unictype/.deps/libgnu_a-ctype_lower.Po48
-rw-r--r--gl/unictype/.deps/libgnu_a-ctype_print.Po48
-rw-r--r--gl/unictype/.deps/libgnu_a-ctype_punct.Po48
-rw-r--r--gl/unictype/.deps/libgnu_a-ctype_space.Po48
-rw-r--r--gl/unictype/.deps/libgnu_a-ctype_upper.Po48
-rw-r--r--gl/unictype/.deps/libgnu_a-ctype_xdigit.Po48
-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.h897
-rw-r--r--gl/unictype/ctype_alpha.c32
-rw-r--r--gl/unictype/ctype_alpha.h897
-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.h1202
-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.h1202
-rw-r--r--gl/unictype/ctype_punct.c32
-rw-r--r--gl/unictype/ctype_punct.h870
-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.h256
-rw-r--r--gl/uninorm.in.h255
-rw-r--r--gl/unistd.c4
-rw-r--r--gl/unistd.in.h443
-rw-r--r--gl/unitypes.h72
-rw-r--r--gl/unitypes.in.h71
-rw-r--r--gl/uniwidth.h73
-rw-r--r--gl/uniwidth.in.h72
-rw-r--r--gl/uniwidth/.deps/.dirstamp0
-rw-r--r--gl/uniwidth/.deps/libgnu_a-width.Po60
-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.h495
-rw-r--r--gl/uniwidth/width2.h541
-rw-r--r--gl/unlocked-io.h2
-rw-r--r--gl/unsetenv.c34
-rw-r--r--gl/vasnprintf.c1451
-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.c65
-rw-r--r--gl/w32sock.h2
-rw-r--r--gl/warn-on-use.h10
-rw-r--r--gl/wchar.in.h313
-rw-r--r--gl/wcrtomb.c2
-rw-r--r--gl/wctype-h.c4
-rw-r--r--gl/wctype-impl.h2
-rw-r--r--gl/wctype.c2
-rw-r--r--gl/wctype.in.h28
-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.c2
-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.c6
-rw-r--r--gl/xsize.c2
-rw-r--r--gl/xsize.h20
535 files changed, 37892 insertions, 3777 deletions
diff --git a/gl/Makefile.am b/gl/Makefile.am
index df988b37..f462fdb7 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-2025 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
@@ -80,9 +80,9 @@ AM_CFLAGS =
80noinst_LIBRARIES += libgnu.a 80noinst_LIBRARIES += libgnu.a
81 81
82libgnu_a_SOURCES = 82libgnu_a_SOURCES =
83libgnu_a_CFLAGS = $(AM_CFLAGS) $(GL_CFLAG_GNULIB_WARNINGS) 83libgnu_a_CFLAGS = $(AM_CFLAGS) $(GL_CFLAG_GNULIB_WARNINGS) $(GL_CFLAG_ALLOW_WARNINGS)
84libgnu_a_LIBADD = $(gl_LIBOBJS) 84libgnu_a_LIBADD = $(gl_libgnu_LIBOBJS)
85libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) 85libgnu_a_DEPENDENCIES = $(gl_libgnu_LIBOBJS)
86EXTRA_libgnu_a_SOURCES = 86EXTRA_libgnu_a_SOURCES =
87 87
88## begin gnulib module absolute-header 88## begin gnulib module absolute-header
@@ -116,9 +116,10 @@ EXTRA_DIST += alloca.in.h
116 116
117## end gnulib module alloca-opt 117## end gnulib module alloca-opt
118 118
119## begin gnulib module arpa_inet 119## begin gnulib module arpa_inet-h
120 120
121BUILT_SOURCES += arpa/inet.h 121BUILT_SOURCES += arpa/inet.h
122libgnu_a_SOURCES += arpa_inet.c
122 123
123# We need the following in order to create <arpa/inet.h> when the system 124# We need the following in order to create <arpa/inet.h> when the system
124# doesn't have one. 125# doesn't have one.
@@ -135,8 +136,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' \ 136 -e 's/@''GNULIB_INET_NTOP''@/$(GL_GNULIB_INET_NTOP)/g' \
136 -e 's/@''GNULIB_INET_PTON''@/$(GL_GNULIB_INET_PTON)/g' \ 137 -e 's/@''GNULIB_INET_PTON''@/$(GL_GNULIB_INET_PTON)/g' \
137 -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \ 138 -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \
139 -e 's|@''HAVE_DECL_HTONL''@|$(HAVE_DECL_HTONL)|g' \
140 -e 's|@''HAVE_DECL_HTONS''@|$(HAVE_DECL_HTONS)|g' \
138 -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \ 141 -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \
139 -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \ 142 -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \
143 -e 's|@''HAVE_DECL_NTOHL''@|$(HAVE_DECL_NTOHL)|g' \
144 -e 's|@''HAVE_DECL_NTOHS''@|$(HAVE_DECL_NTOHS)|g' \
140 -e 's|@''REPLACE_INET_NTOP''@|$(REPLACE_INET_NTOP)|g' \ 145 -e 's|@''REPLACE_INET_NTOP''@|$(REPLACE_INET_NTOP)|g' \
141 -e 's|@''REPLACE_INET_PTON''@|$(REPLACE_INET_PTON)|g' \ 146 -e 's|@''REPLACE_INET_PTON''@|$(REPLACE_INET_PTON)|g' \
142 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ 147 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
@@ -149,7 +154,7 @@ MOSTLYCLEANDIRS += arpa
149 154
150EXTRA_DIST += arpa_inet.in.h 155EXTRA_DIST += arpa_inet.in.h
151 156
152## end gnulib module arpa_inet 157## end gnulib module arpa_inet-h
153 158
154## begin gnulib module assert-h 159## begin gnulib module assert-h
155 160
@@ -221,6 +226,7 @@ if GL_GENERATE_BYTESWAP_H
221byteswap.h: byteswap.in.h $(top_builddir)/config.status 226byteswap.h: byteswap.in.h $(top_builddir)/config.status
222 $(gl_V_at)$(SED_HEADER_TO_AT_t) $(srcdir)/byteswap.in.h 227 $(gl_V_at)$(SED_HEADER_TO_AT_t) $(srcdir)/byteswap.in.h
223 $(AM_V_at)mv $@-t $@ 228 $(AM_V_at)mv $@-t $@
229libgnu_a_SOURCES += byteswap.c
224else 230else
225byteswap.h: $(top_builddir)/config.status 231byteswap.h: $(top_builddir)/config.status
226 rm -f $@ 232 rm -f $@
@@ -231,6 +237,122 @@ EXTRA_DIST += byteswap.in.h
231 237
232## end gnulib module byteswap 238## end gnulib module byteswap
233 239
240## begin gnulib module c-ctype
241
242libgnu_a_SOURCES += c-ctype.h c-ctype.c
243
244## end gnulib module c-ctype
245
246## begin gnulib module c32isalnum
247
248libgnu_a_SOURCES += c32isalnum.c
249
250EXTRA_DIST += c32is-impl.h
251
252## end gnulib module c32isalnum
253
254## begin gnulib module c32isalpha
255
256libgnu_a_SOURCES += c32isalpha.c
257
258EXTRA_DIST += c32is-impl.h
259
260## end gnulib module c32isalpha
261
262## begin gnulib module c32isblank
263
264libgnu_a_SOURCES += c32isblank.c
265
266EXTRA_DIST += c32is-impl.h
267
268## end gnulib module c32isblank
269
270## begin gnulib module c32iscntrl
271
272libgnu_a_SOURCES += c32iscntrl.c
273
274EXTRA_DIST += c32is-impl.h
275
276## end gnulib module c32iscntrl
277
278## begin gnulib module c32isdigit
279
280libgnu_a_SOURCES += c32isdigit.c
281
282EXTRA_DIST += c32is-impl.h
283
284## end gnulib module c32isdigit
285
286## begin gnulib module c32isgraph
287
288libgnu_a_SOURCES += c32isgraph.c
289
290EXTRA_DIST += c32is-impl.h
291
292## end gnulib module c32isgraph
293
294## begin gnulib module c32islower
295
296libgnu_a_SOURCES += c32islower.c
297
298EXTRA_DIST += c32is-impl.h
299
300## end gnulib module c32islower
301
302## begin gnulib module c32isprint
303
304libgnu_a_SOURCES += c32isprint.c
305
306EXTRA_DIST += c32is-impl.h
307
308## end gnulib module c32isprint
309
310## begin gnulib module c32ispunct
311
312libgnu_a_SOURCES += c32ispunct.c
313
314EXTRA_DIST += c32is-impl.h
315
316## end gnulib module c32ispunct
317
318## begin gnulib module c32isspace
319
320libgnu_a_SOURCES += c32isspace.c
321
322EXTRA_DIST += c32is-impl.h
323
324## end gnulib module c32isspace
325
326## begin gnulib module c32isupper
327
328libgnu_a_SOURCES += c32isupper.c
329
330EXTRA_DIST += c32is-impl.h
331
332## end gnulib module c32isupper
333
334## begin gnulib module c32isxdigit
335
336libgnu_a_SOURCES += c32isxdigit.c
337
338EXTRA_DIST += c32is-impl.h
339
340## end gnulib module c32isxdigit
341
342## begin gnulib module c32tolower
343
344libgnu_a_SOURCES += c32tolower.c
345
346EXTRA_DIST += c32to-impl.h
347
348## end gnulib module c32tolower
349
350## begin gnulib module c32width
351
352libgnu_a_SOURCES += c32width.c
353
354## end gnulib module c32width
355
234## begin gnulib module calloc-gnu 356## begin gnulib module calloc-gnu
235 357
236 358
@@ -313,7 +435,7 @@ endif
313 435
314## end gnulib module dup2 436## end gnulib module dup2
315 437
316## begin gnulib module errno 438## begin gnulib module errno-h
317 439
318BUILT_SOURCES += $(ERRNO_H) 440BUILT_SOURCES += $(ERRNO_H)
319 441
@@ -343,7 +465,7 @@ MOSTLYCLEANFILES += errno.h errno.h-t
343 465
344EXTRA_DIST += errno.in.h 466EXTRA_DIST += errno.in.h
345 467
346## end gnulib module errno 468## end gnulib module errno-h
347 469
348## begin gnulib module error 470## begin gnulib module error
349 471
@@ -455,7 +577,7 @@ EXTRA_DIST += filename.h
455 577
456## end gnulib module filename 578## end gnulib module filename
457 579
458## begin gnulib module float 580## begin gnulib module float-h
459 581
460BUILT_SOURCES += $(FLOAT_H) 582BUILT_SOURCES += $(FLOAT_H)
461 583
@@ -487,7 +609,7 @@ endif
487 609
488EXTRA_DIST += float.in.h 610EXTRA_DIST += float.in.h
489 611
490## end gnulib module float 612## end gnulib module float-h
491 613
492## begin gnulib module floorf 614## begin gnulib module floorf
493 615
@@ -563,6 +685,16 @@ EXTRA_DIST += stdio-impl.h
563 685
564## end gnulib module fseeko 686## end gnulib module fseeko
565 687
688## begin gnulib module fseterr
689
690if GL_COND_OBJ_FSETERR
691libgnu_a_SOURCES += fseterr.c
692endif
693
694EXTRA_DIST += fseterr.h stdio-impl.h
695
696## end gnulib module fseterr
697
566## begin gnulib module fstat 698## begin gnulib module fstat
567 699
568if GL_COND_OBJ_FSTAT 700if GL_COND_OBJ_FSTAT
@@ -807,6 +939,14 @@ endif
807 939
808## end gnulib module inet_ntop 940## end gnulib module inet_ntop
809 941
942## begin gnulib module inet_pton
943
944if GL_COND_OBJ_INET_PTON
945libgnu_a_SOURCES += inet_pton.c
946endif
947
948## end gnulib module inet_pton
949
810## begin gnulib module intprops 950## begin gnulib module intprops
811 951
812 952
@@ -814,7 +954,7 @@ EXTRA_DIST += intprops-internal.h intprops.h
814 954
815## end gnulib module intprops 955## end gnulib module intprops
816 956
817## begin gnulib module inttypes-incomplete 957## begin gnulib module inttypes-h-incomplete
818 958
819BUILT_SOURCES += inttypes.h 959BUILT_SOURCES += inttypes.h
820 960
@@ -855,7 +995,7 @@ MOSTLYCLEANFILES += inttypes.h inttypes.h-t
855 995
856EXTRA_DIST += inttypes.in.h 996EXTRA_DIST += inttypes.in.h
857 997
858## end gnulib module inttypes-incomplete 998## end gnulib module inttypes-h-incomplete
859 999
860## begin gnulib module iswblank 1000## begin gnulib module iswblank
861 1001
@@ -899,7 +1039,7 @@ endif
899 1039
900## end gnulib module iswxdigit 1040## end gnulib module iswxdigit
901 1041
902## begin gnulib module langinfo 1042## begin gnulib module langinfo-h
903 1043
904BUILT_SOURCES += langinfo.h 1044BUILT_SOURCES += langinfo.h
905 1045
@@ -917,6 +1057,7 @@ langinfo.h: langinfo.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_U
917 -e 's|@''HAVE_LANGINFO_CODESET''@|$(HAVE_LANGINFO_CODESET)|g' \ 1057 -e 's|@''HAVE_LANGINFO_CODESET''@|$(HAVE_LANGINFO_CODESET)|g' \
918 -e 's|@''HAVE_LANGINFO_T_FMT_AMPM''@|$(HAVE_LANGINFO_T_FMT_AMPM)|g' \ 1058 -e 's|@''HAVE_LANGINFO_T_FMT_AMPM''@|$(HAVE_LANGINFO_T_FMT_AMPM)|g' \
919 -e 's|@''HAVE_LANGINFO_ALTMON''@|$(HAVE_LANGINFO_ALTMON)|g' \ 1059 -e 's|@''HAVE_LANGINFO_ALTMON''@|$(HAVE_LANGINFO_ALTMON)|g' \
1060 -e 's|@''HAVE_LANGINFO_ABALTMON''@|$(HAVE_LANGINFO_ABALTMON)|g' \
920 -e 's|@''HAVE_LANGINFO_ERA''@|$(HAVE_LANGINFO_ERA)|g' \ 1061 -e 's|@''HAVE_LANGINFO_ERA''@|$(HAVE_LANGINFO_ERA)|g' \
921 -e 's|@''HAVE_LANGINFO_YESEXPR''@|$(HAVE_LANGINFO_YESEXPR)|g' \ 1062 -e 's|@''HAVE_LANGINFO_YESEXPR''@|$(HAVE_LANGINFO_YESEXPR)|g' \
922 -e 's|@''HAVE_NL_LANGINFO''@|$(HAVE_NL_LANGINFO)|g' \ 1063 -e 's|@''HAVE_NL_LANGINFO''@|$(HAVE_NL_LANGINFO)|g' \
@@ -929,7 +1070,7 @@ MOSTLYCLEANFILES += langinfo.h langinfo.h-t
929 1070
930EXTRA_DIST += langinfo.in.h 1071EXTRA_DIST += langinfo.in.h
931 1072
932## end gnulib module langinfo 1073## end gnulib module langinfo-h
933 1074
934## begin gnulib module libc-config 1075## begin gnulib module libc-config
935 1076
@@ -972,7 +1113,7 @@ EXTRA_DIST += localcharset.h
972 1113
973## end gnulib module localcharset 1114## end gnulib module localcharset
974 1115
975## begin gnulib module locale 1116## begin gnulib module locale-h
976 1117
977BUILT_SOURCES += locale.h 1118BUILT_SOURCES += locale.h
978 1119
@@ -985,20 +1126,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' \ 1126 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
986 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ 1127 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
987 -e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \ 1128 -e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \
1129 -e 's|@''HAVE_LOCALE_T''@|$(HAVE_LOCALE_T)|g' \
1130 -e 's|@''HAVE_WINDOWS_LOCALE_T''@|$(HAVE_WINDOWS_LOCALE_T)|g' \
988 -e 's/@''GNULIB_LOCALECONV''@/$(GL_GNULIB_LOCALECONV)/g' \ 1131 -e 's/@''GNULIB_LOCALECONV''@/$(GL_GNULIB_LOCALECONV)/g' \
989 -e 's/@''GNULIB_SETLOCALE''@/$(GL_GNULIB_SETLOCALE)/g' \ 1132 -e 's/@''GNULIB_SETLOCALE''@/$(GL_GNULIB_SETLOCALE)/g' \
990 -e 's/@''GNULIB_SETLOCALE_NULL''@/$(GL_GNULIB_SETLOCALE_NULL)/g' \ 1133 -e 's/@''GNULIB_SETLOCALE_NULL''@/$(GL_GNULIB_SETLOCALE_NULL)/g' \
1134 -e 's/@''GNULIB_NEWLOCALE''@/$(GL_GNULIB_NEWLOCALE)/g' \
991 -e 's/@''GNULIB_DUPLOCALE''@/$(GL_GNULIB_DUPLOCALE)/g' \ 1135 -e 's/@''GNULIB_DUPLOCALE''@/$(GL_GNULIB_DUPLOCALE)/g' \
1136 -e 's/@''GNULIB_FREELOCALE''@/$(GL_GNULIB_FREELOCALE)/g' \
1137 -e 's/@''GNULIB_GETLOCALENAME_L''@/$(GL_GNULIB_GETLOCALENAME_L)/g' \
1138 -e 's/@''GNULIB_GETLOCALENAME_L_UNSAFE''@/$(GL_GNULIB_GETLOCALENAME_L_UNSAFE)/g' \
992 -e 's/@''GNULIB_LOCALENAME_UNSAFE''@/$(GL_GNULIB_LOCALENAME_UNSAFE)/g' \ 1139 -e 's/@''GNULIB_LOCALENAME_UNSAFE''@/$(GL_GNULIB_LOCALENAME_UNSAFE)/g' \
993 -e 's|@''HAVE_NEWLOCALE''@|$(HAVE_NEWLOCALE)|g' \ 1140 -e 's|@''HAVE_NEWLOCALE''@|$(HAVE_NEWLOCALE)|g' \
994 -e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \ 1141 -e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \
995 -e 's|@''HAVE_FREELOCALE''@|$(HAVE_FREELOCALE)|g' \ 1142 -e 's|@''HAVE_FREELOCALE''@|$(HAVE_FREELOCALE)|g' \
1143 -e 's|@''HAVE_GETLOCALENAME_L''@|$(HAVE_GETLOCALENAME_L)|g' \
996 -e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \ 1144 -e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \
997 -e 's|@''REPLACE_LOCALECONV''@|$(REPLACE_LOCALECONV)|g' \ 1145 -e 's|@''REPLACE_LOCALECONV''@|$(REPLACE_LOCALECONV)|g' \
998 -e 's|@''REPLACE_SETLOCALE''@|$(REPLACE_SETLOCALE)|g' \ 1146 -e 's|@''REPLACE_SETLOCALE''@|$(REPLACE_SETLOCALE)|g' \
999 -e 's|@''REPLACE_NEWLOCALE''@|$(REPLACE_NEWLOCALE)|g' \ 1147 -e 's|@''REPLACE_NEWLOCALE''@|$(REPLACE_NEWLOCALE)|g' \
1000 -e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \ 1148 -e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \
1001 -e 's|@''REPLACE_FREELOCALE''@|$(REPLACE_FREELOCALE)|g' \ 1149 -e 's|@''REPLACE_FREELOCALE''@|$(REPLACE_FREELOCALE)|g' \
1150 -e 's|@''REPLACE_GETLOCALENAME_L''@|$(REPLACE_GETLOCALENAME_L)|g' \
1002 -e 's|@''REPLACE_STRUCT_LCONV''@|$(REPLACE_STRUCT_LCONV)|g' \ 1151 -e 's|@''REPLACE_STRUCT_LCONV''@|$(REPLACE_STRUCT_LCONV)|g' \
1003 -e 's|@''LOCALENAME_ENHANCE_LOCALE_FUNCS''@|$(LOCALENAME_ENHANCE_LOCALE_FUNCS)|g' \ 1152 -e 's|@''LOCALENAME_ENHANCE_LOCALE_FUNCS''@|$(LOCALENAME_ENHANCE_LOCALE_FUNCS)|g' \
1004 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ 1153 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
@@ -1010,7 +1159,7 @@ MOSTLYCLEANFILES += locale.h locale.h-t
1010 1159
1011EXTRA_DIST += locale.in.h 1160EXTRA_DIST += locale.in.h
1012 1161
1013## end gnulib module locale 1162## end gnulib module locale-h
1014 1163
1015## begin gnulib module localeconv 1164## begin gnulib module localeconv
1016 1165
@@ -1034,6 +1183,14 @@ endif
1034 1183
1035## end gnulib module lseek 1184## end gnulib module lseek
1036 1185
1186## begin gnulib module lstat
1187
1188if GL_COND_OBJ_LSTAT
1189libgnu_a_SOURCES += lstat.c
1190endif
1191
1192## end gnulib module lstat
1193
1037## begin gnulib module malloc-gnu 1194## begin gnulib module malloc-gnu
1038 1195
1039 1196
@@ -1060,7 +1217,7 @@ EXTRA_DIST += malloca.h
1060 1217
1061## end gnulib module malloca 1218## end gnulib module malloca
1062 1219
1063## begin gnulib module math 1220## begin gnulib module math-h
1064 1221
1065BUILT_SOURCES += math.h 1222BUILT_SOURCES += math.h
1066libgnu_a_SOURCES += math.c 1223libgnu_a_SOURCES += math.c
@@ -1150,6 +1307,9 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
1150 -e 's/@''GNULIB_LOGB''@/$(GL_GNULIB_LOGB)/g' \ 1307 -e 's/@''GNULIB_LOGB''@/$(GL_GNULIB_LOGB)/g' \
1151 -e 's/@''GNULIB_LOGBF''@/$(GL_GNULIB_LOGBF)/g' \ 1308 -e 's/@''GNULIB_LOGBF''@/$(GL_GNULIB_LOGBF)/g' \
1152 -e 's/@''GNULIB_LOGBL''@/$(GL_GNULIB_LOGBL)/g' \ 1309 -e 's/@''GNULIB_LOGBL''@/$(GL_GNULIB_LOGBL)/g' \
1310 -e 's/@''GNULIB_LOGP1''@/$(GL_GNULIB_LOGP1)/g' \
1311 -e 's/@''GNULIB_LOGP1F''@/$(GL_GNULIB_LOGP1F)/g' \
1312 -e 's/@''GNULIB_LOGP1L''@/$(GL_GNULIB_LOGP1L)/g' \
1153 -e 's/@''GNULIB_MODF''@/$(GL_GNULIB_MODF)/g' \ 1313 -e 's/@''GNULIB_MODF''@/$(GL_GNULIB_MODF)/g' \
1154 -e 's/@''GNULIB_MODFF''@/$(GL_GNULIB_MODFF)/g' \ 1314 -e 's/@''GNULIB_MODFF''@/$(GL_GNULIB_MODFF)/g' \
1155 -e 's/@''GNULIB_MODFL''@/$(GL_GNULIB_MODFL)/g' \ 1315 -e 's/@''GNULIB_MODFL''@/$(GL_GNULIB_MODFL)/g' \
@@ -1243,6 +1403,9 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
1243 -e 's|@''HAVE_LOG1PL''@|$(HAVE_LOG1PL)|g' \ 1403 -e 's|@''HAVE_LOG1PL''@|$(HAVE_LOG1PL)|g' \
1244 -e 's|@''HAVE_LOGBF''@|$(HAVE_LOGBF)|g' \ 1404 -e 's|@''HAVE_LOGBF''@|$(HAVE_LOGBF)|g' \
1245 -e 's|@''HAVE_LOGBL''@|$(HAVE_LOGBL)|g' \ 1405 -e 's|@''HAVE_LOGBL''@|$(HAVE_LOGBL)|g' \
1406 -e 's|@''HAVE_LOGP1''@|$(HAVE_LOGP1)|g' \
1407 -e 's|@''HAVE_LOGP1F''@|$(HAVE_LOGP1F)|g' \
1408 -e 's|@''HAVE_LOGP1L''@|$(HAVE_LOGP1L)|g' \
1246 -e 's|@''HAVE_MODFF''@|$(HAVE_MODFF)|g' \ 1409 -e 's|@''HAVE_MODFF''@|$(HAVE_MODFF)|g' \
1247 -e 's|@''HAVE_MODFL''@|$(HAVE_MODFL)|g' \ 1410 -e 's|@''HAVE_MODFL''@|$(HAVE_MODFL)|g' \
1248 -e 's|@''HAVE_POWF''@|$(HAVE_POWF)|g' \ 1411 -e 's|@''HAVE_POWF''@|$(HAVE_POWF)|g' \
@@ -1389,6 +1552,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' \ 1552 -e 's|@''REPLACE_SIGNBIT_USING_BUILTINS''@|$(REPLACE_SIGNBIT_USING_BUILTINS)|g' \
1390 -e 's|@''REPLACE_SINF''@|$(REPLACE_SINF)|g' \ 1553 -e 's|@''REPLACE_SINF''@|$(REPLACE_SINF)|g' \
1391 -e 's|@''REPLACE_SINHF''@|$(REPLACE_SINHF)|g' \ 1554 -e 's|@''REPLACE_SINHF''@|$(REPLACE_SINHF)|g' \
1555 -e 's|@''REPLACE_SINL''@|$(REPLACE_SINL)|g' \
1392 -e 's|@''REPLACE_SQRTF''@|$(REPLACE_SQRTF)|g' \ 1556 -e 's|@''REPLACE_SQRTF''@|$(REPLACE_SQRTF)|g' \
1393 -e 's|@''REPLACE_SQRTL''@|$(REPLACE_SQRTL)|g' \ 1557 -e 's|@''REPLACE_SQRTL''@|$(REPLACE_SQRTL)|g' \
1394 -e 's|@''REPLACE_TANF''@|$(REPLACE_TANF)|g' \ 1558 -e 's|@''REPLACE_TANF''@|$(REPLACE_TANF)|g' \
@@ -1412,7 +1576,33 @@ MOSTLYCLEANFILES += math.h math.h-t1 math.h-t2 math.h-t3 math.h-t4 math.h-t5 mat
1412 1576
1413EXTRA_DIST += math.in.h 1577EXTRA_DIST += math.in.h
1414 1578
1415## end gnulib module math 1579## end gnulib module math-h
1580
1581## begin gnulib module mbchar
1582
1583libgnu_a_SOURCES += mbchar.c
1584
1585EXTRA_DIST += mbchar.h
1586
1587## end gnulib module mbchar
1588
1589## begin gnulib module mbiterf
1590
1591libgnu_a_SOURCES += mbiterf.h mbiterf.c
1592
1593## end gnulib module mbiterf
1594
1595## begin gnulib module mbrtoc32
1596
1597if GL_COND_OBJ_MBRTOC32
1598libgnu_a_SOURCES += mbrtoc32.c
1599endif
1600
1601EXTRA_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
1602
1603EXTRA_libgnu_a_SOURCES += lc-charset-dispatch.c mbtowc-lock.c
1604
1605## end gnulib module mbrtoc32
1416 1606
1417## begin gnulib module mbrtowc 1607## begin gnulib module mbrtowc
1418 1608
@@ -1434,6 +1624,12 @@ endif
1434 1624
1435## end gnulib module mbsinit 1625## end gnulib module mbsinit
1436 1626
1627## begin gnulib module mbsnlen
1628
1629libgnu_a_SOURCES += mbsnlen.c
1630
1631## end gnulib module mbsnlen
1632
1437## begin gnulib module mbszero 1633## begin gnulib module mbszero
1438 1634
1439libgnu_a_SOURCES += mbszero.c 1635libgnu_a_SOURCES += mbszero.c
@@ -1486,9 +1682,7 @@ EXTRA_libgnu_a_SOURCES += mktime.c
1486 1682
1487## begin gnulib module mountlist 1683## begin gnulib module mountlist
1488 1684
1489if GL_COND_OBJ_MOUNTLIST
1490libgnu_a_SOURCES += mountlist.c 1685libgnu_a_SOURCES += mountlist.c
1491endif
1492 1686
1493EXTRA_DIST += mountlist.h 1687EXTRA_DIST += mountlist.h
1494 1688
@@ -1514,7 +1708,7 @@ EXTRA_DIST += msvc-nothrow.h
1514 1708
1515## end gnulib module msvc-nothrow 1709## end gnulib module msvc-nothrow
1516 1710
1517## begin gnulib module netdb 1711## begin gnulib module netdb-h
1518 1712
1519BUILT_SOURCES += netdb.h 1713BUILT_SOURCES += netdb.h
1520 1714
@@ -1545,9 +1739,9 @@ MOSTLYCLEANFILES += netdb.h netdb.h-t
1545 1739
1546EXTRA_DIST += netdb.in.h 1740EXTRA_DIST += netdb.in.h
1547 1741
1548## end gnulib module netdb 1742## end gnulib module netdb-h
1549 1743
1550## begin gnulib module netinet_in 1744## begin gnulib module netinet_in-h
1551 1745
1552BUILT_SOURCES += $(NETINET_IN_H) 1746BUILT_SOURCES += $(NETINET_IN_H)
1553 1747
@@ -1574,7 +1768,7 @@ MOSTLYCLEANDIRS += netinet
1574 1768
1575EXTRA_DIST += netinet_in.in.h 1769EXTRA_DIST += netinet_in.in.h
1576 1770
1577## end gnulib module netinet_in 1771## end gnulib module netinet_in-h
1578 1772
1579## begin gnulib module nl_langinfo 1773## begin gnulib module nl_langinfo
1580 1774
@@ -1589,6 +1783,12 @@ EXTRA_DIST += windows-initguard.h
1589 1783
1590## end gnulib module nl_langinfo 1784## end gnulib module nl_langinfo
1591 1785
1786## begin gnulib module once
1787
1788libgnu_a_SOURCES += glthread/once.h glthread/once.c
1789
1790## end gnulib module once
1791
1592## begin gnulib module open 1792## begin gnulib module open
1593 1793
1594if GL_COND_OBJ_OPEN 1794if GL_COND_OBJ_OPEN
@@ -1604,21 +1804,168 @@ EXTRA_DIST += pathmax.h
1604 1804
1605## end gnulib module pathmax 1805## end gnulib module pathmax
1606 1806
1607## begin gnulib module realloc-gnu 1807## begin gnulib module pthread-h
1608 1808
1809BUILT_SOURCES += pthread.h
1810
1811# We need the following in order to create <pthread.h> when the system
1812# doesn't have one that works with the given compiler.
1813pthread.h: pthread.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
1814 $(gl_V_at)$(SED_HEADER_STDOUT) \
1815 -e 's|@''GUARD_PREFIX''@|GL|g' \
1816 -e 's|@''HAVE_PTHREAD_H''@|$(HAVE_PTHREAD_H)|g' \
1817 -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
1818 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
1819 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
1820 -e 's|@''NEXT_PTHREAD_H''@|$(NEXT_PTHREAD_H)|g' \
1821 -e 's/@''GNULIB_PTHREAD_THREAD''@/$(GL_GNULIB_PTHREAD_THREAD)/g' \
1822 -e 's/@''GNULIB_PTHREAD_ONCE''@/$(GL_GNULIB_PTHREAD_ONCE)/g' \
1823 -e 's/@''GNULIB_PTHREAD_MUTEX''@/$(GL_GNULIB_PTHREAD_MUTEX)/g' \
1824 -e 's/@''GNULIB_PTHREAD_RWLOCK''@/$(GL_GNULIB_PTHREAD_RWLOCK)/g' \
1825 -e 's/@''GNULIB_PTHREAD_COND''@/$(GL_GNULIB_PTHREAD_COND)/g' \
1826 -e 's/@''GNULIB_PTHREAD_TSS''@/$(GL_GNULIB_PTHREAD_TSS)/g' \
1827 -e 's/@''GNULIB_PTHREAD_SPIN''@/$(GL_GNULIB_PTHREAD_SPIN)/g' \
1828 -e 's/@''GNULIB_PTHREAD_MUTEX_TIMEDLOCK''@/$(GL_GNULIB_PTHREAD_MUTEX_TIMEDLOCK)/g' \
1829 -e 's|@''HAVE_PTHREAD_T''@|$(HAVE_PTHREAD_T)|g' \
1830 -e 's|@''HAVE_PTHREAD_SPINLOCK_T''@|$(HAVE_PTHREAD_SPINLOCK_T)|g' \
1831 -e 's|@''HAVE_PTHREAD_CREATE_DETACHED''@|$(HAVE_PTHREAD_CREATE_DETACHED)|g' \
1832 -e 's|@''HAVE_PTHREAD_MUTEX_RECURSIVE''@|$(HAVE_PTHREAD_MUTEX_RECURSIVE)|g' \
1833 -e 's|@''HAVE_PTHREAD_MUTEX_ROBUST''@|$(HAVE_PTHREAD_MUTEX_ROBUST)|g' \
1834 -e 's|@''HAVE_PTHREAD_PROCESS_SHARED''@|$(HAVE_PTHREAD_PROCESS_SHARED)|g' \
1835 -e 's|@''HAVE_PTHREAD_CREATE''@|$(HAVE_PTHREAD_CREATE)|g' \
1836 -e 's|@''HAVE_PTHREAD_ATTR_INIT''@|$(HAVE_PTHREAD_ATTR_INIT)|g' \
1837 -e 's|@''HAVE_PTHREAD_ATTR_GETDETACHSTATE''@|$(HAVE_PTHREAD_ATTR_GETDETACHSTATE)|g' \
1838 -e 's|@''HAVE_PTHREAD_ATTR_SETDETACHSTATE''@|$(HAVE_PTHREAD_ATTR_SETDETACHSTATE)|g' \
1839 -e 's|@''HAVE_PTHREAD_ATTR_DESTROY''@|$(HAVE_PTHREAD_ATTR_DESTROY)|g' \
1840 -e 's|@''HAVE_PTHREAD_SELF''@|$(HAVE_PTHREAD_SELF)|g' \
1841 -e 's|@''HAVE_PTHREAD_EQUAL''@|$(HAVE_PTHREAD_EQUAL)|g' \
1842 -e 's|@''HAVE_PTHREAD_DETACH''@|$(HAVE_PTHREAD_DETACH)|g' \
1843 -e 's|@''HAVE_PTHREAD_JOIN''@|$(HAVE_PTHREAD_JOIN)|g' \
1844 -e 's|@''HAVE_PTHREAD_EXIT''@|$(HAVE_PTHREAD_EXIT)|g' \
1845 < $(srcdir)/pthread.in.h > $@-t1
1846 $(AM_V_at)sed \
1847 -e 's|@''HAVE_PTHREAD_ONCE''@|$(HAVE_PTHREAD_ONCE)|g' \
1848 -e 's|@''HAVE_PTHREAD_MUTEX_INIT''@|$(HAVE_PTHREAD_MUTEX_INIT)|g' \
1849 -e 's|@''HAVE_PTHREAD_MUTEXATTR_INIT''@|$(HAVE_PTHREAD_MUTEXATTR_INIT)|g' \
1850 -e 's|@''HAVE_PTHREAD_MUTEXATTR_GETTYPE''@|$(HAVE_PTHREAD_MUTEXATTR_GETTYPE)|g' \
1851 -e 's|@''HAVE_PTHREAD_MUTEXATTR_SETTYPE''@|$(HAVE_PTHREAD_MUTEXATTR_SETTYPE)|g' \
1852 -e 's|@''HAVE_PTHREAD_MUTEXATTR_GETROBUST''@|$(HAVE_PTHREAD_MUTEXATTR_GETROBUST)|g' \
1853 -e 's|@''HAVE_PTHREAD_MUTEXATTR_SETROBUST''@|$(HAVE_PTHREAD_MUTEXATTR_SETROBUST)|g' \
1854 -e 's|@''HAVE_PTHREAD_MUTEXATTR_DESTROY''@|$(HAVE_PTHREAD_MUTEXATTR_DESTROY)|g' \
1855 -e 's|@''HAVE_PTHREAD_MUTEX_LOCK''@|$(HAVE_PTHREAD_MUTEX_LOCK)|g' \
1856 -e 's|@''HAVE_PTHREAD_MUTEX_TRYLOCK''@|$(HAVE_PTHREAD_MUTEX_TRYLOCK)|g' \
1857 -e 's|@''HAVE_PTHREAD_MUTEX_TIMEDLOCK''@|$(HAVE_PTHREAD_MUTEX_TIMEDLOCK)|g' \
1858 -e 's|@''HAVE_PTHREAD_MUTEX_UNLOCK''@|$(HAVE_PTHREAD_MUTEX_UNLOCK)|g' \
1859 -e 's|@''HAVE_PTHREAD_MUTEX_DESTROY''@|$(HAVE_PTHREAD_MUTEX_DESTROY)|g' \
1860 -e 's|@''HAVE_PTHREAD_RWLOCK_INIT''@|$(HAVE_PTHREAD_RWLOCK_INIT)|g' \
1861 -e 's|@''HAVE_PTHREAD_RWLOCKATTR_INIT''@|$(HAVE_PTHREAD_RWLOCKATTR_INIT)|g' \
1862 -e 's|@''HAVE_PTHREAD_RWLOCKATTR_DESTROY''@|$(HAVE_PTHREAD_RWLOCKATTR_DESTROY)|g' \
1863 -e 's|@''HAVE_PTHREAD_RWLOCK_RDLOCK''@|$(HAVE_PTHREAD_RWLOCK_RDLOCK)|g' \
1864 -e 's|@''HAVE_PTHREAD_RWLOCK_WRLOCK''@|$(HAVE_PTHREAD_RWLOCK_WRLOCK)|g' \
1865 -e 's|@''HAVE_PTHREAD_RWLOCK_TRYRDLOCK''@|$(HAVE_PTHREAD_RWLOCK_TRYRDLOCK)|g' \
1866 -e 's|@''HAVE_PTHREAD_RWLOCK_TRYWRLOCK''@|$(HAVE_PTHREAD_RWLOCK_TRYWRLOCK)|g' \
1867 -e 's|@''HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK''@|$(HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK)|g' \
1868 -e 's|@''HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK''@|$(HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK)|g' \
1869 -e 's|@''HAVE_PTHREAD_RWLOCK_UNLOCK''@|$(HAVE_PTHREAD_RWLOCK_UNLOCK)|g' \
1870 -e 's|@''HAVE_PTHREAD_RWLOCK_DESTROY''@|$(HAVE_PTHREAD_RWLOCK_DESTROY)|g' \
1871 -e 's|@''HAVE_PTHREAD_COND_INIT''@|$(HAVE_PTHREAD_COND_INIT)|g' \
1872 -e 's|@''HAVE_PTHREAD_CONDATTR_INIT''@|$(HAVE_PTHREAD_CONDATTR_INIT)|g' \
1873 -e 's|@''HAVE_PTHREAD_CONDATTR_DESTROY''@|$(HAVE_PTHREAD_CONDATTR_DESTROY)|g' \
1874 -e 's|@''HAVE_PTHREAD_COND_WAIT''@|$(HAVE_PTHREAD_COND_WAIT)|g' \
1875 -e 's|@''HAVE_PTHREAD_COND_TIMEDWAIT''@|$(HAVE_PTHREAD_COND_TIMEDWAIT)|g' \
1876 -e 's|@''HAVE_PTHREAD_COND_SIGNAL''@|$(HAVE_PTHREAD_COND_SIGNAL)|g' \
1877 -e 's|@''HAVE_PTHREAD_COND_BROADCAST''@|$(HAVE_PTHREAD_COND_BROADCAST)|g' \
1878 -e 's|@''HAVE_PTHREAD_COND_DESTROY''@|$(HAVE_PTHREAD_COND_DESTROY)|g' \
1879 -e 's|@''HAVE_PTHREAD_KEY_CREATE''@|$(HAVE_PTHREAD_KEY_CREATE)|g' \
1880 -e 's|@''HAVE_PTHREAD_SETSPECIFIC''@|$(HAVE_PTHREAD_SETSPECIFIC)|g' \
1881 -e 's|@''HAVE_PTHREAD_GETSPECIFIC''@|$(HAVE_PTHREAD_GETSPECIFIC)|g' \
1882 -e 's|@''HAVE_PTHREAD_KEY_DELETE''@|$(HAVE_PTHREAD_KEY_DELETE)|g' \
1883 -e 's|@''HAVE_PTHREAD_SPIN_INIT''@|$(HAVE_PTHREAD_SPIN_INIT)|g' \
1884 -e 's|@''HAVE_PTHREAD_SPIN_LOCK''@|$(HAVE_PTHREAD_SPIN_LOCK)|g' \
1885 -e 's|@''HAVE_PTHREAD_SPIN_TRYLOCK''@|$(HAVE_PTHREAD_SPIN_TRYLOCK)|g' \
1886 -e 's|@''HAVE_PTHREAD_SPIN_UNLOCK''@|$(HAVE_PTHREAD_SPIN_UNLOCK)|g' \
1887 -e 's|@''HAVE_PTHREAD_SPIN_DESTROY''@|$(HAVE_PTHREAD_SPIN_DESTROY)|g' \
1888 < $@-t1 > $@-t2
1889 $(AM_V_at)sed \
1890 -e 's|@''REPLACE_PTHREAD_CREATE''@|$(REPLACE_PTHREAD_CREATE)|g' \
1891 -e 's|@''REPLACE_PTHREAD_ATTR_INIT''@|$(REPLACE_PTHREAD_ATTR_INIT)|g' \
1892 -e 's|@''REPLACE_PTHREAD_ATTR_GETDETACHSTATE''@|$(REPLACE_PTHREAD_ATTR_GETDETACHSTATE)|g' \
1893 -e 's|@''REPLACE_PTHREAD_ATTR_SETDETACHSTATE''@|$(REPLACE_PTHREAD_ATTR_SETDETACHSTATE)|g' \
1894 -e 's|@''REPLACE_PTHREAD_ATTR_DESTROY''@|$(REPLACE_PTHREAD_ATTR_DESTROY)|g' \
1895 -e 's|@''REPLACE_PTHREAD_SELF''@|$(REPLACE_PTHREAD_SELF)|g' \
1896 -e 's|@''REPLACE_PTHREAD_EQUAL''@|$(REPLACE_PTHREAD_EQUAL)|g' \
1897 -e 's|@''REPLACE_PTHREAD_DETACH''@|$(REPLACE_PTHREAD_DETACH)|g' \
1898 -e 's|@''REPLACE_PTHREAD_JOIN''@|$(REPLACE_PTHREAD_JOIN)|g' \
1899 -e 's|@''REPLACE_PTHREAD_EXIT''@|$(REPLACE_PTHREAD_EXIT)|g' \
1900 -e 's|@''REPLACE_PTHREAD_ONCE''@|$(REPLACE_PTHREAD_ONCE)|g' \
1901 -e 's|@''REPLACE_PTHREAD_MUTEX_INIT''@|$(REPLACE_PTHREAD_MUTEX_INIT)|g' \
1902 -e 's|@''REPLACE_PTHREAD_MUTEXATTR_INIT''@|$(REPLACE_PTHREAD_MUTEXATTR_INIT)|g' \
1903 -e 's|@''REPLACE_PTHREAD_MUTEXATTR_GETTYPE''@|$(REPLACE_PTHREAD_MUTEXATTR_GETTYPE)|g' \
1904 -e 's|@''REPLACE_PTHREAD_MUTEXATTR_SETTYPE''@|$(REPLACE_PTHREAD_MUTEXATTR_SETTYPE)|g' \
1905 -e 's|@''REPLACE_PTHREAD_MUTEXATTR_GETROBUST''@|$(REPLACE_PTHREAD_MUTEXATTR_GETROBUST)|g' \
1906 -e 's|@''REPLACE_PTHREAD_MUTEXATTR_SETROBUST''@|$(REPLACE_PTHREAD_MUTEXATTR_SETROBUST)|g' \
1907 -e 's|@''REPLACE_PTHREAD_MUTEXATTR_DESTROY''@|$(REPLACE_PTHREAD_MUTEXATTR_DESTROY)|g' \
1908 -e 's|@''REPLACE_PTHREAD_MUTEX_LOCK''@|$(REPLACE_PTHREAD_MUTEX_LOCK)|g' \
1909 -e 's|@''REPLACE_PTHREAD_MUTEX_TRYLOCK''@|$(REPLACE_PTHREAD_MUTEX_TRYLOCK)|g' \
1910 -e 's|@''REPLACE_PTHREAD_MUTEX_TIMEDLOCK''@|$(REPLACE_PTHREAD_MUTEX_TIMEDLOCK)|g' \
1911 -e 's|@''REPLACE_PTHREAD_MUTEX_UNLOCK''@|$(REPLACE_PTHREAD_MUTEX_UNLOCK)|g' \
1912 -e 's|@''REPLACE_PTHREAD_MUTEX_DESTROY''@|$(REPLACE_PTHREAD_MUTEX_DESTROY)|g' \
1913 -e 's|@''REPLACE_PTHREAD_RWLOCK_INIT''@|$(REPLACE_PTHREAD_RWLOCK_INIT)|g' \
1914 -e 's|@''REPLACE_PTHREAD_RWLOCKATTR_INIT''@|$(REPLACE_PTHREAD_RWLOCKATTR_INIT)|g' \
1915 -e 's|@''REPLACE_PTHREAD_RWLOCKATTR_DESTROY''@|$(REPLACE_PTHREAD_RWLOCKATTR_DESTROY)|g' \
1916 -e 's|@''REPLACE_PTHREAD_RWLOCK_RDLOCK''@|$(REPLACE_PTHREAD_RWLOCK_RDLOCK)|g' \
1917 -e 's|@''REPLACE_PTHREAD_RWLOCK_WRLOCK''@|$(REPLACE_PTHREAD_RWLOCK_WRLOCK)|g' \
1918 -e 's|@''REPLACE_PTHREAD_RWLOCK_TRYRDLOCK''@|$(REPLACE_PTHREAD_RWLOCK_TRYRDLOCK)|g' \
1919 -e 's|@''REPLACE_PTHREAD_RWLOCK_TRYWRLOCK''@|$(REPLACE_PTHREAD_RWLOCK_TRYWRLOCK)|g' \
1920 -e 's|@''REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK''@|$(REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK)|g' \
1921 -e 's|@''REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK''@|$(REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK)|g' \
1922 -e 's|@''REPLACE_PTHREAD_RWLOCK_UNLOCK''@|$(REPLACE_PTHREAD_RWLOCK_UNLOCK)|g' \
1923 -e 's|@''REPLACE_PTHREAD_RWLOCK_DESTROY''@|$(REPLACE_PTHREAD_RWLOCK_DESTROY)|g' \
1924 < $@-t2 > $@-t3
1925 $(AM_V_at)sed \
1926 -e 's|@''REPLACE_PTHREAD_COND_INIT''@|$(REPLACE_PTHREAD_COND_INIT)|g' \
1927 -e 's|@''REPLACE_PTHREAD_CONDATTR_INIT''@|$(REPLACE_PTHREAD_CONDATTR_INIT)|g' \
1928 -e 's|@''REPLACE_PTHREAD_CONDATTR_DESTROY''@|$(REPLACE_PTHREAD_CONDATTR_DESTROY)|g' \
1929 -e 's|@''REPLACE_PTHREAD_COND_WAIT''@|$(REPLACE_PTHREAD_COND_WAIT)|g' \
1930 -e 's|@''REPLACE_PTHREAD_COND_TIMEDWAIT''@|$(REPLACE_PTHREAD_COND_TIMEDWAIT)|g' \
1931 -e 's|@''REPLACE_PTHREAD_COND_SIGNAL''@|$(REPLACE_PTHREAD_COND_SIGNAL)|g' \
1932 -e 's|@''REPLACE_PTHREAD_COND_BROADCAST''@|$(REPLACE_PTHREAD_COND_BROADCAST)|g' \
1933 -e 's|@''REPLACE_PTHREAD_COND_DESTROY''@|$(REPLACE_PTHREAD_COND_DESTROY)|g' \
1934 -e 's|@''REPLACE_PTHREAD_KEY_CREATE''@|$(REPLACE_PTHREAD_KEY_CREATE)|g' \
1935 -e 's|@''REPLACE_PTHREAD_SETSPECIFIC''@|$(REPLACE_PTHREAD_SETSPECIFIC)|g' \
1936 -e 's|@''REPLACE_PTHREAD_GETSPECIFIC''@|$(REPLACE_PTHREAD_GETSPECIFIC)|g' \
1937 -e 's|@''REPLACE_PTHREAD_KEY_DELETE''@|$(REPLACE_PTHREAD_KEY_DELETE)|g' \
1938 -e 's|@''REPLACE_PTHREAD_SPIN_INIT''@|$(REPLACE_PTHREAD_SPIN_INIT)|g' \
1939 -e 's|@''REPLACE_PTHREAD_SPIN_LOCK''@|$(REPLACE_PTHREAD_SPIN_LOCK)|g' \
1940 -e 's|@''REPLACE_PTHREAD_SPIN_TRYLOCK''@|$(REPLACE_PTHREAD_SPIN_TRYLOCK)|g' \
1941 -e 's|@''REPLACE_PTHREAD_SPIN_UNLOCK''@|$(REPLACE_PTHREAD_SPIN_UNLOCK)|g' \
1942 -e 's|@''REPLACE_PTHREAD_SPIN_DESTROY''@|$(REPLACE_PTHREAD_SPIN_DESTROY)|g' \
1943 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
1944 -e '/definition of _Noreturn/r $(_NORETURN_H)' \
1945 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
1946 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
1947 < $@-t3 > $@-t4
1948 $(AM_V_at)rm -f $@-t1 $@-t2 $@-t3
1949 $(AM_V_at)mv $@-t4 $@
1950MOSTLYCLEANFILES += pthread.h pthread.h-t1 pthread.h-t2 pthread.h-t3 pthread.h-t4
1609 1951
1610EXTRA_DIST += realloc.c 1952EXTRA_DIST += pthread.in.h
1611 1953
1612EXTRA_libgnu_a_SOURCES += realloc.c 1954## end gnulib module pthread-h
1613 1955
1614## end gnulib module realloc-gnu 1956## begin gnulib module pthread-once
1615 1957
1616## begin gnulib module realloc-posix 1958if GL_COND_OBJ_PTHREAD_ONCE
1959libgnu_a_SOURCES += pthread-once.c
1960endif
1617 1961
1962## end gnulib module pthread-once
1618 1963
1619EXTRA_DIST += realloc.c 1964## begin gnulib module realloc-posix
1620 1965
1621EXTRA_libgnu_a_SOURCES += realloc.c 1966if GL_COND_OBJ_REALLOC_POSIX
1967libgnu_a_SOURCES += realloc.c
1968endif
1622 1969
1623## end gnulib module realloc-posix 1970## end gnulib module realloc-posix
1624 1971
@@ -1642,6 +1989,35 @@ EXTRA_libgnu_a_SOURCES += regcomp.c regex_internal.c regexec.c
1642 1989
1643## end gnulib module regex 1990## end gnulib module regex
1644 1991
1992## begin gnulib module sched-h
1993
1994BUILT_SOURCES += sched.h
1995
1996# We need the following in order to create a replacement for <sched.h> when
1997# the system doesn't have one.
1998sched.h: sched.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
1999 $(gl_V_at)$(SED_HEADER_STDOUT) \
2000 -e 's|@''GUARD_PREFIX''@|GL|g' \
2001 -e 's|@''HAVE_SCHED_H''@|$(HAVE_SCHED_H)|g' \
2002 -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \
2003 -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
2004 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
2005 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
2006 -e 's|@''NEXT_SCHED_H''@|$(NEXT_SCHED_H)|g' \
2007 -e 's|@''HAVE_STRUCT_SCHED_PARAM''@|$(HAVE_STRUCT_SCHED_PARAM)|g' \
2008 -e 's/@''GNULIB_SCHED_YIELD''@/$(GL_GNULIB_SCHED_YIELD)/g' \
2009 -e 's|@''HAVE_SCHED_YIELD''@|$(HAVE_SCHED_YIELD)|g' \
2010 -e 's|@''REPLACE_SCHED_YIELD''@|$(REPLACE_SCHED_YIELD)|g' \
2011 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
2012 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
2013 $(srcdir)/sched.in.h > $@-t
2014 $(AM_V_at)mv $@-t $@
2015MOSTLYCLEANFILES += sched.h sched.h-t
2016
2017EXTRA_DIST += sched.in.h
2018
2019## end gnulib module sched-h
2020
1645## begin gnulib module setenv 2021## begin gnulib module setenv
1646 2022
1647if GL_COND_OBJ_SETENV 2023if GL_COND_OBJ_SETENV
@@ -1760,7 +2136,7 @@ EXTRA_DIST += stat-time.h
1760 2136
1761## end gnulib module stat-time 2137## end gnulib module stat-time
1762 2138
1763## begin gnulib module stdckdint 2139## begin gnulib module stdckdint-h
1764 2140
1765BUILT_SOURCES += $(STDCKDINT_H) 2141BUILT_SOURCES += $(STDCKDINT_H)
1766 2142
@@ -1769,6 +2145,15 @@ BUILT_SOURCES += $(STDCKDINT_H)
1769if GL_GENERATE_STDCKDINT_H 2145if GL_GENERATE_STDCKDINT_H
1770stdckdint.h: stdckdint.in.h $(top_builddir)/config.status 2146stdckdint.h: stdckdint.in.h $(top_builddir)/config.status
1771 $(gl_V_at)$(SED_HEADER_STDOUT) \ 2147 $(gl_V_at)$(SED_HEADER_STDOUT) \
2148 -e 's|@''GUARD_PREFIX''@|GL|g' \
2149 -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
2150 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
2151 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
2152 -e 's|@''NEXT_STDCKDINT_H''@|$(NEXT_STDCKDINT_H)|g' \
2153 -e 's|@''HAVE_C_STDCKDINT_H''@|$(HAVE_C_STDCKDINT_H)|g' \
2154 -e 's|@''HAVE_WORKING_C_STDCKDINT_H''@|$(HAVE_WORKING_C_STDCKDINT_H)|g' \
2155 -e 's|@''HAVE_CXX_STDCKDINT_H''@|$(HAVE_CXX_STDCKDINT_H)|g' \
2156 -e 's|@''HAVE_WORKING_CXX_STDCKDINT_H''@|$(HAVE_WORKING_CXX_STDCKDINT_H)|g' \
1772 $(srcdir)/stdckdint.in.h > $@-t 2157 $(srcdir)/stdckdint.in.h > $@-t
1773 $(AM_V_at)mv $@-t $@ 2158 $(AM_V_at)mv $@-t $@
1774else 2159else
@@ -1779,9 +2164,9 @@ MOSTLYCLEANFILES += stdckdint.h stdckdint.h-t
1779 2164
1780EXTRA_DIST += intprops-internal.h stdckdint.in.h 2165EXTRA_DIST += intprops-internal.h stdckdint.in.h
1781 2166
1782## end gnulib module stdckdint 2167## end gnulib module stdckdint-h
1783 2168
1784## begin gnulib module stddef 2169## begin gnulib module stddef-h
1785 2170
1786BUILT_SOURCES += $(STDDEF_H) 2171BUILT_SOURCES += $(STDDEF_H)
1787 2172
@@ -1795,9 +2180,11 @@ stddef.h: stddef.in.h $(top_builddir)/config.status
1795 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ 2180 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
1796 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ 2181 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
1797 -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ 2182 -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
1798 -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \ 2183 -e 's|@''NULLPTR_T_NEEDS_STDDEF''@|$(NULLPTR_T_NEEDS_STDDEF)|g' \
1799 -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ 2184 -e 's|@''STDDEF_NOT_IDEMPOTENT''@|$(STDDEF_NOT_IDEMPOTENT)|g' \
1800 -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ 2185 -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
2186 -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \
2187 -e 's|@''HAVE_C_UNREACHABLE''@|$(HAVE_C_UNREACHABLE)|g' \
1801 $(srcdir)/stddef.in.h > $@-t 2188 $(srcdir)/stddef.in.h > $@-t
1802 $(AM_V_at)mv $@-t $@ 2189 $(AM_V_at)mv $@-t $@
1803else 2190else
@@ -1808,9 +2195,9 @@ MOSTLYCLEANFILES += stddef.h stddef.h-t
1808 2195
1809EXTRA_DIST += stddef.in.h 2196EXTRA_DIST += stddef.in.h
1810 2197
1811## end gnulib module stddef 2198## end gnulib module stddef-h
1812 2199
1813## begin gnulib module stdint 2200## begin gnulib module stdint-h
1814 2201
1815BUILT_SOURCES += $(STDINT_H) 2202BUILT_SOURCES += $(STDINT_H)
1816 2203
@@ -1856,9 +2243,9 @@ MOSTLYCLEANFILES += stdint.h stdint.h-t
1856 2243
1857EXTRA_DIST += stdint.in.h 2244EXTRA_DIST += stdint.in.h
1858 2245
1859## end gnulib module stdint 2246## end gnulib module stdint-h
1860 2247
1861## begin gnulib module stdio 2248## begin gnulib module stdio-h
1862 2249
1863BUILT_SOURCES += stdio.h 2250BUILT_SOURCES += stdio.h
1864 2251
@@ -1872,6 +2259,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
1872 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ 2259 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
1873 -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ 2260 -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
1874 -e 's/@''GNULIB_DPRINTF''@/$(GL_GNULIB_DPRINTF)/g' \ 2261 -e 's/@''GNULIB_DPRINTF''@/$(GL_GNULIB_DPRINTF)/g' \
2262 -e 's/@''GNULIB_DZPRINTF''@/$(GL_GNULIB_DZPRINTF)/g' \
1875 -e 's/@''GNULIB_FCLOSE''@/$(GL_GNULIB_FCLOSE)/g' \ 2263 -e 's/@''GNULIB_FCLOSE''@/$(GL_GNULIB_FCLOSE)/g' \
1876 -e 's/@''GNULIB_FDOPEN''@/$(GL_GNULIB_FDOPEN)/g' \ 2264 -e 's/@''GNULIB_FDOPEN''@/$(GL_GNULIB_FDOPEN)/g' \
1877 -e 's/@''GNULIB_FFLUSH''@/$(GL_GNULIB_FFLUSH)/g' \ 2265 -e 's/@''GNULIB_FFLUSH''@/$(GL_GNULIB_FFLUSH)/g' \
@@ -1892,12 +2280,14 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
1892 -e 's/@''GNULIB_FTELL''@/$(GL_GNULIB_FTELL)/g' \ 2280 -e 's/@''GNULIB_FTELL''@/$(GL_GNULIB_FTELL)/g' \
1893 -e 's/@''GNULIB_FTELLO''@/$(GL_GNULIB_FTELLO)/g' \ 2281 -e 's/@''GNULIB_FTELLO''@/$(GL_GNULIB_FTELLO)/g' \
1894 -e 's/@''GNULIB_FWRITE''@/$(GL_GNULIB_FWRITE)/g' \ 2282 -e 's/@''GNULIB_FWRITE''@/$(GL_GNULIB_FWRITE)/g' \
2283 -e 's/@''GNULIB_FZPRINTF''@/$(GL_GNULIB_FZPRINTF)/g' \
1895 -e 's/@''GNULIB_GETC''@/$(GL_GNULIB_GETC)/g' \ 2284 -e 's/@''GNULIB_GETC''@/$(GL_GNULIB_GETC)/g' \
1896 -e 's/@''GNULIB_GETCHAR''@/$(GL_GNULIB_GETCHAR)/g' \ 2285 -e 's/@''GNULIB_GETCHAR''@/$(GL_GNULIB_GETCHAR)/g' \
1897 -e 's/@''GNULIB_GETDELIM''@/$(GL_GNULIB_GETDELIM)/g' \ 2286 -e 's/@''GNULIB_GETDELIM''@/$(GL_GNULIB_GETDELIM)/g' \
1898 -e 's/@''GNULIB_GETLINE''@/$(GL_GNULIB_GETLINE)/g' \ 2287 -e 's/@''GNULIB_GETLINE''@/$(GL_GNULIB_GETLINE)/g' \
1899 -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GL_GNULIB_OBSTACK_PRINTF)/g' \ 2288 -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GL_GNULIB_OBSTACK_PRINTF)/g' \
1900 -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GL_GNULIB_OBSTACK_PRINTF_POSIX)/g' \ 2289 -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GL_GNULIB_OBSTACK_PRINTF_POSIX)/g' \
2290 -e 's/@''GNULIB_OBSTACK_ZPRINTF''@/$(GL_GNULIB_OBSTACK_ZPRINTF)/g' \
1901 -e 's/@''GNULIB_PCLOSE''@/$(GL_GNULIB_PCLOSE)/g' \ 2291 -e 's/@''GNULIB_PCLOSE''@/$(GL_GNULIB_PCLOSE)/g' \
1902 -e 's/@''GNULIB_PERROR''@/$(GL_GNULIB_PERROR)/g' \ 2292 -e 's/@''GNULIB_PERROR''@/$(GL_GNULIB_PERROR)/g' \
1903 -e 's/@''GNULIB_POPEN''@/$(GL_GNULIB_POPEN)/g' \ 2293 -e 's/@''GNULIB_POPEN''@/$(GL_GNULIB_POPEN)/g' \
@@ -1911,20 +2301,29 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
1911 -e 's/@''GNULIB_RENAMEAT''@/$(GL_GNULIB_RENAMEAT)/g' \ 2301 -e 's/@''GNULIB_RENAMEAT''@/$(GL_GNULIB_RENAMEAT)/g' \
1912 -e 's/@''GNULIB_SCANF''@/$(GL_GNULIB_SCANF)/g' \ 2302 -e 's/@''GNULIB_SCANF''@/$(GL_GNULIB_SCANF)/g' \
1913 -e 's/@''GNULIB_SNPRINTF''@/$(GL_GNULIB_SNPRINTF)/g' \ 2303 -e 's/@''GNULIB_SNPRINTF''@/$(GL_GNULIB_SNPRINTF)/g' \
2304 -e 's/@''GNULIB_SNZPRINTF''@/$(GL_GNULIB_SNZPRINTF)/g' \
1914 -e 's/@''GNULIB_SPRINTF_POSIX''@/$(GL_GNULIB_SPRINTF_POSIX)/g' \ 2305 -e 's/@''GNULIB_SPRINTF_POSIX''@/$(GL_GNULIB_SPRINTF_POSIX)/g' \
1915 -e 's/@''GNULIB_STDIO_H_NONBLOCKING''@/$(GL_GNULIB_STDIO_H_NONBLOCKING)/g' \ 2306 -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' \ 2307 -e 's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GL_GNULIB_STDIO_H_SIGPIPE)/g' \
2308 -e 's/@''GNULIB_SZPRINTF''@/$(GL_GNULIB_SZPRINTF)/g' \
1917 -e 's/@''GNULIB_TMPFILE''@/$(GL_GNULIB_TMPFILE)/g' \ 2309 -e 's/@''GNULIB_TMPFILE''@/$(GL_GNULIB_TMPFILE)/g' \
1918 -e 's/@''GNULIB_VASPRINTF''@/$(GL_GNULIB_VASPRINTF)/g' \ 2310 -e 's/@''GNULIB_VASPRINTF''@/$(GL_GNULIB_VASPRINTF)/g' \
2311 -e 's/@''GNULIB_VASZPRINTF''@/$(GL_GNULIB_VASZPRINTF)/g' \
1919 -e 's/@''GNULIB_VDPRINTF''@/$(GL_GNULIB_VDPRINTF)/g' \ 2312 -e 's/@''GNULIB_VDPRINTF''@/$(GL_GNULIB_VDPRINTF)/g' \
2313 -e 's/@''GNULIB_VDZPRINTF''@/$(GL_GNULIB_VDZPRINTF)/g' \
1920 -e 's/@''GNULIB_VFPRINTF''@/$(GL_GNULIB_VFPRINTF)/g' \ 2314 -e 's/@''GNULIB_VFPRINTF''@/$(GL_GNULIB_VFPRINTF)/g' \
1921 -e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GL_GNULIB_VFPRINTF_POSIX)/g' \ 2315 -e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GL_GNULIB_VFPRINTF_POSIX)/g' \
2316 -e 's/@''GNULIB_VFZPRINTF''@/$(GL_GNULIB_VFZPRINTF)/g' \
1922 -e 's/@''GNULIB_VFSCANF''@/$(GL_GNULIB_VFSCANF)/g' \ 2317 -e 's/@''GNULIB_VFSCANF''@/$(GL_GNULIB_VFSCANF)/g' \
1923 -e 's/@''GNULIB_VSCANF''@/$(GL_GNULIB_VSCANF)/g' \ 2318 -e 's/@''GNULIB_VSCANF''@/$(GL_GNULIB_VSCANF)/g' \
1924 -e 's/@''GNULIB_VPRINTF''@/$(GL_GNULIB_VPRINTF)/g' \ 2319 -e 's/@''GNULIB_VPRINTF''@/$(GL_GNULIB_VPRINTF)/g' \
1925 -e 's/@''GNULIB_VPRINTF_POSIX''@/$(GL_GNULIB_VPRINTF_POSIX)/g' \ 2320 -e 's/@''GNULIB_VPRINTF_POSIX''@/$(GL_GNULIB_VPRINTF_POSIX)/g' \
1926 -e 's/@''GNULIB_VSNPRINTF''@/$(GL_GNULIB_VSNPRINTF)/g' \ 2321 -e 's/@''GNULIB_VSNPRINTF''@/$(GL_GNULIB_VSNPRINTF)/g' \
2322 -e 's/@''GNULIB_VSNZPRINTF''@/$(GL_GNULIB_VSNZPRINTF)/g' \
1927 -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GL_GNULIB_VSPRINTF_POSIX)/g' \ 2323 -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GL_GNULIB_VSPRINTF_POSIX)/g' \
2324 -e 's/@''GNULIB_VSZPRINTF''@/$(GL_GNULIB_VSZPRINTF)/g' \
2325 -e 's/@''GNULIB_VZPRINTF''@/$(GL_GNULIB_VZPRINTF)/g' \
2326 -e 's/@''GNULIB_ZPRINTF''@/$(GL_GNULIB_ZPRINTF)/g' \
1928 -e 's/@''GNULIB_MDA_FCLOSEALL''@/$(GL_GNULIB_MDA_FCLOSEALL)/g' \ 2327 -e 's/@''GNULIB_MDA_FCLOSEALL''@/$(GL_GNULIB_MDA_FCLOSEALL)/g' \
1929 -e 's/@''GNULIB_MDA_FDOPEN''@/$(GL_GNULIB_MDA_FDOPEN)/g' \ 2328 -e 's/@''GNULIB_MDA_FDOPEN''@/$(GL_GNULIB_MDA_FDOPEN)/g' \
1930 -e 's/@''GNULIB_MDA_FILENO''@/$(GL_GNULIB_MDA_FILENO)/g' \ 2329 -e 's/@''GNULIB_MDA_FILENO''@/$(GL_GNULIB_MDA_FILENO)/g' \
@@ -1996,6 +2395,9 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
1996 $(AM_V_at)mv $@-t3 $@ 2395 $(AM_V_at)mv $@-t3 $@
1997MOSTLYCLEANFILES += stdio.h stdio.h-t1 stdio.h-t2 stdio.h-t3 2396MOSTLYCLEANFILES += stdio.h stdio.h-t1 stdio.h-t2 stdio.h-t3
1998 2397
2398if GL_COND_OBJ_STDIO_CONSOLESAFE
2399libgnu_a_SOURCES += stdio-consolesafe.c
2400endif
1999if GL_COND_OBJ_STDIO_READ 2401if GL_COND_OBJ_STDIO_READ
2000libgnu_a_SOURCES += stdio-read.c 2402libgnu_a_SOURCES += stdio-read.c
2001endif 2403endif
@@ -2005,14 +2407,13 @@ endif
2005 2407
2006EXTRA_DIST += stdio.in.h 2408EXTRA_DIST += stdio.in.h
2007 2409
2008## end gnulib module stdio 2410## end gnulib module stdio-h
2009 2411
2010## begin gnulib module stdlib 2412## begin gnulib module stdlib-h
2011 2413
2012BUILT_SOURCES += stdlib.h 2414BUILT_SOURCES += stdlib.h
2415libgnu_a_SOURCES += stdlib.c
2013 2416
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) \ 2417stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
2017 $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) 2418 $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
2018 $(gl_V_at)$(SED_HEADER_STDOUT) \ 2419 $(gl_V_at)$(SED_HEADER_STDOUT) \
@@ -2022,6 +2423,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
2022 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ 2423 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
2023 -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ 2424 -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
2024 -e 's/@''GNULIB__EXIT''@/$(GL_GNULIB__EXIT)/g' \ 2425 -e 's/@''GNULIB__EXIT''@/$(GL_GNULIB__EXIT)/g' \
2426 -e 's/@''GNULIB_ABORT_DEBUG''@/$(GL_GNULIB_ABORT_DEBUG)/g' \
2025 -e 's/@''GNULIB_ALIGNED_ALLOC''@/$(GL_GNULIB_ALIGNED_ALLOC)/g' \ 2427 -e 's/@''GNULIB_ALIGNED_ALLOC''@/$(GL_GNULIB_ALIGNED_ALLOC)/g' \
2026 -e 's/@''GNULIB_ATOLL''@/$(GL_GNULIB_ATOLL)/g' \ 2428 -e 's/@''GNULIB_ATOLL''@/$(GL_GNULIB_ATOLL)/g' \
2027 -e 's/@''GNULIB_CALLOC_GNU''@/$(GL_GNULIB_CALLOC_GNU)/g' \ 2429 -e 's/@''GNULIB_CALLOC_GNU''@/$(GL_GNULIB_CALLOC_GNU)/g' \
@@ -2050,13 +2452,13 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
2050 -e 's/@''GNULIB_RAND''@/$(GL_GNULIB_RAND)/g' \ 2452 -e 's/@''GNULIB_RAND''@/$(GL_GNULIB_RAND)/g' \
2051 -e 's/@''GNULIB_RANDOM''@/$(GL_GNULIB_RANDOM)/g' \ 2453 -e 's/@''GNULIB_RANDOM''@/$(GL_GNULIB_RANDOM)/g' \
2052 -e 's/@''GNULIB_RANDOM_R''@/$(GL_GNULIB_RANDOM_R)/g' \ 2454 -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' \ 2455 -e 's/@''GNULIB_REALLOC_POSIX''@/$(GL_GNULIB_REALLOC_POSIX)/g' \
2055 -e 's/@''GNULIB_REALLOCARRAY''@/$(GL_GNULIB_REALLOCARRAY)/g' \ 2456 -e 's/@''GNULIB_REALLOCARRAY''@/$(GL_GNULIB_REALLOCARRAY)/g' \
2056 -e 's/@''GNULIB_REALPATH''@/$(GL_GNULIB_REALPATH)/g' \ 2457 -e 's/@''GNULIB_REALPATH''@/$(GL_GNULIB_REALPATH)/g' \
2057 -e 's/@''GNULIB_RPMATCH''@/$(GL_GNULIB_RPMATCH)/g' \ 2458 -e 's/@''GNULIB_RPMATCH''@/$(GL_GNULIB_RPMATCH)/g' \
2058 -e 's/@''GNULIB_SECURE_GETENV''@/$(GL_GNULIB_SECURE_GETENV)/g' \ 2459 -e 's/@''GNULIB_SECURE_GETENV''@/$(GL_GNULIB_SECURE_GETENV)/g' \
2059 -e 's/@''GNULIB_SETENV''@/$(GL_GNULIB_SETENV)/g' \ 2460 -e 's/@''GNULIB_SETENV''@/$(GL_GNULIB_SETENV)/g' \
2461 -e 's/@''GNULIB_STACK_TRACE''@/$(GL_GNULIB_STACK_TRACE)/g' \
2060 -e 's/@''GNULIB_STRTOD''@/$(GL_GNULIB_STRTOD)/g' \ 2462 -e 's/@''GNULIB_STRTOD''@/$(GL_GNULIB_STRTOD)/g' \
2061 -e 's/@''GNULIB_STRTOF''@/$(GL_GNULIB_STRTOF)/g' \ 2463 -e 's/@''GNULIB_STRTOF''@/$(GL_GNULIB_STRTOF)/g' \
2062 -e 's/@''GNULIB_STRTOL''@/$(GL_GNULIB_STRTOL)/g' \ 2464 -e 's/@''GNULIB_STRTOL''@/$(GL_GNULIB_STRTOL)/g' \
@@ -2124,6 +2526,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
2124 < $@-t1 > $@-t2 2526 < $@-t1 > $@-t2
2125 $(AM_V_at)sed \ 2527 $(AM_V_at)sed \
2126 -e 's|@''REPLACE__EXIT''@|$(REPLACE__EXIT)|g' \ 2528 -e 's|@''REPLACE__EXIT''@|$(REPLACE__EXIT)|g' \
2529 -e 's|@''REPLACE_ABORT''@|$(REPLACE_ABORT)|g' \
2127 -e 's|@''REPLACE_ALIGNED_ALLOC''@|$(REPLACE_ALIGNED_ALLOC)|g' \ 2530 -e 's|@''REPLACE_ALIGNED_ALLOC''@|$(REPLACE_ALIGNED_ALLOC)|g' \
2128 -e 's|@''REPLACE_CALLOC_FOR_CALLOC_GNU''@|$(REPLACE_CALLOC_FOR_CALLOC_GNU)|g' \ 2531 -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' \ 2532 -e 's|@''REPLACE_CALLOC_FOR_CALLOC_POSIX''@|$(REPLACE_CALLOC_FOR_CALLOC_POSIX)|g' \
@@ -2150,7 +2553,6 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
2150 -e 's|@''REPLACE_RAND''@|$(REPLACE_RAND)|g' \ 2553 -e 's|@''REPLACE_RAND''@|$(REPLACE_RAND)|g' \
2151 -e 's|@''REPLACE_RANDOM''@|$(REPLACE_RANDOM)|g' \ 2554 -e 's|@''REPLACE_RANDOM''@|$(REPLACE_RANDOM)|g' \
2152 -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \ 2555 -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' \ 2556 -e 's|@''REPLACE_REALLOC_FOR_REALLOC_POSIX''@|$(REPLACE_REALLOC_FOR_REALLOC_POSIX)|g' \
2155 -e 's|@''REPLACE_REALLOCARRAY''@|$(REPLACE_REALLOCARRAY)|g' \ 2557 -e 's|@''REPLACE_REALLOCARRAY''@|$(REPLACE_REALLOCARRAY)|g' \
2156 -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ 2558 -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
@@ -2165,6 +2567,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
2165 -e 's|@''REPLACE_STRTOULL''@|$(REPLACE_STRTOULL)|g' \ 2567 -e 's|@''REPLACE_STRTOULL''@|$(REPLACE_STRTOULL)|g' \
2166 -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ 2568 -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
2167 -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ 2569 -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \
2570 -e 's|@''CAN_PRINT_STACK_TRACE''@|$(CAN_PRINT_STACK_TRACE)|g' \
2168 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ 2571 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
2169 -e '/definition of _Noreturn/r $(_NORETURN_H)' \ 2572 -e '/definition of _Noreturn/r $(_NORETURN_H)' \
2170 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ 2573 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
@@ -2176,18 +2579,15 @@ MOSTLYCLEANFILES += stdlib.h stdlib.h-t1 stdlib.h-t2 stdlib.h-t3
2176 2579
2177EXTRA_DIST += stdlib.in.h 2580EXTRA_DIST += stdlib.in.h
2178 2581
2179## end gnulib module stdlib 2582## end gnulib module stdlib-h
2180 2583
2181## begin gnulib module strcase 2584## begin gnulib module strcasecmp
2182 2585
2183if GL_COND_OBJ_STRCASECMP 2586if GL_COND_OBJ_STRCASECMP
2184libgnu_a_SOURCES += strcasecmp.c 2587libgnu_a_SOURCES += strcasecmp.c
2185endif 2588endif
2186if GL_COND_OBJ_STRNCASECMP
2187libgnu_a_SOURCES += strncasecmp.c
2188endif
2189 2589
2190## end gnulib module strcase 2590## end gnulib module strcasecmp
2191 2591
2192## begin gnulib module strcasestr 2592## begin gnulib module strcasestr
2193 2593
@@ -2232,7 +2632,7 @@ EXTRA_DIST += strerror-override.h
2232 2632
2233## end gnulib module strerror-override 2633## end gnulib module strerror-override
2234 2634
2235## begin gnulib module string 2635## begin gnulib module string-h
2236 2636
2237BUILT_SOURCES += string.h 2637BUILT_SOURCES += string.h
2238 2638
@@ -2262,6 +2662,8 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
2262 -e 's/@''GNULIB_MBSSPN''@/$(GL_GNULIB_MBSSPN)/g' \ 2662 -e 's/@''GNULIB_MBSSPN''@/$(GL_GNULIB_MBSSPN)/g' \
2263 -e 's/@''GNULIB_MBSSEP''@/$(GL_GNULIB_MBSSEP)/g' \ 2663 -e 's/@''GNULIB_MBSSEP''@/$(GL_GNULIB_MBSSEP)/g' \
2264 -e 's/@''GNULIB_MBSTOK_R''@/$(GL_GNULIB_MBSTOK_R)/g' \ 2664 -e 's/@''GNULIB_MBSTOK_R''@/$(GL_GNULIB_MBSTOK_R)/g' \
2665 -e 's/@''GNULIB_MBS_ENDSWITH''@/$(GL_GNULIB_MBS_ENDSWITH)/g' \
2666 -e 's/@''GNULIB_MBS_STARTSWITH''@/$(GL_GNULIB_MBS_STARTSWITH)/g' \
2265 -e 's/@''GNULIB_MEMCHR''@/$(GL_GNULIB_MEMCHR)/g' \ 2667 -e 's/@''GNULIB_MEMCHR''@/$(GL_GNULIB_MEMCHR)/g' \
2266 -e 's/@''GNULIB_MEMMEM''@/$(GL_GNULIB_MEMMEM)/g' \ 2668 -e 's/@''GNULIB_MEMMEM''@/$(GL_GNULIB_MEMMEM)/g' \
2267 -e 's/@''GNULIB_MEMPCPY''@/$(GL_GNULIB_MEMPCPY)/g' \ 2669 -e 's/@''GNULIB_MEMPCPY''@/$(GL_GNULIB_MEMPCPY)/g' \
@@ -2273,6 +2675,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
2273 -e 's/@''GNULIB_STRCHRNUL''@/$(GL_GNULIB_STRCHRNUL)/g' \ 2675 -e 's/@''GNULIB_STRCHRNUL''@/$(GL_GNULIB_STRCHRNUL)/g' \
2274 -e 's/@''GNULIB_STRDUP''@/$(GL_GNULIB_STRDUP)/g' \ 2676 -e 's/@''GNULIB_STRDUP''@/$(GL_GNULIB_STRDUP)/g' \
2275 -e 's/@''GNULIB_STRNCAT''@/$(GL_GNULIB_STRNCAT)/g' \ 2677 -e 's/@''GNULIB_STRNCAT''@/$(GL_GNULIB_STRNCAT)/g' \
2678 -e 's/@''GNULIB_STRNCPY''@/$(GL_GNULIB_STRNCPY)/g' \
2276 -e 's/@''GNULIB_STRNDUP''@/$(GL_GNULIB_STRNDUP)/g' \ 2679 -e 's/@''GNULIB_STRNDUP''@/$(GL_GNULIB_STRNDUP)/g' \
2277 -e 's/@''GNULIB_STRNLEN''@/$(GL_GNULIB_STRNLEN)/g' \ 2680 -e 's/@''GNULIB_STRNLEN''@/$(GL_GNULIB_STRNLEN)/g' \
2278 -e 's/@''GNULIB_STRPBRK''@/$(GL_GNULIB_STRPBRK)/g' \ 2681 -e 's/@''GNULIB_STRPBRK''@/$(GL_GNULIB_STRPBRK)/g' \
@@ -2280,8 +2683,11 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
2280 -e 's/@''GNULIB_STRSTR''@/$(GL_GNULIB_STRSTR)/g' \ 2683 -e 's/@''GNULIB_STRSTR''@/$(GL_GNULIB_STRSTR)/g' \
2281 -e 's/@''GNULIB_STRCASESTR''@/$(GL_GNULIB_STRCASESTR)/g' \ 2684 -e 's/@''GNULIB_STRCASESTR''@/$(GL_GNULIB_STRCASESTR)/g' \
2282 -e 's/@''GNULIB_STRTOK_R''@/$(GL_GNULIB_STRTOK_R)/g' \ 2685 -e 's/@''GNULIB_STRTOK_R''@/$(GL_GNULIB_STRTOK_R)/g' \
2686 -e 's/@''GNULIB_STR_ENDSWITH''@/$(GL_GNULIB_STR_ENDSWITH)/g' \
2687 -e 's/@''GNULIB_STR_STARTSWITH''@/$(GL_GNULIB_STR_STARTSWITH)/g' \
2283 -e 's/@''GNULIB_STRERROR''@/$(GL_GNULIB_STRERROR)/g' \ 2688 -e 's/@''GNULIB_STRERROR''@/$(GL_GNULIB_STRERROR)/g' \
2284 -e 's/@''GNULIB_STRERROR_R''@/$(GL_GNULIB_STRERROR_R)/g' \ 2689 -e 's/@''GNULIB_STRERROR_R''@/$(GL_GNULIB_STRERROR_R)/g' \
2690 -e 's/@''GNULIB_STRERROR_L''@/$(GL_GNULIB_STRERROR_L)/g' \
2285 -e 's/@''GNULIB_STRERRORNAME_NP''@/$(GL_GNULIB_STRERRORNAME_NP)/g' \ 2691 -e 's/@''GNULIB_STRERRORNAME_NP''@/$(GL_GNULIB_STRERRORNAME_NP)/g' \
2286 -e 's/@''GNULIB_SIGABBREV_NP''@/$(GL_GNULIB_SIGABBREV_NP)/g' \ 2692 -e 's/@''GNULIB_SIGABBREV_NP''@/$(GL_GNULIB_SIGABBREV_NP)/g' \
2287 -e 's/@''GNULIB_SIGDESCR_NP''@/$(GL_GNULIB_SIGDESCR_NP)/g' \ 2693 -e 's/@''GNULIB_SIGDESCR_NP''@/$(GL_GNULIB_SIGDESCR_NP)/g' \
@@ -2312,6 +2718,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
2312 -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ 2718 -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
2313 -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ 2719 -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
2314 -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \ 2720 -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \
2721 -e 's|@''HAVE_STRERROR_L''@|$(HAVE_STRERROR_L)|g' \
2315 -e 's|@''HAVE_STRERRORNAME_NP''@|$(HAVE_STRERRORNAME_NP)|g' \ 2722 -e 's|@''HAVE_STRERRORNAME_NP''@|$(HAVE_STRERRORNAME_NP)|g' \
2316 -e 's|@''HAVE_SIGABBREV_NP''@|$(HAVE_SIGABBREV_NP)|g' \ 2723 -e 's|@''HAVE_SIGABBREV_NP''@|$(HAVE_SIGABBREV_NP)|g' \
2317 -e 's|@''HAVE_SIGDESCR_NP''@|$(HAVE_SIGDESCR_NP)|g' \ 2724 -e 's|@''HAVE_SIGDESCR_NP''@|$(HAVE_SIGDESCR_NP)|g' \
@@ -2328,6 +2735,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
2328 -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \ 2735 -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \
2329 -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ 2736 -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \
2330 -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \ 2737 -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \
2738 -e 's|@''REPLACE_STRNCPY''@|$(REPLACE_STRNCPY)|g' \
2331 -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \ 2739 -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \
2332 -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \ 2740 -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \
2333 -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ 2741 -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
@@ -2335,6 +2743,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' \ 2743 -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
2336 -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ 2744 -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
2337 -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ 2745 -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \
2746 -e 's|@''REPLACE_STRERROR_L''@|$(REPLACE_STRERROR_L)|g' \
2338 -e 's|@''REPLACE_STRERRORNAME_NP''@|$(REPLACE_STRERRORNAME_NP)|g' \ 2747 -e 's|@''REPLACE_STRERRORNAME_NP''@|$(REPLACE_STRERRORNAME_NP)|g' \
2339 -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ 2748 -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
2340 -e 's|@''REPLACE_STRVERSCMP''@|$(REPLACE_STRVERSCMP)|g' \ 2749 -e 's|@''REPLACE_STRVERSCMP''@|$(REPLACE_STRVERSCMP)|g' \
@@ -2349,9 +2758,9 @@ MOSTLYCLEANFILES += string.h string.h-t1 string.h-t2
2349 2758
2350EXTRA_DIST += string.in.h 2759EXTRA_DIST += string.in.h
2351 2760
2352## end gnulib module string 2761## end gnulib module string-h
2353 2762
2354## begin gnulib module strings 2763## begin gnulib module strings-h
2355 2764
2356BUILT_SOURCES += strings.h 2765BUILT_SOURCES += strings.h
2357 2766
@@ -2366,9 +2775,20 @@ strings.h: strings.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE
2366 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ 2775 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
2367 -e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \ 2776 -e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \
2368 -e 's/@''GNULIB_FFS''@/$(GL_GNULIB_FFS)/g' \ 2777 -e 's/@''GNULIB_FFS''@/$(GL_GNULIB_FFS)/g' \
2778 -e 's/@''GNULIB_STRCASECMP''@/$(GL_GNULIB_STRCASECMP)/g' \
2779 -e 's/@''GNULIB_STRCASECMP_L''@/$(GL_GNULIB_STRCASECMP_L)/g' \
2780 -e 's/@''GNULIB_STRNCASECMP''@/$(GL_GNULIB_STRNCASECMP)/g' \
2781 -e 's/@''GNULIB_STRNCASECMP_L''@/$(GL_GNULIB_STRNCASECMP_L)/g' \
2369 -e 's|@''HAVE_FFS''@|$(HAVE_FFS)|g' \ 2782 -e 's|@''HAVE_FFS''@|$(HAVE_FFS)|g' \
2370 -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \ 2783 -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
2784 -e 's|@''HAVE_STRCASECMP_L''@|$(HAVE_STRCASECMP_L)|g' \
2785 -e 's|@''HAVE_STRNCASECMP''@|$(HAVE_STRNCASECMP)|g' \
2786 -e 's|@''HAVE_STRNCASECMP_L''@|$(HAVE_STRNCASECMP_L)|g' \
2371 -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \ 2787 -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
2788 -e 's|@''REPLACE_STRCASECMP''@|$(REPLACE_STRCASECMP)|g' \
2789 -e 's|@''REPLACE_STRCASECMP_L''@|$(REPLACE_STRCASECMP_L)|g' \
2790 -e 's|@''REPLACE_STRNCASECMP''@|$(REPLACE_STRNCASECMP)|g' \
2791 -e 's|@''REPLACE_STRNCASECMP_L''@|$(REPLACE_STRNCASECMP_L)|g' \
2372 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ 2792 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
2373 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ 2793 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
2374 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ 2794 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
@@ -2378,7 +2798,23 @@ MOSTLYCLEANFILES += strings.h strings.h-t
2378 2798
2379EXTRA_DIST += strings.in.h 2799EXTRA_DIST += strings.in.h
2380 2800
2381## end gnulib module strings 2801## end gnulib module strings-h
2802
2803## begin gnulib module strncasecmp
2804
2805if GL_COND_OBJ_STRNCASECMP
2806libgnu_a_SOURCES += strncasecmp.c
2807endif
2808
2809## end gnulib module strncasecmp
2810
2811## begin gnulib module strncpy
2812
2813if GL_COND_OBJ_STRNCPY
2814libgnu_a_SOURCES += strncpy.c
2815endif
2816
2817## end gnulib module strncpy
2382 2818
2383## begin gnulib module strsep 2819## begin gnulib module strsep
2384 2820
@@ -2397,7 +2833,7 @@ EXTRA_libgnu_a_SOURCES += strstr.c
2397 2833
2398## end gnulib module strstr-simple 2834## end gnulib module strstr-simple
2399 2835
2400## begin gnulib module sys_socket 2836## begin gnulib module sys_socket-h
2401 2837
2402BUILT_SOURCES += sys/socket.h 2838BUILT_SOURCES += sys/socket.h
2403libgnu_a_SOURCES += sys_socket.c 2839libgnu_a_SOURCES += sys_socket.c
@@ -2445,9 +2881,9 @@ MOSTLYCLEANDIRS += sys
2445 2881
2446EXTRA_DIST += sys_socket.in.h 2882EXTRA_DIST += sys_socket.in.h
2447 2883
2448## end gnulib module sys_socket 2884## end gnulib module sys_socket-h
2449 2885
2450## begin gnulib module sys_stat 2886## begin gnulib module sys_stat-h
2451 2887
2452BUILT_SOURCES += sys/stat.h 2888BUILT_SOURCES += sys/stat.h
2453 2889
@@ -2518,9 +2954,9 @@ MOSTLYCLEANDIRS += sys
2518 2954
2519EXTRA_DIST += sys_stat.in.h 2955EXTRA_DIST += sys_stat.in.h
2520 2956
2521## end gnulib module sys_stat 2957## end gnulib module sys_stat-h
2522 2958
2523## begin gnulib module sys_types 2959## begin gnulib module sys_types-h
2524 2960
2525BUILT_SOURCES += sys/types.h 2961BUILT_SOURCES += sys/types.h
2526 2962
@@ -2535,16 +2971,20 @@ sys/types.h: sys_types.in.h $(top_builddir)/config.status
2535 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ 2971 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
2536 -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \ 2972 -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' \ 2973 -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
2974 -e 's|@''HAVE_OFF64_T''@|$(HAVE_OFF64_T)|g' \
2538 -e 's|@''WINDOWS_STAT_INODES''@|$(WINDOWS_STAT_INODES)|g' \ 2975 -e 's|@''WINDOWS_STAT_INODES''@|$(WINDOWS_STAT_INODES)|g' \
2976 -e 's|@''HAVE_BLKSIZE_T''@|$(HAVE_BLKSIZE_T)|g' \
2977 -e 's|@''HAVE_BLKCNT_T''@|$(HAVE_BLKCNT_T)|g' \
2539 $(srcdir)/sys_types.in.h > $@-t 2978 $(srcdir)/sys_types.in.h > $@-t
2540 $(AM_V_at)mv $@-t $@ 2979 $(AM_V_at)mv $@-t $@
2541MOSTLYCLEANFILES += sys/types.h sys/types.h-t 2980MOSTLYCLEANFILES += sys/types.h sys/types.h-t
2981MOSTLYCLEANDIRS += sys
2542 2982
2543EXTRA_DIST += sys_types.in.h 2983EXTRA_DIST += sys_types.in.h
2544 2984
2545## end gnulib module sys_types 2985## end gnulib module sys_types-h
2546 2986
2547## begin gnulib module sys_uio 2987## begin gnulib module sys_uio-h
2548 2988
2549BUILT_SOURCES += sys/uio.h 2989BUILT_SOURCES += sys/uio.h
2550 2990
@@ -2566,7 +3006,7 @@ MOSTLYCLEANDIRS += sys
2566 3006
2567EXTRA_DIST += sys_uio.in.h 3007EXTRA_DIST += sys_uio.in.h
2568 3008
2569## end gnulib module sys_uio 3009## end gnulib module sys_uio-h
2570 3010
2571## begin gnulib module threadlib 3011## begin gnulib module threadlib
2572 3012
@@ -2599,6 +3039,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' \ 3039 -e 's/@''GNULIB_TIMESPEC_GETRES''@/$(GL_GNULIB_TIMESPEC_GETRES)/g' \
2600 -e 's/@''GNULIB_TIME_R''@/$(GL_GNULIB_TIME_R)/g' \ 3040 -e 's/@''GNULIB_TIME_R''@/$(GL_GNULIB_TIME_R)/g' \
2601 -e 's/@''GNULIB_TIME_RZ''@/$(GL_GNULIB_TIME_RZ)/g' \ 3041 -e 's/@''GNULIB_TIME_RZ''@/$(GL_GNULIB_TIME_RZ)/g' \
3042 -e 's/@''GNULIB_TZNAME''@/$(GL_GNULIB_TZNAME)/g' \
2602 -e 's/@''GNULIB_TZSET''@/$(GL_GNULIB_TZSET)/g' \ 3043 -e 's/@''GNULIB_TZSET''@/$(GL_GNULIB_TZSET)/g' \
2603 -e 's/@''GNULIB_MDA_TZSET''@/$(GL_GNULIB_MDA_TZSET)/g' \ 3044 -e 's/@''GNULIB_MDA_TZSET''@/$(GL_GNULIB_MDA_TZSET)/g' \
2604 -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \ 3045 -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \
@@ -2608,11 +3049,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' \ 3049 -e 's|@''HAVE_TIMESPEC_GET''@|$(HAVE_TIMESPEC_GET)|g' \
2609 -e 's|@''HAVE_TIMESPEC_GETRES''@|$(HAVE_TIMESPEC_GETRES)|g' \ 3050 -e 's|@''HAVE_TIMESPEC_GETRES''@|$(HAVE_TIMESPEC_GETRES)|g' \
2610 -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \ 3051 -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \
3052 -e 's|@''HAVE_TZALLOC''@|$(HAVE_TZALLOC)|g' \
2611 -e 's|@''REPLACE_CTIME''@|$(REPLACE_CTIME)|g' \ 3053 -e 's|@''REPLACE_CTIME''@|$(REPLACE_CTIME)|g' \
2612 -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \ 3054 -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \
2613 -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \ 3055 -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \
2614 -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \ 3056 -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \
3057 -e 's|@''REPLACE_LOCALTIME_RZ''@|$(REPLACE_LOCALTIME_RZ)|g' \
2615 -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \ 3058 -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \
3059 -e 's|@''REPLACE_MKTIME_Z''@|$(REPLACE_MKTIME_Z)|g' \
2616 -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \ 3060 -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
2617 -e 's|@''REPLACE_STRFTIME''@|$(REPLACE_STRFTIME)|g' \ 3061 -e 's|@''REPLACE_STRFTIME''@|$(REPLACE_STRFTIME)|g' \
2618 -e 's|@''REPLACE_TIME''@|$(REPLACE_TIME)|g' \ 3062 -e 's|@''REPLACE_TIME''@|$(REPLACE_TIME)|g' \
@@ -2654,7 +3098,412 @@ EXTRA_DIST += mktime-internal.h
2654 3098
2655## end gnulib module timegm 3099## end gnulib module timegm
2656 3100
2657## begin gnulib module unistd 3101## begin gnulib module uchar-h
3102
3103BUILT_SOURCES += uchar.h
3104
3105uchar.h: uchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
3106 $(gl_V_at)$(SED_HEADER_STDOUT) \
3107 -e 's|@''GUARD_PREFIX''@|GL|g' \
3108 -e 's/@''HAVE_UCHAR_H''@/$(HAVE_UCHAR_H)/g' \
3109 -e 's/@''CXX_HAVE_UCHAR_H''@/$(CXX_HAVE_UCHAR_H)/g' \
3110 -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
3111 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
3112 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
3113 -e 's|@''NEXT_UCHAR_H''@|$(NEXT_UCHAR_H)|g' \
3114 -e 's|@''CXX_HAS_CHAR8_TYPE''@|$(CXX_HAS_CHAR8_TYPE)|g' \
3115 -e 's|@''CXX_HAS_UCHAR_TYPES''@|$(CXX_HAS_UCHAR_TYPES)|g' \
3116 -e 's|@''SMALL_WCHAR_T''@|$(SMALL_WCHAR_T)|g' \
3117 -e 's|@''GNULIBHEADERS_OVERRIDE_CHAR8_T''@|$(GNULIBHEADERS_OVERRIDE_CHAR8_T)|g' \
3118 -e 's|@''GNULIBHEADERS_OVERRIDE_CHAR16_T''@|$(GNULIBHEADERS_OVERRIDE_CHAR16_T)|g' \
3119 -e 's|@''GNULIBHEADERS_OVERRIDE_CHAR32_T''@|$(GNULIBHEADERS_OVERRIDE_CHAR32_T)|g' \
3120 -e 's/@''GNULIB_BTOC32''@/$(GL_GNULIB_BTOC32)/g' \
3121 -e 's/@''GNULIB_BTOWC''@/$(GL_GNULIB_BTOWC)/g' \
3122 -e 's/@''GNULIB_C32ISALNUM''@/$(GL_GNULIB_C32ISALNUM)/g' \
3123 -e 's/@''GNULIB_C32ISALPHA''@/$(GL_GNULIB_C32ISALPHA)/g' \
3124 -e 's/@''GNULIB_C32ISBLANK''@/$(GL_GNULIB_C32ISBLANK)/g' \
3125 -e 's/@''GNULIB_C32ISCNTRL''@/$(GL_GNULIB_C32ISCNTRL)/g' \
3126 -e 's/@''GNULIB_C32ISDIGIT''@/$(GL_GNULIB_C32ISDIGIT)/g' \
3127 -e 's/@''GNULIB_C32ISGRAPH''@/$(GL_GNULIB_C32ISGRAPH)/g' \
3128 -e 's/@''GNULIB_C32ISLOWER''@/$(GL_GNULIB_C32ISLOWER)/g' \
3129 -e 's/@''GNULIB_C32ISPRINT''@/$(GL_GNULIB_C32ISPRINT)/g' \
3130 -e 's/@''GNULIB_C32ISPUNCT''@/$(GL_GNULIB_C32ISPUNCT)/g' \
3131 -e 's/@''GNULIB_C32ISSPACE''@/$(GL_GNULIB_C32ISSPACE)/g' \
3132 -e 's/@''GNULIB_C32ISUPPER''@/$(GL_GNULIB_C32ISUPPER)/g' \
3133 -e 's/@''GNULIB_C32ISXDIGIT''@/$(GL_GNULIB_C32ISXDIGIT)/g' \
3134 -e 's/@''GNULIB_C32TOLOWER''@/$(GL_GNULIB_C32TOLOWER)/g' \
3135 -e 's/@''GNULIB_C32TOUPPER''@/$(GL_GNULIB_C32TOUPPER)/g' \
3136 -e 's/@''GNULIB_C32WIDTH''@/$(GL_GNULIB_C32WIDTH)/g' \
3137 -e 's/@''GNULIB_C32RTOMB''@/$(GL_GNULIB_C32RTOMB)/g' \
3138 -e 's/@''GNULIB_C32SNRTOMBS''@/$(GL_GNULIB_C32SNRTOMBS)/g' \
3139 -e 's/@''GNULIB_C32SRTOMBS''@/$(GL_GNULIB_C32SRTOMBS)/g' \
3140 -e 's/@''GNULIB_C32STOMBS''@/$(GL_GNULIB_C32STOMBS)/g' \
3141 -e 's/@''GNULIB_C32SWIDTH''@/$(GL_GNULIB_C32SWIDTH)/g' \
3142 -e 's/@''GNULIB_C32TOB''@/$(GL_GNULIB_C32TOB)/g' \
3143 -e 's/@''GNULIB_C32_APPLY_MAPPING''@/$(GL_GNULIB_C32_APPLY_MAPPING)/g' \
3144 -e 's/@''GNULIB_C32_APPLY_TYPE_TEST''@/$(GL_GNULIB_C32_APPLY_TYPE_TEST)/g' \
3145 -e 's/@''GNULIB_C32_GET_MAPPING''@/$(GL_GNULIB_C32_GET_MAPPING)/g' \
3146 -e 's/@''GNULIB_C32_GET_TYPE_TEST''@/$(GL_GNULIB_C32_GET_TYPE_TEST)/g' \
3147 -e 's/@''GNULIB_ISWCTYPE''@/$(GL_GNULIB_ISWCTYPE)/g' \
3148 -e 's/@''GNULIB_ISWDIGIT''@/$(GL_GNULIB_ISWDIGIT)/g' \
3149 -e 's/@''GNULIB_ISWXDIGIT''@/$(GL_GNULIB_ISWXDIGIT)/g' \
3150 -e 's/@''GNULIB_MBRTOC16''@/$(GL_GNULIB_MBRTOC16)/g' \
3151 -e 's/@''GNULIB_MBRTOC32''@/$(GL_GNULIB_MBRTOC32)/g' \
3152 -e 's/@''GNULIB_MBSNRTOC32S''@/$(GL_GNULIB_MBSNRTOC32S)/g' \
3153 -e 's/@''GNULIB_MBSNRTOWCS''@/$(GL_GNULIB_MBSNRTOWCS)/g' \
3154 -e 's/@''GNULIB_MBSRTOC32S''@/$(GL_GNULIB_MBSRTOC32S)/g' \
3155 -e 's/@''GNULIB_MBSRTOWCS''@/$(GL_GNULIB_MBSRTOWCS)/g' \
3156 -e 's/@''GNULIB_MBSTOC32S''@/$(GL_GNULIB_MBSTOC32S)/g' \
3157 -e 's/@''GNULIB_TOWCTRANS''@/$(GL_GNULIB_TOWCTRANS)/g' \
3158 -e 's/@''GNULIB_WCSNRTOMBS''@/$(GL_GNULIB_WCSNRTOMBS)/g' \
3159 -e 's/@''GNULIB_WCSRTOMBS''@/$(GL_GNULIB_WCSRTOMBS)/g' \
3160 -e 's/@''GNULIB_WCSWIDTH''@/$(GL_GNULIB_WCSWIDTH)/g' \
3161 -e 's/@''GNULIB_WCTOB''@/$(GL_GNULIB_WCTOB)/g' \
3162 -e 's/@''GNULIB_WCTRANS''@/$(GL_GNULIB_WCTRANS)/g' \
3163 -e 's/@''GNULIB_WCTYPE''@/$(GL_GNULIB_WCTYPE)/g' \
3164 -e 's/@''GNULIB_WCWIDTH''@/$(GL_GNULIB_WCWIDTH)/g' \
3165 -e 's|@''HAVE_C32RTOMB''@|$(HAVE_C32RTOMB)|g' \
3166 -e 's|@''HAVE_MBRTOC16''@|$(HAVE_MBRTOC16)|g' \
3167 -e 's|@''HAVE_MBRTOC32''@|$(HAVE_MBRTOC32)|g' \
3168 -e 's|@''REPLACE_C32RTOMB''@|$(REPLACE_C32RTOMB)|g' \
3169 -e 's|@''REPLACE_MBRTOC16''@|$(REPLACE_MBRTOC16)|g' \
3170 -e 's|@''REPLACE_MBRTOC32''@|$(REPLACE_MBRTOC32)|g' \
3171 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
3172 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
3173 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
3174 $(srcdir)/uchar.in.h > $@-t
3175 $(AM_V_at)mv $@-t $@
3176MOSTLYCLEANFILES += uchar.h uchar.h-t
3177
3178EXTRA_DIST += uchar.in.h
3179
3180## end gnulib module uchar-h
3181
3182## begin gnulib module unicase/base
3183
3184BUILT_SOURCES += $(LIBUNISTRING_UNICASE_H)
3185
3186unicase.h: unicase.in.h
3187 $(gl_V_at)$(SED_HEADER_STDOUT) \
3188 -e 's|@''HAVE_UNISTRING_WOE32DLL_H''@|$(HAVE_UNISTRING_WOE32DLL_H)|g' \
3189 -e 's/@''GNULIB_UNICASE_EMPTY_PREFIX_CONTEXT_DLL_VARIABLE''@/$(GL_GNULIB_UNICASE_EMPTY_PREFIX_CONTEXT_DLL_VARIABLE)/g' \
3190 -e 's/@''GNULIB_UNICASE_EMPTY_SUFFIX_CONTEXT_DLL_VARIABLE''@/$(GL_GNULIB_UNICASE_EMPTY_SUFFIX_CONTEXT_DLL_VARIABLE)/g' \
3191 $(srcdir)/unicase.in.h > $@-t
3192 $(AM_V_at)mv $@-t $@
3193MOSTLYCLEANFILES += unicase.h unicase.h-t
3194
3195EXTRA_DIST += unicase.in.h
3196
3197## end gnulib module unicase/base
3198
3199## begin gnulib module unicase/tolower
3200
3201if LIBUNISTRING_COMPILE_UNICASE_TOLOWER
3202libgnu_a_SOURCES += unicase/tolower.c
3203endif
3204
3205EXTRA_DIST += unicase/simple-mapping.h unicase/tolower.h
3206
3207## end gnulib module unicase/tolower
3208
3209## begin gnulib module unictype/base
3210
3211BUILT_SOURCES += $(LIBUNISTRING_UNICTYPE_H)
3212
3213unictype.h: unictype.in.h
3214 $(gl_V_at)$(SED_HEADER_STDOUT) \
3215 -e 's|@''HAVE_UNISTRING_WOE32DLL_H''@|$(HAVE_UNISTRING_WOE32DLL_H)|g' \
3216 -e 's/@''GNULIB_UNICTYPE_CATEGORY_L_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_L_DLL_VARIABLE)/g' \
3217 -e 's/@''GNULIB_UNICTYPE_CATEGORY_LC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_LC_DLL_VARIABLE)/g' \
3218 -e 's/@''GNULIB_UNICTYPE_CATEGORY_LU_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_LU_DLL_VARIABLE)/g' \
3219 -e 's/@''GNULIB_UNICTYPE_CATEGORY_LL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_LL_DLL_VARIABLE)/g' \
3220 -e 's/@''GNULIB_UNICTYPE_CATEGORY_LT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_LT_DLL_VARIABLE)/g' \
3221 -e 's/@''GNULIB_UNICTYPE_CATEGORY_LM_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_LM_DLL_VARIABLE)/g' \
3222 -e 's/@''GNULIB_UNICTYPE_CATEGORY_LO_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_LO_DLL_VARIABLE)/g' \
3223 -e 's/@''GNULIB_UNICTYPE_CATEGORY_M_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_M_DLL_VARIABLE)/g' \
3224 -e 's/@''GNULIB_UNICTYPE_CATEGORY_MN_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_MN_DLL_VARIABLE)/g' \
3225 -e 's/@''GNULIB_UNICTYPE_CATEGORY_MC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_MC_DLL_VARIABLE)/g' \
3226 -e 's/@''GNULIB_UNICTYPE_CATEGORY_ME_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_ME_DLL_VARIABLE)/g' \
3227 -e 's/@''GNULIB_UNICTYPE_CATEGORY_N_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_N_DLL_VARIABLE)/g' \
3228 -e 's/@''GNULIB_UNICTYPE_CATEGORY_ND_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_ND_DLL_VARIABLE)/g' \
3229 -e 's/@''GNULIB_UNICTYPE_CATEGORY_NL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_NL_DLL_VARIABLE)/g' \
3230 -e 's/@''GNULIB_UNICTYPE_CATEGORY_NO_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_NO_DLL_VARIABLE)/g' \
3231 -e 's/@''GNULIB_UNICTYPE_CATEGORY_P_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_P_DLL_VARIABLE)/g' \
3232 -e 's/@''GNULIB_UNICTYPE_CATEGORY_PC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_PC_DLL_VARIABLE)/g' \
3233 -e 's/@''GNULIB_UNICTYPE_CATEGORY_PD_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_PD_DLL_VARIABLE)/g' \
3234 -e 's/@''GNULIB_UNICTYPE_CATEGORY_PS_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_PS_DLL_VARIABLE)/g' \
3235 -e 's/@''GNULIB_UNICTYPE_CATEGORY_PE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_PE_DLL_VARIABLE)/g' \
3236 -e 's/@''GNULIB_UNICTYPE_CATEGORY_PI_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_PI_DLL_VARIABLE)/g' \
3237 -e 's/@''GNULIB_UNICTYPE_CATEGORY_PF_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_PF_DLL_VARIABLE)/g' \
3238 -e 's/@''GNULIB_UNICTYPE_CATEGORY_PO_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_PO_DLL_VARIABLE)/g' \
3239 -e 's/@''GNULIB_UNICTYPE_CATEGORY_S_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_S_DLL_VARIABLE)/g' \
3240 -e 's/@''GNULIB_UNICTYPE_CATEGORY_SM_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_SM_DLL_VARIABLE)/g' \
3241 -e 's/@''GNULIB_UNICTYPE_CATEGORY_SC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_SC_DLL_VARIABLE)/g' \
3242 -e 's/@''GNULIB_UNICTYPE_CATEGORY_SK_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_SK_DLL_VARIABLE)/g' \
3243 -e 's/@''GNULIB_UNICTYPE_CATEGORY_SO_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_SO_DLL_VARIABLE)/g' \
3244 -e 's/@''GNULIB_UNICTYPE_CATEGORY_Z_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_Z_DLL_VARIABLE)/g' \
3245 -e 's/@''GNULIB_UNICTYPE_CATEGORY_ZS_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_ZS_DLL_VARIABLE)/g' \
3246 -e 's/@''GNULIB_UNICTYPE_CATEGORY_ZL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_ZL_DLL_VARIABLE)/g' \
3247 -e 's/@''GNULIB_UNICTYPE_CATEGORY_ZP_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_ZP_DLL_VARIABLE)/g' \
3248 -e 's/@''GNULIB_UNICTYPE_CATEGORY_C_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_C_DLL_VARIABLE)/g' \
3249 -e 's/@''GNULIB_UNICTYPE_CATEGORY_CC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_CC_DLL_VARIABLE)/g' \
3250 -e 's/@''GNULIB_UNICTYPE_CATEGORY_CF_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_CF_DLL_VARIABLE)/g' \
3251 -e 's/@''GNULIB_UNICTYPE_CATEGORY_CS_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_CS_DLL_VARIABLE)/g' \
3252 -e 's/@''GNULIB_UNICTYPE_CATEGORY_CO_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_CO_DLL_VARIABLE)/g' \
3253 -e 's/@''GNULIB_UNICTYPE_CATEGORY_CN_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_CATEGORY_CN_DLL_VARIABLE)/g' \
3254 < $(srcdir)/unictype.in.h > $@-t1
3255 $(AM_V_at)sed \
3256 -e 's/@''GNULIB_UNICTYPE_PROPERTY_WHITE_SPACE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_WHITE_SPACE_DLL_VARIABLE)/g' \
3257 -e 's/@''GNULIB_UNICTYPE_PROPERTY_ALPHABETIC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ALPHABETIC_DLL_VARIABLE)/g' \
3258 -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_ALPHABETIC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_ALPHABETIC_DLL_VARIABLE)/g' \
3259 -e 's/@''GNULIB_UNICTYPE_PROPERTY_NOT_A_CHARACTER_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_NOT_A_CHARACTER_DLL_VARIABLE)/g' \
3260 -e 's/@''GNULIB_UNICTYPE_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE)/g' \
3261 -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE)/g' \
3262 -e 's/@''GNULIB_UNICTYPE_PROPERTY_DEPRECATED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_DEPRECATED_DLL_VARIABLE)/g' \
3263 -e 's/@''GNULIB_UNICTYPE_PROPERTY_LOGICAL_ORDER_EXCEPTION_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_LOGICAL_ORDER_EXCEPTION_DLL_VARIABLE)/g' \
3264 -e 's/@''GNULIB_UNICTYPE_PROPERTY_VARIATION_SELECTOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_VARIATION_SELECTOR_DLL_VARIABLE)/g' \
3265 -e 's/@''GNULIB_UNICTYPE_PROPERTY_PRIVATE_USE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_PRIVATE_USE_DLL_VARIABLE)/g' \
3266 -e 's/@''GNULIB_UNICTYPE_PROPERTY_UNASSIGNED_CODE_VALUE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_UNASSIGNED_CODE_VALUE_DLL_VARIABLE)/g' \
3267 -e 's/@''GNULIB_UNICTYPE_PROPERTY_UPPERCASE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_UPPERCASE_DLL_VARIABLE)/g' \
3268 -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_UPPERCASE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_UPPERCASE_DLL_VARIABLE)/g' \
3269 -e 's/@''GNULIB_UNICTYPE_PROPERTY_LOWERCASE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_LOWERCASE_DLL_VARIABLE)/g' \
3270 -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_LOWERCASE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_LOWERCASE_DLL_VARIABLE)/g' \
3271 -e 's/@''GNULIB_UNICTYPE_PROPERTY_TITLECASE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_TITLECASE_DLL_VARIABLE)/g' \
3272 -e 's/@''GNULIB_UNICTYPE_PROPERTY_CASED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CASED_DLL_VARIABLE)/g' \
3273 -e 's/@''GNULIB_UNICTYPE_PROPERTY_CASE_IGNORABLE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CASE_IGNORABLE_DLL_VARIABLE)/g' \
3274 -e 's/@''GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_LOWERCASED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_LOWERCASED_DLL_VARIABLE)/g' \
3275 -e 's/@''GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_UPPERCASED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_UPPERCASED_DLL_VARIABLE)/g' \
3276 -e 's/@''GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_TITLECASED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_TITLECASED_DLL_VARIABLE)/g' \
3277 -e 's/@''GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEFOLDED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEFOLDED_DLL_VARIABLE)/g' \
3278 -e 's/@''GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEMAPPED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEMAPPED_DLL_VARIABLE)/g' \
3279 -e 's/@''GNULIB_UNICTYPE_PROPERTY_SOFT_DOTTED_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_SOFT_DOTTED_DLL_VARIABLE)/g' \
3280 < $@-t1 > $@-t2
3281 $(AM_V_at)sed \
3282 -e 's/@''GNULIB_UNICTYPE_PROPERTY_ID_START_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ID_START_DLL_VARIABLE)/g' \
3283 -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_ID_START_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_ID_START_DLL_VARIABLE)/g' \
3284 -e 's/@''GNULIB_UNICTYPE_PROPERTY_ID_CONTINUE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ID_CONTINUE_DLL_VARIABLE)/g' \
3285 -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_ID_CONTINUE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_ID_CONTINUE_DLL_VARIABLE)/g' \
3286 -e 's/@''GNULIB_UNICTYPE_PROPERTY_XID_START_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_XID_START_DLL_VARIABLE)/g' \
3287 -e 's/@''GNULIB_UNICTYPE_PROPERTY_XID_CONTINUE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_XID_CONTINUE_DLL_VARIABLE)/g' \
3288 -e 's/@''GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_START_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_START_DLL_VARIABLE)/g' \
3289 -e 's/@''GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_CONTINUE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_CONTINUE_DLL_VARIABLE)/g' \
3290 -e 's/@''GNULIB_UNICTYPE_PROPERTY_PATTERN_WHITE_SPACE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_PATTERN_WHITE_SPACE_DLL_VARIABLE)/g' \
3291 -e 's/@''GNULIB_UNICTYPE_PROPERTY_PATTERN_SYNTAX_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_PATTERN_SYNTAX_DLL_VARIABLE)/g' \
3292 -e 's/@''GNULIB_UNICTYPE_PROPERTY_JOIN_CONTROL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_JOIN_CONTROL_DLL_VARIABLE)/g' \
3293 -e 's/@''GNULIB_UNICTYPE_PROPERTY_GRAPHEME_BASE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_GRAPHEME_BASE_DLL_VARIABLE)/g' \
3294 -e 's/@''GNULIB_UNICTYPE_PROPERTY_GRAPHEME_EXTEND_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_GRAPHEME_EXTEND_DLL_VARIABLE)/g' \
3295 -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_GRAPHEME_EXTEND_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_GRAPHEME_EXTEND_DLL_VARIABLE)/g' \
3296 -e 's/@''GNULIB_UNICTYPE_PROPERTY_GRAPHEME_LINK_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_GRAPHEME_LINK_DLL_VARIABLE)/g' \
3297 -e 's/@''GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK_DLL_VARIABLE)/g' \
3298 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_CONTROL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_CONTROL_DLL_VARIABLE)/g' \
3299 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_LEFT_TO_RIGHT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_LEFT_TO_RIGHT_DLL_VARIABLE)/g' \
3300 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT_DLL_VARIABLE)/g' \
3301 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT_DLL_VARIABLE)/g' \
3302 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_EUROPEAN_DIGIT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_EUROPEAN_DIGIT_DLL_VARIABLE)/g' \
3303 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_SEPARATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_SEPARATOR_DLL_VARIABLE)/g' \
3304 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_TERMINATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_TERMINATOR_DLL_VARIABLE)/g' \
3305 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_DIGIT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_DIGIT_DLL_VARIABLE)/g' \
3306 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_COMMON_SEPARATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_COMMON_SEPARATOR_DLL_VARIABLE)/g' \
3307 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_BLOCK_SEPARATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_BLOCK_SEPARATOR_DLL_VARIABLE)/g' \
3308 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_SEGMENT_SEPARATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_SEGMENT_SEPARATOR_DLL_VARIABLE)/g' \
3309 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_WHITESPACE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_WHITESPACE_DLL_VARIABLE)/g' \
3310 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_NON_SPACING_MARK_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_NON_SPACING_MARK_DLL_VARIABLE)/g' \
3311 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_BOUNDARY_NEUTRAL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_BOUNDARY_NEUTRAL_DLL_VARIABLE)/g' \
3312 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_PDF_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_PDF_DLL_VARIABLE)/g' \
3313 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE_DLL_VARIABLE)/g' \
3314 -e 's/@''GNULIB_UNICTYPE_PROPERTY_BIDI_OTHER_NEUTRAL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_BIDI_OTHER_NEUTRAL_DLL_VARIABLE)/g' \
3315 < $@-t2 > $@-t3
3316 $(AM_V_at)sed \
3317 -e 's/@''GNULIB_UNICTYPE_PROPERTY_HEX_DIGIT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_HEX_DIGIT_DLL_VARIABLE)/g' \
3318 -e 's/@''GNULIB_UNICTYPE_PROPERTY_ASCII_HEX_DIGIT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ASCII_HEX_DIGIT_DLL_VARIABLE)/g' \
3319 -e 's/@''GNULIB_UNICTYPE_PROPERTY_IDEOGRAPHIC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_IDEOGRAPHIC_DLL_VARIABLE)/g' \
3320 -e 's/@''GNULIB_UNICTYPE_PROPERTY_UNIFIED_IDEOGRAPH_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_UNIFIED_IDEOGRAPH_DLL_VARIABLE)/g' \
3321 -e 's/@''GNULIB_UNICTYPE_PROPERTY_RADICAL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_RADICAL_DLL_VARIABLE)/g' \
3322 -e 's/@''GNULIB_UNICTYPE_PROPERTY_IDS_UNARY_OPERATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_IDS_UNARY_OPERATOR_DLL_VARIABLE)/g' \
3323 -e 's/@''GNULIB_UNICTYPE_PROPERTY_IDS_BINARY_OPERATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_IDS_BINARY_OPERATOR_DLL_VARIABLE)/g' \
3324 -e 's/@''GNULIB_UNICTYPE_PROPERTY_IDS_TRINARY_OPERATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_IDS_TRINARY_OPERATOR_DLL_VARIABLE)/g' \
3325 -e 's/@''GNULIB_UNICTYPE_PROPERTY_EMOJI_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_EMOJI_DLL_VARIABLE)/g' \
3326 -e 's/@''GNULIB_UNICTYPE_PROPERTY_EMOJI_PRESENTATION_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_EMOJI_PRESENTATION_DLL_VARIABLE)/g' \
3327 -e 's/@''GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_DLL_VARIABLE)/g' \
3328 -e 's/@''GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_BASE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_BASE_DLL_VARIABLE)/g' \
3329 -e 's/@''GNULIB_UNICTYPE_PROPERTY_EMOJI_COMPONENT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_EMOJI_COMPONENT_DLL_VARIABLE)/g' \
3330 -e 's/@''GNULIB_UNICTYPE_PROPERTY_EXTENDED_PICTOGRAPHIC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_EXTENDED_PICTOGRAPHIC_DLL_VARIABLE)/g' \
3331 -e 's/@''GNULIB_UNICTYPE_PROPERTY_ZERO_WIDTH_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ZERO_WIDTH_DLL_VARIABLE)/g' \
3332 -e 's/@''GNULIB_UNICTYPE_PROPERTY_SPACE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_SPACE_DLL_VARIABLE)/g' \
3333 -e 's/@''GNULIB_UNICTYPE_PROPERTY_NON_BREAK_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_NON_BREAK_DLL_VARIABLE)/g' \
3334 -e 's/@''GNULIB_UNICTYPE_PROPERTY_ISO_CONTROL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_ISO_CONTROL_DLL_VARIABLE)/g' \
3335 -e 's/@''GNULIB_UNICTYPE_PROPERTY_FORMAT_CONTROL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_FORMAT_CONTROL_DLL_VARIABLE)/g' \
3336 -e 's/@''GNULIB_UNICTYPE_PROPERTY_PREPENDED_CONCATENATION_MARK_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_PREPENDED_CONCATENATION_MARK_DLL_VARIABLE)/g' \
3337 -e 's/@''GNULIB_UNICTYPE_PROPERTY_DASH_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_DASH_DLL_VARIABLE)/g' \
3338 -e 's/@''GNULIB_UNICTYPE_PROPERTY_HYPHEN_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_HYPHEN_DLL_VARIABLE)/g' \
3339 -e 's/@''GNULIB_UNICTYPE_PROPERTY_PUNCTUATION_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_PUNCTUATION_DLL_VARIABLE)/g' \
3340 -e 's/@''GNULIB_UNICTYPE_PROPERTY_LINE_SEPARATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_LINE_SEPARATOR_DLL_VARIABLE)/g' \
3341 -e 's/@''GNULIB_UNICTYPE_PROPERTY_PARAGRAPH_SEPARATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_PARAGRAPH_SEPARATOR_DLL_VARIABLE)/g' \
3342 -e 's/@''GNULIB_UNICTYPE_PROPERTY_QUOTATION_MARK_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_QUOTATION_MARK_DLL_VARIABLE)/g' \
3343 -e 's/@''GNULIB_UNICTYPE_PROPERTY_SENTENCE_TERMINAL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_SENTENCE_TERMINAL_DLL_VARIABLE)/g' \
3344 -e 's/@''GNULIB_UNICTYPE_PROPERTY_TERMINAL_PUNCTUATION_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_TERMINAL_PUNCTUATION_DLL_VARIABLE)/g' \
3345 -e 's/@''GNULIB_UNICTYPE_PROPERTY_CURRENCY_SYMBOL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_CURRENCY_SYMBOL_DLL_VARIABLE)/g' \
3346 -e 's/@''GNULIB_UNICTYPE_PROPERTY_MATH_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_MATH_DLL_VARIABLE)/g' \
3347 -e 's/@''GNULIB_UNICTYPE_PROPERTY_OTHER_MATH_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_OTHER_MATH_DLL_VARIABLE)/g' \
3348 -e 's/@''GNULIB_UNICTYPE_PROPERTY_PAIRED_PUNCTUATION_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_PAIRED_PUNCTUATION_DLL_VARIABLE)/g' \
3349 -e 's/@''GNULIB_UNICTYPE_PROPERTY_LEFT_OF_PAIR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_LEFT_OF_PAIR_DLL_VARIABLE)/g' \
3350 -e 's/@''GNULIB_UNICTYPE_PROPERTY_COMBINING_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_COMBINING_DLL_VARIABLE)/g' \
3351 -e 's/@''GNULIB_UNICTYPE_PROPERTY_COMPOSITE_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_COMPOSITE_DLL_VARIABLE)/g' \
3352 -e 's/@''GNULIB_UNICTYPE_PROPERTY_DECIMAL_DIGIT_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_DECIMAL_DIGIT_DLL_VARIABLE)/g' \
3353 -e 's/@''GNULIB_UNICTYPE_PROPERTY_NUMERIC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_NUMERIC_DLL_VARIABLE)/g' \
3354 -e 's/@''GNULIB_UNICTYPE_PROPERTY_DIACRITIC_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_DIACRITIC_DLL_VARIABLE)/g' \
3355 -e 's/@''GNULIB_UNICTYPE_PROPERTY_EXTENDER_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_EXTENDER_DLL_VARIABLE)/g' \
3356 -e 's/@''GNULIB_UNICTYPE_PROPERTY_IGNORABLE_CONTROL_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_IGNORABLE_CONTROL_DLL_VARIABLE)/g' \
3357 -e 's/@''GNULIB_UNICTYPE_PROPERTY_REGIONAL_INDICATOR_DLL_VARIABLE''@/$(GL_GNULIB_UNICTYPE_PROPERTY_REGIONAL_INDICATOR_DLL_VARIABLE)/g' \
3358 < $@-t3 > $@-t4
3359 $(AM_V_at)rm -f $@-t1 $@-t2 $@-t3
3360 $(AM_V_at)mv $@-t4 $@
3361MOSTLYCLEANFILES += unictype.h unictype.h-t1 unictype.h-t2 unictype.h-t3 unictype.h-t4
3362
3363EXTRA_DIST += unictype.in.h
3364
3365## end gnulib module unictype/base
3366
3367## begin gnulib module unictype/ctype-alnum
3368
3369if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_ALNUM
3370libgnu_a_SOURCES += unictype/ctype_alnum.c
3371endif
3372
3373EXTRA_DIST += unictype/bitmap.h unictype/ctype_alnum.h
3374
3375## end gnulib module unictype/ctype-alnum
3376
3377## begin gnulib module unictype/ctype-alpha
3378
3379if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_ALPHA
3380libgnu_a_SOURCES += unictype/ctype_alpha.c
3381endif
3382
3383EXTRA_DIST += unictype/bitmap.h unictype/ctype_alpha.h
3384
3385## end gnulib module unictype/ctype-alpha
3386
3387## begin gnulib module unictype/ctype-blank
3388
3389if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_BLANK
3390libgnu_a_SOURCES += unictype/ctype_blank.c
3391endif
3392
3393EXTRA_DIST += unictype/bitmap.h unictype/ctype_blank.h
3394
3395## end gnulib module unictype/ctype-blank
3396
3397## begin gnulib module unictype/ctype-cntrl
3398
3399if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_CNTRL
3400libgnu_a_SOURCES += unictype/ctype_cntrl.c
3401endif
3402
3403EXTRA_DIST += unictype/bitmap.h unictype/ctype_cntrl.h
3404
3405## end gnulib module unictype/ctype-cntrl
3406
3407## begin gnulib module unictype/ctype-digit
3408
3409if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_DIGIT
3410libgnu_a_SOURCES += unictype/ctype_digit.c
3411endif
3412
3413EXTRA_DIST += unictype/bitmap.h unictype/ctype_digit.h
3414
3415## end gnulib module unictype/ctype-digit
3416
3417## begin gnulib module unictype/ctype-graph
3418
3419if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_GRAPH
3420libgnu_a_SOURCES += unictype/ctype_graph.c
3421endif
3422
3423EXTRA_DIST += unictype/bitmap.h unictype/ctype_graph.h
3424
3425## end gnulib module unictype/ctype-graph
3426
3427## begin gnulib module unictype/ctype-lower
3428
3429if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_LOWER
3430libgnu_a_SOURCES += unictype/ctype_lower.c
3431endif
3432
3433EXTRA_DIST += unictype/bitmap.h unictype/ctype_lower.h
3434
3435## end gnulib module unictype/ctype-lower
3436
3437## begin gnulib module unictype/ctype-print
3438
3439if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_PRINT
3440libgnu_a_SOURCES += unictype/ctype_print.c
3441endif
3442
3443EXTRA_DIST += unictype/bitmap.h unictype/ctype_print.h
3444
3445## end gnulib module unictype/ctype-print
3446
3447## begin gnulib module unictype/ctype-punct
3448
3449if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_PUNCT
3450libgnu_a_SOURCES += unictype/ctype_punct.c
3451endif
3452
3453EXTRA_DIST += unictype/bitmap.h unictype/ctype_punct.h
3454
3455## end gnulib module unictype/ctype-punct
3456
3457## begin gnulib module unictype/ctype-space
3458
3459if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_SPACE
3460libgnu_a_SOURCES += unictype/ctype_space.c
3461endif
3462
3463EXTRA_DIST += unictype/bitmap.h unictype/ctype_space.h
3464
3465## end gnulib module unictype/ctype-space
3466
3467## begin gnulib module unictype/ctype-upper
3468
3469if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_UPPER
3470libgnu_a_SOURCES += unictype/ctype_upper.c
3471endif
3472
3473EXTRA_DIST += unictype/bitmap.h unictype/ctype_upper.h
3474
3475## end gnulib module unictype/ctype-upper
3476
3477## begin gnulib module unictype/ctype-xdigit
3478
3479if LIBUNISTRING_COMPILE_UNICTYPE_CTYPE_XDIGIT
3480libgnu_a_SOURCES += unictype/ctype_xdigit.c
3481endif
3482
3483EXTRA_DIST += unictype/bitmap.h unictype/ctype_xdigit.h
3484
3485## end gnulib module unictype/ctype-xdigit
3486
3487## begin gnulib module uninorm/base
3488
3489BUILT_SOURCES += $(LIBUNISTRING_UNINORM_H)
3490
3491uninorm.h: uninorm.in.h
3492 $(gl_V_at)$(SED_HEADER_STDOUT) \
3493 -e 's|@''HAVE_UNISTRING_WOE32DLL_H''@|$(HAVE_UNISTRING_WOE32DLL_H)|g' \
3494 -e 's/@''GNULIB_UNINORM_NFD_DLL_VARIABLE''@/$(GL_GNULIB_UNINORM_NFD_DLL_VARIABLE)/g' \
3495 -e 's/@''GNULIB_UNINORM_NFC_DLL_VARIABLE''@/$(GL_GNULIB_UNINORM_NFC_DLL_VARIABLE)/g' \
3496 -e 's/@''GNULIB_UNINORM_NFKD_DLL_VARIABLE''@/$(GL_GNULIB_UNINORM_NFKD_DLL_VARIABLE)/g' \
3497 -e 's/@''GNULIB_UNINORM_NFKC_DLL_VARIABLE''@/$(GL_GNULIB_UNINORM_NFKC_DLL_VARIABLE)/g' \
3498 $(srcdir)/uninorm.in.h > $@-t
3499 $(AM_V_at)mv $@-t $@
3500MOSTLYCLEANFILES += uninorm.h uninorm.h-t
3501
3502EXTRA_DIST += uninorm.in.h
3503
3504## end gnulib module uninorm/base
3505
3506## begin gnulib module unistd-h
2658 3507
2659BUILT_SOURCES += unistd.h 3508BUILT_SOURCES += unistd.h
2660libgnu_a_SOURCES += unistd.c 3509libgnu_a_SOURCES += unistd.c
@@ -2830,11 +3679,13 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
2830 -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \ 3679 -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \
2831 -e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \ 3680 -e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \
2832 -e 's|@''REPLACE_GETENTROPY''@|$(REPLACE_GETENTROPY)|g' \ 3681 -e 's|@''REPLACE_GETENTROPY''@|$(REPLACE_GETENTROPY)|g' \
3682 -e 's|@''REPLACE_GETLOGIN''@|$(REPLACE_GETLOGIN)|g' \
2833 -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \ 3683 -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \
2834 -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ 3684 -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
2835 -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ 3685 -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
2836 -e 's|@''REPLACE_GETPASS''@|$(REPLACE_GETPASS)|g' \ 3686 -e 's|@''REPLACE_GETPASS''@|$(REPLACE_GETPASS)|g' \
2837 -e 's|@''REPLACE_GETPASS_FOR_GETPASS_GNU''@|$(REPLACE_GETPASS_FOR_GETPASS_GNU)|g' \ 3687 -e 's|@''REPLACE_GETPASS_FOR_GETPASS_GNU''@|$(REPLACE_GETPASS_FOR_GETPASS_GNU)|g' \
3688 -e 's|@''REPLACE_GETUSERSHELL''@|$(REPLACE_GETUSERSHELL)|g' \
2838 -e 's|@''REPLACE_ISATTY''@|$(REPLACE_ISATTY)|g' \ 3689 -e 's|@''REPLACE_ISATTY''@|$(REPLACE_ISATTY)|g' \
2839 -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ 3690 -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
2840 -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \ 3691 -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \
@@ -2870,7 +3721,43 @@ MOSTLYCLEANFILES += unistd.h unistd.h-t1 unistd.h-t2 unistd.h-t3 unistd.h-t4
2870 3721
2871EXTRA_DIST += unistd.in.h 3722EXTRA_DIST += unistd.in.h
2872 3723
2873## end gnulib module unistd 3724## end gnulib module unistd-h
3725
3726## begin gnulib module unitypes-h
3727
3728BUILT_SOURCES += $(LIBUNISTRING_UNITYPES_H)
3729
3730unitypes.h: unitypes.in.h
3731 $(gl_V_at)$(SED_HEADER_TO_AT_t) $(srcdir)/unitypes.in.h
3732 $(AM_V_at)mv $@-t $@
3733MOSTLYCLEANFILES += unitypes.h unitypes.h-t
3734
3735EXTRA_DIST += unitypes.in.h
3736
3737## end gnulib module unitypes-h
3738
3739## begin gnulib module uniwidth/base
3740
3741BUILT_SOURCES += $(LIBUNISTRING_UNIWIDTH_H)
3742
3743uniwidth.h: uniwidth.in.h
3744 $(gl_V_at)$(SED_HEADER_TO_AT_t) $(srcdir)/uniwidth.in.h
3745 $(AM_V_at)mv $@-t $@
3746MOSTLYCLEANFILES += uniwidth.h uniwidth.h-t
3747
3748EXTRA_DIST += localcharset.h uniwidth.in.h
3749
3750## end gnulib module uniwidth/base
3751
3752## begin gnulib module uniwidth/width
3753
3754if LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH
3755libgnu_a_SOURCES += uniwidth/width.c
3756endif
3757
3758EXTRA_DIST += unictype/bitmap.h uniwidth/cjk.h uniwidth/width0.h uniwidth/width2.h
3759
3760## end gnulib module uniwidth/width
2874 3761
2875## begin gnulib module unlocked-io-internal 3762## begin gnulib module unlocked-io-internal
2876 3763
@@ -2921,7 +3808,13 @@ EXTRA_libgnu_a_SOURCES += vsnprintf.c
2921 3808
2922## end gnulib module vsnprintf 3809## end gnulib module vsnprintf
2923 3810
2924## begin gnulib module wchar 3811## begin gnulib module vsnzprintf
3812
3813libgnu_a_SOURCES += vsnzprintf.c
3814
3815## end gnulib module vsnzprintf
3816
3817## begin gnulib module wchar-h
2925 3818
2926BUILT_SOURCES += wchar.h 3819BUILT_SOURCES += wchar.h
2927 3820
@@ -3046,6 +3939,7 @@ wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
3046 -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \ 3939 -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \
3047 -e 's|@''REPLACE_WCSFTIME''@|$(REPLACE_WCSFTIME)|g' \ 3940 -e 's|@''REPLACE_WCSFTIME''@|$(REPLACE_WCSFTIME)|g' \
3048 -e 's|@''REPLACE_WCSCMP''@|$(REPLACE_WCSCMP)|g' \ 3941 -e 's|@''REPLACE_WCSCMP''@|$(REPLACE_WCSCMP)|g' \
3942 -e 's|@''REPLACE_WCSNCAT''@|$(REPLACE_WCSNCAT)|g' \
3049 -e 's|@''REPLACE_WCSNCMP''@|$(REPLACE_WCSNCMP)|g' \ 3943 -e 's|@''REPLACE_WCSNCMP''@|$(REPLACE_WCSNCMP)|g' \
3050 -e 's|@''REPLACE_WCSSTR''@|$(REPLACE_WCSSTR)|g' \ 3944 -e 's|@''REPLACE_WCSSTR''@|$(REPLACE_WCSSTR)|g' \
3051 -e 's|@''REPLACE_WCSTOK''@|$(REPLACE_WCSTOK)|g' \ 3945 -e 's|@''REPLACE_WCSTOK''@|$(REPLACE_WCSTOK)|g' \
@@ -3061,7 +3955,7 @@ MOSTLYCLEANFILES += wchar.h wchar.h-t1 wchar.h-t2 wchar.h-t3
3061 3955
3062EXTRA_DIST += wchar.in.h 3956EXTRA_DIST += wchar.in.h
3063 3957
3064## end gnulib module wchar 3958## end gnulib module wchar-h
3065 3959
3066## begin gnulib module wcrtomb 3960## begin gnulib module wcrtomb
3067 3961
@@ -3130,6 +4024,14 @@ EXTRA_DIST += wctype.in.h
3130 4024
3131## end gnulib module wctype-h 4025## end gnulib module wctype-h
3132 4026
4027## begin gnulib module wcwidth
4028
4029if GL_COND_OBJ_WCWIDTH
4030libgnu_a_SOURCES += wcwidth.c
4031endif
4032
4033## end gnulib module wcwidth
4034
3133## begin gnulib module windows-mutex 4035## begin gnulib module windows-mutex
3134 4036
3135if GL_COND_OBJ_WINDOWS_MUTEX 4037if GL_COND_OBJ_WINDOWS_MUTEX
@@ -3209,5 +4111,5 @@ mostlyclean-local: mostlyclean-generic
3209 : 4111 :
3210distclean-local: distclean-gnulib-libobjs 4112distclean-local: distclean-gnulib-libobjs
3211distclean-gnulib-libobjs: 4113distclean-gnulib-libobjs:
3212 -rm -f @gl_LIBOBJDEPS@ 4114 -rm -f @gl_libgnu_LIBOBJDEPS@
3213maintainer-clean-local: distclean-gnulib-libobjs 4115maintainer-clean-local: distclean-gnulib-libobjs
diff --git a/gl/_Noreturn.h b/gl/_Noreturn.h
index 7326bd47..d42f15ee 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-2025 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..cfa96954 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-2025 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/af_alg.h b/gl/af_alg.h
index ed933e12..236659bc 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-2025 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..afb00caf 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-2025 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..747bb413 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-2025 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..fae7c241
--- /dev/null
+++ b/gl/arpa_inet.c
@@ -0,0 +1,21 @@
1/* Inline functions for <arpa/inet.h>.
2
3 Copyright (C) 2024-2025 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#include <config.h>
19
20#define _GL_ARPA_INET_INLINE _GL_EXTERN_INLINE
21#include <arpa/inet.h>
diff --git a/gl/arpa_inet.in.h b/gl/arpa_inet.in.h
index 523a448c..d7417bfd 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-2025 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
@@ -126,14 +173,14 @@ _GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - "
126# define inet_pton rpl_inet_pton 173# define inet_pton rpl_inet_pton
127# endif 174# endif
128_GL_FUNCDECL_RPL (inet_pton, int, 175_GL_FUNCDECL_RPL (inet_pton, int,
129 (int af, const char *restrict src, void *restrict dst) 176 (int af, const char *restrict src, void *restrict dst),
130 _GL_ARG_NONNULL ((2, 3))); 177 _GL_ARG_NONNULL ((2, 3)));
131_GL_CXXALIAS_RPL (inet_pton, int, 178_GL_CXXALIAS_RPL (inet_pton, int,
132 (int af, const char *restrict src, void *restrict dst)); 179 (int af, const char *restrict src, void *restrict dst));
133# else 180# else
134# if !@HAVE_DECL_INET_PTON@ 181# if !@HAVE_DECL_INET_PTON@
135_GL_FUNCDECL_SYS (inet_pton, int, 182_GL_FUNCDECL_SYS (inet_pton, int,
136 (int af, const char *restrict src, void *restrict dst) 183 (int af, const char *restrict src, void *restrict dst),
137 _GL_ARG_NONNULL ((2, 3))); 184 _GL_ARG_NONNULL ((2, 3)));
138# endif 185# endif
139_GL_CXXALIAS_SYS (inet_pton, int, 186_GL_CXXALIAS_SYS (inet_pton, int,
@@ -150,6 +197,7 @@ _GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - "
150# endif 197# endif
151#endif 198#endif
152 199
200_GL_INLINE_HEADER_END
153 201
154#endif /* _@GUARD_PREFIX@_ARPA_INET_H */ 202#endif /* _@GUARD_PREFIX@_ARPA_INET_H */
155#endif /* _@GUARD_PREFIX@_ARPA_INET_H */ 203#endif /* _@GUARD_PREFIX@_ARPA_INET_H */
diff --git a/gl/asnprintf.c b/gl/asnprintf.c
index a6c09bc2..0488b6be 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-2025 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/asprintf.c b/gl/asprintf.c
index b0c33478..336700be 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-2025 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
diff --git a/gl/assert.in.h b/gl/assert.in.h
index 6e4995e1..87339abc 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-2025 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..c85412d9 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-2025 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. */
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,68 @@
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 calls to the function and to omit
244 calls to the function if another call has the same arguments or the
245 result is not used.
199 This attribute is safe for a function that neither depends on 246 This attribute is safe for a function that neither depends on
200 nor affects observable state, and always returns exactly once - 247 nor affects state, and always returns exactly once -
201 e.g., does not loop forever, and does not call longjmp. 248 e.g., does not raise an exception, call longjmp, or loop forever.
202 (This attribute is stricter than ATTRIBUTE_PURE.) */ 249 (This attribute is stricter than ATTRIBUTE_PURE because the
250 function cannot observe state. It is stricter than UNSEQUENCED
251 because the function must return exactly once and cannot depend on
252 state addressed by its arguments.) */
203/* Applies to: functions. */ 253/* Applies to: functions. */
204#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST 254#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST
205 255
206/* It is OK for a compiler to omit duplicate calls with the same 256/* It is OK for a compiler to move calls to the function and to omit duplicate
207 arguments if observable state is not changed between calls. 257 calls to the function with the same arguments, so long as the state
208 This attribute is safe for a function that does not affect 258 addressed by its arguments is the same.
209 observable state, and always returns exactly once. 259 This attribute is safe for a function that is effectless, idempotent,
210 (This attribute is looser than ATTRIBUTE_CONST.) */ 260 stateless, and independent; see ISO C 23 § 6.7.12.7 for a definition of
261 these terms.
262 (This attribute is stricter than REPRODUCIBLE because the function
263 must be stateless and independent. It is looser than ATTRIBUTE_CONST
264 because the function need not return exactly once and can depend
265 on state addressed by its arguments.)
266 See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
267 <https://stackoverflow.com/questions/76847905/>.
268 ATTENTION! Efforts are underway to change the meaning of this attribute.
269 See <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3424.htm>. */
270/* Applies to: functions, pointer to functions, function type. */
271#define UNSEQUENCED _GL_ATTRIBUTE_UNSEQUENCED
272
273/* It is OK for a compiler to move calls to the function and to omit
274 calls to the function if another call has the same arguments or the
275 result is not used, and if observable state is the same.
276 This attribute is safe for a function that does not affect observable state
277 and always returns exactly once.
278 (This attribute is looser than ATTRIBUTE_CONST because the function
279 can depend on observable state. It is stricter than REPRODUCIBLE
280 because the function must return exactly once and cannot affect
281 state addressed by its arguments.) */
211/* Applies to: functions. */ 282/* Applies to: functions. */
212#define ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE 283#define ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE
213 284
285/* It is OK for a compiler to move calls to the function and to omit duplicate
286 calls to the function with the same arguments, so long as the state
287 addressed by its arguments is the same and is updated in time for
288 the rest of the program.
289 This attribute is safe for a function that is effectless and idempotent; see
290 ISO C 23 § 6.7.12.7 for a definition of these terms.
291 (This attribute is looser than UNSEQUENCED because the function need
292 not be stateless and idempotent. It is looser than ATTRIBUTE_PURE
293 because the function need not return exactly once and can affect
294 state addressed by its arguments.)
295 See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
296 <https://stackoverflow.com/questions/76847905/>.
297 ATTENTION! Efforts are underway to change the meaning of this attribute.
298 See <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3424.htm>. */
299/* Applies to: functions, pointer to functions, function type. */
300#define REPRODUCIBLE _GL_ATTRIBUTE_REPRODUCIBLE
301
214/* The function is rarely executed. */ 302/* The function is rarely executed. */
215/* Applies to: functions. */ 303/* Applies to: functions. */
216#define ATTRIBUTE_COLD _GL_ATTRIBUTE_COLD 304#define ATTRIBUTE_COLD _GL_ATTRIBUTE_COLD
diff --git a/gl/base64.c b/gl/base64.c
index c8b3b76b..8a0edd4a 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-2025 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,7 +48,7 @@
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;
diff --git a/gl/base64.h b/gl/base64.h
index 7691f6c4..cdafdac9 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-2025 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..2aecb0dd 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-2025 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/basename-lgpl.h b/gl/basename-lgpl.h
index 2a56be98..120bd1cf 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-2025 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..9d2852d4 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-2025 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..891347de 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-2025 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..97f7fc9e
--- /dev/null
+++ b/gl/byteswap.c
@@ -0,0 +1,21 @@
1/* Inline functions for <byteswap.h>.
2
3 Copyright 2024-2025 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#include <config.h>
19
20#define _GL_BYTESWAP_INLINE _GL_EXTERN_INLINE
21#include <byteswap.h>
diff --git a/gl/byteswap.in.h b/gl/byteswap.in.h
index 8e49efad..6b4fbabf 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-2025 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..df98a5ae 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-2025 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,24 @@
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 (func, rettype, parameters, [attributes]);
115 declares the system function, named func, with the given prototype, 131 declares the system function, named func, with the given prototype,
116 consisting of return type, parameters, and attributes. 132 consisting of return type, parameters, and attributes.
117 Example: 133 Although attributes are optional, the comma before them is required
118 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 134 for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW,
119 _GL_ARG_NONNULL ((1))); 135 if needed, must be placed after the _GL_FUNCDECL_RPL invocation,
136 at the end of the declaration.
137 Examples:
138 _GL_FUNCDECL_SYS (getumask, mode_t, (void), ) _GL_ATTRIBUTE_NOTHROW;
139 _GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD);
120 */ 140 */
121#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 141#define _GL_FUNCDECL_SYS(func,rettype,parameters,...) \
122 _GL_EXTERN_C rettype func parameters_and_attributes 142 _GL_EXTERN_C_FUNC __VA_ARGS__ rettype func parameters
123 143
124/* _GL_CXXALIAS_RPL (func, rettype, parameters); 144/* _GL_CXXALIAS_RPL (func, rettype, parameters);
125 declares a C++ alias called GNULIB_NAMESPACE::func 145 declares a C++ alias called GNULIB_NAMESPACE::func
@@ -297,7 +317,7 @@
297 _GL_WARN_ON_USE (func, \ 317 _GL_WARN_ON_USE (func, \
298 "The symbol ::" #func " refers to the system function. " \ 318 "The symbol ::" #func " refers to the system function. " \
299 "Use " #namespace "::" #func " instead.") 319 "Use " #namespace "::" #func " instead.")
300# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 320# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING
301# define _GL_CXXALIASWARN_2(func,namespace) \ 321# define _GL_CXXALIASWARN_2(func,namespace) \
302 extern __typeof__ (func) func 322 extern __typeof__ (func) func
303# else 323# else
diff --git a/gl/c-ctype.c b/gl/c-ctype.c
new file mode 100644
index 00000000..ecf2c083
--- /dev/null
+++ b/gl/c-ctype.c
@@ -0,0 +1,21 @@
1/* Character handling in C locale.
2
3 Copyright (C) 2003-2025 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#include <config.h>
19
20#define C_CTYPE_INLINE _GL_EXTERN_INLINE
21#include "c-ctype.h"
diff --git a/gl/c-ctype.h b/gl/c-ctype.h
new file mode 100644
index 00000000..39063142
--- /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-2025 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..8366035d
--- /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-2025 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, IRIX */
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..7d0ebcf5
--- /dev/null
+++ b/gl/c32isalnum.c
@@ -0,0 +1,26 @@
1/* Test 32-bit wide character for being alphanumeric.
2 Copyright (C) 2020-2025 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..308fd76a
--- /dev/null
+++ b/gl/c32isalpha.c
@@ -0,0 +1,26 @@
1/* Test 32-bit wide character for being alphabetic.
2 Copyright (C) 2020-2025 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..1a03c2db
--- /dev/null
+++ b/gl/c32isblank.c
@@ -0,0 +1,26 @@
1/* Test 32-bit wide character for being blank.
2 Copyright (C) 2020-2025 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..1d004087
--- /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-2025 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..7d3bda81
--- /dev/null
+++ b/gl/c32isdigit.c
@@ -0,0 +1,26 @@
1/* Test 32-bit wide character for being a digit.
2 Copyright (C) 2020-2025 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..8b68ae39
--- /dev/null
+++ b/gl/c32isgraph.c
@@ -0,0 +1,26 @@
1/* Test 32-bit wide character for being graphic.
2 Copyright (C) 2020-2025 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..1ce08cf4
--- /dev/null
+++ b/gl/c32islower.c
@@ -0,0 +1,26 @@
1/* Test 32-bit wide character for being lowercase.
2 Copyright (C) 2020-2025 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..d47ce1f8
--- /dev/null
+++ b/gl/c32isprint.c
@@ -0,0 +1,26 @@
1/* Test 32-bit wide character for being printable.
2 Copyright (C) 2020-2025 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..41ac3d70
--- /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-2025 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..2393142b
--- /dev/null
+++ b/gl/c32isspace.c
@@ -0,0 +1,26 @@
1/* Test 32-bit wide character for being white-space.
2 Copyright (C) 2020-2025 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..bfe4a148
--- /dev/null
+++ b/gl/c32isupper.c
@@ -0,0 +1,26 @@
1/* Test 32-bit wide character for being uppercase.
2 Copyright (C) 2020-2025 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..b38d7f1f
--- /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-2025 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..a63a25b6
--- /dev/null
+++ b/gl/c32to-impl.h
@@ -0,0 +1,103 @@
1/* Case mapping of a 32-bit wide character.
2 Copyright (C) 2020-2025 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, IRIX */
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..a0b0523f
--- /dev/null
+++ b/gl/c32tolower.c
@@ -0,0 +1,26 @@
1/* Map a 32-bit wide character to lowercase.
2 Copyright (C) 2023-2025 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..442a432c
--- /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-2025 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, IRIX */
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..5258c5de 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 Tru64 UNIX 5.1 and mingw.
3 Copyright (C) 2004-2007, 2009-2024 Free Software Foundation, Inc. 3 Copyright (C) 2004-2007, 2009-2025 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..dce5739d 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-2025 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..8ab5591f 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-2025 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..0eb9fa09 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-2025 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..3bcfc479 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-2025 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..9e0ec565 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-2025 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/dirname.c b/gl/dirname.c
index 393ec1b4..e747fcaf 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-2025 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..d4d03f66 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-2025 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..69b37196 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-2025 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/dynarray.h b/gl/dynarray.h
index 8940e81b..74471ea2 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-2025 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..ba5dd371 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-2025 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 */
@@ -270,10 +270,17 @@
270# define GNULIB_defined_ENOTRECOVERABLE 1 270# define GNULIB_defined_ENOTRECOVERABLE 1
271# endif 271# endif
272 272
273/* On LynxOS, the macro EILSEQ is not defined. */
273# ifndef EILSEQ 274# ifndef EILSEQ
274# define EILSEQ 2015 275# define EILSEQ 2015
275# define GNULIB_defined_EILSEQ 1 276# define GNULIB_defined_EILSEQ 1
276# endif 277# endif
277 278
279/* On Haiku, the macro ESOCKTNOSUPPORT is not defined. */
280# ifndef ESOCKTNOSUPPORT
281# define ESOCKTNOSUPPORT 2016
282# define GNULIB_defined_ESOCKTNOSUPPORT 1
283# endif
284
278#endif /* _@GUARD_PREFIX@_ERRNO_H */ 285#endif /* _@GUARD_PREFIX@_ERRNO_H */
279#endif /* _@GUARD_PREFIX@_ERRNO_H */ 286#endif /* _@GUARD_PREFIX@_ERRNO_H */
diff --git a/gl/error.c b/gl/error.c
index c53dfeb6..9231c79c 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-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 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", 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..6c512ec8 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-2025 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..5b37c10b 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-2025 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..9d6b1528 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-2025 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..ecb18e50 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-2025 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,7 @@
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>
34#endif 33#endif
35 34
36#if defined _WIN32 && ! defined __CYGWIN__ 35#if defined _WIN32 && ! defined __CYGWIN__
@@ -562,7 +561,8 @@ klibc_fcntl (int fd, int action, /* arg */...)
562 if (result == -1 && (errno == EPERM || errno == ENOTSUP) 561 if (result == -1 && (errno == EPERM || errno == ENOTSUP)
563 && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode)) 562 && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode))
564 { 563 {
565 ULONG ulMode; 564 PLIBCFH pFH;
565 unsigned fFlags;
566 566
567 switch (action) 567 switch (action)
568 { 568 {
@@ -574,34 +574,41 @@ klibc_fcntl (int fd, int action, /* arg */...)
574 result = dup2 (fd, arg); 574 result = dup2 (fd, arg);
575 break; 575 break;
576 576
577 /* Using underlying APIs is right ? */
578 case F_GETFD: 577 case F_GETFD:
579 if (DosQueryFHState (fd, &ulMode)) 578 pFH = __libc_FH (fd);
580 break; 579 if (!pFH)
580 {
581 errno = EBADF;
582 break;
583 }
581 584
582 result = (ulMode & OPEN_FLAGS_NOINHERIT) ? FD_CLOEXEC : 0; 585 result = (pFH->fFlags & ((FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT )
586 | O_NOINHERIT)) ? FD_CLOEXEC : 0;
583 break; 587 break;
584 588
585 case F_SETFD: 589 case F_SETFD:
586 if (arg & ~FD_CLOEXEC) 590 if (arg & ~FD_CLOEXEC)
587 break; 591 break;
588 592
589 if (DosQueryFHState (fd, &ulMode)) 593 pFH = __libc_FH (fd);
590 break; 594 if (!pFH)
595 {
596 errno = EBADF;
597 break;
598 }
591 599
600 fFlags = pFH->fFlags;
592 if (arg & FD_CLOEXEC) 601 if (arg & FD_CLOEXEC)
593 ulMode |= OPEN_FLAGS_NOINHERIT; 602 fFlags |= (FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT) | O_NOINHERIT;
594 else 603 else
595 ulMode &= ~OPEN_FLAGS_NOINHERIT; 604 fFlags &= ~((FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT) | O_NOINHERIT);
596
597 /* Filter supported flags. */
598 ulMode &= (OPEN_FLAGS_WRITE_THROUGH | OPEN_FLAGS_FAIL_ON_ERROR
599 | OPEN_FLAGS_NO_CACHE | OPEN_FLAGS_NOINHERIT);
600 605
601 if (DosSetFHState (fd, ulMode)) 606 result = __libc_FHSetFlags (pFH, fd, fFlags);
602 break; 607 if (result < 0)
603 608 {
604 result = 0; 609 errno = -result;
610 result = -1;
611 }
605 break; 612 break;
606 613
607 case F_GETFL: 614 case F_GETFL:
diff --git a/gl/fcntl.in.h b/gl/fcntl.in.h
index eea3b954..c5068ed4 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-2025 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__
@@ -140,14 +149,14 @@ _GL_CXXALIASWARN (creat);
140# undef fcntl 149# undef fcntl
141# define fcntl rpl_fcntl 150# define fcntl rpl_fcntl
142# endif 151# endif
143_GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...)); 152_GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...), );
144_GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...)); 153_GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...));
145# if !GNULIB_defined_rpl_fcntl 154# if !GNULIB_defined_rpl_fcntl
146# define GNULIB_defined_rpl_fcntl 1 155# define GNULIB_defined_rpl_fcntl 1
147# endif 156# endif
148# else 157# else
149# if !@HAVE_FCNTL@ 158# if !@HAVE_FCNTL@
150_GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...)); 159_GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...), );
151# if !GNULIB_defined_fcntl 160# if !GNULIB_defined_fcntl
152# define GNULIB_defined_fcntl 1 161# define GNULIB_defined_fcntl 1
153# endif 162# endif
@@ -169,7 +178,7 @@ _GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - "
169# undef open 178# undef open
170# define open rpl_open 179# define open rpl_open
171# endif 180# endif
172_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 181_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...),
173 _GL_ARG_NONNULL ((1))); 182 _GL_ARG_NONNULL ((1)));
174_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 183_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
175# elif defined _WIN32 && !defined __CYGWIN__ 184# elif defined _WIN32 && !defined __CYGWIN__
@@ -200,7 +209,9 @@ _GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
200# undef open 209# undef open
201# define open _open 210# define open _open
202# endif 211# endif
203_GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); 212/* Need to cast, because in MSVC the parameter list of _open as a C++ function
213 is (const char *, int, int = 0). */
214_GL_CXXALIAS_MDA_CAST (open, int, (const char *filename, int flags, ...));
204# else 215# else
205_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 216_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
206# endif 217# endif
@@ -216,14 +227,14 @@ _GL_CXXALIASWARN (open);
216# define openat rpl_openat 227# define openat rpl_openat
217# endif 228# endif
218_GL_FUNCDECL_RPL (openat, int, 229_GL_FUNCDECL_RPL (openat, int,
219 (int fd, char const *file, int flags, /* mode_t mode */ ...) 230 (int fd, char const *file, int flags, /* mode_t mode */ ...),
220 _GL_ARG_NONNULL ((2))); 231 _GL_ARG_NONNULL ((2)));
221_GL_CXXALIAS_RPL (openat, int, 232_GL_CXXALIAS_RPL (openat, int,
222 (int fd, char const *file, int flags, /* mode_t mode */ ...)); 233 (int fd, char const *file, int flags, /* mode_t mode */ ...));
223# else 234# else
224# if !@HAVE_OPENAT@ 235# if !@HAVE_OPENAT@
225_GL_FUNCDECL_SYS (openat, int, 236_GL_FUNCDECL_SYS (openat, int,
226 (int fd, char const *file, int flags, /* mode_t mode */ ...) 237 (int fd, char const *file, int flags, /* mode_t mode */ ...),
227 _GL_ARG_NONNULL ((2))); 238 _GL_ARG_NONNULL ((2)));
228# endif 239# endif
229_GL_CXXALIAS_SYS (openat, int, 240_GL_CXXALIAS_SYS (openat, int,
@@ -304,7 +315,7 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
304#endif 315#endif
305 316
306#ifndef O_DIRECTORY 317#ifndef O_DIRECTORY
307# define O_DIRECTORY 0 318# define O_DIRECTORY 0x20000000 /* Try to not collide with system O_* flags. */
308#endif 319#endif
309 320
310#ifndef O_DSYNC 321#ifndef O_DSYNC
@@ -368,8 +379,12 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
368# define O_RSYNC 0 379# define O_RSYNC 0
369#endif 380#endif
370 381
382#if defined O_SEARCH && defined O_PATH && O_SEARCH == O_PATH
383# undef O_SEARCH /* musl mistakenly #defines O_SEARCH to O_PATH. */
384#endif
385
371#ifndef O_SEARCH 386#ifndef O_SEARCH
372# define O_SEARCH O_RDONLY /* This is often close enough in older systems. */ 387# define O_SEARCH O_RDONLY /* Often close enough in non-POSIX systems. */
373#endif 388#endif
374 389
375#ifndef O_SYNC 390#ifndef O_SYNC
diff --git a/gl/fd-hook.c b/gl/fd-hook.c
index 75bbe49c..4a5014eb 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-2025 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..a960eaf3 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-2025 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..d8619082 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-2025 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;
@@ -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..37381146 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-2025 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..780a0d1c 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-2025 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,101 @@
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
24# if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__
24const union gl_long_double_union gl_LDBL_MAX = 25const union gl_long_double_union gl_LDBL_MAX =
25 { { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL } }; 26 { { DBL_MAX, DBL_MAX / 0x1p53 } };
26#elif defined __i386__ 27# elif defined __i386__
27const union gl_long_double_union gl_LDBL_MAX = 28const union gl_long_double_union gl_LDBL_MAX =
28 { { 0xFFFFFFFF, 0xFFFFFFFF, 32766 } }; 29 { { 0xFFFFFFFF, 0xFFFFFFFF, 32766 } };
29#else 30# endif
31# if defined __i386__ && (defined __FreeBSD__ || defined __DragonFly__)
32/* We can't even simply evaluate the formula (LDBL_MIN / 9223372036854775808.0L)
33 at run time, because it would require BEGIN_LONG_DOUBLE_ROUNDING /
34 END_LONG_DOUBLE_ROUNDING invocations. It simpler to just write down the
35 representation of LDBL_TRUE_MIN, based on
36 <https://en.wikipedia.org/wiki/Extended_precision#x86_extended_precision_format>. */
37const union gl_long_double_union gl_LDBL_TRUE_MIN =
38 { { 0x00000001, 0x00000000, 0 } };
39# endif
40#endif
41
42#if GNULIB_defined_FLT_SNAN
43/* Define like memory_positive_SNaNf(), see signed-snan.h and snan.h,
44 or like setpayloadsigf() with an arbitrary payload. */
45gl_FLT_SNAN_t gl_FLT_SNAN =
46# if FLT_MANT_DIG == 24
47# if defined __hppa || (defined __mips__ && !MIPS_NAN2008_FLOAT) || defined __sh__
48 /* sign bit: 0, 8 exponent bits: all 1, next bit: 1, payload: 0b10...0 */
49 { { 0x7FE00000U } }
50# else
51 /* sign bit: 0, 8 exponent bits: all 1, next bit: 0, payload: 0b10...0 */
52 { { 0x7FA00000U } }
53# endif
54# endif
55 ;
56#endif
57
58#if GNULIB_defined_DBL_SNAN
59/* Define like memory_positive_SNaNd(), see signed-snan.h and snan.h,
60 or like setpayloadsig() with an arbitrary payload. */
61gl_DBL_SNAN_t gl_DBL_SNAN =
62# if DBL_MANT_DIG == 53
63# if defined __hppa || (defined __mips__ && !MIPS_NAN2008_FLOAT) || defined __sh__
64 /* sign bit: 0, 11 exponent bits: all 1, next bit: 1, payload: 0b10...0 */
65 { { 0x7FFC000000000000ULL } }
66# else
67 /* sign bit: 0, 11 exponent bits: all 1, next bit: 0, payload: 0b10...0 */
68 { { 0x7FF4000000000000ULL } }
69# endif
70# endif
71 ;
72#endif
73
74#if GNULIB_defined_LDBL_SNAN
75# ifdef WORDS_BIGENDIAN
76# define TWO(hi,lo) { hi, lo }
77# else
78# define TWO(hi,lo) { lo, hi }
79# endif
80/* Define like memory_positive_SNaNl(), see signed-snan.h and snan.h,
81 or like setpayloadsigl() with an arbitrary payload. */
82gl_LDBL_SNAN_t gl_LDBL_SNAN =
83# if LDBL_MANT_DIG == 53 /* on arm, hppa, mips, sh, but also MSVC */
84# if defined __hppa || (defined __mips__ && !MIPS_NAN2008_FLOAT) || defined __sh__
85 /* sign bit: 0, 11 exponent bits: all 1, next bit: 1, payload: 0b10...0 */
86 { { 0x7FFC000000000000ULL } }
87# else
88 /* sign bit: 0, 11 exponent bits: all 1, next bit: 0, payload: 0b10...0 */
89 { { 0x7FF4000000000000ULL } }
90# endif
91# elif LDBL_MANT_DIG == 64 /* on i386, x86_64, ia64, m68k */
92# if defined __m68k__
93 /* sign bit: 0, 15 exponent bits: all 1, 16 gap bits: all 0,
94 always=1 bit: 1, next bit: 0, payload: 0b10...0 */
95 { { 0x7FFF0000ULL, 0xA0000000ULL, 0x00000000ULL } }
96# else
97 /* sign bit: 0, 15 exponent bits: all 1, always=1 bit: 1, next bit: 0, payload: 0b10...0
98 (see <https://en.wikipedia.org/wiki/Extended_precision#x86_extended_precision_format>) */
99 { TWO (0x00007FFFULL, 0xA000000000000000ULL) }
100# endif
101# elif LDBL_MANT_DIG == 106 /* on powerpc, powerpc64, powerpc64le */
102 /* most-significant double:
103 sign bit: 0, 11 exponent bits: all 1, next bit: 0, payload: 0b10...0,
104 least-significant double: 0.0 */
105 { { 0x7FF4000000000000ULL, 0ULL } }
106# elif LDBL_MANT_DIG == 113 /* on alpha, arm64, loongarch64, mips64, riscv64, s390x, sparc64 */
107# if (defined __mips__ && !MIPS_NAN2008_FLOAT)
108 /* sign bit: 0, 15 exponent bits: all 1, next bit: 1, payload: 0b10...0 */
109 { TWO (0x7FFFC00000000000ULL, 0ULL) }
110# else
111 /* sign bit: 0, 15 exponent bits: all 1, next bit: 0, payload: 0b10...0 */
112 { TWO (0x7FFF400000000000ULL, 0ULL) }
113# endif
114# endif
115 ;
116#endif
117
30/* This declaration is solely to ensure that after preprocessing 118/* This declaration is solely to ensure that after preprocessing
31 this file is never empty. */ 119 this file is never empty. */
32typedef int dummy; 120typedef int dummy;
33#endif
diff --git a/gl/float.in.h b/gl/float.in.h
index 73e8d406..d75a06e7 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-2025 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__)
@@ -111,44 +113,38 @@ extern const union gl_long_double_union gl_LDBL_MAX;
111# define LDBL_MAX_10_EXP 4932 113# define LDBL_MAX_10_EXP 4932
112#endif 114#endif
113 115
114/* On AIX 7.1 with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX are 116/* On PowerPC with gcc 15 when using __ibm128 long double, the value of
115 wrong. 117 LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX, and LDBL_NORM_MAX are wrong. */
116 On Linux/PowerPC with gcc 4.4, the value of LDBL_MAX is wrong. */ 118#if (defined _ARCH_PPC && LDBL_MANT_DIG == 106 \
117#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__ 119 && defined __GNUC__)
118# undef LDBL_MIN_EXP 120# undef LDBL_MIN_EXP
119# define LDBL_MIN_EXP DBL_MIN_EXP 121# define LDBL_MIN_EXP DBL_MIN_EXP
120# undef LDBL_MIN_10_EXP 122# undef LDBL_MIN_10_EXP
121# define LDBL_MIN_10_EXP DBL_MIN_10_EXP 123# define LDBL_MIN_10_EXP DBL_MIN_10_EXP
122# undef LDBL_MIN 124# undef LDBL_MIN
123# define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */ 125# define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN = 2^-1022 */
124#endif
125#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__
126# undef LDBL_MAX 126# undef LDBL_MAX
127/* LDBL_MAX is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xFFFFFFFF }. 127/* LDBL_MAX is 2**1024 - 2**918, represented as: { 0x7FEFFFFF, 0xFFFFFFFF,
128 It is not easy to define: 128 0x7C9FFFFF, 0xFFFFFFFF }.
129 #define LDBL_MAX 1.79769313486231580793728971405302307166e308L 129
130 is too small, whereas 130 Do not write it as a constant expression, as GCC would likely treat
131 #define LDBL_MAX 1.79769313486231580793728971405302307167e308L 131 that as infinity due to the vagaries of this platform's funky arithmetic.
132 is too large. Apparently a bug in GCC decimal-to-binary conversion. 132 Instead, define it through a reference to an external variable.
133 Also, I can't get values larger than 133 Like the following, but using a union to avoid type mismatches:
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 134
142 const double LDBL_MAX[2] = { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL }; 135 const double LDBL_MAX[2] = { DBL_MAX, DBL_MAX / 0x1p53 };
143 extern const long double LDBL_MAX; 136 extern const long double LDBL_MAX;
144 137
145 or through a pointer cast 138 The following alternative would not work as well when GCC is optimizing:
146 139
147 #define LDBL_MAX \ 140 #define LDBL_MAX (*(long double const *) (double[])
148 (*(const long double *) (double[]) { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL }) 141 { DBL_MAX, DBL_MAX / 0x1p53 })
149 142
150 Unfortunately, this is not a constant expression, and the latter expression 143 The following alternative would require GCC 6 or later:
151 does not work well when GCC is optimizing.. */ 144
145 #define LDBL_MAX __builtin_pack_longdouble (DBL_MAX, DBL_MAX / 0x1p53)
146
147 Unfortunately none of the alternatives are constant expressions. */
152# if !GNULIB_defined_long_double_union 148# if !GNULIB_defined_long_double_union
153union gl_long_double_union 149union gl_long_double_union
154 { 150 {
@@ -159,6 +155,8 @@ union gl_long_double_union
159# endif 155# endif
160extern const union gl_long_double_union gl_LDBL_MAX; 156extern const union gl_long_double_union gl_LDBL_MAX;
161# define LDBL_MAX (gl_LDBL_MAX.ld) 157# define LDBL_MAX (gl_LDBL_MAX.ld)
158# undef LDBL_NORM_MAX
159# define LDBL_NORM_MAX LDBL_MAX
162#endif 160#endif
163 161
164/* On IRIX 6.5, with cc, the value of LDBL_MANT_DIG is wrong. 162/* On IRIX 6.5, with cc, the value of LDBL_MANT_DIG is wrong.
@@ -179,6 +177,175 @@ extern const union gl_long_double_union gl_LDBL_MAX;
179# endif 177# endif
180#endif 178#endif
181 179
180/* On PowerPC platforms, 'long double' has a double-double representation.
181 Up to ISO C 17, this was outside the scope of ISO C because it can represent
182 numbers with mantissas of the form 1.<52 bits><many zeroes><52 bits>, such as
183 1.0L + 4.94065645841246544176568792868221e-324L = 1 + 2^-1074; see
184 ISO C 17 § 5.2.4.2.2.(3).
185 In ISO C 23, wording has been included that makes this 'long double'
186 representation compliant; see ISO C 23 § 5.2.5.3.3.(8)-(9). In this setting,
187 numbers with mantissas of the form 1.<52 bits><many zeroes><52 bits> are
188 called "unnormalized". And since LDBL_EPSILON must be normalized (per
189 ISO C 23 § 5.2.5.3.3.(33)), it must be 2^-105. */
190#if defined __powerpc__ && LDBL_MANT_DIG == 106
191# undef LDBL_EPSILON
192# define LDBL_EPSILON 2.46519032881566189191165176650870696773e-32L /* 2^-105 */
193#endif
194
195/* ============================ ISO C11 support ============================ */
196
197/* 'float' properties */
198
199#ifndef FLT_HAS_SUBNORM
200# define FLT_HAS_SUBNORM 1
201#endif
202#ifndef FLT_DECIMAL_DIG
203/* FLT_MANT_DIG = 24 => FLT_DECIMAL_DIG = 9 */
204# define FLT_DECIMAL_DIG ((int)(FLT_MANT_DIG * 0.3010299956639812 + 2))
205#endif
206#if defined _AIX && !defined __GNUC__
207/* On AIX, the value of FLT_TRUE_MIN in /usr/include/float.h is a 'double',
208 not a 'float'. */
209# undef FLT_TRUE_MIN
210#endif
211#ifndef FLT_TRUE_MIN
212/* FLT_MIN / 2^(FLT_MANT_DIG-1) */
213# define FLT_TRUE_MIN (FLT_MIN / 8388608.0f)
214#endif
215
216/* 'double' properties */
217
218#ifndef DBL_HAS_SUBNORM
219# define DBL_HAS_SUBNORM 1
220#endif
221#ifndef DBL_DECIMAL_DIG
222/* DBL_MANT_DIG = 53 => DBL_DECIMAL_DIG = 17 */
223# define DBL_DECIMAL_DIG ((int)(DBL_MANT_DIG * 0.3010299956639812 + 2))
224#endif
225#ifndef DBL_TRUE_MIN
226/* DBL_MIN / 2^(DBL_MANT_DIG-1) */
227# define DBL_TRUE_MIN (DBL_MIN / 4503599627370496.0)
228#endif
229
230/* 'long double' properties */
231
232#ifndef LDBL_HAS_SUBNORM
233# define LDBL_HAS_SUBNORM 1
234#endif
235#ifndef LDBL_DECIMAL_DIG
236/* LDBL_MANT_DIG = 53 => LDBL_DECIMAL_DIG = 17 */
237/* LDBL_MANT_DIG = 64 => LDBL_DECIMAL_DIG = 21 */
238/* LDBL_MANT_DIG = 106 => LDBL_DECIMAL_DIG = 33 */
239/* LDBL_MANT_DIG = 113 => LDBL_DECIMAL_DIG = 36 */
240# define LDBL_DECIMAL_DIG ((int)(LDBL_MANT_DIG * 0.3010299956639812 + 2))
241#endif
242#ifndef LDBL_TRUE_MIN
243/* LDBL_MIN / 2^(LDBL_MANT_DIG-1) */
244# if LDBL_MANT_DIG == 53
245# define LDBL_TRUE_MIN (LDBL_MIN / 4503599627370496.0L)
246# elif LDBL_MANT_DIG == 64
247# if defined __i386__ && (defined __FreeBSD__ || defined __DragonFly__)
248/* Work around FreeBSD/x86 problem mentioned above. */
249extern const union gl_long_double_union gl_LDBL_TRUE_MIN;
250# define LDBL_TRUE_MIN (gl_LDBL_TRUE_MIN.ld)
251# else
252# define LDBL_TRUE_MIN (LDBL_MIN / 9223372036854775808.0L)
253# endif
254# elif LDBL_MANT_DIG == 106
255# define LDBL_TRUE_MIN (LDBL_MIN / 40564819207303340847894502572032.0L)
256# elif LDBL_MANT_DIG == 113
257# define LDBL_TRUE_MIN (LDBL_MIN / 5192296858534827628530496329220096.0L)
258# endif
259#endif
260
261/* ============================ ISO C23 support ============================ */
262
263/* 'float' properties */
264
265#ifndef FLT_IS_IEC_60559
266# if defined __m68k__
267# define FLT_IS_IEC_60559 0
268# else
269# define FLT_IS_IEC_60559 1
270# endif
271#endif
272#ifndef FLT_NORM_MAX
273# define FLT_NORM_MAX FLT_MAX
274#endif
275#ifndef FLT_SNAN
276/* For sh, beware of <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111814>. */
277# if ((__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__) && !defined __sh__
278# define FLT_SNAN __builtin_nansf ("")
279# else
280typedef union { unsigned int word[1]; float value; } gl_FLT_SNAN_t;
281extern gl_FLT_SNAN_t gl_FLT_SNAN;
282# define FLT_SNAN (gl_FLT_SNAN.value)
283# define GNULIB_defined_FLT_SNAN 1
284# endif
285#endif
286
287/* 'double' properties */
288
289#ifndef DBL_IS_IEC_60559
290# if defined __m68k__
291# define DBL_IS_IEC_60559 0
292# else
293# define DBL_IS_IEC_60559 1
294# endif
295#endif
296#ifndef DBL_NORM_MAX
297# define DBL_NORM_MAX DBL_MAX
298#endif
299#ifndef DBL_SNAN
300/* For sh, beware of <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111814>. */
301# if ((__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__) && !defined __sh__
302# define DBL_SNAN __builtin_nans ("")
303# else
304typedef union { unsigned long long word[1]; double value; } gl_DBL_SNAN_t;
305extern gl_DBL_SNAN_t gl_DBL_SNAN;
306# define DBL_SNAN (gl_DBL_SNAN.value)
307# define GNULIB_defined_DBL_SNAN 1
308# endif
309#endif
310
311/* 'long double' properties */
312
313#ifndef LDBL_IS_IEC_60559
314# if defined __m68k__
315# define LDBL_IS_IEC_60559 0
316# elif LDBL_MANT_DIG == 53 || LDBL_MANT_DIG == 113
317# define LDBL_IS_IEC_60559 1
318# else
319# define LDBL_IS_IEC_60559 0
320# endif
321#endif
322#ifndef LDBL_NORM_MAX
323# ifdef __LDBL_NORM_MAX__
324# define LDBL_NORM_MAX __LDBL_NORM_MAX__
325# else
326# define LDBL_NORM_MAX LDBL_MAX
327# endif
328#endif
329#ifndef LDBL_SNAN
330/* For sh, beware of <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111814>. */
331# if ((__GNUC__ + (__GNUC_MINOR__ >= 3) > 3) || defined __clang__) && !defined __sh__
332# define LDBL_SNAN __builtin_nansl ("")
333# else
334# if LDBL_MANT_DIG == 53
335typedef union { unsigned long long word[1]; long double value; } gl_LDBL_SNAN_t;
336# elif defined __m68k__
337typedef union { unsigned int word[3]; long double value; } gl_LDBL_SNAN_t;
338# else
339typedef union { unsigned long long word[2]; long double value; } gl_LDBL_SNAN_t;
340# endif
341extern gl_LDBL_SNAN_t gl_LDBL_SNAN;
342# define LDBL_SNAN (gl_LDBL_SNAN.value)
343# define GNULIB_defined_LDBL_SNAN 1
344# endif
345#endif
346
347/* ================================= Other ================================= */
348
182#if @REPLACE_ITOLD@ 349#if @REPLACE_ITOLD@
183/* Pull in a function that fixes the 'int' to 'long double' conversion 350/* Pull in a function that fixes the 'int' to 'long double' conversion
184 of glibc 2.7. */ 351 of glibc 2.7. */
diff --git a/gl/floor.c b/gl/floor.c
index 392f2044..4d7fecae 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-2025 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..d210c297 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-2025 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..41587d2c 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-2025 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)
diff --git a/gl/fpurge.c b/gl/fpurge.c
index 52a3dcef..0b69da3f 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-2025 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? */
diff --git a/gl/freading.c b/gl/freading.c
index c80d9aa8..6a60d6b3 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-2025 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,10 @@
25 <https://sourceware.org/bugzilla/show_bug.cgi?id=4359> */ 25 <https://sourceware.org/bugzilla/show_bug.cgi?id=4359> */
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,7 +41,7 @@ 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;
diff --git a/gl/freading.h b/gl/freading.h
index 943354f5..405a651e 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-2025 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..98ceafd7 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-2025 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/fseek.c b/gl/fseek.c
index cebc1749..a5857650 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-2025 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..ecd2f83a 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-2025 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 {
@@ -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;
diff --git a/gl/fseterr.c b/gl/fseterr.c
new file mode 100644
index 00000000..a01ef2af
--- /dev/null
+++ b/gl/fseterr.c
@@ -0,0 +1,84 @@
1/* Set the error indicator of a stream.
2 Copyright (C) 2007-2025 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, IRIX, OSF/1, 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;
63 int fd;
64 int fd2;
65
66 saved_errno = errno;
67 fflush (fp);
68 fd = fileno (fp);
69 fd2 = dup (fd);
70 if (fd2 >= 0)
71 {
72 close (fd);
73 fputc ('\0', fp); /* This should set the error indicator. */
74 fflush (fp); /* Or this. */
75 if (dup2 (fd2, fd) < 0)
76 /* Whee... we botched the stream and now cannot restore it! */
77 abort ();
78 close (fd2);
79 }
80 errno = saved_errno;
81#else
82 #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."
83#endif
84}
diff --git a/gl/fseterr.h b/gl/fseterr.h
new file mode 100644
index 00000000..57c30ef3
--- /dev/null
+++ b/gl/fseterr.h
@@ -0,0 +1,55 @@
1/* Set the error indicator of a stream.
2 Copyright (C) 2007, 2009-2025 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..200e672e 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-2025 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/fsusage.c b/gl/fsusage.c
index 97d0eef7..e26bda88 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-2025 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/fsusage.h b/gl/fsusage.h
index da878590..00d9067e 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-2025 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..96648d5a 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-2025 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..b0a20bf3 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-2025 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;
diff --git a/gl/gai_strerror.c b/gl/gai_strerror.c
index 37092e29..9c5f1419 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-2025 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", 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
diff --git a/gl/getaddrinfo.c b/gl/getaddrinfo.c
index bf5d61f3..a8c45c21 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-2025 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", 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
@@ -54,7 +54,7 @@
54 54
55#if HAVE_GETADDRINFO 55#if HAVE_GETADDRINFO
56 56
57/* Override with cdecl calling convention. */ 57/* Override with cdecl calling convention and mingw fix. */
58 58
59int 59int
60getaddrinfo (const char *restrict nodename, 60getaddrinfo (const char *restrict nodename,
@@ -63,6 +63,10 @@ getaddrinfo (const char *restrict nodename,
63 struct addrinfo **restrict res) 63 struct addrinfo **restrict res)
64# undef getaddrinfo 64# undef getaddrinfo
65{ 65{
66 if (hints && (hints->ai_flags & AI_NUMERICSERV) != 0
67 && servname && !(*servname >= '0' && *servname <= '9'))
68 return EAI_NONAME;
69
66 return getaddrinfo (nodename, servname, hints, res); 70 return getaddrinfo (nodename, servname, hints, res);
67} 71}
68 72
@@ -169,16 +173,43 @@ validate_family (int family)
169{ 173{
170 /* FIXME: Support more families. */ 174 /* FIXME: Support more families. */
171# if HAVE_IPV4 175# if HAVE_IPV4
172 if (family == PF_INET) 176 if (family == PF_INET)
173 return true; 177 return true;
174# endif 178# endif
175# if HAVE_IPV6 179# if HAVE_IPV6
176 if (family == PF_INET6) 180 if (family == PF_INET6)
177 return true; 181 return true;
178# endif 182# endif
179 if (family == PF_UNSPEC) 183 if (family == PF_UNSPEC)
180 return true; 184 return true;
181 return false; 185 return false;
186}
187
188static bool
189is_numeric_host (const char *host, int family)
190{
191# if HAVE_IPV4
192 if (family == PF_INET || family == PF_UNSPEC)
193 {
194 /* glibc supports IPv4 addresses in numbers-and-dots notation, that is,
195 also hexadecimal and octal number formats and formats that don't
196 require all four bytes to be explicitly written, via inet_aton().
197 But POSIX doesn't require support for these legacy formats. Therefore
198 we are free to use inet_pton() instead of inet_aton(). */
199 struct in_addr addr;
200 if (inet_pton (AF_INET, host, &addr))
201 return true;
202 }
203# endif
204# if HAVE_IPV6
205 if (family == PF_INET6 || family == PF_UNSPEC)
206 {
207 struct in6_addr addr;
208 if (inet_pton (AF_INET6, host, &addr))
209 return true;
210 }
211# endif
212 return false;
182} 213}
183 214
184/* Translate name of a service location and/or a service name to set of 215/* Translate name of a service location and/or a service name to set of
@@ -210,10 +241,17 @@ getaddrinfo (const char *restrict nodename,
210 241
211# ifdef WINDOWS_NATIVE 242# ifdef WINDOWS_NATIVE
212 if (use_win32_p ()) 243 if (use_win32_p ())
213 return getaddrinfo_ptr (nodename, servname, hints, res); 244 {
245 if (hints && (hints->ai_flags & AI_NUMERICSERV) != 0
246 && servname && !(*servname >= '0' && *servname <= '9'))
247 return EAI_NONAME;
248 return getaddrinfo_ptr (nodename, servname, hints, res);
249 }
214# endif 250# endif
215 251
216 if (hints && (hints->ai_flags & ~(AI_CANONNAME|AI_PASSIVE))) 252 if (hints
253 && (hints->ai_flags
254 & ~(AI_CANONNAME | AI_PASSIVE | AI_NUMERICHOST | AI_NUMERICSERV)))
217 /* FIXME: Support more flags. */ 255 /* FIXME: Support more flags. */
218 return EAI_BADFLAGS; 256 return EAI_BADFLAGS;
219 257
@@ -225,12 +263,18 @@ getaddrinfo (const char *restrict nodename,
225 /* FIXME: Support other socktype. */ 263 /* FIXME: Support other socktype. */
226 return EAI_SOCKTYPE; /* FIXME: Better return code? */ 264 return EAI_SOCKTYPE; /* FIXME: Better return code? */
227 265
228 if (!nodename) 266 if (nodename != NULL)
267 {
268 if (hints && (hints->ai_flags & AI_NUMERICHOST) != 0
269 && !is_numeric_host (nodename, hints->ai_family))
270 return EAI_NONAME;
271 }
272 else
229 { 273 {
230 if (!(hints->ai_flags & AI_PASSIVE)) 274 if (!(hints->ai_flags & AI_PASSIVE))
231 return EAI_NONAME; 275 return EAI_NONAME;
232 276
233# ifdef HAVE_IPV6 277# if HAVE_IPV6
234 nodename = (hints->ai_family == AF_INET6) ? "::" : "0.0.0.0"; 278 nodename = (hints->ai_family == AF_INET6) ? "::" : "0.0.0.0";
235# else 279# else
236 nodename = "0.0.0.0"; 280 nodename = "0.0.0.0";
diff --git a/gl/getdelim.c b/gl/getdelim.c
index 58063b15..2576d376 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-2025 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/getdtablesize.c b/gl/getdtablesize.c
index 762c100b..b98fbb70 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-2025 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/gethostname.c b/gl/gethostname.c
index c075b6df..8f0ceafc 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-2025 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/getline.c b/gl/getline.c
index 2d03b646..0921dd95 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-2025 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..752ec1f5 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-2025 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,7 +140,7 @@
143# define SUNOS_5 140# define SUNOS_5
144# endif 141# endif
145 142
146# if defined (__osf__) && (defined (__alpha) || defined (__alpha__)) 143# if defined (__osf__) && defined (__alpha)
147# define OSF_ALPHA 144# define OSF_ALPHA
148# include <sys/mbuf.h> 145# include <sys/mbuf.h>
149# include <sys/socket.h> 146# include <sys/socket.h>
@@ -312,8 +309,7 @@
312# endif 309# endif
313# endif 310# endif
314 311
315# if defined (__GNU__) && !defined (NeXT) 312# 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, 313/* GNU system acts much like NeXT, for load average purposes,
318 but not exactly. */ 314 but not exactly. */
319# define NeXT 315# define NeXT
@@ -358,6 +354,11 @@
358# include <sys/dg_sys_info.h> 354# include <sys/dg_sys_info.h>
359# endif 355# endif
360 356
357# if defined __linux__ || defined __ANDROID__
358# include <sys/param.h>
359# include <sys/sysinfo.h>
360# endif
361
361# if (defined __linux__ || defined __ANDROID__ \ 362# if (defined __linux__ || defined __ANDROID__ \
362 || defined __CYGWIN__ || defined SUNOS_5 \ 363 || defined __CYGWIN__ || defined SUNOS_5 \
363 || (defined LOAD_AVE_TYPE && ! defined __VMS)) 364 || (defined LOAD_AVE_TYPE && ! defined __VMS))
@@ -498,20 +499,33 @@ getloadavg (double loadavg[], int nelem)
498 } 499 }
499# endif 500# endif
500 501
501# if !defined (LDAV_DONE) && (defined __linux__ || defined __ANDROID__ || defined __CYGWIN__) 502# if (!defined LDAV_DONE \
502 /* Linux without glibc, Android, Cygwin */ 503 && (defined __ANDROID__ ? 13 <= __ANDROID_API__ : defined __linux__))
504 /* non-Android Linux without glibc, Android 3.2+, Cygwin */
503# define LDAV_DONE 505# define LDAV_DONE
504# undef LOAD_AVE_TYPE 506# undef LOAD_AVE_TYPE
505 507
506# ifndef LINUX_LDAV_FILE 508 {
507# define LINUX_LDAV_FILE "/proc/loadavg" 509 struct sysinfo info;
508# endif 510 if (sysinfo (&info) < 0)
511 return -1;
512 loadavg[0] = info.loads[0] / (double)(1U << SI_LOAD_SHIFT);
513 loadavg[1] = info.loads[1] / (double)(1U << SI_LOAD_SHIFT);
514 loadavg[2] = info.loads[2] / (double)(1U << SI_LOAD_SHIFT);
515 elem = 3;
516 }
517# endif /* __ANDROID__ ? 13 <= __ANDROID_API__ : __linux__ */
518
519# if !defined (LDAV_DONE) && defined __CYGWIN__
520 /* Cygwin */
521# define LDAV_DONE
522# undef LOAD_AVE_TYPE
509 523
510 char ldavgbuf[3 * (INT_STRLEN_BOUND (int) + sizeof ".00 ")]; 524 char ldavgbuf[3 * (INT_STRLEN_BOUND (int) + sizeof ".00 ")];
511 char const *ptr = ldavgbuf; 525 char const *ptr = ldavgbuf;
512 int fd, count, saved_errno; 526 int fd, count, saved_errno;
513 527
514 fd = open (LINUX_LDAV_FILE, O_RDONLY | O_CLOEXEC); 528 fd = open ("/proc/loadavg", O_RDONLY | O_CLOEXEC);
515 if (fd == -1) 529 if (fd == -1)
516 return -1; 530 return -1;
517 count = read (fd, ldavgbuf, sizeof ldavgbuf - 1); 531 count = read (fd, ldavgbuf, sizeof ldavgbuf - 1);
@@ -554,7 +568,7 @@ getloadavg (double loadavg[], int nelem)
554 568
555 return elem; 569 return elem;
556 570
557# endif /* __linux__ || __ANDROID__ || __CYGWIN__ */ 571# endif /* __CYGWIN__ */
558 572
559# if !defined (LDAV_DONE) && defined (__NetBSD__) /* NetBSD < 0.9 */ 573# if !defined (LDAV_DONE) && defined (__NetBSD__) /* NetBSD < 0.9 */
560# define LDAV_DONE 574# define LDAV_DONE
diff --git a/gl/getopt-cdefs.in.h b/gl/getopt-cdefs.in.h
index a1d304d4..3a5d06be 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-2025 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..51ac213d 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-2025 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..92b66a3b 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-2025 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..7c5ea094 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-2025 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..a61c68c7 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-2025 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..6b155e6c 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-2025 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", 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 \
@@ -723,7 +723,7 @@ _getopt_internal (int argc, char **argv, const char *optstring,
723 return result; 723 return result;
724} 724}
725 725
726/* glibc gets a LSB-compliant getopt and a POSIX-complaint __posix_getopt. 726/* glibc gets a LSB-compliant getopt and a POSIX-compliant __posix_getopt.
727 Standalone applications just get a POSIX-compliant getopt. 727 Standalone applications just get a POSIX-compliant getopt.
728 POSIX and LSB both require these functions to take 'char *const *argv' 728 POSIX and LSB both require these functions to take 'char *const *argv'
729 even though this is incorrect (because of the permutation). */ 729 even though this is incorrect (because of the permutation). */
@@ -732,7 +732,7 @@ _getopt_internal (int argc, char **argv, const char *optstring,
732 NAME (int argc, char *const *argv, const char *optstring) \ 732 NAME (int argc, char *const *argv, const char *optstring) \
733 { \ 733 { \
734 return _getopt_internal (argc, (char **)argv, optstring, \ 734 return _getopt_internal (argc, (char **)argv, optstring, \
735 0, 0, 0, POSIXLY_CORRECT); \ 735 NULL, NULL, 0, POSIXLY_CORRECT); \
736 } 736 }
737 737
738#ifdef _LIBC 738#ifdef _LIBC
diff --git a/gl/getopt.in.h b/gl/getopt.in.h
index c2411a75..4a87a2d5 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-2025 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..c8566845 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-2025 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_int.h b/gl/getopt_int.h
index c00c0b69..94c1945c 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-2025 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..4fe7c90d 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-2025 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/getprogname.h b/gl/getprogname.h
index bee1c1a2..ee9bb286 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-2025 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..0650abc9 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-2025 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) \
@@ -297,4 +362,5 @@ dcnpgettext_expr (const char *domain,
297 return (n == 1 ? msgid : msgid_plural); 362 return (n == 1 ? msgid : msgid_plural);
298} 363}
299 364
365
300#endif /* _LIBGETTEXT_H */ 366#endif /* _LIBGETTEXT_H */
diff --git a/gl/gl_openssl.h b/gl/gl_openssl.h
index 06864732..dea70c1c 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-2025 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/glthread/lock.c b/gl/glthread/lock.c
index 6661ad6a..dace4fda 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-2025 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/* ========================================================================= */
@@ -271,7 +269,7 @@ glthread_rwlock_init_for_glibc (pthread_rwlock_t *lock)
271 /* Note: PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP is the only value that 269 /* 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 270 causes the writer to be preferred. PTHREAD_RWLOCK_PREFER_WRITER_NP does not
273 do this; see 271 do this; see
274 http://man7.org/linux/man-pages/man3/pthread_rwlockattr_setkind_np.3.html */ 272 https://man7.org/linux/man-pages/man3/pthread_rwlockattr_setkind_np.3.html */
275 err = pthread_rwlockattr_setkind_np (&attributes, 273 err = pthread_rwlockattr_setkind_np (&attributes,
276 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); 274 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
277 if (err == 0) 275 if (err == 0)
@@ -698,46 +696,6 @@ glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock)
698 696
699# endif 697# endif
700 698
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 699#endif
742 700
743/* ========================================================================= */ 701/* ========================================================================= */
diff --git a/gl/glthread/lock.h b/gl/glthread/lock.h
index 2d5cb320..d6ccc202 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-2025 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
@@ -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..53211af8
--- /dev/null
+++ b/gl/glthread/once.c
@@ -0,0 +1,80 @@
1/* Once-only initialization in multithreaded situations.
2 Copyright (C) 2005-2025 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..943bd7a2
--- /dev/null
+++ b/gl/glthread/once.h
@@ -0,0 +1,272 @@
1/* Once-only initialization in multithreaded situations.
2 Copyright (C) 2005-2025 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..a6f7688b 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-2025 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..767906d1 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-2025 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/hard-locale.h b/gl/hard-locale.h
index 5d40e522..29808da6 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-2025 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..881c8f04 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-2025 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.h b/gl/ialloc.h
index 2aa94ae7..8bf5dd12 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-2025 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..ecaab836 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-2025 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)
@@ -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. */
diff --git a/gl/idpriv.h b/gl/idpriv.h
index a3ae5926..f4f8158e 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-2025 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..639b6cf0 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-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/inet_ntop.c b/gl/inet_ntop.c
index 0a4ba20e..df3d9512 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-2025 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 */
diff --git a/gl/inet_pton.c b/gl/inet_pton.c
new file mode 100644
index 00000000..74d55c43
--- /dev/null
+++ b/gl/inet_pton.c
@@ -0,0 +1,268 @@
1/* inet_pton.c -- convert IPv4 and IPv6 addresses from text to binary form
2
3 Copyright (C) 2006, 2008-2025 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 int saw_digit, octets, ch;
116 unsigned char tmp[NS_INADDRSZ], *tp;
117
118 saw_digit = 0;
119 octets = 0;
120 *(tp = tmp) = 0;
121 while ((ch = *src++) != '\0')
122 {
123
124 if (ch >= '0' && ch <= '9')
125 {
126 unsigned new = *tp * 10 + (ch - '0');
127
128 if (saw_digit && *tp == 0)
129 return (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 memcpy (dst, tmp, NS_INADDRSZ);
153 return (1);
154}
155
156# if HAVE_IPV6
157
158/* int
159 * inet_pton6(src, dst)
160 * convert presentation level address to network order binary form.
161 * return:
162 * 1 if 'src' is a valid [RFC1884 2.2] address, else 0.
163 * notice:
164 * (1) does not touch 'dst' unless it's returning 1.
165 * (2) :: in a full address is silently ignored.
166 * credit:
167 * inspired by Mark Andrews.
168 * author:
169 * Paul Vixie, 1996.
170 */
171static int
172inet_pton6 (const char *restrict src, unsigned char *restrict dst)
173{
174 static const char xdigits[] = "0123456789abcdef";
175 unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
176 const char *curtok;
177 int ch, saw_xdigit;
178 unsigned val;
179
180 tp = memset (tmp, '\0', NS_IN6ADDRSZ);
181 endp = tp + NS_IN6ADDRSZ;
182 colonp = NULL;
183 /* Leading :: requires some special handling. */
184 if (*src == ':')
185 if (*++src != ':')
186 return (0);
187 curtok = src;
188 saw_xdigit = 0;
189 val = 0;
190 while ((ch = c_tolower (*src++)) != '\0')
191 {
192 const char *pch;
193
194 pch = strchr (xdigits, ch);
195 if (pch != NULL)
196 {
197 val <<= 4;
198 val |= (pch - xdigits);
199 if (val > 0xffff)
200 return (0);
201 saw_xdigit = 1;
202 continue;
203 }
204 if (ch == ':')
205 {
206 curtok = src;
207 if (!saw_xdigit)
208 {
209 if (colonp)
210 return (0);
211 colonp = tp;
212 continue;
213 }
214 else if (*src == '\0')
215 {
216 return (0);
217 }
218 if (tp + NS_INT16SZ > endp)
219 return (0);
220 *tp++ = (unsigned char) (val >> 8) & 0xff;
221 *tp++ = (unsigned char) val & 0xff;
222 saw_xdigit = 0;
223 val = 0;
224 continue;
225 }
226 if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
227 inet_pton4 (curtok, tp) > 0)
228 {
229 tp += NS_INADDRSZ;
230 saw_xdigit = 0;
231 break; /* '\0' was seen by inet_pton4(). */
232 }
233 return (0);
234 }
235 if (saw_xdigit)
236 {
237 if (tp + NS_INT16SZ > endp)
238 return (0);
239 *tp++ = (unsigned char) (val >> 8) & 0xff;
240 *tp++ = (unsigned char) val & 0xff;
241 }
242 if (colonp != NULL)
243 {
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 int i;
250
251 if (tp == endp)
252 return (0);
253 for (i = 1; i <= n; i++)
254 {
255 endp[-i] = colonp[n - i];
256 colonp[n - i] = 0;
257 }
258 tp = endp;
259 }
260 if (tp != endp)
261 return (0);
262 memcpy (dst, tmp, NS_IN6ADDRSZ);
263 return (1);
264}
265
266# endif
267
268#endif
diff --git a/gl/intprops-internal.h b/gl/intprops-internal.h
index b5ba8d7c..7ace0cdd 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-2025 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
@@ -77,10 +77,11 @@
77 77
78/* Does the __typeof__ keyword work? This could be done by 78/* Does the __typeof__ keyword work? This could be done by
79 'configure', but for now it's easier to do it by hand. */ 79 'configure', but for now it's easier to do it by hand. */
80#if (2 <= __GNUC__ \ 80#if ((defined __GNUC__ && 2 <= __GNUC__) \
81 || (4 <= __clang_major__) \ 81 || (defined __clang_major__ && 4 <= __clang_major__) \
82 || (1210 <= __IBMC__ && defined __IBM__TYPEOF__) \ 82 || (defined __IBMC__ && 1210 <= __IBMC__ && defined __IBM__TYPEOF__) \
83 || (0x5110 <= __SUNPRO_C && !__STDC__)) 83 || (defined __SUNPRO_C && 0x5110 <= __SUNPRO_C && !__STDC__) \
84 || (defined _MSC_VER && 1939 <= _MSC_VER))
84# define _GL_HAVE___TYPEOF__ 1 85# define _GL_HAVE___TYPEOF__ 1
85#else 86#else
86# define _GL_HAVE___TYPEOF__ 0 87# define _GL_HAVE___TYPEOF__ 0
@@ -119,8 +120,8 @@
119#endif 120#endif
120 121
121/* True if __builtin_mul_overflow (A, B, P) works when P is non-null. */ 122/* True if __builtin_mul_overflow (A, B, P) works when P is non-null. */
122#if defined __clang_major__ && __clang_major__ < 14 123#if defined __clang_major__ && __clang_major__ < 21
123/* Work around Clang bug <https://bugs.llvm.org/show_bug.cgi?id=16404>. */ 124/* Work around Clang bug <https://github.com/llvm/llvm-project/issues/16778>. */
124# define _GL_HAS_BUILTIN_MUL_OVERFLOW 0 125# define _GL_HAS_BUILTIN_MUL_OVERFLOW 0
125#else 126#else
126# define _GL_HAS_BUILTIN_MUL_OVERFLOW _GL_HAS_BUILTIN_ADD_OVERFLOW 127# define _GL_HAS_BUILTIN_MUL_OVERFLOW _GL_HAS_BUILTIN_ADD_OVERFLOW
@@ -163,7 +164,7 @@
163#if _GL_HAS_BUILTIN_MUL_OVERFLOW 164#if _GL_HAS_BUILTIN_MUL_OVERFLOW
164# if ((9 < __GNUC__ + (3 <= __GNUC_MINOR__) \ 165# if ((9 < __GNUC__ + (3 <= __GNUC_MINOR__) \
165 || (__GNUC__ == 8 && 4 <= __GNUC_MINOR__)) \ 166 || (__GNUC__ == 8 && 4 <= __GNUC_MINOR__)) \
166 && !defined __EDG__) 167 && !defined __clang__ && !defined __EDG__)
167# define _GL_INT_MULTIPLY_WRAPV(a, b, r) __builtin_mul_overflow (a, b, r) 168# define _GL_INT_MULTIPLY_WRAPV(a, b, r) __builtin_mul_overflow (a, b, r)
168# else 169# else
169 /* Work around GCC bug 91450. */ 170 /* Work around GCC bug 91450. */
@@ -182,13 +183,13 @@
182 _GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW) 183 _GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW)
183#endif 184#endif
184 185
185/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See: 186/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25764. See:
186 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193 187 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193
187 https://llvm.org/bugs/show_bug.cgi?id=25390 188 https://github.com/llvm/llvm-project/issues/25764
188 For now, assume all versions of GCC-like compilers generate bogus 189 For now, assume GCC < 14 and all Clang versions generate bogus
189 warnings for _Generic. This matters only for compilers that 190 warnings for _Generic. This matters only for compilers that
190 lack relevant builtins. */ 191 lack relevant builtins. */
191#if __GNUC__ || defined __clang__ 192#if (__GNUC__ && __GNUC__ < 14) || defined __clang__
192# define _GL__GENERIC_BOGUS 1 193# define _GL__GENERIC_BOGUS 1
193#else 194#else
194# define _GL__GENERIC_BOGUS 0 195# define _GL__GENERIC_BOGUS 0
diff --git a/gl/intprops.h b/gl/intprops.h
index 43734f34..2f9fa0a0 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-2025 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
diff --git a/gl/inttypes.in.h b/gl/inttypes.in.h
index b9ab8a4b..5520ebc5 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-2025 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
@@ -944,11 +944,11 @@ typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t;
944# undef imaxdiv 944# undef imaxdiv
945# define imaxdiv rpl_imaxdiv 945# define imaxdiv rpl_imaxdiv
946# endif 946# endif
947_GL_FUNCDECL_RPL (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom)); 947_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)); 948_GL_CXXALIAS_RPL (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom));
949# else 949# else
950# if !@HAVE_DECL_IMAXDIV@ 950# if !@HAVE_DECL_IMAXDIV@
951_GL_FUNCDECL_SYS (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom)); 951_GL_FUNCDECL_SYS (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom), );
952# endif 952# endif
953_GL_CXXALIAS_SYS (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom)); 953_GL_CXXALIAS_SYS (imaxdiv, imaxdiv_t, (intmax_t numer, intmax_t denom));
954# endif 954# endif
@@ -970,7 +970,7 @@ _GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - "
970# define strtoimax rpl_strtoimax 970# define strtoimax rpl_strtoimax
971# endif 971# endif
972_GL_FUNCDECL_RPL (strtoimax, intmax_t, 972_GL_FUNCDECL_RPL (strtoimax, intmax_t,
973 (const char *restrict, char **restrict, int) 973 (const char *restrict, char **restrict, int),
974 _GL_ARG_NONNULL ((1))); 974 _GL_ARG_NONNULL ((1)));
975_GL_CXXALIAS_RPL (strtoimax, intmax_t, 975_GL_CXXALIAS_RPL (strtoimax, intmax_t,
976 (const char *restrict, char **restrict, int)); 976 (const char *restrict, char **restrict, int));
@@ -978,7 +978,7 @@ _GL_CXXALIAS_RPL (strtoimax, intmax_t,
978# if !@HAVE_DECL_STRTOIMAX@ 978# if !@HAVE_DECL_STRTOIMAX@
979# undef strtoimax 979# undef strtoimax
980_GL_FUNCDECL_SYS (strtoimax, intmax_t, 980_GL_FUNCDECL_SYS (strtoimax, intmax_t,
981 (const char *restrict, char **restrict, int) 981 (const char *restrict, char **restrict, int),
982 _GL_ARG_NONNULL ((1))); 982 _GL_ARG_NONNULL ((1)));
983# endif 983# endif
984_GL_CXXALIAS_SYS (strtoimax, intmax_t, 984_GL_CXXALIAS_SYS (strtoimax, intmax_t,
@@ -1000,7 +1000,7 @@ _GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - "
1000# define strtoumax rpl_strtoumax 1000# define strtoumax rpl_strtoumax
1001# endif 1001# endif
1002_GL_FUNCDECL_RPL (strtoumax, uintmax_t, 1002_GL_FUNCDECL_RPL (strtoumax, uintmax_t,
1003 (const char *restrict, char **restrict, int) 1003 (const char *restrict, char **restrict, int),
1004 _GL_ARG_NONNULL ((1))); 1004 _GL_ARG_NONNULL ((1)));
1005_GL_CXXALIAS_RPL (strtoumax, uintmax_t, 1005_GL_CXXALIAS_RPL (strtoumax, uintmax_t,
1006 (const char *restrict, char **restrict, int)); 1006 (const char *restrict, char **restrict, int));
@@ -1008,7 +1008,7 @@ _GL_CXXALIAS_RPL (strtoumax, uintmax_t,
1008# if !@HAVE_DECL_STRTOUMAX@ 1008# if !@HAVE_DECL_STRTOUMAX@
1009# undef strtoumax 1009# undef strtoumax
1010_GL_FUNCDECL_SYS (strtoumax, uintmax_t, 1010_GL_FUNCDECL_SYS (strtoumax, uintmax_t,
1011 (const char *restrict, char **restrict, int) 1011 (const char *restrict, char **restrict, int),
1012 _GL_ARG_NONNULL ((1))); 1012 _GL_ARG_NONNULL ((1)));
1013# endif 1013# endif
1014_GL_CXXALIAS_SYS (strtoumax, uintmax_t, 1014_GL_CXXALIAS_SYS (strtoumax, uintmax_t,
diff --git a/gl/iswblank.c b/gl/iswblank.c
index f699850a..6e361f43 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-2025 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..c87e00ff 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-2025 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..576e93e4 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-2025 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..6bba487b 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-2025 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..2b9258a9 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-2025 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..e154ac80 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-2025 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..084eba23 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-2025 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..e16c95b3 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-2025 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
@@ -171,6 +183,37 @@ typedef int nl_item;
171# define GNULIB_defined_ALTMON 1 183# define GNULIB_defined_ALTMON 1
172# endif 184# endif
173 185
186# if !@HAVE_LANGINFO_ABALTMON@
187# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 27
188# define ABALTMON_1 _NL_ABALTMON_1
189# define ABALTMON_2 _NL_ABALTMON_2
190# define ABALTMON_3 _NL_ABALTMON_3
191# define ABALTMON_4 _NL_ABALTMON_4
192# define ABALTMON_5 _NL_ABALTMON_5
193# define ABALTMON_6 _NL_ABALTMON_6
194# define ABALTMON_7 _NL_ABALTMON_7
195# define ABALTMON_8 _NL_ABALTMON_8
196# define ABALTMON_9 _NL_ABALTMON_9
197# define ABALTMON_10 _NL_ABALTMON_10
198# define ABALTMON_11 _NL_ABALTMON_11
199# define ABALTMON_12 _NL_ABALTMON_12
200# else
201# define ABALTMON_1 10220
202# define ABALTMON_2 (ABALTMON_1 + 1)
203# define ABALTMON_3 (ABALTMON_1 + 2)
204# define ABALTMON_4 (ABALTMON_1 + 3)
205# define ABALTMON_5 (ABALTMON_1 + 4)
206# define ABALTMON_6 (ABALTMON_1 + 5)
207# define ABALTMON_7 (ABALTMON_1 + 6)
208# define ABALTMON_8 (ABALTMON_1 + 7)
209# define ABALTMON_9 (ABALTMON_1 + 8)
210# define ABALTMON_10 (ABALTMON_1 + 9)
211# define ABALTMON_11 (ABALTMON_1 + 10)
212# define ABALTMON_12 (ABALTMON_1 + 11)
213# define GNULIB_defined_ABALTMON 1
214# endif
215# endif
216
174# if !@HAVE_LANGINFO_ERA@ 217# if !@HAVE_LANGINFO_ERA@
175# define ERA 10047 218# define ERA 10047
176# define ERA_D_FMT 10048 219# define ERA_D_FMT 10048
@@ -205,11 +248,11 @@ typedef int nl_item;
205# undef nl_langinfo 248# undef nl_langinfo
206# define nl_langinfo rpl_nl_langinfo 249# define nl_langinfo rpl_nl_langinfo
207# endif 250# endif
208_GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item)); 251_GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item), );
209_GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item)); 252_GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item));
210# else 253# else
211# if !@HAVE_NL_LANGINFO@ 254# if !@HAVE_NL_LANGINFO@
212_GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item)); 255_GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item), );
213# endif 256# endif
214_GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item)); 257_GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item));
215# endif 258# endif
diff --git a/gl/lc-charset-dispatch.c b/gl/lc-charset-dispatch.c
index e2f8b2f5..91ab6d72 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-2025 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..554137b6 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-2025 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..33da9cf1 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-2025 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..c33c59e1 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-2025 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
diff --git a/gl/localcharset.c b/gl/localcharset.c
index 93c4baa4..32f6f78e 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-2025 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
@@ -380,7 +380,7 @@ static const struct table_entry alias_table[] =
380# if defined OS2 /* OS/2 */ 380# if defined OS2 /* OS/2 */
381 /* The list of encodings is taken from "List of OS/2 Codepages" 381 /* The list of encodings is taken from "List of OS/2 Codepages"
382 by Alex Taylor: 382 by Alex Taylor:
383 <http://altsan.org/os2/toolkits/uls/index.html#codepages>. 383 <https://altsan.org/os2/toolkits/uls/index.html#codepages>.
384 See also "__convcp() of kLIBC": 384 See also "__convcp() of kLIBC":
385 <https://github.com/bitwiseworks/libc/blob/master/src/emx/src/lib/locale/__convcp.c>. */ 385 <https://github.com/bitwiseworks/libc/blob/master/src/emx/src/lib/locale/__convcp.c>. */
386 { "CP1004", "CP1252" }, 386 { "CP1004", "CP1252" },
@@ -939,8 +939,10 @@ locale_charset (void)
939 sprintf (buf, "CP%u", GetACP ()); 939 sprintf (buf, "CP%u", GetACP ());
940 } 940 }
941 /* For a locale name such as "French_France.65001", in Windows 10, 941 /* For a locale name such as "French_France.65001", in Windows 10,
942 setlocale now returns "French_France.utf8" instead. */ 942 setlocale now returns "French_France.utf8" instead, or in the UTF-8
943 if (strcmp (buf + 2, "65001") == 0 || strcmp (buf + 2, "utf8") == 0) 943 environment (with modern system settings) "fr_FR.UTF-8". */
944 if (strcmp (buf + 2, "65001") == 0 || strcmp (buf + 2, "utf8") == 0
945 || strcmp (buf + 2, "UTF-8") == 0)
944 codeset = "UTF-8"; 946 codeset = "UTF-8";
945 else 947 else
946 { 948 {
diff --git a/gl/localcharset.h b/gl/localcharset.h
index 47214024..25e6d099 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-2025 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
diff --git a/gl/locale.in.h b/gl/locale.in.h
index 1b11a41c..34f8c5b6 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-2025 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,8 +259,10 @@ _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 267# undef localeconv
184# if HAVE_RAW_DECL_LOCALECONV 268# if HAVE_RAW_DECL_LOCALECONV
@@ -195,7 +279,7 @@ _GL_WARN_ON_USE (localeconv,
195# define setlocale rpl_setlocale 279# define setlocale rpl_setlocale
196# define GNULIB_defined_setlocale 1 280# define GNULIB_defined_setlocale 1
197# endif 281# endif
198_GL_FUNCDECL_RPL (setlocale, char *, (int category, const char *locale)); 282_GL_FUNCDECL_RPL (setlocale, char *, (int category, const char *locale), );
199_GL_CXXALIAS_RPL (setlocale, char *, (int category, const char *locale)); 283_GL_CXXALIAS_RPL (setlocale, char *, (int category, const char *locale));
200# else 284# else
201_GL_CXXALIAS_SYS (setlocale, char *, (int category, const char *locale)); 285_GL_CXXALIAS_SYS (setlocale, char *, (int category, const char *locale));
@@ -216,7 +300,7 @@ _GL_WARN_ON_USE (setlocale, "setlocale works differently on native Windows - "
216# include "setlocale_null.h" 300# include "setlocale_null.h"
217#endif 301#endif
218 302
219#if /*@GNULIB_NEWLOCALE@ ||*/ (@GNULIB_LOCALENAME_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_NEWLOCALE@) 303#if @GNULIB_NEWLOCALE@ || (@GNULIB_GETLOCALENAME_L_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_NEWLOCALE@)
220# if @REPLACE_NEWLOCALE@ 304# if @REPLACE_NEWLOCALE@
221# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 305# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
222# undef newlocale 306# undef newlocale
@@ -224,24 +308,22 @@ _GL_WARN_ON_USE (setlocale, "setlocale works differently on native Windows - "
224# define GNULIB_defined_newlocale 1 308# define GNULIB_defined_newlocale 1
225# endif 309# endif
226_GL_FUNCDECL_RPL (newlocale, locale_t, 310_GL_FUNCDECL_RPL (newlocale, locale_t,
227 (int category_mask, const char *name, locale_t base) 311 (int category_mask, const char *name, locale_t base),
228 _GL_ARG_NONNULL ((2))); 312 _GL_ARG_NONNULL ((2)));
229_GL_CXXALIAS_RPL (newlocale, locale_t, 313_GL_CXXALIAS_RPL (newlocale, locale_t,
230 (int category_mask, const char *name, locale_t base)); 314 (int category_mask, const char *name, locale_t base));
231# else 315# else
232# if @HAVE_NEWLOCALE@ 316# if !@HAVE_NEWLOCALE@
317_GL_FUNCDECL_SYS (newlocale, locale_t,
318 (int category_mask, const char *name, locale_t base),
319 _GL_ARG_NONNULL ((2)));
320# endif
233_GL_CXXALIAS_SYS (newlocale, locale_t, 321_GL_CXXALIAS_SYS (newlocale, locale_t,
234 (int category_mask, const char *name, locale_t base)); 322 (int category_mask, const char *name, locale_t base));
235# endif
236# endif 323# endif
237# if __GLIBC__ >= 2 && @HAVE_NEWLOCALE@ 324# if __GLIBC__ >= 2
238_GL_CXXALIASWARN (newlocale); 325_GL_CXXALIASWARN (newlocale);
239# endif 326# 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 327#elif defined GNULIB_POSIXCHECK
246# undef newlocale 328# undef newlocale
247# if HAVE_RAW_DECL_NEWLOCALE 329# if HAVE_RAW_DECL_NEWLOCALE
@@ -249,53 +331,50 @@ _GL_WARN_ON_USE (newlocale, "newlocale is not portable");
249# endif 331# endif
250#endif 332#endif
251 333
252#if @GNULIB_DUPLOCALE@ || (@GNULIB_LOCALENAME_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_DUPLOCALE@) 334#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@. */ 335# if @REPLACE_DUPLOCALE@
254# if @REPLACE_DUPLOCALE@ 336# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
255# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 337# undef duplocale
256# undef duplocale 338# define duplocale rpl_duplocale
257# define duplocale rpl_duplocale 339# define GNULIB_defined_duplocale 1
258# define GNULIB_defined_duplocale 1 340# endif
259# endif 341_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)); 342_GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale));
262# else 343# else
263_GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale)); 344# if !@HAVE_DUPLOCALE@
345_GL_FUNCDECL_SYS (duplocale, locale_t, (locale_t locale), _GL_ARG_NONNULL ((1)));
264# endif 346# endif
347_GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale));
265# endif 348# endif
266# if __GLIBC__ >= 2 && @HAVE_DUPLOCALE@ 349# if __GLIBC__ >= 2
267_GL_CXXALIASWARN (duplocale); 350_GL_CXXALIASWARN (duplocale);
268# endif 351# 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 352#elif defined GNULIB_POSIXCHECK
275# undef duplocale 353# undef duplocale
276# if HAVE_RAW_DECL_DUPLOCALE 354# if HAVE_RAW_DECL_DUPLOCALE
277_GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - " 355_GL_WARN_ON_USE (duplocale, "duplocale is unportable and buggy on some glibc systems - "
278 "use gnulib module duplocale for portability"); 356 "use gnulib module duplocale for portability");
279# endif 357# endif
280#endif 358#endif
281 359
282#if /*@GNULIB_FREELOCALE@ ||*/ (@GNULIB_LOCALENAME_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_FREELOCALE@) 360#if @GNULIB_FREELOCALE@ || (@GNULIB_GETLOCALENAME_L_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_FREELOCALE@)
283# if @REPLACE_FREELOCALE@ 361# if @REPLACE_FREELOCALE@
284# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 362# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
285# undef freelocale 363# undef freelocale
286# define freelocale rpl_freelocale 364# define freelocale rpl_freelocale
287# define GNULIB_defined_freelocale 1 365# define GNULIB_defined_freelocale 1
288# endif 366# endif
289_GL_FUNCDECL_RPL (freelocale, void, (locale_t locale) _GL_ARG_NONNULL ((1))); 367_GL_FUNCDECL_RPL (freelocale, void, (locale_t locale), _GL_ARG_NONNULL ((1)));
290_GL_CXXALIAS_RPL (freelocale, void, (locale_t locale)); 368_GL_CXXALIAS_RPL (freelocale, void, (locale_t locale));
291# else 369# else
292# if @HAVE_FREELOCALE@ 370# if !@HAVE_FREELOCALE@
371_GL_FUNCDECL_SYS (freelocale, void, (locale_t locale), _GL_ARG_NONNULL ((1)));
372# endif
293/* Need to cast, because on FreeBSD and Mac OS X 10.13, the return type is 373/* Need to cast, because on FreeBSD and Mac OS X 10.13, the return type is
294 int. */ 374 int. */
295_GL_CXXALIAS_SYS_CAST (freelocale, void, (locale_t locale)); 375_GL_CXXALIAS_SYS_CAST (freelocale, void, (locale_t locale));
296# endif
297# endif 376# endif
298# if __GLIBC__ >= 2 && @HAVE_FREELOCALE@ 377# if __GLIBC__ >= 2
299_GL_CXXALIASWARN (freelocale); 378_GL_CXXALIASWARN (freelocale);
300# endif 379# endif
301#elif defined GNULIB_POSIXCHECK 380#elif defined GNULIB_POSIXCHECK
@@ -305,6 +384,36 @@ _GL_WARN_ON_USE (freelocale, "freelocale is not portable");
305# endif 384# endif
306#endif 385#endif
307 386
387#if @GNULIB_GETLOCALENAME_L@
388# if @REPLACE_GETLOCALENAME_L@
389# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
390# undef getlocalename_l
391# define getlocalename_l rpl_getlocalename_l
392# endif
393_GL_FUNCDECL_RPL (getlocalename_l, const char *,
394 (int category, locale_t locale),
395 _GL_ARG_NONNULL ((2)));
396_GL_CXXALIAS_RPL (getlocalename_l, const char *,
397 (int category, locale_t locale));
398# else
399# if !@HAVE_GETLOCALENAME_L@
400_GL_FUNCDECL_SYS (getlocalename_l, const char *,
401 (int category, locale_t locale),
402 _GL_ARG_NONNULL ((2)));
403# endif
404_GL_CXXALIAS_SYS (getlocalename_l, const char *,
405 (int category, locale_t locale));
406# endif
407# if __GLIBC__ >= 2
408_GL_CXXALIASWARN (getlocalename_l);
409# endif
410#elif defined GNULIB_POSIXCHECK
411# undef getlocalename_l
412# if HAVE_RAW_DECL_GETLOCALENAME_L
413_GL_WARN_ON_USE (getlocalename_l, "getlocalename_l is not portable");
414# endif
415#endif
416
308#endif /* _@GUARD_PREFIX@_LOCALE_H */ 417#endif /* _@GUARD_PREFIX@_LOCALE_H */
309#endif /* _@GUARD_PREFIX@_LOCALE_H */ 418#endif /* _@GUARD_PREFIX@_LOCALE_H */
310#endif /* !(__need_locale_t || _GL_ALREADY_INCLUDING_LOCALE_H) */ 419#endif /* !(__need_locale_t || _@GUARD_PREFIX@_ALREADY_INCLUDING_LOCALE_H) */
diff --git a/gl/localeconv.c b/gl/localeconv.c
index 10fc7b74..a6bbdced 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-2025 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..41708787 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-2025 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..bb4a59f1
--- /dev/null
+++ b/gl/lstat.c
@@ -0,0 +1,104 @@
1/* Work around a bug of lstat on some systems
2
3 Copyright (C) 1997-2006, 2008-2025 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# ifdef __osf__
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
54# include "stat-time.h"
55
56# include <string.h>
57# include <errno.h>
58
59/* lstat works differently on Linux and Solaris systems. POSIX (see
60 "pathname resolution" in the glossary) requires that programs like
61 'ls' take into consideration the fact that FILE has a trailing slash
62 when FILE is a symbolic link. On Linux and Solaris 10 systems, the
63 lstat function already has the desired semantics (in treating
64 'lstat ("symlink/", sbuf)' just like 'lstat ("symlink/.", sbuf)',
65 but on Solaris 9 and earlier it does not.
66
67 If FILE has a trailing slash and specifies a symbolic link,
68 then use stat() to get more info on the referent of FILE.
69 If the referent is a non-directory, then set errno to ENOTDIR
70 and return -1. Otherwise, return stat's result. */
71
72int
73rpl_lstat (const char *file, struct stat *sbuf)
74{
75 int result = orig_lstat (file, sbuf);
76
77 /* This replacement file can blindly check against '/' rather than
78 using the ISSLASH macro, because all platforms with '\\' either
79 lack symlinks (mingw) or have working lstat (cygwin) and thus do
80 not compile this file. 0 len should have already been filtered
81 out above, with a failure return of ENOENT. */
82 if (result == 0)
83 {
84 if (S_ISDIR (sbuf->st_mode) || file[strlen (file) - 1] != '/')
85 result = stat_time_normalize (result, sbuf);
86 else
87 {
88 /* At this point, a trailing slash is permitted only on
89 symlink-to-dir; but it should have found information on the
90 directory, not the symlink. Call 'stat' to get info about the
91 link's referent. Our replacement stat guarantees valid results,
92 even if the symlink is not pointing to a directory. */
93 if (!S_ISLNK (sbuf->st_mode))
94 {
95 errno = ENOTDIR;
96 return -1;
97 }
98 result = stat (file, sbuf);
99 }
100 }
101 return result;
102}
103
104#endif /* HAVE_LSTAT */
diff --git a/gl/m4/00gnulib.m4 b/gl/m4/00gnulib.m4
index cd167718..2b205b35 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-2025 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..d1b8257b 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-2025 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..5501b07b 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-2025 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..38575b6d 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-2025 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..68fc6211 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-2025 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..5dae6f72 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-2025 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..e77524ca 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 5
3dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2011-2025 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,6 +50,10 @@ 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 59 dnl #undef __ASSERT_H__ so that on IRIX, when programs later include
@@ -55,7 +61,18 @@ AC_DEFUN([gl_ASSERT_H],
55 dnl Break the #undef_s apart with a comment so that 'configure' does 61 dnl Break the #undef_s apart with a comment so that 'configure' does
56 dnl not comment them out. 62 dnl not comment them out.
57 AH_VERBATIM([zzstatic_assert], 63 AH_VERBATIM([zzstatic_assert],
58[#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \ 64[#if (!(defined __clang__ \
65 ? (defined __cplusplus \
66 ? __cplusplus >= 201703L \
67 : __STDC_VERSION__ >= 202000L && __clang_major__ >= 16 \
68 && !defined __sun) \
69 : (defined __GNUC__ \
70 ? (defined __cplusplus \
71 ? __cplusplus >= 201103L && __GNUG__ >= 6 \
72 : __STDC_VERSION__ >= 202000L && __GNUC__ >= 13 \
73 && !defined __sun) \
74 : defined HAVE_C_STATIC_ASSERT)) \
75 && !defined assert \
59 && (!defined __cplusplus \ 76 && (!defined __cplusplus \
60 || (__cpp_static_assert < 201411 \ 77 || (__cpp_static_assert < 201411 \
61 && __GNUG__ < 6 && __clang_major__ < 6))) 78 && __GNUG__ < 6 && __clang_major__ < 6)))
@@ -65,8 +82,9 @@ AC_DEFUN([gl_ASSERT_H],
65 #undef/**/__ASSERT_H__ 82 #undef/**/__ASSERT_H__
66 #endif 83 #endif
67 /* Solaris 11.4 <assert.h> defines static_assert as a macro with 2 arguments. 84 /* 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. */ 85 We need it also to be invocable with a single argument.
69 #if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus 86 Haiku 2022 <assert.h> does not define static_assert at all. */
87 #if (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus
70 #undef/**/static_assert 88 #undef/**/static_assert
71 #define static_assert _Static_assert 89 #define static_assert _Static_assert
72 #endif 90 #endif
diff --git a/gl/m4/base64.m4 b/gl/m4/base64.m4
index 26f2af41..785d31c0 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-2025 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..59d52be6 100644
--- a/gl/m4/btowc.m4
+++ b/gl/m4/btowc.m4
@@ -1,13 +1,15 @@
1# btowc.m4 1# btowc.m4
2# serial 14 2# serial 15
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2025 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
@@ -133,6 +135,13 @@ int main ()
133 ]) 135 ])
134 ]) 136 ])
135 137
138 if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then
139 dnl On mingw/ucrt, we override the return type of btowc().
140 dnl While the original wint_t (= unsigned short) and the overridden wint_t
141 dnl (= unsigned int) are equivalent in function parameters, this is not
142 dnl the case for function return types.
143 REPLACE_BTOWC=1
144 fi
136 case "$gl_cv_func_btowc_nul" in 145 case "$gl_cv_func_btowc_nul" in
137 *yes) ;; 146 *yes) ;;
138 *) REPLACE_BTOWC=1 ;; 147 *) 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..01bff8f3
--- /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-2025 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..76d32867 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-2025 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..b53cb4d0 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-2025 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..8fa8bfc8 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-2025 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..ce26a31e
--- /dev/null
+++ b/gl/m4/c32rtomb.m4
@@ -0,0 +1,187 @@
1# c32rtomb.m4
2# serial 8
3dnl Copyright (C) 2020-2025 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..ac7d08d4 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-2025 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..314e321e 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-2025 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..6bed9dee 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-2025 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..5c40b73c 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-2025 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..5da3a0b9 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-2025 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..e0690e54 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-2025 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..420d5bb3 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 18
3dnl Copyright (C) 2004, 2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2004, 2006, 2008-2025 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])
diff --git a/gl/m4/error.m4 b/gl/m4/error.m4
index 273b636b..1572250a 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-2025 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..4ef5cbff 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-2025 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..08e93397 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-2025 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..08b703b4
--- /dev/null
+++ b/gl/m4/extensions-aix.m4
@@ -0,0 +1,26 @@
1# extensions-aix.m4
2# serial 1
3dnl Copyright (C) 2024-2025 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..76516bce 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-2025 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..d4fe6d82 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 1
3dnl Copyright 2012-2024 Free Software Foundation, Inc. 3dnl Copyright 2012-2025 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
diff --git a/gl/m4/fclose.m4 b/gl/m4/fclose.m4
index 0c1358ed..cfb92e28 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-2025 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..8020c481 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-2025 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..08ab936f 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-2025 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..1c9f9cce 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 20
3dnl Copyright (C) 2006-2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006-2007, 2009-2025 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
diff --git a/gl/m4/fflush.m4 b/gl/m4/fflush.m4
index 43fc3bf3..399065b6 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-2025 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..8580c9c9 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 15
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2025 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[
@@ -54,6 +55,31 @@ 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 float maxf = FLT_NORM_MAX;
67 double maxd = DBL_NORM_MAX;
68 long double maxl = LDBL_NORM_MAX;
69 ]],
70 [[float sf = FLT_SNAN;
71 double sd = DBL_SNAN;
72 long double sl = LDBL_SNAN;
73 return (sf != 0) + (sd != 0) + (sl != 0);
74 ]])],
75 [gl_cv_header_float_h_isoc23=yes],
76 [gl_cv_header_float_h_isoc23=no])
77 ])
78 if test $gl_cv_header_float_h_isoc23 != yes; then
79 GL_GENERATE_FLOAT_H=true
80 REPLACE_FLOAT_SNAN=1
81 fi
82
57 dnl Test against glibc-2.7 Linux/SPARC64 bug. 83 dnl Test against glibc-2.7 Linux/SPARC64 bug.
58 REPLACE_ITOLD=0 84 REPLACE_ITOLD=0
59 AC_CACHE_CHECK([whether conversion from 'int' to 'long double' works], 85 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..cb75fce9 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-2025 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..e27b3270 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-2025 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..408a2579 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-2025 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..373d2bff 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-2025 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..485d8243 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-2025 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
diff --git a/gl/m4/fseek.m4 b/gl/m4/fseek.m4
index fb220a1f..ce728f60 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-2025 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..c093d399 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-2025 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..3a94c288
--- /dev/null
+++ b/gl/m4/fseterr.m4
@@ -0,0 +1,15 @@
1# fseterr.m4
2# serial 2
3dnl Copyright (C) 2012-2025 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..e89bbc32 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-2025 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..4407b765 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-2025 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..bb7b6e43 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 35
3dnl Copyright (C) 1997-1998, 2000-2001, 2003-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 1997-1998, 2000-2001, 2003-2025 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
diff --git a/gl/m4/ftell.m4 b/gl/m4/ftell.m4
index ab10736b..d5610b70 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-2025 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..35d30f98 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-2025 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..2931d526 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 38
3dnl Copyright (C) 2004-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2004-2025 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,46 @@ 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_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 struct addrinfo hints;
111 struct addrinfo *ai;
112 memset (&hints, 0, sizeof (hints));
113 hints.ai_flags = AI_NUMERICSERV;
114 return getaddrinfo ("www.gnu.org", "http", &hints, &ai) != EAI_NONAME;
115 ]])
116 ],
117 [gl_cv_func_getaddrinfo_works=yes],
118 [gl_cv_func_getaddrinfo_works=no],
119 [case "$host_os" in
120 # Guess no on native Windows.
121 mingw* | windows*) gl_cv_func_getaddrinfo_works="guessing no" ;;
122 # Guess yes otherwise.
123 *) gl_cv_func_getaddrinfo_works="guessing yes" ;;
124 esac
125 ])
126 ])
127 case "$gl_cv_func_getaddrinfo_works" in
128 *yes) ;;
129 *) REPLACE_GETADDRINFO=1 ;;
130 esac
131 fi
90 AC_DEFINE_UNQUOTED([HAVE_GETADDRINFO], [$HAVE_GETADDRINFO], 132 AC_DEFINE_UNQUOTED([HAVE_GETADDRINFO], [$HAVE_GETADDRINFO],
91 [Define to 1 if getaddrinfo exists, or to 0 otherwise.]) 133 [Define to 1 if getaddrinfo exists, or to 0 otherwise.])
92 134
diff --git a/gl/m4/getdelim.m4 b/gl/m4/getdelim.m4
index 61139039..63d88306 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 19
3 3
4dnl Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc. 4dnl Copyright (C) 2005-2007, 2009-2025 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
diff --git a/gl/m4/getdtablesize.m4 b/gl/m4/getdtablesize.m4
index aaefe9b2..112c1c4d 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-2025 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..be71ff78 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-2025 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..b97b8011 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 33
3 3
4dnl Copyright (C) 1998-2003, 2005-2007, 2009-2024 Free Software Foundation, 4dnl Copyright (C) 1998-2003, 2005-2007, 2009-2025 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
diff --git a/gl/m4/getloadavg.m4 b/gl/m4/getloadavg.m4
index 0918bcd2..8ab613db 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 13
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-2025 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
diff --git a/gl/m4/getopt.m4 b/gl/m4/getopt.m4
index 297722ea..cb344c15 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 50
3dnl Copyright (C) 2002-2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2006, 2008-2025 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
@@ -366,14 +367,7 @@ dnl is ambiguous with environment values that contain newlines.
366 367
367AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], 368AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
368[ 369[
369 AC_CHECK_HEADERS_ONCE([sys/cdefs.h]) 370 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_]], 371 AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
378 [Define to rpl_ if the getopt replacement functions and variables 372 [Define to rpl_ if the getopt replacement functions and variables
379 should be used.]) 373 should be used.])
diff --git a/gl/m4/getprogname.m4 b/gl/m4/getprogname.m4
index b24f4480..90f34c74 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 8
3dnl Copyright (C) 2016-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2016-2025 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
diff --git a/gl/m4/gl-openssl.m4 b/gl/m4/gl-openssl.m4
index c5e1f7ba..3cfea50f 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 7
3dnl Copyright (C) 2013-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2013-2025 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[
diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4
index fcf84226..6a6e8593 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-2025 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..034dae69 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 113
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2025 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/bugzilla/show_bug.cgi?id=108796>, 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,18 +413,23 @@ 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 calls to the function and to omit
206 This attribute is safe for a function that neither depends on nor affects 418 calls to the function if another call has the same arguments or the
207 observable state, and always returns exactly once - e.g., does not loop 419 result is not used.
208 forever, and does not call longjmp. 420 This attribute is safe for a function that neither depends on
209 (This attribute is stricter than _GL_ATTRIBUTE_PURE.) */ 421 nor affects state, and always returns exactly once -
422 e.g., does not raise an exception, call longjmp, or loop forever.
423 (This attribute is stricter than _GL_ATTRIBUTE_PURE because the
424 function cannot observe state. It is stricter than
425 _GL_ATTRIBUTE_UNSEQUENCED because the function must return exactly
426 once and cannot depend on state addressed by its arguments.) */
210/* Applies to: functions. */ 427/* Applies to: functions. */
211#ifndef _GL_ATTRIBUTE_CONST 428#ifndef _GL_ATTRIBUTE_CONST
212# if _GL_HAS_ATTRIBUTE (const) 429# if _GL_HAS_ATTRIBUTE (const)
213# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) 430# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
214# else 431# else
215# define _GL_ATTRIBUTE_CONST 432# define _GL_ATTRIBUTE_CONST _GL_ATTRIBUTE_UNSEQUENCED
216# endif 433# endif
217#endif 434#endif
218 435
@@ -460,6 +677,17 @@ AC_DEFUN([gl_COMMON_BODY], [
460# endif 677# endif
461#endif 678#endif
462 679
680/* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP
681 (a pointer) must not be NULL if the argument NI (an integer) is != 0. */
682/* Applies to: functions. */
683#ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO
684# if _GL_HAS_ATTRIBUTE (nonnull_if_nonzero)
685# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) __attribute__ ((__nonnull_if_nonzero__ (np, ni)))
686# else
687# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni)
688# endif
689#endif
690
463/* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is 691/* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is
464 not meant to be NUL-terminated. */ 692 not meant to be NUL-terminated. */
465/* Applies to: struct/union members and variables that are arrays of element 693/* Applies to: struct/union members and variables that are arrays of element
@@ -481,7 +709,7 @@ AC_DEFUN([gl_COMMON_BODY], [
481 other attributes. */ 709 other attributes. */
482#ifndef _GL_ATTRIBUTE_NOTHROW 710#ifndef _GL_ATTRIBUTE_NOTHROW
483# if defined __cplusplus 711# if defined __cplusplus
484# if _GL_GNUC_PREREQ (2, 8) || __clang_major >= 4 712# if _GL_GNUC_PREREQ (2, 8) || __clang_major__ >= 4
485# if __cplusplus >= 201103L 713# if __cplusplus >= 201103L
486# define _GL_ATTRIBUTE_NOTHROW noexcept (true) 714# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
487# else 715# else
@@ -505,9 +733,9 @@ AC_DEFUN([gl_COMMON_BODY], [
505 minimizing the memory required. */ 733 minimizing the memory required. */
506/* Applies to: struct members, struct, union, 734/* Applies to: struct members, struct, union,
507 in C++ also: class. */ 735 in C++ also: class. */
736#ifndef _GL_ATTRIBUTE_PACKED
508/* Oracle Studio 12.6 miscompiles code with __attribute__ ((__packed__)) despite 737/* Oracle Studio 12.6 miscompiles code with __attribute__ ((__packed__)) despite
509 __has_attribute OK. */ 738 __has_attribute OK. */
510#ifndef _GL_ATTRIBUTE_PACKED
511# if _GL_HAS_ATTRIBUTE (packed) && !defined __SUNPRO_C 739# if _GL_HAS_ATTRIBUTE (packed) && !defined __SUNPRO_C
512# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) 740# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__))
513# else 741# else
@@ -515,18 +743,51 @@ AC_DEFUN([gl_COMMON_BODY], [
515# endif 743# endif
516#endif 744#endif
517 745
518/* _GL_ATTRIBUTE_PURE declares that It is OK for a compiler to omit duplicate 746/* _GL_ATTRIBUTE_PURE declares:
519 calls to the function with the same arguments if observable state is not 747 It is OK for a compiler to move calls to the function and to omit
520 changed between calls. 748 calls to the function if another call has the same arguments or the
521 This attribute is safe for a function that does not affect 749 result is not used, and if observable state is the same.
522 observable state, and always returns exactly once. 750 This attribute is safe for a function that does not affect observable state
523 (This attribute is looser than _GL_ATTRIBUTE_CONST.) */ 751 and always returns exactly once.
752 (This attribute is looser than _GL_ATTRIBUTE_CONST because the function
753 can depend on observable state. It is stricter than
754 _GL_ATTRIBUTE_REPRODUCIBLE because the function must return exactly
755 once and cannot affect state addressed by its arguments.) */
524/* Applies to: functions. */ 756/* Applies to: functions. */
525#ifndef _GL_ATTRIBUTE_PURE 757#ifndef _GL_ATTRIBUTE_PURE
526# if _GL_HAS_ATTRIBUTE (pure) 758# if _GL_HAS_ATTRIBUTE (pure)
527# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) 759# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
528# else 760# else
529# define _GL_ATTRIBUTE_PURE 761# define _GL_ATTRIBUTE_PURE _GL_ATTRIBUTE_REPRODUCIBLE
762# endif
763#endif
764
765/* _GL_ATTRIBUTE_REPRODUCIBLE declares:
766 It is OK for a compiler to move calls to the function and to omit duplicate
767 calls to the function with the same arguments, so long as the state
768 addressed by its arguments is the same and is updated in time for
769 the rest of the program.
770 This attribute is safe for a function that is effectless and idempotent; see
771 ISO C 23 § 6.7.12.7 for a definition of these terms.
772 (This attribute is looser than _GL_ATTRIBUTE_UNSEQUENCED because
773 the function need not be stateless and idempotent. It is looser
774 than _GL_ATTRIBUTE_PURE because the function need not return
775 exactly once and can affect state addressed by its arguments.)
776 See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
777 <https://stackoverflow.com/questions/76847905/>.
778 ATTENTION! Efforts are underway to change the meaning of this attribute.
779 See <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3424.htm>. */
780/* Applies to: functions, pointer to functions, function types. */
781#ifndef _GL_ATTRIBUTE_REPRODUCIBLE
782/* This may be revisited when gcc and clang support [[reproducible]] or possibly
783 __attribute__ ((__reproducible__)). */
784# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
785# if _GL_HAS_ATTRIBUTE (reproducible)
786# define _GL_ATTRIBUTE_REPRODUCIBLE [[reproducible]]
787# endif
788# endif
789# ifndef _GL_ATTRIBUTE_REPRODUCIBLE
790# define _GL_ATTRIBUTE_REPRODUCIBLE
530# endif 791# endif
531#endif 792#endif
532 793
@@ -554,6 +815,35 @@ AC_DEFUN([gl_COMMON_BODY], [
554# endif 815# endif
555#endif 816#endif
556 817
818/* _GL_ATTRIBUTE_UNSEQUENCED declares:
819 It is OK for a compiler to move calls to the function and to omit duplicate
820 calls to the function with the same arguments, so long as the state
821 addressed by its arguments is the same.
822 This attribute is safe for a function that is effectless, idempotent,
823 stateless, and independent; see ISO C 23 § 6.7.12.7 for a definition of
824 these terms.
825 (This attribute is stricter than _GL_ATTRIBUTE_REPRODUCIBLE because
826 the function must be stateless and independent. It is looser than
827 _GL_ATTRIBUTE_CONST because the function need not return exactly
828 once and can depend on state addressed by its arguments.)
829 See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
830 <https://stackoverflow.com/questions/76847905/>.
831 ATTENTION! Efforts are underway to change the meaning of this attribute.
832 See <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3424.htm>. */
833/* Applies to: functions, pointer to functions, function types. */
834#ifndef _GL_ATTRIBUTE_UNSEQUENCED
835/* This may be revisited when gcc and clang support [[unsequenced]] or possibly
836 __attribute__ ((__unsequenced__)). */
837# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
838# if _GL_HAS_ATTRIBUTE (unsequenced)
839# define _GL_ATTRIBUTE_UNSEQUENCED [[unsequenced]]
840# endif
841# endif
842# ifndef _GL_ATTRIBUTE_UNSEQUENCED
843# define _GL_ATTRIBUTE_UNSEQUENCED
844# endif
845#endif
846
557/* A helper macro. Don't use it directly. */ 847/* A helper macro. Don't use it directly. */
558#ifndef _GL_ATTRIBUTE_UNUSED 848#ifndef _GL_ATTRIBUTE_UNUSED
559# if _GL_HAS_ATTRIBUTE (unused) 849# if _GL_HAS_ATTRIBUTE (unused)
@@ -578,6 +868,35 @@ AC_DEFUN([gl_COMMON_BODY], [
578# define _GL_UNUSED_LABEL 868# define _GL_UNUSED_LABEL
579# endif 869# endif
580#endif 870#endif
871
872/* The following attributes enable detection of multithread-safety problems
873 and resource leaks at compile-time, by clang ≥ 15, when the warning option
874 -Wthread-safety is enabled. For usage, see
875 <https://clang.llvm.org/docs/ThreadSafetyAnalysis.html>. */
876#ifndef _GL_ATTRIBUTE_CAPABILITY_TYPE
877# if __clang_major__ >= 15
878# define _GL_ATTRIBUTE_CAPABILITY_TYPE(concept) \
879 __attribute__ ((__capability__ (concept)))
880# else
881# define _GL_ATTRIBUTE_CAPABILITY_TYPE(concept)
882# endif
883#endif
884#ifndef _GL_ATTRIBUTE_ACQUIRE_CAPABILITY
885# if __clang_major__ >= 15
886# define _GL_ATTRIBUTE_ACQUIRE_CAPABILITY(resource) \
887 __attribute__ ((__acquire_capability__ (resource)))
888# else
889# define _GL_ATTRIBUTE_ACQUIRE_CAPABILITY(resource)
890# endif
891#endif
892#ifndef _GL_ATTRIBUTE_RELEASE_CAPABILITY
893# if __clang_major__ >= 15
894# define _GL_ATTRIBUTE_RELEASE_CAPABILITY(resource) \
895 __attribute__ ((__release_capability__ (resource)))
896# else
897# define _GL_ATTRIBUTE_RELEASE_CAPABILITY(resource)
898# endif
899#endif
581]) 900])
582 AH_VERBATIM([c_linkage], 901 AH_VERBATIM([c_linkage],
583[/* In C++, there is the concept of "language linkage", that encompasses 902[/* In C++, there is the concept of "language linkage", that encompasses
@@ -628,8 +947,8 @@ AC_DEFUN([gl_COMMON_BODY], [
628 -1 if n1 < n2 947 -1 if n1 < n2
629 The naïve code (n1 > n2 ? 1 : n1 < n2 ? -1 : 0) produces a conditional 948 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. 949 jump with nearly all GCC versions up to GCC 10.
631 This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional with many 950 This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional jump with
632 GCC versions up to GCC 9. 951 many GCC versions up to GCC 9.
633 The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9 952 The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9
634 avoids conditional jumps in all GCC versions >= 3.4. */ 953 avoids conditional jumps in all GCC versions >= 3.4. */
635#define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2))) 954#define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2)))
@@ -1006,7 +1325,7 @@ AC_DEFUN([gl_CC_ALLOW_WARNINGS],
1006 AC_REQUIRE([AC_PROG_CC]) 1325 AC_REQUIRE([AC_PROG_CC])
1007 AC_CACHE_CHECK([for C compiler option to allow warnings], 1326 AC_CACHE_CHECK([for C compiler option to allow warnings],
1008 [gl_cv_cc_wallow], 1327 [gl_cv_cc_wallow],
1009 [rm -f conftest* 1328 [rm -fr conftest*
1010 echo 'int dummy;' > conftest.c 1329 echo 'int dummy;' > conftest.c
1011 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null 1330 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 1331 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Wno-error -c conftest.c 2>conftest2.err]) >/dev/null
@@ -1019,7 +1338,7 @@ AC_DEFUN([gl_CC_ALLOW_WARNINGS],
1019 else 1338 else
1020 gl_cv_cc_wallow=none 1339 gl_cv_cc_wallow=none
1021 fi 1340 fi
1022 rm -f conftest* 1341 rm -fr conftest*
1023 ]) 1342 ])
1024 case "$gl_cv_cc_wallow" in 1343 case "$gl_cv_cc_wallow" in
1025 none) GL_CFLAG_ALLOW_WARNINGS='' ;; 1344 none) GL_CFLAG_ALLOW_WARNINGS='' ;;
@@ -1037,7 +1356,7 @@ AC_DEFUN([gl_CXX_ALLOW_WARNINGS],
1037 if test -n "$CXX" && test "$CXX" != no; then 1356 if test -n "$CXX" && test "$CXX" != no; then
1038 AC_CACHE_CHECK([for C++ compiler option to allow warnings], 1357 AC_CACHE_CHECK([for C++ compiler option to allow warnings],
1039 [gl_cv_cxx_wallow], 1358 [gl_cv_cxx_wallow],
1040 [rm -f conftest* 1359 [rm -fr conftest*
1041 echo 'int dummy;' > conftest.cc 1360 echo 'int dummy;' > conftest.cc
1042 AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null 1361 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 1362 AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -Wno-error -c conftest.cc 2>conftest2.err]) >/dev/null
@@ -1050,7 +1369,7 @@ AC_DEFUN([gl_CXX_ALLOW_WARNINGS],
1050 else 1369 else
1051 gl_cv_cxx_wallow=none 1370 gl_cv_cxx_wallow=none
1052 fi 1371 fi
1053 rm -f conftest* 1372 rm -fr conftest*
1054 ]) 1373 ])
1055 case "$gl_cv_cxx_wallow" in 1374 case "$gl_cv_cxx_wallow" in
1056 none) GL_CXXFLAG_ALLOW_WARNINGS='' ;; 1375 none) GL_CXXFLAG_ALLOW_WARNINGS='' ;;
@@ -1087,11 +1406,12 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
1087 dnl -Wno-type-limits >= 4.3 >= 3.9 1406 dnl -Wno-type-limits >= 4.3 >= 3.9
1088 dnl -Wno-undef >= 3 >= 3.9 1407 dnl -Wno-undef >= 3 >= 3.9
1089 dnl -Wno-unsuffixed-float-constants >= 4.5 1408 dnl -Wno-unsuffixed-float-constants >= 4.5
1409 dnl -Wno-unused-const-variable >= 4.4 >= 3.9
1090 dnl -Wno-unused-function >= 3 >= 3.9 1410 dnl -Wno-unused-function >= 3 >= 3.9
1091 dnl -Wno-unused-parameter >= 3 >= 3.9 1411 dnl -Wno-unused-parameter >= 3 >= 3.9
1092 dnl 1412 dnl
1093 cat > conftest.c <<\EOF 1413 cat > conftest.c <<\EOF
1094 #if __GNUC__ >= 3 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1414 #if (__GNUC__ >= 3 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1095 -Wno-cast-qual 1415 -Wno-cast-qual
1096 -Wno-conversion 1416 -Wno-conversion
1097 -Wno-float-equal 1417 -Wno-float-equal
@@ -1100,23 +1420,26 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
1100 -Wno-unused-function 1420 -Wno-unused-function
1101 -Wno-unused-parameter 1421 -Wno-unused-parameter
1102 #endif 1422 #endif
1103 #if __GNUC__ + (__GNUC_MINOR__ >= 9) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1423 #if (__GNUC__ + (__GNUC_MINOR__ >= 9) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1104 -Wno-float-conversion 1424 -Wno-float-conversion
1105 #endif 1425 #endif
1106 #if __GNUC__ >= 7 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1426 #if (__GNUC__ >= 7 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1107 -Wimplicit-fallthrough 1427 -Wimplicit-fallthrough
1108 #endif 1428 #endif
1109 #if __GNUC__ + (__GNUC_MINOR__ >= 8) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1429 #if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1110 -Wno-pedantic 1430 -Wno-pedantic
1111 #endif 1431 #endif
1112 #if 3 < __clang_major__ + (9 <= __clang_minor__) 1432 #if 3 < __clang_major__ + (9 <= __clang_minor__)
1113 -Wno-tautological-constant-out-of-range-compare 1433 -Wno-tautological-constant-out-of-range-compare
1114 #endif 1434 #endif
1115 #if __GNUC__ + (__GNUC_MINOR__ >= 3) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1435 #if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1116 -Wno-sign-conversion 1436 -Wno-sign-conversion
1117 -Wno-type-limits 1437 -Wno-type-limits
1118 #endif 1438 #endif
1119 #if __GNUC__ + (__GNUC_MINOR__ >= 5) > 4 1439 #if (__GNUC__ + (__GNUC_MINOR__ >= 4) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1440 -Wno-unused-const-variable
1441 #endif
1442 #if (__GNUC__ + (__GNUC_MINOR__ >= 5) > 4 && !defined __clang__)
1120 -Wno-unsuffixed-float-constants 1443 -Wno-unsuffixed-float-constants
1121 #endif 1444 #endif
1122EOF 1445EOF
@@ -1240,13 +1563,25 @@ AC_DEFUN([gl_CHECK_FUNCS_CASE_FOR_MACOS],
1240 if test $[ac_cv_func_][$1] = yes; then 1563 if test $[ac_cv_func_][$1] = yes; then
1241 [gl_cv_onwards_func_][$1]=yes 1564 [gl_cv_onwards_func_][$1]=yes
1242 else 1565 else
1566 dnl This is a bit complicated, because here we need the behaviour
1567 dnl of AC_CHECK_DECL before the
1568 dnl commit e1bbc9b93cdff61d70719c224b37970e065008bb (2025-05-26).
1569 [ac_cv_have_decl_][$1][_saved]="$[ac_cv_have_decl_][$1]"
1243 unset [ac_cv_have_decl_][$1] 1570 unset [ac_cv_have_decl_][$1]
1571 ac_c_future_darwin_options_saved="$ac_c_future_darwin_options"
1572 ac_cxx_future_darwin_options_saved="$ac_cxx_future_darwin_options"
1573 ac_c_future_darwin_options=
1574 ac_cxx_future_darwin_options=
1244 AC_CHECK_DECL([$1], , , [$2]) 1575 AC_CHECK_DECL([$1], , , [$2])
1576 ac_c_future_darwin_options="$ac_c_future_darwin_options_saved"
1577 ac_cxx_future_darwin_options="$ac_cxx_future_darwin_options_saved"
1245 if test $[ac_cv_have_decl_][$1] = yes; then 1578 if test $[ac_cv_have_decl_][$1] = yes; then
1246 [gl_cv_onwards_func_][$1]='future OS version' 1579 [gl_cv_onwards_func_][$1]='future OS version'
1247 else 1580 else
1248 [gl_cv_onwards_func_][$1]=no 1581 [gl_cv_onwards_func_][$1]=no
1249 fi 1582 fi
1583 [ac_cv_have_decl_][$1]="$[ac_cv_have_decl_][$1][_saved]"
1584 unset [ac_cv_have_decl_][$1][_saved]
1250 fi 1585 fi
1251 else 1586 else
1252 AC_CHECK_FUNC([$1]) 1587 AC_CHECK_FUNC([$1])
@@ -1299,7 +1634,7 @@ dnl
1299dnl This macro sets two variables: 1634dnl This macro sets two variables:
1300dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version" 1635dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version"
1301dnl - ac_cv_func_<func> to yes / no / no 1636dnl - ac_cv_func_<func> to yes / no / no
1302dnl The first variable allows to distinguish all three cases. 1637dnl The first variable allows distinguishing all three cases.
1303dnl The second variable is set, so that an invocation 1638dnl The second variable is set, so that an invocation
1304dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]]) 1639dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]])
1305dnl can be used as a drop-in replacement for 1640dnl can be used as a drop-in replacement for
@@ -1352,7 +1687,7 @@ dnl
1352dnl This macro sets two variables: 1687dnl This macro sets two variables:
1353dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version" 1688dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version"
1354dnl - ac_cv_func_<func> to yes / no / no 1689dnl - ac_cv_func_<func> to yes / no / no
1355dnl The first variable allows to distinguish all three cases. 1690dnl The first variable allows distinguishing all three cases.
1356dnl The second variable is set, so that an invocation 1691dnl The second variable is set, so that an invocation
1357dnl gl_CHECK_FUNCS_MACOS([func], [[#include <foo.h>]]) 1692dnl gl_CHECK_FUNCS_MACOS([func], [[#include <foo.h>]])
1358dnl can be used as a drop-in replacement for 1693dnl 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..50e98454 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-2025 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,56 @@ 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 stdlib-h:
182 # Code from module strcase: 213 # Code from module strcase:
214 # Code from module strcasecmp:
183 # Code from module strcasestr: 215 # Code from module strcasestr:
184 # Code from module strcasestr-simple: 216 # Code from module strcasestr-simple:
185 # Code from module streq: 217 # Code from module streq:
186 # Code from module strerror: 218 # Code from module strerror:
187 # Code from module strerror-override: 219 # Code from module strerror-override:
188 # Code from module string: 220 # Code from module string-h:
189 # Code from module strings: 221 # Code from module strings-h:
222 # Code from module strncasecmp:
223 # Code from module strncpy:
190 # Code from module strsep: 224 # Code from module strsep:
191 # Code from module strstr-simple: 225 # Code from module strstr-simple:
192 # Code from module sys_socket: 226 # Code from module sys_socket-h:
193 # Code from module sys_stat: 227 # Code from module sys_stat-h:
194 # Code from module sys_types: 228 # Code from module sys_types-h:
195 # Code from module sys_uio: 229 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
230 # Code from module sys_uio-h:
196 # Code from module threadlib: 231 # Code from module threadlib:
197 gl_THREADLIB_EARLY 232 gl_THREADLIB_EARLY
198 # Code from module time-h: 233 # Code from module time-h:
199 # Code from module time_r: 234 # Code from module time_r:
200 # Code from module timegm: 235 # Code from module timegm:
201 # Code from module unistd: 236 # Code from module uchar-h:
237 # Code from module unicase/base:
238 # Code from module unicase/tolower:
239 # Code from module unictype/base:
240 # Code from module unictype/ctype-alnum:
241 # Code from module unictype/ctype-alpha:
242 # Code from module unictype/ctype-blank:
243 # Code from module unictype/ctype-cntrl:
244 # Code from module unictype/ctype-digit:
245 # Code from module unictype/ctype-graph:
246 # Code from module unictype/ctype-lower:
247 # Code from module unictype/ctype-print:
248 # Code from module unictype/ctype-punct:
249 # Code from module unictype/ctype-space:
250 # Code from module unictype/ctype-upper:
251 # Code from module unictype/ctype-xdigit:
252 # Code from module uninorm/base:
253 # Code from module unistd-h:
254 # Code from module unitypes-h:
255 # Code from module uniwidth/base:
256 # Code from module uniwidth/width:
202 # Code from module unlocked-io-internal: 257 # Code from module unlocked-io-internal:
203 # Code from module unsetenv: 258 # Code from module unsetenv:
204 # Code from module vararrays: 259 # Code from module vararrays:
@@ -206,10 +261,12 @@ AC_DEFUN([gl_EARLY],
206 # Code from module vasprintf: 261 # Code from module vasprintf:
207 # Code from module verify: 262 # Code from module verify:
208 # Code from module vsnprintf: 263 # Code from module vsnprintf:
209 # Code from module wchar: 264 # Code from module vsnzprintf:
265 # Code from module wchar-h:
210 # Code from module wcrtomb: 266 # Code from module wcrtomb:
211 # Code from module wctype: 267 # Code from module wctype:
212 # Code from module wctype-h: 268 # Code from module wctype-h:
269 # Code from module wcwidth:
213 # Code from module windows-mutex: 270 # Code from module windows-mutex:
214 # Code from module windows-once: 271 # Code from module windows-once:
215 # Code from module windows-recmutex: 272 # Code from module windows-recmutex:
@@ -250,6 +307,7 @@ AC_DEFUN([gl_INIT],
250 gl_CONDITIONAL_HEADER([assert.h]) 307 gl_CONDITIONAL_HEADER([assert.h])
251 AC_PROG_MKDIR_P 308 AC_PROG_MKDIR_P
252 gl_FUNC_BASE64 309 gl_FUNC_BASE64
310 gl_C_BOOL
253 gl_FUNC_BTOWC 311 gl_FUNC_BTOWC
254 gl_CONDITIONAL([GL_COND_OBJ_BTOWC], 312 gl_CONDITIONAL([GL_COND_OBJ_BTOWC],
255 [test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1]) 313 [test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1])
@@ -261,6 +319,104 @@ AC_DEFUN([gl_INIT],
261 gl_BYTESWAP 319 gl_BYTESWAP
262 gl_CONDITIONAL_HEADER([byteswap.h]) 320 gl_CONDITIONAL_HEADER([byteswap.h])
263 AC_PROG_MKDIR_P 321 AC_PROG_MKDIR_P
322 AC_REQUIRE([gl_UCHAR_H])
323 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
324 dnl determined. It describes how mbrtoc32 is implemented.
325 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
326 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
327 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
328 gl_UCHAR_MODULE_INDICATOR([c32isalnum])
329 AC_REQUIRE([gl_UCHAR_H])
330 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
331 dnl determined. It describes how mbrtoc32 is implemented.
332 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
333 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
334 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
335 gl_UCHAR_MODULE_INDICATOR([c32isalpha])
336 AC_REQUIRE([gl_UCHAR_H])
337 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
338 dnl determined. It describes how mbrtoc32 is implemented.
339 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
340 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
341 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
342 gl_UCHAR_MODULE_INDICATOR([c32isblank])
343 AC_REQUIRE([gl_UCHAR_H])
344 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
345 dnl determined. It describes how mbrtoc32 is implemented.
346 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
347 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
348 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
349 gl_UCHAR_MODULE_INDICATOR([c32iscntrl])
350 AC_REQUIRE([gl_UCHAR_H])
351 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
352 dnl determined. It describes how mbrtoc32 is implemented.
353 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
354 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
355 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
356 gl_UCHAR_MODULE_INDICATOR([c32isdigit])
357 AC_REQUIRE([gl_UCHAR_H])
358 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
359 dnl determined. It describes how mbrtoc32 is implemented.
360 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
361 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
362 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
363 gl_UCHAR_MODULE_INDICATOR([c32isgraph])
364 AC_REQUIRE([gl_UCHAR_H])
365 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
366 dnl determined. It describes how mbrtoc32 is implemented.
367 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
368 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
369 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
370 gl_UCHAR_MODULE_INDICATOR([c32islower])
371 AC_REQUIRE([gl_UCHAR_H])
372 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
373 dnl determined. It describes how mbrtoc32 is implemented.
374 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
375 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
376 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
377 gl_UCHAR_MODULE_INDICATOR([c32isprint])
378 AC_REQUIRE([gl_UCHAR_H])
379 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
380 dnl determined. It describes how mbrtoc32 is implemented.
381 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
382 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
383 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
384 gl_UCHAR_MODULE_INDICATOR([c32ispunct])
385 AC_REQUIRE([gl_UCHAR_H])
386 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
387 dnl determined. It describes how mbrtoc32 is implemented.
388 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
389 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
390 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
391 gl_UCHAR_MODULE_INDICATOR([c32isspace])
392 AC_REQUIRE([gl_UCHAR_H])
393 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
394 dnl determined. It describes how mbrtoc32 is implemented.
395 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
396 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
397 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
398 gl_UCHAR_MODULE_INDICATOR([c32isupper])
399 AC_REQUIRE([gl_UCHAR_H])
400 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
401 dnl determined. It describes how mbrtoc32 is implemented.
402 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
403 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
404 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
405 gl_UCHAR_MODULE_INDICATOR([c32isxdigit])
406 AC_REQUIRE([gl_UCHAR_H])
407 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
408 dnl determined. It describes how mbrtoc32 is implemented.
409 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
410 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
411 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
412 gl_UCHAR_MODULE_INDICATOR([c32tolower])
413 AC_REQUIRE([gl_UCHAR_H])
414 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
415 dnl determined. It describes how mbrtoc32 is implemented.
416 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
417 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
418 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
419 gl_UCHAR_MODULE_INDICATOR([c32width])
264 gl_FUNC_CALLOC_GNU 420 gl_FUNC_CALLOC_GNU
265 if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 1; then 421 if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 1; then
266 AC_LIBOBJ([calloc]) 422 AC_LIBOBJ([calloc])
@@ -275,6 +431,7 @@ AC_DEFUN([gl_INIT],
275 gl_FUNC_CLOSE 431 gl_FUNC_CLOSE
276 gl_CONDITIONAL([GL_COND_OBJ_CLOSE], [test $REPLACE_CLOSE = 1]) 432 gl_CONDITIONAL([GL_COND_OBJ_CLOSE], [test $REPLACE_CLOSE = 1])
277 gl_UNISTD_MODULE_INDICATOR([close]) 433 gl_UNISTD_MODULE_INDICATOR([close])
434 gl_MODULE_INDICATOR([close])
278 gl_AF_ALG 435 gl_AF_ALG
279 AC_REQUIRE([AC_C_RESTRICT]) 436 AC_REQUIRE([AC_C_RESTRICT])
280 gl_SHA256 437 gl_SHA256
@@ -320,8 +477,11 @@ AC_DEFUN([gl_INIT],
320 gl_FLOAT_H 477 gl_FLOAT_H
321 gl_CONDITIONAL_HEADER([float.h]) 478 gl_CONDITIONAL_HEADER([float.h])
322 AC_PROG_MKDIR_P 479 AC_PROG_MKDIR_P
323 gl_CONDITIONAL([GL_COND_OBJ_FLOAT], [test $REPLACE_FLOAT_LDBL = 1]) 480 gl_CONDITIONAL([GL_COND_OBJ_FLOAT],
481 [test $REPLACE_FLOAT_LDBL = 1 || test $REPLACE_FLOAT_SNAN = 1])
324 gl_CONDITIONAL([GL_COND_OBJ_ITOLD], [test $REPLACE_ITOLD = 1]) 482 gl_CONDITIONAL([GL_COND_OBJ_ITOLD], [test $REPLACE_ITOLD = 1])
483 dnl Prerequisites of lib/float.c.
484 AC_REQUIRE([gl_BIGENDIAN])
325 gl_FUNC_FLOORF 485 gl_FUNC_FLOORF
326 gl_CONDITIONAL([GL_COND_OBJ_FLOORF], 486 gl_CONDITIONAL([GL_COND_OBJ_FLOORF],
327 [test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1]) 487 [test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1])
@@ -360,6 +520,8 @@ AC_DEFUN([gl_INIT],
360 gl_PREREQ_FSEEKO 520 gl_PREREQ_FSEEKO
361 ]) 521 ])
362 gl_STDIO_MODULE_INDICATOR([fseeko]) 522 gl_STDIO_MODULE_INDICATOR([fseeko])
523 gl_FUNC_FSETERR
524 gl_CONDITIONAL([GL_COND_OBJ_FSETERR], [test $ac_cv_func___fseterr = no])
363 gl_FUNC_FSTAT 525 gl_FUNC_FSTAT
364 gl_CONDITIONAL([GL_COND_OBJ_FSTAT], [test $REPLACE_FSTAT = 1]) 526 gl_CONDITIONAL([GL_COND_OBJ_FSTAT], [test $REPLACE_FSTAT = 1])
365 AM_COND_IF([GL_COND_OBJ_FSTAT], [ 527 AM_COND_IF([GL_COND_OBJ_FSTAT], [
@@ -371,6 +533,7 @@ AC_DEFUN([gl_INIT],
371 gl_PREREQ_FSTAT 533 gl_PREREQ_FSTAT
372 ]) 534 ])
373 gl_SYS_STAT_MODULE_INDICATOR([fstat]) 535 gl_SYS_STAT_MODULE_INDICATOR([fstat])
536 gl_MODULE_INDICATOR([fstat])
374 gl_FSUSAGE 537 gl_FSUSAGE
375 gl_CONDITIONAL([GL_COND_OBJ_FSUSAGE], [test $gl_cv_fs_space = yes]) 538 gl_CONDITIONAL([GL_COND_OBJ_FSUSAGE], [test $gl_cv_fs_space = yes])
376 AM_COND_IF([GL_COND_OBJ_FSUSAGE], [ 539 AM_COND_IF([GL_COND_OBJ_FSUSAGE], [
@@ -412,6 +575,7 @@ AC_DEFUN([gl_INIT],
412 gl_PREREQ_GETHOSTNAME 575 gl_PREREQ_GETHOSTNAME
413 ]) 576 ])
414 gl_UNISTD_MODULE_INDICATOR([gethostname]) 577 gl_UNISTD_MODULE_INDICATOR([gethostname])
578 gl_MODULE_INDICATOR([gethostname])
415 gl_FUNC_GETLINE 579 gl_FUNC_GETLINE
416 gl_CONDITIONAL([GL_COND_OBJ_GETLINE], [test $REPLACE_GETLINE = 1]) 580 gl_CONDITIONAL([GL_COND_OBJ_GETLINE], [test $REPLACE_GETLINE = 1])
417 AM_COND_IF([GL_COND_OBJ_GETLINE], [ 581 AM_COND_IF([GL_COND_OBJ_GETLINE], [
@@ -441,6 +605,8 @@ AC_DEFUN([gl_INIT],
441 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT], [1]) 605 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT], [1])
442 ]) 606 ])
443 gl_UNISTD_MODULE_INDICATOR([getopt-posix]) 607 gl_UNISTD_MODULE_INDICATOR([getopt-posix])
608 gl_MUSL_LIBC
609 AC_REQUIRE([AC_CANONICAL_HOST])
444 gl_FUNC_GETPROGNAME 610 gl_FUNC_GETPROGNAME
445 gl_CONDITIONAL([GL_COND_OBJ_GETPROGNAME], 611 gl_CONDITIONAL([GL_COND_OBJ_GETPROGNAME],
446 [test $HAVE_GETPROGNAME = 0 || test $REPLACE_GETPROGNAME = 1]) 612 [test $HAVE_GETPROGNAME = 0 || test $REPLACE_GETPROGNAME = 1])
@@ -451,6 +617,7 @@ AC_DEFUN([gl_INIT],
451 AC_SUBST([LIBINTL]) 617 AC_SUBST([LIBINTL])
452 AC_SUBST([LTLIBINTL]) 618 AC_SUBST([LTLIBINTL])
453 AC_PROG_MKDIR_P 619 AC_PROG_MKDIR_P
620 GNULIB_I18N
454 AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) 621 AC_REQUIRE([gl_FUNC_SETLOCALE_NULL])
455 HARD_LOCALE_LIB="$SETLOCALE_NULL_LIB" 622 HARD_LOCALE_LIB="$SETLOCALE_NULL_LIB"
456 AC_SUBST([HARD_LOCALE_LIB]) 623 AC_SUBST([HARD_LOCALE_LIB])
@@ -466,6 +633,13 @@ AC_DEFUN([gl_INIT],
466 gl_PREREQ_INET_NTOP 633 gl_PREREQ_INET_NTOP
467 ]) 634 ])
468 gl_ARPA_INET_MODULE_INDICATOR([inet_ntop]) 635 gl_ARPA_INET_MODULE_INDICATOR([inet_ntop])
636 gl_FUNC_INET_PTON
637 gl_CONDITIONAL([GL_COND_OBJ_INET_PTON],
638 [test $HAVE_INET_PTON = 0 || test $REPLACE_INET_PTON = 1])
639 AM_COND_IF([GL_COND_OBJ_INET_PTON], [
640 gl_PREREQ_INET_PTON
641 ])
642 gl_ARPA_INET_MODULE_INDICATOR([inet_pton])
469 gl_INTTYPES_INCOMPLETE 643 gl_INTTYPES_INCOMPLETE
470 gl_INTTYPES_H_REQUIRE_DEFAULTS 644 gl_INTTYPES_H_REQUIRE_DEFAULTS
471 AC_PROG_MKDIR_P 645 AC_PROG_MKDIR_P
@@ -510,11 +684,19 @@ AC_DEFUN([gl_INIT],
510 gl_PREREQ_LOCALECONV 684 gl_PREREQ_LOCALECONV
511 ]) 685 ])
512 gl_LOCALE_MODULE_INDICATOR([localeconv]) 686 gl_LOCALE_MODULE_INDICATOR([localeconv])
687 gl_MODULE_INDICATOR([localeconv])
513 gl_LOCK 688 gl_LOCK
514 gl_MODULE_INDICATOR([lock]) 689 gl_MODULE_INDICATOR([lock])
515 gl_FUNC_LSEEK 690 gl_FUNC_LSEEK
516 gl_CONDITIONAL([GL_COND_OBJ_LSEEK], [test $REPLACE_LSEEK = 1]) 691 gl_CONDITIONAL([GL_COND_OBJ_LSEEK], [test $REPLACE_LSEEK = 1])
517 gl_UNISTD_MODULE_INDICATOR([lseek]) 692 gl_UNISTD_MODULE_INDICATOR([lseek])
693 gl_FUNC_LSTAT
694 gl_CONDITIONAL([GL_COND_OBJ_LSTAT], [test $REPLACE_LSTAT = 1])
695 AM_COND_IF([GL_COND_OBJ_LSTAT], [
696 gl_PREREQ_LSTAT
697 ])
698 gl_SYS_STAT_MODULE_INDICATOR([lstat])
699 gl_MODULE_INDICATOR([lstat])
518 gl_FUNC_MALLOC_GNU 700 gl_FUNC_MALLOC_GNU
519 if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 1; then 701 if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 1; then
520 AC_LIBOBJ([malloc]) 702 AC_LIBOBJ([malloc])
@@ -529,6 +711,20 @@ AC_DEFUN([gl_INIT],
529 gl_MATH_H 711 gl_MATH_H
530 gl_MATH_H_REQUIRE_DEFAULTS 712 gl_MATH_H_REQUIRE_DEFAULTS
531 AC_PROG_MKDIR_P 713 AC_PROG_MKDIR_P
714 gl_MBCHAR
715 gl_MBITER
716 gl_FUNC_MBRTOC32
717 gl_CONDITIONAL([GL_COND_OBJ_MBRTOC32],
718 [test $HAVE_MBRTOC32 = 0 || test $REPLACE_MBRTOC32 = 1])
719 AM_COND_IF([GL_COND_OBJ_MBRTOC32], [
720 if test $REPLACE_MBSTATE_T = 1; then
721 AC_LIBOBJ([lc-charset-dispatch])
722 AC_LIBOBJ([mbtowc-lock])
723 gl_PREREQ_MBTOWC_LOCK
724 fi
725 gl_PREREQ_MBRTOC32
726 ])
727 gl_UCHAR_MODULE_INDICATOR([mbrtoc32])
532 gl_FUNC_MBRTOWC 728 gl_FUNC_MBRTOWC
533 gl_CONDITIONAL([GL_COND_OBJ_MBRTOWC], 729 gl_CONDITIONAL([GL_COND_OBJ_MBRTOWC],
534 [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]) 730 [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1])
@@ -548,6 +744,7 @@ AC_DEFUN([gl_INIT],
548 gl_PREREQ_MBSINIT 744 gl_PREREQ_MBSINIT
549 ]) 745 ])
550 gl_WCHAR_MODULE_INDICATOR([mbsinit]) 746 gl_WCHAR_MODULE_INDICATOR([mbsinit])
747 gl_STRING_MODULE_INDICATOR([mbsnlen])
551 AC_REQUIRE([AC_TYPE_MBSTATE_T]) 748 AC_REQUIRE([AC_TYPE_MBSTATE_T])
552 gl_MBSTATE_T_BROKEN 749 gl_MBSTATE_T_BROKEN
553 gl_MUSL_LIBC 750 gl_MUSL_LIBC
@@ -578,10 +775,7 @@ AC_DEFUN([gl_INIT],
578 gl_PREREQ_MKTIME 775 gl_PREREQ_MKTIME
579 fi 776 fi
580 gl_MOUNTLIST 777 gl_MOUNTLIST
581 gl_CONDITIONAL([GL_COND_OBJ_MOUNTLIST], [test $gl_cv_list_mounted_fs = yes]) 778 gl_PREREQ_MOUNTLIST_EXTRA
582 AM_COND_IF([GL_COND_OBJ_MOUNTLIST], [
583 gl_PREREQ_MOUNTLIST_EXTRA
584 ])
585 AC_REQUIRE([gl_MSVC_INVAL]) 779 AC_REQUIRE([gl_MSVC_INVAL])
586 gl_CONDITIONAL([GL_COND_OBJ_MSVC_INVAL], 780 gl_CONDITIONAL([GL_COND_OBJ_MSVC_INVAL],
587 [test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1]) 781 [test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1])
@@ -605,6 +799,7 @@ AC_DEFUN([gl_INIT],
605 gl_PREREQ_NL_LANGINFO_LOCK 799 gl_PREREQ_NL_LANGINFO_LOCK
606 fi 800 fi
607 gl_LANGINFO_MODULE_INDICATOR([nl_langinfo]) 801 gl_LANGINFO_MODULE_INDICATOR([nl_langinfo])
802 gl_ONCE
608 gl_FUNC_OPEN 803 gl_FUNC_OPEN
609 gl_CONDITIONAL([GL_COND_OBJ_OPEN], [test $REPLACE_OPEN = 1]) 804 gl_CONDITIONAL([GL_COND_OBJ_OPEN], [test $REPLACE_OPEN = 1])
610 AM_COND_IF([GL_COND_OBJ_OPEN], [ 805 AM_COND_IF([GL_COND_OBJ_OPEN], [
@@ -612,15 +807,17 @@ AC_DEFUN([gl_INIT],
612 ]) 807 ])
613 gl_FCNTL_MODULE_INDICATOR([open]) 808 gl_FCNTL_MODULE_INDICATOR([open])
614 gl_PATHMAX 809 gl_PATHMAX
615 gl_FUNC_REALLOC_GNU 810 gl_PTHREAD_H
616 if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 1; then 811 gl_PTHREAD_H_REQUIRE_DEFAULTS
617 AC_LIBOBJ([realloc]) 812 AC_PROG_MKDIR_P
618 fi 813 gl_PTHREAD_ONCE
619 gl_STDLIB_MODULE_INDICATOR([realloc-gnu]) 814 gl_CONDITIONAL([GL_COND_OBJ_PTHREAD_ONCE],
815 [test $HAVE_PTHREAD_ONCE = 0 || test $REPLACE_PTHREAD_ONCE = 1])
816 gl_PTHREAD_MODULE_INDICATOR([pthread-once])
620 gl_FUNC_REALLOC_POSIX 817 gl_FUNC_REALLOC_POSIX
621 if test $REPLACE_REALLOC_FOR_REALLOC_POSIX = 1; then 818 gl_FUNC_REALLOC_0_NONNULL
622 AC_LIBOBJ([realloc]) 819 gl_CONDITIONAL([GL_COND_OBJ_REALLOC_POSIX],
623 fi 820 [test $REPLACE_REALLOC_FOR_REALLOC_POSIX != 0])
624 gl_STDLIB_MODULE_INDICATOR([realloc-posix]) 821 gl_STDLIB_MODULE_INDICATOR([realloc-posix])
625 gl_FUNC_REALLOCARRAY 822 gl_FUNC_REALLOCARRAY
626 gl_CONDITIONAL([GL_COND_OBJ_REALLOCARRAY], 823 gl_CONDITIONAL([GL_COND_OBJ_REALLOCARRAY],
@@ -635,6 +832,9 @@ AC_DEFUN([gl_INIT],
635 AM_COND_IF([GL_COND_OBJ_REGEX], [ 832 AM_COND_IF([GL_COND_OBJ_REGEX], [
636 gl_PREREQ_REGEX 833 gl_PREREQ_REGEX
637 ]) 834 ])
835 gl_SCHED_H
836 gl_SCHED_H_REQUIRE_DEFAULTS
837 AC_PROG_MKDIR_P
638 gl_SERVENT 838 gl_SERVENT
639 gl_FUNC_SETENV 839 gl_FUNC_SETENV
640 gl_CONDITIONAL([GL_COND_OBJ_SETENV], 840 gl_CONDITIONAL([GL_COND_OBJ_SETENV],
@@ -666,15 +866,10 @@ AC_DEFUN([gl_INIT],
666 gl_PREREQ_STAT 866 gl_PREREQ_STAT
667 ]) 867 ])
668 gl_SYS_STAT_MODULE_INDICATOR([stat]) 868 gl_SYS_STAT_MODULE_INDICATOR([stat])
869 gl_MODULE_INDICATOR([stat])
669 gl_STAT_TIME 870 gl_STAT_TIME
670 gl_STAT_BIRTHTIME 871 gl_STAT_BIRTHTIME
671 gl_C_BOOL 872 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]) 873 gl_CONDITIONAL_HEADER([stdckdint.h])
679 AC_PROG_MKDIR_P 874 AC_PROG_MKDIR_P
680 gl_STDDEF_H 875 gl_STDDEF_H
@@ -689,6 +884,19 @@ AC_DEFUN([gl_INIT],
689 gl_STDIO_H 884 gl_STDIO_H
690 gl_STDIO_H_REQUIRE_DEFAULTS 885 gl_STDIO_H_REQUIRE_DEFAULTS
691 AC_PROG_MKDIR_P 886 AC_PROG_MKDIR_P
887 USES_MSVCRT=0
888 case "$host_os" in
889 mingw* | windows*)
890 AC_EGREP_CPP([Special], [
891 #ifndef _UCRT
892 Special
893 #endif
894 ],
895 [USES_MSVCRT=1])
896 ;;
897 esac
898 gl_CONDITIONAL([GL_COND_OBJ_STDIO_CONSOLESAFE], [test $USES_MSVCRT = 1])
899 AC_CHECK_FUNCS([vasprintf])
692 gl_CONDITIONAL([GL_COND_OBJ_STDIO_READ], [test $REPLACE_STDIO_READ_FUNCS = 1]) 900 gl_CONDITIONAL([GL_COND_OBJ_STDIO_READ], [test $REPLACE_STDIO_READ_FUNCS = 1])
693 gl_CONDITIONAL([GL_COND_OBJ_STDIO_WRITE], [test $REPLACE_STDIO_WRITE_FUNCS = 1]) 901 gl_CONDITIONAL([GL_COND_OBJ_STDIO_WRITE], [test $REPLACE_STDIO_WRITE_FUNCS = 1])
694 dnl No need to create extra modules for these functions. Everyone who uses 902 dnl No need to create extra modules for these functions. Everyone who uses
@@ -717,15 +925,13 @@ AC_DEFUN([gl_INIT],
717 gl_STDLIB_H 925 gl_STDLIB_H
718 gl_STDLIB_H_REQUIRE_DEFAULTS 926 gl_STDLIB_H_REQUIRE_DEFAULTS
719 AC_PROG_MKDIR_P 927 AC_PROG_MKDIR_P
720 gl_STRCASE 928 gl_FUNC_STRCASECMP
721 gl_CONDITIONAL([GL_COND_OBJ_STRCASECMP], [test $HAVE_STRCASECMP = 0]) 929 gl_CONDITIONAL([GL_COND_OBJ_STRCASECMP],
930 [test $HAVE_STRCASECMP = 0 || test $REPLACE_STRCASECMP = 1])
722 AM_COND_IF([GL_COND_OBJ_STRCASECMP], [ 931 AM_COND_IF([GL_COND_OBJ_STRCASECMP], [
723 gl_PREREQ_STRCASECMP 932 gl_PREREQ_STRCASECMP
724 ]) 933 ])
725 gl_CONDITIONAL([GL_COND_OBJ_STRNCASECMP], [test $HAVE_STRNCASECMP = 0]) 934 gl_STRINGS_MODULE_INDICATOR([strcasecmp])
726 AM_COND_IF([GL_COND_OBJ_STRNCASECMP], [
727 gl_PREREQ_STRNCASECMP
728 ])
729 gl_FUNC_STRCASESTR 935 gl_FUNC_STRCASESTR
730 if test $HAVE_STRCASESTR = 0 || test $REPLACE_STRCASESTR = 1; then 936 if test $HAVE_STRCASESTR = 0 || test $REPLACE_STRCASESTR = 1; then
731 AC_LIBOBJ([strcasestr]) 937 AC_LIBOBJ([strcasestr])
@@ -754,6 +960,19 @@ AC_DEFUN([gl_INIT],
754 gl_STRINGS_H 960 gl_STRINGS_H
755 gl_STRINGS_H_REQUIRE_DEFAULTS 961 gl_STRINGS_H_REQUIRE_DEFAULTS
756 AC_PROG_MKDIR_P 962 AC_PROG_MKDIR_P
963 gl_FUNC_STRNCASECMP
964 gl_CONDITIONAL([GL_COND_OBJ_STRNCASECMP],
965 [test $HAVE_STRNCASECMP = 0 || test $REPLACE_STRNCASECMP = 1])
966 AM_COND_IF([GL_COND_OBJ_STRNCASECMP], [
967 gl_PREREQ_STRNCASECMP
968 ])
969 gl_STRINGS_MODULE_INDICATOR([strncasecmp])
970 gl_FUNC_STRNCPY
971 gl_CONDITIONAL([GL_COND_OBJ_STRNCPY], [test $REPLACE_STRNCPY = 1])
972 AM_COND_IF([GL_COND_OBJ_STRNCPY], [
973 gl_PREREQ_STRNCPY
974 ])
975 gl_STRING_MODULE_INDICATOR([strncpy])
757 gl_FUNC_STRSEP 976 gl_FUNC_STRSEP
758 gl_CONDITIONAL([GL_COND_OBJ_STRSEP], [test $HAVE_STRSEP = 0]) 977 gl_CONDITIONAL([GL_COND_OBJ_STRSEP], [test $HAVE_STRSEP = 0])
759 AM_COND_IF([GL_COND_OBJ_STRSEP], [ 978 AM_COND_IF([GL_COND_OBJ_STRSEP], [
@@ -795,9 +1014,55 @@ AC_DEFUN([gl_INIT],
795 gl_PREREQ_TIMEGM 1014 gl_PREREQ_TIMEGM
796 ]) 1015 ])
797 gl_TIME_MODULE_INDICATOR([timegm]) 1016 gl_TIME_MODULE_INDICATOR([timegm])
1017 gl_UCHAR_H
1018 gl_UCHAR_H_REQUIRE_DEFAULTS
1019 AC_PROG_MKDIR_P
1020 gl_LIBUNISTRING_LIBHEADER([1.2], [unicase.h])
1021 gl_UNICASE_H
1022 gl_UNICASE_H_REQUIRE_DEFAULTS
1023 AC_PROG_MKDIR_P
1024 gl_LIBUNISTRING_MODULE([1.3], [unicase/tolower])
1025 gl_LIBUNISTRING_LIBHEADER([1.3], [unictype.h])
1026 gl_UNICTYPE_H
1027 gl_UNICTYPE_H_REQUIRE_DEFAULTS
1028 AC_PROG_MKDIR_P
1029 AC_REQUIRE([AC_C_INLINE])
1030 gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-alnum])
1031 AC_REQUIRE([AC_C_INLINE])
1032 gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-alpha])
1033 AC_REQUIRE([AC_C_INLINE])
1034 gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-blank])
1035 AC_REQUIRE([AC_C_INLINE])
1036 gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-cntrl])
1037 AC_REQUIRE([AC_C_INLINE])
1038 gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-digit])
1039 AC_REQUIRE([AC_C_INLINE])
1040 gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-graph])
1041 AC_REQUIRE([AC_C_INLINE])
1042 gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-lower])
1043 AC_REQUIRE([AC_C_INLINE])
1044 gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-print])
1045 AC_REQUIRE([AC_C_INLINE])
1046 gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-punct])
1047 AC_REQUIRE([AC_C_INLINE])
1048 gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-space])
1049 AC_REQUIRE([AC_C_INLINE])
1050 gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-upper])
1051 AC_REQUIRE([AC_C_INLINE])
1052 gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-xdigit])
1053 gl_LIBUNISTRING_LIBHEADER([1.2], [uninorm.h])
1054 gl_UNINORM_H
1055 gl_UNINORM_H_REQUIRE_DEFAULTS
1056 AC_PROG_MKDIR_P
798 gl_UNISTD_H 1057 gl_UNISTD_H
799 gl_UNISTD_H_REQUIRE_DEFAULTS 1058 gl_UNISTD_H_REQUIRE_DEFAULTS
800 AC_PROG_MKDIR_P 1059 AC_PROG_MKDIR_P
1060 gl_LIBUNISTRING_LIBHEADER([0.9.11], [unitypes.h])
1061 AC_PROG_MKDIR_P
1062 gl_UNITYPES_H
1063 gl_LIBUNISTRING_LIBHEADER([0.9.11], [uniwidth.h])
1064 AC_PROG_MKDIR_P
1065 gl_LIBUNISTRING_MODULE([1.3], [uniwidth/width])
801 gl_FUNC_GLIBC_UNLOCKED_IO 1066 gl_FUNC_GLIBC_UNLOCKED_IO
802 gl_FUNC_UNSETENV 1067 gl_FUNC_UNSETENV
803 gl_CONDITIONAL([GL_COND_OBJ_UNSETENV], 1068 gl_CONDITIONAL([GL_COND_OBJ_UNSETENV],
@@ -816,6 +1081,7 @@ AC_DEFUN([gl_INIT],
816 AM_][XGETTEXT_OPTION([--flag=vasprintf:2:c-format])]) 1081 AM_][XGETTEXT_OPTION([--flag=vasprintf:2:c-format])])
817 gl_FUNC_VSNPRINTF 1082 gl_FUNC_VSNPRINTF
818 gl_STDIO_MODULE_INDICATOR([vsnprintf]) 1083 gl_STDIO_MODULE_INDICATOR([vsnprintf])
1084 gl_STDIO_MODULE_INDICATOR([vsnzprintf])
819 gl_WCHAR_H 1085 gl_WCHAR_H
820 gl_WCHAR_H_REQUIRE_DEFAULTS 1086 gl_WCHAR_H_REQUIRE_DEFAULTS
821 AC_PROG_MKDIR_P 1087 AC_PROG_MKDIR_P
@@ -832,6 +1098,13 @@ AC_DEFUN([gl_INIT],
832 gl_WCTYPE_H 1098 gl_WCTYPE_H
833 gl_WCTYPE_H_REQUIRE_DEFAULTS 1099 gl_WCTYPE_H_REQUIRE_DEFAULTS
834 AC_PROG_MKDIR_P 1100 AC_PROG_MKDIR_P
1101 gl_FUNC_WCWIDTH
1102 gl_CONDITIONAL([GL_COND_OBJ_WCWIDTH],
1103 [test $HAVE_WCWIDTH = 0 || test $REPLACE_WCWIDTH = 1])
1104 AM_COND_IF([GL_COND_OBJ_WCWIDTH], [
1105 gl_PREREQ_WCWIDTH
1106 ])
1107 gl_WCHAR_MODULE_INDICATOR([wcwidth])
835 AC_REQUIRE([AC_CANONICAL_HOST]) 1108 AC_REQUIRE([AC_CANONICAL_HOST])
836 gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_MUTEX], 1109 gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_MUTEX],
837 [case "$host_os" in mingw* | windows*) true;; *) false;; esac]) 1110 [case "$host_os" in mingw* | windows*) true;; *) false;; esac])
@@ -871,27 +1144,35 @@ AC_DEFUN([gl_INIT],
871 gl_libobjs= 1144 gl_libobjs=
872 gl_ltlibobjs= 1145 gl_ltlibobjs=
873 gl_libobjdeps= 1146 gl_libobjdeps=
1147 gl_libgnu_libobjs=
1148 gl_libgnu_ltlibobjs=
1149 gl_libgnu_libobjdeps=
874 if test -n "$gl_LIBOBJS"; then 1150 if test -n "$gl_LIBOBJS"; then
875 # Remove the extension. 1151 # Remove the extension.
876changequote(,)dnl 1152changequote(,)dnl
877 sed_drop_objext='s/\.o$//;s/\.obj$//' 1153 sed_drop_objext='s/\.o$//;s/\.obj$//'
878 sed_dirname1='s,//*,/,g' 1154 sed_dirname1='s,//*,/,g'
879 sed_dirname2='s,\(.\)/$,\1,' 1155 sed_dirname2='s,\(.\)/$,\1,'
880 sed_dirname3='s,^[^/]*$,.,' 1156 sed_dirname3='s,[^/]*$,,'
881 sed_dirname4='s,\(.\)/[^/]*$,\1,'
882 sed_basename1='s,.*/,,' 1157 sed_basename1='s,.*/,,'
883changequote([, ])dnl 1158changequote([, ])dnl
884 for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do 1159 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" 1160 gl_libobjs="$gl_libobjs $i.$ac_objext"
886 gl_ltlibobjs="$gl_ltlibobjs $i.lo" 1161 gl_ltlibobjs="$gl_ltlibobjs $i.lo"
887 i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3" -e "$sed_dirname4"` 1162 i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3"`
888 i_base=`echo "$i" | sed -e "$sed_basename1"` 1163 i_base=`echo "$i" | sed -e "$sed_basename1"`
889 gl_libobjdeps="$gl_libobjdeps $i_dir/\$(DEPDIR)/$i_base.Po" 1164 gl_libgnu_libobjs="$gl_libgnu_libobjs $i_dir""libgnu_a-$i_base.$ac_objext"
1165 gl_libgnu_ltlibobjs="$gl_libgnu_ltlibobjs $i_dir""libgnu_la-$i_base.lo"
1166 gl_libobjdeps="$gl_libobjdeps $i_dir\$(DEPDIR)/$i_base.Po"
1167 gl_libgnu_libobjdeps="$gl_libgnu_libobjdeps $i_dir\$(DEPDIR)/libgnu_a-$i_base.Po"
890 done 1168 done
891 fi 1169 fi
892 AC_SUBST([gl_LIBOBJS], [$gl_libobjs]) 1170 AC_SUBST([gl_LIBOBJS], [$gl_libobjs])
893 AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs]) 1171 AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs])
894 AC_SUBST([gl_LIBOBJDEPS], [$gl_libobjdeps]) 1172 AC_SUBST([gl_LIBOBJDEPS], [$gl_libobjdeps])
1173 AC_SUBST([gl_libgnu_LIBOBJS], [$gl_libgnu_libobjs])
1174 AC_SUBST([gl_libgnu_LTLIBOBJS], [$gl_libgnu_ltlibobjs])
1175 AC_SUBST([gl_libgnu_LIBOBJDEPS], [$gl_libgnu_libobjdeps])
895 ]) 1176 ])
896 gltests_libdeps= 1177 gltests_libdeps=
897 gltests_ltlibdeps= 1178 gltests_ltlibdeps=
@@ -934,27 +1215,35 @@ changequote([, ])dnl
934 gltests_libobjs= 1215 gltests_libobjs=
935 gltests_ltlibobjs= 1216 gltests_ltlibobjs=
936 gltests_libobjdeps= 1217 gltests_libobjdeps=
1218 gltests_libgnu_libobjs=
1219 gltests_libgnu_ltlibobjs=
1220 gltests_libgnu_libobjdeps=
937 if test -n "$gltests_LIBOBJS"; then 1221 if test -n "$gltests_LIBOBJS"; then
938 # Remove the extension. 1222 # Remove the extension.
939changequote(,)dnl 1223changequote(,)dnl
940 sed_drop_objext='s/\.o$//;s/\.obj$//' 1224 sed_drop_objext='s/\.o$//;s/\.obj$//'
941 sed_dirname1='s,//*,/,g' 1225 sed_dirname1='s,//*,/,g'
942 sed_dirname2='s,\(.\)/$,\1,' 1226 sed_dirname2='s,\(.\)/$,\1,'
943 sed_dirname3='s,^[^/]*$,.,' 1227 sed_dirname3='s,[^/]*$,,'
944 sed_dirname4='s,\(.\)/[^/]*$,\1,'
945 sed_basename1='s,.*/,,' 1228 sed_basename1='s,.*/,,'
946changequote([, ])dnl 1229changequote([, ])dnl
947 for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do 1230 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" 1231 gltests_libobjs="$gltests_libobjs $i.$ac_objext"
949 gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" 1232 gltests_ltlibobjs="$gltests_ltlibobjs $i.lo"
950 i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3" -e "$sed_dirname4"` 1233 i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3"`
951 i_base=`echo "$i" | sed -e "$sed_basename1"` 1234 i_base=`echo "$i" | sed -e "$sed_basename1"`
952 gltests_libobjdeps="$gltests_libobjdeps $i_dir/\$(DEPDIR)/$i_base.Po" 1235 gltests_libgnu_libobjs="$gltests_libgnu_libobjs $i_dir""libgnu_a-$i_base.$ac_objext"
1236 gltests_libgnu_ltlibobjs="$gltests_libgnu_ltlibobjs $i_dir""libgnu_la-$i_base.lo"
1237 gltests_libobjdeps="$gltests_libobjdeps $i_dir\$(DEPDIR)/$i_base.Po"
1238 gltests_libgnu_libobjdeps="$gltests_libgnu_libobjdeps $i_dir\$(DEPDIR)/libgnu_a-$i_base.Po"
953 done 1239 done
954 fi 1240 fi
955 AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs]) 1241 AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs])
956 AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs]) 1242 AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs])
957 AC_SUBST([gltests_LIBOBJDEPS], [$gltests_libobjdeps]) 1243 AC_SUBST([gltests_LIBOBJDEPS], [$gltests_libobjdeps])
1244 AC_SUBST([gltests_libgnu_LIBOBJS], [$gltests_libgnu_libobjs])
1245 AC_SUBST([gltests_libgnu_LTLIBOBJS], [$gltests_libgnu_ltlibobjs])
1246 AC_SUBST([gltests_libgnu_LIBOBJDEPS], [$gltests_libgnu_libobjdeps])
958 ]) 1247 ])
959 AC_REQUIRE([gl_CC_GNULIB_WARNINGS]) 1248 AC_REQUIRE([gl_CC_GNULIB_WARNINGS])
960 LIBGNU_LIBDEPS="$gl_libdeps" 1249 LIBGNU_LIBDEPS="$gl_libdeps"
@@ -1025,6 +1314,7 @@ AC_DEFUN([gl_FILE_LIST], [
1025 lib/af_alg.h 1314 lib/af_alg.h
1026 lib/alloca.in.h 1315 lib/alloca.in.h
1027 lib/arg-nonnull.h 1316 lib/arg-nonnull.h
1317 lib/arpa_inet.c
1028 lib/arpa_inet.in.h 1318 lib/arpa_inet.in.h
1029 lib/asnprintf.c 1319 lib/asnprintf.c
1030 lib/asprintf.c 1320 lib/asprintf.c
@@ -1036,8 +1326,27 @@ AC_DEFUN([gl_FILE_LIST], [
1036 lib/basename-lgpl.h 1326 lib/basename-lgpl.h
1037 lib/basename.c 1327 lib/basename.c
1038 lib/btowc.c 1328 lib/btowc.c
1329 lib/byteswap.c
1039 lib/byteswap.in.h 1330 lib/byteswap.in.h
1040 lib/c++defs.h 1331 lib/c++defs.h
1332 lib/c-ctype.c
1333 lib/c-ctype.h
1334 lib/c32is-impl.h
1335 lib/c32isalnum.c
1336 lib/c32isalpha.c
1337 lib/c32isblank.c
1338 lib/c32iscntrl.c
1339 lib/c32isdigit.c
1340 lib/c32isgraph.c
1341 lib/c32islower.c
1342 lib/c32isprint.c
1343 lib/c32ispunct.c
1344 lib/c32isspace.c
1345 lib/c32isupper.c
1346 lib/c32isxdigit.c
1347 lib/c32to-impl.h
1348 lib/c32tolower.c
1349 lib/c32width.c
1041 lib/calloc.c 1350 lib/calloc.c
1042 lib/cdefs.h 1351 lib/cdefs.h
1043 lib/cloexec.c 1352 lib/cloexec.c
@@ -1071,6 +1380,8 @@ AC_DEFUN([gl_FILE_LIST], [
1071 lib/free.c 1380 lib/free.c
1072 lib/fseek.c 1381 lib/fseek.c
1073 lib/fseeko.c 1382 lib/fseeko.c
1383 lib/fseterr.c
1384 lib/fseterr.h
1074 lib/fstat.c 1385 lib/fstat.c
1075 lib/fsusage.c 1386 lib/fsusage.c
1076 lib/fsusage.h 1387 lib/fsusage.h
@@ -1098,6 +1409,8 @@ AC_DEFUN([gl_FILE_LIST], [
1098 lib/gl_openssl.h 1409 lib/gl_openssl.h
1099 lib/glthread/lock.c 1410 lib/glthread/lock.c
1100 lib/glthread/lock.h 1411 lib/glthread/lock.h
1412 lib/glthread/once.c
1413 lib/glthread/once.h
1101 lib/glthread/threadlib.c 1414 lib/glthread/threadlib.c
1102 lib/hard-locale.c 1415 lib/hard-locale.c
1103 lib/hard-locale.h 1416 lib/hard-locale.h
@@ -1107,6 +1420,7 @@ AC_DEFUN([gl_FILE_LIST], [
1107 lib/idpriv.h 1420 lib/idpriv.h
1108 lib/idx.h 1421 lib/idx.h
1109 lib/inet_ntop.c 1422 lib/inet_ntop.c
1423 lib/inet_pton.c
1110 lib/intprops-internal.h 1424 lib/intprops-internal.h
1111 lib/intprops.h 1425 lib/intprops.h
1112 lib/inttypes.in.h 1426 lib/inttypes.in.h
@@ -1127,6 +1441,7 @@ AC_DEFUN([gl_FILE_LIST], [
1127 lib/locale.in.h 1441 lib/locale.in.h
1128 lib/localeconv.c 1442 lib/localeconv.c
1129 lib/lseek.c 1443 lib/lseek.c
1444 lib/lstat.c
1130 lib/malloc.c 1445 lib/malloc.c
1131 lib/malloc/dynarray-skeleton.c 1446 lib/malloc/dynarray-skeleton.c
1132 lib/malloc/dynarray.h 1447 lib/malloc/dynarray.h
@@ -1139,10 +1454,16 @@ AC_DEFUN([gl_FILE_LIST], [
1139 lib/malloca.h 1454 lib/malloca.h
1140 lib/math.c 1455 lib/math.c
1141 lib/math.in.h 1456 lib/math.in.h
1457 lib/mbchar.c
1458 lib/mbchar.h
1459 lib/mbiterf.c
1460 lib/mbiterf.h
1461 lib/mbrtoc32.c
1142 lib/mbrtowc-impl-utf8.h 1462 lib/mbrtowc-impl-utf8.h
1143 lib/mbrtowc-impl.h 1463 lib/mbrtowc-impl.h
1144 lib/mbrtowc.c 1464 lib/mbrtowc.c
1145 lib/mbsinit.c 1465 lib/mbsinit.c
1466 lib/mbsnlen.c
1146 lib/mbszero.c 1467 lib/mbszero.c
1147 lib/mbtowc-impl.h 1468 lib/mbtowc-impl.h
1148 lib/mbtowc-lock.c 1469 lib/mbtowc-lock.c
@@ -1169,6 +1490,8 @@ AC_DEFUN([gl_FILE_LIST], [
1169 lib/printf-args.h 1490 lib/printf-args.h
1170 lib/printf-parse.c 1491 lib/printf-parse.c
1171 lib/printf-parse.h 1492 lib/printf-parse.h
1493 lib/pthread-once.c
1494 lib/pthread.in.h
1172 lib/realloc.c 1495 lib/realloc.c
1173 lib/reallocarray.c 1496 lib/reallocarray.c
1174 lib/regcomp.c 1497 lib/regcomp.c
@@ -1177,6 +1500,7 @@ AC_DEFUN([gl_FILE_LIST], [
1177 lib/regex_internal.c 1500 lib/regex_internal.c
1178 lib/regex_internal.h 1501 lib/regex_internal.h
1179 lib/regexec.c 1502 lib/regexec.c
1503 lib/sched.in.h
1180 lib/setenv.c 1504 lib/setenv.c
1181 lib/setlocale-lock.c 1505 lib/setlocale-lock.c
1182 lib/setlocale_null-unlocked.c 1506 lib/setlocale_null-unlocked.c
@@ -1197,10 +1521,12 @@ AC_DEFUN([gl_FILE_LIST], [
1197 lib/stdckdint.in.h 1521 lib/stdckdint.in.h
1198 lib/stddef.in.h 1522 lib/stddef.in.h
1199 lib/stdint.in.h 1523 lib/stdint.in.h
1524 lib/stdio-consolesafe.c
1200 lib/stdio-impl.h 1525 lib/stdio-impl.h
1201 lib/stdio-read.c 1526 lib/stdio-read.c
1202 lib/stdio-write.c 1527 lib/stdio-write.c
1203 lib/stdio.in.h 1528 lib/stdio.in.h
1529 lib/stdlib.c
1204 lib/stdlib.in.h 1530 lib/stdlib.in.h
1205 lib/str-two-way.h 1531 lib/str-two-way.h
1206 lib/strcasecmp.c 1532 lib/strcasecmp.c
@@ -1213,6 +1539,7 @@ AC_DEFUN([gl_FILE_LIST], [
1213 lib/strings.in.h 1539 lib/strings.in.h
1214 lib/stripslash.c 1540 lib/stripslash.c
1215 lib/strncasecmp.c 1541 lib/strncasecmp.c
1542 lib/strncpy.c
1216 lib/strsep.c 1543 lib/strsep.c
1217 lib/strstr.c 1544 lib/strstr.c
1218 lib/sys-limits.h 1545 lib/sys-limits.h
@@ -1224,8 +1551,46 @@ AC_DEFUN([gl_FILE_LIST], [
1224 lib/time.in.h 1551 lib/time.in.h
1225 lib/time_r.c 1552 lib/time_r.c
1226 lib/timegm.c 1553 lib/timegm.c
1554 lib/uchar.in.h
1555 lib/unicase.in.h
1556 lib/unicase/simple-mapping.h
1557 lib/unicase/tolower.c
1558 lib/unicase/tolower.h
1559 lib/unictype.in.h
1560 lib/unictype/bitmap.h
1561 lib/unictype/ctype_alnum.c
1562 lib/unictype/ctype_alnum.h
1563 lib/unictype/ctype_alpha.c
1564 lib/unictype/ctype_alpha.h
1565 lib/unictype/ctype_blank.c
1566 lib/unictype/ctype_blank.h
1567 lib/unictype/ctype_cntrl.c
1568 lib/unictype/ctype_cntrl.h
1569 lib/unictype/ctype_digit.c
1570 lib/unictype/ctype_digit.h
1571 lib/unictype/ctype_graph.c
1572 lib/unictype/ctype_graph.h
1573 lib/unictype/ctype_lower.c
1574 lib/unictype/ctype_lower.h
1575 lib/unictype/ctype_print.c
1576 lib/unictype/ctype_print.h
1577 lib/unictype/ctype_punct.c
1578 lib/unictype/ctype_punct.h
1579 lib/unictype/ctype_space.c
1580 lib/unictype/ctype_space.h
1581 lib/unictype/ctype_upper.c
1582 lib/unictype/ctype_upper.h
1583 lib/unictype/ctype_xdigit.c
1584 lib/unictype/ctype_xdigit.h
1585 lib/uninorm.in.h
1227 lib/unistd.c 1586 lib/unistd.c
1228 lib/unistd.in.h 1587 lib/unistd.in.h
1588 lib/unitypes.in.h
1589 lib/uniwidth.in.h
1590 lib/uniwidth/cjk.h
1591 lib/uniwidth/width.c
1592 lib/uniwidth/width0.h
1593 lib/uniwidth/width2.h
1229 lib/unlocked-io.h 1594 lib/unlocked-io.h
1230 lib/unsetenv.c 1595 lib/unsetenv.c
1231 lib/vasnprintf.c 1596 lib/vasnprintf.c
@@ -1233,6 +1598,7 @@ AC_DEFUN([gl_FILE_LIST], [
1233 lib/vasprintf.c 1598 lib/vasprintf.c
1234 lib/verify.h 1599 lib/verify.h
1235 lib/vsnprintf.c 1600 lib/vsnprintf.c
1601 lib/vsnzprintf.c
1236 lib/w32sock.h 1602 lib/w32sock.h
1237 lib/warn-on-use.h 1603 lib/warn-on-use.h
1238 lib/wchar.in.h 1604 lib/wchar.in.h
@@ -1241,6 +1607,7 @@ AC_DEFUN([gl_FILE_LIST], [
1241 lib/wctype-impl.h 1607 lib/wctype-impl.h
1242 lib/wctype.c 1608 lib/wctype.c
1243 lib/wctype.in.h 1609 lib/wctype.in.h
1610 lib/wcwidth.c
1244 lib/windows-initguard.h 1611 lib/windows-initguard.h
1245 lib/windows-mutex.c 1612 lib/windows-mutex.c
1246 lib/windows-mutex.h 1613 lib/windows-mutex.h
@@ -1265,20 +1632,22 @@ AC_DEFUN([gl_FILE_LIST], [
1265 m4/assert_h.m4 1632 m4/assert_h.m4
1266 m4/base64.m4 1633 m4/base64.m4
1267 m4/btowc.m4 1634 m4/btowc.m4
1635 m4/build-to-host.m4
1268 m4/builtin-expect.m4 1636 m4/builtin-expect.m4
1269 m4/byteswap.m4 1637 m4/byteswap.m4
1270 m4/c-bool.m4 1638 m4/c-bool.m4
1639 m4/c32rtomb.m4
1271 m4/calloc.m4 1640 m4/calloc.m4
1272 m4/close.m4 1641 m4/close.m4
1273 m4/codeset.m4 1642 m4/codeset.m4
1274 m4/double-slash-root.m4 1643 m4/double-slash-root.m4
1275 m4/dup2.m4 1644 m4/dup2.m4
1276 m4/eealloc.m4
1277 m4/environ.m4 1645 m4/environ.m4
1278 m4/errno_h.m4 1646 m4/errno_h.m4
1279 m4/error.m4 1647 m4/error.m4
1280 m4/error_h.m4 1648 m4/error_h.m4
1281 m4/exponentd.m4 1649 m4/exponentd.m4
1650 m4/extensions-aix.m4
1282 m4/extensions.m4 1651 m4/extensions.m4
1283 m4/extern-inline.m4 1652 m4/extern-inline.m4
1284 m4/fclose.m4 1653 m4/fclose.m4
@@ -1294,6 +1663,7 @@ AC_DEFUN([gl_FILE_LIST], [
1294 m4/free.m4 1663 m4/free.m4
1295 m4/fseek.m4 1664 m4/fseek.m4
1296 m4/fseeko.m4 1665 m4/fseeko.m4
1666 m4/fseterr.m4
1297 m4/fstat.m4 1667 m4/fstat.m4
1298 m4/fstypename.m4 1668 m4/fstypename.m4
1299 m4/fsusage.m4 1669 m4/fsusage.m4
@@ -1309,10 +1679,12 @@ AC_DEFUN([gl_FILE_LIST], [
1309 m4/getprogname.m4 1679 m4/getprogname.m4
1310 m4/gl-openssl.m4 1680 m4/gl-openssl.m4
1311 m4/gnulib-common.m4 1681 m4/gnulib-common.m4
1682 m4/gnulib-i18n.m4
1312 m4/hostent.m4 1683 m4/hostent.m4
1313 m4/idpriv.m4 1684 m4/idpriv.m4
1314 m4/include_next.m4 1685 m4/include_next.m4
1315 m4/inet_ntop.m4 1686 m4/inet_ntop.m4
1687 m4/inet_pton.m4
1316 m4/intmax_t.m4 1688 m4/intmax_t.m4
1317 m4/inttypes.m4 1689 m4/inttypes.m4
1318 m4/inttypes_h.m4 1690 m4/inttypes_h.m4
@@ -1323,8 +1695,10 @@ AC_DEFUN([gl_FILE_LIST], [
1323 m4/iswxdigit.m4 1695 m4/iswxdigit.m4
1324 m4/langinfo_h.m4 1696 m4/langinfo_h.m4
1325 m4/largefile.m4 1697 m4/largefile.m4
1698 m4/libunistring-base.m4
1326 m4/limits-h.m4 1699 m4/limits-h.m4
1327 m4/localcharset.m4 1700 m4/localcharset.m4
1701 m4/locale-en.m4
1328 m4/locale-fr.m4 1702 m4/locale-fr.m4
1329 m4/locale-ja.m4 1703 m4/locale-ja.m4
1330 m4/locale-zh.m4 1704 m4/locale-zh.m4
@@ -1332,9 +1706,13 @@ AC_DEFUN([gl_FILE_LIST], [
1332 m4/localeconv.m4 1706 m4/localeconv.m4
1333 m4/lock.m4 1707 m4/lock.m4
1334 m4/lseek.m4 1708 m4/lseek.m4
1709 m4/lstat.m4
1335 m4/malloc.m4 1710 m4/malloc.m4
1336 m4/malloca.m4 1711 m4/malloca.m4
1337 m4/math_h.m4 1712 m4/math_h.m4
1713 m4/mbchar.m4
1714 m4/mbiter.m4
1715 m4/mbrtoc32.m4
1338 m4/mbrtowc.m4 1716 m4/mbrtowc.m4
1339 m4/mbsinit.m4 1717 m4/mbsinit.m4
1340 m4/mbstate_t.m4 1718 m4/mbstate_t.m4
@@ -1353,17 +1731,23 @@ AC_DEFUN([gl_FILE_LIST], [
1353 m4/netinet_in_h.m4 1731 m4/netinet_in_h.m4
1354 m4/nl_langinfo.m4 1732 m4/nl_langinfo.m4
1355 m4/nocrash.m4 1733 m4/nocrash.m4
1734 m4/off64_t.m4
1356 m4/off_t.m4 1735 m4/off_t.m4
1736 m4/once.m4
1357 m4/open-cloexec.m4 1737 m4/open-cloexec.m4
1358 m4/open-slash.m4 1738 m4/open-slash.m4
1359 m4/open.m4 1739 m4/open.m4
1360 m4/pathmax.m4 1740 m4/pathmax.m4
1361 m4/pid_t.m4 1741 m4/pid_t.m4
1362 m4/printf.m4 1742 m4/printf.m4
1743 m4/pthread-once.m4
1744 m4/pthread-spin.m4
1745 m4/pthread_h.m4
1363 m4/pthread_rwlock_rdlock.m4 1746 m4/pthread_rwlock_rdlock.m4
1364 m4/realloc.m4 1747 m4/realloc.m4
1365 m4/reallocarray.m4 1748 m4/reallocarray.m4
1366 m4/regex.m4 1749 m4/regex.m4
1750 m4/sched_h.m4
1367 m4/servent.m4 1751 m4/servent.m4
1368 m4/setenv.m4 1752 m4/setenv.m4
1369 m4/setlocale_null.m4 1753 m4/setlocale_null.m4
@@ -1379,18 +1763,22 @@ AC_DEFUN([gl_FILE_LIST], [
1379 m4/stat.m4 1763 m4/stat.m4
1380 m4/std-gnu11.m4 1764 m4/std-gnu11.m4
1381 m4/stdalign.m4 1765 m4/stdalign.m4
1766 m4/stdckdint_h.m4
1382 m4/stddef_h.m4 1767 m4/stddef_h.m4
1383 m4/stdint.m4 1768 m4/stdint.m4
1384 m4/stdint_h.m4 1769 m4/stdint_h.m4
1385 m4/stdio_h.m4 1770 m4/stdio_h.m4
1386 m4/stdlib_h.m4 1771 m4/stdlib_h.m4
1387 m4/strcase.m4 1772 m4/strcasecmp.m4
1388 m4/strcasestr.m4 1773 m4/strcasestr.m4
1389 m4/strerror.m4 1774 m4/strerror.m4
1390 m4/string_h.m4 1775 m4/string_h.m4
1391 m4/strings_h.m4 1776 m4/strings_h.m4
1777 m4/strncasecmp.m4
1778 m4/strncpy.m4
1392 m4/strsep.m4 1779 m4/strsep.m4
1393 m4/strstr.m4 1780 m4/strstr.m4
1781 m4/sys_cdefs_h.m4
1394 m4/sys_socket_h.m4 1782 m4/sys_socket_h.m4
1395 m4/sys_stat_h.m4 1783 m4/sys_stat_h.m4
1396 m4/sys_types_h.m4 1784 m4/sys_types_h.m4
@@ -1399,8 +1787,13 @@ AC_DEFUN([gl_FILE_LIST], [
1399 m4/time_h.m4 1787 m4/time_h.m4
1400 m4/time_r.m4 1788 m4/time_r.m4
1401 m4/timegm.m4 1789 m4/timegm.m4
1790 m4/uchar_h.m4
1402 m4/ungetc.m4 1791 m4/ungetc.m4
1792 m4/unicase_h.m4
1793 m4/unictype_h.m4
1794 m4/uninorm_h.m4
1403 m4/unistd_h.m4 1795 m4/unistd_h.m4
1796 m4/unitypes_h.m4
1404 m4/unlocked-io.m4 1797 m4/unlocked-io.m4
1405 m4/vararrays.m4 1798 m4/vararrays.m4
1406 m4/vasnprintf.m4 1799 m4/vasnprintf.m4
@@ -1409,10 +1802,10 @@ AC_DEFUN([gl_FILE_LIST], [
1409 m4/vsnprintf.m4 1802 m4/vsnprintf.m4
1410 m4/warn-on-use.m4 1803 m4/warn-on-use.m4
1411 m4/wchar_h.m4 1804 m4/wchar_h.m4
1412 m4/wchar_t.m4
1413 m4/wcrtomb.m4 1805 m4/wcrtomb.m4
1414 m4/wctype.m4 1806 m4/wctype.m4
1415 m4/wctype_h.m4 1807 m4/wctype_h.m4
1808 m4/wcwidth.m4
1416 m4/wint_t.m4 1809 m4/wint_t.m4
1417 m4/xalloc.m4 1810 m4/xalloc.m4
1418 m4/xsize.m4 1811 m4/xsize.m4
diff --git a/gl/m4/gnulib-i18n.m4 b/gl/m4/gnulib-i18n.m4
new file mode 100644
index 00000000..868043e7
--- /dev/null
+++ b/gl/m4/gnulib-i18n.m4
@@ -0,0 +1,61 @@
1# gnulib-i18n.m4
2# serial 1
3dnl Copyright (C) 2005-2025 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..8634a6e9 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-2025 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..9278285c 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-2025 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..6e855e9a 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-2025 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..80de991e 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-2025 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..693bd51b 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 22
3dnl Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-2006, 2008-2025 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[
diff --git a/gl/m4/inet_pton.m4 b/gl/m4/inet_pton.m4
new file mode 100644
index 00000000..b6e59a25
--- /dev/null
+++ b/gl/m4/inet_pton.m4
@@ -0,0 +1,72 @@
1# inet_pton.m4
2# serial 20
3dnl Copyright (C) 2006, 2008-2025 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 Native Windows provides it in -lws2_32 instead, with a declaration in
23 dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl
24 dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it).
25 HAVE_INET_PTON=1
26 INET_PTON_LIB=
27 gl_PREREQ_SYS_H_WINSOCK2
28 if test $HAVE_WINSOCK2_H = 1; then
29 dnl It needs to be overridden, because the stdcall calling convention
30 dnl is not compliant with POSIX. Set REPLACE_INET_PTON in order to avoid
31 dnl a name conflict at the linker level, even though the header file
32 dnl <ws2tcpip.h> declares inet_pton only if _WIN32_WINNT >= 0x0600.
33 REPLACE_INET_PTON=1
34 AC_CHECK_DECLS([inet_pton],,, [[#include <ws2tcpip.h>]])
35 if test $ac_cv_have_decl_inet_pton = yes; then
36 INET_PTON_LIB="-lws2_32"
37 else
38 HAVE_DECL_INET_PTON=0
39 fi
40 else
41 gl_saved_LIBS=$LIBS
42 AC_SEARCH_LIBS([inet_pton], [nsl resolv network], [],
43 [AC_CHECK_FUNCS([inet_pton])
44 if test $ac_cv_func_inet_pton = no; then
45 HAVE_INET_PTON=0
46 fi
47 ])
48 LIBS=$gl_saved_LIBS
49
50 if test "$ac_cv_search_inet_pton" != "no" \
51 && test "$ac_cv_search_inet_pton" != "none required"; then
52 INET_PTON_LIB="$ac_cv_search_inet_pton"
53 fi
54
55 AC_CHECK_HEADERS_ONCE([netdb.h])
56 AC_CHECK_DECLS([inet_pton],,,
57 [[#include <arpa/inet.h>
58 #if HAVE_NETDB_H
59 # include <netdb.h>
60 #endif
61 ]])
62 if test $ac_cv_have_decl_inet_pton = no; then
63 HAVE_DECL_INET_PTON=0
64 fi
65 fi
66 AC_SUBST([INET_PTON_LIB])
67])
68
69# Prerequisites of lib/inet_pton.c.
70AC_DEFUN([gl_PREREQ_INET_PTON], [
71 AC_REQUIRE([gl_SOCKET_FAMILIES])
72])
diff --git a/gl/m4/intmax_t.m4 b/gl/m4/intmax_t.m4
index 72858ea8..c1df7b27 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-2025 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..63c82c61 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-2025 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..ad939a53 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-2025 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..d06b16a2 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-2025 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..f5a3b760 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-2025 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..4582f598 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-2025 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..d8e8d712 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-2025 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..95226fc4 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-2025 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..69f936f0 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 13
3dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2025 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[
@@ -19,6 +20,7 @@ AC_DEFUN_ONCE([gl_LANGINFO_H],
19 HAVE_LANGINFO_CODESET=0 20 HAVE_LANGINFO_CODESET=0
20 HAVE_LANGINFO_T_FMT_AMPM=0 21 HAVE_LANGINFO_T_FMT_AMPM=0
21 HAVE_LANGINFO_ALTMON=0 22 HAVE_LANGINFO_ALTMON=0
23 HAVE_LANGINFO_ABALTMON=0
22 HAVE_LANGINFO_ERA=0 24 HAVE_LANGINFO_ERA=0
23 HAVE_LANGINFO_YESEXPR=0 25 HAVE_LANGINFO_YESEXPR=0
24 AC_CHECK_HEADERS_ONCE([langinfo.h]) 26 AC_CHECK_HEADERS_ONCE([langinfo.h])
@@ -29,6 +31,7 @@ AC_DEFUN_ONCE([gl_LANGINFO_H],
29 dnl ERA etc. are missing on OpenBSD 6.7. 31 dnl ERA etc. are missing on OpenBSD 6.7.
30 dnl T_FMT_AMPM and YESEXPR, NOEXPR are missing on IRIX 5.3. 32 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. 33 dnl ALTMON_* are missing on glibc 2.26 and many other systems.
34 dnl ABALTMON_* are missing on glibc 2.41 and many other systems.
32 AC_CACHE_CHECK([whether langinfo.h defines CODESET], 35 AC_CACHE_CHECK([whether langinfo.h defines CODESET],
33 [gl_cv_header_langinfo_codeset], 36 [gl_cv_header_langinfo_codeset],
34 [AC_COMPILE_IFELSE( 37 [AC_COMPILE_IFELSE(
@@ -65,6 +68,18 @@ int a = ALTMON_1;
65 if test $gl_cv_header_langinfo_altmon = yes; then 68 if test $gl_cv_header_langinfo_altmon = yes; then
66 HAVE_LANGINFO_ALTMON=1 69 HAVE_LANGINFO_ALTMON=1
67 fi 70 fi
71 AC_CACHE_CHECK([whether langinfo.h defines ABALTMON_1],
72 [gl_cv_header_langinfo_abaltmon],
73 [AC_COMPILE_IFELSE(
74 [AC_LANG_PROGRAM([[#include <langinfo.h>
75int a = ABALTMON_1;
76]])],
77 [gl_cv_header_langinfo_abaltmon=yes],
78 [gl_cv_header_langinfo_abaltmon=no])
79 ])
80 if test $gl_cv_header_langinfo_abaltmon = yes; then
81 HAVE_LANGINFO_ABALTMON=1
82 fi
68 AC_CACHE_CHECK([whether langinfo.h defines ERA], 83 AC_CACHE_CHECK([whether langinfo.h defines ERA],
69 [gl_cv_header_langinfo_era], 84 [gl_cv_header_langinfo_era],
70 [AC_COMPILE_IFELSE( 85 [AC_COMPILE_IFELSE(
@@ -96,6 +111,7 @@ int a = YESEXPR;
96 AC_SUBST([HAVE_LANGINFO_CODESET]) 111 AC_SUBST([HAVE_LANGINFO_CODESET])
97 AC_SUBST([HAVE_LANGINFO_T_FMT_AMPM]) 112 AC_SUBST([HAVE_LANGINFO_T_FMT_AMPM])
98 AC_SUBST([HAVE_LANGINFO_ALTMON]) 113 AC_SUBST([HAVE_LANGINFO_ALTMON])
114 AC_SUBST([HAVE_LANGINFO_ABALTMON])
99 AC_SUBST([HAVE_LANGINFO_ERA]) 115 AC_SUBST([HAVE_LANGINFO_ERA])
100 AC_SUBST([HAVE_LANGINFO_YESEXPR]) 116 AC_SUBST([HAVE_LANGINFO_YESEXPR])
101 117
diff --git a/gl/m4/largefile.m4 b/gl/m4/largefile.m4
index 2f824089..b24f657d 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 2
3dnl Copyright 1992-1996, 1998-2024 Free Software Foundation, Inc. 3dnl Copyright 1992-1996, 1998-2025 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.
diff --git a/gl/m4/libunistring-base.m4 b/gl/m4/libunistring-base.m4
new file mode 100644
index 00000000..9b5795ed
--- /dev/null
+++ b/gl/m4/libunistring-base.m4
@@ -0,0 +1,204 @@
1# libunistring-base.m4
2# serial 10
3dnl Copyright (C) 2010-2025 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..202df492 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-2025 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..374a48f1 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-2025 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..4151428a
--- /dev/null
+++ b/gl/m4/locale-en.m4
@@ -0,0 +1,138 @@
1# locale-en.m4
2# serial 1
3dnl Copyright (C) 2003-2025 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_MESSSAGES)
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..f504d5b5 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 24
3dnl Copyright (C) 2003, 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2005-2025 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.
@@ -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..1c813b89 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 19
3dnl Copyright (C) 2003, 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2005-2025 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
diff --git a/gl/m4/locale-zh.m4 b/gl/m4/locale-zh.m4
index 7f1a10be..6f9374d2 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-2025 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..e1afbc16 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 37
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2025 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.
@@ -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..55a669d0 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-2025 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..b1d3f435 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 14
3dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-2025 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/lseek.m4 b/gl/m4/lseek.m4
index 0bc3d65e..ddfadd38 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-2025 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..efae2485
--- /dev/null
+++ b/gl/m4/lstat.m4
@@ -0,0 +1,82 @@
1# lstat.m4
2# serial 36
3dnl Copyright (C) 1997-2001, 2003-2025 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..547b4e4d 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 43.1
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2025 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,30 +145,48 @@ 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.
176 dnl More recent MSVCRT from 2019 does so.
177 dnl UCRT is the successor of MSVCRT. Assume that UCRT does so as well.
178 AC_COMPILE_IFELSE(
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 ;;
135 irix* | solaris*) 190 irix* | solaris*)
136 dnl On IRIX 6.5, the three functions return NULL with errno unset 191 dnl On IRIX 6.5, the three functions return NULL with errno unset
137 dnl when the argument is larger than PTRDIFF_MAX. 192 dnl when the argument is larger than PTRDIFF_MAX.
diff --git a/gl/m4/malloca.m4 b/gl/m4/malloca.m4
index 9e09d22c..cabe5fe7 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-2025 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..8c27503b 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 140.1
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2025 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
@@ -153,6 +154,9 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS],
153 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGB]) 154 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGB])
154 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBF]) 155 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBF])
155 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBL]) 156 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBL])
157 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1])
158 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1F])
159 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1L])
156 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODF]) 160 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODF])
157 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFF]) 161 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFF])
158 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFL]) 162 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFL])
@@ -253,6 +257,9 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
253 HAVE_LOG1PL=1; AC_SUBST([HAVE_LOG1PL]) 257 HAVE_LOG1PL=1; AC_SUBST([HAVE_LOG1PL])
254 HAVE_LOGBF=1; AC_SUBST([HAVE_LOGBF]) 258 HAVE_LOGBF=1; AC_SUBST([HAVE_LOGBF])
255 HAVE_LOGBL=1; AC_SUBST([HAVE_LOGBL]) 259 HAVE_LOGBL=1; AC_SUBST([HAVE_LOGBL])
260 HAVE_LOGP1=1; AC_SUBST([HAVE_LOGP1])
261 HAVE_LOGP1F=1; AC_SUBST([HAVE_LOGP1F])
262 HAVE_LOGP1L=1; AC_SUBST([HAVE_LOGP1L])
256 HAVE_MODFF=1; AC_SUBST([HAVE_MODFF]) 263 HAVE_MODFF=1; AC_SUBST([HAVE_MODFF])
257 HAVE_MODFL=1; AC_SUBST([HAVE_MODFL]) 264 HAVE_MODFL=1; AC_SUBST([HAVE_MODFL])
258 HAVE_POWF=1; AC_SUBST([HAVE_POWF]) 265 HAVE_POWF=1; AC_SUBST([HAVE_POWF])
@@ -392,6 +399,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
392 REPLACE_SIGNBIT_USING_BUILTINS=0; AC_SUBST([REPLACE_SIGNBIT_USING_BUILTINS]) 399 REPLACE_SIGNBIT_USING_BUILTINS=0; AC_SUBST([REPLACE_SIGNBIT_USING_BUILTINS])
393 REPLACE_SINF=0; AC_SUBST([REPLACE_SINF]) 400 REPLACE_SINF=0; AC_SUBST([REPLACE_SINF])
394 REPLACE_SINHF=0; AC_SUBST([REPLACE_SINHF]) 401 REPLACE_SINHF=0; AC_SUBST([REPLACE_SINHF])
402 REPLACE_SINL=0; AC_SUBST([REPLACE_SINL])
395 REPLACE_SQRTF=0; AC_SUBST([REPLACE_SQRTF]) 403 REPLACE_SQRTF=0; AC_SUBST([REPLACE_SQRTF])
396 REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL]) 404 REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL])
397 REPLACE_TANF=0; AC_SUBST([REPLACE_TANF]) 405 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..b76f1d7b
--- /dev/null
+++ b/gl/m4/mbchar.m4
@@ -0,0 +1,15 @@
1# mbchar.m4
2# serial 9
3dnl Copyright (C) 2005-2007, 2009-2025 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..b51242e6
--- /dev/null
+++ b/gl/m4/mbiter.m4
@@ -0,0 +1,16 @@
1# mbiter.m4
2# serial 7
3dnl Copyright (C) 2005, 2008-2025 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..1991529c
--- /dev/null
+++ b/gl/m4/mbrtoc32.m4
@@ -0,0 +1,326 @@
1# mbrtoc32.m4
2# serial 21
3dnl Copyright (C) 2014-2025 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..cc09a5fb 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 46
3dnl Copyright (C) 2001-2002, 2004-2005, 2008-2024 Free Software Foundation, 3dnl Copyright (C) 2001-2002, 2004-2005, 2008-2025 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[
@@ -160,7 +161,7 @@ AC_DEFUN([gl_MBRTOWC_INCOMPLETE_STATE],
160[ 161[
161 AC_REQUIRE([AC_PROG_CC]) 162 AC_REQUIRE([AC_PROG_CC])
162 AC_REQUIRE([gt_LOCALE_JA]) 163 AC_REQUIRE([gt_LOCALE_JA])
163 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 164 AC_REQUIRE([gt_LOCALE_EN_UTF8])
164 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 165 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
165 AC_CACHE_CHECK([whether mbrtowc handles incomplete characters], 166 AC_CACHE_CHECK([whether mbrtowc handles incomplete characters],
166 [gl_cv_func_mbrtowc_incomplete_state], 167 [gl_cv_func_mbrtowc_incomplete_state],
@@ -200,7 +201,7 @@ int main ()
200 [gl_cv_func_mbrtowc_incomplete_state=no], 201 [gl_cv_func_mbrtowc_incomplete_state=no],
201 [:]) 202 [:])
202 else 203 else
203 if test $LOCALE_FR_UTF8 != none; then 204 if test "$LOCALE_EN_UTF8" != none; then
204 AC_RUN_IFELSE( 205 AC_RUN_IFELSE(
205 [AC_LANG_SOURCE([[ 206 [AC_LANG_SOURCE([[
206#include <locale.h> 207#include <locale.h>
@@ -208,7 +209,7 @@ int main ()
208#include <wchar.h> 209#include <wchar.h>
209int main () 210int main ()
210{ 211{
211 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 212 if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
212 { 213 {
213 const char input[] = "B\303\274\303\237er"; /* "Büßer" */ 214 const char input[] = "B\303\274\303\237er"; /* "Büßer" */
214 mbstate_t state; 215 mbstate_t state;
@@ -288,7 +289,7 @@ dnl Result is gl_cv_func_mbrtowc_null_arg1.
288AC_DEFUN([gl_MBRTOWC_NULL_ARG1], 289AC_DEFUN([gl_MBRTOWC_NULL_ARG1],
289[ 290[
290 AC_REQUIRE([AC_PROG_CC]) 291 AC_REQUIRE([AC_PROG_CC])
291 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 292 AC_REQUIRE([gt_LOCALE_EN_UTF8])
292 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 293 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
293 AC_CACHE_CHECK([whether mbrtowc handles a NULL pwc argument], 294 AC_CACHE_CHECK([whether mbrtowc handles a NULL pwc argument],
294 [gl_cv_func_mbrtowc_null_arg1], 295 [gl_cv_func_mbrtowc_null_arg1],
@@ -303,7 +304,7 @@ changequote(,)dnl
303 *) gl_cv_func_mbrtowc_null_arg1="guessing yes" ;; 304 *) gl_cv_func_mbrtowc_null_arg1="guessing yes" ;;
304 esac 305 esac
305changequote([,])dnl 306changequote([,])dnl
306 if test $LOCALE_FR_UTF8 != none; then 307 if test "$LOCALE_EN_UTF8" != none; then
307 AC_RUN_IFELSE( 308 AC_RUN_IFELSE(
308 [AC_LANG_SOURCE([[ 309 [AC_LANG_SOURCE([[
309#include <locale.h> 310#include <locale.h>
@@ -314,7 +315,7 @@ int main ()
314{ 315{
315 int result = 0; 316 int result = 0;
316 317
317 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 318 if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
318 { 319 {
319 char input[] = "\303\237er"; 320 char input[] = "\303\237er";
320 mbstate_t state; 321 mbstate_t state;
@@ -351,7 +352,7 @@ dnl Result is gl_cv_func_mbrtowc_null_arg2.
351AC_DEFUN([gl_MBRTOWC_NULL_ARG2], 352AC_DEFUN([gl_MBRTOWC_NULL_ARG2],
352[ 353[
353 AC_REQUIRE([AC_PROG_CC]) 354 AC_REQUIRE([AC_PROG_CC])
354 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 355 AC_REQUIRE([gt_LOCALE_EN_UTF8])
355 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 356 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
356 AC_CACHE_CHECK([whether mbrtowc handles a NULL string argument], 357 AC_CACHE_CHECK([whether mbrtowc handles a NULL string argument],
357 [gl_cv_func_mbrtowc_null_arg2], 358 [gl_cv_func_mbrtowc_null_arg2],
@@ -366,7 +367,7 @@ changequote(,)dnl
366 *) gl_cv_func_mbrtowc_null_arg2="guessing yes" ;; 367 *) gl_cv_func_mbrtowc_null_arg2="guessing yes" ;;
367 esac 368 esac
368changequote([,])dnl 369changequote([,])dnl
369 if test $LOCALE_FR_UTF8 != none; then 370 if test "$LOCALE_EN_UTF8" != none; then
370 AC_RUN_IFELSE( 371 AC_RUN_IFELSE(
371 [AC_LANG_SOURCE([[ 372 [AC_LANG_SOURCE([[
372#include <locale.h> 373#include <locale.h>
@@ -374,7 +375,7 @@ changequote([,])dnl
374#include <wchar.h> 375#include <wchar.h>
375int main () 376int main ()
376{ 377{
377 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 378 if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
378 { 379 {
379 mbstate_t state; 380 mbstate_t state;
380 wchar_t wc; 381 wchar_t wc;
@@ -404,7 +405,7 @@ dnl Result is gl_cv_func_mbrtowc_retval.
404AC_DEFUN([gl_MBRTOWC_RETVAL], 405AC_DEFUN([gl_MBRTOWC_RETVAL],
405[ 406[
406 AC_REQUIRE([AC_PROG_CC]) 407 AC_REQUIRE([AC_PROG_CC])
407 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 408 AC_REQUIRE([gt_LOCALE_EN_UTF8])
408 AC_REQUIRE([gt_LOCALE_JA]) 409 AC_REQUIRE([gt_LOCALE_JA])
409 AC_REQUIRE([AC_CANONICAL_HOST]) 410 AC_REQUIRE([AC_CANONICAL_HOST])
410 AC_CACHE_CHECK([whether mbrtowc has a correct return value], 411 AC_CACHE_CHECK([whether mbrtowc has a correct return value],
@@ -422,7 +423,7 @@ changequote(,)dnl
422 gl_cv_func_mbrtowc_retval="guessing yes" ;; 423 gl_cv_func_mbrtowc_retval="guessing yes" ;;
423 esac 424 esac
424changequote([,])dnl 425changequote([,])dnl
425 if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none \ 426 if test "$LOCALE_EN_UTF8" != none || test $LOCALE_JA != none \
426 || { case "$host_os" in mingw* | windows*) true;; *) false;; esac; }; then 427 || { case "$host_os" in mingw* | windows*) true;; *) false;; esac; }; then
427 AC_RUN_IFELSE( 428 AC_RUN_IFELSE(
428 [AC_LANG_SOURCE([[ 429 [AC_LANG_SOURCE([[
@@ -434,8 +435,8 @@ int main ()
434 int result = 0; 435 int result = 0;
435 int found_some_locale = 0; 436 int found_some_locale = 0;
436 /* This fails on Solaris. */ 437 /* This fails on Solaris. */
437 if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 438 if (strcmp ("$LOCALE_EN_UTF8", "none") != 0
438 && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 439 && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
439 { 440 {
440 char input[] = "B\303\274\303\237er"; /* "Büßer" */ 441 char input[] = "B\303\274\303\237er"; /* "Büßer" */
441 mbstate_t state; 442 mbstate_t state;
@@ -649,8 +650,8 @@ int main ()
649 [:]) 650 [:])
650 ;; 651 ;;
651 *) 652 *)
652 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 653 AC_REQUIRE([gt_LOCALE_EN_UTF8])
653 if test $LOCALE_FR_UTF8 != none; then 654 if test "$LOCALE_EN_UTF8" != none; then
654 AC_RUN_IFELSE( 655 AC_RUN_IFELSE(
655 [AC_LANG_SOURCE([[ 656 [AC_LANG_SOURCE([[
656#include <locale.h> 657#include <locale.h>
@@ -658,7 +659,7 @@ int main ()
658#include <wchar.h> 659#include <wchar.h>
659int main () 660int main ()
660{ 661{
661 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 662 if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
662 { 663 {
663 wchar_t wc = (wchar_t) 0xBADFACE; 664 wchar_t wc = (wchar_t) 0xBADFACE;
664 mbstate_t state; 665 mbstate_t state;
diff --git a/gl/m4/mbsinit.m4 b/gl/m4/mbsinit.m4
index 10c86ba9..69cfa574 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-2025 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..59df1e2e 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-2025 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..3e3f6ce0 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-2025 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..1c2ecf1d 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 20
3dnl Copyright (C) 2002-2004, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2004, 2009-2025 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[
@@ -49,7 +50,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
49 if (fd >= 0) 50 if (fd >= 0)
50# endif 51# endif
51 { 52 {
52 int pagesize = getpagesize (); 53 long int pagesize = sysconf (_SC_PAGESIZE);
53 char *two_pages = 54 char *two_pages =
54 (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, 55 (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
55 flags, fd, 0); 56 flags, fd, 0);
diff --git a/gl/m4/minmax.m4 b/gl/m4/minmax.m4
index bc7d0c34..69c8a89f 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-2025 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..eca6c4d8 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 42
3dnl Copyright (C) 2002-2003, 2005-2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2003, 2005-2007, 2009-2025 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
diff --git a/gl/m4/mmap-anon.m4 b/gl/m4/mmap-anon.m4
index 61ca0120..3f7a6656 100644
--- a/gl/m4/mmap-anon.m4
+++ b/gl/m4/mmap-anon.m4
@@ -1,9 +1,10 @@
1# mmap-anon.m4 1# mmap-anon.m4
2# serial 12 2# serial 12
3dnl Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005, 2007, 2009-2025 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.
diff --git a/gl/m4/mode_t.m4 b/gl/m4/mode_t.m4
index 0d5c2808..7dae201b 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-2025 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..e7eac2e9 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 18
3dnl Copyright (C) 2002-2006, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2006, 2009-2025 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
@@ -318,12 +319,17 @@ int getmntinfo (struct statfs **, int);
318 fi 319 fi
319 320
320 if test -z "$ac_list_mounted_fs"; then 321 if test -z "$ac_list_mounted_fs"; then
321 AC_MSG_ERROR([could not determine how to read list of mounted file systems]) 322 case "$host_os" in
322 # FIXME -- no need to abort building the whole package 323 mingw* | windows*) ac_list_mounted_fs=found ;;
323 # Can't build mountlist.c or anything that needs its functions 324 esac
325 fi
326
327 if test -z "$ac_list_mounted_fs"; then
328 AC_DEFINE([MOUNTED_NOT_PORTED], [1],
329 [Define if we don't know how to determine the list of mounted file systems.])
324 fi 330 fi
325 331
326 if test $ac_list_mounted_fs = found; then 332 if test "$ac_list_mounted_fs" = found; then
327 gl_cv_list_mounted_fs=yes 333 gl_cv_list_mounted_fs=yes
328 else 334 else
329 gl_cv_list_mounted_fs=no 335 gl_cv_list_mounted_fs=no
diff --git a/gl/m4/msvc-inval.m4 b/gl/m4/msvc-inval.m4
index 7919ff12..bfbb983b 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-2025 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..6a470971 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-2025 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..817f01f1 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-2025 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..6ff778cb 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-2025 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..88512546 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-2025 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..b56e354c 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-2025 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..9b1e0f32 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 12.1
3dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2025 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[
@@ -40,16 +41,18 @@ AC_DEFUN([gl_FUNC_NL_LANGINFO],
40 AC_DEFINE_UNQUOTED([FUNC_NL_LANGINFO_YESEXPR_WORKS], 41 AC_DEFINE_UNQUOTED([FUNC_NL_LANGINFO_YESEXPR_WORKS],
41 [$FUNC_NL_LANGINFO_YESEXPR_WORKS], 42 [$FUNC_NL_LANGINFO_YESEXPR_WORKS],
42 [Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string.]) 43 [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 # On macOS 26, Solaris 10, and Solaris 11.3, nl_langinfo is not
45 # multithread-safe.
44 case "$host_os" in 46 case "$host_os" in
45 solaris*) NL_LANGINFO_MTSAFE=0 ;; 47 darwin* | solaris*) NL_LANGINFO_MTSAFE=0 ;;
46 *) NL_LANGINFO_MTSAFE=1 ;; 48 *) NL_LANGINFO_MTSAFE=1 ;;
47 esac 49 esac
48 AC_DEFINE_UNQUOTED([NL_LANGINFO_MTSAFE], [$NL_LANGINFO_MTSAFE], 50 AC_DEFINE_UNQUOTED([NL_LANGINFO_MTSAFE], [$NL_LANGINFO_MTSAFE],
49 [Define to 1 if nl_langinfo is multithread-safe.]) 51 [Define to 1 if nl_langinfo is multithread-safe.])
50 if test $HAVE_LANGINFO_CODESET = 1 \ 52 if test $HAVE_LANGINFO_CODESET = 1 \
51 && test $HAVE_LANGINFO_T_FMT_AMPM = 1 \ 53 && test $HAVE_LANGINFO_T_FMT_AMPM = 1 \
52 && test $HAVE_LANGINFO_ALTMON = 1 \ 54 && test $HAVE_LANGINFO_ALTMON = 1 \
55 && test $HAVE_LANGINFO_ABALTMON = 1 \
53 && test $HAVE_LANGINFO_ERA = 1 \ 56 && test $HAVE_LANGINFO_ERA = 1 \
54 && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1 \ 57 && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1 \
55 && test $NL_LANGINFO_MTSAFE = 1; then 58 && test $NL_LANGINFO_MTSAFE = 1; then
diff --git a/gl/m4/nocrash.m4 b/gl/m4/nocrash.m4
index cbe8fe82..662fb049 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-2025 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..963d53e9
--- /dev/null
+++ b/gl/m4/off64_t.m4
@@ -0,0 +1,32 @@
1# off64_t.m4
2# serial 1
3dnl Copyright (C) 2024-2025 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..f4f4bbf6 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-2025 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..7876a8fe
--- /dev/null
+++ b/gl/m4/once.m4
@@ -0,0 +1,14 @@
1# once.m4
2# serial 1
3dnl Copyright (C) 2024-2025 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..860541b0 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-2025 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..2cba48fe 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-2025 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..dd3a805f 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-2025 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..0c3925df 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-2025 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..a8bdabc2 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-2025 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..4619a402 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 96
3dnl Copyright (C) 2003, 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2007-2025 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/bugzilla/show_bug.cgi?id=2908>
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,6 +932,9 @@ 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)
@@ -1173,6 +1186,112 @@ changequote([,])dnl
1173 ]) 1186 ])
1174]) 1187])
1175 1188
1189dnl Test whether the *printf family of functions supports POSIX/XSI format
1190dnl strings with the ' flag for grouping of decimal digits on integers,
1191dnl together with a precision.
1192dnl Result is gl_cv_func_printf_flag_grouping_int_precision.
1193
1194AC_DEFUN([gl_PRINTF_FLAG_GROUPING_INT_PRECISION],
1195[
1196 AC_REQUIRE([AC_PROG_CC])
1197 AC_REQUIRE([AC_CANONICAL_HOST])
1198 AC_CACHE_CHECK([whether printf supports grouping on integers with a precision],
1199 [gl_cv_func_printf_flag_grouping_int_precision],
1200 [
1201 dnl Prepare a guess, used when cross-compiling or when specific locales
1202 dnl are not available.
1203 case "$host_os" in
1204 # Guess no on FreeBSD, NetBSD, Solaris, Cygwin, Haiku.
1205 freebsd* | dragonfly* | netbsd* | solaris* | cygwin* | haiku*)
1206 gl_cv_func_printf_flag_grouping_int_precision="guessing no";;
1207 *)
1208 gl_cv_func_printf_flag_grouping_int_precision="guessing yes";;
1209 esac
1210 AC_RUN_IFELSE(
1211 [AC_LANG_SOURCE([[
1212#include <locale.h>
1213#include <stdio.h>
1214#include <string.h>
1215static char buf[100];
1216int main ()
1217{
1218 if (setlocale (LC_ALL, "fr_FR.UTF-8") != NULL
1219 || setlocale (LC_ALL, "fr_FR") != NULL
1220 || setlocale (LC_ALL, "fr_FR.ISO-8859-1") != NULL
1221 || setlocale (LC_ALL, "fr_FR.ISO8859-1") != NULL)
1222 {
1223 if (sprintf (buf, "%'.10d", 1000) < 0)
1224 return 1;
1225 if (strlen (buf) == 10 && strcmp (buf, "0000001000") != 0)
1226 /* The sprintf implementation has produced fewer than 10 digits. */
1227 return 2;
1228 else
1229 return 0;
1230 }
1231 return 3;
1232}]])],
1233 [gl_cv_func_printf_flag_grouping_int_precision=yes],
1234 [if test $? = 2; then
1235 gl_cv_func_printf_flag_grouping_int_precision=no
1236 fi
1237 ],
1238 [:])
1239 ])
1240])
1241
1242dnl Test whether the *printf family of functions supports POSIX/XSI format
1243dnl strings with the ' flag for grouping of decimal digits, when the thousands
1244dnl separator is a multibyte character (such as U+00A0 or U+202F in a UTF-8
1245dnl locale).
1246dnl Result is gl_cv_func_printf_flag_grouping_multibyte.
1247
1248AC_DEFUN([gl_PRINTF_FLAG_GROUPING_MULTIBYTE],
1249[
1250 AC_REQUIRE([AC_PROG_CC])
1251 AC_REQUIRE([AC_CANONICAL_HOST])
1252 AC_CACHE_CHECK([whether printf supports grouping with a multibyte separator],
1253 [gl_cv_func_printf_flag_grouping_multibyte],
1254 [
1255 dnl Prepare a guess, used when cross-compiling or when specific locales
1256 dnl are not available.
1257 case "$host_os" in
1258 # Guess no on NetBSD and Solaris 11 OpenIndiana.
1259 netbsd* | solaris*)
1260 gl_cv_func_printf_flag_grouping_multibyte="guessing no";;
1261 *)
1262 gl_cv_func_printf_flag_grouping_multibyte="guessing yes";;
1263 esac
1264 AC_RUN_IFELSE(
1265 [AC_LANG_SOURCE([[
1266#include <locale.h>
1267#include <stdio.h>
1268#include <string.h>
1269static char buf[100];
1270int main ()
1271{
1272 if (setlocale (LC_ALL, "fr_FR.UTF-8") == NULL)
1273 return 0;
1274 if (sprintf (buf, "%'.0f", 1000.0) < 0)
1275 return 1;
1276 if (strlen (localeconv ()->thousands_sep) > 1)
1277 {
1278 if (strlen (buf) <= 4 + 1)
1279 return 2;
1280 else
1281 return 3;
1282 }
1283 return 0;
1284}]])],
1285 [:],
1286 [case $? in
1287 2) gl_cv_func_printf_flag_grouping_multibyte=no ;;
1288 3) gl_cv_func_printf_flag_grouping_multibyte=yes ;;
1289 esac
1290 ],
1291 [:])
1292 ])
1293])
1294
1176dnl Test whether the *printf family of functions supports the - flag correctly. 1295dnl Test whether the *printf family of functions supports the - flag correctly.
1177dnl (ISO C99.) See 1296dnl (ISO C99.) See
1178dnl <https://lists.gnu.org/r/bug-coreutils/2008-02/msg00035.html> 1297dnl <https://lists.gnu.org/r/bug-coreutils/2008-02/msg00035.html>
@@ -1709,6 +1828,11 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N],
1709#include <signal.h> 1828#include <signal.h>
1710#include <stdio.h> 1829#include <stdio.h>
1711#include <string.h> 1830#include <string.h>
1831#if defined _WIN32 && !defined __CYGWIN__
1832# include <stdlib.h>
1833#else
1834# include <unistd.h>
1835#endif
1712#if HAVE_SNPRINTF 1836#if HAVE_SNPRINTF
1713# define my_snprintf snprintf 1837# define my_snprintf snprintf
1714#else 1838#else
@@ -2143,20 +2267,22 @@ dnl 11 = gl_PRINTF_DIRECTIVE_LS
2143dnl 12 = gl_PRINTF_DIRECTIVE_LC 2267dnl 12 = gl_PRINTF_DIRECTIVE_LC
2144dnl 13 = gl_PRINTF_POSITIONS 2268dnl 13 = gl_PRINTF_POSITIONS
2145dnl 14 = gl_PRINTF_FLAG_GROUPING 2269dnl 14 = gl_PRINTF_FLAG_GROUPING
2146dnl 15 = gl_PRINTF_FLAG_LEFTADJUST 2270dnl 15 = gl_PRINTF_FLAG_GROUPING_INT_PRECISION
2147dnl 16 = gl_PRINTF_FLAG_ZERO 2271dnl 16 = gl_PRINTF_FLAG_GROUPING_MULTIBYTE
2148dnl 17 = gl_PRINTF_FLAG_ALT_PRECISION_ZERO 2272dnl 17 = gl_PRINTF_FLAG_LEFTADJUST
2149dnl 18 = gl_PRINTF_PRECISION 2273dnl 18 = gl_PRINTF_FLAG_ZERO
2150dnl 19 = gl_PRINTF_ENOMEM 2274dnl 19 = gl_PRINTF_FLAG_ALT_PRECISION_ZERO
2151dnl 20 = gl_SNPRINTF_PRESENCE 2275dnl 20 = gl_PRINTF_PRECISION
2152dnl 21 = gl_SNPRINTF_TRUNCATION_C99 2276dnl 21 = gl_PRINTF_ENOMEM
2153dnl 22 = gl_SNPRINTF_RETVAL_C99 2277dnl 22 = gl_SNPRINTF_PRESENCE
2154dnl 23 = gl_SNPRINTF_DIRECTIVE_N 2278dnl 23 = gl_SNPRINTF_TRUNCATION_C99
2155dnl 24 = gl_SNPRINTF_SIZE1 2279dnl 24 = gl_SNPRINTF_RETVAL_C99
2156dnl 25 = gl_VSNPRINTF_ZEROSIZE_C99 2280dnl 25 = gl_SNPRINTF_DIRECTIVE_N
2157dnl 26 = gl_SWPRINTF_WORKS 2281dnl 26 = gl_SNPRINTF_SIZE1
2158dnl 27 = gl_SWPRINTF_DIRECTIVE_LA 2282dnl 27 = gl_VSNPRINTF_ZEROSIZE_C99
2159dnl 28 = gl_SWPRINTF_DIRECTIVE_LC 2283dnl 28 = gl_SWPRINTF_WORKS
2284dnl 29 = gl_SWPRINTF_DIRECTIVE_LA
2285dnl 30 = gl_SWPRINTF_DIRECTIVE_LC
2160dnl 2286dnl
2161dnl 1 = checking whether printf supports size specifiers as in C99... 2287dnl 1 = checking whether printf supports size specifiers as in C99...
2162dnl 2 = checking whether printf supports size specifiers as in C23... 2288dnl 2 = checking whether printf supports size specifiers as in C23...
@@ -2172,62 +2298,64 @@ dnl 11 = checking whether printf supports the 'ls' directive...
2172dnl 12 = checking whether printf supports the 'lc' directive correctly... 2298dnl 12 = checking whether printf supports the 'lc' directive correctly...
2173dnl 13 = checking whether printf supports POSIX/XSI format strings with positions... 2299dnl 13 = checking whether printf supports POSIX/XSI format strings with positions...
2174dnl 14 = checking whether printf supports the grouping flag... 2300dnl 14 = checking whether printf supports the grouping flag...
2175dnl 15 = checking whether printf supports the left-adjust flag correctly... 2301dnl 15 = checking whether printf supports grouping on integers with a precision...
2176dnl 16 = checking whether printf supports the zero flag correctly... 2302dnl 16 = checking whether printf supports grouping with a multibyte separator...
2177dnl 17 = checking whether printf supports the alternative flag with a zero precision... 2303dnl 17 = checking whether printf supports the left-adjust flag correctly...
2178dnl 18 = checking whether printf supports large precisions... 2304dnl 18 = checking whether printf supports the zero flag correctly...
2179dnl 19 = checking whether printf survives out-of-memory conditions... 2305dnl 19 = checking whether printf supports the alternative flag with a zero precision...
2180dnl 20 = checking for snprintf... 2306dnl 20 = checking whether printf supports large precisions...
2181dnl 21 = checking whether snprintf truncates the result as in C99... 2307dnl 21 = checking whether printf survives out-of-memory conditions...
2182dnl 22 = checking whether snprintf returns a byte count as in C99... 2308dnl 22 = checking for snprintf...
2183dnl 23 = checking whether snprintf fully supports the 'n' directive... 2309dnl 23 = checking whether snprintf truncates the result as in C99...
2184dnl 24 = checking whether snprintf respects a size of 1... 2310dnl 24 = checking whether snprintf returns a byte count as in C99...
2185dnl 25 = checking whether vsnprintf respects a zero size as in C99... 2311dnl 25 = checking whether snprintf fully supports the 'n' directive...
2186dnl 26 = checking whether swprintf works... 2312dnl 26 = checking whether snprintf respects a size of 1...
2187dnl 27 = checking whether swprintf supports the 'La' and 'LA' directives... 2313dnl 27 = checking whether vsnprintf respects a zero size as in C99...
2188dnl 28 = checking whether swprintf supports the 'lc' directive... 2314dnl 28 = checking whether swprintf works...
2315dnl 29 = checking whether swprintf supports the 'La' and 'LA' directives...
2316dnl 30 = checking whether swprintf supports the 'lc' directive...
2189dnl 2317dnl
2190dnl . = yes, # = no. 2318dnl . = yes, # = no.
2191dnl 2319dnl
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 2320dnl 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 . # . . . . # # . . . # . . . . ? . . . . . . . . # . # 2321dnl musl libc 1.2.3 . # . . . . # # . . . # . . . . . . . . . . . . . . . # . #
2194dnl glibc 2.35 . # . . . . . . . . . . . . . . . . . . . . . . . . . . 2322dnl glibc 2.35 . # . . . . . . . . . . . . # . . . . . . . . . . . . . . .
2195dnl glibc 2.5 . # . . . . # # . . . . . . . . . . . . . . . . . . # . 2323dnl glibc 2.5 . # . . . . # # . . . . . . # . . . . . . . . . . . . . # .
2196dnl glibc 2.3.6 . # . . . # # # . . . . . . . . . . . . . . . . . . # . 2324dnl glibc 2.3.6 . # . . . # # # . . . . . . . . . . . . . . . . . . . . # .
2197dnl FreeBSD 14.0 . . . . . # . . . . . . . . . . . . # . . . . . . # . # 2325dnl FreeBSD 14.0 . . . . . # . . . . . . . . # . . . . . # . . . . . . # . #
2198dnl FreeBSD 13.0 . # . . . # # # . . . . . . . . . . # . . . . . . # . # 2326dnl FreeBSD 13.0 . # . . . # # # . . . . . . # . . . . . # . . . . . . # . #
2199dnl FreeBSD 5.4, 6.1 . # . . . # # # . . . . . . . # ? . # . . . . . . # ? ? 2327dnl FreeBSD 5.4, 6.1 . # . . . # # # . . . . . . . . . # ? . # . . . . . . # ? ?
2200dnl Mac OS X 10.13.5 . # . . # # # # . # . . . . . . . . . . . . # . . # ? ? 2328dnl Mac OS X 10.13.5 . # . . # # # # . # . . . . ? ? . . . . . . . . # . . # ? ?
2201dnl Mac OS X 10.5.8 . # . . # # # # . . . . . . . # # . . . . . . . . # ? ? 2329dnl Mac OS X 10.5.8 . # . . # # # # . . . . . . ? ? . # # . . . . . . . . # ? ?
2202dnl Mac OS X 10.3.9 . # . . . # # # . . . . . . . # # . # . . . . . . # ? ? 2330dnl Mac OS X 10.3.9 . # . . . # # # . . . . . . ? ? . # # . # . . . . . . # ? ?
2203dnl OpenBSD 6.0, 6.7 . # . . . # # # . . . . . . . . . . # . . . . . . # . # 2331dnl OpenBSD 6.0, 6.7 . # . . . # # # . . . . . . . . . . . . # . . . . . . # . #
2204dnl OpenBSD 3.9, 4.0 . # . # # # # # # . # . . # . # ? . # . . . . . . # ? ? 2332dnl OpenBSD 3.9, 4.0 . # . # # # # # # . # . . # ? ? . # ? . # . . . . . . # ? ?
2205dnl Cygwin 1.7.0 (2009) . # . . # . # # . . ? ? . . . . ? . ? . . . . . . ? ? ? 2333dnl Cygwin 1.7.0 (2009) . # . . # . # # . . ? ? . . ? ? . . ? . ? . . . . . . ? ? ?
2206dnl Cygwin 1.5.25 (2008) . # . . # # # # . . # ? . . . . ? . # . . . . . . ? ? ? 2334dnl Cygwin 1.5.25 (2008) . # . . # # # # . . # ? . . ? ? . . ? . # . . . . . . ? ? ?
2207dnl Cygwin 1.5.19 (2006) # # . . # # # # # . # ? . # . # ? # # . . . . . . ? ? ? 2335dnl Cygwin 1.5.19 (2006) # # . . # # # # # . # ? . # ? ? . # ? # # . . . . . . ? ? ?
2208dnl Solaris 11.4 . # . # # # # # . . # . . . . # . . . . . . . . . . # . 2336dnl Solaris 11.4 . # . # # # # # . . # . . . # # . # . . . . . . . . . . # .
2209dnl Solaris 11.3 . # . . . # # # . . # . . . . . . . . . . . . . . . # . 2337dnl Solaris 11.3 . # . . . # # # . . # . . . ? ? . . . . . . . . . . . . # .
2210dnl Solaris 11.0 . # . # # # # # . . # . . . . # . . . . . . . . . ? ? ? 2338dnl Solaris 11.0 . # . # # # # # . . # . . . ? ? . # . . . . . . . . . ? ? ?
2211dnl Solaris 10 . # . # # # # # . . # . . . . # . # . . . . . . . . # . 2339dnl Solaris 10 . # . # # # # # . . # . . . # # . # . # . . . . . . . . # .
2212dnl Solaris 2.6 ... 9 # # . # # # # # # . # . . . . # ? # . . . # . . . ? ? ? 2340dnl Solaris 2.6 ... 9 # # . # # # # # # . # . . . ? ? . # ? # . . . # . . . ? ? ?
2213dnl Solaris 2.5.1 # # . # # # # # # . # . . . . # ? . . # # # # # # ? ? ? 2341dnl Solaris 2.5.1 # # . # # # # # # . # . . . ? ? . # ? . . # # # # # # ? ? ?
2214dnl AIX 7.1 . # . # # # # # . . . . . . . # . # . . . . . . . # . . 2342dnl AIX 7.1 . # . # # # # # . . . . . . . . . # . # . . . . . . . # . .
2215dnl AIX 5.2 . # . # # # # # . . . . . . . # ? . . . . . . . . # ? ? 2343dnl AIX 5.2 . # . # # # # # . . . . . . ? ? . # ? . . . . . . . . # ? ?
2216dnl AIX 4.3.2, 5.1 # # . # # # # # # . . . . . . # ? . . . . # . . . # ? ? 2344dnl AIX 4.3.2, 5.1 # # . # # # # # # . . . . . ? ? . # ? . . . . # . . . # ? ?
2217dnl HP-UX 11.31 . # . . . # # # . . . ? . . . # ? . . . . # # . . ? ? ? 2345dnl HP-UX 11.31 . # . . . # # # . . . ? . . ? ? . # ? . . . . # # . . ? ? ?
2218dnl HP-UX 11.{00,11,23} # # . . . # # # # . . ? . . . # ? . . . . # # . # ? ? ? 2346dnl HP-UX 11.{00,11,23} # # . . . # # # # . . ? . . ? ? . # ? . . . . # # . # ? ? ?
2219dnl HP-UX 10.20 # # . # . # # # # . ? ? . . # # ? . . . . # # ? # ? ? ? 2347dnl HP-UX 10.20 # # . # . # # # # . ? ? . . ? ? # # ? . . . . # # ? # ? ? ?
2220dnl IRIX 6.5 # # . # # # # # # . # . . . . # ? . . . . # . . . # ? ? 2348dnl IRIX 6.5 # # . # # # # # # . # . . . ? ? . # ? . . . . # . . . # ? ?
2221dnl OSF/1 5.1 # # . # # # # # # . . ? . . . # ? . . . . # . . # ? ? ? 2349dnl OSF/1 5.1 # # . # # # # # # . . ? . . ? ? . # ? . . . . # . . # ? ? ?
2222dnl OSF/1 4.0d # # . # # # # # # . . ? . . . # ? . . # # # # # # ? ? ? 2350dnl OSF/1 4.0d # # . # # # # # # . . ? . . ? ? . # ? . . # # # # # # ? ? ?
2223dnl NetBSD 9.0 . # . . . # # # . . . . . . . . . . . . . . . . . # . # 2351dnl NetBSD 9.0 . # . . . # # # . . . . . . # # . . . . . . . . . . . # . #
2224dnl NetBSD 5.0 . # . . # # # # . . . . . . . # ? . # . . . . . . # ? ? 2352dnl NetBSD 5.0 . # . . # # # # . . . . . . ? ? . # ? . # . . . . . . # ? ?
2225dnl NetBSD 4.0 . # ? ? ? ? # # ? . ? . . ? ? ? ? ? ? . . . ? ? ? # ? ? 2353dnl NetBSD 4.0 . # ? ? ? ? # # ? . ? . . ? ? ? ? ? ? ? ? . . . ? ? ? # ? ?
2226dnl NetBSD 3.0 . # . . . # # # # . ? . # # ? # ? . # . . . . . . # ? ? 2354dnl NetBSD 3.0 . # . . . # # # # . ? . # # ? ? ? # ? . # . . . . . . # ? ?
2227dnl Haiku . # . . # # # # # . # ? . . . . ? . ? . . ? . . . . # . 2355dnl Haiku . # . . # # # # # . # ? . . # . . . ? . ? . . ? . . . . # .
2228dnl BeOS # # # . # # # # # . ? ? # . ? . ? # ? . . ? . . . ? ? ? 2356dnl BeOS # # # . # # # # # . ? ? # . ? ? ? . ? # ? . . ? . . . ? ? ?
2229dnl Android 4.3 . # . # # # # # # # # ? . # . # ? . # . . . # . . ? ? ? 2357dnl Android 4.3 . # . # # # # # # # # ? . # ? ? . # ? . # . . . # . . ? ? ?
2230dnl old mingw / msvcrt # # # # # # # # # . . ? # # . # ? # ? . # # # . . # ? ? 2358dnl old mingw / msvcrt # # # # # # # # # . . ? # # ? ? . # ? # ? . # # # . . # ? ?
2231dnl MSVC 9 # # # # # # # # # # . ? # # . # ? # ? # # # # . . # ? ? 2359dnl MSVC 9 # # # # # # # # # # . ? # # ? ? . # ? # ? # # # # . . # ? ?
2232dnl mingw 2009-2011 . # # . # . # # . . . ? # # . . ? . ? . . . . . . # ? ? 2360dnl mingw 2009-2011 . # # . # . # # . . . ? # # ? ? . . ? . ? . . . . . . # ? ?
2233dnl mingw-w64 2011 # # # # # # # # # . . ? # # . # ? # ? . # # # . . # ? ? 2361dnl mingw-w64 2011 # # # # # # # # # . . ? # # ? ? . # ? # ? . # # # . . # ? ?
diff --git a/gl/m4/pthread-once.m4 b/gl/m4/pthread-once.m4
new file mode 100644
index 00000000..85549254
--- /dev/null
+++ b/gl/m4/pthread-once.m4
@@ -0,0 +1,83 @@
1# pthread-once.m4
2# serial 6
3dnl Copyright (C) 2019-2025 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..aae2fb3b
--- /dev/null
+++ b/gl/m4/pthread-spin.m4
@@ -0,0 +1,72 @@
1# pthread-spin.m4
2# serial 8
3dnl Copyright (C) 2019-2025 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..bb921386
--- /dev/null
+++ b/gl/m4/pthread_h.m4
@@ -0,0 +1,293 @@
1# pthread_h.m4
2# serial 11
3dnl Copyright (C) 2009-2025 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..aec9f076 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-2025 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
diff --git a/gl/m4/realloc.m4 b/gl/m4/realloc.m4
index eb90d588..67c1476b 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 39.1
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2025 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..3970d9e1 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-2025 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..49a8059f 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-2025 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..1ffd465f
--- /dev/null
+++ b/gl/m4/sched_h.m4
@@ -0,0 +1,102 @@
1# sched_h.m4
2# serial 16
3dnl Copyright (C) 2008-2025 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..ba6ebd1d 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-2025 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..727e35af 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 35
3dnl Copyright (C) 2001-2004, 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2001-2004, 2006-2025 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[
@@ -155,6 +156,7 @@ AC_DEFUN([gl_PREREQ_SETENV],
155 AC_REQUIRE([gl_ENVIRON]) 156 AC_REQUIRE([gl_ENVIRON])
156 AC_CHECK_HEADERS_ONCE([unistd.h]) 157 AC_CHECK_HEADERS_ONCE([unistd.h])
157 AC_CHECK_HEADERS([search.h]) 158 AC_CHECK_HEADERS([search.h])
159 AC_CHECK_DECLS_ONCE([_putenv])
158 gl_CHECK_FUNCS_ANDROID([tsearch], [[#include <search.h>]]) 160 gl_CHECK_FUNCS_ANDROID([tsearch], [[#include <search.h>]])
159]) 161])
160 162
@@ -163,4 +165,5 @@ AC_DEFUN([gl_PREREQ_UNSETENV],
163[ 165[
164 AC_REQUIRE([gl_ENVIRON]) 166 AC_REQUIRE([gl_ENVIRON])
165 AC_CHECK_HEADERS_ONCE([unistd.h]) 167 AC_CHECK_HEADERS_ONCE([unistd.h])
168 AC_CHECK_DECLS_ONCE([_putenv])
166]) 169])
diff --git a/gl/m4/setlocale_null.m4 b/gl/m4/setlocale_null.m4
index e5b7d28b..3c8b693e 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 10
3dnl Copyright (C) 2019-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2019-2025 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])
diff --git a/gl/m4/sha256.m4 b/gl/m4/sha256.m4
index ad5596a4..30e8deeb 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-2025 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..b0460d45 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-2025 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..2c50cee9 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-2025 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..e3509f81 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-2025 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..54f4dc79 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-2025 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..a8ac25b1 100644
--- a/gl/m4/socklen.m4
+++ b/gl/m4/socklen.m4
@@ -1,9 +1,10 @@
1# socklen.m4 1# socklen.m4
2# serial 11 2# serial 11
3dnl Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-2007, 2009-2025 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
diff --git a/gl/m4/sockpfaf.m4 b/gl/m4/sockpfaf.m4
index c68b3abb..08ce843d 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-2025 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..a2ffd6fc 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-2025 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..4aa24e7f 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-2025 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..66876305 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-2025 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..762764e0 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-2025 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
@@ -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..885feafd 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-2025 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
@@ -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/n3096.pdf>)
85 sections 6.5.3.4, 6.7.5, 7.15. 86 sections 6.5.3.4, 6.7.5, 7.15.
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
@@ -103,11 +104,13 @@ AC_DEFUN([gl_ALIGNASOF],
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/bugzilla/show_bug.cgi?id=52023>.
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..d269faa5
--- /dev/null
+++ b/gl/m4/stdckdint_h.m4
@@ -0,0 +1,136 @@
1# stdckdint_h.m4
2# serial 1
3dnl Copyright 2025 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..127ec05b 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-2025 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/bugzilla/show_bug.cgi?id=114869
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/bugzilla/show_bug.cgi?id=114870
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..2d69088b 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 64
3dnl Copyright (C) 2001-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2001-2025 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
diff --git a/gl/m4/stdint_h.m4 b/gl/m4/stdint_h.m4
index 29f42160..d4f1acdd 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-2025 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..71d86180 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-2025 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..2d25da37 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 84
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2025 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])
@@ -218,6 +227,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
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..eb4345d9
--- /dev/null
+++ b/gl/m4/strcasecmp.m4
@@ -0,0 +1,67 @@
1# strcasecmp.m4
2# serial 3
3dnl Copyright (C) 2002-2025 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..eb2862f1 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-2025 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],
@@ -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..c8b3b207 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-2025 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..fc73603a 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 44.1
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2025 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])
@@ -62,6 +64,7 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
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])
64 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT]) 66 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT])
67 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCPY])
65 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP]) 68 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP])
66 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNLEN]) 69 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNLEN])
67 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPBRK]) 70 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPBRK])
@@ -69,6 +72,8 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
69 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR]) 72 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR])
70 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR]) 73 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR])
71 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R]) 74 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R])
75 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STR_STARTSWITH])
76 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STR_ENDSWITH])
72 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN]) 77 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN])
73 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN]) 78 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN])
74 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR]) 79 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR])
@@ -83,8 +88,11 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
83 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN]) 88 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN])
84 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP]) 89 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP])
85 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R]) 90 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R])
91 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBS_STARTSWITH])
92 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBS_ENDSWITH])
86 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR]) 93 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR])
87 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R]) 94 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R])
95 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_L])
88 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP]) 96 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP])
89 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP]) 97 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP])
90 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP]) 98 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP])
@@ -123,6 +131,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
123 HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) 131 HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR])
124 HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) 132 HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
125 HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R]) 133 HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R])
134 HAVE_STRERROR_L=1; AC_SUBST([HAVE_STRERROR_L])
126 HAVE_STRERRORNAME_NP=1; AC_SUBST([HAVE_STRERRORNAME_NP]) 135 HAVE_STRERRORNAME_NP=1; AC_SUBST([HAVE_STRERRORNAME_NP])
127 HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP]) 136 HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP])
128 HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP]) 137 HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP])
@@ -138,6 +147,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
138 REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL]) 147 REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL])
139 REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) 148 REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP])
140 REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) 149 REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT])
150 REPLACE_STRNCPY=0; AC_SUBST([REPLACE_STRNCPY])
141 REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) 151 REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP])
142 REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN]) 152 REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN])
143 REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) 153 REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR])
@@ -145,6 +155,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
145 REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) 155 REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R])
146 REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) 156 REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
147 REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) 157 REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R])
158 REPLACE_STRERROR_L=0; AC_SUBST([REPLACE_STRERROR_L])
148 REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP]) 159 REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP])
149 REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) 160 REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL])
150 REPLACE_STRVERSCMP=0; AC_SUBST([REPLACE_STRVERSCMP]) 161 REPLACE_STRVERSCMP=0; AC_SUBST([REPLACE_STRVERSCMP])
diff --git a/gl/m4/strings_h.m4 b/gl/m4/strings_h.m4
index aaafb559..18f30d4a 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-2025 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..c7c8b240 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-2025 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..57876171
--- /dev/null
+++ b/gl/m4/strncpy.m4
@@ -0,0 +1,94 @@
1# strncpy.m4
2# serial 1
3dnl Copyright (C) 2002-2004, 2009-2025 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..b018ff88 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-2025 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..1b5ef6c1 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-2025 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],
@@ -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..d72796ca
--- /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-2025 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..fb69209b 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 31
3dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-2025 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
@@ -52,24 +53,10 @@ AC_DEFUN_ONCE([gl_SYS_SOCKET_H],
52 fi 53 fi
53 # We need to check for ws2tcpip.h now. 54 # We need to check for ws2tcpip.h now.
54 gl_PREREQ_SYS_H_SOCKET 55 gl_PREREQ_SYS_H_SOCKET
55 AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[ 56 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 57 if test $ac_cv_type_struct_sockaddr_storage = no; then
68 HAVE_STRUCT_SOCKADDR_STORAGE=0 58 HAVE_STRUCT_SOCKADDR_STORAGE=0
69 fi 59 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 60 if test $ac_cv_type_struct_sockaddr_storage != no; then
74 AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], 61 AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family],
75 [], 62 [],
@@ -158,6 +145,32 @@ AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP],
158 AC_SUBST([HAVE_WS2TCPIP_H]) 145 AC_SUBST([HAVE_WS2TCPIP_H])
159]) 146])
160 147
148# Common prerequisites of the <sys/socket.h> replacement and of the <sys/un.h>
149# replacement.
150# Sets and substitutes HAVE_SA_FAMILY_T.
151AC_DEFUN([gl_PREREQ_SYS_SA_FAMILY],
152[
153 AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])
154 AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[
155 /* sys/types.h is not needed according to POSIX, but the
156 sys/socket.h in i386-unknown-freebsd4.10 and
157 powerpc-apple-darwin5.5 required it. */
158#include <sys/types.h>
159#ifdef HAVE_SYS_SOCKET_H
160#include <sys/socket.h>
161#endif
162#ifdef HAVE_WS2TCPIP_H
163#include <ws2tcpip.h>
164#endif
165])
166 if test $ac_cv_type_sa_family_t = yes; then
167 HAVE_SA_FAMILY_T=1
168 else
169 HAVE_SA_FAMILY_T=0
170 fi
171 AC_SUBST([HAVE_SA_FAMILY_T])
172])
173
161# gl_SYS_SOCKET_MODULE_INDICATOR([modulename]) 174# gl_SYS_SOCKET_MODULE_INDICATOR([modulename])
162# sets the shell variable that indicates the presence of the given module 175# sets the shell variable that indicates the presence of the given module
163# to a C preprocessor expression that will evaluate to 1. 176# to a C preprocessor expression that will evaluate to 1.
@@ -202,6 +215,5 @@ AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
202 HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) 215 HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE])
203 HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; 216 HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1;
204 AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) 217 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]) 218 HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4])
207]) 219])
diff --git a/gl/m4/sys_stat_h.m4 b/gl/m4/sys_stat_h.m4
index 3cc50ce6..fdcc8954 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 42 -*- Autoconf -*-
3dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006-2025 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..e99fdcc6 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-2025 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..eb0e8424 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-2025 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..333c8fe0 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 45.1
3dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-2025 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,22 @@ 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 AS_CASE([$host_os],
60 osf*) 61 [osf*],
61 # On OSF/1, the compiler needs the flag -D_REENTRANT so that it 62 [# 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 # 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 # we do not use it because 1. gcc-2.95 does not understand -pthread,
64 # 2. putting a flag into CPPFLAGS that has an effect on the linker 65 # 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 # causes the AC_LINK_IFELSE test below to succeed unexpectedly,
66 # leading to wrong values of LIBTHREAD and LTLIBTHREAD. 67 # leading to wrong values of LIBTHREAD and LTLIBTHREAD.
67 CPPFLAGS="$CPPFLAGS -D_REENTRANT" 68 CPPFLAGS="$CPPFLAGS -D_REENTRANT"
68 ;; 69 ])
69 esac
70 # Some systems optimize for single-threaded programs by default, and 70 # Some systems optimize for single-threaded programs by default, and
71 # need special flags to disable these optimizations. For example, the 71 # need special flags to disable these optimizations. For example, the
72 # definition of 'errno' in <errno.h>. 72 # definition of errno in <errno.h>.
73 case "$host_os" in 73 AS_CASE([$host_os],
74 aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; 74 [aix* | freebsd*], [CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"],
75 solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; 75 [hpux* | solaris*], [CPPFLAGS="$CPPFLAGS -D_REENTRANT"])
76 esac
77 gl_anythreadlib_early_done=done 76 gl_anythreadlib_early_done=done
78 fi 77 fi
79]) 78])
@@ -85,24 +84,26 @@ AC_DEFUN([gl_WEAK_SYMBOLS],
85 AC_REQUIRE([AC_CANONICAL_HOST]) 84 AC_REQUIRE([AC_CANONICAL_HOST])
86 AC_CACHE_CHECK([whether imported symbols can be declared weak], 85 AC_CACHE_CHECK([whether imported symbols can be declared weak],
87 [gl_cv_have_weak], 86 [gl_cv_have_weak],
88 [case "$host_os" in 87 [AS_CASE([$host_os],
89 cygwin* | mingw* | windows*) 88 [cygwin* | mingw* | windows*],
89 [
90 dnl On Cygwin 3.2.0 with gcc 10.2, and likewise on mingw 10.0.0 with 90 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 91 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 92 dnl pthread_in_use() with weak symbol references crash miserably at
93 dnl runtime. 93 dnl runtime.
94 gl_cv_have_weak="guessing no" 94 gl_cv_have_weak="guessing no"
95 ;; 95 ],
96 *) 96 [
97 gl_cv_have_weak=no 97 gl_cv_have_weak=no
98 dnl First, test whether the compiler accepts it syntactically. 98 dnl First, test whether the compiler accepts it syntactically.
99 AC_LINK_IFELSE( 99 AC_LINK_IFELSE(
100 [AC_LANG_PROGRAM( 100 [AC_LANG_PROGRAM(
101 [[extern void xyzzy (); 101 [[extern void xyzzy ();
102#pragma weak xyzzy]], 102#pragma weak xyzzy
103 ]],
103 [[xyzzy();]])], 104 [[xyzzy();]])],
104 [gl_cv_have_weak=maybe]) 105 [gl_cv_have_weak=maybe])
105 if test $gl_cv_have_weak = maybe; then 106 AS_IF([test $gl_cv_have_weak = maybe], [
106 dnl Second, test whether it actually works. On Cygwin 1.7.2, with 107 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. 108 dnl gcc 4.3, symbols declared weak always evaluate to the address 0.
108 AC_RUN_IFELSE( 109 AC_RUN_IFELSE(
@@ -125,20 +126,19 @@ int main ()
125 [gl_cv_have_weak="guessing yes"], 126 [gl_cv_have_weak="guessing yes"],
126 [gl_cv_have_weak="guessing no"]) 127 [gl_cv_have_weak="guessing no"])
127 ]) 128 ])
128 fi 129 ])
129 ;; 130 ])
130 esac 131 dnl But when linking statically, weak symbols do not work.
131 dnl But when linking statically, weak symbols don't work. 132 AS_CASE([" $LDFLAGS "],
132 case " $LDFLAGS " in 133 [*" -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 134 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 135 dnl symbol and linking against a shared library that has a dependency on
137 dnl the shared library that defines the symbol. 136 dnl the shared library that defines the symbol.
138 case "$gl_cv_have_weak" in 137 AS_CASE([$gl_cv_have_weak],
139 *yes) 138 [*yes],
140 case "$host_os" in 139 [AS_CASE([$host_os],
141 freebsd* | dragonfly* | midnightbsd*) 140 [freebsd* | dragonfly* | midnightbsd*],
141 [
142 : > conftest1.c 142 : > conftest1.c
143 $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&AS_MESSAGE_LOG_FD 2>&1 143 $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&AS_MESSAGE_LOG_FD 2>&1
144 cat <<EOF > conftest2.c 144 cat <<EOF > conftest2.c
@@ -152,17 +152,15 @@ EOF
152 $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&AS_MESSAGE_LOG_FD 2>&1 \ 152 $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&AS_MESSAGE_LOG_FD 2>&1 \
153 || gl_cv_have_weak=no 153 || gl_cv_have_weak=no
154 rm -f conftest1.c libempty.so conftest2.c conftest 154 rm -f conftest1.c libempty.so conftest2.c conftest
155 ;; 155 ])
156 esac 156 ])
157 ;;
158 esac
159 ]) 157 ])
160 case "$gl_cv_have_weak" in 158 AS_CASE([$gl_cv_have_weak],
161 *yes) 159 [*yes],
160 [
162 AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], 161 AC_DEFINE([HAVE_WEAK_SYMBOLS], [1],
163 [Define to 1 if the compiler and linker support weak declarations of symbols.]) 162 [Define to 1 if the compiler and linker support weak declarations of symbols.])
164 ;; 163 ])
165 esac
166]) 164])
167 165
168dnl ============================================================================ 166dnl ============================================================================
@@ -188,15 +186,15 @@ dnl The guts of gl_PTHREADLIB. Needs to be expanded only once.
188AC_DEFUN([gl_PTHREADLIB_BODY], 186AC_DEFUN([gl_PTHREADLIB_BODY],
189[ 187[
190 AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) 188 AC_REQUIRE([gl_ANYTHREADLIB_EARLY])
191 if test -z "$gl_pthreadlib_body_done"; then 189 AS_IF([test -z "$gl_pthreadlib_body_done"], [
192 gl_pthread_api=no 190 gl_pthread_api=no
193 LIBPTHREAD= 191 LIBPTHREAD=
194 LIBPMULTITHREAD= 192 LIBPMULTITHREAD=
195 # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that 193 # 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. 194 # it groks <pthread.h>. It is added above, in gl_ANYTHREADLIB_EARLY.
197 AC_CHECK_HEADER([pthread.h], 195 AC_CHECK_HEADER([pthread.h],
198 [gl_have_pthread_h=yes], [gl_have_pthread_h=no]) 196 [gl_have_pthread_h=yes], [gl_have_pthread_h=no])
199 if test "$gl_have_pthread_h" = yes; then 197 AS_IF([test "$gl_have_pthread_h" = yes], [
200 # Other possible tests: 198 # Other possible tests:
201 # -lpthreads (FSU threads, PCthreads) 199 # -lpthreads (FSU threads, PCthreads)
202 # -lgthreads 200 # -lgthreads
@@ -208,7 +206,7 @@ AC_DEFUN([gl_PTHREADLIB_BODY],
208 # needs -pthread for some reason. See: 206 # needs -pthread for some reason. See:
209 # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html 207 # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html
210 saved_LIBS="$LIBS" 208 saved_LIBS="$LIBS"
211 for gl_pthread in '' '-pthread'; do 209 for gl_pthread in "" "-pthread"; do
212 LIBS="$LIBS $gl_pthread" 210 LIBS="$LIBS $gl_pthread"
213 AC_LINK_IFELSE( 211 AC_LINK_IFELSE(
214 [AC_LANG_PROGRAM( 212 [AC_LANG_PROGRAM(
@@ -230,8 +228,9 @@ AC_DEFUN([gl_PTHREADLIB_BODY],
230 gl_pthread_in_glibc=no 228 gl_pthread_in_glibc=no
231 # On Linux with glibc >= 2.34, libc contains the fully functional 229 # On Linux with glibc >= 2.34, libc contains the fully functional
232 # pthread functions. 230 # pthread functions.
233 case "$host_os" in 231 AS_CASE([$host_os],
234 linux*) 232 [linux*],
233 [
235 AC_EGREP_CPP([Lucky user], 234 AC_EGREP_CPP([Lucky user],
236 [#include <features.h> 235 [#include <features.h>
237 #ifdef __GNU_LIBRARY__ 236 #ifdef __GNU_LIBRARY__
@@ -242,19 +241,18 @@ AC_DEFUN([gl_PTHREADLIB_BODY],
242 ], 241 ],
243 [gl_pthread_in_glibc=yes], 242 [gl_pthread_in_glibc=yes],
244 []) 243 [])
245 ;; 244 ])
246 esac
247 echo "$as_me:__oline__: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&AS_MESSAGE_LOG_FD 245 echo "$as_me:__oline__: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&AS_MESSAGE_LOG_FD
248 246
249 # Test for libpthread by looking for pthread_kill. (Not pthread_self, 247 # Test for libpthread by looking for pthread_kill. (Not pthread_self,
250 # since it is defined as a macro on OSF/1.) 248 # since it is defined as a macro on OSF/1.)
251 if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then 249 AS_IF([test $gl_pthread_api = yes && test -z "$LIBPTHREAD"], [
252 # The program links fine without libpthread. But it may actually 250 # The program links fine without libpthread. But it may actually
253 # need to link with libpthread in order to create multiple threads. 251 # need to link with libpthread in order to create multiple threads.
254 AC_CHECK_LIB([pthread], [pthread_kill], 252 AC_CHECK_LIB([pthread], [pthread_kill],
255 [if test $gl_pthread_in_glibc = yes; then 253 [AS_IF([test $gl_pthread_in_glibc = yes], [
256 LIBPMULTITHREAD= 254 LIBPMULTITHREAD=
257 else 255 ], [
258 LIBPMULTITHREAD=-lpthread 256 LIBPMULTITHREAD=-lpthread
259 # On Solaris and HP-UX, most pthread functions exist also in libc. 257 # On Solaris and HP-UX, most pthread functions exist also in libc.
260 # Therefore pthread_in_use() needs to actually try to create a 258 # Therefore pthread_in_use() needs to actually try to create a
@@ -262,14 +260,13 @@ AC_DEFUN([gl_PTHREADLIB_BODY],
262 # pthread_create will actually create a thread. 260 # pthread_create will actually create a thread.
263 # On Solaris 10 or newer, this test is no longer needed, because 261 # On Solaris 10 or newer, this test is no longer needed, because
264 # libc contains the fully functional pthread functions. 262 # libc contains the fully functional pthread functions.
265 case "$host_os" in 263 AS_CASE([$host_os],
266changequote(,)dnl 264 [[solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*]],
267 solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*) 265 [
268changequote([,])dnl 266 AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1],
269 AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], 267 [Define if the pthread_in_use() detection is hard.])
270 [Define if the pthread_in_use() detection is hard.]) 268 ])
271 esac 269 ])
272 fi
273 ], 270 ],
274 [dnl This is needed on FreeBSD 5.2.1. 271 [dnl This is needed on FreeBSD 5.2.1.
275 AC_CHECK_LIB([thr], [pthread_kill], 272 AC_CHECK_LIB([thr], [pthread_kill],
@@ -280,35 +277,36 @@ changequote([,])dnl
280 fi 277 fi
281 ]) 278 ])
282 ]) 279 ])
283 elif test $gl_pthread_api != yes; then 280 ], [test $gl_pthread_api != yes], [
284 # Some library is needed. Try libpthread and libc_r. 281 # Some library is needed. Try libpthread and libc_r.
285 AC_CHECK_LIB([pthread], [pthread_kill], 282 AC_CHECK_LIB([pthread], [pthread_kill],
286 [gl_pthread_api=yes 283 [gl_pthread_api=yes
287 LIBPTHREAD=-lpthread 284 LIBPTHREAD=-lpthread
288 LIBPMULTITHREAD=-lpthread]) 285 LIBPMULTITHREAD=-lpthread])
289 if test $gl_pthread_api != yes; then 286 AS_IF([test $gl_pthread_api != yes], [
290 # For FreeBSD 4. 287 # For FreeBSD 4.
291 AC_CHECK_LIB([c_r], [pthread_kill], 288 AC_CHECK_LIB([c_r], [pthread_kill],
292 [gl_pthread_api=yes 289 [gl_pthread_api=yes
293 LIBPTHREAD=-lc_r 290 LIBPTHREAD=-lc_r
294 LIBPMULTITHREAD=-lc_r]) 291 LIBPMULTITHREAD=-lc_r])
295 fi 292 ])
296 fi 293 ])
297 echo "$as_me:__oline__: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&AS_MESSAGE_LOG_FD 294 echo "$as_me:__oline__: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&AS_MESSAGE_LOG_FD
298 fi 295 ])
299 AC_MSG_CHECKING([whether POSIX threads API is available]) 296 AC_MSG_CHECKING([whether POSIX threads API is available])
300 AC_MSG_RESULT([$gl_pthread_api]) 297 AC_MSG_RESULT([$gl_pthread_api])
301 AC_SUBST([LIBPTHREAD]) 298 AC_SUBST([LIBPTHREAD])
302 AC_SUBST([LIBPMULTITHREAD]) 299 AC_SUBST([LIBPMULTITHREAD])
303 if test $gl_pthread_api = yes; then 300 AS_IF([test $gl_pthread_api = yes], [
304 AC_DEFINE([HAVE_PTHREAD_API], [1], 301 AC_DEFINE([HAVE_PTHREAD_API], [1],
305 [Define if you have the <pthread.h> header and the POSIX threads API.]) 302 [Define if you have the <pthread.h> header and the POSIX threads API.])
306 fi 303 ])
307 304
308 dnl On some systems, sched_yield is in librt, rather than in libpthread. 305 dnl On some systems, sched_yield is in librt, rather than in libpthread.
309 AC_LINK_IFELSE( 306 AC_LINK_IFELSE(
310 [AC_LANG_PROGRAM( 307 [AC_LANG_PROGRAM(
311 [[#include <sched.h>]], 308 [[#include <sched.h>
309 ]],
312 [[sched_yield ();]])], 310 [[sched_yield ();]])],
313 [SCHED_YIELD_LIB= 311 [SCHED_YIELD_LIB=
314 ], 312 ],
@@ -323,7 +321,7 @@ changequote([,])dnl
323 AC_SUBST([LIB_SCHED_YIELD]) 321 AC_SUBST([LIB_SCHED_YIELD])
324 322
325 gl_pthreadlib_body_done=done 323 gl_pthreadlib_body_done=done
326 fi 324 ])
327]) 325])
328 326
329AC_DEFUN([gl_PTHREADLIB], 327AC_DEFUN([gl_PTHREADLIB],
@@ -350,44 +348,45 @@ AC_DEFUN([gl_STDTHREADLIB_BODY],
350[ 348[
351 AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) 349 AC_REQUIRE([gl_ANYTHREADLIB_EARLY])
352 AC_REQUIRE([AC_CANONICAL_HOST]) 350 AC_REQUIRE([AC_CANONICAL_HOST])
353 if test -z "$gl_stdthreadlib_body_done"; then 351 AS_IF([test -z "$gl_stdthreadlib_body_done"], [
354 AC_CHECK_HEADERS_ONCE([threads.h]) 352 AC_CHECK_HEADERS_ONCE([threads.h])
355 353
356 case "$host_os" in 354 AS_CASE([$host_os],
357 mingw* | windows*) 355 [mingw* | windows*],
356 [
358 LIBSTDTHREAD= 357 LIBSTDTHREAD=
359 ;; 358 ],
360 *) 359 [
361 gl_PTHREADLIB_BODY 360 gl_PTHREADLIB_BODY
362 if test $ac_cv_header_threads_h = yes; then 361 AS_IF([test $ac_cv_header_threads_h = yes], [
363 dnl glibc >= 2.29 has thrd_create in libpthread. 362 dnl glibc >= 2.29 has thrd_create in libpthread.
364 dnl FreeBSD >= 10 has thrd_create in libstdthreads; this library depends 363 dnl FreeBSD >= 10 has thrd_create in libstdthreads; this library depends
365 dnl on libpthread (for the symbol 'pthread_mutexattr_gettype'). 364 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 365 dnl glibc >= 2.34, AIX >= 7.1, and Solaris >= 11.4 have thrd_create in
367 dnl libc. 366 dnl libc.
368 gl_CHECK_FUNCS_ANDROID([thrd_create], [[#include <threads.h>]]) 367 gl_CHECK_FUNCS_ANDROID([thrd_create], [[#include <threads.h>
369 if test $ac_cv_func_thrd_create = yes; then 368 ]])
369 AS_IF([test $ac_cv_func_thrd_create = yes], [
370 LIBSTDTHREAD= 370 LIBSTDTHREAD=
371 else 371 ], [
372 AC_CHECK_LIB([stdthreads], [thrd_create], [ 372 AC_CHECK_LIB([stdthreads], [thrd_create], [
373 LIBSTDTHREAD='-lstdthreads -lpthread' 373 LIBSTDTHREAD="-lstdthreads -lpthread"
374 ], [ 374 ], [
375 dnl Guess that thrd_create is in libpthread. 375 dnl Guess that thrd_create is in libpthread.
376 LIBSTDTHREAD="$LIBPMULTITHREAD" 376 LIBSTDTHREAD="$LIBPMULTITHREAD"
377 ]) 377 ])
378 fi 378 ])
379 else 379 ], [
380 dnl Libraries needed by thrd.c, mtx.c, cnd.c, tss.c. 380 dnl Libraries needed by thrd.c, mtx.c, cnd.c, tss.c.
381 LIBSTDTHREAD="$LIBPMULTITHREAD $SCHED_YIELD_LIB" 381 LIBSTDTHREAD="$LIBPMULTITHREAD $SCHED_YIELD_LIB"
382 fi 382 ])
383 ;; 383 ])
384 esac
385 AC_SUBST([LIBSTDTHREAD]) 384 AC_SUBST([LIBSTDTHREAD])
386 385
387 AC_MSG_CHECKING([whether ISO C threads API is available]) 386 AC_MSG_CHECKING([whether ISO C threads API is available])
388 AC_MSG_RESULT([$ac_cv_header_threads_h]) 387 AC_MSG_RESULT([$ac_cv_header_threads_h])
389 gl_stdthreadlib_body_done=done 388 gl_stdthreadlib_body_done=done
390 fi 389 ])
391]) 390])
392 391
393AC_DEFUN([gl_STDTHREADLIB], 392AC_DEFUN([gl_STDTHREADLIB],
@@ -404,7 +403,7 @@ dnl ------------
404dnl Tests for a multithreading library to be used. 403dnl Tests for a multithreading library to be used.
405dnl If the configure.ac contains a definition of the gl_THREADLIB_DEFAULT_NO 404dnl 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 405dnl (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 406dnl 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 407dnl can change the choice through the options --enable-threads=choice or
409dnl --disable-threads. 408dnl --disable-threads.
410dnl Defines at most one of the macros USE_ISOC_THREADS, USE_POSIX_THREADS, 409dnl Defines at most one of the macros USE_ISOC_THREADS, USE_POSIX_THREADS,
@@ -449,7 +448,7 @@ AC_DEFUN([gl_THREADLIB_EARLY_BODY],
449 m4_ifdef([gl_THREADLIB_DEFAULT_NO], 448 m4_ifdef([gl_THREADLIB_DEFAULT_NO],
450 [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])], 449 [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])],
451 [m4_divert_text([DEFAULTS], [gl_use_threads_default=])]) 450 [m4_divert_text([DEFAULTS], [gl_use_threads_default=])])
452 dnl gl_use_winpthreads_default defaults to 'no', because in mingw 10, like 451 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. 452 dnl in mingw 5, the use of libwinpthread still makes test-pthread-tss crash.
454 m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=no]) 453 m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=no])
455 AC_ARG_ENABLE([threads], 454 AC_ARG_ENABLE([threads],
@@ -459,41 +458,35 @@ AS_HELP_STRING([[--disable-threads]], [build without multithread safety])]),
459 [if test -n "$gl_use_threads_default"; then 458 [if test -n "$gl_use_threads_default"; then
460 gl_use_threads="$gl_use_threads_default" 459 gl_use_threads="$gl_use_threads_default"
461 else 460 else
462changequote(,)dnl 461 AS_CASE([$host_os],
463 case "$host_os" in
464 dnl Disable multithreading by default on OSF/1, because it interferes 462 dnl Disable multithreading by default on OSF/1, because it interferes
465 dnl with fork()/exec(): When msgexec is linked with -lpthread, its 463 dnl with fork()/exec(): When msgexec is linked with -lpthread, its
466 dnl child process gets an endless segmentation fault inside execvp(). 464 dnl child process gets an endless segmentation fault inside execvp().
467 osf*) gl_use_threads=no ;; 465 [osf*], [gl_use_threads=no],
468 dnl Disable multithreading by default on Cygwin 1.5.x, because it has 466 dnl Disable multithreading by default on Cygwin 1.5.x, because it has
469 dnl bugs that lead to endless loops or crashes. See 467 dnl bugs that lead to endless loops or crashes. See
470 dnl <https://cygwin.com/ml/cygwin/2009-08/msg00283.html>. 468 dnl <https://cygwin.com/ml/cygwin/2009-08/msg00283.html>.
471 cygwin*) 469 [cygwin*],
472 case `uname -r` in 470 [AS_CASE([$(uname -r)],
473 1.[0-5].*) gl_use_threads=no ;; 471 [[1.[0-5].*]], [gl_use_threads=no],
474 *) gl_use_threads=yes ;; 472 [gl_use_threads=yes])
475 esac 473 ],
476 ;;
477 dnl Obey gl_AVOID_WINPTHREAD on mingw. 474 dnl Obey gl_AVOID_WINPTHREAD on mingw.
478 mingw* | windows*) 475 [mingw* | windows*],
479 case "$gl_use_winpthreads_default" in 476 [AS_CASE([$gl_use_winpthreads_default],
480 yes) gl_use_threads=posix ;; 477 [yes], [gl_use_threads=posix],
481 no) gl_use_threads=windows ;; 478 [no], [gl_use_threads=windows],
482 *) gl_use_threads=yes ;; 479 [gl_use_threads=yes])
483 esac 480 ],
484 ;; 481 [gl_use_threads=yes])
485 *) gl_use_threads=yes ;;
486 esac
487changequote([,])dnl
488 fi 482 fi
489 ]) 483 ])
490 if test "$gl_use_threads" = yes \ 484 AS_CASE([$gl_use_threads],
491 || test "$gl_use_threads" = isoc \ 485 [yes | isoc | posix | isoc+posix],
492 || test "$gl_use_threads" = posix \ 486 [
493 || test "$gl_use_threads" = isoc+posix; then 487 # For using <threads.h> or <pthread.h>:
494 # For using <threads.h> or <pthread.h>: 488 gl_ANYTHREADLIB_EARLY
495 gl_ANYTHREADLIB_EARLY 489 ])
496 fi
497]) 490])
498 491
499dnl The guts of gl_THREADLIB. Needs to be expanded only once. 492dnl The guts of gl_THREADLIB. Needs to be expanded only once.
@@ -506,90 +499,95 @@ AC_DEFUN([gl_THREADLIB_BODY],
506 LTLIBTHREAD= 499 LTLIBTHREAD=
507 LIBMULTITHREAD= 500 LIBMULTITHREAD=
508 LTLIBMULTITHREAD= 501 LTLIBMULTITHREAD=
509 if test "$gl_use_threads" != no; then 502 AS_IF([test "$gl_use_threads" = no],
503 [AC_DEFINE([AVOID_ANY_THREADS], [1],
504 [Define if no multithread safety and no multithreading is desired.])],
505 [
510 dnl Check whether the compiler and linker support weak declarations. 506 dnl Check whether the compiler and linker support weak declarations.
511 gl_WEAK_SYMBOLS 507 gl_WEAK_SYMBOLS
512 if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then 508 AS_CASE([$gl_cv_have_weak],
513 dnl If we use weak symbols to implement pthread_in_use / pth_in_use / 509 [*yes],
514 dnl thread_in_use, we also need to test whether the ISO C 11 thrd_create 510 [
515 dnl facility is in use. 511 dnl If we use weak symbols to implement pthread_in_use / pth_in_use /
516 AC_CHECK_HEADERS_ONCE([threads.h]) 512 dnl thread_in_use, we also need to test whether the ISO C 11 thrd_create
517 : 513 dnl facility is in use.
518 fi 514 AC_CHECK_HEADERS_ONCE([threads.h])
519 if test "$gl_use_threads" = isoc || test "$gl_use_threads" = isoc+posix; then 515 :
520 AC_CHECK_HEADERS_ONCE([threads.h]) 516 ])
521 gl_have_isoc_threads="$ac_cv_header_threads_h" 517 AS_CASE([$gl_use_threads],
522 fi 518 [isoc | isoc+posix],
523 if test "$gl_use_threads" = yes \ 519 [
524 || test "$gl_use_threads" = posix \ 520 AC_CHECK_HEADERS_ONCE([threads.h])
525 || test "$gl_use_threads" = isoc+posix; then 521 gl_have_isoc_threads="$ac_cv_header_threads_h"
526 gl_PTHREADLIB_BODY 522 ])
527 LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD 523 AS_CASE([$gl_use_threads],
528 LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD 524 [yes | posix | isoc+posix],
529 if test $gl_pthread_api = yes; then 525 [
530 if test "$gl_use_threads" = isoc+posix && test "$gl_have_isoc_threads" = yes; then 526 gl_PTHREADLIB_BODY
531 gl_threads_api='isoc+posix' 527 LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD
532 AC_DEFINE([USE_ISOC_AND_POSIX_THREADS], [1], 528 LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD
533 [Define if the combination of the ISO C and POSIX multithreading APIs can be used.]) 529 AS_IF([test $gl_pthread_api = yes], [
534 LIBTHREAD= LTLIBTHREAD= 530 AS_IF([test "$gl_use_threads" = isoc+posix &&
535 else 531 test "$gl_have_isoc_threads" = yes], [
536 gl_threads_api=posix 532 gl_threads_api="isoc+posix"
537 AC_DEFINE([USE_POSIX_THREADS], [1], 533 AC_DEFINE([USE_ISOC_AND_POSIX_THREADS], [1],
538 [Define if the POSIX multithreading library can be used.]) 534 [Define if the combination of the ISO C and POSIX multithreading APIs can be used.])
539 if test -z "$LIBMULTITHREAD" && test -z "$LTLIBMULTITHREAD"; then 535 LIBTHREAD= LTLIBTHREAD=
540 AC_DEFINE([USE_POSIX_THREADS_FROM_LIBC], [1], 536 ], [
541 [Define if references to the POSIX multithreading library are satisfied by libc.]) 537 gl_threads_api=posix
542 else 538 AC_DEFINE([USE_POSIX_THREADS], [1],
543 if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then 539 [Define if the POSIX multithreading library can be used.])
544 AC_DEFINE([USE_POSIX_THREADS_WEAK], [1], 540 AS_IF([test -z "$LIBMULTITHREAD" && test -z "$LTLIBMULTITHREAD"], [
545 [Define if references to the POSIX multithreading library should be made weak.]) 541 AC_DEFINE([USE_POSIX_THREADS_FROM_LIBC], [1],
546 LIBTHREAD= LTLIBTHREAD= 542 [Define if references to the POSIX multithreading library are satisfied by libc.])
547 else 543 ], [
548 case "$host_os" in 544 AS_CASE([$gl_cv_have_weak],
549 freebsd* | dragonfly* | midnightbsd*) 545 [*yes],
550 if test "x$LIBTHREAD" != "x$LIBMULTITHREAD"; then 546 [
551 dnl If weak symbols can't tell whether pthread_create(), pthread_key_create() 547 AC_DEFINE([USE_POSIX_THREADS_WEAK], [1],
552 dnl etc. will succeed, we need a runtime test. 548 [Define if references to the POSIX multithreading library should be made weak.])
553 AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], 549 LIBTHREAD= LTLIBTHREAD=
554 [Define if the pthread_in_use() detection is hard.]) 550 ],
555 fi 551 [AS_CASE([$host_os],
556 ;; 552 [freebsd* | dragonfly* | midnightbsd*],
557 esac 553 [
558 fi 554 AS_IF([test "x$LIBTHREAD" != "x$LIBMULTITHREAD"], [
559 fi 555 dnl If weak symbols cannot tell whether
560 fi 556 dnl pthread_create(), dnl pthread_key_create()
561 fi 557 dnl etc. will succeed, we need a runtime test.
562 fi 558 AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1],
563 if test $gl_threads_api = none; then 559 [Define if the pthread_in_use() detection is hard.])
564 if test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes; then 560 ])
561 ])
562 ])
563 ])
564 ])
565 ])
566 ])
567 AS_IF([test $gl_threads_api = none], [
568 AS_IF([test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes], [
565 gl_STDTHREADLIB_BODY 569 gl_STDTHREADLIB_BODY
566 LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD 570 LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD
567 LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD 571 LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD
568 gl_threads_api=isoc 572 gl_threads_api=isoc
569 AC_DEFINE([USE_ISOC_THREADS], [1], 573 AC_DEFINE([USE_ISOC_THREADS], [1],
570 [Define if the ISO C multithreading library can be used.]) 574 [Define if the ISO C multithreading library can be used.])
571 fi 575 ])
572 fi 576 ])
573 if test $gl_threads_api = none; then 577 AS_IF([test $gl_threads_api = none], [
574 case "$gl_use_threads" in 578 # The "win32" is for backward compatibility.
575 yes | windows | win32) # The 'win32' is for backward compatibility. 579 AS_CASE([$gl_use_threads],
576 if { case "$host_os" in 580 [yes | windows | win32],
577 mingw* | windows*) true;; 581 [AS_CASE([$host_os],
578 *) false;; 582 [mingw* | windows*],
579 esac 583 [
580 }; then 584 gl_threads_api=windows
581 gl_threads_api=windows 585 AC_DEFINE([USE_WINDOWS_THREADS], [1],
582 AC_DEFINE([USE_WINDOWS_THREADS], [1], 586 [Define if the native Windows multithreading API can be used.])
583 [Define if the native Windows multithreading API can be used.]) 587 ])
584 fi 588 ])
585 ;; 589 ])
586 esac 590 ])
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]) 591 AC_MSG_CHECKING([for multithread API to use])
594 AC_MSG_RESULT([$gl_threads_api]) 592 AC_MSG_RESULT([$gl_threads_api])
595 AC_SUBST([LIBTHREAD]) 593 AC_SUBST([LIBTHREAD])
@@ -609,7 +607,7 @@ dnl gl_DISABLE_THREADS
609dnl ------------------ 607dnl ------------------
610dnl Sets the gl_THREADLIB default so that threads are not used by default. 608dnl 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 609dnl The user can still override it at installation time, by using the
612dnl configure option '--enable-threads'. 610dnl configure option "--enable-threads".
613 611
614AC_DEFUN([gl_DISABLE_THREADS], [ 612AC_DEFUN([gl_DISABLE_THREADS], [
615 m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no]) 613 m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no])
@@ -621,7 +619,7 @@ dnl -------------------
621dnl Sets the gl_THREADLIB default so that on mingw, a dependency to the 619dnl Sets the gl_THREADLIB default so that on mingw, a dependency to the
622dnl libwinpthread DLL (mingw-w64 winpthreads library) is avoided. 620dnl libwinpthread DLL (mingw-w64 winpthreads library) is avoided.
623dnl The user can still override it at installation time, by using the 621dnl The user can still override it at installation time, by using the
624dnl configure option '--enable-threads=posix'. 622dnl configure option "--enable-threads=posix".
625dnl As of 2023, this is now the default. 623dnl As of 2023, this is now the default.
626 624
627AC_DEFUN([gl_AVOID_WINPTHREAD], [ 625AC_DEFUN([gl_AVOID_WINPTHREAD], [
diff --git a/gl/m4/time_h.m4 b/gl/m4/time_h.m4
index d2f3c970..f4d8e20f 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-2025 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..96f5c5b5 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-2025 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..cb6da6da 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-2025 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..b2309385
--- /dev/null
+++ b/gl/m4/uchar_h.m4
@@ -0,0 +1,279 @@
1# uchar_h.m4
2# serial 32
3dnl Copyright (C) 2019-2025 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..969b60e8 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-2025 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..bf5d4c2e
--- /dev/null
+++ b/gl/m4/unicase_h.m4
@@ -0,0 +1,45 @@
1# unicase_h.m4
2# serial 1
3dnl Copyright (C) 2023-2025 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..68ddaf6c
--- /dev/null
+++ b/gl/m4/unictype_h.m4
@@ -0,0 +1,179 @@
1# unictype_h.m4
2# serial 4
3dnl Copyright (C) 2023-2025 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..d416f73b
--- /dev/null
+++ b/gl/m4/uninorm_h.m4
@@ -0,0 +1,47 @@
1# uninorm_h.m4
2# serial 1
3dnl Copyright (C) 2023-2025 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..6ec16286 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-2025 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..264e61be
--- /dev/null
+++ b/gl/m4/unitypes_h.m4
@@ -0,0 +1,26 @@
1# unitypes_h.m4
2# serial 1
3dnl Copyright (C) 2021-2025 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..97f43f4b 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 16
3dnl Copyright (C) 1998-2006, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 1998-2006, 2009-2025 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
diff --git a/gl/m4/vararrays.m4 b/gl/m4/vararrays.m4
index 9211f69d..086e409f 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-2025 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..1d040d6e 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-2025 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..6ea602bd 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-2025 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..c2cd38d0 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-2025 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..68ab757d 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-2025 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..73cf16fb 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-2025 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..722fcfc2 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 65
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2025 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
@@ -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..91530176 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 21
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2025 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[
@@ -36,7 +37,7 @@ AC_DEFUN([gl_FUNC_WCRTOMB],
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
@@ -90,7 +91,7 @@ changequote(,)dnl
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..56593cd5 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-2025 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..8e54678d 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-2025 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..2cc6ebb1
--- /dev/null
+++ b/gl/m4/wcwidth.m4
@@ -0,0 +1,116 @@
1# wcwidth.m4
2# serial 38
3dnl Copyright (C) 2006-2025 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, OSF/1 5.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..8a3c7944 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-2025 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..c10c4189 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-2025 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..157d635c 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-2025 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..343bda5c 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-2025 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..5642c83c 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-2025 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..6b0585c1 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-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/malloc/dynarray.h b/gl/malloc/dynarray.h
index 3163e278..6cbbe50e 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-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/malloc/dynarray_at_failure.c b/gl/malloc/dynarray_at_failure.c
index 95e34e7a..b94ac3df 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-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/malloc/dynarray_emplace_enlarge.c b/gl/malloc/dynarray_emplace_enlarge.c
index 7bdba159..53126863 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-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/malloc/dynarray_finalize.c b/gl/malloc/dynarray_finalize.c
index 52764f73..3178c687 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-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/malloc/dynarray_resize.c b/gl/malloc/dynarray_resize.c
index 7323f8ee..3cd1626a 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-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/malloc/dynarray_resize_clear.c b/gl/malloc/dynarray_resize_clear.c
index aa17f740..7bfc0005 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-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/malloca.c b/gl/malloca.c
index e75c72df..4bce9a3d 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-2025 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..f131fd5a 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-2025 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..febdf82a 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-2025 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..f4e80c53 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-2025 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,46 +210,46 @@ _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__ || defined __sgi
242 /* NetBSD, IRIX 6.5: match what ilogb() does */ 255 /* NetBSD, IRIX 6.5: match what ilogb() does */
@@ -264,12 +277,12 @@ _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
@@ -285,7 +298,7 @@ _GL_WARN_ON_USE (acosf, "acosf is unportable - "
285#if @GNULIB_ACOSL@ 298#if @GNULIB_ACOSL@
286# if !@HAVE_ACOSL@ || !@HAVE_DECL_ACOSL@ 299# if !@HAVE_ACOSL@ || !@HAVE_DECL_ACOSL@
287# undef acosl 300# undef acosl
288_GL_FUNCDECL_SYS (acosl, long double, (long double x)); 301_GL_FUNCDECL_SYS (acosl, long double, (long double x), );
289# endif 302# endif
290_GL_CXXALIAS_SYS (acosl, long double, (long double x)); 303_GL_CXXALIAS_SYS (acosl, long double, (long double x));
291# if __GLIBC__ >= 2 304# if __GLIBC__ >= 2
@@ -306,12 +319,12 @@ _GL_WARN_ON_USE (acosl, "acosl is unportable - "
306# undef asinf 319# undef asinf
307# define asinf rpl_asinf 320# define asinf rpl_asinf
308# endif 321# endif
309_GL_FUNCDECL_RPL (asinf, float, (float x)); 322_GL_FUNCDECL_RPL (asinf, float, (float x), );
310_GL_CXXALIAS_RPL (asinf, float, (float x)); 323_GL_CXXALIAS_RPL (asinf, float, (float x));
311# else 324# else
312# if !@HAVE_ASINF@ 325# if !@HAVE_ASINF@
313# undef asinf 326# undef asinf
314_GL_FUNCDECL_SYS (asinf, float, (float x)); 327_GL_FUNCDECL_SYS (asinf, float, (float x), );
315# endif 328# endif
316_GL_CXXALIAS_SYS (asinf, float, (float x)); 329_GL_CXXALIAS_SYS (asinf, float, (float x));
317# endif 330# endif
@@ -327,7 +340,7 @@ _GL_WARN_ON_USE (asinf, "asinf is unportable - "
327#if @GNULIB_ASINL@ 340#if @GNULIB_ASINL@
328# if !@HAVE_ASINL@ || !@HAVE_DECL_ASINL@ 341# if !@HAVE_ASINL@ || !@HAVE_DECL_ASINL@
329# undef asinl 342# undef asinl
330_GL_FUNCDECL_SYS (asinl, long double, (long double x)); 343_GL_FUNCDECL_SYS (asinl, long double, (long double x), );
331# endif 344# endif
332_GL_CXXALIAS_SYS (asinl, long double, (long double x)); 345_GL_CXXALIAS_SYS (asinl, long double, (long double x));
333# if __GLIBC__ >= 2 346# if __GLIBC__ >= 2
@@ -348,12 +361,12 @@ _GL_WARN_ON_USE (asinl, "asinl is unportable - "
348# undef atanf 361# undef atanf
349# define atanf rpl_atanf 362# define atanf rpl_atanf
350# endif 363# endif
351_GL_FUNCDECL_RPL (atanf, float, (float x)); 364_GL_FUNCDECL_RPL (atanf, float, (float x), );
352_GL_CXXALIAS_RPL (atanf, float, (float x)); 365_GL_CXXALIAS_RPL (atanf, float, (float x));
353# else 366# else
354# if !@HAVE_ATANF@ 367# if !@HAVE_ATANF@
355# undef atanf 368# undef atanf
356_GL_FUNCDECL_SYS (atanf, float, (float x)); 369_GL_FUNCDECL_SYS (atanf, float, (float x), );
357# endif 370# endif
358_GL_CXXALIAS_SYS (atanf, float, (float x)); 371_GL_CXXALIAS_SYS (atanf, float, (float x));
359# endif 372# endif
@@ -369,7 +382,7 @@ _GL_WARN_ON_USE (atanf, "atanf is unportable - "
369#if @GNULIB_ATANL@ 382#if @GNULIB_ATANL@
370# if !@HAVE_ATANL@ || !@HAVE_DECL_ATANL@ 383# if !@HAVE_ATANL@ || !@HAVE_DECL_ATANL@
371# undef atanl 384# undef atanl
372_GL_FUNCDECL_SYS (atanl, long double, (long double x)); 385_GL_FUNCDECL_SYS (atanl, long double, (long double x), );
373# endif 386# endif
374_GL_CXXALIAS_SYS (atanl, long double, (long double x)); 387_GL_CXXALIAS_SYS (atanl, long double, (long double x));
375# if __GLIBC__ >= 2 388# if __GLIBC__ >= 2
@@ -390,12 +403,12 @@ _GL_WARN_ON_USE (atanl, "atanl is unportable - "
390# undef atan2f 403# undef atan2f
391# define atan2f rpl_atan2f 404# define atan2f rpl_atan2f
392# endif 405# endif
393_GL_FUNCDECL_RPL (atan2f, float, (float y, float x)); 406_GL_FUNCDECL_RPL (atan2f, float, (float y, float x), );
394_GL_CXXALIAS_RPL (atan2f, float, (float y, float x)); 407_GL_CXXALIAS_RPL (atan2f, float, (float y, float x));
395# else 408# else
396# if !@HAVE_ATAN2F@ 409# if !@HAVE_ATAN2F@
397# undef atan2f 410# undef atan2f
398_GL_FUNCDECL_SYS (atan2f, float, (float y, float x)); 411_GL_FUNCDECL_SYS (atan2f, float, (float y, float x), );
399# endif 412# endif
400_GL_CXXALIAS_SYS (atan2f, float, (float y, float x)); 413_GL_CXXALIAS_SYS (atan2f, float, (float y, float x));
401# endif 414# endif
@@ -415,11 +428,11 @@ _GL_WARN_ON_USE (atan2f, "atan2f is unportable - "
415# undef cbrtf 428# undef cbrtf
416# define cbrtf rpl_cbrtf 429# define cbrtf rpl_cbrtf
417# endif 430# endif
418_GL_FUNCDECL_RPL (cbrtf, float, (float x)); 431_GL_FUNCDECL_RPL (cbrtf, float, (float x), );
419_GL_CXXALIAS_RPL (cbrtf, float, (float x)); 432_GL_CXXALIAS_RPL (cbrtf, float, (float x));
420# else 433# else
421# if !@HAVE_DECL_CBRTF@ 434# if !@HAVE_DECL_CBRTF@
422_GL_FUNCDECL_SYS (cbrtf, float, (float x)); 435_GL_FUNCDECL_SYS (cbrtf, float, (float x), );
423# endif 436# endif
424_GL_CXXALIAS_SYS (cbrtf, float, (float x)); 437_GL_CXXALIAS_SYS (cbrtf, float, (float x));
425# endif 438# endif
@@ -434,7 +447,7 @@ _GL_WARN_ON_USE (cbrtf, "cbrtf is unportable - "
434 447
435#if @GNULIB_CBRT@ 448#if @GNULIB_CBRT@
436# if !@HAVE_CBRT@ 449# if !@HAVE_CBRT@
437_GL_FUNCDECL_SYS (cbrt, double, (double x)); 450_GL_FUNCDECL_SYS (cbrt, double, (double x), );
438# endif 451# endif
439_GL_CXXALIAS_SYS (cbrt, double, (double x)); 452_GL_CXXALIAS_SYS (cbrt, double, (double x));
440# if __GLIBC__ >= 2 453# if __GLIBC__ >= 2
@@ -454,11 +467,11 @@ _GL_WARN_ON_USE (cbrt, "cbrt is unportable - "
454# undef cbrtl 467# undef cbrtl
455# define cbrtl rpl_cbrtl 468# define cbrtl rpl_cbrtl
456# endif 469# endif
457_GL_FUNCDECL_RPL (cbrtl, long double, (long double x)); 470_GL_FUNCDECL_RPL (cbrtl, long double, (long double x), );
458_GL_CXXALIAS_RPL (cbrtl, long double, (long double x)); 471_GL_CXXALIAS_RPL (cbrtl, long double, (long double x));
459# else 472# else
460# if !@HAVE_DECL_CBRTL@ 473# if !@HAVE_DECL_CBRTL@
461_GL_FUNCDECL_SYS (cbrtl, long double, (long double x)); 474_GL_FUNCDECL_SYS (cbrtl, long double, (long double x), );
462# endif 475# endif
463_GL_CXXALIAS_SYS (cbrtl, long double, (long double x)); 476_GL_CXXALIAS_SYS (cbrtl, long double, (long double x));
464# endif 477# endif
@@ -480,12 +493,12 @@ _GL_WARN_ON_USE (cbrtl, "cbrtl is unportable - "
480# undef ceilf 493# undef ceilf
481# define ceilf rpl_ceilf 494# define ceilf rpl_ceilf
482# endif 495# endif
483_GL_FUNCDECL_RPL (ceilf, float, (float x)); 496_GL_FUNCDECL_RPL (ceilf, float, (float x), );
484_GL_CXXALIAS_RPL (ceilf, float, (float x)); 497_GL_CXXALIAS_RPL (ceilf, float, (float x));
485# else 498# else
486# if !@HAVE_DECL_CEILF@ 499# if !@HAVE_DECL_CEILF@
487# undef ceilf 500# undef ceilf
488_GL_FUNCDECL_SYS (ceilf, float, (float x)); 501_GL_FUNCDECL_SYS (ceilf, float, (float x), );
489# endif 502# endif
490_GL_CXXALIAS_SYS (ceilf, float, (float x)); 503_GL_CXXALIAS_SYS (ceilf, float, (float x));
491# endif 504# endif
@@ -504,7 +517,7 @@ _GL_WARN_ON_USE (ceilf, "ceilf is unportable - "
504# undef ceil 517# undef ceil
505# define ceil rpl_ceil 518# define ceil rpl_ceil
506# endif 519# endif
507_GL_FUNCDECL_RPL (ceil, double, (double x)); 520_GL_FUNCDECL_RPL (ceil, double, (double x), );
508_GL_CXXALIAS_RPL (ceil, double, (double x)); 521_GL_CXXALIAS_RPL (ceil, double, (double x));
509# else 522# else
510_GL_CXXALIAS_SYS (ceil, double, (double x)); 523_GL_CXXALIAS_SYS (ceil, double, (double x));
@@ -520,12 +533,12 @@ _GL_CXXALIASWARN1 (ceil, double, (double x));
520# undef ceill 533# undef ceill
521# define ceill rpl_ceill 534# define ceill rpl_ceill
522# endif 535# endif
523_GL_FUNCDECL_RPL (ceill, long double, (long double x)); 536_GL_FUNCDECL_RPL (ceill, long double, (long double x), );
524_GL_CXXALIAS_RPL (ceill, long double, (long double x)); 537_GL_CXXALIAS_RPL (ceill, long double, (long double x));
525# else 538# else
526# if !@HAVE_DECL_CEILL@ 539# if !@HAVE_DECL_CEILL@
527# undef ceill 540# undef ceill
528_GL_FUNCDECL_SYS (ceill, long double, (long double x)); 541_GL_FUNCDECL_SYS (ceill, long double, (long double x), );
529# endif 542# endif
530_GL_CXXALIAS_SYS (ceill, long double, (long double x)); 543_GL_CXXALIAS_SYS (ceill, long double, (long double x));
531# endif 544# endif
@@ -544,7 +557,7 @@ _GL_WARN_ON_USE (ceill, "ceill is unportable - "
544#if @GNULIB_COPYSIGNF@ 557#if @GNULIB_COPYSIGNF@
545# if !@HAVE_DECL_COPYSIGNF@ 558# if !@HAVE_DECL_COPYSIGNF@
546# undef copysignf 559# undef copysignf
547_GL_FUNCDECL_SYS (copysignf, float, (float x, float y)); 560_GL_FUNCDECL_SYS (copysignf, float, (float x, float y), );
548# endif 561# endif
549_GL_CXXALIAS_SYS (copysignf, float, (float x, float y)); 562_GL_CXXALIAS_SYS (copysignf, float, (float x, float y));
550_GL_CXXALIASWARN (copysignf); 563_GL_CXXALIASWARN (copysignf);
@@ -558,7 +571,7 @@ _GL_WARN_ON_USE (copysignf, "copysignf is unportable - "
558 571
559#if @GNULIB_COPYSIGN@ 572#if @GNULIB_COPYSIGN@
560# if !@HAVE_COPYSIGN@ 573# if !@HAVE_COPYSIGN@
561_GL_FUNCDECL_SYS (copysign, double, (double x, double y)); 574_GL_FUNCDECL_SYS (copysign, double, (double x, double y), );
562# endif 575# endif
563_GL_CXXALIAS_SYS (copysign, double, (double x, double y)); 576_GL_CXXALIAS_SYS (copysign, double, (double x, double y));
564# if __GLIBC__ >= 2 577# if __GLIBC__ >= 2
@@ -574,7 +587,7 @@ _GL_WARN_ON_USE (copysign, "copysign is unportable - "
574 587
575#if @GNULIB_COPYSIGNL@ 588#if @GNULIB_COPYSIGNL@
576# if !@HAVE_COPYSIGNL@ 589# if !@HAVE_COPYSIGNL@
577_GL_FUNCDECL_SYS (copysignl, long double, (long double x, long double y)); 590_GL_FUNCDECL_SYS (copysignl, long double, (long double x, long double y), );
578# endif 591# endif
579_GL_CXXALIAS_SYS (copysignl, long double, (long double x, long double y)); 592_GL_CXXALIAS_SYS (copysignl, long double, (long double x, long double y));
580# if __GLIBC__ >= 2 593# if __GLIBC__ >= 2
@@ -595,12 +608,12 @@ _GL_WARN_ON_USE (copysign, "copysignl is unportable - "
595# undef cosf 608# undef cosf
596# define cosf rpl_cosf 609# define cosf rpl_cosf
597# endif 610# endif
598_GL_FUNCDECL_RPL (cosf, float, (float x)); 611_GL_FUNCDECL_RPL (cosf, float, (float x), );
599_GL_CXXALIAS_RPL (cosf, float, (float x)); 612_GL_CXXALIAS_RPL (cosf, float, (float x));
600# else 613# else
601# if !@HAVE_COSF@ 614# if !@HAVE_COSF@
602# undef cosf 615# undef cosf
603_GL_FUNCDECL_SYS (cosf, float, (float x)); 616_GL_FUNCDECL_SYS (cosf, float, (float x), );
604# endif 617# endif
605_GL_CXXALIAS_SYS (cosf, float, (float x)); 618_GL_CXXALIAS_SYS (cosf, float, (float x));
606# endif 619# endif
@@ -616,7 +629,7 @@ _GL_WARN_ON_USE (cosf, "cosf is unportable - "
616#if @GNULIB_COSL@ 629#if @GNULIB_COSL@
617# if !@HAVE_COSL@ || !@HAVE_DECL_COSL@ 630# if !@HAVE_COSL@ || !@HAVE_DECL_COSL@
618# undef cosl 631# undef cosl
619_GL_FUNCDECL_SYS (cosl, long double, (long double x)); 632_GL_FUNCDECL_SYS (cosl, long double, (long double x), );
620# endif 633# endif
621_GL_CXXALIAS_SYS (cosl, long double, (long double x)); 634_GL_CXXALIAS_SYS (cosl, long double, (long double x));
622# if __GLIBC__ >= 2 635# if __GLIBC__ >= 2
@@ -637,12 +650,12 @@ _GL_WARN_ON_USE (cosl, "cosl is unportable - "
637# undef coshf 650# undef coshf
638# define coshf rpl_coshf 651# define coshf rpl_coshf
639# endif 652# endif
640_GL_FUNCDECL_RPL (coshf, float, (float x)); 653_GL_FUNCDECL_RPL (coshf, float, (float x), );
641_GL_CXXALIAS_RPL (coshf, float, (float x)); 654_GL_CXXALIAS_RPL (coshf, float, (float x));
642# else 655# else
643# if !@HAVE_COSHF@ 656# if !@HAVE_COSHF@
644# undef coshf 657# undef coshf
645_GL_FUNCDECL_SYS (coshf, float, (float x)); 658_GL_FUNCDECL_SYS (coshf, float, (float x), );
646# endif 659# endif
647_GL_CXXALIAS_SYS (coshf, float, (float x)); 660_GL_CXXALIAS_SYS (coshf, float, (float x));
648# endif 661# endif
@@ -662,12 +675,12 @@ _GL_WARN_ON_USE (coshf, "coshf is unportable - "
662# undef expf 675# undef expf
663# define expf rpl_expf 676# define expf rpl_expf
664# endif 677# endif
665_GL_FUNCDECL_RPL (expf, float, (float x)); 678_GL_FUNCDECL_RPL (expf, float, (float x), );
666_GL_CXXALIAS_RPL (expf, float, (float x)); 679_GL_CXXALIAS_RPL (expf, float, (float x));
667# else 680# else
668# if !@HAVE_EXPF@ 681# if !@HAVE_EXPF@
669# undef expf 682# undef expf
670_GL_FUNCDECL_SYS (expf, float, (float x)); 683_GL_FUNCDECL_SYS (expf, float, (float x), );
671# endif 684# endif
672_GL_CXXALIAS_SYS (expf, float, (float x)); 685_GL_CXXALIAS_SYS (expf, float, (float x));
673# endif 686# endif
@@ -686,12 +699,12 @@ _GL_WARN_ON_USE (expf, "expf is unportable - "
686# undef expl 699# undef expl
687# define expl rpl_expl 700# define expl rpl_expl
688# endif 701# endif
689_GL_FUNCDECL_RPL (expl, long double, (long double x)); 702_GL_FUNCDECL_RPL (expl, long double, (long double x), );
690_GL_CXXALIAS_RPL (expl, long double, (long double x)); 703_GL_CXXALIAS_RPL (expl, long double, (long double x));
691# else 704# else
692# if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@ 705# if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@
693# undef expl 706# undef expl
694_GL_FUNCDECL_SYS (expl, long double, (long double x)); 707_GL_FUNCDECL_SYS (expl, long double, (long double x), );
695# endif 708# endif
696_GL_CXXALIAS_SYS (expl, long double, (long double x)); 709_GL_CXXALIAS_SYS (expl, long double, (long double x));
697# endif 710# endif
@@ -709,7 +722,7 @@ _GL_WARN_ON_USE (expl, "expl is unportable - "
709 722
710#if @GNULIB_EXP2F@ 723#if @GNULIB_EXP2F@
711# if !@HAVE_DECL_EXP2F@ 724# if !@HAVE_DECL_EXP2F@
712_GL_FUNCDECL_SYS (exp2f, float, (float x)); 725_GL_FUNCDECL_SYS (exp2f, float, (float x), );
713# endif 726# endif
714_GL_CXXALIAS_SYS (exp2f, float, (float x)); 727_GL_CXXALIAS_SYS (exp2f, float, (float x));
715_GL_CXXALIASWARN (exp2f); 728_GL_CXXALIASWARN (exp2f);
@@ -727,11 +740,11 @@ _GL_WARN_ON_USE (exp2f, "exp2f is unportable - "
727# undef exp2 740# undef exp2
728# define exp2 rpl_exp2 741# define exp2 rpl_exp2
729# endif 742# endif
730_GL_FUNCDECL_RPL (exp2, double, (double x)); 743_GL_FUNCDECL_RPL (exp2, double, (double x), );
731_GL_CXXALIAS_RPL (exp2, double, (double x)); 744_GL_CXXALIAS_RPL (exp2, double, (double x));
732# else 745# else
733# if !@HAVE_DECL_EXP2@ 746# if !@HAVE_DECL_EXP2@
734_GL_FUNCDECL_SYS (exp2, double, (double x)); 747_GL_FUNCDECL_SYS (exp2, double, (double x), );
735# endif 748# endif
736_GL_CXXALIAS_SYS (exp2, double, (double x)); 749_GL_CXXALIAS_SYS (exp2, double, (double x));
737# endif 750# endif
@@ -752,12 +765,12 @@ _GL_WARN_ON_USE (exp2, "exp2 is unportable - "
752# undef exp2l 765# undef exp2l
753# define exp2l rpl_exp2l 766# define exp2l rpl_exp2l
754# endif 767# endif
755_GL_FUNCDECL_RPL (exp2l, long double, (long double x)); 768_GL_FUNCDECL_RPL (exp2l, long double, (long double x), );
756_GL_CXXALIAS_RPL (exp2l, long double, (long double x)); 769_GL_CXXALIAS_RPL (exp2l, long double, (long double x));
757# else 770# else
758# if !@HAVE_DECL_EXP2L@ 771# if !@HAVE_DECL_EXP2L@
759# undef exp2l 772# undef exp2l
760_GL_FUNCDECL_SYS (exp2l, long double, (long double x)); 773_GL_FUNCDECL_SYS (exp2l, long double, (long double x), );
761# endif 774# endif
762_GL_CXXALIAS_SYS (exp2l, long double, (long double x)); 775_GL_CXXALIAS_SYS (exp2l, long double, (long double x));
763# endif 776# endif
@@ -779,11 +792,11 @@ _GL_WARN_ON_USE (exp2l, "exp2l is unportable - "
779# undef expm1f 792# undef expm1f
780# define expm1f rpl_expm1f 793# define expm1f rpl_expm1f
781# endif 794# endif
782_GL_FUNCDECL_RPL (expm1f, float, (float x)); 795_GL_FUNCDECL_RPL (expm1f, float, (float x), );
783_GL_CXXALIAS_RPL (expm1f, float, (float x)); 796_GL_CXXALIAS_RPL (expm1f, float, (float x));
784# else 797# else
785# if !@HAVE_EXPM1F@ 798# if !@HAVE_EXPM1F@
786_GL_FUNCDECL_SYS (expm1f, float, (float x)); 799_GL_FUNCDECL_SYS (expm1f, float, (float x), );
787# endif 800# endif
788_GL_CXXALIAS_SYS (expm1f, float, (float x)); 801_GL_CXXALIAS_SYS (expm1f, float, (float x));
789# endif 802# endif
@@ -802,11 +815,11 @@ _GL_WARN_ON_USE (expm1f, "expm1f is unportable - "
802# undef expm1 815# undef expm1
803# define expm1 rpl_expm1 816# define expm1 rpl_expm1
804# endif 817# endif
805_GL_FUNCDECL_RPL (expm1, double, (double x)); 818_GL_FUNCDECL_RPL (expm1, double, (double x), );
806_GL_CXXALIAS_RPL (expm1, double, (double x)); 819_GL_CXXALIAS_RPL (expm1, double, (double x));
807# else 820# else
808# if !@HAVE_EXPM1@ 821# if !@HAVE_EXPM1@
809_GL_FUNCDECL_SYS (expm1, double, (double x)); 822_GL_FUNCDECL_SYS (expm1, double, (double x), );
810# endif 823# endif
811_GL_CXXALIAS_SYS (expm1, double, (double x)); 824_GL_CXXALIAS_SYS (expm1, double, (double x));
812# endif 825# endif
@@ -827,13 +840,13 @@ _GL_WARN_ON_USE (expm1, "expm1 is unportable - "
827# undef expm1l 840# undef expm1l
828# define expm1l rpl_expm1l 841# define expm1l rpl_expm1l
829# endif 842# endif
830_GL_FUNCDECL_RPL (expm1l, long double, (long double x)); 843_GL_FUNCDECL_RPL (expm1l, long double, (long double x), );
831_GL_CXXALIAS_RPL (expm1l, long double, (long double x)); 844_GL_CXXALIAS_RPL (expm1l, long double, (long double x));
832# else 845# else
833# if !@HAVE_DECL_EXPM1L@ 846# if !@HAVE_DECL_EXPM1L@
834# undef expm1l 847# undef expm1l
835# if !(defined __cplusplus && defined _AIX) 848# if !(defined __cplusplus && defined _AIX)
836_GL_FUNCDECL_SYS (expm1l, long double, (long double x)); 849_GL_FUNCDECL_SYS (expm1l, long double, (long double x), );
837# endif 850# endif
838# endif 851# endif
839_GL_CXXALIAS_SYS (expm1l, long double, (long double x)); 852_GL_CXXALIAS_SYS (expm1l, long double, (long double x));
@@ -853,7 +866,7 @@ _GL_WARN_ON_USE (expm1l, "expm1l is unportable - "
853#if @GNULIB_FABSF@ 866#if @GNULIB_FABSF@
854# if !@HAVE_FABSF@ 867# if !@HAVE_FABSF@
855# undef fabsf 868# undef fabsf
856_GL_FUNCDECL_SYS (fabsf, float, (float x)); 869_GL_FUNCDECL_SYS (fabsf, float, (float x), );
857# endif 870# endif
858_GL_CXXALIAS_SYS (fabsf, float, (float x)); 871_GL_CXXALIAS_SYS (fabsf, float, (float x));
859# if __GLIBC__ >= 2 872# if __GLIBC__ >= 2
@@ -873,12 +886,12 @@ _GL_WARN_ON_USE (fabsf, "fabsf is unportable - "
873# undef fabsl 886# undef fabsl
874# define fabsl rpl_fabsl 887# define fabsl rpl_fabsl
875# endif 888# endif
876_GL_FUNCDECL_RPL (fabsl, long double, (long double x)); 889_GL_FUNCDECL_RPL (fabsl, long double, (long double x), );
877_GL_CXXALIAS_RPL (fabsl, long double, (long double x)); 890_GL_CXXALIAS_RPL (fabsl, long double, (long double x));
878# else 891# else
879# if !@HAVE_FABSL@ 892# if !@HAVE_FABSL@
880# undef fabsl 893# undef fabsl
881_GL_FUNCDECL_SYS (fabsl, long double, (long double x)); 894_GL_FUNCDECL_SYS (fabsl, long double, (long double x), );
882# endif 895# endif
883_GL_CXXALIAS_SYS (fabsl, long double, (long double x)); 896_GL_CXXALIAS_SYS (fabsl, long double, (long double x));
884# endif 897# endif
@@ -900,12 +913,12 @@ _GL_WARN_ON_USE (fabsl, "fabsl is unportable - "
900# undef floorf 913# undef floorf
901# define floorf rpl_floorf 914# define floorf rpl_floorf
902# endif 915# endif
903_GL_FUNCDECL_RPL (floorf, float, (float x)); 916_GL_FUNCDECL_RPL (floorf, float, (float x), );
904_GL_CXXALIAS_RPL (floorf, float, (float x)); 917_GL_CXXALIAS_RPL (floorf, float, (float x));
905# else 918# else
906# if !@HAVE_DECL_FLOORF@ 919# if !@HAVE_DECL_FLOORF@
907# undef floorf 920# undef floorf
908_GL_FUNCDECL_SYS (floorf, float, (float x)); 921_GL_FUNCDECL_SYS (floorf, float, (float x), );
909# endif 922# endif
910_GL_CXXALIAS_SYS (floorf, float, (float x)); 923_GL_CXXALIAS_SYS (floorf, float, (float x));
911# endif 924# endif
@@ -924,7 +937,7 @@ _GL_WARN_ON_USE (floorf, "floorf is unportable - "
924# undef floor 937# undef floor
925# define floor rpl_floor 938# define floor rpl_floor
926# endif 939# endif
927_GL_FUNCDECL_RPL (floor, double, (double x)); 940_GL_FUNCDECL_RPL (floor, double, (double x), );
928_GL_CXXALIAS_RPL (floor, double, (double x)); 941_GL_CXXALIAS_RPL (floor, double, (double x));
929# else 942# else
930_GL_CXXALIAS_SYS (floor, double, (double x)); 943_GL_CXXALIAS_SYS (floor, double, (double x));
@@ -940,12 +953,12 @@ _GL_CXXALIASWARN1 (floor, double, (double x));
940# undef floorl 953# undef floorl
941# define floorl rpl_floorl 954# define floorl rpl_floorl
942# endif 955# endif
943_GL_FUNCDECL_RPL (floorl, long double, (long double x)); 956_GL_FUNCDECL_RPL (floorl, long double, (long double x), );
944_GL_CXXALIAS_RPL (floorl, long double, (long double x)); 957_GL_CXXALIAS_RPL (floorl, long double, (long double x));
945# else 958# else
946# if !@HAVE_DECL_FLOORL@ 959# if !@HAVE_DECL_FLOORL@
947# undef floorl 960# undef floorl
948_GL_FUNCDECL_SYS (floorl, long double, (long double x)); 961_GL_FUNCDECL_SYS (floorl, long double, (long double x), );
949# endif 962# endif
950_GL_CXXALIAS_SYS (floorl, long double, (long double x)); 963_GL_CXXALIAS_SYS (floorl, long double, (long double x));
951# endif 964# endif
@@ -967,12 +980,12 @@ _GL_WARN_ON_USE (floorl, "floorl is unportable - "
967# undef fmaf 980# undef fmaf
968# define fmaf rpl_fmaf 981# define fmaf rpl_fmaf
969# endif 982# endif
970_GL_FUNCDECL_RPL (fmaf, float, (float x, float y, float z)); 983_GL_FUNCDECL_RPL (fmaf, float, (float x, float y, float z), );
971_GL_CXXALIAS_RPL (fmaf, float, (float x, float y, float z)); 984_GL_CXXALIAS_RPL (fmaf, float, (float x, float y, float z));
972# else 985# else
973# if !@HAVE_FMAF@ 986# if !@HAVE_FMAF@
974# undef fmaf 987# undef fmaf
975_GL_FUNCDECL_SYS (fmaf, float, (float x, float y, float z)); 988_GL_FUNCDECL_SYS (fmaf, float, (float x, float y, float z), );
976# endif 989# endif
977_GL_CXXALIAS_SYS (fmaf, float, (float x, float y, float z)); 990_GL_CXXALIAS_SYS (fmaf, float, (float x, float y, float z));
978# endif 991# endif
@@ -991,12 +1004,12 @@ _GL_WARN_ON_USE (fmaf, "fmaf is unportable - "
991# undef fma 1004# undef fma
992# define fma rpl_fma 1005# define fma rpl_fma
993# endif 1006# endif
994_GL_FUNCDECL_RPL (fma, double, (double x, double y, double z)); 1007_GL_FUNCDECL_RPL (fma, double, (double x, double y, double z), );
995_GL_CXXALIAS_RPL (fma, double, (double x, double y, double z)); 1008_GL_CXXALIAS_RPL (fma, double, (double x, double y, double z));
996# else 1009# else
997# if !@HAVE_FMA@ 1010# if !@HAVE_FMA@
998# undef fma 1011# undef fma
999_GL_FUNCDECL_SYS (fma, double, (double x, double y, double z)); 1012_GL_FUNCDECL_SYS (fma, double, (double x, double y, double z), );
1000# endif 1013# endif
1001_GL_CXXALIAS_SYS (fma, double, (double x, double y, double z)); 1014_GL_CXXALIAS_SYS (fma, double, (double x, double y, double z));
1002# endif 1015# endif
@@ -1018,7 +1031,7 @@ _GL_WARN_ON_USE (fma, "fma is unportable - "
1018# define fmal rpl_fmal 1031# define fmal rpl_fmal
1019# endif 1032# endif
1020_GL_FUNCDECL_RPL (fmal, long double, 1033_GL_FUNCDECL_RPL (fmal, long double,
1021 (long double x, long double y, long double z)); 1034 (long double x, long double y, long double z), );
1022_GL_CXXALIAS_RPL (fmal, long double, 1035_GL_CXXALIAS_RPL (fmal, long double,
1023 (long double x, long double y, long double z)); 1036 (long double x, long double y, long double z));
1024# else 1037# else
@@ -1026,7 +1039,7 @@ _GL_CXXALIAS_RPL (fmal, long double,
1026# undef fmal 1039# undef fmal
1027# if !(defined __cplusplus && defined _AIX) 1040# if !(defined __cplusplus && defined _AIX)
1028_GL_FUNCDECL_SYS (fmal, long double, 1041_GL_FUNCDECL_SYS (fmal, long double,
1029 (long double x, long double y, long double z)); 1042 (long double x, long double y, long double z), );
1030# endif 1043# endif
1031# endif 1044# endif
1032_GL_CXXALIAS_SYS (fmal, long double, 1045_GL_CXXALIAS_SYS (fmal, long double,
@@ -1050,12 +1063,12 @@ _GL_WARN_ON_USE (fmal, "fmal is unportable - "
1050# undef fmodf 1063# undef fmodf
1051# define fmodf rpl_fmodf 1064# define fmodf rpl_fmodf
1052# endif 1065# endif
1053_GL_FUNCDECL_RPL (fmodf, float, (float x, float y)); 1066_GL_FUNCDECL_RPL (fmodf, float, (float x, float y), );
1054_GL_CXXALIAS_RPL (fmodf, float, (float x, float y)); 1067_GL_CXXALIAS_RPL (fmodf, float, (float x, float y));
1055# else 1068# else
1056# if !@HAVE_FMODF@ 1069# if !@HAVE_FMODF@
1057# undef fmodf 1070# undef fmodf
1058_GL_FUNCDECL_SYS (fmodf, float, (float x, float y)); 1071_GL_FUNCDECL_SYS (fmodf, float, (float x, float y), );
1059# endif 1072# endif
1060_GL_CXXALIAS_SYS (fmodf, float, (float x, float y)); 1073_GL_CXXALIAS_SYS (fmodf, float, (float x, float y));
1061# endif 1074# endif
@@ -1074,7 +1087,7 @@ _GL_WARN_ON_USE (fmodf, "fmodf is unportable - "
1074# undef fmod 1087# undef fmod
1075# define fmod rpl_fmod 1088# define fmod rpl_fmod
1076# endif 1089# endif
1077_GL_FUNCDECL_RPL (fmod, double, (double x, double y)); 1090_GL_FUNCDECL_RPL (fmod, double, (double x, double y), );
1078_GL_CXXALIAS_RPL (fmod, double, (double x, double y)); 1091_GL_CXXALIAS_RPL (fmod, double, (double x, double y));
1079# else 1092# else
1080_GL_CXXALIAS_SYS (fmod, double, (double x, double y)); 1093_GL_CXXALIAS_SYS (fmod, double, (double x, double y));
@@ -1096,12 +1109,12 @@ _GL_WARN_ON_USE (fmod, "fmod has portability problems - "
1096# undef fmodl 1109# undef fmodl
1097# define fmodl rpl_fmodl 1110# define fmodl rpl_fmodl
1098# endif 1111# endif
1099_GL_FUNCDECL_RPL (fmodl, long double, (long double x, long double y)); 1112_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)); 1113_GL_CXXALIAS_RPL (fmodl, long double, (long double x, long double y));
1101# else 1114# else
1102# if !@HAVE_FMODL@ 1115# if !@HAVE_FMODL@
1103# undef fmodl 1116# undef fmodl
1104_GL_FUNCDECL_SYS (fmodl, long double, (long double x, long double y)); 1117_GL_FUNCDECL_SYS (fmodl, long double, (long double x, long double y), );
1105# endif 1118# endif
1106_GL_CXXALIAS_SYS (fmodl, long double, (long double x, long double y)); 1119_GL_CXXALIAS_SYS (fmodl, long double, (long double x, long double y));
1107# endif 1120# endif
@@ -1130,12 +1143,12 @@ _GL_WARN_ON_USE (fmodl, "fmodl is unportable - "
1130# undef frexpf 1143# undef frexpf
1131# define frexpf rpl_frexpf 1144# define frexpf rpl_frexpf
1132# endif 1145# endif
1133_GL_FUNCDECL_RPL (frexpf, float, (float x, int *expptr) _GL_ARG_NONNULL ((2))); 1146_GL_FUNCDECL_RPL (frexpf, float, (float x, int *expptr), _GL_ARG_NONNULL ((2)));
1134_GL_CXXALIAS_RPL (frexpf, float, (float x, int *expptr)); 1147_GL_CXXALIAS_RPL (frexpf, float, (float x, int *expptr));
1135# else 1148# else
1136# if !@HAVE_FREXPF@ 1149# if !@HAVE_FREXPF@
1137# undef frexpf 1150# undef frexpf
1138_GL_FUNCDECL_SYS (frexpf, float, (float x, int *expptr) _GL_ARG_NONNULL ((2))); 1151_GL_FUNCDECL_SYS (frexpf, float, (float x, int *expptr), _GL_ARG_NONNULL ((2)));
1139# endif 1152# endif
1140_GL_CXXALIAS_SYS (frexpf, float, (float x, int *expptr)); 1153_GL_CXXALIAS_SYS (frexpf, float, (float x, int *expptr));
1141# endif 1154# endif
@@ -1163,7 +1176,8 @@ _GL_WARN_ON_USE (frexpf, "frexpf is unportable - "
1163# undef frexp 1176# undef frexp
1164# define frexp rpl_frexp 1177# define frexp rpl_frexp
1165# endif 1178# endif
1166_GL_FUNCDECL_RPL (frexp, double, (double x, int *expptr) _GL_ARG_NONNULL ((2))); 1179_GL_FUNCDECL_RPL (frexp, double, (double x, int *expptr),
1180 _GL_ARG_NONNULL ((2)));
1167_GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr)); 1181_GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr));
1168# else 1182# else
1169_GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr)); 1183_GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr));
@@ -1174,8 +1188,10 @@ _GL_CXXALIASWARN1 (frexp, double, (double x, int *expptr));
1174#elif defined GNULIB_POSIXCHECK 1188#elif defined GNULIB_POSIXCHECK
1175# undef frexp 1189# undef frexp
1176/* Assume frexp is always declared. */ 1190/* Assume frexp is always declared. */
1177_GL_WARN_ON_USE (frexp, "frexp is unportable - " 1191_GL_WARN_ON_USE_CXX (frexp,
1178 "use gnulib module frexp for portability"); 1192 double, double, (double, int *),
1193 "frexp is unportable - "
1194 "use gnulib module frexp for portability");
1179#endif 1195#endif
1180 1196
1181/* Write x as 1197/* Write x as
@@ -1191,12 +1207,12 @@ _GL_WARN_ON_USE (frexp, "frexp is unportable - "
1191# define frexpl rpl_frexpl 1207# define frexpl rpl_frexpl
1192# endif 1208# endif
1193_GL_FUNCDECL_RPL (frexpl, long double, 1209_GL_FUNCDECL_RPL (frexpl, long double,
1194 (long double x, int *expptr) _GL_ARG_NONNULL ((2))); 1210 (long double x, int *expptr), _GL_ARG_NONNULL ((2)));
1195_GL_CXXALIAS_RPL (frexpl, long double, (long double x, int *expptr)); 1211_GL_CXXALIAS_RPL (frexpl, long double, (long double x, int *expptr));
1196#else 1212#else
1197# if !@HAVE_DECL_FREXPL@ 1213# if !@HAVE_DECL_FREXPL@
1198_GL_FUNCDECL_SYS (frexpl, long double, 1214_GL_FUNCDECL_SYS (frexpl, long double,
1199 (long double x, int *expptr) _GL_ARG_NONNULL ((2))); 1215 (long double x, int *expptr), _GL_ARG_NONNULL ((2)));
1200# endif 1216# endif
1201# if @GNULIB_FREXPL@ 1217# if @GNULIB_FREXPL@
1202_GL_CXXALIAS_SYS (frexpl, long double, (long double x, int *expptr)); 1218_GL_CXXALIAS_SYS (frexpl, long double, (long double x, int *expptr));
@@ -1223,11 +1239,11 @@ _GL_WARN_ON_USE (frexpl, "frexpl is unportable - "
1223# undef hypotf 1239# undef hypotf
1224# define hypotf rpl_hypotf 1240# define hypotf rpl_hypotf
1225# endif 1241# endif
1226_GL_FUNCDECL_RPL (hypotf, float, (float x, float y)); 1242_GL_FUNCDECL_RPL (hypotf, float, (float x, float y), );
1227_GL_CXXALIAS_RPL (hypotf, float, (float x, float y)); 1243_GL_CXXALIAS_RPL (hypotf, float, (float x, float y));
1228# else 1244# else
1229# if !@HAVE_HYPOTF@ 1245# if !@HAVE_HYPOTF@
1230_GL_FUNCDECL_SYS (hypotf, float, (float x, float y)); 1246_GL_FUNCDECL_SYS (hypotf, float, (float x, float y), );
1231# endif 1247# endif
1232_GL_CXXALIAS_SYS (hypotf, float, (float x, float y)); 1248_GL_CXXALIAS_SYS (hypotf, float, (float x, float y));
1233# endif 1249# endif
@@ -1249,7 +1265,7 @@ _GL_WARN_ON_USE (hypotf, "hypotf is unportable - "
1249# undef hypot 1265# undef hypot
1250# define hypot rpl_hypot 1266# define hypot rpl_hypot
1251# endif 1267# endif
1252_GL_FUNCDECL_RPL (hypot, double, (double x, double y)); 1268_GL_FUNCDECL_RPL (hypot, double, (double x, double y), );
1253_GL_CXXALIAS_RPL (hypot, double, (double x, double y)); 1269_GL_CXXALIAS_RPL (hypot, double, (double x, double y));
1254# else 1270# else
1255_GL_CXXALIAS_SYS (hypot, double, (double x, double y)); 1271_GL_CXXALIAS_SYS (hypot, double, (double x, double y));
@@ -1272,11 +1288,11 @@ _GL_WARN_ON_USE (hypotf, "hypot has portability problems - "
1272# undef hypotl 1288# undef hypotl
1273# define hypotl rpl_hypotl 1289# define hypotl rpl_hypotl
1274# endif 1290# endif
1275_GL_FUNCDECL_RPL (hypotl, long double, (long double x, long double y)); 1291_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)); 1292_GL_CXXALIAS_RPL (hypotl, long double, (long double x, long double y));
1277# else 1293# else
1278# if !@HAVE_HYPOTL@ 1294# if !@HAVE_HYPOTL@
1279_GL_FUNCDECL_SYS (hypotl, long double, (long double x, long double y)); 1295_GL_FUNCDECL_SYS (hypotl, long double, (long double x, long double y), );
1280# endif 1296# endif
1281_GL_CXXALIAS_SYS (hypotl, long double, (long double x, long double y)); 1297_GL_CXXALIAS_SYS (hypotl, long double, (long double x, long double y));
1282# endif 1298# endif
@@ -1298,11 +1314,11 @@ _GL_WARN_ON_USE (hypotl, "hypotl is unportable - "
1298# undef ilogbf 1314# undef ilogbf
1299# define ilogbf rpl_ilogbf 1315# define ilogbf rpl_ilogbf
1300# endif 1316# endif
1301_GL_FUNCDECL_RPL (ilogbf, int, (float x)); 1317_GL_FUNCDECL_RPL (ilogbf, int, (float x), );
1302_GL_CXXALIAS_RPL (ilogbf, int, (float x)); 1318_GL_CXXALIAS_RPL (ilogbf, int, (float x));
1303# else 1319# else
1304# if !@HAVE_ILOGBF@ 1320# if !@HAVE_ILOGBF@
1305_GL_FUNCDECL_SYS (ilogbf, int, (float x)); 1321_GL_FUNCDECL_SYS (ilogbf, int, (float x), );
1306# endif 1322# endif
1307_GL_CXXALIAS_SYS (ilogbf, int, (float x)); 1323_GL_CXXALIAS_SYS (ilogbf, int, (float x));
1308# endif 1324# endif
@@ -1321,11 +1337,11 @@ _GL_WARN_ON_USE (ilogbf, "ilogbf is unportable - "
1321# undef ilogb 1337# undef ilogb
1322# define ilogb rpl_ilogb 1338# define ilogb rpl_ilogb
1323# endif 1339# endif
1324_GL_FUNCDECL_RPL (ilogb, int, (double x)); 1340_GL_FUNCDECL_RPL (ilogb, int, (double x), );
1325_GL_CXXALIAS_RPL (ilogb, int, (double x)); 1341_GL_CXXALIAS_RPL (ilogb, int, (double x));
1326# else 1342# else
1327# if !@HAVE_ILOGB@ 1343# if !@HAVE_ILOGB@
1328_GL_FUNCDECL_SYS (ilogb, int, (double x)); 1344_GL_FUNCDECL_SYS (ilogb, int, (double x), );
1329# endif 1345# endif
1330_GL_CXXALIAS_SYS (ilogb, int, (double x)); 1346_GL_CXXALIAS_SYS (ilogb, int, (double x));
1331# endif 1347# endif
@@ -1346,12 +1362,12 @@ _GL_WARN_ON_USE (ilogb, "ilogb is unportable - "
1346# undef ilogbl 1362# undef ilogbl
1347# define ilogbl rpl_ilogbl 1363# define ilogbl rpl_ilogbl
1348# endif 1364# endif
1349_GL_FUNCDECL_RPL (ilogbl, int, (long double x)); 1365_GL_FUNCDECL_RPL (ilogbl, int, (long double x), );
1350_GL_CXXALIAS_RPL (ilogbl, int, (long double x)); 1366_GL_CXXALIAS_RPL (ilogbl, int, (long double x));
1351# else 1367# else
1352# if !@HAVE_ILOGBL@ 1368# if !@HAVE_ILOGBL@
1353# undef ilogbl 1369# undef ilogbl
1354_GL_FUNCDECL_SYS (ilogbl, int, (long double x)); 1370_GL_FUNCDECL_SYS (ilogbl, int, (long double x), );
1355# endif 1371# endif
1356_GL_CXXALIAS_SYS (ilogbl, int, (long double x)); 1372_GL_CXXALIAS_SYS (ilogbl, int, (long double x));
1357# endif 1373# endif
@@ -1420,7 +1436,7 @@ _GL_CXXALIASWARN (jn);
1420#if @GNULIB_LDEXPF@ 1436#if @GNULIB_LDEXPF@
1421# if !@HAVE_LDEXPF@ 1437# if !@HAVE_LDEXPF@
1422# undef ldexpf 1438# undef ldexpf
1423_GL_FUNCDECL_SYS (ldexpf, float, (float x, int exp)); 1439_GL_FUNCDECL_SYS (ldexpf, float, (float x, int exp), );
1424# endif 1440# endif
1425_GL_CXXALIAS_SYS (ldexpf, float, (float x, int exp)); 1441_GL_CXXALIAS_SYS (ldexpf, float, (float x, int exp));
1426# if __GLIBC__ >= 2 1442# if __GLIBC__ >= 2
@@ -1441,7 +1457,7 @@ _GL_WARN_ON_USE (ldexpf, "ldexpf is unportable - "
1441# undef ldexp 1457# undef ldexp
1442# define ldexp rpl_ldexp 1458# define ldexp rpl_ldexp
1443# endif 1459# endif
1444_GL_FUNCDECL_RPL (ldexp, double, (double x, int exp)); 1460_GL_FUNCDECL_RPL (ldexp, double, (double x, int exp), );
1445_GL_CXXALIAS_RPL (ldexp, double, (double x, int exp)); 1461_GL_CXXALIAS_RPL (ldexp, double, (double x, int exp));
1446# else 1462# else
1447/* Assume ldexp is always declared. */ 1463/* Assume ldexp is always declared. */
@@ -1453,8 +1469,10 @@ _GL_CXXALIASWARN1 (ldexp, double, (double x, int exp));
1453#elif defined GNULIB_POSIXCHECK 1469#elif defined GNULIB_POSIXCHECK
1454# undef ldexp 1470# undef ldexp
1455/* Assume ldexp is always declared. */ 1471/* Assume ldexp is always declared. */
1456_GL_WARN_ON_USE (ldexp, "ldexp is unportable - " 1472_GL_WARN_ON_USE_CXX (ldexp,
1457 "use gnulib module ldexp for portability"); 1473 double, double, (double, int),
1474 "ldexp is unportable - "
1475 "use gnulib module ldexp for portability");
1458#endif 1476#endif
1459 1477
1460/* Return x * 2^exp. */ 1478/* Return x * 2^exp. */
@@ -1463,11 +1481,11 @@ _GL_WARN_ON_USE (ldexp, "ldexp is unportable - "
1463# undef ldexpl 1481# undef ldexpl
1464# define ldexpl rpl_ldexpl 1482# define ldexpl rpl_ldexpl
1465# endif 1483# endif
1466_GL_FUNCDECL_RPL (ldexpl, long double, (long double x, int exp)); 1484_GL_FUNCDECL_RPL (ldexpl, long double, (long double x, int exp), );
1467_GL_CXXALIAS_RPL (ldexpl, long double, (long double x, int exp)); 1485_GL_CXXALIAS_RPL (ldexpl, long double, (long double x, int exp));
1468#else 1486#else
1469# if !@HAVE_DECL_LDEXPL@ 1487# if !@HAVE_DECL_LDEXPL@
1470_GL_FUNCDECL_SYS (ldexpl, long double, (long double x, int exp)); 1488_GL_FUNCDECL_SYS (ldexpl, long double, (long double x, int exp), );
1471# endif 1489# endif
1472# if @GNULIB_LDEXPL@ 1490# if @GNULIB_LDEXPL@
1473_GL_CXXALIAS_SYS (ldexpl, long double, (long double x, int exp)); 1491_GL_CXXALIAS_SYS (ldexpl, long double, (long double x, int exp));
@@ -1493,12 +1511,12 @@ _GL_WARN_ON_USE (ldexpl, "ldexpl is unportable - "
1493# undef logf 1511# undef logf
1494# define logf rpl_logf 1512# define logf rpl_logf
1495# endif 1513# endif
1496_GL_FUNCDECL_RPL (logf, float, (float x)); 1514_GL_FUNCDECL_RPL (logf, float, (float x), );
1497_GL_CXXALIAS_RPL (logf, float, (float x)); 1515_GL_CXXALIAS_RPL (logf, float, (float x));
1498# else 1516# else
1499# if !@HAVE_LOGF@ 1517# if !@HAVE_LOGF@
1500# undef logf 1518# undef logf
1501_GL_FUNCDECL_SYS (logf, float, (float x)); 1519_GL_FUNCDECL_SYS (logf, float, (float x), );
1502# endif 1520# endif
1503_GL_CXXALIAS_SYS (logf, float, (float x)); 1521_GL_CXXALIAS_SYS (logf, float, (float x));
1504# endif 1522# endif
@@ -1517,7 +1535,7 @@ _GL_WARN_ON_USE (logf, "logf is unportable - "
1517# undef log 1535# undef log
1518# define log rpl_log 1536# define log rpl_log
1519# endif 1537# endif
1520_GL_FUNCDECL_RPL (log, double, (double x)); 1538_GL_FUNCDECL_RPL (log, double, (double x), );
1521_GL_CXXALIAS_RPL (log, double, (double x)); 1539_GL_CXXALIAS_RPL (log, double, (double x));
1522# else 1540# else
1523_GL_CXXALIAS_SYS (log, double, (double x)); 1541_GL_CXXALIAS_SYS (log, double, (double x));
@@ -1539,12 +1557,12 @@ _GL_WARN_ON_USE (log, "log has portability problems - "
1539# undef logl 1557# undef logl
1540# define logl rpl_logl 1558# define logl rpl_logl
1541# endif 1559# endif
1542_GL_FUNCDECL_RPL (logl, long double, (long double x)); 1560_GL_FUNCDECL_RPL (logl, long double, (long double x), );
1543_GL_CXXALIAS_RPL (logl, long double, (long double x)); 1561_GL_CXXALIAS_RPL (logl, long double, (long double x));
1544# else 1562# else
1545# if !@HAVE_LOGL@ || !@HAVE_DECL_LOGL@ 1563# if !@HAVE_LOGL@ || !@HAVE_DECL_LOGL@
1546# undef logl 1564# undef logl
1547_GL_FUNCDECL_SYS (logl, long double, (long double x)); 1565_GL_FUNCDECL_SYS (logl, long double, (long double x), );
1548# endif 1566# endif
1549_GL_CXXALIAS_SYS (logl, long double, (long double x)); 1567_GL_CXXALIAS_SYS (logl, long double, (long double x));
1550# endif 1568# endif
@@ -1566,12 +1584,12 @@ _GL_WARN_ON_USE (logl, "logl is unportable - "
1566# undef log10f 1584# undef log10f
1567# define log10f rpl_log10f 1585# define log10f rpl_log10f
1568# endif 1586# endif
1569_GL_FUNCDECL_RPL (log10f, float, (float x)); 1587_GL_FUNCDECL_RPL (log10f, float, (float x), );
1570_GL_CXXALIAS_RPL (log10f, float, (float x)); 1588_GL_CXXALIAS_RPL (log10f, float, (float x));
1571# else 1589# else
1572# if !@HAVE_LOG10F@ 1590# if !@HAVE_LOG10F@
1573# undef log10f 1591# undef log10f
1574_GL_FUNCDECL_SYS (log10f, float, (float x)); 1592_GL_FUNCDECL_SYS (log10f, float, (float x), );
1575# endif 1593# endif
1576_GL_CXXALIAS_SYS (log10f, float, (float x)); 1594_GL_CXXALIAS_SYS (log10f, float, (float x));
1577# endif 1595# endif
@@ -1590,7 +1608,7 @@ _GL_WARN_ON_USE (log10f, "log10f is unportable - "
1590# undef log10 1608# undef log10
1591# define log10 rpl_log10 1609# define log10 rpl_log10
1592# endif 1610# endif
1593_GL_FUNCDECL_RPL (log10, double, (double x)); 1611_GL_FUNCDECL_RPL (log10, double, (double x), );
1594_GL_CXXALIAS_RPL (log10, double, (double x)); 1612_GL_CXXALIAS_RPL (log10, double, (double x));
1595# else 1613# else
1596_GL_CXXALIAS_SYS (log10, double, (double x)); 1614_GL_CXXALIAS_SYS (log10, double, (double x));
@@ -1612,12 +1630,12 @@ _GL_WARN_ON_USE (log10, "log10 has portability problems - "
1612# undef log10l 1630# undef log10l
1613# define log10l rpl_log10l 1631# define log10l rpl_log10l
1614# endif 1632# endif
1615_GL_FUNCDECL_RPL (log10l, long double, (long double x)); 1633_GL_FUNCDECL_RPL (log10l, long double, (long double x), );
1616_GL_CXXALIAS_RPL (log10l, long double, (long double x)); 1634_GL_CXXALIAS_RPL (log10l, long double, (long double x));
1617# else 1635# else
1618# if !@HAVE_LOG10L@ || !@HAVE_DECL_LOG10L@ 1636# if !@HAVE_LOG10L@ || !@HAVE_DECL_LOG10L@
1619# undef log10l 1637# undef log10l
1620_GL_FUNCDECL_SYS (log10l, long double, (long double x)); 1638_GL_FUNCDECL_SYS (log10l, long double, (long double x), );
1621# endif 1639# endif
1622_GL_CXXALIAS_SYS (log10l, long double, (long double x)); 1640_GL_CXXALIAS_SYS (log10l, long double, (long double x));
1623# endif 1641# endif
@@ -1639,11 +1657,11 @@ _GL_WARN_ON_USE (log10l, "log10l is unportable - "
1639# undef log1pf 1657# undef log1pf
1640# define log1pf rpl_log1pf 1658# define log1pf rpl_log1pf
1641# endif 1659# endif
1642_GL_FUNCDECL_RPL (log1pf, float, (float x)); 1660_GL_FUNCDECL_RPL (log1pf, float, (float x), );
1643_GL_CXXALIAS_RPL (log1pf, float, (float x)); 1661_GL_CXXALIAS_RPL (log1pf, float, (float x));
1644# else 1662# else
1645# if !@HAVE_LOG1PF@ 1663# if !@HAVE_LOG1PF@
1646_GL_FUNCDECL_SYS (log1pf, float, (float x)); 1664_GL_FUNCDECL_SYS (log1pf, float, (float x), );
1647# endif 1665# endif
1648_GL_CXXALIAS_SYS (log1pf, float, (float x)); 1666_GL_CXXALIAS_SYS (log1pf, float, (float x));
1649# endif 1667# endif
@@ -1662,11 +1680,11 @@ _GL_WARN_ON_USE (log1pf, "log1pf is unportable - "
1662# undef log1p 1680# undef log1p
1663# define log1p rpl_log1p 1681# define log1p rpl_log1p
1664# endif 1682# endif
1665_GL_FUNCDECL_RPL (log1p, double, (double x)); 1683_GL_FUNCDECL_RPL (log1p, double, (double x), );
1666_GL_CXXALIAS_RPL (log1p, double, (double x)); 1684_GL_CXXALIAS_RPL (log1p, double, (double x));
1667# else 1685# else
1668# if !@HAVE_LOG1P@ 1686# if !@HAVE_LOG1P@
1669_GL_FUNCDECL_SYS (log1p, double, (double x)); 1687_GL_FUNCDECL_SYS (log1p, double, (double x), );
1670# endif 1688# endif
1671_GL_CXXALIAS_SYS (log1p, double, (double x)); 1689_GL_CXXALIAS_SYS (log1p, double, (double x));
1672# endif 1690# endif
@@ -1687,11 +1705,11 @@ _GL_WARN_ON_USE (log1p, "log1p has portability problems - "
1687# undef log1pl 1705# undef log1pl
1688# define log1pl rpl_log1pl 1706# define log1pl rpl_log1pl
1689# endif 1707# endif
1690_GL_FUNCDECL_RPL (log1pl, long double, (long double x)); 1708_GL_FUNCDECL_RPL (log1pl, long double, (long double x), );
1691_GL_CXXALIAS_RPL (log1pl, long double, (long double x)); 1709_GL_CXXALIAS_RPL (log1pl, long double, (long double x));
1692# else 1710# else
1693# if !@HAVE_LOG1PL@ 1711# if !@HAVE_LOG1PL@
1694_GL_FUNCDECL_SYS (log1pl, long double, (long double x)); 1712_GL_FUNCDECL_SYS (log1pl, long double, (long double x), );
1695# endif 1713# endif
1696_GL_CXXALIAS_SYS (log1pl, long double, (long double x)); 1714_GL_CXXALIAS_SYS (log1pl, long double, (long double x));
1697# endif 1715# endif
@@ -1713,12 +1731,12 @@ _GL_WARN_ON_USE (log1pl, "log1pl has portability problems - "
1713# undef log2f 1731# undef log2f
1714# define log2f rpl_log2f 1732# define log2f rpl_log2f
1715# endif 1733# endif
1716_GL_FUNCDECL_RPL (log2f, float, (float x)); 1734_GL_FUNCDECL_RPL (log2f, float, (float x), );
1717_GL_CXXALIAS_RPL (log2f, float, (float x)); 1735_GL_CXXALIAS_RPL (log2f, float, (float x));
1718# else 1736# else
1719# if !@HAVE_DECL_LOG2F@ 1737# if !@HAVE_DECL_LOG2F@
1720# undef log2f 1738# undef log2f
1721_GL_FUNCDECL_SYS (log2f, float, (float x)); 1739_GL_FUNCDECL_SYS (log2f, float, (float x), );
1722# endif 1740# endif
1723_GL_CXXALIAS_SYS (log2f, float, (float x)); 1741_GL_CXXALIAS_SYS (log2f, float, (float x));
1724# endif 1742# endif
@@ -1739,12 +1757,12 @@ _GL_WARN_ON_USE (log2f, "log2f is unportable - "
1739# undef log2 1757# undef log2
1740# define log2 rpl_log2 1758# define log2 rpl_log2
1741# endif 1759# endif
1742_GL_FUNCDECL_RPL (log2, double, (double x)); 1760_GL_FUNCDECL_RPL (log2, double, (double x), );
1743_GL_CXXALIAS_RPL (log2, double, (double x)); 1761_GL_CXXALIAS_RPL (log2, double, (double x));
1744# else 1762# else
1745# if !@HAVE_DECL_LOG2@ 1763# if !@HAVE_DECL_LOG2@
1746# undef log2 1764# undef log2
1747_GL_FUNCDECL_SYS (log2, double, (double x)); 1765_GL_FUNCDECL_SYS (log2, double, (double x), );
1748# endif 1766# endif
1749_GL_CXXALIAS_SYS (log2, double, (double x)); 1767_GL_CXXALIAS_SYS (log2, double, (double x));
1750# endif 1768# endif
@@ -1765,11 +1783,11 @@ _GL_WARN_ON_USE (log2, "log2 is unportable - "
1765# undef log2l 1783# undef log2l
1766# define log2l rpl_log2l 1784# define log2l rpl_log2l
1767# endif 1785# endif
1768_GL_FUNCDECL_RPL (log2l, long double, (long double x)); 1786_GL_FUNCDECL_RPL (log2l, long double, (long double x), );
1769_GL_CXXALIAS_RPL (log2l, long double, (long double x)); 1787_GL_CXXALIAS_RPL (log2l, long double, (long double x));
1770# else 1788# else
1771# if !@HAVE_DECL_LOG2L@ 1789# if !@HAVE_DECL_LOG2L@
1772_GL_FUNCDECL_SYS (log2l, long double, (long double x)); 1790_GL_FUNCDECL_SYS (log2l, long double, (long double x), );
1773# endif 1791# endif
1774_GL_CXXALIAS_SYS (log2l, long double, (long double x)); 1792_GL_CXXALIAS_SYS (log2l, long double, (long double x));
1775# endif 1793# endif
@@ -1791,11 +1809,11 @@ _GL_WARN_ON_USE (log2l, "log2l is unportable - "
1791# undef logbf 1809# undef logbf
1792# define logbf rpl_logbf 1810# define logbf rpl_logbf
1793# endif 1811# endif
1794_GL_FUNCDECL_RPL (logbf, float, (float x)); 1812_GL_FUNCDECL_RPL (logbf, float, (float x), );
1795_GL_CXXALIAS_RPL (logbf, float, (float x)); 1813_GL_CXXALIAS_RPL (logbf, float, (float x));
1796# else 1814# else
1797# if !@HAVE_LOGBF@ 1815# if !@HAVE_LOGBF@
1798_GL_FUNCDECL_SYS (logbf, float, (float x)); 1816_GL_FUNCDECL_SYS (logbf, float, (float x), );
1799# endif 1817# endif
1800_GL_CXXALIAS_SYS (logbf, float, (float x)); 1818_GL_CXXALIAS_SYS (logbf, float, (float x));
1801# endif 1819# endif
@@ -1814,11 +1832,11 @@ _GL_WARN_ON_USE (logbf, "logbf is unportable - "
1814# undef logb 1832# undef logb
1815# define logb rpl_logb 1833# define logb rpl_logb
1816# endif 1834# endif
1817_GL_FUNCDECL_RPL (logb, double, (double x)); 1835_GL_FUNCDECL_RPL (logb, double, (double x), );
1818_GL_CXXALIAS_RPL (logb, double, (double x)); 1836_GL_CXXALIAS_RPL (logb, double, (double x));
1819# else 1837# else
1820# if !@HAVE_DECL_LOGB@ 1838# if !@HAVE_DECL_LOGB@
1821_GL_FUNCDECL_SYS (logb, double, (double x)); 1839_GL_FUNCDECL_SYS (logb, double, (double x), );
1822# endif 1840# endif
1823_GL_CXXALIAS_SYS (logb, double, (double x)); 1841_GL_CXXALIAS_SYS (logb, double, (double x));
1824# endif 1842# endif
@@ -1839,11 +1857,11 @@ _GL_WARN_ON_USE (logb, "logb is unportable - "
1839# undef logbl 1857# undef logbl
1840# define logbl rpl_logbl 1858# define logbl rpl_logbl
1841# endif 1859# endif
1842_GL_FUNCDECL_RPL (logbl, long double, (long double x)); 1860_GL_FUNCDECL_RPL (logbl, long double, (long double x), );
1843_GL_CXXALIAS_RPL (logbl, long double, (long double x)); 1861_GL_CXXALIAS_RPL (logbl, long double, (long double x));
1844# else 1862# else
1845# if !@HAVE_LOGBL@ 1863# if !@HAVE_LOGBL@
1846_GL_FUNCDECL_SYS (logbl, long double, (long double x)); 1864_GL_FUNCDECL_SYS (logbl, long double, (long double x), );
1847# endif 1865# endif
1848_GL_CXXALIAS_SYS (logbl, long double, (long double x)); 1866_GL_CXXALIAS_SYS (logbl, long double, (long double x));
1849# endif 1867# endif
@@ -1859,18 +1877,67 @@ _GL_WARN_ON_USE (logbl, "logbl is unportable - "
1859#endif 1877#endif
1860 1878
1861 1879
1880#if @GNULIB_LOGP1F@
1881# if !@HAVE_LOGP1F@
1882_GL_FUNCDECL_SYS (logp1f, float, (float x), );
1883# endif
1884_GL_CXXALIAS_SYS (logp1f, float, (float x));
1885# if __GLIBC__ >= 2
1886_GL_CXXALIASWARN1 (logp1f, float, (float x));
1887# endif
1888#elif defined GNULIB_POSIXCHECK
1889# undef logp1f
1890# if HAVE_RAW_DECL_LOGP1F
1891_GL_WARN_ON_USE (logp1f, "logp1f is unportable - "
1892 "use gnulib module logp1f for portability");
1893# endif
1894#endif
1895
1896#if @GNULIB_LOGP1@
1897# if !@HAVE_LOGP1@
1898_GL_FUNCDECL_SYS (logp1, double, (double x), );
1899# endif
1900_GL_CXXALIAS_SYS (logp1, double, (double x));
1901# if __GLIBC__ >= 2
1902_GL_CXXALIASWARN1 (logp1, double, (double x));
1903# endif
1904#elif defined GNULIB_POSIXCHECK
1905# undef logp1
1906# if HAVE_RAW_DECL_LOGP1
1907_GL_WARN_ON_USE (logp1, "logp1 is unportable - "
1908 "use gnulib module logp1 for portability");
1909# endif
1910#endif
1911
1912#if @GNULIB_LOGP1L@
1913# if !@HAVE_LOGP1L@
1914_GL_FUNCDECL_SYS (logp1l, long double, (long double x), );
1915# endif
1916_GL_CXXALIAS_SYS (logp1l, long double, (long double x));
1917# if __GLIBC__ >= 2
1918_GL_CXXALIASWARN1 (logp1l, long double, (long double x));
1919# endif
1920#elif defined GNULIB_POSIXCHECK
1921# undef logp1l
1922# if HAVE_RAW_DECL_LOGP1L
1923_GL_WARN_ON_USE (logp1l, "logp1l is unportable - "
1924 "use gnulib module logp1l for portability");
1925# endif
1926#endif
1927
1928
1862#if @GNULIB_MODFF@ 1929#if @GNULIB_MODFF@
1863# if @REPLACE_MODFF@ 1930# if @REPLACE_MODFF@
1864# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1931# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1865# undef modff 1932# undef modff
1866# define modff rpl_modff 1933# define modff rpl_modff
1867# endif 1934# endif
1868_GL_FUNCDECL_RPL (modff, float, (float x, float *iptr) _GL_ARG_NONNULL ((2))); 1935_GL_FUNCDECL_RPL (modff, float, (float x, float *iptr), _GL_ARG_NONNULL ((2)));
1869_GL_CXXALIAS_RPL (modff, float, (float x, float *iptr)); 1936_GL_CXXALIAS_RPL (modff, float, (float x, float *iptr));
1870# else 1937# else
1871# if !@HAVE_MODFF@ 1938# if !@HAVE_MODFF@
1872# undef modff 1939# undef modff
1873_GL_FUNCDECL_SYS (modff, float, (float x, float *iptr) _GL_ARG_NONNULL ((2))); 1940_GL_FUNCDECL_SYS (modff, float, (float x, float *iptr), _GL_ARG_NONNULL ((2)));
1874# endif 1941# endif
1875_GL_CXXALIAS_SYS (modff, float, (float x, float *iptr)); 1942_GL_CXXALIAS_SYS (modff, float, (float x, float *iptr));
1876# endif 1943# endif
@@ -1889,7 +1956,8 @@ _GL_WARN_ON_USE (modff, "modff is unportable - "
1889# undef modf 1956# undef modf
1890# define modf rpl_modf 1957# define modf rpl_modf
1891# endif 1958# endif
1892_GL_FUNCDECL_RPL (modf, double, (double x, double *iptr) _GL_ARG_NONNULL ((2))); 1959_GL_FUNCDECL_RPL (modf, double, (double x, double *iptr),
1960 _GL_ARG_NONNULL ((2)));
1893_GL_CXXALIAS_RPL (modf, double, (double x, double *iptr)); 1961_GL_CXXALIAS_RPL (modf, double, (double x, double *iptr));
1894# else 1962# else
1895_GL_CXXALIAS_SYS (modf, double, (double x, double *iptr)); 1963_GL_CXXALIAS_SYS (modf, double, (double x, double *iptr));
@@ -1911,13 +1979,13 @@ _GL_WARN_ON_USE (modf, "modf has portability problems - "
1911# undef modfl 1979# undef modfl
1912# define modfl rpl_modfl 1980# define modfl rpl_modfl
1913# endif 1981# endif
1914_GL_FUNCDECL_RPL (modfl, long double, (long double x, long double *iptr) 1982_GL_FUNCDECL_RPL (modfl, long double, (long double x, long double *iptr),
1915 _GL_ARG_NONNULL ((2))); 1983 _GL_ARG_NONNULL ((2)));
1916_GL_CXXALIAS_RPL (modfl, long double, (long double x, long double *iptr)); 1984_GL_CXXALIAS_RPL (modfl, long double, (long double x, long double *iptr));
1917# else 1985# else
1918# if !@HAVE_MODFL@ 1986# if !@HAVE_MODFL@
1919# undef modfl 1987# undef modfl
1920_GL_FUNCDECL_SYS (modfl, long double, (long double x, long double *iptr) 1988_GL_FUNCDECL_SYS (modfl, long double, (long double x, long double *iptr),
1921 _GL_ARG_NONNULL ((2))); 1989 _GL_ARG_NONNULL ((2)));
1922# endif 1990# endif
1923_GL_CXXALIAS_SYS (modfl, long double, (long double x, long double *iptr)); 1991_GL_CXXALIAS_SYS (modfl, long double, (long double x, long double *iptr));
@@ -1937,7 +2005,7 @@ _GL_WARN_ON_USE (modfl, "modfl is unportable - "
1937#if @GNULIB_POWF@ 2005#if @GNULIB_POWF@
1938# if !@HAVE_POWF@ 2006# if !@HAVE_POWF@
1939# undef powf 2007# undef powf
1940_GL_FUNCDECL_SYS (powf, float, (float x, float y)); 2008_GL_FUNCDECL_SYS (powf, float, (float x, float y), );
1941# endif 2009# endif
1942_GL_CXXALIAS_SYS (powf, float, (float x, float y)); 2010_GL_CXXALIAS_SYS (powf, float, (float x, float y));
1943_GL_CXXALIASWARN (powf); 2011_GL_CXXALIASWARN (powf);
@@ -1956,11 +2024,11 @@ _GL_WARN_ON_USE (powf, "powf is unportable - "
1956# undef remainderf 2024# undef remainderf
1957# define remainderf rpl_remainderf 2025# define remainderf rpl_remainderf
1958# endif 2026# endif
1959_GL_FUNCDECL_RPL (remainderf, float, (float x, float y)); 2027_GL_FUNCDECL_RPL (remainderf, float, (float x, float y), );
1960_GL_CXXALIAS_RPL (remainderf, float, (float x, float y)); 2028_GL_CXXALIAS_RPL (remainderf, float, (float x, float y));
1961# else 2029# else
1962# if !@HAVE_REMAINDERF@ 2030# if !@HAVE_REMAINDERF@
1963_GL_FUNCDECL_SYS (remainderf, float, (float x, float y)); 2031_GL_FUNCDECL_SYS (remainderf, float, (float x, float y), );
1964# endif 2032# endif
1965_GL_CXXALIAS_SYS (remainderf, float, (float x, float y)); 2033_GL_CXXALIAS_SYS (remainderf, float, (float x, float y));
1966# endif 2034# endif
@@ -1979,11 +2047,11 @@ _GL_WARN_ON_USE (remainderf, "remainderf is unportable - "
1979# undef remainder 2047# undef remainder
1980# define remainder rpl_remainder 2048# define remainder rpl_remainder
1981# endif 2049# endif
1982_GL_FUNCDECL_RPL (remainder, double, (double x, double y)); 2050_GL_FUNCDECL_RPL (remainder, double, (double x, double y), );
1983_GL_CXXALIAS_RPL (remainder, double, (double x, double y)); 2051_GL_CXXALIAS_RPL (remainder, double, (double x, double y));
1984# else 2052# else
1985# if !@HAVE_REMAINDER@ || !@HAVE_DECL_REMAINDER@ 2053# if !@HAVE_REMAINDER@ || !@HAVE_DECL_REMAINDER@
1986_GL_FUNCDECL_SYS (remainder, double, (double x, double y)); 2054_GL_FUNCDECL_SYS (remainder, double, (double x, double y), );
1987# endif 2055# endif
1988_GL_CXXALIAS_SYS (remainder, double, (double x, double y)); 2056_GL_CXXALIAS_SYS (remainder, double, (double x, double y));
1989# endif 2057# endif
@@ -2004,13 +2072,13 @@ _GL_WARN_ON_USE (remainder, "remainder is unportable - "
2004# undef remainderl 2072# undef remainderl
2005# define remainderl rpl_remainderl 2073# define remainderl rpl_remainderl
2006# endif 2074# endif
2007_GL_FUNCDECL_RPL (remainderl, long double, (long double x, long double y)); 2075_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)); 2076_GL_CXXALIAS_RPL (remainderl, long double, (long double x, long double y));
2009# else 2077# else
2010# if !@HAVE_DECL_REMAINDERL@ 2078# if !@HAVE_DECL_REMAINDERL@
2011# undef remainderl 2079# undef remainderl
2012# if !(defined __cplusplus && defined _AIX) 2080# if !(defined __cplusplus && defined _AIX)
2013_GL_FUNCDECL_SYS (remainderl, long double, (long double x, long double y)); 2081_GL_FUNCDECL_SYS (remainderl, long double, (long double x, long double y), );
2014# endif 2082# endif
2015# endif 2083# endif
2016_GL_CXXALIAS_SYS (remainderl, long double, (long double x, long double y)); 2084_GL_CXXALIAS_SYS (remainderl, long double, (long double x, long double y));
@@ -2029,7 +2097,7 @@ _GL_WARN_ON_USE (remainderl, "remainderl is unportable - "
2029 2097
2030#if @GNULIB_RINTF@ 2098#if @GNULIB_RINTF@
2031# if !@HAVE_DECL_RINTF@ 2099# if !@HAVE_DECL_RINTF@
2032_GL_FUNCDECL_SYS (rintf, float, (float x)); 2100_GL_FUNCDECL_SYS (rintf, float, (float x), );
2033# endif 2101# endif
2034_GL_CXXALIAS_SYS (rintf, float, (float x)); 2102_GL_CXXALIAS_SYS (rintf, float, (float x));
2035_GL_CXXALIASWARN (rintf); 2103_GL_CXXALIASWARN (rintf);
@@ -2043,7 +2111,7 @@ _GL_WARN_ON_USE (rintf, "rintf is unportable - "
2043 2111
2044#if @GNULIB_RINT@ 2112#if @GNULIB_RINT@
2045# if !@HAVE_RINT@ 2113# if !@HAVE_RINT@
2046_GL_FUNCDECL_SYS (rint, double, (double x)); 2114_GL_FUNCDECL_SYS (rint, double, (double x), );
2047# endif 2115# endif
2048_GL_CXXALIAS_SYS (rint, double, (double x)); 2116_GL_CXXALIAS_SYS (rint, double, (double x));
2049# if __GLIBC__ >= 2 2117# if __GLIBC__ >= 2
@@ -2063,11 +2131,11 @@ _GL_WARN_ON_USE (rint, "rint is unportable - "
2063# undef rintl 2131# undef rintl
2064# define rintl rpl_rintl 2132# define rintl rpl_rintl
2065# endif 2133# endif
2066_GL_FUNCDECL_RPL (rintl, long double, (long double x)); 2134_GL_FUNCDECL_RPL (rintl, long double, (long double x), );
2067_GL_CXXALIAS_RPL (rintl, long double, (long double x)); 2135_GL_CXXALIAS_RPL (rintl, long double, (long double x));
2068# else 2136# else
2069# if !@HAVE_RINTL@ 2137# if !@HAVE_RINTL@
2070_GL_FUNCDECL_SYS (rintl, long double, (long double x)); 2138_GL_FUNCDECL_SYS (rintl, long double, (long double x), );
2071# endif 2139# endif
2072_GL_CXXALIAS_SYS (rintl, long double, (long double x)); 2140_GL_CXXALIAS_SYS (rintl, long double, (long double x));
2073# endif 2141# endif
@@ -2089,11 +2157,11 @@ _GL_WARN_ON_USE (rintl, "rintl is unportable - "
2089# undef roundf 2157# undef roundf
2090# define roundf rpl_roundf 2158# define roundf rpl_roundf
2091# endif 2159# endif
2092_GL_FUNCDECL_RPL (roundf, float, (float x)); 2160_GL_FUNCDECL_RPL (roundf, float, (float x), );
2093_GL_CXXALIAS_RPL (roundf, float, (float x)); 2161_GL_CXXALIAS_RPL (roundf, float, (float x));
2094# else 2162# else
2095# if !@HAVE_DECL_ROUNDF@ 2163# if !@HAVE_DECL_ROUNDF@
2096_GL_FUNCDECL_SYS (roundf, float, (float x)); 2164_GL_FUNCDECL_SYS (roundf, float, (float x), );
2097# endif 2165# endif
2098_GL_CXXALIAS_SYS (roundf, float, (float x)); 2166_GL_CXXALIAS_SYS (roundf, float, (float x));
2099# endif 2167# endif
@@ -2112,11 +2180,11 @@ _GL_WARN_ON_USE (roundf, "roundf is unportable - "
2112# undef round 2180# undef round
2113# define round rpl_round 2181# define round rpl_round
2114# endif 2182# endif
2115_GL_FUNCDECL_RPL (round, double, (double x)); 2183_GL_FUNCDECL_RPL (round, double, (double x), );
2116_GL_CXXALIAS_RPL (round, double, (double x)); 2184_GL_CXXALIAS_RPL (round, double, (double x));
2117# else 2185# else
2118# if !@HAVE_DECL_ROUND@ 2186# if !@HAVE_DECL_ROUND@
2119_GL_FUNCDECL_SYS (round, double, (double x)); 2187_GL_FUNCDECL_SYS (round, double, (double x), );
2120# endif 2188# endif
2121_GL_CXXALIAS_SYS (round, double, (double x)); 2189_GL_CXXALIAS_SYS (round, double, (double x));
2122# endif 2190# endif
@@ -2137,13 +2205,13 @@ _GL_WARN_ON_USE (round, "round is unportable - "
2137# undef roundl 2205# undef roundl
2138# define roundl rpl_roundl 2206# define roundl rpl_roundl
2139# endif 2207# endif
2140_GL_FUNCDECL_RPL (roundl, long double, (long double x)); 2208_GL_FUNCDECL_RPL (roundl, long double, (long double x), );
2141_GL_CXXALIAS_RPL (roundl, long double, (long double x)); 2209_GL_CXXALIAS_RPL (roundl, long double, (long double x));
2142# else 2210# else
2143# if !@HAVE_DECL_ROUNDL@ 2211# if !@HAVE_DECL_ROUNDL@
2144# undef roundl 2212# undef roundl
2145# if !(defined __cplusplus && defined _AIX) 2213# if !(defined __cplusplus && defined _AIX)
2146_GL_FUNCDECL_SYS (roundl, long double, (long double x)); 2214_GL_FUNCDECL_SYS (roundl, long double, (long double x), );
2147# endif 2215# endif
2148# endif 2216# endif
2149_GL_CXXALIAS_SYS (roundl, long double, (long double x)); 2217_GL_CXXALIAS_SYS (roundl, long double, (long double x));
@@ -2166,12 +2234,12 @@ _GL_WARN_ON_USE (roundl, "roundl is unportable - "
2166# undef sinf 2234# undef sinf
2167# define sinf rpl_sinf 2235# define sinf rpl_sinf
2168# endif 2236# endif
2169_GL_FUNCDECL_RPL (sinf, float, (float x)); 2237_GL_FUNCDECL_RPL (sinf, float, (float x), );
2170_GL_CXXALIAS_RPL (sinf, float, (float x)); 2238_GL_CXXALIAS_RPL (sinf, float, (float x));
2171# else 2239# else
2172# if !@HAVE_SINF@ 2240# if !@HAVE_SINF@
2173# undef sinf 2241# undef sinf
2174_GL_FUNCDECL_SYS (sinf, float, (float x)); 2242_GL_FUNCDECL_SYS (sinf, float, (float x), );
2175# endif 2243# endif
2176_GL_CXXALIAS_SYS (sinf, float, (float x)); 2244_GL_CXXALIAS_SYS (sinf, float, (float x));
2177# endif 2245# endif
@@ -2185,11 +2253,20 @@ _GL_WARN_ON_USE (sinf, "sinf is unportable - "
2185#endif 2253#endif
2186 2254
2187#if @GNULIB_SINL@ 2255#if @GNULIB_SINL@
2188# if !@HAVE_SINL@ || !@HAVE_DECL_SINL@ 2256# if @REPLACE_SINL@
2189# undef sinl 2257# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2190_GL_FUNCDECL_SYS (sinl, long double, (long double x)); 2258# undef sinl
2191# endif 2259# define sinl rpl_sinl
2260# endif
2261_GL_FUNCDECL_RPL (sinl, long double, (long double x), );
2262_GL_CXXALIAS_RPL (sinl, long double, (long double x));
2263# else
2264# if !@HAVE_SINL@ || !@HAVE_DECL_SINL@
2265# undef sinl
2266_GL_FUNCDECL_SYS (sinl, long double, (long double x), );
2267# endif
2192_GL_CXXALIAS_SYS (sinl, long double, (long double x)); 2268_GL_CXXALIAS_SYS (sinl, long double, (long double x));
2269# endif
2193# if __GLIBC__ >= 2 2270# if __GLIBC__ >= 2
2194_GL_CXXALIASWARN (sinl); 2271_GL_CXXALIASWARN (sinl);
2195# endif 2272# endif
@@ -2208,12 +2285,12 @@ _GL_WARN_ON_USE (sinl, "sinl is unportable - "
2208# undef sinhf 2285# undef sinhf
2209# define sinhf rpl_sinhf 2286# define sinhf rpl_sinhf
2210# endif 2287# endif
2211_GL_FUNCDECL_RPL (sinhf, float, (float x)); 2288_GL_FUNCDECL_RPL (sinhf, float, (float x), );
2212_GL_CXXALIAS_RPL (sinhf, float, (float x)); 2289_GL_CXXALIAS_RPL (sinhf, float, (float x));
2213# else 2290# else
2214# if !@HAVE_SINHF@ 2291# if !@HAVE_SINHF@
2215# undef sinhf 2292# undef sinhf
2216_GL_FUNCDECL_SYS (sinhf, float, (float x)); 2293_GL_FUNCDECL_SYS (sinhf, float, (float x), );
2217# endif 2294# endif
2218_GL_CXXALIAS_SYS (sinhf, float, (float x)); 2295_GL_CXXALIAS_SYS (sinhf, float, (float x));
2219# endif 2296# endif
@@ -2233,12 +2310,12 @@ _GL_WARN_ON_USE (sinhf, "sinhf is unportable - "
2233# undef sqrtf 2310# undef sqrtf
2234# define sqrtf rpl_sqrtf 2311# define sqrtf rpl_sqrtf
2235# endif 2312# endif
2236_GL_FUNCDECL_RPL (sqrtf, float, (float x)); 2313_GL_FUNCDECL_RPL (sqrtf, float, (float x), );
2237_GL_CXXALIAS_RPL (sqrtf, float, (float x)); 2314_GL_CXXALIAS_RPL (sqrtf, float, (float x));
2238# else 2315# else
2239# if !@HAVE_SQRTF@ 2316# if !@HAVE_SQRTF@
2240# undef sqrtf 2317# undef sqrtf
2241_GL_FUNCDECL_SYS (sqrtf, float, (float x)); 2318_GL_FUNCDECL_SYS (sqrtf, float, (float x), );
2242# endif 2319# endif
2243_GL_CXXALIAS_SYS (sqrtf, float, (float x)); 2320_GL_CXXALIAS_SYS (sqrtf, float, (float x));
2244# endif 2321# endif
@@ -2257,12 +2334,12 @@ _GL_WARN_ON_USE (sqrtf, "sqrtf is unportable - "
2257# undef sqrtl 2334# undef sqrtl
2258# define sqrtl rpl_sqrtl 2335# define sqrtl rpl_sqrtl
2259# endif 2336# endif
2260_GL_FUNCDECL_RPL (sqrtl, long double, (long double x)); 2337_GL_FUNCDECL_RPL (sqrtl, long double, (long double x), );
2261_GL_CXXALIAS_RPL (sqrtl, long double, (long double x)); 2338_GL_CXXALIAS_RPL (sqrtl, long double, (long double x));
2262# else 2339# else
2263# if !@HAVE_SQRTL@ || !@HAVE_DECL_SQRTL@ 2340# if !@HAVE_SQRTL@ || !@HAVE_DECL_SQRTL@
2264# undef sqrtl 2341# undef sqrtl
2265_GL_FUNCDECL_SYS (sqrtl, long double, (long double x)); 2342_GL_FUNCDECL_SYS (sqrtl, long double, (long double x), );
2266# endif 2343# endif
2267_GL_CXXALIAS_SYS (sqrtl, long double, (long double x)); 2344_GL_CXXALIAS_SYS (sqrtl, long double, (long double x));
2268# endif 2345# endif
@@ -2284,12 +2361,12 @@ _GL_WARN_ON_USE (sqrtl, "sqrtl is unportable - "
2284# undef tanf 2361# undef tanf
2285# define tanf rpl_tanf 2362# define tanf rpl_tanf
2286# endif 2363# endif
2287_GL_FUNCDECL_RPL (tanf, float, (float x)); 2364_GL_FUNCDECL_RPL (tanf, float, (float x), );
2288_GL_CXXALIAS_RPL (tanf, float, (float x)); 2365_GL_CXXALIAS_RPL (tanf, float, (float x));
2289# else 2366# else
2290# if !@HAVE_TANF@ 2367# if !@HAVE_TANF@
2291# undef tanf 2368# undef tanf
2292_GL_FUNCDECL_SYS (tanf, float, (float x)); 2369_GL_FUNCDECL_SYS (tanf, float, (float x), );
2293# endif 2370# endif
2294_GL_CXXALIAS_SYS (tanf, float, (float x)); 2371_GL_CXXALIAS_SYS (tanf, float, (float x));
2295# endif 2372# endif
@@ -2305,7 +2382,7 @@ _GL_WARN_ON_USE (tanf, "tanf is unportable - "
2305#if @GNULIB_TANL@ 2382#if @GNULIB_TANL@
2306# if !@HAVE_TANL@ || !@HAVE_DECL_TANL@ 2383# if !@HAVE_TANL@ || !@HAVE_DECL_TANL@
2307# undef tanl 2384# undef tanl
2308_GL_FUNCDECL_SYS (tanl, long double, (long double x)); 2385_GL_FUNCDECL_SYS (tanl, long double, (long double x), );
2309# endif 2386# endif
2310_GL_CXXALIAS_SYS (tanl, long double, (long double x)); 2387_GL_CXXALIAS_SYS (tanl, long double, (long double x));
2311# if __GLIBC__ >= 2 2388# if __GLIBC__ >= 2
@@ -2326,12 +2403,12 @@ _GL_WARN_ON_USE (tanl, "tanl is unportable - "
2326# undef tanhf 2403# undef tanhf
2327# define tanhf rpl_tanhf 2404# define tanhf rpl_tanhf
2328# endif 2405# endif
2329_GL_FUNCDECL_RPL (tanhf, float, (float x)); 2406_GL_FUNCDECL_RPL (tanhf, float, (float x), );
2330_GL_CXXALIAS_RPL (tanhf, float, (float x)); 2407_GL_CXXALIAS_RPL (tanhf, float, (float x));
2331# else 2408# else
2332# if !@HAVE_TANHF@ 2409# if !@HAVE_TANHF@
2333# undef tanhf 2410# undef tanhf
2334_GL_FUNCDECL_SYS (tanhf, float, (float x)); 2411_GL_FUNCDECL_SYS (tanhf, float, (float x), );
2335# endif 2412# endif
2336_GL_CXXALIAS_SYS (tanhf, float, (float x)); 2413_GL_CXXALIAS_SYS (tanhf, float, (float x));
2337# endif 2414# endif
@@ -2351,11 +2428,11 @@ _GL_WARN_ON_USE (tanhf, "tanhf is unportable - "
2351# undef truncf 2428# undef truncf
2352# define truncf rpl_truncf 2429# define truncf rpl_truncf
2353# endif 2430# endif
2354_GL_FUNCDECL_RPL (truncf, float, (float x)); 2431_GL_FUNCDECL_RPL (truncf, float, (float x), );
2355_GL_CXXALIAS_RPL (truncf, float, (float x)); 2432_GL_CXXALIAS_RPL (truncf, float, (float x));
2356# else 2433# else
2357# if !@HAVE_DECL_TRUNCF@ 2434# if !@HAVE_DECL_TRUNCF@
2358_GL_FUNCDECL_SYS (truncf, float, (float x)); 2435_GL_FUNCDECL_SYS (truncf, float, (float x), );
2359# endif 2436# endif
2360_GL_CXXALIAS_SYS (truncf, float, (float x)); 2437_GL_CXXALIAS_SYS (truncf, float, (float x));
2361# endif 2438# endif
@@ -2374,11 +2451,11 @@ _GL_WARN_ON_USE (truncf, "truncf is unportable - "
2374# undef trunc 2451# undef trunc
2375# define trunc rpl_trunc 2452# define trunc rpl_trunc
2376# endif 2453# endif
2377_GL_FUNCDECL_RPL (trunc, double, (double x)); 2454_GL_FUNCDECL_RPL (trunc, double, (double x), );
2378_GL_CXXALIAS_RPL (trunc, double, (double x)); 2455_GL_CXXALIAS_RPL (trunc, double, (double x));
2379# else 2456# else
2380# if !@HAVE_DECL_TRUNC@ 2457# if !@HAVE_DECL_TRUNC@
2381_GL_FUNCDECL_SYS (trunc, double, (double x)); 2458_GL_FUNCDECL_SYS (trunc, double, (double x), );
2382# endif 2459# endif
2383_GL_CXXALIAS_SYS (trunc, double, (double x)); 2460_GL_CXXALIAS_SYS (trunc, double, (double x));
2384# endif 2461# endif
@@ -2399,11 +2476,11 @@ _GL_WARN_ON_USE (trunc, "trunc is unportable - "
2399# undef truncl 2476# undef truncl
2400# define truncl rpl_truncl 2477# define truncl rpl_truncl
2401# endif 2478# endif
2402_GL_FUNCDECL_RPL (truncl, long double, (long double x)); 2479_GL_FUNCDECL_RPL (truncl, long double, (long double x), );
2403_GL_CXXALIAS_RPL (truncl, long double, (long double x)); 2480_GL_CXXALIAS_RPL (truncl, long double, (long double x));
2404# else 2481# else
2405# if !@HAVE_DECL_TRUNCL@ 2482# if !@HAVE_DECL_TRUNCL@
2406_GL_FUNCDECL_SYS (truncl, long double, (long double x)); 2483_GL_FUNCDECL_SYS (truncl, long double, (long double x), );
2407# endif 2484# endif
2408_GL_CXXALIAS_SYS (truncl, long double, (long double x)); 2485_GL_CXXALIAS_SYS (truncl, long double, (long double x));
2409# endif 2486# endif
@@ -2487,7 +2564,7 @@ _GL_EXTERN_C int gl_isfinitel (long double x);
2487# if defined isfinite || defined GNULIB_NAMESPACE 2564# if defined isfinite || defined GNULIB_NAMESPACE
2488_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isfinite) 2565_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isfinite)
2489# undef isfinite 2566# undef isfinite
2490# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || defined _AIX || (defined _WIN32 && !defined __CYGWIN__))) 2567# 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 2568 /* This platform's <cmath> possibly defines isfinite through a set of inline
2492 functions. */ 2569 functions. */
2493_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite, rpl_isfinite, bool) 2570_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite, rpl_isfinite, bool)
@@ -2557,7 +2634,7 @@ _GL_EXTERN_C int isnanf (float x);
2557 GCC >= 4.0 also provides __builtin_isnanf, but clang doesn't. */ 2634 GCC >= 4.0 also provides __builtin_isnanf, but clang doesn't. */
2558# undef isnanf 2635# undef isnanf
2559# define isnanf(x) __builtin_isnan ((float)(x)) 2636# define isnanf(x) __builtin_isnan ((float)(x))
2560# elif defined isnan 2637# elif defined isnan && !defined HAVE_ISNANF_NOLIBM
2561# undef isnanf 2638# undef isnanf
2562# define isnanf(x) isnan ((float)(x)) 2639# define isnanf(x) isnan ((float)(x))
2563# endif 2640# endif
@@ -2586,7 +2663,7 @@ _GL_EXTERN_C int isnand (double x);
2586 /* GCC >= 4.0 and clang provide a type-generic built-in for isnan. */ 2663 /* GCC >= 4.0 and clang provide a type-generic built-in for isnan. */
2587# undef isnand 2664# undef isnand
2588# define isnand(x) __builtin_isnan ((double)(x)) 2665# define isnand(x) __builtin_isnan ((double)(x))
2589# else 2666# elif !defined HAVE_ISNAND_NOLIBM
2590# undef isnand 2667# undef isnand
2591# define isnand(x) isnan ((double)(x)) 2668# define isnand(x) isnan ((double)(x))
2592# endif 2669# endif
@@ -2609,7 +2686,7 @@ _GL_EXTERN_C int isnand (double x);
2609 GCC >= 4.0 also provides __builtin_isnanl, but clang doesn't. */ 2686 GCC >= 4.0 also provides __builtin_isnanl, but clang doesn't. */
2610# undef isnanl 2687# undef isnanl
2611# define isnanl(x) __builtin_isnan ((long double)(x)) 2688# define isnanl(x) __builtin_isnan ((long double)(x))
2612# elif defined isnan 2689# elif defined isnan && !defined HAVE_ISNANL_NOLIBM
2613# undef isnanl 2690# undef isnanl
2614# define isnanl(x) isnan ((long double)(x)) 2691# define isnanl(x) isnan ((long double)(x))
2615# endif 2692# endif
@@ -2754,7 +2831,7 @@ _GL_EXTERN_C int gl_signbitl (long double arg);
2754# if defined signbit || defined GNULIB_NAMESPACE 2831# if defined signbit || defined GNULIB_NAMESPACE
2755_GL_MATH_CXX_REAL_FLOATING_DECL_1 (signbit) 2832_GL_MATH_CXX_REAL_FLOATING_DECL_1 (signbit)
2756# undef signbit 2833# undef signbit
2757# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || defined _AIX || (defined _WIN32 && !defined __CYGWIN__))) 2834# 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 2835 /* This platform's <cmath> possibly defines signbit through a set of inline
2759 functions. */ 2836 functions. */
2760_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit, rpl_signbit, bool) 2837_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit, rpl_signbit, bool)
@@ -2780,11 +2857,11 @@ _GL_WARN_REAL_FLOATING_DECL (signbit);
2780# undef getpayloadf 2857# undef getpayloadf
2781# define getpayloadf rpl_getpayloadf 2858# define getpayloadf rpl_getpayloadf
2782# endif 2859# endif
2783_GL_FUNCDECL_RPL (getpayloadf, float, (const float *)); 2860_GL_FUNCDECL_RPL (getpayloadf, float, (const float *), );
2784_GL_CXXALIAS_RPL (getpayloadf, float, (const float *)); 2861_GL_CXXALIAS_RPL (getpayloadf, float, (const float *));
2785# else 2862# else
2786# if !@HAVE_GETPAYLOADF@ 2863# if !@HAVE_GETPAYLOADF@
2787_GL_FUNCDECL_SYS (getpayloadf, float, (const float *)); 2864_GL_FUNCDECL_SYS (getpayloadf, float, (const float *), );
2788# endif 2865# endif
2789_GL_CXXALIAS_SYS (getpayloadf, float, (const float *)); 2866_GL_CXXALIAS_SYS (getpayloadf, float, (const float *));
2790# endif 2867# endif
@@ -2803,11 +2880,11 @@ _GL_WARN_ON_USE (getpayloadf, "getpayloadf is unportable - "
2803# undef getpayload 2880# undef getpayload
2804# define getpayload rpl_getpayload 2881# define getpayload rpl_getpayload
2805# endif 2882# endif
2806_GL_FUNCDECL_RPL (getpayload, double, (const double *)); 2883_GL_FUNCDECL_RPL (getpayload, double, (const double *), );
2807_GL_CXXALIAS_RPL (getpayload, double, (const double *)); 2884_GL_CXXALIAS_RPL (getpayload, double, (const double *));
2808# else 2885# else
2809# if !@HAVE_GETPAYLOAD@ 2886# if !@HAVE_GETPAYLOAD@
2810_GL_FUNCDECL_SYS (getpayload, double, (const double *)); 2887_GL_FUNCDECL_SYS (getpayload, double, (const double *), );
2811# endif 2888# endif
2812_GL_CXXALIAS_SYS (getpayload, double, (const double *)); 2889_GL_CXXALIAS_SYS (getpayload, double, (const double *));
2813# endif 2890# endif
@@ -2826,11 +2903,11 @@ _GL_WARN_ON_USE (getpayload, "getpayload is unportable - "
2826# undef getpayloadl 2903# undef getpayloadl
2827# define getpayloadl rpl_getpayloadl 2904# define getpayloadl rpl_getpayloadl
2828# endif 2905# endif
2829_GL_FUNCDECL_RPL (getpayloadl, long double, (const long double *)); 2906_GL_FUNCDECL_RPL (getpayloadl, long double, (const long double *), );
2830_GL_CXXALIAS_RPL (getpayloadl, long double, (const long double *)); 2907_GL_CXXALIAS_RPL (getpayloadl, long double, (const long double *));
2831# else 2908# else
2832# if !@HAVE_GETPAYLOADL@ 2909# if !@HAVE_GETPAYLOADL@
2833_GL_FUNCDECL_SYS (getpayloadl, long double, (const long double *)); 2910_GL_FUNCDECL_SYS (getpayloadl, long double, (const long double *), );
2834# endif 2911# endif
2835_GL_CXXALIAS_SYS (getpayloadl, long double, (const long double *)); 2912_GL_CXXALIAS_SYS (getpayloadl, long double, (const long double *));
2836# endif 2913# endif
@@ -2846,7 +2923,7 @@ _GL_WARN_ON_USE (getpayloadl, "getpayloadl is unportable - "
2846 2923
2847#if @GNULIB_SETPAYLOADF@ 2924#if @GNULIB_SETPAYLOADF@
2848# if !@HAVE_SETPAYLOADF@ 2925# if !@HAVE_SETPAYLOADF@
2849_GL_FUNCDECL_SYS (setpayloadf, int, (float *, float)); 2926_GL_FUNCDECL_SYS (setpayloadf, int, (float *, float), );
2850# endif 2927# endif
2851_GL_CXXALIAS_SYS (setpayloadf, int, (float *, float)); 2928_GL_CXXALIAS_SYS (setpayloadf, int, (float *, float));
2852_GL_CXXALIASWARN (setpayloadf); 2929_GL_CXXALIASWARN (setpayloadf);
@@ -2860,7 +2937,7 @@ _GL_WARN_ON_USE (setpayloadf, "setpayloadf is unportable - "
2860 2937
2861#if @GNULIB_SETPAYLOAD@ 2938#if @GNULIB_SETPAYLOAD@
2862# if !@HAVE_SETPAYLOAD@ 2939# if !@HAVE_SETPAYLOAD@
2863_GL_FUNCDECL_SYS (setpayload, int, (double *, double)); 2940_GL_FUNCDECL_SYS (setpayload, int, (double *, double), );
2864# endif 2941# endif
2865_GL_CXXALIAS_SYS (setpayload, int, (double *, double)); 2942_GL_CXXALIAS_SYS (setpayload, int, (double *, double));
2866_GL_CXXALIASWARN (setpayload); 2943_GL_CXXALIASWARN (setpayload);
@@ -2874,7 +2951,7 @@ _GL_WARN_ON_USE (setpayload, "setpayload is unportable - "
2874 2951
2875#if @GNULIB_SETPAYLOADL@ 2952#if @GNULIB_SETPAYLOADL@
2876# if !@HAVE_SETPAYLOADL@ 2953# if !@HAVE_SETPAYLOADL@
2877_GL_FUNCDECL_SYS (setpayloadl, int, (long double *, long double)); 2954_GL_FUNCDECL_SYS (setpayloadl, int, (long double *, long double), );
2878# endif 2955# endif
2879_GL_CXXALIAS_SYS (setpayloadl, int, (long double *, long double)); 2956_GL_CXXALIAS_SYS (setpayloadl, int, (long double *, long double));
2880_GL_CXXALIASWARN (setpayloadl); 2957_GL_CXXALIASWARN (setpayloadl);
@@ -2889,7 +2966,7 @@ _GL_WARN_ON_USE (setpayloadl, "setpayloadl is unportable - "
2889 2966
2890#if @GNULIB_SETPAYLOADSIGF@ 2967#if @GNULIB_SETPAYLOADSIGF@
2891# if !@HAVE_SETPAYLOADSIGF@ 2968# if !@HAVE_SETPAYLOADSIGF@
2892_GL_FUNCDECL_SYS (setpayloadsigf, int, (float *, float)); 2969_GL_FUNCDECL_SYS (setpayloadsigf, int, (float *, float), );
2893# endif 2970# endif
2894_GL_CXXALIAS_SYS (setpayloadsigf, int, (float *, float)); 2971_GL_CXXALIAS_SYS (setpayloadsigf, int, (float *, float));
2895_GL_CXXALIASWARN (setpayloadsigf); 2972_GL_CXXALIASWARN (setpayloadsigf);
@@ -2903,7 +2980,7 @@ _GL_WARN_ON_USE (setpayloadsigf, "setpayloadsigf is unportable - "
2903 2980
2904#if @GNULIB_SETPAYLOADSIG@ 2981#if @GNULIB_SETPAYLOADSIG@
2905# if !@HAVE_SETPAYLOADSIG@ 2982# if !@HAVE_SETPAYLOADSIG@
2906_GL_FUNCDECL_SYS (setpayloadsig, int, (double *, double)); 2983_GL_FUNCDECL_SYS (setpayloadsig, int, (double *, double), );
2907# endif 2984# endif
2908_GL_CXXALIAS_SYS (setpayloadsig, int, (double *, double)); 2985_GL_CXXALIAS_SYS (setpayloadsig, int, (double *, double));
2909_GL_CXXALIASWARN (setpayloadsig); 2986_GL_CXXALIASWARN (setpayloadsig);
@@ -2917,7 +2994,7 @@ _GL_WARN_ON_USE (setpayloadsig, "setpayloadsig is unportable - "
2917 2994
2918#if @GNULIB_SETPAYLOADSIGL@ 2995#if @GNULIB_SETPAYLOADSIGL@
2919# if !@HAVE_SETPAYLOADSIGL@ 2996# if !@HAVE_SETPAYLOADSIGL@
2920_GL_FUNCDECL_SYS (setpayloadsigl, int, (long double *, long double)); 2997_GL_FUNCDECL_SYS (setpayloadsigl, int, (long double *, long double), );
2921# endif 2998# endif
2922_GL_CXXALIAS_SYS (setpayloadsigl, int, (long double *, long double)); 2999_GL_CXXALIAS_SYS (setpayloadsigl, int, (long double *, long double));
2923_GL_CXXALIASWARN (setpayloadsigl); 3000_GL_CXXALIASWARN (setpayloadsigl);
@@ -2936,11 +3013,11 @@ _GL_WARN_ON_USE (setpayloadsigl, "setpayloadsigl is unportable - "
2936# undef totalorderf 3013# undef totalorderf
2937# define totalorderf rpl_totalorderf 3014# define totalorderf rpl_totalorderf
2938# endif 3015# endif
2939_GL_FUNCDECL_RPL (totalorderf, int, (float const *, float const *)); 3016_GL_FUNCDECL_RPL (totalorderf, int, (float const *, float const *), );
2940_GL_CXXALIAS_RPL (totalorderf, int, (float const *, float const *)); 3017_GL_CXXALIAS_RPL (totalorderf, int, (float const *, float const *));
2941# else 3018# else
2942# if !@HAVE_TOTALORDERF@ 3019# if !@HAVE_TOTALORDERF@
2943_GL_FUNCDECL_SYS (totalorderf, int, (float const *, float const *)); 3020_GL_FUNCDECL_SYS (totalorderf, int, (float const *, float const *), );
2944# endif 3021# endif
2945_GL_CXXALIAS_SYS (totalorderf, int, (float const *, float const *)); 3022_GL_CXXALIAS_SYS (totalorderf, int, (float const *, float const *));
2946# endif 3023# endif
@@ -2959,11 +3036,11 @@ _GL_WARN_ON_USE (totalorderf, "totalorderf is unportable - "
2959# undef totalorder 3036# undef totalorder
2960# define totalorder rpl_totalorder 3037# define totalorder rpl_totalorder
2961# endif 3038# endif
2962_GL_FUNCDECL_RPL (totalorder, int, (double const *, double const *)); 3039_GL_FUNCDECL_RPL (totalorder, int, (double const *, double const *), );
2963_GL_CXXALIAS_RPL (totalorder, int, (double const *, double const *)); 3040_GL_CXXALIAS_RPL (totalorder, int, (double const *, double const *));
2964# else 3041# else
2965# if !@HAVE_TOTALORDER@ 3042# if !@HAVE_TOTALORDER@
2966_GL_FUNCDECL_SYS (totalorder, int, (double const *, double const *)); 3043_GL_FUNCDECL_SYS (totalorder, int, (double const *, double const *), );
2967# endif 3044# endif
2968_GL_CXXALIAS_SYS (totalorder, int, (double const *, double const *)); 3045_GL_CXXALIAS_SYS (totalorder, int, (double const *, double const *));
2969# endif 3046# endif
@@ -2985,13 +3062,13 @@ _GL_WARN_ON_USE (totalorder, "totalorder is unportable - "
2985# define totalorderl rpl_totalorderl 3062# define totalorderl rpl_totalorderl
2986# endif 3063# endif
2987_GL_FUNCDECL_RPL (totalorderl, int, 3064_GL_FUNCDECL_RPL (totalorderl, int,
2988 (long double const *, long double const *)); 3065 (long double const *, long double const *), );
2989_GL_CXXALIAS_RPL (totalorderl, int, 3066_GL_CXXALIAS_RPL (totalorderl, int,
2990 (long double const *, long double const *)); 3067 (long double const *, long double const *));
2991# else 3068# else
2992# if !@HAVE_TOTALORDERL@ 3069# if !@HAVE_TOTALORDERL@
2993_GL_FUNCDECL_SYS (totalorderl, int, 3070_GL_FUNCDECL_SYS (totalorderl, int,
2994 (long double const *, long double const *)); 3071 (long double const *, long double const *), );
2995# endif 3072# endif
2996_GL_CXXALIAS_SYS (totalorderl, int, 3073_GL_CXXALIAS_SYS (totalorderl, int,
2997 (long double const *, long double const *)); 3074 (long double const *, long double const *));
@@ -3012,11 +3089,11 @@ _GL_WARN_ON_USE (totalorderl, "totalorderl is unportable - "
3012# undef totalordermagf 3089# undef totalordermagf
3013# define totalordermagf rpl_totalordermagf 3090# define totalordermagf rpl_totalordermagf
3014# endif 3091# endif
3015_GL_FUNCDECL_RPL (totalordermagf, int, (float const *, float const *)); 3092_GL_FUNCDECL_RPL (totalordermagf, int, (float const *, float const *), );
3016_GL_CXXALIAS_RPL (totalordermagf, int, (float const *, float const *)); 3093_GL_CXXALIAS_RPL (totalordermagf, int, (float const *, float const *));
3017# else 3094# else
3018# if !@HAVE_TOTALORDERMAGF@ 3095# if !@HAVE_TOTALORDERMAGF@
3019_GL_FUNCDECL_SYS (totalordermagf, int, (float const *, float const *)); 3096_GL_FUNCDECL_SYS (totalordermagf, int, (float const *, float const *), );
3020# endif 3097# endif
3021_GL_CXXALIAS_SYS (totalordermagf, int, (float const *, float const *)); 3098_GL_CXXALIAS_SYS (totalordermagf, int, (float const *, float const *));
3022# endif 3099# endif
@@ -3037,11 +3114,11 @@ _GL_WARN_ON_USE (totalordermagf, "totalordermagf is unportable - "
3037# undef totalordermag 3114# undef totalordermag
3038# define totalordermag rpl_totalordermag 3115# define totalordermag rpl_totalordermag
3039# endif 3116# endif
3040_GL_FUNCDECL_RPL (totalordermag, int, (double const *, double const *)); 3117_GL_FUNCDECL_RPL (totalordermag, int, (double const *, double const *), );
3041_GL_CXXALIAS_RPL (totalordermag, int, (double const *, double const *)); 3118_GL_CXXALIAS_RPL (totalordermag, int, (double const *, double const *));
3042# else 3119# else
3043# if !@HAVE_TOTALORDERMAG@ 3120# if !@HAVE_TOTALORDERMAG@
3044_GL_FUNCDECL_SYS (totalordermag, int, (double const *, double const *)); 3121_GL_FUNCDECL_SYS (totalordermag, int, (double const *, double const *), );
3045# endif 3122# endif
3046_GL_CXXALIAS_SYS (totalordermag, int, (double const *, double const *)); 3123_GL_CXXALIAS_SYS (totalordermag, int, (double const *, double const *));
3047# endif 3124# endif
@@ -3063,13 +3140,13 @@ _GL_WARN_ON_USE (totalordermag, "totalordermag is unportable - "
3063# define totalordermagl rpl_totalordermagl 3140# define totalordermagl rpl_totalordermagl
3064# endif 3141# endif
3065_GL_FUNCDECL_RPL (totalordermagl, int, 3142_GL_FUNCDECL_RPL (totalordermagl, int,
3066 (long double const *, long double const *)); 3143 (long double const *, long double const *), );
3067_GL_CXXALIAS_RPL (totalordermagl, int, 3144_GL_CXXALIAS_RPL (totalordermagl, int,
3068 (long double const *, long double const *)); 3145 (long double const *, long double const *));
3069# else 3146# else
3070# if !@HAVE_TOTALORDERMAGL@ 3147# if !@HAVE_TOTALORDERMAGL@
3071_GL_FUNCDECL_SYS (totalordermagl, int, 3148_GL_FUNCDECL_SYS (totalordermagl, int,
3072 (long double const *, long double const *)); 3149 (long double const *, long double const *), );
3073# endif 3150# endif
3074_GL_CXXALIAS_SYS (totalordermagl, int, 3151_GL_CXXALIAS_SYS (totalordermagl, int,
3075 (long double const *, long double const *)); 3152 (long double const *, long double const *));
diff --git a/gl/mbchar.c b/gl/mbchar.c
new file mode 100644
index 00000000..713c2f74
--- /dev/null
+++ b/gl/mbchar.c
@@ -0,0 +1,23 @@
1/* Copyright (C) 2001, 2006, 2009-2025 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#include <config.h>
18
19#define MBCHAR_INLINE _GL_EXTERN_INLINE
20
21#include <limits.h>
22
23#include "mbchar.h"
diff --git a/gl/mbchar.h b/gl/mbchar.h
new file mode 100644
index 00000000..d77168e7
--- /dev/null
+++ b/gl/mbchar.h
@@ -0,0 +1,383 @@
1/* Multibyte character data type.
2 Copyright (C) 2001, 2005-2007, 2009-2025 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 && memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) == 0)
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 && memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) == 0)
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. */
265# define mb_setascii(mbc, sc) \
266 ((mbc)->ptr = (mbc)->buf, (mbc)->bytes = 1, (mbc)->wc_valid = 1, \
267 (mbc)->wc = (mbc)->buf[0] = (sc))
268#endif
269
270/* Copying a character. */
271MBCHAR_INLINE void
272mb_copy (mbchar_t *new_mbc, const mbchar_t *old_mbc)
273{
274#if defined GNULIB_MBFILE
275 if (old_mbc->ptr == &old_mbc->buf[0])
276 {
277 memcpy (&new_mbc->buf[0], &old_mbc->buf[0], old_mbc->bytes);
278 new_mbc->ptr = &new_mbc->buf[0];
279 }
280 else
281#endif
282 new_mbc->ptr = old_mbc->ptr;
283 new_mbc->bytes = old_mbc->bytes;
284 if ((new_mbc->wc_valid = old_mbc->wc_valid))
285 new_mbc->wc = old_mbc->wc;
286}
287
288
289/* is_basic(c) tests whether the single-byte character c is
290 - in the ISO C "basic character set" or is one of '@', '$', and '`'
291 which ISO C 23 § 5.2.1.1.(1) guarantees to be single-byte and in
292 practice are safe to treat as basic in the execution character set,
293 or
294 - in the POSIX "portable character set", which
295 <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap06.html>
296 equally guarantees to be single-byte.
297 This is a convenience function, and is in this file only to share code
298 between mbiter.h, mbuiter.h, and mbfile.h. */
299#if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
300 && ('$' == 36) && ('%' == 37) && ('&' == 38) && ('\'' == 39) \
301 && ('(' == 40) && (')' == 41) && ('*' == 42) && ('+' == 43) \
302 && (',' == 44) && ('-' == 45) && ('.' == 46) && ('/' == 47) \
303 && ('0' == 48) && ('1' == 49) && ('2' == 50) && ('3' == 51) \
304 && ('4' == 52) && ('5' == 53) && ('6' == 54) && ('7' == 55) \
305 && ('8' == 56) && ('9' == 57) && (':' == 58) && (';' == 59) \
306 && ('<' == 60) && ('=' == 61) && ('>' == 62) && ('?' == 63) \
307 && ('@' == 64) && ('A' == 65) && ('B' == 66) && ('C' == 67) \
308 && ('D' == 68) && ('E' == 69) && ('F' == 70) && ('G' == 71) \
309 && ('H' == 72) && ('I' == 73) && ('J' == 74) && ('K' == 75) \
310 && ('L' == 76) && ('M' == 77) && ('N' == 78) && ('O' == 79) \
311 && ('P' == 80) && ('Q' == 81) && ('R' == 82) && ('S' == 83) \
312 && ('T' == 84) && ('U' == 85) && ('V' == 86) && ('W' == 87) \
313 && ('X' == 88) && ('Y' == 89) && ('Z' == 90) && ('[' == 91) \
314 && ('\\' == 92) && (']' == 93) && ('^' == 94) && ('_' == 95) \
315 && ('`' == 96) && ('a' == 97) && ('b' == 98) && ('c' == 99) \
316 && ('d' == 100) && ('e' == 101) && ('f' == 102) && ('g' == 103) \
317 && ('h' == 104) && ('i' == 105) && ('j' == 106) && ('k' == 107) \
318 && ('l' == 108) && ('m' == 109) && ('n' == 110) && ('o' == 111) \
319 && ('p' == 112) && ('q' == 113) && ('r' == 114) && ('s' == 115) \
320 && ('t' == 116) && ('u' == 117) && ('v' == 118) && ('w' == 119) \
321 && ('x' == 120) && ('y' == 121) && ('z' == 122) && ('{' == 123) \
322 && ('|' == 124) && ('}' == 125) && ('~' == 126)
323/* The character set is ISO-646, not EBCDIC. */
324# define IS_BASIC_ASCII 1
325
326/* All locale encodings (see localcharset.h) map the characters 0x00..0x7F
327 to U+0000..U+007F, like ASCII, except for
328 CP864 different mapping of '%'
329 SHIFT_JIS different mappings of 0x5C, 0x7E
330 JOHAB different mapping of 0x5C
331 However, these characters in the range 0x20..0x7E are in the ISO C
332 "basic character set" and in the POSIX "portable character set", which
333 ISO C and POSIX guarantee to be single-byte. Thus, locales with these
334 encodings are not POSIX compliant. And they are most likely not in use
335 any more (as of 2023). */
336# define is_basic(c) ((unsigned char) (c) < 0x80)
337
338#else
339
340MBCHAR_INLINE bool
341is_basic (char c)
342{
343 switch (c)
344 {
345 case '\0':
346 case '\007': case '\010':
347 case '\t': case '\n': case '\v': case '\f': case '\r':
348 case ' ': case '!': case '"': case '#': case '$': case '%':
349 case '&': case '\'': case '(': case ')': case '*':
350 case '+': case ',': case '-': case '.': case '/':
351 case '0': case '1': case '2': case '3': case '4':
352 case '5': case '6': case '7': case '8': case '9':
353 case ':': case ';': case '<': case '=': case '>':
354 case '?': case '@':
355 case 'A': case 'B': case 'C': case 'D': case 'E':
356 case 'F': case 'G': case 'H': case 'I': case 'J':
357 case 'K': case 'L': case 'M': case 'N': case 'O':
358 case 'P': case 'Q': case 'R': case 'S': case 'T':
359 case 'U': case 'V': case 'W': case 'X': case 'Y':
360 case 'Z':
361 case '[': case '\\': case ']': case '^': case '_': case '`':
362 case 'a': case 'b': case 'c': case 'd': case 'e':
363 case 'f': case 'g': case 'h': case 'i': case 'j':
364 case 'k': case 'l': case 'm': case 'n': case 'o':
365 case 'p': case 'q': case 'r': case 's': case 't':
366 case 'u': case 'v': case 'w': case 'x': case 'y':
367 case 'z': case '{': case '|': case '}': case '~':
368 return 1;
369 default:
370 return 0;
371 }
372}
373
374#endif
375
376
377#ifdef __cplusplus
378}
379#endif
380
381_GL_INLINE_HEADER_END
382
383#endif /* _MBCHAR_H */
diff --git a/gl/mbiterf.c b/gl/mbiterf.c
new file mode 100644
index 00000000..ad354c55
--- /dev/null
+++ b/gl/mbiterf.c
@@ -0,0 +1,21 @@
1/* Iterating through multibyte strings: macros for multi-byte encodings.
2
3 Copyright (C) 2023-2025 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#include <config.h>
19
20#define MBITERF_INLINE _GL_EXTERN_INLINE
21#include "mbiterf.h"
diff --git a/gl/mbiterf.h b/gl/mbiterf.h
new file mode 100644
index 00000000..99d8d11d
--- /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-2025 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 asssumes 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..c4625525
--- /dev/null
+++ b/gl/mbrtoc32.c
@@ -0,0 +1,288 @@
1/* Convert multibyte character to 32-bit wide character.
2 Copyright (C) 2020-2025 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, IRIX */
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 int res;
169
170 switch (nstate)
171 {
172 case 0:
173 p = s;
174 m = n;
175 break;
176 case 3:
177 buf[2] = pstate[3];
178 FALLTHROUGH;
179 case 2:
180 buf[1] = pstate[2];
181 FALLTHROUGH;
182 case 1:
183 buf[0] = pstate[1];
184 p = buf;
185 m = nstate;
186 buf[m++] = s[0];
187 if (n >= 2 && m < 4)
188 {
189 buf[m++] = s[1];
190 if (n >= 3 && m < 4)
191 buf[m++] = s[2];
192 }
193 break;
194 default:
195 errno = EINVAL;
196 return (size_t)(-1);
197 }
198
199 /* Here m > 0. */
200
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..98858e22 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-2025 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..61be6599 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-2025 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.c b/gl/mbrtowc.c
index 8a1646d2..6f0aa129 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-2025 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/mbsinit.c b/gl/mbsinit.c
index d1b8475c..2df30b32 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-2025 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..9c25465a
--- /dev/null
+++ b/gl/mbsnlen.c
@@ -0,0 +1,60 @@
1/* Counting the multibyte characters in a string.
2 Copyright (C) 2007-2025 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..36fc9200 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-2025 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..3366c9da 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-2025 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/mbtowc-lock.c b/gl/mbtowc-lock.c
index 9001c5af..e350608b 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-2025 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..500f74cc 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-2025 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.c b/gl/mbtowc.c
index 31a2d635..27ff35c6 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-2025 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..ef0d15f7 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-2025
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),
diff --git a/gl/memchr.valgrind b/gl/memchr.valgrind
index 0295d7e6..8e55c207 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-2025 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..355de4b1 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-2025 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/mktime-internal.h b/gl/mktime-internal.h
index 0693aaf1..215be914 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-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 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..4218fca6 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-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 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,21 +460,17 @@ __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;
458
459 /* Search in both directions, so the maximum distance is half
460 the duration; add the stride to avoid off-by-1 problems. */
461 int delta_bound = duration_max / 2 + stride;
462 470
463 int delta, direction; 471 int delta, direction;
464 472
473 /* Search in both directions, closest first. */
465 for (delta = stride; delta < delta_bound; delta += stride) 474 for (delta = stride; delta < delta_bound; delta += stride)
466 for (direction = -1; direction <= 1; direction += 2) 475 for (direction = -1; direction <= 1; direction += 2)
467 { 476 {
@@ -469,7 +478,7 @@ __mktime_internal (struct tm *tp,
469 if (! ckd_add (&ot, t, delta * direction)) 478 if (! ckd_add (&ot, t, delta * direction))
470 { 479 {
471 struct tm otm; 480 struct tm otm;
472 if (! ranged_convert (convert, &ot, &otm)) 481 if (! ranged_convert (local, &ot, &otm))
473 return -1; 482 return -1;
474 if (! isdst_differ (isdst, otm.tm_isdst)) 483 if (! isdst_differ (isdst, otm.tm_isdst))
475 { 484 {
@@ -479,7 +488,7 @@ __mktime_internal (struct tm *tp,
479 &otm); 488 &otm);
480 if (mktime_min <= gt && gt <= mktime_max) 489 if (mktime_min <= gt && gt <= mktime_max)
481 { 490 {
482 if (convert_time (convert, gt, &tm)) 491 if (__tz_convert (gt, local, &tm))
483 { 492 {
484 t = gt; 493 t = gt;
485 goto offset_found; 494 goto offset_found;
@@ -491,13 +500,8 @@ __mktime_internal (struct tm *tp,
491 } 500 }
492 } 501 }
493 502
494 /* No unusual DST offset was found nearby. Assume one-hour DST. */ 503 /* No probe with the requested tm_isdst was found nearby.
495 t += 60 * 60 * dst_difference; 504 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 } 505 }
502 506
503 offset_found: 507 offset_found:
@@ -520,7 +524,7 @@ __mktime_internal (struct tm *tp,
520 __set_errno (EOVERFLOW); 524 __set_errno (EOVERFLOW);
521 return -1; 525 return -1;
522 } 526 }
523 if (! convert_time (convert, t, &tm)) 527 if (! __tz_convert (t, local, &tm))
524 return -1; 528 return -1;
525 } 529 }
526 530
@@ -536,18 +540,19 @@ __mktime_internal (struct tm *tp,
536__time64_t 540__time64_t
537__mktime64 (struct tm *tp) 541__mktime64 (struct tm *tp)
538{ 542{
539 /* POSIX.1 8.1.1 requires that whenever mktime() is called, the 543 __libc_lock_lock (__tzset_lock);
540 time zone names contained in the external variable 'tzname' shall 544 __tzset_unlocked ();
541 be set as if the tzset() function had been called. */
542 __tzset ();
543 545
544# if defined _LIBC || NEED_MKTIME_WORKING 546# if defined _LIBC || NEED_MKTIME_WORKING
545 static mktime_offset_t localtime_offset; 547 static mktime_offset_t localtime_offset;
546 return __mktime_internal (tp, __localtime64_r, &localtime_offset); 548 __time64_t result = __mktime_internal (tp, true, &localtime_offset);
547# else 549# else
548# undef mktime 550# undef mktime
549 return mktime (tp); 551 __time64_t result = mktime (tp);
550# endif 552# endif
553
554 __libc_lock_unlock (__tzset_lock);
555 return result;
551} 556}
552#endif /* _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS */ 557#endif /* _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_WINDOWS */
553 558
diff --git a/gl/mountlist.c b/gl/mountlist.c
index 06300d6b..dcff6f83 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-2025 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
@@ -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
@@ -396,15 +398,18 @@ dev_from_mount_options (char const *mount_options)
396 if (devopt) 398 if (devopt)
397 { 399 {
398 char const *optval = devopt + sizeof dev_pattern - 1; 400 char const *optval = devopt + sizeof dev_pattern - 1;
399 char *optvalend; 401 if (c_isxdigit (*optval))
400 unsigned long int dev; 402 {
401 errno = 0; 403 char *optvalend;
402 dev = strtoul (optval, &optvalend, 16); 404 unsigned long int dev;
403 if (optval != optvalend 405 errno = 0;
404 && (*optvalend == '\0' || *optvalend == ',') 406 dev = strtoul (optval, &optvalend, 16);
405 && ! (dev == ULONG_MAX && errno == ERANGE) 407 if (optval != optvalend
406 && dev == (dev_t) dev) 408 && (*optvalend == '\0' || *optvalend == ',')
407 return dev; 409 && ! (dev == ULONG_MAX && errno == ERANGE)
410 && dev == (dev_t) dev)
411 return dev;
412 }
408 } 413 }
409 414
410# endif 415# endif
@@ -452,12 +457,8 @@ terminate_at_blank (char *str)
452 *s = '\0'; 457 *s = '\0';
453 return s; 458 return s;
454} 459}
455#endif
456 460
457/* Return a list of the currently mounted file systems, or NULL on error. 461#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 462
462struct mount_entry * 463struct mount_entry *
463read_file_system_list (bool need_fs_type) 464read_file_system_list (bool need_fs_type)
@@ -567,7 +568,7 @@ read_file_system_list (bool need_fs_type)
567 goto free_then_fail; 568 goto free_then_fail;
568 } 569 }
569 else /* fallback to /proc/self/mounts (/etc/mtab). */ 570 else /* fallback to /proc/self/mounts (/etc/mtab). */
570# endif /* __linux __ || __ANDROID__ */ 571# endif /* __linux__ || __ANDROID__ */
571 { 572 {
572 struct mntent *mnt; 573 struct mntent *mnt;
573 char const *table = MOUNTED; 574 char const *table = MOUNTED;
@@ -883,7 +884,9 @@ read_file_system_list (bool need_fs_type)
883 me->me_mntroot = NULL; 884 me->me_mntroot = NULL;
884 me->me_type = xstrdup (mnt.mnt_fstype); 885 me->me_type = xstrdup (mnt.mnt_fstype);
885 me->me_type_malloced = 1; 886 me->me_type_malloced = 1;
886 me->me_dummy = MNT_IGNORE (&mnt) != 0; 887 /* The cast from 'struct extmnttab *' to 'struct mnttab *' is OK
888 because 'struct extmnttab' extends 'struct mnttab'. */
889 me->me_dummy = MNT_IGNORE ((struct mnttab *) &mnt) != 0;
887 me->me_remote = ME_REMOTE (me->me_devname, me->me_type); 890 me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
888 me->me_dev = makedev (mnt.mnt_major, mnt.mnt_minor); 891 me->me_dev = makedev (mnt.mnt_major, mnt.mnt_minor);
889 892
@@ -1092,6 +1095,201 @@ read_file_system_list (bool need_fs_type)
1092 } 1095 }
1093#endif /* MOUNTED_INTERIX_STATVFS */ 1096#endif /* MOUNTED_INTERIX_STATVFS */
1094 1097
1098#if defined _WIN32 && !defined __CYGWIN__ /* native Windows */
1099/* Don't assume that UNICODE is not defined. */
1100# undef GetDriveType
1101# define GetDriveType GetDriveTypeA
1102# undef GetVolumeInformation
1103# define GetVolumeInformation GetVolumeInformationA
1104 {
1105 /* Windows has drive prefixes which are similar to mount points.
1106 GetLogicalDrives returns a bitmask where the i-th bit is set
1107 if ASCII 'A' + i is an available drive. See:
1108 <https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getlogicaldrives>. */
1109 DWORD value = GetLogicalDrives ();
1110 unsigned int i;
1111
1112 for (i = 0; i < 26; ++i)
1113 {
1114 if (value & (1U << i))
1115 {
1116 char mountdir[4];
1117 char fs_name[MAX_PATH + 1];
1118 mountdir[0] = 'A' + i;
1119 mountdir[1] = ':';
1120 mountdir[2] = '\\';
1121 mountdir[3] = '\0';
1122 /* Test whether the drive actually exists, and
1123 get the name of the file system. See:
1124 <https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getvolumeinformationa>. */
1125 if (GetVolumeInformation (mountdir, NULL, 0, NULL, NULL, NULL,
1126 fs_name, sizeof fs_name))
1127 {
1128 me = xmalloc (sizeof *me);
1129 me->me_mountdir = xstrdup (mountdir);
1130 /* Check if drive is remote. See:
1131 <https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getdrivetypea>. */
1132 me->me_remote = GetDriveType (mountdir) == DRIVE_REMOTE;
1133 /* Here we could use
1134 QueryDosDeviceW -> returns something like '\Device\HarddiskVolume2'
1135 GetVolumeNameForVolumeMountPointW -> return something like '\\?\Volume{...}'
1136 */
1137 me->me_devname = NULL;
1138 {
1139 /* Find the SUBST or NET USE mapping of the given drive.
1140 <https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-querydosdevicew>
1141 For testing of SUBST: <https://ss64.com/nt/subst.html>
1142 For testing of NET USE: <https://ss64.com/nt/net-use.html> */
1143 wchar_t drive[3];
1144 wchar_t mapping[MAX_PATH + 1];
1145 drive[0] = L'A' + i;
1146 drive[1] = L':';
1147 drive[2] = L'\0';
1148 DWORD mapping_len = QueryDosDeviceW (drive, mapping, sizeof (mapping) / sizeof (mapping[0]));
1149 if (mapping_len > 4 && wcsncmp (mapping, L"\\??\\", 4) == 0)
1150 {
1151 /* It's a SUBSTed drive. */
1152 char subst_dir[MAX_PATH + 1];
1153 size_t subst_dir_len = wcstombs (subst_dir, mapping + 4, sizeof (subst_dir));
1154 if (subst_dir_len > 0 && subst_dir_len <= MAX_PATH)
1155 me->me_mntroot = xstrdup (subst_dir);
1156 else
1157 /* mapping is too long or not convertible to the
1158 locale encoding. */
1159 me->me_mntroot = NULL;
1160 }
1161 else if (mapping_len > 26
1162 && wcsncmp (mapping, L"\\Device\\LanmanRedirector\\;", 26) == 0)
1163 {
1164 wchar_t *next_backslash = wcschr (mapping + 26, L'\\');
1165 if (next_backslash != NULL)
1166 {
1167 *--next_backslash = L'\\';
1168 char share_dir[MAX_PATH + 1];
1169 size_t share_dir_len = wcstombs (share_dir, next_backslash, sizeof (share_dir));
1170 if (share_dir_len > 0 && share_dir_len <= MAX_PATH)
1171 me->me_mntroot = xstrdup (share_dir);
1172 else
1173 /* mapping is too long or not convertible to the
1174 locale encoding. */
1175 me->me_mntroot = NULL;
1176 }
1177 else
1178 /* mapping does not have the expected form. */
1179 me->me_mntroot = NULL;
1180 }
1181 else
1182 /* It's neither a SUBSTed nor a NET USEd drive. */
1183 me->me_mntroot = NULL;
1184 }
1185 me->me_dev = (dev_t) -1;
1186 me->me_dummy = 0;
1187 me->me_type = xstrdup (fs_name);
1188 me->me_type_malloced = 1;
1189
1190 /* Add to the linked list. */
1191 *mtail = me;
1192 mtail = &me->me_next;
1193 }
1194 }
1195 }
1196 }
1197 {
1198 /* Windows also has true mount points, called "mounted folders". See
1199 <https://learn.microsoft.com/en-us/windows/win32/fileio/volume-mount-points>
1200 For testing: <https://learn.microsoft.com/en-us/windows-server/storage/disk-management/assign-a-mount-point-folder-path-to-a-drive> */
1201 /* Enumerate the volumes. See
1202 <https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findfirstvolumew>
1203 <https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findnextvolumew>
1204 <https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findvolumeclose> */
1205 wchar_t vol_name[MAX_PATH + 1];
1206 HANDLE h = FindFirstVolumeW (vol_name, sizeof (vol_name) / sizeof (vol_name[0]));
1207 if (h != INVALID_HANDLE_VALUE)
1208 {
1209 do
1210 {
1211 /* Look where the volume vol_name is mounted.
1212 There are two APIs for doing this:
1213 - FindFirstVolumeMountPointW, FindNextVolumeMountPointW,
1214 FindVolumeMountPointClose. This API always fails with
1215 error code ERROR_ACCESS_DENIED.
1216 - GetVolumePathNamesForVolumeNameW. This API works but
1217 may require a significantly larger buffer.
1218 <https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getvolumepathnamesforvolumenamew> */
1219 wchar_t stack_buf[MAX_PATH + 2];
1220 wchar_t *malloced_buf = NULL;
1221 wchar_t *buf = stack_buf;
1222 DWORD bufsize = sizeof (stack_buf) / sizeof (wchar_t);
1223 BOOL success;
1224 for (;;)
1225 {
1226 success = GetVolumePathNamesForVolumeNameW (vol_name, buf, bufsize, &bufsize);
1227 if (!success && GetLastError () == ERROR_MORE_DATA)
1228 {
1229 free (malloced_buf);
1230 malloced_buf = (wchar_t *) xmalloc (bufsize * sizeof (wchar_t));
1231 buf = malloced_buf;
1232 }
1233 else
1234 break;
1235 }
1236 if (success)
1237 {
1238 wchar_t *mount_dir = buf;
1239 while (*mount_dir != L'\0')
1240 {
1241 /* Drive mounts are already handled above. */
1242 if (!(mount_dir[0] >= L'A' && mount_dir[0] <= L'Z'
1243 && mount_dir[1] == L':' && mount_dir[2] == L'\\'
1244 && mount_dir[3] == L'\0'))
1245 {
1246 char mountdir[MAX_PATH + 1];
1247 size_t mountdir_len = wcstombs (mountdir, mount_dir, sizeof (mountdir));
1248 if (mountdir_len > 0 && mountdir_len <= MAX_PATH)
1249 {
1250 char fs_name[MAX_PATH + 1];
1251 /* Get the name of the file system. See:
1252 <https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getvolumeinformationa>. */
1253 if (GetVolumeInformation (mountdir, NULL, 0, NULL, NULL, NULL,
1254 fs_name, sizeof fs_name))
1255 {
1256 me = xmalloc (sizeof *me);
1257 me->me_mountdir = xstrdup (mountdir);
1258 me->me_remote = false;
1259 /* Here we could use vol_name, something like '\\?\Volume{...}'. */
1260 me->me_devname = NULL;
1261 me->me_mntroot = NULL;
1262 me->me_dev = (dev_t) -1;
1263 me->me_dummy = 0;
1264 me->me_type = xstrdup (fs_name);
1265 me->me_type_malloced = 1;
1266
1267 /* Add to the linked list. */
1268 *mtail = me;
1269 mtail = &me->me_next;
1270 }
1271 }
1272 else
1273 {
1274 /* mount_dir is too long or not convertible to the
1275 locale encoding. */
1276 }
1277 }
1278 mount_dir += wcslen (mount_dir) + 1;
1279 }
1280 }
1281 free (malloced_buf);
1282 }
1283 while (FindNextVolumeW (h, vol_name, sizeof (vol_name) / sizeof (vol_name[0])));
1284 FindVolumeClose (h);
1285 }
1286 }
1287#endif
1288
1289#if MOUNTED_NOT_PORTED
1290# error "Please port gnulib mountlist.c to your platform!"
1291#endif
1292
1095 *mtail = NULL; 1293 *mtail = NULL;
1096 return mount_list; 1294 return mount_list;
1097 1295
diff --git a/gl/mountlist.h b/gl/mountlist.h
index 9728e38b..e8ba1d96 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-2025 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..1b51b1b0 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-2025 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..9bb8a156 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-2025 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-nothrow.c b/gl/msvc-nothrow.c
index 06b35a61..7cf7517e 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-2025 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..b02f36c4 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-2025 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..22059ea0 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-2025 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
@@ -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
diff --git a/gl/netinet_in.in.h b/gl/netinet_in.in.h
index 4e9f6f2d..402d01a9 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-2025 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..1ac25515 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-2025 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..0180c26a 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-2025 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
@@ -154,11 +154,15 @@ ctype_codeset (void)
154 "thread5 disturbed by threadN!", even when threadN invokes only 154 "thread5 disturbed by threadN!", even when threadN invokes only
155 nl_langinfo (CODESET); 155 nl_langinfo (CODESET);
156 nl_langinfo (CRNCYSTR); 156 nl_langinfo (CRNCYSTR);
157 Similarly on Solaris 10. */ 157 Similarly on Solaris 10 and macOS 26. */
158 158
159# if !NL_LANGINFO_MTSAFE /* Solaris */ 159# if !NL_LANGINFO_MTSAFE /* macOS, Solaris */
160 160
161# define ITEMS (MAXSTRMSG + 1) 161# ifdef __sun /* Solaris */
162# define ITEMS (MAXSTRMSG + 1)
163# else /* macOS */
164# define ITEMS (CRNCYSTR + 20)
165# endif
162# define MAX_RESULT_LEN 80 166# define MAX_RESULT_LEN 80
163 167
164static char * 168static char *
@@ -317,6 +321,24 @@ rpl_nl_langinfo (nl_item item)
317 item = item - ALTMON_1 + MON_1; 321 item = item - ALTMON_1 + MON_1;
318 break; 322 break;
319# endif 323# endif
324# if GNULIB_defined_ABALTMON
325 case ABALTMON_1:
326 case ABALTMON_2:
327 case ABALTMON_3:
328 case ABALTMON_4:
329 case ABALTMON_5:
330 case ABALTMON_6:
331 case ABALTMON_7:
332 case ABALTMON_8:
333 case ABALTMON_9:
334 case ABALTMON_10:
335 case ABALTMON_11:
336 case ABALTMON_12:
337 /* We don't ship the appropriate localizations with gnulib. Therefore,
338 treat ABALTMON_i like ABMON_i. */
339 item = item - ABALTMON_1 + ABMON_1;
340 break;
341# endif
320# if GNULIB_defined_ERA 342# if GNULIB_defined_ERA
321 case ERA: 343 case ERA:
322 /* The format is not standardized. In glibc it is a sequence of strings 344 /* The format is not standardized. In glibc it is a sequence of strings
@@ -510,30 +532,57 @@ nl_langinfo (nl_item item)
510 return result[item - ALTMON_1]; 532 return result[item - ALTMON_1];
511 } 533 }
512 } 534 }
513 case ABMON_1: 535 {
514 case ABMON_2: 536 static char const abmonths[][sizeof "Jan"] = {
515 case ABMON_3: 537 "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
516 case ABMON_4: 538 "Aug", "Sep", "Oct", "Nov", "Dec"
517 case ABMON_5: 539 };
518 case ABMON_6: 540 case ABMON_1:
519 case ABMON_7: 541 case ABMON_2:
520 case ABMON_8: 542 case ABMON_3:
521 case ABMON_9: 543 case ABMON_4:
522 case ABMON_10: 544 case ABMON_5:
523 case ABMON_11: 545 case ABMON_6:
524 case ABMON_12: 546 case ABMON_7:
525 { 547 case ABMON_8:
526 static char result[12][30]; 548 case ABMON_9:
527 static char const abmonths[][sizeof "Jan"] = { 549 case ABMON_10:
528 "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", 550 case ABMON_11:
529 "Aug", "Sep", "Oct", "Nov", "Dec" 551 case ABMON_12:
530 }; 552 {
531 tmm.tm_mon = item - ABMON_1; 553 static char result[12][30];
532 if (!strftime (buf, sizeof result[0], "%b", &tmm)) 554 tmm.tm_mon = item - ABMON_1;
533 return (char *) abmonths[item - ABMON_1]; 555 if (!strftime (buf, sizeof result[0], "%b", &tmm))
534 strcpy (result[item - ABMON_1], buf); 556 return (char *) abmonths[item - ABMON_1];
535 return result[item - ABMON_1]; 557 strcpy (result[item - ABMON_1], buf);
536 } 558 return result[item - ABMON_1];
559 }
560 case ABALTMON_1:
561 case ABALTMON_2:
562 case ABALTMON_3:
563 case ABALTMON_4:
564 case ABALTMON_5:
565 case ABALTMON_6:
566 case ABALTMON_7:
567 case ABALTMON_8:
568 case ABALTMON_9:
569 case ABALTMON_10:
570 case ABALTMON_11:
571 case ABALTMON_12:
572 {
573 static char result[12][50];
574 tmm.tm_mon = item - ABALTMON_1;
575 /* The platforms without nl_langinfo() don't support strftime with
576 %Ob. We don't even need to try. */
577 #if 0
578 if (!strftime (buf, sizeof result[0], "%Ob", &tmm))
579 #endif
580 if (!strftime (buf, sizeof result[0], "%b", &tmm))
581 return (char *) abmonths[item - ABALTMON_1];
582 strcpy (result[item - ABALTMON_1], buf);
583 return result[item - ABALTMON_1];
584 }
585 }
537 case ERA: 586 case ERA:
538 return (char *) ""; 587 return (char *) "";
539 case ALT_DIGITS: 588 case ALT_DIGITS:
diff --git a/gl/open.c b/gl/open.c
index e690c9ea..d76372fd 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-2025 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,24 +55,29 @@ orig_open (const char *filename, int flags, mode_t mode)
55#include <sys/stat.h> 55#include <sys/stat.h>
56#include <unistd.h> 56#include <unistd.h>
57 57
58#ifndef HAVE_WORKING_O_DIRECTORY
59# define HAVE_WORKING_O_DIRECTORY false
60#endif
61
62#ifndef OPEN_TRAILING_SLASH_BUG
63# define OPEN_TRAILING_SLASH_BUG false
64#endif
65
58#ifndef REPLACE_OPEN_DIRECTORY 66#ifndef REPLACE_OPEN_DIRECTORY
59# define REPLACE_OPEN_DIRECTORY 0 67# define REPLACE_OPEN_DIRECTORY false
60#endif 68#endif
61 69
70static int
71lstatif (char const *filename, struct stat *st, int flags)
72{
73 return flags & O_NOFOLLOW ? lstat (filename, st) : stat (filename, st);
74}
75
62int 76int
63open (const char *filename, int flags, ...) 77open (const char *filename, int flags, ...)
64{ 78{
65 /* 0 = unknown, 1 = yes, -1 = no. */ 79 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 80
75 mode = 0;
76 if (flags & O_CREAT) 81 if (flags & O_CREAT)
77 { 82 {
78 va_list arg; 83 va_list arg;
@@ -99,7 +104,6 @@ open (const char *filename, int flags, ...)
99 filename = "NUL"; 104 filename = "NUL";
100#endif 105#endif
101 106
102#if OPEN_TRAILING_SLASH_BUG
103 /* Fail if one of O_CREAT, O_WRONLY, O_RDWR is specified and the filename 107 /* 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 108 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>: 109 <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>:
@@ -118,21 +122,55 @@ open (const char *filename, int flags, ...)
118 directories, 122 directories,
119 - if O_WRONLY or O_RDWR is specified, open() must fail because the 123 - if O_WRONLY or O_RDWR is specified, open() must fail because the
120 file does not contain a '.' directory. */ 124 file does not contain a '.' directory. */
121 if ((flags & O_CREAT) 125 bool check_for_slash_bug;
122 || (flags & O_ACCMODE) == O_RDWR 126 if (OPEN_TRAILING_SLASH_BUG)
123 || (flags & O_ACCMODE) == O_WRONLY)
124 { 127 {
125 size_t len = strlen (filename); 128 size_t len = strlen (filename);
126 if (len > 0 && filename[len - 1] == '/') 129 check_for_slash_bug = len && filename[len - 1] == '/';
130 }
131 else
132 check_for_slash_bug = false;
133
134 if (check_for_slash_bug
135 && (flags & O_CREAT
136 || (flags & O_ACCMODE) == O_RDWR
137 || (flags & O_ACCMODE) == O_WRONLY))
138 {
139 errno = EISDIR;
140 return -1;
141 }
142
143 /* With the trailing slash bug or without working O_DIRECTORY, check with
144 stat first lest we hang trying to open a fifo. Although there is
145 a race between this and opening the file, we can do no better.
146 After opening the file we will check again with fstat. */
147 bool check_directory =
148 (check_for_slash_bug
149 || (!HAVE_WORKING_O_DIRECTORY && flags & O_DIRECTORY));
150 if (check_directory)
151 {
152 struct stat statbuf;
153 if (lstatif (filename, &statbuf, flags) < 0)
154 {
155 if (! (flags & O_CREAT && errno == ENOENT))
156 return -1;
157 }
158 else if (!S_ISDIR (statbuf.st_mode))
127 { 159 {
128 errno = EISDIR; 160 errno = ENOTDIR;
129 return -1; 161 return -1;
130 } 162 }
131 } 163 }
164
165 /* 0 = unknown, 1 = yes, -1 = no. */
166#if GNULIB_defined_O_CLOEXEC
167 int have_cloexec = -1;
168#else
169 static int have_cloexec;
132#endif 170#endif
133 171
134 fd = orig_open (filename, 172 int fd = orig_open (filename,
135 flags & ~(have_cloexec < 0 ? O_CLOEXEC : 0), mode); 173 flags & ~(have_cloexec < 0 ? O_CLOEXEC : 0), mode);
136 174
137 if (flags & O_CLOEXEC) 175 if (flags & O_CLOEXEC)
138 { 176 {
@@ -154,19 +192,21 @@ open (const char *filename, int flags, ...)
154#if REPLACE_FCHDIR 192#if REPLACE_FCHDIR
155 /* Implementing fchdir and fdopendir requires the ability to open a 193 /* Implementing fchdir and fdopendir requires the ability to open a
156 directory file descriptor. If open doesn't support that (as on 194 directory file descriptor. If open doesn't support that (as on
157 mingw), we use a dummy file that behaves the same as directories 195 mingw), use a dummy file that behaves the same as directories
158 on Linux (ie. always reports EOF on attempts to read()), and 196 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 197 override fstat in fchdir.c to hide the dummy. */
160 dummy. */
161 if (REPLACE_OPEN_DIRECTORY && fd < 0 && errno == EACCES 198 if (REPLACE_OPEN_DIRECTORY && fd < 0 && errno == EACCES
162 && ((flags & O_ACCMODE) == O_RDONLY 199 && ((flags & (O_ACCMODE | O_CREAT)) == O_RDONLY
163 || (O_SEARCH != O_RDONLY && (flags & O_ACCMODE) == O_SEARCH))) 200 || (O_SEARCH != O_RDONLY
201 && (flags & (O_ACCMODE | O_CREAT)) == O_SEARCH)))
164 { 202 {
165 struct stat statbuf; 203 struct stat statbuf;
166 if (stat (filename, &statbuf) == 0 && S_ISDIR (statbuf.st_mode)) 204 if (check_directory
205 || (lstatif (filename, &statbuf, flags) == 0
206 && S_ISDIR (statbuf.st_mode)))
167 { 207 {
168 /* Maximum recursion depth of 1. */ 208 /* Maximum recursion depth of 1. */
169 fd = open ("/dev/null", flags, mode); 209 fd = open ("/dev/null", flags & ~O_DIRECTORY, mode);
170 if (0 <= fd) 210 if (0 <= fd)
171 fd = _gl_register_fd (fd, filename); 211 fd = _gl_register_fd (fd, filename);
172 } 212 }
@@ -175,10 +215,8 @@ open (const char *filename, int flags, ...)
175 } 215 }
176#endif 216#endif
177 217
178#if OPEN_TRAILING_SLASH_BUG 218 /* 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, 219 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>: 220 <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 221 "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 222 ends with one or more trailing <slash> characters shall not be resolved
@@ -186,23 +224,18 @@ open (const char *filename, int flags, ...)
186 <slash> characters names an existing directory" 224 <slash> characters names an existing directory"
187 If the named file without the slash is not a directory, open() must fail 225 If the named file without the slash is not a directory, open() must fail
188 with ENOTDIR. */ 226 with ENOTDIR. */
189 if (fd >= 0) 227 if (check_directory && 0 <= fd)
190 { 228 {
191 /* We know len is positive, since open did not fail with ENOENT. */ 229 struct stat statbuf;
192 size_t len = strlen (filename); 230 int r = fstat (fd, &statbuf);
193 if (filename[len - 1] == '/') 231 if (r < 0 || !S_ISDIR (statbuf.st_mode))
194 { 232 {
195 struct stat statbuf; 233 int err = r < 0 ? errno : ENOTDIR;
196 234 close (fd);
197 if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode)) 235 errno = err;
198 { 236 return -1;
199 close (fd);
200 errno = ENOTDIR;
201 return -1;
202 }
203 } 237 }
204 } 238 }
205#endif
206 239
207#if REPLACE_FCHDIR 240#if REPLACE_FCHDIR
208 if (!REPLACE_OPEN_DIRECTORY && 0 <= fd) 241 if (!REPLACE_OPEN_DIRECTORY && 0 <= fd)
diff --git a/gl/pathmax.h b/gl/pathmax.h
index d6512c6f..5f535517 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-2025 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..b83ec1e8 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-2025 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..6edc570c 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-2025 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..79b35034 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-2025 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
@@ -600,20 +600,14 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
600 if (signed_type == TYPE_LONGINT 600 if (signed_type == TYPE_LONGINT
601 /* For backward compatibility only. */ 601 /* For backward compatibility only. */
602 || signed_type == TYPE_LONGLONGINT) 602 || signed_type == TYPE_LONGLONGINT)
603#if HAVE_WCHAR_T
604 type = TYPE_WIDE_STRING; 603 type = TYPE_WIDE_STRING;
605#else
606 goto error;
607#endif
608 else 604 else
609 type = TYPE_STRING; 605 type = TYPE_STRING;
610 break; 606 break;
611#if HAVE_WCHAR_T
612 case 'S': 607 case 'S':
613 type = TYPE_WIDE_STRING; 608 type = TYPE_WIDE_STRING;
614 c = 's'; 609 c = 's';
615 break; 610 break;
616#endif
617 case 'p': 611 case 'p':
618 type = TYPE_POINTER; 612 type = TYPE_POINTER;
619 break; 613 break;
diff --git a/gl/printf-parse.h b/gl/printf-parse.h
index 949b8754..673053b8 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-2025 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..b19dae50
--- /dev/null
+++ b/gl/pthread-once.c
@@ -0,0 +1,148 @@
1/* POSIX once-only control.
2 Copyright (C) 2019-2025 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.h b/gl/pthread.h
new file mode 100644
index 00000000..599f1633
--- /dev/null
+++ b/gl/pthread.h
@@ -0,0 +1,2571 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* Implement the most essential subset of POSIX pthread.h.
3
4 Copyright (C) 2009-2025 Free Software Foundation, Inc.
5
6 This file is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation; either version 2.1 of the
9 License, or (at your option) any later version.
10
11 This file is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with this program. If not, see <https://www.gnu.org/licenses/>. */
18
19/* Written by Paul Eggert, Glen Lenker, and Bruno Haible. */
20
21#if __GNUC__ >= 3
22#pragma GCC system_header
23#endif
24
25
26#if defined _GL_ALREADY_INCLUDING_PTHREAD_H
27/* Special invocation convention:
28 On Android, we have a sequence of nested includes
29 <pthread.h> -> <time.h> -> <sys/time.h> -> <sys/select.h> ->
30 <signal.h> -> <pthread.h>.
31 In this situation, PTHREAD_COND_INITIALIZER is not yet defined,
32 therefore we should not attempt to define PTHREAD_MUTEX_NORMAL etc. */
33
34#include_next <pthread.h>
35
36#else
37/* Normal invocation convention. */
38
39#ifndef _GL_PTHREAD_H_
40
41#if 1
42
43# define _GL_ALREADY_INCLUDING_PTHREAD_H
44
45/* The include_next requires a split double-inclusion guard. */
46# include_next <pthread.h>
47
48# undef _GL_ALREADY_INCLUDING_PTHREAD_H
49
50#endif
51
52#ifndef _GL_PTHREAD_H_
53#define _GL_PTHREAD_H_
54
55/* This file uses _Noreturn, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK,
56 HAVE_RAW_DECL_*. */
57#if !_GL_CONFIG_H_INCLUDED
58 #error "Please include config.h first."
59#endif
60
61#define __need_system_stdlib_h
62#include <stdlib.h>
63#undef __need_system_stdlib_h
64
65
66/* The pthreads-win32 <pthread.h> defines a couple of broken macros. */
67#undef asctime_r
68#undef ctime_r
69#undef gmtime_r
70#undef localtime_r
71#undef rand_r
72#undef strtok_r
73
74#include <errno.h>
75#include <sched.h>
76#include <sys/types.h>
77#include <time.h>
78
79/* The __attribute__ feature is available in gcc versions 2.5 and later.
80 The attribute __pure__ was added in gcc 2.96. */
81#ifndef _GL_ATTRIBUTE_PURE
82# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
83# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
84# else
85# define _GL_ATTRIBUTE_PURE /* empty */
86# endif
87#endif
88
89/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
90/* C++ compatible function declaration macros.
91 Copyright (C) 2010-2025 Free Software Foundation, Inc.
92
93 This program is free software: you can redistribute it and/or modify it
94 under the terms of the GNU Lesser General Public License as published
95 by the Free Software Foundation; either version 2 of the License, or
96 (at your option) any later version.
97
98 This program is distributed in the hope that it will be useful,
99 but WITHOUT ANY WARRANTY; without even the implied warranty of
100 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
101 Lesser General Public License for more details.
102
103 You should have received a copy of the GNU Lesser General Public License
104 along with this program. If not, see <https://www.gnu.org/licenses/>. */
105
106#ifndef _GL_CXXDEFS_H
107#define _GL_CXXDEFS_H
108
109/* Begin/end the GNULIB_NAMESPACE namespace. */
110#if defined __cplusplus && defined GNULIB_NAMESPACE
111# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
112# define _GL_END_NAMESPACE }
113#else
114# define _GL_BEGIN_NAMESPACE
115# define _GL_END_NAMESPACE
116#endif
117
118/* The three most frequent use cases of these macros are:
119
120 * For providing a substitute for a function that is missing on some
121 platforms, but is declared and works fine on the platforms on which
122 it exists:
123
124 #if @GNULIB_FOO@
125 # if !@HAVE_FOO@
126 _GL_FUNCDECL_SYS (foo, ...);
127 # endif
128 _GL_CXXALIAS_SYS (foo, ...);
129 _GL_CXXALIASWARN (foo);
130 #elif defined GNULIB_POSIXCHECK
131 ...
132 #endif
133
134 * For providing a replacement for a function that exists on all platforms,
135 but is broken/insufficient and needs to be replaced on some platforms:
136
137 #if @GNULIB_FOO@
138 # if @REPLACE_FOO@
139 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
140 # undef foo
141 # define foo rpl_foo
142 # endif
143 _GL_FUNCDECL_RPL (foo, ...);
144 _GL_CXXALIAS_RPL (foo, ...);
145 # else
146 _GL_CXXALIAS_SYS (foo, ...);
147 # endif
148 _GL_CXXALIASWARN (foo);
149 #elif defined GNULIB_POSIXCHECK
150 ...
151 #endif
152
153 * For providing a replacement for a function that exists on some platforms
154 but is broken/insufficient and needs to be replaced on some of them and
155 is additionally either missing or undeclared on some other platforms:
156
157 #if @GNULIB_FOO@
158 # if @REPLACE_FOO@
159 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
160 # undef foo
161 # define foo rpl_foo
162 # endif
163 _GL_FUNCDECL_RPL (foo, ...);
164 _GL_CXXALIAS_RPL (foo, ...);
165 # else
166 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
167 _GL_FUNCDECL_SYS (foo, ...);
168 # endif
169 _GL_CXXALIAS_SYS (foo, ...);
170 # endif
171 _GL_CXXALIASWARN (foo);
172 #elif defined GNULIB_POSIXCHECK
173 ...
174 #endif
175*/
176
177/* _GL_EXTERN_C declaration;
178 performs the declaration with C linkage. */
179#if defined __cplusplus
180# define _GL_EXTERN_C extern "C"
181#else
182# define _GL_EXTERN_C extern
183#endif
184
185/* _GL_EXTERN_C_FUNC declaration;
186 performs the declaration of a function with C linkage. */
187#if defined __cplusplus
188# define _GL_EXTERN_C_FUNC extern "C"
189#else
190/* In C mode, omit the 'extern' keyword, because attributes in bracket syntax
191 are not allowed between 'extern' and the return type (see gnulib-common.m4).
192 */
193# define _GL_EXTERN_C_FUNC
194#endif
195
196/* _GL_FUNCDECL_RPL (func, rettype, parameters, [attributes]);
197 declares a replacement function, named rpl_func, with the given prototype,
198 consisting of return type, parameters, and attributes.
199 Although attributes are optional, the comma before them is required
200 for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW,
201 if needed, must be placed after the _GL_FUNCDECL_RPL invocation,
202 at the end of the declaration.
203 Examples:
204 _GL_FUNCDECL_RPL (free, void, (void *ptr), ) _GL_ATTRIBUTE_NOTHROW;
205 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...),
206 _GL_ARG_NONNULL ((1)));
207
208 Note: Attributes, such as _GL_ATTRIBUTE_DEPRECATED, are supported in front
209 of a _GL_FUNCDECL_RPL invocation only in C mode, not in C++ mode. (That's
210 because
211 [[...]] extern "C" <declaration>;
212 is invalid syntax in C++.)
213 */
214#define _GL_FUNCDECL_RPL(func,rettype,parameters,...) \
215 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters, __VA_ARGS__)
216#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters,...) \
217 _GL_EXTERN_C_FUNC __VA_ARGS__ rettype rpl_func parameters
218
219/* _GL_FUNCDECL_SYS_NAME (func) expands to plain func if C++, and to
220 parenthesized func otherwise. Parenthesization is needed in C23 if
221 the function is like strchr and so is a qualifier-generic macro
222 that expands to something more complicated. */
223#ifdef __cplusplus
224# define _GL_FUNCDECL_SYS_NAME(func) func
225#else
226# define _GL_FUNCDECL_SYS_NAME(func) (func)
227#endif
228
229/* _GL_FUNCDECL_SYS (func, rettype, parameters, [attributes]);
230 declares the system function, named func, with the given prototype,
231 consisting of return type, parameters, and attributes.
232 Although attributes are optional, the comma before them is required
233 for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW,
234 if needed, must be placed after the _GL_FUNCDECL_RPL invocation,
235 at the end of the declaration.
236 Examples:
237 _GL_FUNCDECL_SYS (getumask, mode_t, (void), ) _GL_ATTRIBUTE_NOTHROW;
238 _GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD);
239 */
240#define _GL_FUNCDECL_SYS(func,rettype,parameters,...) \
241 _GL_EXTERN_C_FUNC __VA_ARGS__ rettype _GL_FUNCDECL_SYS_NAME (func) parameters
242
243/* _GL_CXXALIAS_RPL (func, rettype, parameters);
244 declares a C++ alias called GNULIB_NAMESPACE::func
245 that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
246 Example:
247 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
248
249 Wrapping rpl_func in an object with an inline conversion operator
250 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
251 actually used in the program. */
252#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
253 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
254#if defined __cplusplus && defined GNULIB_NAMESPACE
255# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
256 namespace GNULIB_NAMESPACE \
257 { \
258 static const struct _gl_ ## func ## _wrapper \
259 { \
260 typedef rettype (*type) parameters; \
261 \
262 inline operator type () const \
263 { \
264 return ::rpl_func; \
265 } \
266 } func = {}; \
267 } \
268 _GL_EXTERN_C int _gl_cxxalias_dummy
269#else
270# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
271 _GL_EXTERN_C int _gl_cxxalias_dummy
272#endif
273
274/* _GL_CXXALIAS_MDA (func, rettype, parameters);
275 is to be used when func is a Microsoft deprecated alias, on native Windows.
276 It declares a C++ alias called GNULIB_NAMESPACE::func
277 that redirects to _func, if GNULIB_NAMESPACE is defined.
278 Example:
279 _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
280 */
281#define _GL_CXXALIAS_MDA(func,rettype,parameters) \
282 _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
283
284/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
285 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
286 except that the C function rpl_func may have a slightly different
287 declaration. A cast is used to silence the "invalid conversion" error
288 that would otherwise occur. */
289#if defined __cplusplus && defined GNULIB_NAMESPACE
290# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
291 namespace GNULIB_NAMESPACE \
292 { \
293 static const struct _gl_ ## func ## _wrapper \
294 { \
295 typedef rettype (*type) parameters; \
296 \
297 inline operator type () const \
298 { \
299 return reinterpret_cast<type>(::rpl_func); \
300 } \
301 } func = {}; \
302 } \
303 _GL_EXTERN_C int _gl_cxxalias_dummy
304#else
305# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
306 _GL_EXTERN_C int _gl_cxxalias_dummy
307#endif
308
309/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters);
310 is like _GL_CXXALIAS_MDA (func, rettype, parameters);
311 except that the C function func may have a slightly different declaration.
312 A cast is used to silence the "invalid conversion" error that would
313 otherwise occur. */
314#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \
315 _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters)
316
317/* _GL_CXXALIAS_SYS (func, rettype, parameters);
318 declares a C++ alias called GNULIB_NAMESPACE::func
319 that redirects to the system provided function func, if GNULIB_NAMESPACE
320 is defined.
321 Example:
322 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
323
324 Wrapping func in an object with an inline conversion operator
325 avoids a reference to func unless GNULIB_NAMESPACE::func is
326 actually used in the program. */
327#if defined __cplusplus && defined GNULIB_NAMESPACE
328# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
329 namespace GNULIB_NAMESPACE \
330 { \
331 static const struct _gl_ ## func ## _wrapper \
332 { \
333 typedef rettype (*type) parameters; \
334 \
335 inline operator type () const \
336 { \
337 return ::func; \
338 } \
339 } func = {}; \
340 } \
341 _GL_EXTERN_C int _gl_cxxalias_dummy
342#else
343# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
344 _GL_EXTERN_C int _gl_cxxalias_dummy
345#endif
346
347/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
348 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
349 except that the C function func may have a slightly different declaration.
350 A cast is used to silence the "invalid conversion" error that would
351 otherwise occur. */
352#if defined __cplusplus && defined GNULIB_NAMESPACE
353# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
354 namespace GNULIB_NAMESPACE \
355 { \
356 static const struct _gl_ ## func ## _wrapper \
357 { \
358 typedef rettype (*type) parameters; \
359 \
360 inline operator type () const \
361 { \
362 return reinterpret_cast<type>(::func); \
363 } \
364 } func = {}; \
365 } \
366 _GL_EXTERN_C int _gl_cxxalias_dummy
367#else
368# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
369 _GL_EXTERN_C int _gl_cxxalias_dummy
370#endif
371
372/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
373 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
374 except that the C function is picked among a set of overloaded functions,
375 namely the one with rettype2 and parameters2. Two consecutive casts
376 are used to silence the "cannot find a match" and "invalid conversion"
377 errors that would otherwise occur. */
378#if defined __cplusplus && defined GNULIB_NAMESPACE
379 /* The outer cast must be a reinterpret_cast.
380 The inner cast: When the function is defined as a set of overloaded
381 functions, it works as a static_cast<>, choosing the designated variant.
382 When the function is defined as a single variant, it works as a
383 reinterpret_cast<>. The parenthesized cast syntax works both ways. */
384# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
385 namespace GNULIB_NAMESPACE \
386 { \
387 static const struct _gl_ ## func ## _wrapper \
388 { \
389 typedef rettype (*type) parameters; \
390 \
391 inline operator type () const \
392 { \
393 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \
394 } \
395 } func = {}; \
396 } \
397 _GL_EXTERN_C int _gl_cxxalias_dummy
398#else
399# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
400 _GL_EXTERN_C int _gl_cxxalias_dummy
401#endif
402
403/* _GL_CXXALIASWARN (func);
404 causes a warning to be emitted when ::func is used but not when
405 GNULIB_NAMESPACE::func is used. func must be defined without overloaded
406 variants. */
407#if defined __cplusplus && defined GNULIB_NAMESPACE
408# define _GL_CXXALIASWARN(func) \
409 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
410# define _GL_CXXALIASWARN_1(func,namespace) \
411 _GL_CXXALIASWARN_2 (func, namespace)
412/* To work around GCC bug <https://gcc.gnu.org/PR43881>,
413 we enable the warning only when not optimizing. */
414# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
415# define _GL_CXXALIASWARN_2(func,namespace) \
416 _GL_WARN_ON_USE (func, \
417 "The symbol ::" #func " refers to the system function. " \
418 "Use " #namespace "::" #func " instead.")
419# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING
420# define _GL_CXXALIASWARN_2(func,namespace) \
421 extern __typeof__ (func) func
422# else
423# define _GL_CXXALIASWARN_2(func,namespace) \
424 _GL_EXTERN_C int _gl_cxxalias_dummy
425# endif
426#else
427# define _GL_CXXALIASWARN(func) \
428 _GL_EXTERN_C int _gl_cxxalias_dummy
429#endif
430
431/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
432 causes a warning to be emitted when the given overloaded variant of ::func
433 is used but not when GNULIB_NAMESPACE::func is used. */
434#if defined __cplusplus && defined GNULIB_NAMESPACE
435# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
436 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
437 GNULIB_NAMESPACE)
438# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
439 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
440/* To work around GCC bug <https://gcc.gnu.org/PR43881>,
441 we enable the warning only when not optimizing. */
442# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
443# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
444 _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \
445 "The symbol ::" #func " refers to the system function. " \
446 "Use " #namespace "::" #func " instead.")
447# else
448# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
449 _GL_EXTERN_C int _gl_cxxalias_dummy
450# endif
451#else
452# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
453 _GL_EXTERN_C int _gl_cxxalias_dummy
454#endif
455
456#endif /* _GL_CXXDEFS_H */
457
458/* The definition of _Noreturn is copied here. */
459/* A C macro for declaring that a function does not return.
460 Copyright (C) 2011-2025 Free Software Foundation, Inc.
461
462 This program is free software: you can redistribute it and/or modify it
463 under the terms of the GNU Lesser General Public License as published
464 by the Free Software Foundation; either version 2 of the License, or
465 (at your option) any later version.
466
467 This program is distributed in the hope that it will be useful,
468 but WITHOUT ANY WARRANTY; without even the implied warranty of
469 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
470 Lesser General Public License for more details.
471
472 You should have received a copy of the GNU Lesser General Public License
473 along with this program. If not, see <https://www.gnu.org/licenses/>. */
474
475/* The _Noreturn keyword of C11.
476 Do not use [[noreturn]], because with it the syntax
477 extern _Noreturn void func (...);
478 would not be valid; such a declaration would be valid only with 'extern'
479 and '_Noreturn' swapped, or without the 'extern' keyword. However, some
480 AIX system header files and several gnulib header files use precisely
481 this syntax with 'extern'. So even though C23 deprecates _Noreturn,
482 it is currently more portable to prefer it to [[noreturn]].
483
484 Also, do not try to work around LLVM bug 59792 (clang 15 or earlier).
485 This rare bug can be worked around by compiling with 'clang -D_Noreturn=',
486 though the workaround may generate many false-alarm warnings. */
487#ifndef _Noreturn
488# if ((!defined __cplusplus || defined __clang__) \
489 && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0)))
490 /* _Noreturn works as-is. */
491# elif (2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ \
492 || 0x5110 <= __SUNPRO_C)
493 /* Prefer __attribute__ ((__noreturn__)) to plain _Noreturn even if the
494 latter works, as 'gcc -std=gnu99 -Wpedantic' warns about _Noreturn. */
495# define _Noreturn __attribute__ ((__noreturn__))
496# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
497# define _Noreturn __declspec (noreturn)
498# else
499# define _Noreturn
500# endif
501#endif
502
503/* The definition of _GL_ARG_NONNULL is copied here. */
504/* A C macro for declaring that specific arguments must not be NULL.
505 Copyright (C) 2009-2025 Free Software Foundation, Inc.
506
507 This program is free software: you can redistribute it and/or modify it
508 under the terms of the GNU Lesser General Public License as published
509 by the Free Software Foundation; either version 2 of the License, or
510 (at your option) any later version.
511
512 This program is distributed in the hope that it will be useful,
513 but WITHOUT ANY WARRANTY; without even the implied warranty of
514 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
515 Lesser General Public License for more details.
516
517 You should have received a copy of the GNU Lesser General Public License
518 along with this program. If not, see <https://www.gnu.org/licenses/>. */
519
520/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
521 that the values passed as arguments n, ..., m must be non-NULL pointers.
522 n = 1 stands for the first argument, n = 2 for the second argument etc. */
523#ifndef _GL_ARG_NONNULL
524# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__
525# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
526# else
527# define _GL_ARG_NONNULL(params)
528# endif
529#endif
530
531/* The definition of _GL_WARN_ON_USE is copied here. */
532/* A C macro for emitting warnings if a function is used.
533 Copyright (C) 2010-2025 Free Software Foundation, Inc.
534
535 This program is free software: you can redistribute it and/or modify it
536 under the terms of the GNU Lesser General Public License as published
537 by the Free Software Foundation; either version 2 of the License, or
538 (at your option) any later version.
539
540 This program is distributed in the hope that it will be useful,
541 but WITHOUT ANY WARRANTY; without even the implied warranty of
542 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
543 Lesser General Public License for more details.
544
545 You should have received a copy of the GNU Lesser General Public License
546 along with this program. If not, see <https://www.gnu.org/licenses/>. */
547
548/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
549 for FUNCTION which will then trigger a compiler warning containing
550 the text of "literal string" anywhere that function is called, if
551 supported by the compiler. If the compiler does not support this
552 feature, the macro expands to an unused extern declaration.
553
554 _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
555 attribute used in _GL_WARN_ON_USE. If the compiler does not support
556 this feature, it expands to empty.
557
558 These macros are useful for marking a function as a potential
559 portability trap, with the intent that "literal string" include
560 instructions on the replacement function that should be used
561 instead.
562 _GL_WARN_ON_USE is for functions with 'extern' linkage.
563 _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
564 linkage.
565
566 _GL_WARN_ON_USE should not be used more than once for a given function
567 in a given compilation unit (because this may generate a warning even
568 if the function is never called).
569
570 However, one of the reasons that a function is a portability trap is
571 if it has the wrong signature. Declaring FUNCTION with a different
572 signature in C is a compilation error, so this macro must use the
573 same type as any existing declaration so that programs that avoid
574 the problematic FUNCTION do not fail to compile merely because they
575 included a header that poisoned the function. But this implies that
576 _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
577 have a declaration. Use of this macro implies that there must not
578 be any other macro hiding the declaration of FUNCTION; but
579 undefining FUNCTION first is part of the poisoning process anyway
580 (although for symbols that are provided only via a macro, the result
581 is a compilation error rather than a warning containing
582 "literal string"). Also note that in C++, it is only safe to use if
583 FUNCTION has no overloads.
584
585 For an example, it is possible to poison 'getline' by:
586 - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
587 [getline]) in configure.ac, which potentially defines
588 HAVE_RAW_DECL_GETLINE
589 - adding this code to a header that wraps the system <stdio.h>:
590 #undef getline
591 #if HAVE_RAW_DECL_GETLINE
592 _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
593 "not universally present; use the gnulib module getline");
594 #endif
595
596 It is not possible to directly poison global variables. But it is
597 possible to write a wrapper accessor function, and poison that
598 (less common usage, like &environ, will cause a compilation error
599 rather than issue the nice warning, but the end result of informing
600 the developer about their portability problem is still achieved):
601 #if HAVE_RAW_DECL_ENVIRON
602 static char ***
603 rpl_environ (void) { return &environ; }
604 _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
605 # undef environ
606 # define environ (*rpl_environ ())
607 #endif
608 or better (avoiding contradictory use of 'static' and 'extern'):
609 #if HAVE_RAW_DECL_ENVIRON
610 static char ***
611 _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
612 rpl_environ (void) { return &environ; }
613 # undef environ
614 # define environ (*rpl_environ ())
615 #endif
616 */
617#ifndef _GL_WARN_ON_USE
618
619# if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__
620/* A compiler attribute is available in gcc versions 4.3.0 and later. */
621# define _GL_WARN_ON_USE(function, message) \
622_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message)))
623# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
624 __attribute__ ((__warning__ (message)))
625# elif __clang_major__ >= 4
626/* Another compiler attribute is available in clang. */
627# define _GL_WARN_ON_USE(function, message) \
628_GL_WARN_EXTERN_C __typeof__ (function) function \
629 __attribute__ ((__diagnose_if__ (1, message, "warning")))
630# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
631 __attribute__ ((__diagnose_if__ (1, message, "warning")))
632# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING
633/* Verify the existence of the function. */
634# define _GL_WARN_ON_USE(function, message) \
635_GL_WARN_EXTERN_C __typeof__ (function) function
636# define _GL_WARN_ON_USE_ATTRIBUTE(message)
637# else /* Unsupported. */
638# define _GL_WARN_ON_USE(function, message) \
639_GL_WARN_EXTERN_C int _gl_warn_on_use
640# define _GL_WARN_ON_USE_ATTRIBUTE(message)
641# endif
642#endif
643
644/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message")
645 is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the
646 function is declared with the given prototype, consisting of return type,
647 parameters, and attributes.
648 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
649 not work in this case. */
650#ifndef _GL_WARN_ON_USE_CXX
651# if !defined __cplusplus
652# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
653 _GL_WARN_ON_USE (function, msg)
654# else
655# if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__
656/* A compiler attribute is available in gcc versions 4.3.0 and later. */
657# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
658extern rettype_gcc function parameters_and_attributes \
659 __attribute__ ((__warning__ (msg)))
660# elif __clang_major__ >= 4
661/* Another compiler attribute is available in clang. */
662# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
663extern rettype_clang function parameters_and_attributes \
664 __attribute__ ((__diagnose_if__ (1, msg, "warning")))
665# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING
666/* Verify the existence of the function. */
667# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
668extern rettype_gcc function parameters_and_attributes
669# else /* Unsupported. */
670# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
671_GL_WARN_EXTERN_C int _gl_warn_on_use
672# endif
673# endif
674#endif
675
676/* _GL_WARN_EXTERN_C declaration;
677 performs the declaration with C linkage. */
678#ifndef _GL_WARN_EXTERN_C
679# if defined __cplusplus
680# define _GL_WARN_EXTERN_C extern "C"
681# else
682# define _GL_WARN_EXTERN_C extern
683# endif
684#endif
685
686/* =========== Thread types and macros =========== */
687
688#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
689# if 0
690# include "windows-thread.h"
691# if 1
692# define pthread_t rpl_pthread_t
693# define pthread_attr_t rpl_pthread_attr_t
694# endif
695# if !GNULIB_defined_pthread_thread_types
696typedef glwthread_thread_t pthread_t;
697typedef unsigned int pthread_attr_t;
698# define GNULIB_defined_pthread_thread_types 1
699# endif
700# else
701# if 1
702# define pthread_t rpl_pthread_t
703# define pthread_attr_t rpl_pthread_attr_t
704# endif
705# if !GNULIB_defined_pthread_thread_types
706typedef int pthread_t;
707typedef unsigned int pthread_attr_t;
708# define GNULIB_defined_pthread_thread_types 1
709# endif
710# endif
711# undef PTHREAD_CREATE_JOINABLE
712# undef PTHREAD_CREATE_DETACHED
713# define PTHREAD_CREATE_JOINABLE 0
714# define PTHREAD_CREATE_DETACHED 1
715#else
716# if !1
717# if !GNULIB_defined_pthread_thread_types
718typedef int pthread_t;
719typedef unsigned int pthread_attr_t;
720# define GNULIB_defined_pthread_thread_types 1
721# endif
722# endif
723# if !1
724# define PTHREAD_CREATE_JOINABLE 0
725# define PTHREAD_CREATE_DETACHED 1
726# endif
727#endif
728
729/* =========== Once-only control (initialization) types and macros ========== */
730
731#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
732# if 1
733# include "windows-once.h"
734# if 1
735# define pthread_once_t rpl_pthread_once_t
736# endif
737# if !GNULIB_defined_pthread_once_types
738typedef glwthread_once_t pthread_once_t;
739# define GNULIB_defined_pthread_once_types 1
740# endif
741# undef PTHREAD_ONCE_INIT
742# define PTHREAD_ONCE_INIT GLWTHREAD_ONCE_INIT
743# else
744# if 1
745# define pthread_once_t rpl_pthread_once_t
746# endif
747# if !GNULIB_defined_pthread_once_types
748typedef int pthread_once_t;
749# define GNULIB_defined_pthread_once_types 1
750# endif
751# undef PTHREAD_ONCE_INIT
752# define PTHREAD_ONCE_INIT { 0 }
753# endif
754#else
755# if !1
756# if !GNULIB_defined_pthread_once_types
757typedef int pthread_once_t;
758# define GNULIB_defined_pthread_once_types 1
759# endif
760# undef PTHREAD_ONCE_INIT
761# define PTHREAD_ONCE_INIT { 0 }
762# endif
763#endif
764
765/* =========== Mutex types and macros =========== */
766
767#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
768# if 0
769# include "windows-timedmutex.h"
770# include "windows-timedrecmutex.h"
771# if 1
772# define pthread_mutex_t rpl_pthread_mutex_t
773# define pthread_mutexattr_t rpl_pthread_mutexattr_t
774# endif
775# if !GNULIB_defined_pthread_mutex_types
776typedef struct
777 {
778 int type;
779 union
780 {
781 glwthread_timedmutex_t u_timedmutex;
782 glwthread_timedrecmutex_t u_timedrecmutex;
783 }
784 u;
785 }
786 pthread_mutex_t;
787typedef unsigned int pthread_mutexattr_t;
788# define GNULIB_defined_pthread_mutex_types 1
789# endif
790# undef PTHREAD_MUTEX_INITIALIZER
791# define PTHREAD_MUTEX_INITIALIZER { 1, { GLWTHREAD_TIMEDMUTEX_INIT } }
792# else
793# if 1
794# define pthread_mutex_t rpl_pthread_mutex_t
795# define pthread_mutexattr_t rpl_pthread_mutexattr_t
796# endif
797# if !GNULIB_defined_pthread_mutex_types
798typedef int pthread_mutex_t;
799typedef unsigned int pthread_mutexattr_t;
800# define GNULIB_defined_pthread_mutex_types 1
801# endif
802# undef PTHREAD_MUTEX_INITIALIZER
803# define PTHREAD_MUTEX_INITIALIZER { 0 }
804# endif
805# undef PTHREAD_MUTEX_DEFAULT
806# undef PTHREAD_MUTEX_NORMAL
807# undef PTHREAD_MUTEX_ERRORCHECK
808# undef PTHREAD_MUTEX_RECURSIVE
809# define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
810# define PTHREAD_MUTEX_NORMAL 0
811# define PTHREAD_MUTEX_ERRORCHECK 1
812# define PTHREAD_MUTEX_RECURSIVE 2
813# undef PTHREAD_MUTEX_STALLED
814# undef PTHREAD_MUTEX_ROBUST
815# define PTHREAD_MUTEX_STALLED 0
816# define PTHREAD_MUTEX_ROBUST 1
817#else
818# if !1
819# if !GNULIB_defined_pthread_mutex_types
820typedef int pthread_mutex_t;
821typedef unsigned int pthread_mutexattr_t;
822# define GNULIB_defined_pthread_mutex_types 1
823# endif
824# undef PTHREAD_MUTEX_INITIALIZER
825# define PTHREAD_MUTEX_INITIALIZER { 0 }
826# endif
827# if !1
828# define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
829# define PTHREAD_MUTEX_NORMAL 0
830# define PTHREAD_MUTEX_ERRORCHECK 1
831# define PTHREAD_MUTEX_RECURSIVE 2
832# endif
833# if !1
834# define PTHREAD_MUTEX_STALLED 0
835# define PTHREAD_MUTEX_ROBUST 1
836# endif
837#endif
838
839/* =========== Read-write lock types and macros =========== */
840
841#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
842# if 0
843# include "windows-timedrwlock.h"
844# if 1
845# define pthread_rwlock_t rpl_pthread_rwlock_t
846# define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
847# endif
848# if !GNULIB_defined_pthread_rwlock_types
849typedef glwthread_timedrwlock_t pthread_rwlock_t;
850typedef unsigned int pthread_rwlockattr_t;
851# define GNULIB_defined_pthread_rwlock_types 1
852# endif
853# undef PTHREAD_RWLOCK_INITIALIZER
854# define PTHREAD_RWLOCK_INITIALIZER GLWTHREAD_TIMEDRWLOCK_INIT
855# else
856# if 1
857# define pthread_rwlock_t rpl_pthread_rwlock_t
858# define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
859# endif
860# if !GNULIB_defined_pthread_rwlock_types
861typedef int pthread_rwlock_t;
862typedef unsigned int pthread_rwlockattr_t;
863# define GNULIB_defined_pthread_rwlock_types 1
864# endif
865# undef PTHREAD_RWLOCK_INITIALIZER
866# define PTHREAD_RWLOCK_INITIALIZER { 0 }
867# endif
868#elif 0 && 0 /* i.e. PTHREAD_RWLOCK_UNIMPLEMENTED */
869# if 1
870# define pthread_rwlock_t rpl_pthread_rwlock_t
871# define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
872# endif
873# if !GNULIB_defined_pthread_rwlock_types
874typedef struct
875 {
876 pthread_mutex_t lock; /* protects the remaining fields */
877 pthread_cond_t waiting_readers; /* waiting readers */
878 pthread_cond_t waiting_writers; /* waiting writers */
879 unsigned int waiting_writers_count; /* number of waiting writers */
880 int runcount; /* number of readers running, or -1 when a writer runs */
881 }
882 pthread_rwlock_t;
883typedef unsigned int pthread_rwlockattr_t;
884# define GNULIB_defined_pthread_rwlock_types 1
885# endif
886# undef PTHREAD_RWLOCK_INITIALIZER
887# define PTHREAD_RWLOCK_INITIALIZER \
888 { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 }
889#elif 0 && 0 /* i.e. PTHREAD_RWLOCK_BAD_WAITQUEUE */
890/* Use rwlocks of kind PREFER_WRITER or PREFER_WRITER_NONRECURSIVE instead of
891 the DEFAULT. */
892# undef PTHREAD_RWLOCK_INITIALIZER
893# define PTHREAD_RWLOCK_INITIALIZER PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
894#else
895# if 1
896# if !defined PTHREAD_RWLOCK_INITIALIZER && defined PTHREAD_RWLOCK_INITIALIZER_NP /* z/OS */
897# define PTHREAD_RWLOCK_INITIALIZER PTHREAD_RWLOCK_INITIALIZER_NP
898# endif
899# else
900# if !GNULIB_defined_pthread_rwlock_types
901typedef int pthread_rwlock_t;
902typedef unsigned int pthread_rwlockattr_t;
903# define GNULIB_defined_pthread_rwlock_types 1
904# endif
905# undef PTHREAD_RWLOCK_INITIALIZER
906# define PTHREAD_RWLOCK_INITIALIZER { 0 }
907# endif
908#endif
909
910/* =========== Condition variable types and macros =========== */
911
912#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
913# if 0
914# include "windows-cond.h"
915# if 1
916# define pthread_cond_t rpl_pthread_cond_t
917# define pthread_condattr_t rpl_pthread_condattr_t
918# endif
919# if !GNULIB_defined_pthread_cond_types
920typedef glwthread_cond_t pthread_cond_t;
921typedef unsigned int pthread_condattr_t;
922# define GNULIB_defined_pthread_cond_types 1
923# endif
924# undef PTHREAD_COND_INITIALIZER
925# define PTHREAD_COND_INITIALIZER GLWTHREAD_COND_INIT
926# else
927# if 1
928# define pthread_cond_t rpl_pthread_cond_t
929# define pthread_condattr_t rpl_pthread_condattr_t
930# endif
931# if !GNULIB_defined_pthread_cond_types
932typedef int pthread_cond_t;
933typedef unsigned int pthread_condattr_t;
934# define GNULIB_defined_pthread_cond_types 1
935# endif
936# undef PTHREAD_COND_INITIALIZER
937# define PTHREAD_COND_INITIALIZER { 0 }
938# endif
939#else
940# if !1
941# if !GNULIB_defined_pthread_cond_types
942typedef int pthread_cond_t;
943typedef unsigned int pthread_condattr_t;
944# define GNULIB_defined_pthread_cond_types 1
945# endif
946# undef PTHREAD_COND_INITIALIZER
947# define PTHREAD_COND_INITIALIZER { 0 }
948# endif
949#endif
950
951/* =========== Thread-specific storage types and macros =========== */
952
953#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
954# if 0
955# include "windows-tls.h"
956# if 1
957# define pthread_key_t rpl_pthread_key_t
958# endif
959# if !GNULIB_defined_pthread_tss_types
960typedef glwthread_tls_key_t pthread_key_t;
961# define GNULIB_defined_pthread_tss_types 1
962# endif
963# undef PTHREAD_DESTRUCTOR_ITERATIONS
964# define PTHREAD_DESTRUCTOR_ITERATIONS GLWTHREAD_DESTRUCTOR_ITERATIONS
965# else
966# if 1
967# define pthread_key_t rpl_pthread_key_t
968# endif
969# if !GNULIB_defined_pthread_tss_types
970typedef void ** pthread_key_t;
971# define GNULIB_defined_pthread_tss_types 1
972# endif
973# undef PTHREAD_DESTRUCTOR_ITERATIONS
974# define PTHREAD_DESTRUCTOR_ITERATIONS 0
975# endif
976#else
977# if !1
978# if !GNULIB_defined_pthread_tss_types
979typedef void ** pthread_key_t;
980# define GNULIB_defined_pthread_tss_types 1
981# endif
982# undef PTHREAD_DESTRUCTOR_ITERATIONS
983# define PTHREAD_DESTRUCTOR_ITERATIONS 0
984# endif
985#endif
986
987/* =========== Spinlock types and macros =========== */
988
989#if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
990# if 0
991# include "windows-spin.h"
992# if 1
993# define pthread_spinlock_t rpl_pthread_spinlock_t
994# endif
995# if !GNULIB_defined_pthread_spin_types
996typedef glwthread_spinlock_t pthread_spinlock_t;
997# define GNULIB_defined_pthread_spin_types 1
998# endif
999# else
1000# if 1
1001# define pthread_spinlock_t rpl_pthread_spinlock_t
1002# endif
1003# if !GNULIB_defined_pthread_spin_types
1004typedef pthread_mutex_t pthread_spinlock_t;
1005# define GNULIB_defined_pthread_spin_types 1
1006# endif
1007# endif
1008# undef PTHREAD_PROCESS_PRIVATE
1009# undef PTHREAD_PROCESS_SHARED
1010# define PTHREAD_PROCESS_PRIVATE 0
1011# define PTHREAD_PROCESS_SHARED 1
1012#else
1013# if 1
1014/* <pthread.h> exists and defines pthread_spinlock_t. */
1015# if !1 || 0
1016/* If the 'pthread-spin' module is in use, it defines all the pthread_spin*
1017 functions. Prepare for it by overriding pthread_spinlock_t if that might
1018 be needed. */
1019# if !(((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) \
1020 || __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 1)) \
1021 || (((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) \
1022 && !defined __ANDROID__) \
1023 || __clang_major__ >= 3)) \
1024 && !defined __ibmxl__)
1025/* We can't use GCC built-ins. Approximate spinlocks with mutexes. */
1026# if !GNULIB_defined_pthread_spin_types
1027# define pthread_spinlock_t pthread_mutex_t
1028# define GNULIB_defined_pthread_spin_types 1
1029# endif
1030# endif
1031# endif
1032# else
1033/* Approximate spinlocks with mutexes. */
1034# if !GNULIB_defined_pthread_spin_types
1035typedef pthread_mutex_t pthread_spinlock_t;
1036# define GNULIB_defined_pthread_spin_types 1
1037# endif
1038# endif
1039# if !1
1040# define PTHREAD_PROCESS_PRIVATE 0
1041# define PTHREAD_PROCESS_SHARED 1
1042# endif
1043#endif
1044
1045/* =========== Other types and macros =========== */
1046
1047#if !1
1048# if !GNULIB_defined_other_pthread_types
1049typedef int pthread_barrier_t;
1050typedef unsigned int pthread_barrierattr_t;
1051# define GNULIB_defined_other_pthread_types 1
1052# endif
1053#endif
1054
1055#if !defined PTHREAD_CANCELED
1056
1057# define PTHREAD_BARRIER_SERIAL_THREAD (-1)
1058
1059# define PTHREAD_CANCEL_DEFERRED 0
1060# define PTHREAD_CANCEL_ASYNCHRONOUS 1
1061
1062# define PTHREAD_CANCEL_ENABLE 0
1063# define PTHREAD_CANCEL_DISABLE 1
1064
1065# define PTHREAD_CANCELED ((void *) -1)
1066
1067# define PTHREAD_INHERIT_SCHED 0
1068# define PTHREAD_EXPLICIT_SCHED 1
1069
1070# define PTHREAD_PRIO_NONE 0
1071# define PTHREAD_PRIO_INHERIT 1
1072# define PTHREAD_PRIO_PROTECT 2
1073
1074# define PTHREAD_SCOPE_SYSTEM 0
1075# define PTHREAD_SCOPE_PROCESS 1
1076
1077#endif
1078
1079/* =========== Thread functions =========== */
1080
1081#if 0
1082/* The 'restrict' qualifier on ARG is nonsense, but POSIX specifies it this way.
1083 Sigh. */
1084# if 0
1085# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1086# undef pthread_create
1087# define pthread_create rpl_pthread_create
1088# endif
1089_GL_FUNCDECL_RPL (pthread_create, int,
1090 (pthread_t *restrict threadp,
1091 const pthread_attr_t *restrict attr,
1092 void * (*mainfunc) (void *), void *restrict arg),
1093 _GL_ARG_NONNULL ((1, 3)));
1094_GL_CXXALIAS_RPL (pthread_create, int,
1095 (pthread_t *restrict threadp,
1096 const pthread_attr_t *restrict attr,
1097 void * (*mainfunc) (void *), void *restrict arg));
1098# else
1099# if !1
1100_GL_FUNCDECL_SYS (pthread_create, int,
1101 (pthread_t *restrict threadp,
1102 const pthread_attr_t *restrict attr,
1103 void * (*mainfunc) (void *), void *restrict arg),
1104 _GL_ARG_NONNULL ((1, 3)));
1105# endif
1106_GL_CXXALIAS_SYS_CAST (pthread_create, int,
1107 (pthread_t *restrict threadp,
1108 const pthread_attr_t *restrict attr,
1109 void * (*mainfunc) (void *), void *restrict arg));
1110# endif
1111# if __GLIBC__ >= 2
1112_GL_CXXALIASWARN (pthread_create);
1113# endif
1114#elif defined GNULIB_POSIXCHECK
1115# if HAVE_RAW_DECL_PTHREAD_CREATE
1116_GL_WARN_ON_USE (pthread_create, "pthread_create is not portable - "
1117 "use gnulib module pthread-thread for portability");
1118# endif
1119#endif
1120
1121#if 0
1122# if 0
1123# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1124# undef pthread_attr_init
1125# define pthread_attr_init rpl_pthread_attr_init
1126# endif
1127_GL_FUNCDECL_RPL (pthread_attr_init, int, (pthread_attr_t *attr),
1128 _GL_ARG_NONNULL ((1)));
1129_GL_CXXALIAS_RPL (pthread_attr_init, int, (pthread_attr_t *attr));
1130# else
1131# if !1
1132_GL_FUNCDECL_SYS (pthread_attr_init, int, (pthread_attr_t *attr),
1133 _GL_ARG_NONNULL ((1)));
1134# endif
1135_GL_CXXALIAS_SYS (pthread_attr_init, int, (pthread_attr_t *attr));
1136# endif
1137# if __GLIBC__ >= 2
1138_GL_CXXALIASWARN (pthread_attr_init);
1139# endif
1140#elif defined GNULIB_POSIXCHECK
1141# if HAVE_RAW_DECL_PTHREAD_ATTR_INIT
1142_GL_WARN_ON_USE (pthread_attr_init, "pthread_attr_init is not portable - "
1143 "use gnulib module pthread-thread for portability");
1144# endif
1145#endif
1146
1147#if 0
1148# if 0
1149# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1150# undef pthread_attr_getdetachstate
1151# define pthread_attr_getdetachstate rpl_pthread_attr_getdetachstate
1152# endif
1153_GL_FUNCDECL_RPL (pthread_attr_getdetachstate, int,
1154 (const pthread_attr_t *attr, int *detachstatep),
1155 _GL_ARG_NONNULL ((1, 2)));
1156_GL_CXXALIAS_RPL (pthread_attr_getdetachstate, int,
1157 (const pthread_attr_t *attr, int *detachstatep));
1158# else
1159# if !1
1160_GL_FUNCDECL_SYS (pthread_attr_getdetachstate, int,
1161 (const pthread_attr_t *attr, int *detachstatep),
1162 _GL_ARG_NONNULL ((1, 2)));
1163# endif
1164_GL_CXXALIAS_SYS (pthread_attr_getdetachstate, int,
1165 (const pthread_attr_t *attr, int *detachstatep));
1166# endif
1167# if __GLIBC__ >= 2
1168_GL_CXXALIASWARN (pthread_attr_getdetachstate);
1169# endif
1170#elif defined GNULIB_POSIXCHECK
1171# if HAVE_RAW_DECL_PTHREAD_ATTR_GETDETACHSTATE
1172_GL_WARN_ON_USE (pthread_attr_getdetachstate, "pthread_attr_getdetachstate is not portable - "
1173 "use gnulib module pthread-thread for portability");
1174# endif
1175#endif
1176
1177#if 0
1178# if 0
1179# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1180# undef pthread_attr_setdetachstate
1181# define pthread_attr_setdetachstate rpl_pthread_attr_setdetachstate
1182# endif
1183_GL_FUNCDECL_RPL (pthread_attr_setdetachstate, int,
1184 (pthread_attr_t *attr, int detachstate),
1185 _GL_ARG_NONNULL ((1)));
1186_GL_CXXALIAS_RPL (pthread_attr_setdetachstate, int,
1187 (pthread_attr_t *attr, int detachstate));
1188# else
1189# if !1
1190_GL_FUNCDECL_SYS (pthread_attr_setdetachstate, int,
1191 (pthread_attr_t *attr, int detachstate),
1192 _GL_ARG_NONNULL ((1)));
1193# endif
1194_GL_CXXALIAS_SYS (pthread_attr_setdetachstate, int,
1195 (pthread_attr_t *attr, int detachstate));
1196# endif
1197# if __GLIBC__ >= 2
1198_GL_CXXALIASWARN (pthread_attr_setdetachstate);
1199# endif
1200#elif defined GNULIB_POSIXCHECK
1201# if HAVE_RAW_DECL_PTHREAD_ATTR_SETDETACHSTATE
1202_GL_WARN_ON_USE (pthread_attr_setdetachstate, "pthread_attr_setdetachstate is not portable - "
1203 "use gnulib module pthread-thread for portability");
1204# endif
1205#endif
1206
1207#if 0
1208# if 0
1209# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1210# undef pthread_attr_destroy
1211# define pthread_attr_destroy rpl_pthread_attr_destroy
1212# endif
1213_GL_FUNCDECL_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr),
1214 _GL_ARG_NONNULL ((1)));
1215_GL_CXXALIAS_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr));
1216# else
1217# if !1
1218_GL_FUNCDECL_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr),
1219 _GL_ARG_NONNULL ((1)));
1220# endif
1221_GL_CXXALIAS_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr));
1222# endif
1223# if __GLIBC__ >= 2
1224_GL_CXXALIASWARN (pthread_attr_destroy);
1225# endif
1226#elif defined GNULIB_POSIXCHECK
1227# if HAVE_RAW_DECL_PTHREAD_ATTR_DESTROY
1228_GL_WARN_ON_USE (pthread_attr_destroy, "pthread_attr_destroy is not portable - "
1229 "use gnulib module pthread-thread for portability");
1230# endif
1231#endif
1232
1233#if 0
1234# if 0
1235# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1236# undef pthread_self
1237# define pthread_self rpl_pthread_self
1238# endif
1239_GL_FUNCDECL_RPL (pthread_self, pthread_t, (void), _GL_ATTRIBUTE_PURE);
1240_GL_CXXALIAS_RPL (pthread_self, pthread_t, (void));
1241# else
1242# if !1
1243_GL_FUNCDECL_SYS (pthread_self, pthread_t, (void), _GL_ATTRIBUTE_PURE);
1244# endif
1245_GL_CXXALIAS_SYS (pthread_self, pthread_t, (void));
1246# endif
1247# if __GLIBC__ >= 2
1248_GL_CXXALIASWARN (pthread_self);
1249# endif
1250#elif defined GNULIB_POSIXCHECK
1251# if HAVE_RAW_DECL_PTHREAD_SELF
1252_GL_WARN_ON_USE (pthread_self, "pthread_self is not portable - "
1253 "use gnulib module pthread-thread for portability");
1254# endif
1255#endif
1256
1257#if 0
1258# if 0
1259# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1260# undef pthread_equal
1261# define pthread_equal rpl_pthread_equal
1262# endif
1263_GL_FUNCDECL_RPL (pthread_equal, int, (pthread_t thread1, pthread_t thread2), );
1264_GL_CXXALIAS_RPL (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
1265# else
1266# if !1
1267_GL_FUNCDECL_SYS (pthread_equal, int, (pthread_t thread1, pthread_t thread2), );
1268# endif
1269_GL_CXXALIAS_SYS (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
1270# endif
1271# if __GLIBC__ >= 2
1272_GL_CXXALIASWARN (pthread_equal);
1273# endif
1274#elif defined GNULIB_POSIXCHECK
1275# if HAVE_RAW_DECL_PTHREAD_EQUAL
1276_GL_WARN_ON_USE (pthread_equal, "pthread_equal is not portable - "
1277 "use gnulib module pthread-thread for portability");
1278# endif
1279#endif
1280
1281#if 0
1282# if 0
1283# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1284# undef pthread_detach
1285# define pthread_detach rpl_pthread_detach
1286# endif
1287_GL_FUNCDECL_RPL (pthread_detach, int, (pthread_t thread), );
1288_GL_CXXALIAS_RPL (pthread_detach, int, (pthread_t thread));
1289# else
1290# if !1
1291_GL_FUNCDECL_SYS (pthread_detach, int, (pthread_t thread), );
1292# endif
1293_GL_CXXALIAS_SYS (pthread_detach, int, (pthread_t thread));
1294# endif
1295# if __GLIBC__ >= 2
1296_GL_CXXALIASWARN (pthread_detach);
1297# endif
1298#elif defined GNULIB_POSIXCHECK
1299# if HAVE_RAW_DECL_PTHREAD_DETACH
1300_GL_WARN_ON_USE (pthread_detach, "pthread_detach is not portable - "
1301 "use gnulib module pthread-thread for portability");
1302# endif
1303#endif
1304
1305#if 0
1306# if 0
1307# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1308# undef pthread_join
1309# define pthread_join rpl_pthread_join
1310# endif
1311_GL_FUNCDECL_RPL (pthread_join, int, (pthread_t thread, void **valuep), );
1312_GL_CXXALIAS_RPL (pthread_join, int, (pthread_t thread, void **valuep));
1313# else
1314# if !1
1315_GL_FUNCDECL_SYS (pthread_join, int, (pthread_t thread, void **valuep), );
1316# endif
1317_GL_CXXALIAS_SYS (pthread_join, int, (pthread_t thread, void **valuep));
1318# endif
1319# if __GLIBC__ >= 2
1320_GL_CXXALIASWARN (pthread_join);
1321# endif
1322#elif defined GNULIB_POSIXCHECK
1323# if HAVE_RAW_DECL_PTHREAD_JOIN
1324_GL_WARN_ON_USE (pthread_join, "pthread_join is not portable - "
1325 "use gnulib module pthread-thread for portability");
1326# endif
1327#endif
1328
1329#if 0
1330# if 0
1331# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1332# undef pthread_exit
1333# define pthread_exit rpl_pthread_exit
1334# endif
1335_GL_FUNCDECL_RPL (pthread_exit, _Noreturn void, (void *value), );
1336_GL_CXXALIAS_RPL (pthread_exit, void, (void *value));
1337# else
1338# if !1
1339_GL_FUNCDECL_SYS (pthread_exit, _Noreturn void, (void *value), );
1340# endif
1341/* Need to cast because of AIX with xlclang++. */
1342_GL_CXXALIAS_SYS_CAST (pthread_exit, void, (void *value));
1343# endif
1344# if __GLIBC__ >= 2
1345_GL_CXXALIASWARN (pthread_exit);
1346# endif
1347#elif defined GNULIB_POSIXCHECK
1348# if HAVE_RAW_DECL_PTHREAD_EXIT
1349_GL_WARN_ON_USE (pthread_exit, "pthread_exit is not portable - "
1350 "use gnulib module pthread-thread for portability");
1351# endif
1352#endif
1353
1354/* =========== Once-only control (initialization) functions =========== */
1355
1356#if 1
1357# if 0
1358# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1359# undef pthread_once
1360# define pthread_once rpl_pthread_once
1361# endif
1362_GL_FUNCDECL_RPL (pthread_once, int,
1363 (pthread_once_t *once_control, void (*initfunction) (void)),
1364 _GL_ARG_NONNULL ((1, 2)));
1365_GL_CXXALIAS_RPL (pthread_once, int,
1366 (pthread_once_t *once_control, void (*initfunction) (void)));
1367# else
1368# if !1
1369_GL_FUNCDECL_SYS (pthread_once, int,
1370 (pthread_once_t *once_control, void (*initfunction) (void)),
1371 _GL_ARG_NONNULL ((1, 2)));
1372# endif
1373_GL_CXXALIAS_SYS_CAST (pthread_once, int,
1374 (pthread_once_t *once_control,
1375 void (*initfunction) (void)));
1376# endif
1377# if __GLIBC__ >= 2
1378_GL_CXXALIASWARN (pthread_once);
1379# endif
1380#elif defined GNULIB_POSIXCHECK
1381# if HAVE_RAW_DECL_PTHREAD_ONCE
1382_GL_WARN_ON_USE (pthread_once, "pthread_once is not portable - "
1383 "use gnulib module pthread-once for portability");
1384# endif
1385#endif
1386
1387/* =========== Mutex functions =========== */
1388
1389#if 0
1390# if 0
1391# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1392# undef pthread_mutex_init
1393# define pthread_mutex_init rpl_pthread_mutex_init
1394# endif
1395_GL_FUNCDECL_RPL (pthread_mutex_init, int,
1396 (pthread_mutex_t *restrict mutex,
1397 const pthread_mutexattr_t *restrict attr),
1398 _GL_ARG_NONNULL ((1)));
1399_GL_CXXALIAS_RPL (pthread_mutex_init, int,
1400 (pthread_mutex_t *restrict mutex,
1401 const pthread_mutexattr_t *restrict attr));
1402# else
1403# if !1
1404_GL_FUNCDECL_SYS (pthread_mutex_init, int,
1405 (pthread_mutex_t *restrict mutex,
1406 const pthread_mutexattr_t *restrict attr),
1407 _GL_ARG_NONNULL ((1)));
1408# endif
1409_GL_CXXALIAS_SYS (pthread_mutex_init, int,
1410 (pthread_mutex_t *restrict mutex,
1411 const pthread_mutexattr_t *restrict attr));
1412# endif
1413# if __GLIBC__ >= 2
1414_GL_CXXALIASWARN (pthread_mutex_init);
1415# endif
1416#elif defined GNULIB_POSIXCHECK
1417# if HAVE_RAW_DECL_PTHREAD_MUTEX_INIT
1418_GL_WARN_ON_USE (pthread_mutex_init, "pthread_mutex_init is not portable - "
1419 "use gnulib module pthread-mutex for portability");
1420# endif
1421#endif
1422
1423#if 0
1424# if 0
1425# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1426# undef pthread_mutexattr_init
1427# define pthread_mutexattr_init rpl_pthread_mutexattr_init
1428# endif
1429_GL_FUNCDECL_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr),
1430 _GL_ARG_NONNULL ((1)));
1431_GL_CXXALIAS_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr));
1432# else
1433# if !1
1434_GL_FUNCDECL_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr),
1435 _GL_ARG_NONNULL ((1)));
1436# endif
1437_GL_CXXALIAS_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr));
1438# endif
1439# if __GLIBC__ >= 2
1440_GL_CXXALIASWARN (pthread_mutexattr_init);
1441# endif
1442#elif defined GNULIB_POSIXCHECK
1443# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_INIT
1444_GL_WARN_ON_USE (pthread_mutexattr_init, "pthread_mutexattr_init is not portable - "
1445 "use gnulib module pthread-mutex for portability");
1446# endif
1447#endif
1448
1449#if 0
1450# if 0
1451# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1452# undef pthread_mutexattr_gettype
1453# define pthread_mutexattr_gettype rpl_pthread_mutexattr_gettype
1454# endif
1455_GL_FUNCDECL_RPL (pthread_mutexattr_gettype, int,
1456 (const pthread_mutexattr_t *restrict attr,
1457 int *restrict typep),
1458 _GL_ARG_NONNULL ((1, 2)));
1459_GL_CXXALIAS_RPL (pthread_mutexattr_gettype, int,
1460 (const pthread_mutexattr_t *restrict attr,
1461 int *restrict typep));
1462# else
1463# if !1
1464_GL_FUNCDECL_SYS (pthread_mutexattr_gettype, int,
1465 (const pthread_mutexattr_t *restrict attr,
1466 int *restrict typep),
1467 _GL_ARG_NONNULL ((1, 2)));
1468# endif
1469/* Need to cast, because on FreeBSD the first parameter is
1470 pthread_mutexattr_t *attr. */
1471_GL_CXXALIAS_SYS_CAST (pthread_mutexattr_gettype, int,
1472 (const pthread_mutexattr_t *restrict attr,
1473 int *restrict typep));
1474# endif
1475# if __GLIBC__ >= 2
1476_GL_CXXALIASWARN (pthread_mutexattr_gettype);
1477# endif
1478#elif defined GNULIB_POSIXCHECK
1479# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETTYPE
1480_GL_WARN_ON_USE (pthread_mutexattr_gettype, "pthread_mutexattr_gettype is not portable - "
1481 "use gnulib module pthread-mutex for portability");
1482# endif
1483#endif
1484
1485#if 0
1486# if 0
1487# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1488# undef pthread_mutexattr_settype
1489# define pthread_mutexattr_settype rpl_pthread_mutexattr_settype
1490# endif
1491_GL_FUNCDECL_RPL (pthread_mutexattr_settype, int,
1492 (pthread_mutexattr_t *attr, int type), _GL_ARG_NONNULL ((1)));
1493_GL_CXXALIAS_RPL (pthread_mutexattr_settype, int,
1494 (pthread_mutexattr_t *attr, int type));
1495# else
1496# if !1
1497_GL_FUNCDECL_SYS (pthread_mutexattr_settype, int,
1498 (pthread_mutexattr_t *attr, int type), _GL_ARG_NONNULL ((1)));
1499# endif
1500_GL_CXXALIAS_SYS (pthread_mutexattr_settype, int,
1501 (pthread_mutexattr_t *attr, int type));
1502# endif
1503# if __GLIBC__ >= 2
1504_GL_CXXALIASWARN (pthread_mutexattr_settype);
1505# endif
1506#elif defined GNULIB_POSIXCHECK
1507# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETTYPE
1508_GL_WARN_ON_USE (pthread_mutexattr_settype, "pthread_mutexattr_settype is not portable - "
1509 "use gnulib module pthread-mutex for portability");
1510# endif
1511#endif
1512
1513#if 0
1514# if 0
1515# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1516# undef pthread_mutexattr_getrobust
1517# define pthread_mutexattr_getrobust rpl_pthread_mutexattr_getrobust
1518# endif
1519_GL_FUNCDECL_RPL (pthread_mutexattr_getrobust, int,
1520 (const pthread_mutexattr_t *restrict attr,
1521 int *restrict robustp),
1522 _GL_ARG_NONNULL ((1, 2)));
1523_GL_CXXALIAS_RPL (pthread_mutexattr_getrobust, int,
1524 (const pthread_mutexattr_t *restrict attr,
1525 int *restrict robustp));
1526# else
1527# if !1
1528_GL_FUNCDECL_SYS (pthread_mutexattr_getrobust, int,
1529 (const pthread_mutexattr_t *restrict attr,
1530 int *restrict robustp),
1531 _GL_ARG_NONNULL ((1, 2)));
1532# endif
1533/* Need to cast, because on FreeBSD the first parameter is
1534 pthread_mutexattr_t *attr. */
1535_GL_CXXALIAS_SYS_CAST (pthread_mutexattr_getrobust, int,
1536 (const pthread_mutexattr_t *restrict attr,
1537 int *restrict robustp));
1538# endif
1539# if __GLIBC__ >= 2
1540_GL_CXXALIASWARN (pthread_mutexattr_getrobust);
1541# endif
1542#elif defined GNULIB_POSIXCHECK
1543# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETROBUST
1544_GL_WARN_ON_USE (pthread_mutexattr_getrobust, "pthread_mutexattr_getrobust is not portable - "
1545 "use gnulib module pthread-mutex for portability");
1546# endif
1547#endif
1548
1549#if 0
1550# if 0
1551# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1552# undef pthread_mutexattr_setrobust
1553# define pthread_mutexattr_setrobust rpl_pthread_mutexattr_setrobust
1554# endif
1555_GL_FUNCDECL_RPL (pthread_mutexattr_setrobust, int,
1556 (pthread_mutexattr_t *attr, int robust),
1557 _GL_ARG_NONNULL ((1)));
1558_GL_CXXALIAS_RPL (pthread_mutexattr_setrobust, int,
1559 (pthread_mutexattr_t *attr, int robust));
1560# else
1561# if !1
1562_GL_FUNCDECL_SYS (pthread_mutexattr_setrobust, int,
1563 (pthread_mutexattr_t *attr, int robust),
1564 _GL_ARG_NONNULL ((1)));
1565# endif
1566_GL_CXXALIAS_SYS (pthread_mutexattr_setrobust, int,
1567 (pthread_mutexattr_t *attr, int robust));
1568# endif
1569# if __GLIBC__ >= 2
1570_GL_CXXALIASWARN (pthread_mutexattr_setrobust);
1571# endif
1572#elif defined GNULIB_POSIXCHECK
1573# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETROBUST
1574_GL_WARN_ON_USE (pthread_mutexattr_setrobust, "pthread_mutexattr_setrobust is not portable - "
1575 "use gnulib module pthread-mutex for portability");
1576# endif
1577#endif
1578
1579#if 0
1580# if 0
1581# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1582# undef pthread_mutexattr_destroy
1583# define pthread_mutexattr_destroy rpl_pthread_mutexattr_destroy
1584# endif
1585_GL_FUNCDECL_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr),
1586 _GL_ARG_NONNULL ((1)));
1587_GL_CXXALIAS_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr));
1588# else
1589# if !1
1590_GL_FUNCDECL_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr),
1591 _GL_ARG_NONNULL ((1)));
1592# endif
1593_GL_CXXALIAS_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr));
1594# endif
1595# if __GLIBC__ >= 2
1596_GL_CXXALIASWARN (pthread_mutexattr_destroy);
1597# endif
1598#elif defined GNULIB_POSIXCHECK
1599# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_DESTROY
1600_GL_WARN_ON_USE (pthread_mutexattr_destroy, "pthread_mutexattr_destroy is not portable - "
1601 "use gnulib module pthread-mutex for portability");
1602# endif
1603#endif
1604
1605#if 0
1606# if 0
1607# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1608# undef pthread_mutex_lock
1609# define pthread_mutex_lock rpl_pthread_mutex_lock
1610# endif
1611_GL_FUNCDECL_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex),
1612 _GL_ARG_NONNULL ((1)));
1613_GL_CXXALIAS_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex));
1614# else
1615# if !1
1616_GL_FUNCDECL_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex),
1617 _GL_ARG_NONNULL ((1)));
1618# endif
1619_GL_CXXALIAS_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex));
1620# endif
1621# if __GLIBC__ >= 2
1622_GL_CXXALIASWARN (pthread_mutex_lock);
1623# endif
1624#elif defined GNULIB_POSIXCHECK
1625# if HAVE_RAW_DECL_PTHREAD_MUTEX_LOCK
1626_GL_WARN_ON_USE (pthread_mutex_lock, "pthread_mutex_lock is not portable - "
1627 "use gnulib module pthread-mutex for portability");
1628# endif
1629#endif
1630
1631#if 0
1632# if 0
1633# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1634# undef pthread_mutex_trylock
1635# define pthread_mutex_trylock rpl_pthread_mutex_trylock
1636# endif
1637_GL_FUNCDECL_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex),
1638 _GL_ARG_NONNULL ((1)));
1639_GL_CXXALIAS_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex));
1640# else
1641# if !1
1642_GL_FUNCDECL_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex),
1643 _GL_ARG_NONNULL ((1)));
1644# endif
1645_GL_CXXALIAS_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex));
1646# endif
1647# if __GLIBC__ >= 2
1648_GL_CXXALIASWARN (pthread_mutex_trylock);
1649# endif
1650#elif defined GNULIB_POSIXCHECK
1651# if HAVE_RAW_DECL_PTHREAD_MUTEX_TRYLOCK
1652_GL_WARN_ON_USE (pthread_mutex_trylock, "pthread_mutex_trylock is not portable - "
1653 "use gnulib module pthread-mutex for portability");
1654# endif
1655#endif
1656
1657#if 0
1658# if 0
1659# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1660# undef pthread_mutex_timedlock
1661# define pthread_mutex_timedlock rpl_pthread_mutex_timedlock
1662# endif
1663_GL_FUNCDECL_RPL (pthread_mutex_timedlock, int,
1664 (pthread_mutex_t *restrict mutex,
1665 const struct timespec *restrict abstime),
1666 _GL_ARG_NONNULL ((1, 2)));
1667_GL_CXXALIAS_RPL (pthread_mutex_timedlock, int,
1668 (pthread_mutex_t *restrict mutex,
1669 const struct timespec *restrict abstime));
1670# else
1671# if !1
1672_GL_FUNCDECL_SYS (pthread_mutex_timedlock, int,
1673 (pthread_mutex_t *restrict mutex,
1674 const struct timespec *restrict abstime),
1675 _GL_ARG_NONNULL ((1, 2)));
1676# endif
1677_GL_CXXALIAS_SYS (pthread_mutex_timedlock, int,
1678 (pthread_mutex_t *restrict mutex,
1679 const struct timespec *restrict abstime));
1680# endif
1681# if __GLIBC__ >= 2
1682_GL_CXXALIASWARN (pthread_mutex_timedlock);
1683# endif
1684#elif defined GNULIB_POSIXCHECK
1685# if HAVE_RAW_DECL_PTHREAD_MUTEX_TIMEDLOCK
1686_GL_WARN_ON_USE (pthread_mutex_timedlock, "pthread_mutex_timedlock is not portable - "
1687 "use gnulib module pthread_mutex_timedlock for portability");
1688# endif
1689#endif
1690
1691#if 0
1692# if 0
1693# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1694# undef pthread_mutex_unlock
1695# define pthread_mutex_unlock rpl_pthread_mutex_unlock
1696# endif
1697_GL_FUNCDECL_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex),
1698 _GL_ARG_NONNULL ((1)));
1699_GL_CXXALIAS_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex));
1700# else
1701# if !1
1702_GL_FUNCDECL_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex),
1703 _GL_ARG_NONNULL ((1)));
1704# endif
1705_GL_CXXALIAS_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex));
1706# endif
1707# if __GLIBC__ >= 2
1708_GL_CXXALIASWARN (pthread_mutex_unlock);
1709# endif
1710#elif defined GNULIB_POSIXCHECK
1711# if HAVE_RAW_DECL_PTHREAD_MUTEX_UNLOCK
1712_GL_WARN_ON_USE (pthread_mutex_unlock, "pthread_mutex_unlock is not portable - "
1713 "use gnulib module pthread-mutex for portability");
1714# endif
1715#endif
1716
1717#if 0
1718# if 0
1719# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1720# undef pthread_mutex_destroy
1721# define pthread_mutex_destroy rpl_pthread_mutex_destroy
1722# endif
1723_GL_FUNCDECL_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex),
1724 _GL_ARG_NONNULL ((1)));
1725_GL_CXXALIAS_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex));
1726# else
1727# if !1
1728_GL_FUNCDECL_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex),
1729 _GL_ARG_NONNULL ((1)));
1730# endif
1731_GL_CXXALIAS_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex));
1732# endif
1733# if __GLIBC__ >= 2
1734_GL_CXXALIASWARN (pthread_mutex_destroy);
1735# endif
1736#elif defined GNULIB_POSIXCHECK
1737# if HAVE_RAW_DECL_PTHREAD_MUTEX_DESTROY
1738_GL_WARN_ON_USE (pthread_mutex_destroy, "pthread_mutex_destroy is not portable - "
1739 "use gnulib module pthread-mutex for portability");
1740# endif
1741#endif
1742
1743/* =========== Read-write lock functions =========== */
1744
1745#if 0
1746# if 0
1747# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1748# undef pthread_rwlock_init
1749# define pthread_rwlock_init rpl_pthread_rwlock_init
1750# endif
1751_GL_FUNCDECL_RPL (pthread_rwlock_init, int,
1752 (pthread_rwlock_t *restrict lock,
1753 const pthread_rwlockattr_t *restrict attr),
1754 _GL_ARG_NONNULL ((1)));
1755_GL_CXXALIAS_RPL (pthread_rwlock_init, int,
1756 (pthread_rwlock_t *restrict lock,
1757 const pthread_rwlockattr_t *restrict attr));
1758# else
1759# if !1
1760_GL_FUNCDECL_SYS (pthread_rwlock_init, int,
1761 (pthread_rwlock_t *restrict lock,
1762 const pthread_rwlockattr_t *restrict attr),
1763 _GL_ARG_NONNULL ((1)));
1764# endif
1765_GL_CXXALIAS_SYS (pthread_rwlock_init, int,
1766 (pthread_rwlock_t *restrict lock,
1767 const pthread_rwlockattr_t *restrict attr));
1768# endif
1769# if __GLIBC__ >= 2
1770_GL_CXXALIASWARN (pthread_rwlock_init);
1771# endif
1772#elif defined GNULIB_POSIXCHECK
1773# if HAVE_RAW_DECL_PTHREAD_RWLOCK_INIT
1774_GL_WARN_ON_USE (pthread_rwlock_init, "pthread_rwlock_init is not portable - "
1775 "use gnulib module pthread-rwlock for portability");
1776# endif
1777#endif
1778
1779#if 0
1780# if 0
1781# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1782# undef pthread_rwlockattr_init
1783# define pthread_rwlockattr_init rpl_pthread_rwlockattr_init
1784# endif
1785_GL_FUNCDECL_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr),
1786 _GL_ARG_NONNULL ((1)));
1787_GL_CXXALIAS_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr));
1788# else
1789# if !1
1790_GL_FUNCDECL_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr),
1791 _GL_ARG_NONNULL ((1)));
1792# endif
1793_GL_CXXALIAS_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr));
1794# endif
1795# if __GLIBC__ >= 2
1796_GL_CXXALIASWARN (pthread_rwlockattr_init);
1797# endif
1798#elif defined GNULIB_POSIXCHECK
1799# if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_INIT
1800_GL_WARN_ON_USE (pthread_rwlockattr_init, "pthread_rwlockattr_init is not portable - "
1801 "use gnulib module pthread-rwlock for portability");
1802# endif
1803#endif
1804
1805#if 0
1806# if 0
1807# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1808# undef pthread_rwlockattr_destroy
1809# define pthread_rwlockattr_destroy rpl_pthread_rwlockattr_destroy
1810# endif
1811_GL_FUNCDECL_RPL (pthread_rwlockattr_destroy, int,
1812 (pthread_rwlockattr_t *attr), _GL_ARG_NONNULL ((1)));
1813_GL_CXXALIAS_RPL (pthread_rwlockattr_destroy, int,
1814 (pthread_rwlockattr_t *attr));
1815# else
1816# if !1
1817_GL_FUNCDECL_SYS (pthread_rwlockattr_destroy, int,
1818 (pthread_rwlockattr_t *attr), _GL_ARG_NONNULL ((1)));
1819# endif
1820_GL_CXXALIAS_SYS (pthread_rwlockattr_destroy, int,
1821 (pthread_rwlockattr_t *attr));
1822# endif
1823# if __GLIBC__ >= 2
1824_GL_CXXALIASWARN (pthread_rwlockattr_destroy);
1825# endif
1826#elif defined GNULIB_POSIXCHECK
1827# if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_DESTROY
1828_GL_WARN_ON_USE (pthread_rwlockattr_destroy, "pthread_rwlockattr_destroy is not portable - "
1829 "use gnulib module pthread-rwlock for portability");
1830# endif
1831#endif
1832
1833#if 0
1834# if 0
1835# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1836# undef pthread_rwlock_rdlock
1837# define pthread_rwlock_rdlock rpl_pthread_rwlock_rdlock
1838# endif
1839_GL_FUNCDECL_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock),
1840 _GL_ARG_NONNULL ((1)));
1841_GL_CXXALIAS_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock));
1842# else
1843# if !1
1844_GL_FUNCDECL_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock),
1845 _GL_ARG_NONNULL ((1)));
1846# endif
1847_GL_CXXALIAS_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock));
1848# endif
1849# if __GLIBC__ >= 2
1850_GL_CXXALIASWARN (pthread_rwlock_rdlock);
1851# endif
1852#elif defined GNULIB_POSIXCHECK
1853# if HAVE_RAW_DECL_PTHREAD_RWLOCK_RDLOCK
1854_GL_WARN_ON_USE (pthread_rwlock_rdlock, "pthread_rwlock_rdlock is not portable - "
1855 "use gnulib module pthread-rwlock for portability");
1856# endif
1857#endif
1858
1859#if 0
1860# if 0
1861# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1862# undef pthread_rwlock_wrlock
1863# define pthread_rwlock_wrlock rpl_pthread_rwlock_wrlock
1864# endif
1865_GL_FUNCDECL_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock),
1866 _GL_ARG_NONNULL ((1)));
1867_GL_CXXALIAS_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock));
1868# else
1869# if !1
1870_GL_FUNCDECL_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock),
1871 _GL_ARG_NONNULL ((1)));
1872# endif
1873_GL_CXXALIAS_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock));
1874# endif
1875# if __GLIBC__ >= 2
1876_GL_CXXALIASWARN (pthread_rwlock_wrlock);
1877# endif
1878#elif defined GNULIB_POSIXCHECK
1879# if HAVE_RAW_DECL_PTHREAD_RWLOCK_WRLOCK
1880_GL_WARN_ON_USE (pthread_rwlock_wrlock, "pthread_rwlock_wrlock is not portable - "
1881 "use gnulib module pthread-rwlock for portability");
1882# endif
1883#endif
1884
1885#if 0
1886# if 0
1887# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1888# undef pthread_rwlock_tryrdlock
1889# define pthread_rwlock_tryrdlock rpl_pthread_rwlock_tryrdlock
1890# endif
1891_GL_FUNCDECL_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock),
1892 _GL_ARG_NONNULL ((1)));
1893_GL_CXXALIAS_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock));
1894# else
1895# if !1
1896_GL_FUNCDECL_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock),
1897 _GL_ARG_NONNULL ((1)));
1898# endif
1899_GL_CXXALIAS_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock));
1900# endif
1901# if __GLIBC__ >= 2
1902_GL_CXXALIASWARN (pthread_rwlock_tryrdlock);
1903# endif
1904#elif defined GNULIB_POSIXCHECK
1905# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYRDLOCK
1906_GL_WARN_ON_USE (pthread_rwlock_tryrdlock, "pthread_rwlock_tryrdlock is not portable - "
1907 "use gnulib module pthread-rwlock for portability");
1908# endif
1909#endif
1910
1911#if 0
1912# if 0
1913# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1914# undef pthread_rwlock_trywrlock
1915# define pthread_rwlock_trywrlock rpl_pthread_rwlock_trywrlock
1916# endif
1917_GL_FUNCDECL_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock),
1918 _GL_ARG_NONNULL ((1)));
1919_GL_CXXALIAS_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock));
1920# else
1921# if !1
1922_GL_FUNCDECL_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock),
1923 _GL_ARG_NONNULL ((1)));
1924# endif
1925_GL_CXXALIAS_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock));
1926# endif
1927# if __GLIBC__ >= 2
1928_GL_CXXALIASWARN (pthread_rwlock_trywrlock);
1929# endif
1930#elif defined GNULIB_POSIXCHECK
1931# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYWRLOCK
1932_GL_WARN_ON_USE (pthread_rwlock_trywrlock, "pthread_rwlock_trywrlock is not portable - "
1933 "use gnulib module pthread-rwlock for portability");
1934# endif
1935#endif
1936
1937#if 0
1938# if 0
1939# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1940# undef pthread_rwlock_timedrdlock
1941# define pthread_rwlock_timedrdlock rpl_pthread_rwlock_timedrdlock
1942# endif
1943_GL_FUNCDECL_RPL (pthread_rwlock_timedrdlock, int,
1944 (pthread_rwlock_t *restrict lock,
1945 const struct timespec *restrict abstime),
1946 _GL_ARG_NONNULL ((1, 2)));
1947_GL_CXXALIAS_RPL (pthread_rwlock_timedrdlock, int,
1948 (pthread_rwlock_t *restrict lock,
1949 const struct timespec *restrict abstime));
1950# else
1951# if !1
1952_GL_FUNCDECL_SYS (pthread_rwlock_timedrdlock, int,
1953 (pthread_rwlock_t *restrict lock,
1954 const struct timespec *restrict abstime),
1955 _GL_ARG_NONNULL ((1, 2)));
1956# endif
1957_GL_CXXALIAS_SYS (pthread_rwlock_timedrdlock, int,
1958 (pthread_rwlock_t *restrict lock,
1959 const struct timespec *restrict abstime));
1960# endif
1961# if __GLIBC__ >= 2
1962_GL_CXXALIASWARN (pthread_rwlock_timedrdlock);
1963# endif
1964#elif defined GNULIB_POSIXCHECK
1965# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDRDLOCK
1966_GL_WARN_ON_USE (pthread_rwlock_timedrdlock, "pthread_rwlock_timedrdlock is not portable - "
1967 "use gnulib module pthread-rwlock for portability");
1968# endif
1969#endif
1970
1971#if 0
1972# if 0
1973# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1974# undef pthread_rwlock_timedwrlock
1975# define pthread_rwlock_timedwrlock rpl_pthread_rwlock_timedwrlock
1976# endif
1977_GL_FUNCDECL_RPL (pthread_rwlock_timedwrlock, int,
1978 (pthread_rwlock_t *restrict lock,
1979 const struct timespec *restrict abstime),
1980 _GL_ARG_NONNULL ((1, 2)));
1981_GL_CXXALIAS_RPL (pthread_rwlock_timedwrlock, int,
1982 (pthread_rwlock_t *restrict lock,
1983 const struct timespec *restrict abstime));
1984# else
1985# if !1
1986_GL_FUNCDECL_SYS (pthread_rwlock_timedwrlock, int,
1987 (pthread_rwlock_t *restrict lock,
1988 const struct timespec *restrict abstime),
1989 _GL_ARG_NONNULL ((1, 2)));
1990# endif
1991_GL_CXXALIAS_SYS (pthread_rwlock_timedwrlock, int,
1992 (pthread_rwlock_t *restrict lock,
1993 const struct timespec *restrict abstime));
1994# endif
1995# if __GLIBC__ >= 2
1996_GL_CXXALIASWARN (pthread_rwlock_timedwrlock);
1997# endif
1998#elif defined GNULIB_POSIXCHECK
1999# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDWRLOCK
2000_GL_WARN_ON_USE (pthread_rwlock_timedwrlock, "pthread_rwlock_timedwrlock is not portable - "
2001 "use gnulib module pthread-rwlock for portability");
2002# endif
2003#endif
2004
2005#if 0
2006# if 0
2007# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2008# undef pthread_rwlock_unlock
2009# define pthread_rwlock_unlock rpl_pthread_rwlock_unlock
2010# endif
2011_GL_FUNCDECL_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock),
2012 _GL_ARG_NONNULL ((1)));
2013_GL_CXXALIAS_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock));
2014# else
2015# if !1
2016_GL_FUNCDECL_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock),
2017 _GL_ARG_NONNULL ((1)));
2018# endif
2019_GL_CXXALIAS_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock));
2020# endif
2021# if __GLIBC__ >= 2
2022_GL_CXXALIASWARN (pthread_rwlock_unlock);
2023# endif
2024#elif defined GNULIB_POSIXCHECK
2025# if HAVE_RAW_DECL_PTHREAD_RWLOCK_UNLOCK
2026_GL_WARN_ON_USE (pthread_rwlock_unlock, "pthread_rwlock_unlock is not portable - "
2027 "use gnulib module pthread-rwlock for portability");
2028# endif
2029#endif
2030
2031#if 0
2032# if 0
2033# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2034# undef pthread_rwlock_destroy
2035# define pthread_rwlock_destroy rpl_pthread_rwlock_destroy
2036# endif
2037_GL_FUNCDECL_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock),
2038 _GL_ARG_NONNULL ((1)));
2039_GL_CXXALIAS_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock));
2040# else
2041# if !1
2042_GL_FUNCDECL_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock),
2043 _GL_ARG_NONNULL ((1)));
2044# endif
2045_GL_CXXALIAS_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock));
2046# endif
2047# if __GLIBC__ >= 2
2048_GL_CXXALIASWARN (pthread_rwlock_destroy);
2049# endif
2050#elif defined GNULIB_POSIXCHECK
2051# if HAVE_RAW_DECL_PTHREAD_RWLOCK_DESTROY
2052_GL_WARN_ON_USE (pthread_rwlock_destroy, "pthread_rwlock_destroy is not portable - "
2053 "use gnulib module pthread-rwlock for portability");
2054# endif
2055#endif
2056
2057/* =========== Condition variable functions =========== */
2058
2059#if 0
2060# if 0
2061# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2062# undef pthread_cond_init
2063# define pthread_cond_init rpl_pthread_cond_init
2064# endif
2065_GL_FUNCDECL_RPL (pthread_cond_init, int,
2066 (pthread_cond_t *restrict cond,
2067 const pthread_condattr_t *restrict attr),
2068 _GL_ARG_NONNULL ((1)));
2069_GL_CXXALIAS_RPL (pthread_cond_init, int,
2070 (pthread_cond_t *restrict cond,
2071 const pthread_condattr_t *restrict attr));
2072# else
2073# if !1
2074_GL_FUNCDECL_SYS (pthread_cond_init, int,
2075 (pthread_cond_t *restrict cond,
2076 const pthread_condattr_t *restrict attr),
2077 _GL_ARG_NONNULL ((1)));
2078# endif
2079_GL_CXXALIAS_SYS (pthread_cond_init, int,
2080 (pthread_cond_t *restrict cond,
2081 const pthread_condattr_t *restrict attr));
2082# endif
2083# if __GLIBC__ >= 2
2084_GL_CXXALIASWARN (pthread_cond_init);
2085# endif
2086#elif defined GNULIB_POSIXCHECK
2087# if HAVE_RAW_DECL_PTHREAD_COND_INIT
2088_GL_WARN_ON_USE (pthread_cond_init, "pthread_cond_init is not portable - "
2089 "use gnulib module pthread-cond for portability");
2090# endif
2091#endif
2092
2093#if 0
2094# if 0
2095# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2096# undef pthread_condattr_init
2097# define pthread_condattr_init rpl_pthread_condattr_init
2098# endif
2099_GL_FUNCDECL_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr),
2100 _GL_ARG_NONNULL ((1)));
2101_GL_CXXALIAS_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr));
2102# else
2103# if !1
2104_GL_FUNCDECL_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr),
2105 _GL_ARG_NONNULL ((1)));
2106# endif
2107_GL_CXXALIAS_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr));
2108# endif
2109# if __GLIBC__ >= 2
2110_GL_CXXALIASWARN (pthread_condattr_init);
2111# endif
2112#elif defined GNULIB_POSIXCHECK
2113# if HAVE_RAW_DECL_PTHREAD_CONDATTR_INIT
2114_GL_WARN_ON_USE (pthread_condattr_init, "pthread_condattr_init is not portable - "
2115 "use gnulib module pthread-cond for portability");
2116# endif
2117#endif
2118
2119#if 0
2120# if 0
2121# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2122# undef pthread_condattr_destroy
2123# define pthread_condattr_destroy rpl_pthread_condattr_destroy
2124# endif
2125_GL_FUNCDECL_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr),
2126 _GL_ARG_NONNULL ((1)));
2127_GL_CXXALIAS_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr));
2128# else
2129# if !1
2130_GL_FUNCDECL_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr),
2131 _GL_ARG_NONNULL ((1)));
2132# endif
2133_GL_CXXALIAS_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr));
2134# endif
2135# if __GLIBC__ >= 2
2136_GL_CXXALIASWARN (pthread_condattr_destroy);
2137# endif
2138#elif defined GNULIB_POSIXCHECK
2139# if HAVE_RAW_DECL_PTHREAD_CONDATTR_DESTROY
2140_GL_WARN_ON_USE (pthread_condattr_destroy, "pthread_condattr_destroy is not portable - "
2141 "use gnulib module pthread-cond for portability");
2142# endif
2143#endif
2144
2145#if 0
2146# if 0
2147# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2148# undef pthread_cond_wait
2149# define pthread_cond_wait rpl_pthread_cond_wait
2150# endif
2151_GL_FUNCDECL_RPL (pthread_cond_wait, int,
2152 (pthread_cond_t *restrict cond,
2153 pthread_mutex_t *restrict mutex),
2154 _GL_ARG_NONNULL ((1, 2)));
2155_GL_CXXALIAS_RPL (pthread_cond_wait, int,
2156 (pthread_cond_t *restrict cond,
2157 pthread_mutex_t *restrict mutex));
2158# else
2159# if !1
2160_GL_FUNCDECL_SYS (pthread_cond_wait, int,
2161 (pthread_cond_t *restrict cond,
2162 pthread_mutex_t *restrict mutex),
2163 _GL_ARG_NONNULL ((1, 2)));
2164# endif
2165_GL_CXXALIAS_SYS (pthread_cond_wait, int,
2166 (pthread_cond_t *restrict cond,
2167 pthread_mutex_t *restrict mutex));
2168# endif
2169# if __GLIBC__ >= 2
2170_GL_CXXALIASWARN (pthread_cond_wait);
2171# endif
2172#elif defined GNULIB_POSIXCHECK
2173# if HAVE_RAW_DECL_PTHREAD_COND_WAIT
2174_GL_WARN_ON_USE (pthread_cond_wait, "pthread_cond_wait is not portable - "
2175 "use gnulib module pthread-cond for portability");
2176# endif
2177#endif
2178
2179#if 0
2180# if 0
2181# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2182# undef pthread_cond_timedwait
2183# define pthread_cond_timedwait rpl_pthread_cond_timedwait
2184# endif
2185_GL_FUNCDECL_RPL (pthread_cond_timedwait, int,
2186 (pthread_cond_t *restrict cond,
2187 pthread_mutex_t *restrict mutex,
2188 const struct timespec *restrict abstime),
2189 _GL_ARG_NONNULL ((1, 2, 3)));
2190_GL_CXXALIAS_RPL (pthread_cond_timedwait, int,
2191 (pthread_cond_t *restrict cond,
2192 pthread_mutex_t *restrict mutex,
2193 const struct timespec *restrict abstime));
2194# else
2195# if !1
2196_GL_FUNCDECL_SYS (pthread_cond_timedwait, int,
2197 (pthread_cond_t *restrict cond,
2198 pthread_mutex_t *restrict mutex,
2199 const struct timespec *restrict abstime),
2200 _GL_ARG_NONNULL ((1, 2, 3)));
2201# endif
2202_GL_CXXALIAS_SYS (pthread_cond_timedwait, int,
2203 (pthread_cond_t *restrict cond,
2204 pthread_mutex_t *restrict mutex,
2205 const struct timespec *restrict abstime));
2206# endif
2207# if __GLIBC__ >= 2
2208_GL_CXXALIASWARN (pthread_cond_timedwait);
2209# endif
2210#elif defined GNULIB_POSIXCHECK
2211# if HAVE_RAW_DECL_PTHREAD_COND_TIMEDWAIT
2212_GL_WARN_ON_USE (pthread_cond_timedwait, "pthread_cond_timedwait is not portable - "
2213 "use gnulib module pthread-cond for portability");
2214# endif
2215#endif
2216
2217#if 0
2218# if 0
2219# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2220# undef pthread_cond_signal
2221# define pthread_cond_signal rpl_pthread_cond_signal
2222# endif
2223_GL_FUNCDECL_RPL (pthread_cond_signal, int, (pthread_cond_t *cond),
2224 _GL_ARG_NONNULL ((1)));
2225_GL_CXXALIAS_RPL (pthread_cond_signal, int, (pthread_cond_t *cond));
2226# else
2227# if !1
2228_GL_FUNCDECL_SYS (pthread_cond_signal, int, (pthread_cond_t *cond),
2229 _GL_ARG_NONNULL ((1)));
2230# endif
2231_GL_CXXALIAS_SYS (pthread_cond_signal, int, (pthread_cond_t *cond));
2232# endif
2233# if __GLIBC__ >= 2
2234_GL_CXXALIASWARN (pthread_cond_signal);
2235# endif
2236#elif defined GNULIB_POSIXCHECK
2237# if HAVE_RAW_DECL_PTHREAD_COND_SIGNAL
2238_GL_WARN_ON_USE (pthread_cond_signal, "pthread_cond_signal is not portable - "
2239 "use gnulib module pthread-cond for portability");
2240# endif
2241#endif
2242
2243#if 0
2244# if 0
2245# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2246# undef pthread_cond_broadcast
2247# define pthread_cond_broadcast rpl_pthread_cond_broadcast
2248# endif
2249_GL_FUNCDECL_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond),
2250 _GL_ARG_NONNULL ((1)));
2251_GL_CXXALIAS_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond));
2252# else
2253# if !1
2254_GL_FUNCDECL_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond),
2255 _GL_ARG_NONNULL ((1)));
2256# endif
2257_GL_CXXALIAS_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond));
2258# endif
2259# if __GLIBC__ >= 2
2260_GL_CXXALIASWARN (pthread_cond_broadcast);
2261# endif
2262#elif defined GNULIB_POSIXCHECK
2263# if HAVE_RAW_DECL_PTHREAD_COND_BROADCAST
2264_GL_WARN_ON_USE (pthread_cond_broadcast, "pthread_cond_broadcast is not portable - "
2265 "use gnulib module pthread-cond for portability");
2266# endif
2267#endif
2268
2269#if 0
2270# if 0
2271# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2272# undef pthread_cond_destroy
2273# define pthread_cond_destroy rpl_pthread_cond_destroy
2274# endif
2275_GL_FUNCDECL_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond),
2276 _GL_ARG_NONNULL ((1)));
2277_GL_CXXALIAS_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond));
2278# else
2279# if !1
2280_GL_FUNCDECL_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond),
2281 _GL_ARG_NONNULL ((1)));
2282# endif
2283_GL_CXXALIAS_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond));
2284# endif
2285# if __GLIBC__ >= 2
2286_GL_CXXALIASWARN (pthread_cond_destroy);
2287# endif
2288#elif defined GNULIB_POSIXCHECK
2289# if HAVE_RAW_DECL_PTHREAD_COND_DESTROY
2290_GL_WARN_ON_USE (pthread_cond_destroy, "pthread_cond_destroy is not portable - "
2291 "use gnulib module pthread-cond for portability");
2292# endif
2293#endif
2294
2295/* =========== Thread-specific storage functions =========== */
2296
2297#if 0
2298# if 0
2299# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2300# undef pthread_key_create
2301# define pthread_key_create rpl_pthread_key_create
2302# endif
2303_GL_FUNCDECL_RPL (pthread_key_create, int,
2304 (pthread_key_t *keyp, void (*destructor) (void *)),
2305 _GL_ARG_NONNULL ((1)));
2306_GL_CXXALIAS_RPL (pthread_key_create, int,
2307 (pthread_key_t *keyp, void (*destructor) (void *)));
2308# else
2309# if !1
2310_GL_FUNCDECL_SYS (pthread_key_create, int,
2311 (pthread_key_t *keyp, void (*destructor) (void *)),
2312 _GL_ARG_NONNULL ((1)));
2313# endif
2314_GL_CXXALIAS_SYS_CAST (pthread_key_create, int,
2315 (pthread_key_t *keyp, void (*destructor) (void *)));
2316# endif
2317# if __GLIBC__ >= 2
2318_GL_CXXALIASWARN (pthread_key_create);
2319# endif
2320#elif defined GNULIB_POSIXCHECK
2321# if HAVE_RAW_DECL_PTHREAD_KEY_CREATE
2322_GL_WARN_ON_USE (pthread_key_create, "pthread_key_create is not portable - "
2323 "use gnulib module pthread-tss for portability");
2324# endif
2325#endif
2326
2327#if 0
2328# if 0
2329# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2330# undef pthread_setspecific
2331# define pthread_setspecific rpl_pthread_setspecific
2332# endif
2333_GL_FUNCDECL_RPL (pthread_setspecific, int,
2334 (pthread_key_t key, const void *value), );
2335_GL_CXXALIAS_RPL (pthread_setspecific, int,
2336 (pthread_key_t key, const void *value));
2337# else
2338# if !1
2339_GL_FUNCDECL_SYS (pthread_setspecific, int,
2340 (pthread_key_t key, const void *value), );
2341# endif
2342_GL_CXXALIAS_SYS (pthread_setspecific, int,
2343 (pthread_key_t key, const void *value));
2344# endif
2345# if __GLIBC__ >= 2
2346_GL_CXXALIASWARN (pthread_setspecific);
2347# endif
2348#elif defined GNULIB_POSIXCHECK
2349# if HAVE_RAW_DECL_PTHREAD_SETSPECIFIC
2350_GL_WARN_ON_USE (pthread_setspecific, "pthread_setspecific is not portable - "
2351 "use gnulib module pthread-tss for portability");
2352# endif
2353#endif
2354
2355#if 0
2356# if 0
2357# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2358# undef pthread_getspecific
2359# define pthread_getspecific rpl_pthread_getspecific
2360# endif
2361_GL_FUNCDECL_RPL (pthread_getspecific, void *, (pthread_key_t key), );
2362_GL_CXXALIAS_RPL (pthread_getspecific, void *, (pthread_key_t key));
2363# else
2364# if !1
2365_GL_FUNCDECL_SYS (pthread_getspecific, void *, (pthread_key_t key), );
2366# endif
2367_GL_CXXALIAS_SYS (pthread_getspecific, void *, (pthread_key_t key));
2368# endif
2369# if __GLIBC__ >= 2
2370_GL_CXXALIASWARN (pthread_getspecific);
2371# endif
2372#elif defined GNULIB_POSIXCHECK
2373# if HAVE_RAW_DECL_PTHREAD_GETSPECIFIC
2374_GL_WARN_ON_USE (pthread_getspecific, "pthread_getspecific is not portable - "
2375 "use gnulib module pthread-tss for portability");
2376# endif
2377#endif
2378
2379#if 0
2380# if 0
2381# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2382# undef pthread_key_delete
2383# define pthread_key_delete rpl_pthread_key_delete
2384# endif
2385_GL_FUNCDECL_RPL (pthread_key_delete, int, (pthread_key_t key), );
2386_GL_CXXALIAS_RPL (pthread_key_delete, int, (pthread_key_t key));
2387# else
2388# if !1
2389_GL_FUNCDECL_SYS (pthread_key_delete, int, (pthread_key_t key), );
2390# endif
2391_GL_CXXALIAS_SYS (pthread_key_delete, int, (pthread_key_t key));
2392# endif
2393# if __GLIBC__ >= 2
2394_GL_CXXALIASWARN (pthread_key_delete);
2395# endif
2396#elif defined GNULIB_POSIXCHECK
2397# if HAVE_RAW_DECL_PTHREAD_KEY_DELETE
2398_GL_WARN_ON_USE (pthread_key_delete, "pthread_key_delete is not portable - "
2399 "use gnulib module pthread-tss for portability");
2400# endif
2401#endif
2402
2403/* =========== Spinlock functions =========== */
2404
2405#if 0
2406# if 0
2407# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2408# undef pthread_spin_init
2409# define pthread_spin_init rpl_pthread_spin_init
2410# endif
2411_GL_FUNCDECL_RPL (pthread_spin_init, int,
2412 (pthread_spinlock_t *lock, int shared_across_processes),
2413 _GL_ARG_NONNULL ((1)));
2414_GL_CXXALIAS_RPL (pthread_spin_init, int,
2415 (pthread_spinlock_t *lock, int shared_across_processes));
2416# else
2417# if !1
2418_GL_FUNCDECL_SYS (pthread_spin_init, int,
2419 (pthread_spinlock_t *lock, int shared_across_processes),
2420 _GL_ARG_NONNULL ((1)));
2421# endif
2422_GL_CXXALIAS_SYS (pthread_spin_init, int,
2423 (pthread_spinlock_t *lock, int shared_across_processes));
2424# endif
2425# if __GLIBC__ >= 2
2426_GL_CXXALIASWARN (pthread_spin_init);
2427# endif
2428#elif defined GNULIB_POSIXCHECK
2429# if HAVE_RAW_DECL_PTHREAD_SPIN_INIT
2430_GL_WARN_ON_USE (pthread_spin_init, "pthread_spin_init is not portable - "
2431 "use gnulib module pthread-spin for portability");
2432# endif
2433#endif
2434
2435#if 0
2436# if 0
2437# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2438# undef pthread_spin_lock
2439# define pthread_spin_lock rpl_pthread_spin_lock
2440# endif
2441_GL_FUNCDECL_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock),
2442 _GL_ARG_NONNULL ((1)));
2443_GL_CXXALIAS_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock));
2444# else
2445# if !1
2446_GL_FUNCDECL_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock),
2447 _GL_ARG_NONNULL ((1)));
2448# endif
2449_GL_CXXALIAS_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock));
2450# endif
2451# if __GLIBC__ >= 2
2452_GL_CXXALIASWARN (pthread_spin_lock);
2453# endif
2454#elif defined GNULIB_POSIXCHECK
2455# if HAVE_RAW_DECL_PTHREAD_SPIN_LOCK
2456_GL_WARN_ON_USE (pthread_spin_lock, "pthread_spin_lock is not portable - "
2457 "use gnulib module pthread-spin for portability");
2458# endif
2459#endif
2460
2461#if 0
2462# if 0
2463# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2464# undef pthread_spin_trylock
2465# define pthread_spin_trylock rpl_pthread_spin_trylock
2466# endif
2467_GL_FUNCDECL_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock),
2468 _GL_ARG_NONNULL ((1)));
2469_GL_CXXALIAS_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock));
2470# else
2471# if !1
2472_GL_FUNCDECL_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock),
2473 _GL_ARG_NONNULL ((1)));
2474# endif
2475_GL_CXXALIAS_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock));
2476# endif
2477# if __GLIBC__ >= 2
2478_GL_CXXALIASWARN (pthread_spin_trylock);
2479# endif
2480#elif defined GNULIB_POSIXCHECK
2481# if HAVE_RAW_DECL_PTHREAD_SPIN_TRYLOCK
2482_GL_WARN_ON_USE (pthread_spin_trylock, "pthread_spin_trylock is not portable - "
2483 "use gnulib module pthread-spin for portability");
2484# endif
2485#endif
2486
2487#if 0
2488# if 0
2489# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2490# undef pthread_spin_unlock
2491# define pthread_spin_unlock rpl_pthread_spin_unlock
2492# endif
2493_GL_FUNCDECL_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock),
2494 _GL_ARG_NONNULL ((1)));
2495_GL_CXXALIAS_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock));
2496# else
2497# if !1
2498_GL_FUNCDECL_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock),
2499 _GL_ARG_NONNULL ((1)));
2500# endif
2501_GL_CXXALIAS_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock));
2502# endif
2503# if __GLIBC__ >= 2
2504_GL_CXXALIASWARN (pthread_spin_unlock);
2505# endif
2506#elif defined GNULIB_POSIXCHECK
2507# if HAVE_RAW_DECL_PTHREAD_SPIN_UNLOCK
2508_GL_WARN_ON_USE (pthread_spin_unlock, "pthread_spin_unlock is not portable - "
2509 "use gnulib module pthread-spin for portability");
2510# endif
2511#endif
2512
2513#if 0
2514# if 0
2515# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2516# undef pthread_spin_destroy
2517# define pthread_spin_destroy rpl_pthread_spin_destroy
2518# endif
2519_GL_FUNCDECL_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock),
2520 _GL_ARG_NONNULL ((1)));
2521_GL_CXXALIAS_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock));
2522# else
2523# if !1
2524_GL_FUNCDECL_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock),
2525 _GL_ARG_NONNULL ((1)));
2526# endif
2527_GL_CXXALIAS_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock));
2528# endif
2529# if __GLIBC__ >= 2
2530_GL_CXXALIASWARN (pthread_spin_destroy);
2531# endif
2532#elif defined GNULIB_POSIXCHECK
2533# if HAVE_RAW_DECL_PTHREAD_SPIN_DESTROY
2534_GL_WARN_ON_USE (pthread_spin_destroy, "pthread_spin_destroy is not portable - "
2535 "use gnulib module pthread-spin for portability");
2536# endif
2537#endif
2538
2539
2540#if defined __cplusplus && defined GNULIB_NAMESPACE && !1 && defined __MINGW32__
2541/* Provide the symbols required by mingw's <bits/gthr-default.h>. */
2542using GNULIB_NAMESPACE::pthread_create;
2543using GNULIB_NAMESPACE::pthread_self;
2544using GNULIB_NAMESPACE::pthread_equal;
2545using GNULIB_NAMESPACE::pthread_detach;
2546using GNULIB_NAMESPACE::pthread_join;
2547using GNULIB_NAMESPACE::pthread_once;
2548using GNULIB_NAMESPACE::pthread_mutex_init;
2549using GNULIB_NAMESPACE::pthread_mutexattr_init;
2550using GNULIB_NAMESPACE::pthread_mutexattr_settype;
2551using GNULIB_NAMESPACE::pthread_mutexattr_destroy;
2552using GNULIB_NAMESPACE::pthread_mutex_lock;
2553using GNULIB_NAMESPACE::pthread_mutex_trylock;
2554using GNULIB_NAMESPACE::pthread_mutex_timedlock;
2555using GNULIB_NAMESPACE::pthread_mutex_unlock;
2556using GNULIB_NAMESPACE::pthread_mutex_destroy;
2557using GNULIB_NAMESPACE::pthread_cond_wait;
2558using GNULIB_NAMESPACE::pthread_cond_timedwait;
2559using GNULIB_NAMESPACE::pthread_cond_signal;
2560using GNULIB_NAMESPACE::pthread_cond_broadcast;
2561using GNULIB_NAMESPACE::pthread_cond_destroy;
2562using GNULIB_NAMESPACE::pthread_key_create;
2563using GNULIB_NAMESPACE::pthread_setspecific;
2564using GNULIB_NAMESPACE::pthread_getspecific;
2565using GNULIB_NAMESPACE::pthread_key_delete;
2566#endif
2567
2568
2569#endif /* _GL_PTHREAD_H_ */
2570#endif /* _GL_PTHREAD_H_ */
2571#endif
diff --git a/gl/pthread.in.h b/gl/pthread.in.h
new file mode 100644
index 00000000..28592cfc
--- /dev/null
+++ b/gl/pthread.in.h
@@ -0,0 +1,2032 @@
1/* Implement the most essential subset of POSIX pthread.h.
2
3 Copyright (C) 2009-2025 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# undef pthread_create
526# if HAVE_RAW_DECL_PTHREAD_CREATE
527_GL_WARN_ON_USE (pthread_create, "pthread_create is not portable - "
528 "use gnulib module pthread-thread for portability");
529# endif
530#endif
531
532#if @GNULIB_PTHREAD_THREAD@
533# if @REPLACE_PTHREAD_ATTR_INIT@
534# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
535# undef pthread_attr_init
536# define pthread_attr_init rpl_pthread_attr_init
537# endif
538_GL_FUNCDECL_RPL (pthread_attr_init, int, (pthread_attr_t *attr),
539 _GL_ARG_NONNULL ((1)));
540_GL_CXXALIAS_RPL (pthread_attr_init, int, (pthread_attr_t *attr));
541# else
542# if !@HAVE_PTHREAD_ATTR_INIT@
543_GL_FUNCDECL_SYS (pthread_attr_init, int, (pthread_attr_t *attr),
544 _GL_ARG_NONNULL ((1)));
545# endif
546_GL_CXXALIAS_SYS (pthread_attr_init, int, (pthread_attr_t *attr));
547# endif
548# if __GLIBC__ >= 2
549_GL_CXXALIASWARN (pthread_attr_init);
550# endif
551#elif defined GNULIB_POSIXCHECK
552# undef pthread_attr_init
553# if HAVE_RAW_DECL_PTHREAD_ATTR_INIT
554_GL_WARN_ON_USE (pthread_attr_init, "pthread_attr_init is not portable - "
555 "use gnulib module pthread-thread for portability");
556# endif
557#endif
558
559#if @GNULIB_PTHREAD_THREAD@
560# if @REPLACE_PTHREAD_ATTR_GETDETACHSTATE@
561# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
562# undef pthread_attr_getdetachstate
563# define pthread_attr_getdetachstate rpl_pthread_attr_getdetachstate
564# endif
565_GL_FUNCDECL_RPL (pthread_attr_getdetachstate, int,
566 (const pthread_attr_t *attr, int *detachstatep),
567 _GL_ARG_NONNULL ((1, 2)));
568_GL_CXXALIAS_RPL (pthread_attr_getdetachstate, int,
569 (const pthread_attr_t *attr, int *detachstatep));
570# else
571# if !@HAVE_PTHREAD_ATTR_GETDETACHSTATE@
572_GL_FUNCDECL_SYS (pthread_attr_getdetachstate, int,
573 (const pthread_attr_t *attr, int *detachstatep),
574 _GL_ARG_NONNULL ((1, 2)));
575# endif
576_GL_CXXALIAS_SYS (pthread_attr_getdetachstate, int,
577 (const pthread_attr_t *attr, int *detachstatep));
578# endif
579# if __GLIBC__ >= 2
580_GL_CXXALIASWARN (pthread_attr_getdetachstate);
581# endif
582#elif defined GNULIB_POSIXCHECK
583# undef pthread_attr_getdetachstate
584# if HAVE_RAW_DECL_PTHREAD_ATTR_GETDETACHSTATE
585_GL_WARN_ON_USE (pthread_attr_getdetachstate, "pthread_attr_getdetachstate is not portable - "
586 "use gnulib module pthread-thread for portability");
587# endif
588#endif
589
590#if @GNULIB_PTHREAD_THREAD@
591# if @REPLACE_PTHREAD_ATTR_SETDETACHSTATE@
592# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
593# undef pthread_attr_setdetachstate
594# define pthread_attr_setdetachstate rpl_pthread_attr_setdetachstate
595# endif
596_GL_FUNCDECL_RPL (pthread_attr_setdetachstate, int,
597 (pthread_attr_t *attr, int detachstate),
598 _GL_ARG_NONNULL ((1)));
599_GL_CXXALIAS_RPL (pthread_attr_setdetachstate, int,
600 (pthread_attr_t *attr, int detachstate));
601# else
602# if !@HAVE_PTHREAD_ATTR_SETDETACHSTATE@
603_GL_FUNCDECL_SYS (pthread_attr_setdetachstate, int,
604 (pthread_attr_t *attr, int detachstate),
605 _GL_ARG_NONNULL ((1)));
606# endif
607_GL_CXXALIAS_SYS (pthread_attr_setdetachstate, int,
608 (pthread_attr_t *attr, int detachstate));
609# endif
610# if __GLIBC__ >= 2
611_GL_CXXALIASWARN (pthread_attr_setdetachstate);
612# endif
613#elif defined GNULIB_POSIXCHECK
614# undef pthread_attr_setdetachstate
615# if HAVE_RAW_DECL_PTHREAD_ATTR_SETDETACHSTATE
616_GL_WARN_ON_USE (pthread_attr_setdetachstate, "pthread_attr_setdetachstate is not portable - "
617 "use gnulib module pthread-thread for portability");
618# endif
619#endif
620
621#if @GNULIB_PTHREAD_THREAD@
622# if @REPLACE_PTHREAD_ATTR_DESTROY@
623# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
624# undef pthread_attr_destroy
625# define pthread_attr_destroy rpl_pthread_attr_destroy
626# endif
627_GL_FUNCDECL_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr),
628 _GL_ARG_NONNULL ((1)));
629_GL_CXXALIAS_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr));
630# else
631# if !@HAVE_PTHREAD_ATTR_DESTROY@
632_GL_FUNCDECL_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr),
633 _GL_ARG_NONNULL ((1)));
634# endif
635_GL_CXXALIAS_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr));
636# endif
637# if __GLIBC__ >= 2
638_GL_CXXALIASWARN (pthread_attr_destroy);
639# endif
640#elif defined GNULIB_POSIXCHECK
641# undef pthread_attr_destroy
642# if HAVE_RAW_DECL_PTHREAD_ATTR_DESTROY
643_GL_WARN_ON_USE (pthread_attr_destroy, "pthread_attr_destroy is not portable - "
644 "use gnulib module pthread-thread for portability");
645# endif
646#endif
647
648#if @GNULIB_PTHREAD_THREAD@
649# if @REPLACE_PTHREAD_SELF@
650# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
651# undef pthread_self
652# define pthread_self rpl_pthread_self
653# endif
654_GL_FUNCDECL_RPL (pthread_self, pthread_t, (void), _GL_ATTRIBUTE_PURE);
655_GL_CXXALIAS_RPL (pthread_self, pthread_t, (void));
656# else
657# if !@HAVE_PTHREAD_SELF@
658_GL_FUNCDECL_SYS (pthread_self, pthread_t, (void), _GL_ATTRIBUTE_PURE);
659# endif
660_GL_CXXALIAS_SYS (pthread_self, pthread_t, (void));
661# endif
662# if __GLIBC__ >= 2
663_GL_CXXALIASWARN (pthread_self);
664# endif
665#elif defined GNULIB_POSIXCHECK
666# undef pthread_self
667# if HAVE_RAW_DECL_PTHREAD_SELF
668_GL_WARN_ON_USE (pthread_self, "pthread_self is not portable - "
669 "use gnulib module pthread-thread for portability");
670# endif
671#endif
672
673#if @GNULIB_PTHREAD_THREAD@
674# if @REPLACE_PTHREAD_EQUAL@
675# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
676# undef pthread_equal
677# define pthread_equal rpl_pthread_equal
678# endif
679_GL_FUNCDECL_RPL (pthread_equal, int, (pthread_t thread1, pthread_t thread2), );
680_GL_CXXALIAS_RPL (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
681# else
682# if !@HAVE_PTHREAD_EQUAL@
683_GL_FUNCDECL_SYS (pthread_equal, int, (pthread_t thread1, pthread_t thread2), );
684# endif
685_GL_CXXALIAS_SYS (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
686# endif
687# if __GLIBC__ >= 2
688_GL_CXXALIASWARN (pthread_equal);
689# endif
690#elif defined GNULIB_POSIXCHECK
691# undef pthread_equal
692# if HAVE_RAW_DECL_PTHREAD_EQUAL
693_GL_WARN_ON_USE (pthread_equal, "pthread_equal is not portable - "
694 "use gnulib module pthread-thread for portability");
695# endif
696#endif
697
698#if @GNULIB_PTHREAD_THREAD@
699# if @REPLACE_PTHREAD_DETACH@
700# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
701# undef pthread_detach
702# define pthread_detach rpl_pthread_detach
703# endif
704_GL_FUNCDECL_RPL (pthread_detach, int, (pthread_t thread), );
705_GL_CXXALIAS_RPL (pthread_detach, int, (pthread_t thread));
706# else
707# if !@HAVE_PTHREAD_DETACH@
708_GL_FUNCDECL_SYS (pthread_detach, int, (pthread_t thread), );
709# endif
710_GL_CXXALIAS_SYS (pthread_detach, int, (pthread_t thread));
711# endif
712# if __GLIBC__ >= 2
713_GL_CXXALIASWARN (pthread_detach);
714# endif
715#elif defined GNULIB_POSIXCHECK
716# undef pthread_detach
717# if HAVE_RAW_DECL_PTHREAD_DETACH
718_GL_WARN_ON_USE (pthread_detach, "pthread_detach is not portable - "
719 "use gnulib module pthread-thread for portability");
720# endif
721#endif
722
723#if @GNULIB_PTHREAD_THREAD@
724# if @REPLACE_PTHREAD_JOIN@
725# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
726# undef pthread_join
727# define pthread_join rpl_pthread_join
728# endif
729_GL_FUNCDECL_RPL (pthread_join, int, (pthread_t thread, void **valuep), );
730_GL_CXXALIAS_RPL (pthread_join, int, (pthread_t thread, void **valuep));
731# else
732# if !@HAVE_PTHREAD_JOIN@
733_GL_FUNCDECL_SYS (pthread_join, int, (pthread_t thread, void **valuep), );
734# endif
735_GL_CXXALIAS_SYS (pthread_join, int, (pthread_t thread, void **valuep));
736# endif
737# if __GLIBC__ >= 2
738_GL_CXXALIASWARN (pthread_join);
739# endif
740#elif defined GNULIB_POSIXCHECK
741# undef pthread_join
742# if HAVE_RAW_DECL_PTHREAD_JOIN
743_GL_WARN_ON_USE (pthread_join, "pthread_join is not portable - "
744 "use gnulib module pthread-thread for portability");
745# endif
746#endif
747
748#if @GNULIB_PTHREAD_THREAD@
749# if @REPLACE_PTHREAD_EXIT@
750# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
751# undef pthread_exit
752# define pthread_exit rpl_pthread_exit
753# endif
754_GL_FUNCDECL_RPL (pthread_exit, _Noreturn void, (void *value), );
755_GL_CXXALIAS_RPL (pthread_exit, void, (void *value));
756# else
757# if !@HAVE_PTHREAD_EXIT@
758_GL_FUNCDECL_SYS (pthread_exit, _Noreturn void, (void *value), );
759# endif
760/* Need to cast because of AIX with xlclang++. */
761_GL_CXXALIAS_SYS_CAST (pthread_exit, void, (void *value));
762# endif
763# if __GLIBC__ >= 2
764_GL_CXXALIASWARN (pthread_exit);
765# endif
766#elif defined GNULIB_POSIXCHECK
767# undef pthread_exit
768# if HAVE_RAW_DECL_PTHREAD_EXIT
769_GL_WARN_ON_USE (pthread_exit, "pthread_exit is not portable - "
770 "use gnulib module pthread-thread for portability");
771# endif
772#endif
773
774/* =========== Once-only control (initialization) functions =========== */
775
776#if @GNULIB_PTHREAD_ONCE@
777# if @REPLACE_PTHREAD_ONCE@
778# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
779# undef pthread_once
780# define pthread_once rpl_pthread_once
781# endif
782_GL_FUNCDECL_RPL (pthread_once, int,
783 (pthread_once_t *once_control, void (*initfunction) (void)),
784 _GL_ARG_NONNULL ((1, 2)));
785_GL_CXXALIAS_RPL (pthread_once, int,
786 (pthread_once_t *once_control, void (*initfunction) (void)));
787# else
788# if !@HAVE_PTHREAD_ONCE@
789_GL_FUNCDECL_SYS (pthread_once, int,
790 (pthread_once_t *once_control, void (*initfunction) (void)),
791 _GL_ARG_NONNULL ((1, 2)));
792# endif
793_GL_CXXALIAS_SYS_CAST (pthread_once, int,
794 (pthread_once_t *once_control,
795 void (*initfunction) (void)));
796# endif
797# if __GLIBC__ >= 2
798_GL_CXXALIASWARN (pthread_once);
799# endif
800#elif defined GNULIB_POSIXCHECK
801# undef pthread_once
802# if HAVE_RAW_DECL_PTHREAD_ONCE
803_GL_WARN_ON_USE (pthread_once, "pthread_once is not portable - "
804 "use gnulib module pthread-once for portability");
805# endif
806#endif
807
808/* =========== Mutex functions =========== */
809
810#if @GNULIB_PTHREAD_MUTEX@
811# if @REPLACE_PTHREAD_MUTEX_INIT@
812# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
813# undef pthread_mutex_init
814# define pthread_mutex_init rpl_pthread_mutex_init
815# endif
816_GL_FUNCDECL_RPL (pthread_mutex_init, int,
817 (pthread_mutex_t *restrict mutex,
818 const pthread_mutexattr_t *restrict attr),
819 _GL_ARG_NONNULL ((1)));
820_GL_CXXALIAS_RPL (pthread_mutex_init, int,
821 (pthread_mutex_t *restrict mutex,
822 const pthread_mutexattr_t *restrict attr));
823# else
824# if !@HAVE_PTHREAD_MUTEX_INIT@
825_GL_FUNCDECL_SYS (pthread_mutex_init, int,
826 (pthread_mutex_t *restrict mutex,
827 const pthread_mutexattr_t *restrict attr),
828 _GL_ARG_NONNULL ((1)));
829# endif
830_GL_CXXALIAS_SYS (pthread_mutex_init, int,
831 (pthread_mutex_t *restrict mutex,
832 const pthread_mutexattr_t *restrict attr));
833# endif
834# if __GLIBC__ >= 2
835_GL_CXXALIASWARN (pthread_mutex_init);
836# endif
837#elif defined GNULIB_POSIXCHECK
838# undef pthread_mutex_init
839# if HAVE_RAW_DECL_PTHREAD_MUTEX_INIT
840_GL_WARN_ON_USE (pthread_mutex_init, "pthread_mutex_init is not portable - "
841 "use gnulib module pthread-mutex for portability");
842# endif
843#endif
844
845#if @GNULIB_PTHREAD_MUTEX@
846# if @REPLACE_PTHREAD_MUTEXATTR_INIT@
847# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
848# undef pthread_mutexattr_init
849# define pthread_mutexattr_init rpl_pthread_mutexattr_init
850# endif
851_GL_FUNCDECL_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr),
852 _GL_ARG_NONNULL ((1)));
853_GL_CXXALIAS_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr));
854# else
855# if !@HAVE_PTHREAD_MUTEXATTR_INIT@
856_GL_FUNCDECL_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr),
857 _GL_ARG_NONNULL ((1)));
858# endif
859_GL_CXXALIAS_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr));
860# endif
861# if __GLIBC__ >= 2
862_GL_CXXALIASWARN (pthread_mutexattr_init);
863# endif
864#elif defined GNULIB_POSIXCHECK
865# undef pthread_mutexattr_init
866# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_INIT
867_GL_WARN_ON_USE (pthread_mutexattr_init, "pthread_mutexattr_init is not portable - "
868 "use gnulib module pthread-mutex for portability");
869# endif
870#endif
871
872#if @GNULIB_PTHREAD_MUTEX@
873# if @REPLACE_PTHREAD_MUTEXATTR_GETTYPE@
874# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
875# undef pthread_mutexattr_gettype
876# define pthread_mutexattr_gettype rpl_pthread_mutexattr_gettype
877# endif
878_GL_FUNCDECL_RPL (pthread_mutexattr_gettype, int,
879 (const pthread_mutexattr_t *restrict attr,
880 int *restrict typep),
881 _GL_ARG_NONNULL ((1, 2)));
882_GL_CXXALIAS_RPL (pthread_mutexattr_gettype, int,
883 (const pthread_mutexattr_t *restrict attr,
884 int *restrict typep));
885# else
886# if !@HAVE_PTHREAD_MUTEXATTR_GETTYPE@
887_GL_FUNCDECL_SYS (pthread_mutexattr_gettype, int,
888 (const pthread_mutexattr_t *restrict attr,
889 int *restrict typep),
890 _GL_ARG_NONNULL ((1, 2)));
891# endif
892/* Need to cast, because on FreeBSD the first parameter is
893 pthread_mutexattr_t *attr. */
894_GL_CXXALIAS_SYS_CAST (pthread_mutexattr_gettype, int,
895 (const pthread_mutexattr_t *restrict attr,
896 int *restrict typep));
897# endif
898# if __GLIBC__ >= 2
899_GL_CXXALIASWARN (pthread_mutexattr_gettype);
900# endif
901#elif defined GNULIB_POSIXCHECK
902# undef pthread_mutexattr_gettype
903# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETTYPE
904_GL_WARN_ON_USE (pthread_mutexattr_gettype, "pthread_mutexattr_gettype is not portable - "
905 "use gnulib module pthread-mutex for portability");
906# endif
907#endif
908
909#if @GNULIB_PTHREAD_MUTEX@
910# if @REPLACE_PTHREAD_MUTEXATTR_SETTYPE@
911# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
912# undef pthread_mutexattr_settype
913# define pthread_mutexattr_settype rpl_pthread_mutexattr_settype
914# endif
915_GL_FUNCDECL_RPL (pthread_mutexattr_settype, int,
916 (pthread_mutexattr_t *attr, int type), _GL_ARG_NONNULL ((1)));
917_GL_CXXALIAS_RPL (pthread_mutexattr_settype, int,
918 (pthread_mutexattr_t *attr, int type));
919# else
920# if !@HAVE_PTHREAD_MUTEXATTR_SETTYPE@
921_GL_FUNCDECL_SYS (pthread_mutexattr_settype, int,
922 (pthread_mutexattr_t *attr, int type), _GL_ARG_NONNULL ((1)));
923# endif
924_GL_CXXALIAS_SYS (pthread_mutexattr_settype, int,
925 (pthread_mutexattr_t *attr, int type));
926# endif
927# if __GLIBC__ >= 2
928_GL_CXXALIASWARN (pthread_mutexattr_settype);
929# endif
930#elif defined GNULIB_POSIXCHECK
931# undef pthread_mutexattr_settype
932# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETTYPE
933_GL_WARN_ON_USE (pthread_mutexattr_settype, "pthread_mutexattr_settype is not portable - "
934 "use gnulib module pthread-mutex for portability");
935# endif
936#endif
937
938#if @GNULIB_PTHREAD_MUTEX@
939# if @REPLACE_PTHREAD_MUTEXATTR_GETROBUST@
940# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
941# undef pthread_mutexattr_getrobust
942# define pthread_mutexattr_getrobust rpl_pthread_mutexattr_getrobust
943# endif
944_GL_FUNCDECL_RPL (pthread_mutexattr_getrobust, int,
945 (const pthread_mutexattr_t *restrict attr,
946 int *restrict robustp),
947 _GL_ARG_NONNULL ((1, 2)));
948_GL_CXXALIAS_RPL (pthread_mutexattr_getrobust, int,
949 (const pthread_mutexattr_t *restrict attr,
950 int *restrict robustp));
951# else
952# if !@HAVE_PTHREAD_MUTEXATTR_GETROBUST@
953_GL_FUNCDECL_SYS (pthread_mutexattr_getrobust, int,
954 (const pthread_mutexattr_t *restrict attr,
955 int *restrict robustp),
956 _GL_ARG_NONNULL ((1, 2)));
957# endif
958/* Need to cast, because on FreeBSD the first parameter is
959 pthread_mutexattr_t *attr. */
960_GL_CXXALIAS_SYS_CAST (pthread_mutexattr_getrobust, int,
961 (const pthread_mutexattr_t *restrict attr,
962 int *restrict robustp));
963# endif
964# if __GLIBC__ >= 2
965_GL_CXXALIASWARN (pthread_mutexattr_getrobust);
966# endif
967#elif defined GNULIB_POSIXCHECK
968# undef pthread_mutexattr_getrobust
969# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETROBUST
970_GL_WARN_ON_USE (pthread_mutexattr_getrobust, "pthread_mutexattr_getrobust is not portable - "
971 "use gnulib module pthread-mutex for portability");
972# endif
973#endif
974
975#if @GNULIB_PTHREAD_MUTEX@
976# if @REPLACE_PTHREAD_MUTEXATTR_SETROBUST@
977# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
978# undef pthread_mutexattr_setrobust
979# define pthread_mutexattr_setrobust rpl_pthread_mutexattr_setrobust
980# endif
981_GL_FUNCDECL_RPL (pthread_mutexattr_setrobust, int,
982 (pthread_mutexattr_t *attr, int robust),
983 _GL_ARG_NONNULL ((1)));
984_GL_CXXALIAS_RPL (pthread_mutexattr_setrobust, int,
985 (pthread_mutexattr_t *attr, int robust));
986# else
987# if !@HAVE_PTHREAD_MUTEXATTR_SETROBUST@
988_GL_FUNCDECL_SYS (pthread_mutexattr_setrobust, int,
989 (pthread_mutexattr_t *attr, int robust),
990 _GL_ARG_NONNULL ((1)));
991# endif
992_GL_CXXALIAS_SYS (pthread_mutexattr_setrobust, int,
993 (pthread_mutexattr_t *attr, int robust));
994# endif
995# if __GLIBC__ >= 2
996_GL_CXXALIASWARN (pthread_mutexattr_setrobust);
997# endif
998#elif defined GNULIB_POSIXCHECK
999# undef pthread_mutexattr_setrobust
1000# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETROBUST
1001_GL_WARN_ON_USE (pthread_mutexattr_setrobust, "pthread_mutexattr_setrobust is not portable - "
1002 "use gnulib module pthread-mutex for portability");
1003# endif
1004#endif
1005
1006#if @GNULIB_PTHREAD_MUTEX@
1007# if @REPLACE_PTHREAD_MUTEXATTR_DESTROY@
1008# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1009# undef pthread_mutexattr_destroy
1010# define pthread_mutexattr_destroy rpl_pthread_mutexattr_destroy
1011# endif
1012_GL_FUNCDECL_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr),
1013 _GL_ARG_NONNULL ((1)));
1014_GL_CXXALIAS_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr));
1015# else
1016# if !@HAVE_PTHREAD_MUTEXATTR_DESTROY@
1017_GL_FUNCDECL_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr),
1018 _GL_ARG_NONNULL ((1)));
1019# endif
1020_GL_CXXALIAS_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr));
1021# endif
1022# if __GLIBC__ >= 2
1023_GL_CXXALIASWARN (pthread_mutexattr_destroy);
1024# endif
1025#elif defined GNULIB_POSIXCHECK
1026# undef pthread_mutexattr_destroy
1027# if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_DESTROY
1028_GL_WARN_ON_USE (pthread_mutexattr_destroy, "pthread_mutexattr_destroy is not portable - "
1029 "use gnulib module pthread-mutex for portability");
1030# endif
1031#endif
1032
1033#if @GNULIB_PTHREAD_MUTEX@
1034# if @REPLACE_PTHREAD_MUTEX_LOCK@
1035# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1036# undef pthread_mutex_lock
1037# define pthread_mutex_lock rpl_pthread_mutex_lock
1038# endif
1039_GL_FUNCDECL_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex),
1040 _GL_ARG_NONNULL ((1)));
1041_GL_CXXALIAS_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex));
1042# else
1043# if !@HAVE_PTHREAD_MUTEX_LOCK@
1044_GL_FUNCDECL_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex),
1045 _GL_ARG_NONNULL ((1)));
1046# endif
1047_GL_CXXALIAS_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex));
1048# endif
1049# if __GLIBC__ >= 2
1050_GL_CXXALIASWARN (pthread_mutex_lock);
1051# endif
1052#elif defined GNULIB_POSIXCHECK
1053# undef pthread_mutex_lock
1054# if HAVE_RAW_DECL_PTHREAD_MUTEX_LOCK
1055_GL_WARN_ON_USE (pthread_mutex_lock, "pthread_mutex_lock is not portable - "
1056 "use gnulib module pthread-mutex for portability");
1057# endif
1058#endif
1059
1060#if @GNULIB_PTHREAD_MUTEX@
1061# if @REPLACE_PTHREAD_MUTEX_TRYLOCK@
1062# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1063# undef pthread_mutex_trylock
1064# define pthread_mutex_trylock rpl_pthread_mutex_trylock
1065# endif
1066_GL_FUNCDECL_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex),
1067 _GL_ARG_NONNULL ((1)));
1068_GL_CXXALIAS_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex));
1069# else
1070# if !@HAVE_PTHREAD_MUTEX_TRYLOCK@
1071_GL_FUNCDECL_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex),
1072 _GL_ARG_NONNULL ((1)));
1073# endif
1074_GL_CXXALIAS_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex));
1075# endif
1076# if __GLIBC__ >= 2
1077_GL_CXXALIASWARN (pthread_mutex_trylock);
1078# endif
1079#elif defined GNULIB_POSIXCHECK
1080# undef pthread_mutex_trylock
1081# if HAVE_RAW_DECL_PTHREAD_MUTEX_TRYLOCK
1082_GL_WARN_ON_USE (pthread_mutex_trylock, "pthread_mutex_trylock is not portable - "
1083 "use gnulib module pthread-mutex for portability");
1084# endif
1085#endif
1086
1087#if @GNULIB_PTHREAD_MUTEX_TIMEDLOCK@
1088# if @REPLACE_PTHREAD_MUTEX_TIMEDLOCK@
1089# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1090# undef pthread_mutex_timedlock
1091# define pthread_mutex_timedlock rpl_pthread_mutex_timedlock
1092# endif
1093_GL_FUNCDECL_RPL (pthread_mutex_timedlock, int,
1094 (pthread_mutex_t *restrict mutex,
1095 const struct timespec *restrict abstime),
1096 _GL_ARG_NONNULL ((1, 2)));
1097_GL_CXXALIAS_RPL (pthread_mutex_timedlock, int,
1098 (pthread_mutex_t *restrict mutex,
1099 const struct timespec *restrict abstime));
1100# else
1101# if !@HAVE_PTHREAD_MUTEX_TIMEDLOCK@
1102_GL_FUNCDECL_SYS (pthread_mutex_timedlock, int,
1103 (pthread_mutex_t *restrict mutex,
1104 const struct timespec *restrict abstime),
1105 _GL_ARG_NONNULL ((1, 2)));
1106# endif
1107_GL_CXXALIAS_SYS (pthread_mutex_timedlock, int,
1108 (pthread_mutex_t *restrict mutex,
1109 const struct timespec *restrict abstime));
1110# endif
1111# if __GLIBC__ >= 2
1112_GL_CXXALIASWARN (pthread_mutex_timedlock);
1113# endif
1114#elif defined GNULIB_POSIXCHECK
1115# undef pthread_mutex_timedlock
1116# if HAVE_RAW_DECL_PTHREAD_MUTEX_TIMEDLOCK
1117_GL_WARN_ON_USE (pthread_mutex_timedlock, "pthread_mutex_timedlock is not portable - "
1118 "use gnulib module pthread_mutex_timedlock for portability");
1119# endif
1120#endif
1121
1122#if @GNULIB_PTHREAD_MUTEX@
1123# if @REPLACE_PTHREAD_MUTEX_UNLOCK@
1124# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1125# undef pthread_mutex_unlock
1126# define pthread_mutex_unlock rpl_pthread_mutex_unlock
1127# endif
1128_GL_FUNCDECL_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex),
1129 _GL_ARG_NONNULL ((1)));
1130_GL_CXXALIAS_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex));
1131# else
1132# if !@HAVE_PTHREAD_MUTEX_UNLOCK@
1133_GL_FUNCDECL_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex),
1134 _GL_ARG_NONNULL ((1)));
1135# endif
1136_GL_CXXALIAS_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex));
1137# endif
1138# if __GLIBC__ >= 2
1139_GL_CXXALIASWARN (pthread_mutex_unlock);
1140# endif
1141#elif defined GNULIB_POSIXCHECK
1142# undef pthread_mutex_unlock
1143# if HAVE_RAW_DECL_PTHREAD_MUTEX_UNLOCK
1144_GL_WARN_ON_USE (pthread_mutex_unlock, "pthread_mutex_unlock is not portable - "
1145 "use gnulib module pthread-mutex for portability");
1146# endif
1147#endif
1148
1149#if @GNULIB_PTHREAD_MUTEX@
1150# if @REPLACE_PTHREAD_MUTEX_DESTROY@
1151# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1152# undef pthread_mutex_destroy
1153# define pthread_mutex_destroy rpl_pthread_mutex_destroy
1154# endif
1155_GL_FUNCDECL_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex),
1156 _GL_ARG_NONNULL ((1)));
1157_GL_CXXALIAS_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex));
1158# else
1159# if !@HAVE_PTHREAD_MUTEX_DESTROY@
1160_GL_FUNCDECL_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex),
1161 _GL_ARG_NONNULL ((1)));
1162# endif
1163_GL_CXXALIAS_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex));
1164# endif
1165# if __GLIBC__ >= 2
1166_GL_CXXALIASWARN (pthread_mutex_destroy);
1167# endif
1168#elif defined GNULIB_POSIXCHECK
1169# undef pthread_mutex_destroy
1170# if HAVE_RAW_DECL_PTHREAD_MUTEX_DESTROY
1171_GL_WARN_ON_USE (pthread_mutex_destroy, "pthread_mutex_destroy is not portable - "
1172 "use gnulib module pthread-mutex for portability");
1173# endif
1174#endif
1175
1176/* =========== Read-write lock functions =========== */
1177
1178#if @GNULIB_PTHREAD_RWLOCK@
1179# if @REPLACE_PTHREAD_RWLOCK_INIT@
1180# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1181# undef pthread_rwlock_init
1182# define pthread_rwlock_init rpl_pthread_rwlock_init
1183# endif
1184_GL_FUNCDECL_RPL (pthread_rwlock_init, int,
1185 (pthread_rwlock_t *restrict lock,
1186 const pthread_rwlockattr_t *restrict attr),
1187 _GL_ARG_NONNULL ((1)));
1188_GL_CXXALIAS_RPL (pthread_rwlock_init, int,
1189 (pthread_rwlock_t *restrict lock,
1190 const pthread_rwlockattr_t *restrict attr));
1191# else
1192# if !@HAVE_PTHREAD_RWLOCK_INIT@
1193_GL_FUNCDECL_SYS (pthread_rwlock_init, int,
1194 (pthread_rwlock_t *restrict lock,
1195 const pthread_rwlockattr_t *restrict attr),
1196 _GL_ARG_NONNULL ((1)));
1197# endif
1198_GL_CXXALIAS_SYS (pthread_rwlock_init, int,
1199 (pthread_rwlock_t *restrict lock,
1200 const pthread_rwlockattr_t *restrict attr));
1201# endif
1202# if __GLIBC__ >= 2
1203_GL_CXXALIASWARN (pthread_rwlock_init);
1204# endif
1205#elif defined GNULIB_POSIXCHECK
1206# undef pthread_rwlock_init
1207# if HAVE_RAW_DECL_PTHREAD_RWLOCK_INIT
1208_GL_WARN_ON_USE (pthread_rwlock_init, "pthread_rwlock_init is not portable - "
1209 "use gnulib module pthread-rwlock for portability");
1210# endif
1211#endif
1212
1213#if @GNULIB_PTHREAD_RWLOCK@
1214# if @REPLACE_PTHREAD_RWLOCKATTR_INIT@
1215# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1216# undef pthread_rwlockattr_init
1217# define pthread_rwlockattr_init rpl_pthread_rwlockattr_init
1218# endif
1219_GL_FUNCDECL_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr),
1220 _GL_ARG_NONNULL ((1)));
1221_GL_CXXALIAS_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr));
1222# else
1223# if !@HAVE_PTHREAD_RWLOCKATTR_INIT@
1224_GL_FUNCDECL_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr),
1225 _GL_ARG_NONNULL ((1)));
1226# endif
1227_GL_CXXALIAS_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr));
1228# endif
1229# if __GLIBC__ >= 2
1230_GL_CXXALIASWARN (pthread_rwlockattr_init);
1231# endif
1232#elif defined GNULIB_POSIXCHECK
1233# undef pthread_rwlockattr_init
1234# if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_INIT
1235_GL_WARN_ON_USE (pthread_rwlockattr_init, "pthread_rwlockattr_init is not portable - "
1236 "use gnulib module pthread-rwlock for portability");
1237# endif
1238#endif
1239
1240#if @GNULIB_PTHREAD_RWLOCK@
1241# if @REPLACE_PTHREAD_RWLOCKATTR_DESTROY@
1242# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1243# undef pthread_rwlockattr_destroy
1244# define pthread_rwlockattr_destroy rpl_pthread_rwlockattr_destroy
1245# endif
1246_GL_FUNCDECL_RPL (pthread_rwlockattr_destroy, int,
1247 (pthread_rwlockattr_t *attr), _GL_ARG_NONNULL ((1)));
1248_GL_CXXALIAS_RPL (pthread_rwlockattr_destroy, int,
1249 (pthread_rwlockattr_t *attr));
1250# else
1251# if !@HAVE_PTHREAD_RWLOCKATTR_DESTROY@
1252_GL_FUNCDECL_SYS (pthread_rwlockattr_destroy, int,
1253 (pthread_rwlockattr_t *attr), _GL_ARG_NONNULL ((1)));
1254# endif
1255_GL_CXXALIAS_SYS (pthread_rwlockattr_destroy, int,
1256 (pthread_rwlockattr_t *attr));
1257# endif
1258# if __GLIBC__ >= 2
1259_GL_CXXALIASWARN (pthread_rwlockattr_destroy);
1260# endif
1261#elif defined GNULIB_POSIXCHECK
1262# undef pthread_rwlockattr_destroy
1263# if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_DESTROY
1264_GL_WARN_ON_USE (pthread_rwlockattr_destroy, "pthread_rwlockattr_destroy 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_RDLOCK@
1271# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1272# undef pthread_rwlock_rdlock
1273# define pthread_rwlock_rdlock rpl_pthread_rwlock_rdlock
1274# endif
1275_GL_FUNCDECL_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock),
1276 _GL_ARG_NONNULL ((1)));
1277_GL_CXXALIAS_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock));
1278# else
1279# if !@HAVE_PTHREAD_RWLOCK_RDLOCK@
1280_GL_FUNCDECL_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock),
1281 _GL_ARG_NONNULL ((1)));
1282# endif
1283_GL_CXXALIAS_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock));
1284# endif
1285# if __GLIBC__ >= 2
1286_GL_CXXALIASWARN (pthread_rwlock_rdlock);
1287# endif
1288#elif defined GNULIB_POSIXCHECK
1289# undef pthread_rwlock_rdlock
1290# if HAVE_RAW_DECL_PTHREAD_RWLOCK_RDLOCK
1291_GL_WARN_ON_USE (pthread_rwlock_rdlock, "pthread_rwlock_rdlock is not portable - "
1292 "use gnulib module pthread-rwlock for portability");
1293# endif
1294#endif
1295
1296#if @GNULIB_PTHREAD_RWLOCK@
1297# if @REPLACE_PTHREAD_RWLOCK_WRLOCK@
1298# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1299# undef pthread_rwlock_wrlock
1300# define pthread_rwlock_wrlock rpl_pthread_rwlock_wrlock
1301# endif
1302_GL_FUNCDECL_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock),
1303 _GL_ARG_NONNULL ((1)));
1304_GL_CXXALIAS_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock));
1305# else
1306# if !@HAVE_PTHREAD_RWLOCK_WRLOCK@
1307_GL_FUNCDECL_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock),
1308 _GL_ARG_NONNULL ((1)));
1309# endif
1310_GL_CXXALIAS_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock));
1311# endif
1312# if __GLIBC__ >= 2
1313_GL_CXXALIASWARN (pthread_rwlock_wrlock);
1314# endif
1315#elif defined GNULIB_POSIXCHECK
1316# undef pthread_rwlock_wrlock
1317# if HAVE_RAW_DECL_PTHREAD_RWLOCK_WRLOCK
1318_GL_WARN_ON_USE (pthread_rwlock_wrlock, "pthread_rwlock_wrlock is not portable - "
1319 "use gnulib module pthread-rwlock for portability");
1320# endif
1321#endif
1322
1323#if @GNULIB_PTHREAD_RWLOCK@
1324# if @REPLACE_PTHREAD_RWLOCK_TRYRDLOCK@
1325# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1326# undef pthread_rwlock_tryrdlock
1327# define pthread_rwlock_tryrdlock rpl_pthread_rwlock_tryrdlock
1328# endif
1329_GL_FUNCDECL_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock),
1330 _GL_ARG_NONNULL ((1)));
1331_GL_CXXALIAS_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock));
1332# else
1333# if !@HAVE_PTHREAD_RWLOCK_TRYRDLOCK@
1334_GL_FUNCDECL_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock),
1335 _GL_ARG_NONNULL ((1)));
1336# endif
1337_GL_CXXALIAS_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock));
1338# endif
1339# if __GLIBC__ >= 2
1340_GL_CXXALIASWARN (pthread_rwlock_tryrdlock);
1341# endif
1342#elif defined GNULIB_POSIXCHECK
1343# undef pthread_rwlock_tryrdlock
1344# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYRDLOCK
1345_GL_WARN_ON_USE (pthread_rwlock_tryrdlock, "pthread_rwlock_tryrdlock is not portable - "
1346 "use gnulib module pthread-rwlock for portability");
1347# endif
1348#endif
1349
1350#if @GNULIB_PTHREAD_RWLOCK@
1351# if @REPLACE_PTHREAD_RWLOCK_TRYWRLOCK@
1352# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1353# undef pthread_rwlock_trywrlock
1354# define pthread_rwlock_trywrlock rpl_pthread_rwlock_trywrlock
1355# endif
1356_GL_FUNCDECL_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock),
1357 _GL_ARG_NONNULL ((1)));
1358_GL_CXXALIAS_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock));
1359# else
1360# if !@HAVE_PTHREAD_RWLOCK_TRYWRLOCK@
1361_GL_FUNCDECL_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock),
1362 _GL_ARG_NONNULL ((1)));
1363# endif
1364_GL_CXXALIAS_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock));
1365# endif
1366# if __GLIBC__ >= 2
1367_GL_CXXALIASWARN (pthread_rwlock_trywrlock);
1368# endif
1369#elif defined GNULIB_POSIXCHECK
1370# undef pthread_rwlock_trywrlock
1371# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYWRLOCK
1372_GL_WARN_ON_USE (pthread_rwlock_trywrlock, "pthread_rwlock_trywrlock is not portable - "
1373 "use gnulib module pthread-rwlock for portability");
1374# endif
1375#endif
1376
1377#if @GNULIB_PTHREAD_RWLOCK@
1378# if @REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK@
1379# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1380# undef pthread_rwlock_timedrdlock
1381# define pthread_rwlock_timedrdlock rpl_pthread_rwlock_timedrdlock
1382# endif
1383_GL_FUNCDECL_RPL (pthread_rwlock_timedrdlock, int,
1384 (pthread_rwlock_t *restrict lock,
1385 const struct timespec *restrict abstime),
1386 _GL_ARG_NONNULL ((1, 2)));
1387_GL_CXXALIAS_RPL (pthread_rwlock_timedrdlock, int,
1388 (pthread_rwlock_t *restrict lock,
1389 const struct timespec *restrict abstime));
1390# else
1391# if !@HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK@
1392_GL_FUNCDECL_SYS (pthread_rwlock_timedrdlock, int,
1393 (pthread_rwlock_t *restrict lock,
1394 const struct timespec *restrict abstime),
1395 _GL_ARG_NONNULL ((1, 2)));
1396# endif
1397_GL_CXXALIAS_SYS (pthread_rwlock_timedrdlock, int,
1398 (pthread_rwlock_t *restrict lock,
1399 const struct timespec *restrict abstime));
1400# endif
1401# if __GLIBC__ >= 2
1402_GL_CXXALIASWARN (pthread_rwlock_timedrdlock);
1403# endif
1404#elif defined GNULIB_POSIXCHECK
1405# undef pthread_rwlock_timedrdlock
1406# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDRDLOCK
1407_GL_WARN_ON_USE (pthread_rwlock_timedrdlock, "pthread_rwlock_timedrdlock is not portable - "
1408 "use gnulib module pthread-rwlock for portability");
1409# endif
1410#endif
1411
1412#if @GNULIB_PTHREAD_RWLOCK@
1413# if @REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK@
1414# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1415# undef pthread_rwlock_timedwrlock
1416# define pthread_rwlock_timedwrlock rpl_pthread_rwlock_timedwrlock
1417# endif
1418_GL_FUNCDECL_RPL (pthread_rwlock_timedwrlock, int,
1419 (pthread_rwlock_t *restrict lock,
1420 const struct timespec *restrict abstime),
1421 _GL_ARG_NONNULL ((1, 2)));
1422_GL_CXXALIAS_RPL (pthread_rwlock_timedwrlock, int,
1423 (pthread_rwlock_t *restrict lock,
1424 const struct timespec *restrict abstime));
1425# else
1426# if !@HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK@
1427_GL_FUNCDECL_SYS (pthread_rwlock_timedwrlock, int,
1428 (pthread_rwlock_t *restrict lock,
1429 const struct timespec *restrict abstime),
1430 _GL_ARG_NONNULL ((1, 2)));
1431# endif
1432_GL_CXXALIAS_SYS (pthread_rwlock_timedwrlock, int,
1433 (pthread_rwlock_t *restrict lock,
1434 const struct timespec *restrict abstime));
1435# endif
1436# if __GLIBC__ >= 2
1437_GL_CXXALIASWARN (pthread_rwlock_timedwrlock);
1438# endif
1439#elif defined GNULIB_POSIXCHECK
1440# undef pthread_rwlock_timedwrlock
1441# if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDWRLOCK
1442_GL_WARN_ON_USE (pthread_rwlock_timedwrlock, "pthread_rwlock_timedwrlock is not portable - "
1443 "use gnulib module pthread-rwlock for portability");
1444# endif
1445#endif
1446
1447#if @GNULIB_PTHREAD_RWLOCK@
1448# if @REPLACE_PTHREAD_RWLOCK_UNLOCK@
1449# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1450# undef pthread_rwlock_unlock
1451# define pthread_rwlock_unlock rpl_pthread_rwlock_unlock
1452# endif
1453_GL_FUNCDECL_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock),
1454 _GL_ARG_NONNULL ((1)));
1455_GL_CXXALIAS_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock));
1456# else
1457# if !@HAVE_PTHREAD_RWLOCK_UNLOCK@
1458_GL_FUNCDECL_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock),
1459 _GL_ARG_NONNULL ((1)));
1460# endif
1461_GL_CXXALIAS_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock));
1462# endif
1463# if __GLIBC__ >= 2
1464_GL_CXXALIASWARN (pthread_rwlock_unlock);
1465# endif
1466#elif defined GNULIB_POSIXCHECK
1467# undef pthread_rwlock_unlock
1468# if HAVE_RAW_DECL_PTHREAD_RWLOCK_UNLOCK
1469_GL_WARN_ON_USE (pthread_rwlock_unlock, "pthread_rwlock_unlock is not portable - "
1470 "use gnulib module pthread-rwlock for portability");
1471# endif
1472#endif
1473
1474#if @GNULIB_PTHREAD_RWLOCK@
1475# if @REPLACE_PTHREAD_RWLOCK_DESTROY@
1476# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1477# undef pthread_rwlock_destroy
1478# define pthread_rwlock_destroy rpl_pthread_rwlock_destroy
1479# endif
1480_GL_FUNCDECL_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock),
1481 _GL_ARG_NONNULL ((1)));
1482_GL_CXXALIAS_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock));
1483# else
1484# if !@HAVE_PTHREAD_RWLOCK_DESTROY@
1485_GL_FUNCDECL_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock),
1486 _GL_ARG_NONNULL ((1)));
1487# endif
1488_GL_CXXALIAS_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock));
1489# endif
1490# if __GLIBC__ >= 2
1491_GL_CXXALIASWARN (pthread_rwlock_destroy);
1492# endif
1493#elif defined GNULIB_POSIXCHECK
1494# undef pthread_rwlock_destroy
1495# if HAVE_RAW_DECL_PTHREAD_RWLOCK_DESTROY
1496_GL_WARN_ON_USE (pthread_rwlock_destroy, "pthread_rwlock_destroy is not portable - "
1497 "use gnulib module pthread-rwlock for portability");
1498# endif
1499#endif
1500
1501/* =========== Condition variable functions =========== */
1502
1503#if @GNULIB_PTHREAD_COND@
1504# if @REPLACE_PTHREAD_COND_INIT@
1505# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1506# undef pthread_cond_init
1507# define pthread_cond_init rpl_pthread_cond_init
1508# endif
1509_GL_FUNCDECL_RPL (pthread_cond_init, int,
1510 (pthread_cond_t *restrict cond,
1511 const pthread_condattr_t *restrict attr),
1512 _GL_ARG_NONNULL ((1)));
1513_GL_CXXALIAS_RPL (pthread_cond_init, int,
1514 (pthread_cond_t *restrict cond,
1515 const pthread_condattr_t *restrict attr));
1516# else
1517# if !@HAVE_PTHREAD_COND_INIT@
1518_GL_FUNCDECL_SYS (pthread_cond_init, int,
1519 (pthread_cond_t *restrict cond,
1520 const pthread_condattr_t *restrict attr),
1521 _GL_ARG_NONNULL ((1)));
1522# endif
1523_GL_CXXALIAS_SYS (pthread_cond_init, int,
1524 (pthread_cond_t *restrict cond,
1525 const pthread_condattr_t *restrict attr));
1526# endif
1527# if __GLIBC__ >= 2
1528_GL_CXXALIASWARN (pthread_cond_init);
1529# endif
1530#elif defined GNULIB_POSIXCHECK
1531# undef pthread_cond_init
1532# if HAVE_RAW_DECL_PTHREAD_COND_INIT
1533_GL_WARN_ON_USE (pthread_cond_init, "pthread_cond_init is not portable - "
1534 "use gnulib module pthread-cond for portability");
1535# endif
1536#endif
1537
1538#if @GNULIB_PTHREAD_COND@
1539# if @REPLACE_PTHREAD_CONDATTR_INIT@
1540# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1541# undef pthread_condattr_init
1542# define pthread_condattr_init rpl_pthread_condattr_init
1543# endif
1544_GL_FUNCDECL_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr),
1545 _GL_ARG_NONNULL ((1)));
1546_GL_CXXALIAS_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr));
1547# else
1548# if !@HAVE_PTHREAD_CONDATTR_INIT@
1549_GL_FUNCDECL_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr),
1550 _GL_ARG_NONNULL ((1)));
1551# endif
1552_GL_CXXALIAS_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr));
1553# endif
1554# if __GLIBC__ >= 2
1555_GL_CXXALIASWARN (pthread_condattr_init);
1556# endif
1557#elif defined GNULIB_POSIXCHECK
1558# undef pthread_condattr_init
1559# if HAVE_RAW_DECL_PTHREAD_CONDATTR_INIT
1560_GL_WARN_ON_USE (pthread_condattr_init, "pthread_condattr_init is not portable - "
1561 "use gnulib module pthread-cond for portability");
1562# endif
1563#endif
1564
1565#if @GNULIB_PTHREAD_COND@
1566# if @REPLACE_PTHREAD_CONDATTR_DESTROY@
1567# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1568# undef pthread_condattr_destroy
1569# define pthread_condattr_destroy rpl_pthread_condattr_destroy
1570# endif
1571_GL_FUNCDECL_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr),
1572 _GL_ARG_NONNULL ((1)));
1573_GL_CXXALIAS_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr));
1574# else
1575# if !@HAVE_PTHREAD_CONDATTR_DESTROY@
1576_GL_FUNCDECL_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr),
1577 _GL_ARG_NONNULL ((1)));
1578# endif
1579_GL_CXXALIAS_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr));
1580# endif
1581# if __GLIBC__ >= 2
1582_GL_CXXALIASWARN (pthread_condattr_destroy);
1583# endif
1584#elif defined GNULIB_POSIXCHECK
1585# undef pthread_condattr_destroy
1586# if HAVE_RAW_DECL_PTHREAD_CONDATTR_DESTROY
1587_GL_WARN_ON_USE (pthread_condattr_destroy, "pthread_condattr_destroy is not portable - "
1588 "use gnulib module pthread-cond for portability");
1589# endif
1590#endif
1591
1592#if @GNULIB_PTHREAD_COND@
1593# if @REPLACE_PTHREAD_COND_WAIT@
1594# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1595# undef pthread_cond_wait
1596# define pthread_cond_wait rpl_pthread_cond_wait
1597# endif
1598_GL_FUNCDECL_RPL (pthread_cond_wait, int,
1599 (pthread_cond_t *restrict cond,
1600 pthread_mutex_t *restrict mutex),
1601 _GL_ARG_NONNULL ((1, 2)));
1602_GL_CXXALIAS_RPL (pthread_cond_wait, int,
1603 (pthread_cond_t *restrict cond,
1604 pthread_mutex_t *restrict mutex));
1605# else
1606# if !@HAVE_PTHREAD_COND_WAIT@
1607_GL_FUNCDECL_SYS (pthread_cond_wait, int,
1608 (pthread_cond_t *restrict cond,
1609 pthread_mutex_t *restrict mutex),
1610 _GL_ARG_NONNULL ((1, 2)));
1611# endif
1612_GL_CXXALIAS_SYS (pthread_cond_wait, int,
1613 (pthread_cond_t *restrict cond,
1614 pthread_mutex_t *restrict mutex));
1615# endif
1616# if __GLIBC__ >= 2
1617_GL_CXXALIASWARN (pthread_cond_wait);
1618# endif
1619#elif defined GNULIB_POSIXCHECK
1620# undef pthread_cond_wait
1621# if HAVE_RAW_DECL_PTHREAD_COND_WAIT
1622_GL_WARN_ON_USE (pthread_cond_wait, "pthread_cond_wait 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_TIMEDWAIT@
1629# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1630# undef pthread_cond_timedwait
1631# define pthread_cond_timedwait rpl_pthread_cond_timedwait
1632# endif
1633_GL_FUNCDECL_RPL (pthread_cond_timedwait, int,
1634 (pthread_cond_t *restrict cond,
1635 pthread_mutex_t *restrict mutex,
1636 const struct timespec *restrict abstime),
1637 _GL_ARG_NONNULL ((1, 2, 3)));
1638_GL_CXXALIAS_RPL (pthread_cond_timedwait, int,
1639 (pthread_cond_t *restrict cond,
1640 pthread_mutex_t *restrict mutex,
1641 const struct timespec *restrict abstime));
1642# else
1643# if !@HAVE_PTHREAD_COND_TIMEDWAIT@
1644_GL_FUNCDECL_SYS (pthread_cond_timedwait, int,
1645 (pthread_cond_t *restrict cond,
1646 pthread_mutex_t *restrict mutex,
1647 const struct timespec *restrict abstime),
1648 _GL_ARG_NONNULL ((1, 2, 3)));
1649# endif
1650_GL_CXXALIAS_SYS (pthread_cond_timedwait, int,
1651 (pthread_cond_t *restrict cond,
1652 pthread_mutex_t *restrict mutex,
1653 const struct timespec *restrict abstime));
1654# endif
1655# if __GLIBC__ >= 2
1656_GL_CXXALIASWARN (pthread_cond_timedwait);
1657# endif
1658#elif defined GNULIB_POSIXCHECK
1659# undef pthread_cond_timedwait
1660# if HAVE_RAW_DECL_PTHREAD_COND_TIMEDWAIT
1661_GL_WARN_ON_USE (pthread_cond_timedwait, "pthread_cond_timedwait is not portable - "
1662 "use gnulib module pthread-cond for portability");
1663# endif
1664#endif
1665
1666#if @GNULIB_PTHREAD_COND@
1667# if @REPLACE_PTHREAD_COND_SIGNAL@
1668# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1669# undef pthread_cond_signal
1670# define pthread_cond_signal rpl_pthread_cond_signal
1671# endif
1672_GL_FUNCDECL_RPL (pthread_cond_signal, int, (pthread_cond_t *cond),
1673 _GL_ARG_NONNULL ((1)));
1674_GL_CXXALIAS_RPL (pthread_cond_signal, int, (pthread_cond_t *cond));
1675# else
1676# if !@HAVE_PTHREAD_COND_SIGNAL@
1677_GL_FUNCDECL_SYS (pthread_cond_signal, int, (pthread_cond_t *cond),
1678 _GL_ARG_NONNULL ((1)));
1679# endif
1680_GL_CXXALIAS_SYS (pthread_cond_signal, int, (pthread_cond_t *cond));
1681# endif
1682# if __GLIBC__ >= 2
1683_GL_CXXALIASWARN (pthread_cond_signal);
1684# endif
1685#elif defined GNULIB_POSIXCHECK
1686# undef pthread_cond_signal
1687# if HAVE_RAW_DECL_PTHREAD_COND_SIGNAL
1688_GL_WARN_ON_USE (pthread_cond_signal, "pthread_cond_signal is not portable - "
1689 "use gnulib module pthread-cond for portability");
1690# endif
1691#endif
1692
1693#if @GNULIB_PTHREAD_COND@
1694# if @REPLACE_PTHREAD_COND_BROADCAST@
1695# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1696# undef pthread_cond_broadcast
1697# define pthread_cond_broadcast rpl_pthread_cond_broadcast
1698# endif
1699_GL_FUNCDECL_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond),
1700 _GL_ARG_NONNULL ((1)));
1701_GL_CXXALIAS_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond));
1702# else
1703# if !@HAVE_PTHREAD_COND_BROADCAST@
1704_GL_FUNCDECL_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond),
1705 _GL_ARG_NONNULL ((1)));
1706# endif
1707_GL_CXXALIAS_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond));
1708# endif
1709# if __GLIBC__ >= 2
1710_GL_CXXALIASWARN (pthread_cond_broadcast);
1711# endif
1712#elif defined GNULIB_POSIXCHECK
1713# undef pthread_cond_broadcast
1714# if HAVE_RAW_DECL_PTHREAD_COND_BROADCAST
1715_GL_WARN_ON_USE (pthread_cond_broadcast, "pthread_cond_broadcast is not portable - "
1716 "use gnulib module pthread-cond for portability");
1717# endif
1718#endif
1719
1720#if @GNULIB_PTHREAD_COND@
1721# if @REPLACE_PTHREAD_COND_DESTROY@
1722# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1723# undef pthread_cond_destroy
1724# define pthread_cond_destroy rpl_pthread_cond_destroy
1725# endif
1726_GL_FUNCDECL_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond),
1727 _GL_ARG_NONNULL ((1)));
1728_GL_CXXALIAS_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond));
1729# else
1730# if !@HAVE_PTHREAD_COND_DESTROY@
1731_GL_FUNCDECL_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond),
1732 _GL_ARG_NONNULL ((1)));
1733# endif
1734_GL_CXXALIAS_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond));
1735# endif
1736# if __GLIBC__ >= 2
1737_GL_CXXALIASWARN (pthread_cond_destroy);
1738# endif
1739#elif defined GNULIB_POSIXCHECK
1740# undef pthread_cond_destroy
1741# if HAVE_RAW_DECL_PTHREAD_COND_DESTROY
1742_GL_WARN_ON_USE (pthread_cond_destroy, "pthread_cond_destroy is not portable - "
1743 "use gnulib module pthread-cond for portability");
1744# endif
1745#endif
1746
1747/* =========== Thread-specific storage functions =========== */
1748
1749#if @GNULIB_PTHREAD_TSS@
1750# if @REPLACE_PTHREAD_KEY_CREATE@
1751# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1752# undef pthread_key_create
1753# define pthread_key_create rpl_pthread_key_create
1754# endif
1755_GL_FUNCDECL_RPL (pthread_key_create, int,
1756 (pthread_key_t *keyp, void (*destructor) (void *)),
1757 _GL_ARG_NONNULL ((1)));
1758_GL_CXXALIAS_RPL (pthread_key_create, int,
1759 (pthread_key_t *keyp, void (*destructor) (void *)));
1760# else
1761# if !@HAVE_PTHREAD_KEY_CREATE@
1762_GL_FUNCDECL_SYS (pthread_key_create, int,
1763 (pthread_key_t *keyp, void (*destructor) (void *)),
1764 _GL_ARG_NONNULL ((1)));
1765# endif
1766_GL_CXXALIAS_SYS_CAST (pthread_key_create, int,
1767 (pthread_key_t *keyp, void (*destructor) (void *)));
1768# endif
1769# if __GLIBC__ >= 2
1770_GL_CXXALIASWARN (pthread_key_create);
1771# endif
1772#elif defined GNULIB_POSIXCHECK
1773# undef pthread_key_create
1774# if HAVE_RAW_DECL_PTHREAD_KEY_CREATE
1775_GL_WARN_ON_USE (pthread_key_create, "pthread_key_create is not portable - "
1776 "use gnulib module pthread-tss for portability");
1777# endif
1778#endif
1779
1780#if @GNULIB_PTHREAD_TSS@
1781# if @REPLACE_PTHREAD_SETSPECIFIC@
1782# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1783# undef pthread_setspecific
1784# define pthread_setspecific rpl_pthread_setspecific
1785# endif
1786_GL_FUNCDECL_RPL (pthread_setspecific, int,
1787 (pthread_key_t key, const void *value), );
1788_GL_CXXALIAS_RPL (pthread_setspecific, int,
1789 (pthread_key_t key, const void *value));
1790# else
1791# if !@HAVE_PTHREAD_SETSPECIFIC@
1792_GL_FUNCDECL_SYS (pthread_setspecific, int,
1793 (pthread_key_t key, const void *value), );
1794# endif
1795_GL_CXXALIAS_SYS (pthread_setspecific, int,
1796 (pthread_key_t key, const void *value));
1797# endif
1798# if __GLIBC__ >= 2
1799_GL_CXXALIASWARN (pthread_setspecific);
1800# endif
1801#elif defined GNULIB_POSIXCHECK
1802# undef pthread_setspecific
1803# if HAVE_RAW_DECL_PTHREAD_SETSPECIFIC
1804_GL_WARN_ON_USE (pthread_setspecific, "pthread_setspecific is not portable - "
1805 "use gnulib module pthread-tss for portability");
1806# endif
1807#endif
1808
1809#if @GNULIB_PTHREAD_TSS@
1810# if @REPLACE_PTHREAD_GETSPECIFIC@
1811# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1812# undef pthread_getspecific
1813# define pthread_getspecific rpl_pthread_getspecific
1814# endif
1815_GL_FUNCDECL_RPL (pthread_getspecific, void *, (pthread_key_t key), );
1816_GL_CXXALIAS_RPL (pthread_getspecific, void *, (pthread_key_t key));
1817# else
1818# if !@HAVE_PTHREAD_GETSPECIFIC@
1819_GL_FUNCDECL_SYS (pthread_getspecific, void *, (pthread_key_t key), );
1820# endif
1821_GL_CXXALIAS_SYS (pthread_getspecific, void *, (pthread_key_t key));
1822# endif
1823# if __GLIBC__ >= 2
1824_GL_CXXALIASWARN (pthread_getspecific);
1825# endif
1826#elif defined GNULIB_POSIXCHECK
1827# undef pthread_getspecific
1828# if HAVE_RAW_DECL_PTHREAD_GETSPECIFIC
1829_GL_WARN_ON_USE (pthread_getspecific, "pthread_getspecific is not portable - "
1830 "use gnulib module pthread-tss for portability");
1831# endif
1832#endif
1833
1834#if @GNULIB_PTHREAD_TSS@
1835# if @REPLACE_PTHREAD_KEY_DELETE@
1836# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1837# undef pthread_key_delete
1838# define pthread_key_delete rpl_pthread_key_delete
1839# endif
1840_GL_FUNCDECL_RPL (pthread_key_delete, int, (pthread_key_t key), );
1841_GL_CXXALIAS_RPL (pthread_key_delete, int, (pthread_key_t key));
1842# else
1843# if !@HAVE_PTHREAD_KEY_DELETE@
1844_GL_FUNCDECL_SYS (pthread_key_delete, int, (pthread_key_t key), );
1845# endif
1846_GL_CXXALIAS_SYS (pthread_key_delete, int, (pthread_key_t key));
1847# endif
1848# if __GLIBC__ >= 2
1849_GL_CXXALIASWARN (pthread_key_delete);
1850# endif
1851#elif defined GNULIB_POSIXCHECK
1852# undef pthread_key_delete
1853# if HAVE_RAW_DECL_PTHREAD_KEY_DELETE
1854_GL_WARN_ON_USE (pthread_key_delete, "pthread_key_delete is not portable - "
1855 "use gnulib module pthread-tss for portability");
1856# endif
1857#endif
1858
1859/* =========== Spinlock functions =========== */
1860
1861#if @GNULIB_PTHREAD_SPIN@
1862# if @REPLACE_PTHREAD_SPIN_INIT@
1863# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1864# undef pthread_spin_init
1865# define pthread_spin_init rpl_pthread_spin_init
1866# endif
1867_GL_FUNCDECL_RPL (pthread_spin_init, int,
1868 (pthread_spinlock_t *lock, int shared_across_processes),
1869 _GL_ARG_NONNULL ((1)));
1870_GL_CXXALIAS_RPL (pthread_spin_init, int,
1871 (pthread_spinlock_t *lock, int shared_across_processes));
1872# else
1873# if !@HAVE_PTHREAD_SPIN_INIT@
1874_GL_FUNCDECL_SYS (pthread_spin_init, int,
1875 (pthread_spinlock_t *lock, int shared_across_processes),
1876 _GL_ARG_NONNULL ((1)));
1877# endif
1878_GL_CXXALIAS_SYS (pthread_spin_init, int,
1879 (pthread_spinlock_t *lock, int shared_across_processes));
1880# endif
1881# if __GLIBC__ >= 2
1882_GL_CXXALIASWARN (pthread_spin_init);
1883# endif
1884#elif defined GNULIB_POSIXCHECK
1885# undef pthread_spin_init
1886# if HAVE_RAW_DECL_PTHREAD_SPIN_INIT
1887_GL_WARN_ON_USE (pthread_spin_init, "pthread_spin_init is not portable - "
1888 "use gnulib module pthread-spin for portability");
1889# endif
1890#endif
1891
1892#if @GNULIB_PTHREAD_SPIN@
1893# if @REPLACE_PTHREAD_SPIN_LOCK@
1894# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1895# undef pthread_spin_lock
1896# define pthread_spin_lock rpl_pthread_spin_lock
1897# endif
1898_GL_FUNCDECL_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock),
1899 _GL_ARG_NONNULL ((1)));
1900_GL_CXXALIAS_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock));
1901# else
1902# if !@HAVE_PTHREAD_SPIN_LOCK@
1903_GL_FUNCDECL_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock),
1904 _GL_ARG_NONNULL ((1)));
1905# endif
1906_GL_CXXALIAS_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock));
1907# endif
1908# if __GLIBC__ >= 2
1909_GL_CXXALIASWARN (pthread_spin_lock);
1910# endif
1911#elif defined GNULIB_POSIXCHECK
1912# undef pthread_spin_lock
1913# if HAVE_RAW_DECL_PTHREAD_SPIN_LOCK
1914_GL_WARN_ON_USE (pthread_spin_lock, "pthread_spin_lock is not portable - "
1915 "use gnulib module pthread-spin for portability");
1916# endif
1917#endif
1918
1919#if @GNULIB_PTHREAD_SPIN@
1920# if @REPLACE_PTHREAD_SPIN_TRYLOCK@
1921# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1922# undef pthread_spin_trylock
1923# define pthread_spin_trylock rpl_pthread_spin_trylock
1924# endif
1925_GL_FUNCDECL_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock),
1926 _GL_ARG_NONNULL ((1)));
1927_GL_CXXALIAS_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock));
1928# else
1929# if !@HAVE_PTHREAD_SPIN_TRYLOCK@
1930_GL_FUNCDECL_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock),
1931 _GL_ARG_NONNULL ((1)));
1932# endif
1933_GL_CXXALIAS_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock));
1934# endif
1935# if __GLIBC__ >= 2
1936_GL_CXXALIASWARN (pthread_spin_trylock);
1937# endif
1938#elif defined GNULIB_POSIXCHECK
1939# undef pthread_spin_trylock
1940# if HAVE_RAW_DECL_PTHREAD_SPIN_TRYLOCK
1941_GL_WARN_ON_USE (pthread_spin_trylock, "pthread_spin_trylock is not portable - "
1942 "use gnulib module pthread-spin for portability");
1943# endif
1944#endif
1945
1946#if @GNULIB_PTHREAD_SPIN@
1947# if @REPLACE_PTHREAD_SPIN_UNLOCK@
1948# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1949# undef pthread_spin_unlock
1950# define pthread_spin_unlock rpl_pthread_spin_unlock
1951# endif
1952_GL_FUNCDECL_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock),
1953 _GL_ARG_NONNULL ((1)));
1954_GL_CXXALIAS_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock));
1955# else
1956# if !@HAVE_PTHREAD_SPIN_UNLOCK@
1957_GL_FUNCDECL_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock),
1958 _GL_ARG_NONNULL ((1)));
1959# endif
1960_GL_CXXALIAS_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock));
1961# endif
1962# if __GLIBC__ >= 2
1963_GL_CXXALIASWARN (pthread_spin_unlock);
1964# endif
1965#elif defined GNULIB_POSIXCHECK
1966# undef pthread_spin_unlock
1967# if HAVE_RAW_DECL_PTHREAD_SPIN_UNLOCK
1968_GL_WARN_ON_USE (pthread_spin_unlock, "pthread_spin_unlock is not portable - "
1969 "use gnulib module pthread-spin for portability");
1970# endif
1971#endif
1972
1973#if @GNULIB_PTHREAD_SPIN@
1974# if @REPLACE_PTHREAD_SPIN_DESTROY@
1975# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1976# undef pthread_spin_destroy
1977# define pthread_spin_destroy rpl_pthread_spin_destroy
1978# endif
1979_GL_FUNCDECL_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock),
1980 _GL_ARG_NONNULL ((1)));
1981_GL_CXXALIAS_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock));
1982# else
1983# if !@HAVE_PTHREAD_SPIN_DESTROY@
1984_GL_FUNCDECL_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock),
1985 _GL_ARG_NONNULL ((1)));
1986# endif
1987_GL_CXXALIAS_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock));
1988# endif
1989# if __GLIBC__ >= 2
1990_GL_CXXALIASWARN (pthread_spin_destroy);
1991# endif
1992#elif defined GNULIB_POSIXCHECK
1993# undef pthread_spin_destroy
1994# if HAVE_RAW_DECL_PTHREAD_SPIN_DESTROY
1995_GL_WARN_ON_USE (pthread_spin_destroy, "pthread_spin_destroy is not portable - "
1996 "use gnulib module pthread-spin for portability");
1997# endif
1998#endif
1999
2000
2001#if defined __cplusplus && defined GNULIB_NAMESPACE && !@HAVE_PTHREAD_H@ && defined __MINGW32__
2002/* Provide the symbols required by mingw's <bits/gthr-default.h>. */
2003using GNULIB_NAMESPACE::pthread_create;
2004using GNULIB_NAMESPACE::pthread_self;
2005using GNULIB_NAMESPACE::pthread_equal;
2006using GNULIB_NAMESPACE::pthread_detach;
2007using GNULIB_NAMESPACE::pthread_join;
2008using GNULIB_NAMESPACE::pthread_once;
2009using GNULIB_NAMESPACE::pthread_mutex_init;
2010using GNULIB_NAMESPACE::pthread_mutexattr_init;
2011using GNULIB_NAMESPACE::pthread_mutexattr_settype;
2012using GNULIB_NAMESPACE::pthread_mutexattr_destroy;
2013using GNULIB_NAMESPACE::pthread_mutex_lock;
2014using GNULIB_NAMESPACE::pthread_mutex_trylock;
2015using GNULIB_NAMESPACE::pthread_mutex_timedlock;
2016using GNULIB_NAMESPACE::pthread_mutex_unlock;
2017using GNULIB_NAMESPACE::pthread_mutex_destroy;
2018using GNULIB_NAMESPACE::pthread_cond_wait;
2019using GNULIB_NAMESPACE::pthread_cond_timedwait;
2020using GNULIB_NAMESPACE::pthread_cond_signal;
2021using GNULIB_NAMESPACE::pthread_cond_broadcast;
2022using GNULIB_NAMESPACE::pthread_cond_destroy;
2023using GNULIB_NAMESPACE::pthread_key_create;
2024using GNULIB_NAMESPACE::pthread_setspecific;
2025using GNULIB_NAMESPACE::pthread_getspecific;
2026using GNULIB_NAMESPACE::pthread_key_delete;
2027#endif
2028
2029
2030#endif /* _@GUARD_PREFIX@_PTHREAD_H_ */
2031#endif /* _@GUARD_PREFIX@_PTHREAD_H_ */
2032#endif
diff --git a/gl/realloc.c b/gl/realloc.c
index 05731396..04a28561 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-2025 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/* Ensure that we call the system's realloc() below. */
22#define _GL_USE_STDLIB_ALLOC 1
21#include <config.h> 23#include <config.h>
22 24
25#define _GL_REALLOC_INLINE _GL_EXTERN_INLINE
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/bugzilla/show_bug.cgi?id=117233> 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..77e8d84c 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-2025 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..878b65ba 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-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 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..f5f65526 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-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 Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. 4 Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
5 5
diff --git a/gl/regex.h b/gl/regex.h
index ccf40ceb..e9ab85e8 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-2025 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..9b89cc93 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-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 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..1f297299 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-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 Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. 4 Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
5 5
@@ -100,10 +100,12 @@
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#if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
102# include <libintl.h> 102# include <libintl.h>
103# undef gettext
103# ifdef _LIBC 104# ifdef _LIBC
104# undef gettext
105# define gettext(msgid) \ 105# define gettext(msgid) \
106 __dcgettext (_libc_intl_domainname, msgid, LC_MESSAGES) 106 __dcgettext (_libc_intl_domainname, msgid, LC_MESSAGES)
107# else
108# define gettext(msgid) dgettext ("gnulib", msgid)
107# endif 109# endif
108#else 110#else
109# undef gettext 111# undef gettext
@@ -436,12 +438,6 @@ typedef struct re_dfa_t re_dfa_t;
436#define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx)) 438#define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx))
437#define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx)) 439#define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx))
438 440
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 441#ifndef MAX
446# define MAX(a,b) ((a) < (b) ? (b) : (a)) 442# define MAX(a,b) ((a) < (b) ? (b) : (a))
447#endif 443#endif
diff --git a/gl/regexec.c b/gl/regexec.c
index 9f065dfa..0d14ac35 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-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 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.h b/gl/sched.h
new file mode 100644
index 00000000..4d9d546d
--- /dev/null
+++ b/gl/sched.h
@@ -0,0 +1,631 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* A GNU-like <sched.h>.
3 Copyright (C) 2008-2025 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#ifndef _GL_SCHED_H
19
20#if __GNUC__ >= 3
21#pragma GCC system_header
22#endif
23
24
25/* This file uses #include_next of a system file that defines time_t.
26 For the 'year2038' module to work right, <config.h> needs to have been
27 included before. */
28#if !_GL_CONFIG_H_INCLUDED
29 #error "Please include config.h first."
30#endif
31
32/* The include_next requires a split double-inclusion guard. */
33#if 1
34# if 1
35# include <sys/cdefs.h>
36# endif
37# include_next <sched.h>
38#endif
39
40#ifndef _GL_SCHED_H
41#define _GL_SCHED_H
42
43/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
44#if !_GL_CONFIG_H_INCLUDED
45 #error "Please include config.h first."
46#endif
47
48/* Get pid_t.
49 This is needed on glibc 2.11 (see
50 glibc bug <https://sourceware.org/PR13198>)
51 and Mac OS X 10.5. */
52#include <sys/types.h>
53
54#ifdef __KLIBC__
55/* On OS/2 kLIBC, struct sched_param is in spawn.h. */
56# include <spawn.h>
57#endif
58
59#ifdef __VMS
60/* On OpenVMS, struct sched_param is in <pthread.h>. */
61# include <pthread.h>
62#endif
63
64/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
65/* C++ compatible function declaration macros.
66 Copyright (C) 2010-2025 Free Software Foundation, Inc.
67
68 This program is free software: you can redistribute it and/or modify it
69 under the terms of the GNU Lesser General Public License as published
70 by the Free Software Foundation; either version 2 of the License, or
71 (at your option) any later version.
72
73 This program is distributed in the hope that it will be useful,
74 but WITHOUT ANY WARRANTY; without even the implied warranty of
75 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
76 Lesser General Public License for more details.
77
78 You should have received a copy of the GNU Lesser General Public License
79 along with this program. If not, see <https://www.gnu.org/licenses/>. */
80
81#ifndef _GL_CXXDEFS_H
82#define _GL_CXXDEFS_H
83
84/* Begin/end the GNULIB_NAMESPACE namespace. */
85#if defined __cplusplus && defined GNULIB_NAMESPACE
86# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
87# define _GL_END_NAMESPACE }
88#else
89# define _GL_BEGIN_NAMESPACE
90# define _GL_END_NAMESPACE
91#endif
92
93/* The three most frequent use cases of these macros are:
94
95 * For providing a substitute for a function that is missing on some
96 platforms, but is declared and works fine on the platforms on which
97 it exists:
98
99 #if @GNULIB_FOO@
100 # if !@HAVE_FOO@
101 _GL_FUNCDECL_SYS (foo, ...);
102 # endif
103 _GL_CXXALIAS_SYS (foo, ...);
104 _GL_CXXALIASWARN (foo);
105 #elif defined GNULIB_POSIXCHECK
106 ...
107 #endif
108
109 * For providing a replacement for a function that exists on all platforms,
110 but is broken/insufficient and needs to be replaced on some platforms:
111
112 #if @GNULIB_FOO@
113 # if @REPLACE_FOO@
114 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
115 # undef foo
116 # define foo rpl_foo
117 # endif
118 _GL_FUNCDECL_RPL (foo, ...);
119 _GL_CXXALIAS_RPL (foo, ...);
120 # else
121 _GL_CXXALIAS_SYS (foo, ...);
122 # endif
123 _GL_CXXALIASWARN (foo);
124 #elif defined GNULIB_POSIXCHECK
125 ...
126 #endif
127
128 * For providing a replacement for a function that exists on some platforms
129 but is broken/insufficient and needs to be replaced on some of them and
130 is additionally either missing or undeclared on some other platforms:
131
132 #if @GNULIB_FOO@
133 # if @REPLACE_FOO@
134 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
135 # undef foo
136 # define foo rpl_foo
137 # endif
138 _GL_FUNCDECL_RPL (foo, ...);
139 _GL_CXXALIAS_RPL (foo, ...);
140 # else
141 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
142 _GL_FUNCDECL_SYS (foo, ...);
143 # endif
144 _GL_CXXALIAS_SYS (foo, ...);
145 # endif
146 _GL_CXXALIASWARN (foo);
147 #elif defined GNULIB_POSIXCHECK
148 ...
149 #endif
150*/
151
152/* _GL_EXTERN_C declaration;
153 performs the declaration with C linkage. */
154#if defined __cplusplus
155# define _GL_EXTERN_C extern "C"
156#else
157# define _GL_EXTERN_C extern
158#endif
159
160/* _GL_EXTERN_C_FUNC declaration;
161 performs the declaration of a function with C linkage. */
162#if defined __cplusplus
163# define _GL_EXTERN_C_FUNC extern "C"
164#else
165/* In C mode, omit the 'extern' keyword, because attributes in bracket syntax
166 are not allowed between 'extern' and the return type (see gnulib-common.m4).
167 */
168# define _GL_EXTERN_C_FUNC
169#endif
170
171/* _GL_FUNCDECL_RPL (func, rettype, parameters, [attributes]);
172 declares a replacement function, named rpl_func, with the given prototype,
173 consisting of return type, parameters, and attributes.
174 Although attributes are optional, the comma before them is required
175 for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW,
176 if needed, must be placed after the _GL_FUNCDECL_RPL invocation,
177 at the end of the declaration.
178 Examples:
179 _GL_FUNCDECL_RPL (free, void, (void *ptr), ) _GL_ATTRIBUTE_NOTHROW;
180 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...),
181 _GL_ARG_NONNULL ((1)));
182
183 Note: Attributes, such as _GL_ATTRIBUTE_DEPRECATED, are supported in front
184 of a _GL_FUNCDECL_RPL invocation only in C mode, not in C++ mode. (That's
185 because
186 [[...]] extern "C" <declaration>;
187 is invalid syntax in C++.)
188 */
189#define _GL_FUNCDECL_RPL(func,rettype,parameters,...) \
190 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters, __VA_ARGS__)
191#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters,...) \
192 _GL_EXTERN_C_FUNC __VA_ARGS__ rettype rpl_func parameters
193
194/* _GL_FUNCDECL_SYS_NAME (func) expands to plain func if C++, and to
195 parenthesized func otherwise. Parenthesization is needed in C23 if
196 the function is like strchr and so is a qualifier-generic macro
197 that expands to something more complicated. */
198#ifdef __cplusplus
199# define _GL_FUNCDECL_SYS_NAME(func) func
200#else
201# define _GL_FUNCDECL_SYS_NAME(func) (func)
202#endif
203
204/* _GL_FUNCDECL_SYS (func, rettype, parameters, [attributes]);
205 declares the system function, named func, with the given prototype,
206 consisting of return type, parameters, and attributes.
207 Although attributes are optional, the comma before them is required
208 for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW,
209 if needed, must be placed after the _GL_FUNCDECL_RPL invocation,
210 at the end of the declaration.
211 Examples:
212 _GL_FUNCDECL_SYS (getumask, mode_t, (void), ) _GL_ATTRIBUTE_NOTHROW;
213 _GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD);
214 */
215#define _GL_FUNCDECL_SYS(func,rettype,parameters,...) \
216 _GL_EXTERN_C_FUNC __VA_ARGS__ rettype _GL_FUNCDECL_SYS_NAME (func) parameters
217
218/* _GL_CXXALIAS_RPL (func, rettype, parameters);
219 declares a C++ alias called GNULIB_NAMESPACE::func
220 that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
221 Example:
222 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
223
224 Wrapping rpl_func in an object with an inline conversion operator
225 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
226 actually used in the program. */
227#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
228 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
229#if defined __cplusplus && defined GNULIB_NAMESPACE
230# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
231 namespace GNULIB_NAMESPACE \
232 { \
233 static const struct _gl_ ## func ## _wrapper \
234 { \
235 typedef rettype (*type) parameters; \
236 \
237 inline operator type () const \
238 { \
239 return ::rpl_func; \
240 } \
241 } func = {}; \
242 } \
243 _GL_EXTERN_C int _gl_cxxalias_dummy
244#else
245# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
246 _GL_EXTERN_C int _gl_cxxalias_dummy
247#endif
248
249/* _GL_CXXALIAS_MDA (func, rettype, parameters);
250 is to be used when func is a Microsoft deprecated alias, on native Windows.
251 It declares a C++ alias called GNULIB_NAMESPACE::func
252 that redirects to _func, if GNULIB_NAMESPACE is defined.
253 Example:
254 _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
255 */
256#define _GL_CXXALIAS_MDA(func,rettype,parameters) \
257 _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
258
259/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
260 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
261 except that the C function rpl_func may have a slightly different
262 declaration. A cast is used to silence the "invalid conversion" error
263 that would otherwise occur. */
264#if defined __cplusplus && defined GNULIB_NAMESPACE
265# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
266 namespace GNULIB_NAMESPACE \
267 { \
268 static const struct _gl_ ## func ## _wrapper \
269 { \
270 typedef rettype (*type) parameters; \
271 \
272 inline operator type () const \
273 { \
274 return reinterpret_cast<type>(::rpl_func); \
275 } \
276 } func = {}; \
277 } \
278 _GL_EXTERN_C int _gl_cxxalias_dummy
279#else
280# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
281 _GL_EXTERN_C int _gl_cxxalias_dummy
282#endif
283
284/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters);
285 is like _GL_CXXALIAS_MDA (func, rettype, parameters);
286 except that the C function func may have a slightly different declaration.
287 A cast is used to silence the "invalid conversion" error that would
288 otherwise occur. */
289#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \
290 _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters)
291
292/* _GL_CXXALIAS_SYS (func, rettype, parameters);
293 declares a C++ alias called GNULIB_NAMESPACE::func
294 that redirects to the system provided function func, if GNULIB_NAMESPACE
295 is defined.
296 Example:
297 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
298
299 Wrapping func in an object with an inline conversion operator
300 avoids a reference to func unless GNULIB_NAMESPACE::func is
301 actually used in the program. */
302#if defined __cplusplus && defined GNULIB_NAMESPACE
303# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
304 namespace GNULIB_NAMESPACE \
305 { \
306 static const struct _gl_ ## func ## _wrapper \
307 { \
308 typedef rettype (*type) parameters; \
309 \
310 inline operator type () const \
311 { \
312 return ::func; \
313 } \
314 } func = {}; \
315 } \
316 _GL_EXTERN_C int _gl_cxxalias_dummy
317#else
318# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
319 _GL_EXTERN_C int _gl_cxxalias_dummy
320#endif
321
322/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
323 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
324 except that the C function func may have a slightly different declaration.
325 A cast is used to silence the "invalid conversion" error that would
326 otherwise occur. */
327#if defined __cplusplus && defined GNULIB_NAMESPACE
328# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
329 namespace GNULIB_NAMESPACE \
330 { \
331 static const struct _gl_ ## func ## _wrapper \
332 { \
333 typedef rettype (*type) parameters; \
334 \
335 inline operator type () const \
336 { \
337 return reinterpret_cast<type>(::func); \
338 } \
339 } func = {}; \
340 } \
341 _GL_EXTERN_C int _gl_cxxalias_dummy
342#else
343# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
344 _GL_EXTERN_C int _gl_cxxalias_dummy
345#endif
346
347/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
348 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
349 except that the C function is picked among a set of overloaded functions,
350 namely the one with rettype2 and parameters2. Two consecutive casts
351 are used to silence the "cannot find a match" and "invalid conversion"
352 errors that would otherwise occur. */
353#if defined __cplusplus && defined GNULIB_NAMESPACE
354 /* The outer cast must be a reinterpret_cast.
355 The inner cast: When the function is defined as a set of overloaded
356 functions, it works as a static_cast<>, choosing the designated variant.
357 When the function is defined as a single variant, it works as a
358 reinterpret_cast<>. The parenthesized cast syntax works both ways. */
359# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
360 namespace GNULIB_NAMESPACE \
361 { \
362 static const struct _gl_ ## func ## _wrapper \
363 { \
364 typedef rettype (*type) parameters; \
365 \
366 inline operator type () const \
367 { \
368 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \
369 } \
370 } func = {}; \
371 } \
372 _GL_EXTERN_C int _gl_cxxalias_dummy
373#else
374# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
375 _GL_EXTERN_C int _gl_cxxalias_dummy
376#endif
377
378/* _GL_CXXALIASWARN (func);
379 causes a warning to be emitted when ::func is used but not when
380 GNULIB_NAMESPACE::func is used. func must be defined without overloaded
381 variants. */
382#if defined __cplusplus && defined GNULIB_NAMESPACE
383# define _GL_CXXALIASWARN(func) \
384 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
385# define _GL_CXXALIASWARN_1(func,namespace) \
386 _GL_CXXALIASWARN_2 (func, namespace)
387/* To work around GCC bug <https://gcc.gnu.org/PR43881>,
388 we enable the warning only when not optimizing. */
389# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
390# define _GL_CXXALIASWARN_2(func,namespace) \
391 _GL_WARN_ON_USE (func, \
392 "The symbol ::" #func " refers to the system function. " \
393 "Use " #namespace "::" #func " instead.")
394# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING
395# define _GL_CXXALIASWARN_2(func,namespace) \
396 extern __typeof__ (func) func
397# else
398# define _GL_CXXALIASWARN_2(func,namespace) \
399 _GL_EXTERN_C int _gl_cxxalias_dummy
400# endif
401#else
402# define _GL_CXXALIASWARN(func) \
403 _GL_EXTERN_C int _gl_cxxalias_dummy
404#endif
405
406/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
407 causes a warning to be emitted when the given overloaded variant of ::func
408 is used but not when GNULIB_NAMESPACE::func is used. */
409#if defined __cplusplus && defined GNULIB_NAMESPACE
410# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
411 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
412 GNULIB_NAMESPACE)
413# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
414 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
415/* To work around GCC bug <https://gcc.gnu.org/PR43881>,
416 we enable the warning only when not optimizing. */
417# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
418# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
419 _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \
420 "The symbol ::" #func " refers to the system function. " \
421 "Use " #namespace "::" #func " instead.")
422# else
423# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
424 _GL_EXTERN_C int _gl_cxxalias_dummy
425# endif
426#else
427# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
428 _GL_EXTERN_C int _gl_cxxalias_dummy
429#endif
430
431#endif /* _GL_CXXDEFS_H */
432
433/* The definition of _GL_WARN_ON_USE is copied here. */
434/* A C macro for emitting warnings if a function is used.
435 Copyright (C) 2010-2025 Free Software Foundation, Inc.
436
437 This program is free software: you can redistribute it and/or modify it
438 under the terms of the GNU Lesser General Public License as published
439 by the Free Software Foundation; either version 2 of the License, or
440 (at your option) any later version.
441
442 This program is distributed in the hope that it will be useful,
443 but WITHOUT ANY WARRANTY; without even the implied warranty of
444 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
445 Lesser General Public License for more details.
446
447 You should have received a copy of the GNU Lesser General Public License
448 along with this program. If not, see <https://www.gnu.org/licenses/>. */
449
450/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
451 for FUNCTION which will then trigger a compiler warning containing
452 the text of "literal string" anywhere that function is called, if
453 supported by the compiler. If the compiler does not support this
454 feature, the macro expands to an unused extern declaration.
455
456 _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
457 attribute used in _GL_WARN_ON_USE. If the compiler does not support
458 this feature, it expands to empty.
459
460 These macros are useful for marking a function as a potential
461 portability trap, with the intent that "literal string" include
462 instructions on the replacement function that should be used
463 instead.
464 _GL_WARN_ON_USE is for functions with 'extern' linkage.
465 _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
466 linkage.
467
468 _GL_WARN_ON_USE should not be used more than once for a given function
469 in a given compilation unit (because this may generate a warning even
470 if the function is never called).
471
472 However, one of the reasons that a function is a portability trap is
473 if it has the wrong signature. Declaring FUNCTION with a different
474 signature in C is a compilation error, so this macro must use the
475 same type as any existing declaration so that programs that avoid
476 the problematic FUNCTION do not fail to compile merely because they
477 included a header that poisoned the function. But this implies that
478 _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
479 have a declaration. Use of this macro implies that there must not
480 be any other macro hiding the declaration of FUNCTION; but
481 undefining FUNCTION first is part of the poisoning process anyway
482 (although for symbols that are provided only via a macro, the result
483 is a compilation error rather than a warning containing
484 "literal string"). Also note that in C++, it is only safe to use if
485 FUNCTION has no overloads.
486
487 For an example, it is possible to poison 'getline' by:
488 - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
489 [getline]) in configure.ac, which potentially defines
490 HAVE_RAW_DECL_GETLINE
491 - adding this code to a header that wraps the system <stdio.h>:
492 #undef getline
493 #if HAVE_RAW_DECL_GETLINE
494 _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
495 "not universally present; use the gnulib module getline");
496 #endif
497
498 It is not possible to directly poison global variables. But it is
499 possible to write a wrapper accessor function, and poison that
500 (less common usage, like &environ, will cause a compilation error
501 rather than issue the nice warning, but the end result of informing
502 the developer about their portability problem is still achieved):
503 #if HAVE_RAW_DECL_ENVIRON
504 static char ***
505 rpl_environ (void) { return &environ; }
506 _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
507 # undef environ
508 # define environ (*rpl_environ ())
509 #endif
510 or better (avoiding contradictory use of 'static' and 'extern'):
511 #if HAVE_RAW_DECL_ENVIRON
512 static char ***
513 _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
514 rpl_environ (void) { return &environ; }
515 # undef environ
516 # define environ (*rpl_environ ())
517 #endif
518 */
519#ifndef _GL_WARN_ON_USE
520
521# if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__
522/* A compiler attribute is available in gcc versions 4.3.0 and later. */
523# define _GL_WARN_ON_USE(function, message) \
524_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message)))
525# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
526 __attribute__ ((__warning__ (message)))
527# elif __clang_major__ >= 4
528/* Another compiler attribute is available in clang. */
529# define _GL_WARN_ON_USE(function, message) \
530_GL_WARN_EXTERN_C __typeof__ (function) function \
531 __attribute__ ((__diagnose_if__ (1, message, "warning")))
532# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
533 __attribute__ ((__diagnose_if__ (1, message, "warning")))
534# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING
535/* Verify the existence of the function. */
536# define _GL_WARN_ON_USE(function, message) \
537_GL_WARN_EXTERN_C __typeof__ (function) function
538# define _GL_WARN_ON_USE_ATTRIBUTE(message)
539# else /* Unsupported. */
540# define _GL_WARN_ON_USE(function, message) \
541_GL_WARN_EXTERN_C int _gl_warn_on_use
542# define _GL_WARN_ON_USE_ATTRIBUTE(message)
543# endif
544#endif
545
546/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message")
547 is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the
548 function is declared with the given prototype, consisting of return type,
549 parameters, and attributes.
550 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
551 not work in this case. */
552#ifndef _GL_WARN_ON_USE_CXX
553# if !defined __cplusplus
554# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
555 _GL_WARN_ON_USE (function, msg)
556# else
557# if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__
558/* A compiler attribute is available in gcc versions 4.3.0 and later. */
559# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
560extern rettype_gcc function parameters_and_attributes \
561 __attribute__ ((__warning__ (msg)))
562# elif __clang_major__ >= 4
563/* Another compiler attribute is available in clang. */
564# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
565extern rettype_clang function parameters_and_attributes \
566 __attribute__ ((__diagnose_if__ (1, msg, "warning")))
567# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING
568/* Verify the existence of the function. */
569# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
570extern rettype_gcc function parameters_and_attributes
571# else /* Unsupported. */
572# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
573_GL_WARN_EXTERN_C int _gl_warn_on_use
574# endif
575# endif
576#endif
577
578/* _GL_WARN_EXTERN_C declaration;
579 performs the declaration with C linkage. */
580#ifndef _GL_WARN_EXTERN_C
581# if defined __cplusplus
582# define _GL_WARN_EXTERN_C extern "C"
583# else
584# define _GL_WARN_EXTERN_C extern
585# endif
586#endif
587
588#if !1
589
590# if !GNULIB_defined_struct_sched_param
591struct sched_param
592{
593 int sched_priority;
594};
595# define GNULIB_defined_struct_sched_param 1
596# endif
597
598#endif
599
600#if !(defined SCHED_FIFO && defined SCHED_RR && defined SCHED_OTHER)
601# define SCHED_FIFO 1
602# define SCHED_RR 2
603# define SCHED_OTHER 0
604#endif
605
606#if 0
607# if 0
608# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
609# undef sched_yield
610# define sched_yield rpl_sched_yield
611# endif
612_GL_FUNCDECL_RPL (sched_yield, int, (void), );
613_GL_CXXALIAS_RPL (sched_yield, int, (void));
614# else
615# if !1
616_GL_FUNCDECL_SYS (sched_yield, int, (void), );
617# endif
618_GL_CXXALIAS_SYS (sched_yield, int, (void));
619# endif
620# if __GLIBC__ >= 2
621_GL_CXXALIASWARN (sched_yield);
622# endif
623#elif defined GNULIB_POSIXCHECK
624# if HAVE_RAW_DECL_SCHED_YIELD
625_GL_WARN_ON_USE (sched_yield, "sched_yield is not portable - "
626 "use gnulib module sched_yield for portability");
627# endif
628#endif
629
630#endif /* _GL_SCHED_H */
631#endif /* _GL_SCHED_H */
diff --git a/gl/sched.in.h b/gl/sched.in.h
new file mode 100644
index 00000000..5b4034c3
--- /dev/null
+++ b/gl/sched.in.h
@@ -0,0 +1,111 @@
1/* A GNU-like <sched.h>.
2 Copyright (C) 2008-2025 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/bugzilla/show_bug.cgi?id=13198>)
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# undef sched_yield
104# if HAVE_RAW_DECL_SCHED_YIELD
105_GL_WARN_ON_USE (sched_yield, "sched_yield is not portable - "
106 "use gnulib module sched_yield for portability");
107# endif
108#endif
109
110#endif /* _@GUARD_PREFIX@_SCHED_H */
111#endif /* _@GUARD_PREFIX@_SCHED_H */
diff --git a/gl/setenv.c b/gl/setenv.c
index 9e2e9e2f..ef301d41 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-2025 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
@@ -215,8 +227,7 @@ __add_to_environ (const char *name, const char *value, const char *combined,
215 } 227 }
216 228
217 if (__environ != last_environ) 229 if (__environ != last_environ)
218 memcpy ((char *) new_environ, (char *) __environ, 230 memcpy (new_environ, __environ, size * sizeof (char *));
219 size * sizeof (char *));
220 231
221 new_environ[size + 1] = NULL; 232 new_environ[size + 1] = NULL;
222 233
@@ -343,6 +354,84 @@ weak_alias (__setenv, setenv)
343weak_alias (__clearenv, clearenv) 354weak_alias (__clearenv, clearenv)
344#endif 355#endif
345 356
357#else /* HAVE_DECL__PUTENV */
358/* Native Windows */
359
360int
361setenv (const char *name, const char *value, int replace)
362{
363 if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
364 {
365 errno = EINVAL;
366 return -1;
367 }
368
369 /* The Microsoft documentation
370 <https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/putenv-wputenv>
371 says:
372 "Don't change an environment entry directly: instead,
373 use _putenv or _wputenv to change it."
374 Note: Microsoft's _putenv updates not only the contents of _environ but
375 also the contents of _wenviron, so that both are in kept in sync. */
376 const char *existing_value = getenv (name);
377 if (existing_value != NULL)
378 {
379 if (replace)
380 {
381 if (strcmp (existing_value, value) == 0)
382 /* No need to allocate memory. */
383 return 0;
384 }
385 else
386 /* Keep the existing value. */
387 return 0;
388 }
389 /* Allocate a new environment entry in the heap. */
390 /* _putenv ("NAME=") unsets NAME, so if VALUE is the empty string, invoke
391 _putenv ("NAME= ") and fix up the result afterwards. */
392 const char *value_ = (value[0] == '\0' ? " " : value);
393 size_t name_len = strlen (name);
394 size_t value_len = strlen (value_);
395 char *string = (char *) malloc (name_len + 1 + value_len + 1);
396 if (string == NULL)
397 return -1;
398 memcpy (string, name, name_len);
399 string[name_len] = '=';
400 memcpy (&string[name_len + 1], value_, value_len + 1);
401 /* Use _putenv. */
402 if (_putenv (string) < 0)
403 return -1;
404 if (value[0] == '\0')
405 {
406 /* Fix up the result. */
407 char *new_value = getenv (name);
408 if (new_value != NULL && new_value[0] == ' ' && new_value[1] == '\0')
409 new_value[0] = '\0';
410# if defined _WIN32 && ! defined __CYGWIN__
411 /* _putenv propagated "NAME= " into the subprocess environment;
412 fix that by calling SetEnvironmentVariable directly. */
413 /* Documentation:
414 <https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setenvironmentvariable> */
415 if (!SetEnvironmentVariable (name, ""))
416 {
417 switch (GetLastError ())
418 {
419 case ERROR_NOT_ENOUGH_MEMORY:
420 case ERROR_OUTOFMEMORY:
421 errno = ENOMEM;
422 break;
423 default:
424 errno = EINVAL;
425 break;
426 }
427 return -1;
428 }
429# endif
430 }
431 return 0;
432}
433
434#endif /* HAVE_DECL__PUTENV */
346#endif /* _LIBC || !HAVE_SETENV */ 435#endif /* _LIBC || !HAVE_SETENV */
347 436
348/* The rest of this file is called into use when replacing an existing 437/* The rest of this file is called into use when replacing an existing
@@ -360,7 +449,7 @@ int
360rpl_setenv (const char *name, const char *value, int replace) 449rpl_setenv (const char *name, const char *value, int replace)
361{ 450{
362 int result; 451 int result;
363 if (!name || !*name || strchr (name, '=')) 452 if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
364 { 453 {
365 errno = EINVAL; 454 errno = EINVAL;
366 return -1; 455 return -1;
diff --git a/gl/setlocale-lock.c b/gl/setlocale-lock.c
index 192489c4..87e0048c 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-2025 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..72729e6b 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-2025 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.c b/gl/setlocale_null.c
index 5ecf413d..29889642 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-2025 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.h b/gl/setlocale_null.h
index 966c53cf..3fcb7a82 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-2025 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..e2668078 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-2025 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>
@@ -136,10 +133,3 @@ sha224_stream (FILE *stream, void *resblock)
136 return shaxxx_stream (stream, "sha224", resblock, SHA224_DIGEST_SIZE, 133 return shaxxx_stream (stream, "sha224", resblock, SHA224_DIGEST_SIZE,
137 sha224_init_ctx, sha224_finish_ctx); 134 sha224_init_ctx, sha224_finish_ctx);
138} 135}
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..9358faff 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-2025 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
diff --git a/gl/sha256.h b/gl/sha256.h
index a9d7abb8..cd1a9fe3 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-2025 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..93eb96a6 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-2025 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..edeee083 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-2025 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,25 @@
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;
31 ptrdiff_t ret;
43 32
44 va_start (args, format); 33 va_start (args, format);
45 output = vasnprintf (str, &lenbuf, format, args); 34 ret = vsnzprintf (str, size, format, args);
46 len = lenbuf;
47 va_end (args); 35 va_end (args);
48 36
49 if (!output) 37#if PTRDIFF_MAX > INT_MAX
50 return -1; 38 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 { 39 {
66 errno = EOVERFLOW; 40 errno = EOVERFLOW;
67 return -1; 41 return -1;
68 } 42 }
43#endif
69 44
70 return len; 45 return ret;
71} 46}
diff --git a/gl/sockets.c b/gl/sockets.c
index 92beb7d3..7accfdd3 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-2025 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/sockets.h b/gl/sockets.h
index 55077ae9..5be5d3f6 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-2025 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..fa93e16c 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-2025 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/stat-time.h b/gl/stat-time.h
index 3cd8478f..38315b9f 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-2025 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;
diff --git a/gl/stat-w32.c b/gl/stat-w32.c
index ddd6f598..8da8fe5c 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-2025 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-w32.h b/gl/stat-w32.h
index 392faed1..c70c1be3 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-2025 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..66637837 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-2025 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
@@ -118,6 +118,10 @@ rpl_stat (char const *name, struct stat *buf)
118 around length limitations 118 around length limitations
119 <https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file> ? */ 119 <https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file> ? */
120 120
121 /* To ease portability. Like in open.c. */
122 if (strcmp (name, "/dev/null") == 0)
123 name = "NUL";
124
121 /* POSIX <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13> 125 /* 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 126 specifies: "More than two leading <slash> characters shall be treated as
123 a single <slash> character." */ 127 a single <slash> character." */
diff --git a/gl/stdckdint.in.h b/gl/stdckdint.in.h
index 91848806..bb9089b4 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-2025 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..e8c55ff1 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-2025 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/bugzilla/show_bug.cgi?id=114870>. */ \
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/bugzilla/show_bug.cgi?id=114869>. */
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..ca566b30 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-2025 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
@@ -80,7 +80,7 @@
80#define _@GUARD_PREFIX@_STDINT_H 80#define _@GUARD_PREFIX@_STDINT_H
81 81
82/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, 82/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX,
83 LONG_MIN, LONG_MAX, ULONG_MAX, _GL_INTEGER_WIDTH. */ 83 LONG_MIN, LONG_MAX, ULONG_MAX, CHAR_BIT, _GL_INTEGER_WIDTH. */
84#include <limits.h> 84#include <limits.h>
85 85
86/* Override WINT_MIN and WINT_MAX if gnulib's <wchar.h> or <wctype.h> overrides 86/* Override WINT_MIN and WINT_MAX if gnulib's <wchar.h> or <wctype.h> overrides
@@ -189,6 +189,10 @@ typedef __int64 gl_int64_t;
189# define int64_t gl_int64_t 189# define int64_t gl_int64_t
190# define GL_INT64_T 190# define GL_INT64_T
191# else 191# else
192/* Verify that 'long long' has exactly 64 bits. */
193typedef _gl_verify_int64_bits[
194 _STDINT_MAX (1, sizeof (long long) * CHAR_BIT, 0ll) >> 31 >> 31 == 1
195 ? 1 : -1];
192# undef int64_t 196# undef int64_t
193typedef long long int gl_int64_t; 197typedef long long int gl_int64_t;
194# define int64_t gl_int64_t 198# define int64_t gl_int64_t
@@ -210,6 +214,11 @@ typedef unsigned __int64 gl_uint64_t;
210# define uint64_t gl_uint64_t 214# define uint64_t gl_uint64_t
211# define GL_UINT64_T 215# define GL_UINT64_T
212# else 216# else
217/* Verify that 'unsigned long long' has exactly 64 bits. */
218typedef _gl_verify_uint64_bits[
219 _STDINT_MAX (0, sizeof (unsigned long long) * CHAR_BIT, 0ull)
220 >> 31 >> 31 >> 1 == 1
221 ? 1 : -1];
213# undef uint64_t 222# undef uint64_t
214typedef unsigned long long int gl_uint64_t; 223typedef unsigned long long int gl_uint64_t;
215# define uint64_t gl_uint64_t 224# define uint64_t gl_uint64_t
diff --git a/gl/stdio-consolesafe.c b/gl/stdio-consolesafe.c
new file mode 100644
index 00000000..80561a6d
--- /dev/null
+++ b/gl/stdio-consolesafe.c
@@ -0,0 +1,199 @@
1/* msvcrt workarounds.
2 Copyright (C) 2025 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
88vasprintf (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# endif
127
128/* Bypass the functions __mingw_[v][f]printf, that trigger a bug in msvcrt,
129 but without losing the support for modern format specifiers added by
130 __mingw_*printf. */
131
132int
133gl_consolesafe_fprintf (FILE *restrict fp, const char *restrict format, ...)
134{
135 va_list args;
136 char *tmpstring;
137 va_start (args, format);
138 int result = vasprintf (&tmpstring, format, args);
139 va_end (args);
140 if (result >= 0)
141 {
142 if (workaround_fwrite0 (tmpstring, result, fp) < result)
143 result = -1;
144 }
145 else
146 fseterr (fp);
147 return result;
148}
149
150int
151gl_consolesafe_printf (const char *restrict format, ...)
152{
153 va_list args;
154 char *tmpstring;
155 va_start (args, format);
156 int result = vasprintf (&tmpstring, format, args);
157 va_end (args);
158 if (result >= 0)
159 {
160 if (workaround_fwrite0 (tmpstring, result, stdout) < result)
161 result = -1;
162 }
163 else
164 fseterr (stdout);
165 return result;
166}
167
168int
169gl_consolesafe_vfprintf (FILE *restrict fp,
170 const char *restrict format, va_list args)
171{
172 char *tmpstring;
173 int result = vasprintf (&tmpstring, format, args);
174 if (result >= 0)
175 {
176 if (workaround_fwrite0 (tmpstring, result, fp) < result)
177 result = -1;
178 }
179 else
180 fseterr (fp);
181 return result;
182}
183
184int
185gl_consolesafe_vprintf (const char *restrict format, va_list args)
186{
187 char *tmpstring;
188 int result = vasprintf (&tmpstring, format, args);
189 if (result >= 0)
190 {
191 if (workaround_fwrite0 (tmpstring, result, stdout) < result)
192 result = -1;
193 }
194 else
195 fseterr (stdout);
196 return result;
197}
198
199#endif
diff --git a/gl/stdio-impl.h b/gl/stdio-impl.h
index 63ebf7c6..e4a69a8d 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-2025 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..70452b48 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-2025 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/stdio-write.c b/gl/stdio-write.c
index ca6aa00c..59ba8fc4 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-2025 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
@@ -162,6 +162,9 @@ vprintf (const char *format, va_list args)
162int 162int
163vfprintf (FILE *stream, const char *format, va_list args) 163vfprintf (FILE *stream, const char *format, va_list args)
164#undef vfprintf 164#undef vfprintf
165#if defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO
166# define vfprintf gl_consolesafe_vfprintf
167#endif
165{ 168{
166 CALL_WITH_SIGPIPE_EMULATION (int, vfprintf (stream, format, args), ret == EOF) 169 CALL_WITH_SIGPIPE_EMULATION (int, vfprintf (stream, format, args), ret == EOF)
167} 170}
@@ -198,6 +201,9 @@ puts (const char *string)
198size_t 201size_t
199fwrite (const void *ptr, size_t s, size_t n, FILE *stream) 202fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
200#undef fwrite 203#undef fwrite
204#if (defined _WIN32 && !defined __CYGWIN__) && !defined _UCRT
205# define fwrite gl_consolesafe_fwrite
206#endif
201{ 207{
202 CALL_WITH_SIGPIPE_EMULATION (size_t, fwrite (ptr, s, n, stream), ret < n) 208 CALL_WITH_SIGPIPE_EMULATION (size_t, fwrite (ptr, s, n, stream), ret < n)
203} 209}
diff --git a/gl/stdio.in.h b/gl/stdio.in.h
index 35b9f748..bc454454 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-2025 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 __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 26 - On OSF/1 5.1 we have a sequence of nested includes
@@ -48,12 +48,12 @@
48# endif 48# endif
49#endif 49#endif
50 50
51#define _GL_ALREADY_INCLUDING_STDIO_H 51#define _@GUARD_PREFIX@_ALREADY_INCLUDING_STDIO_H
52 52
53/* The include_next requires a split double-inclusion guard. */ 53/* The include_next requires a split double-inclusion guard. */
54#@INCLUDE_NEXT@ @NEXT_STDIO_H@ 54#@INCLUDE_NEXT@ @NEXT_STDIO_H@
55 55
56#undef _GL_ALREADY_INCLUDING_STDIO_H 56#undef _@GUARD_PREFIX@_ALREADY_INCLUDING_STDIO_H
57 57
58#ifdef _GL_DEFINED__POSIX_C_SOURCE 58#ifdef _GL_DEFINED__POSIX_C_SOURCE
59# undef _GL_DEFINED__POSIX_C_SOURCE 59# undef _GL_DEFINED__POSIX_C_SOURCE
@@ -64,8 +64,8 @@
64#define _@GUARD_PREFIX@_STDIO_H 64#define _@GUARD_PREFIX@_STDIO_H
65 65
66/* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_FORMAT, 66/* This file uses _GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_FORMAT,
67 _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_NOTHROW, GNULIB_POSIXCHECK, 67 _GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOTHROW,
68 HAVE_RAW_DECL_*. */ 68 GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
69#if !_GL_CONFIG_H_INCLUDED 69#if !_GL_CONFIG_H_INCLUDED
70 #error "Please include config.h first." 70 #error "Please include config.h first."
71#endif 71#endif
@@ -77,7 +77,8 @@
77 77
78/* Get off_t and ssize_t. Needed on many systems, including glibc 2.8 78/* Get off_t and ssize_t. Needed on many systems, including glibc 2.8
79 and eglibc 2.11.2. 79 and eglibc 2.11.2.
80 May also define off_t to a 64-bit type on native Windows. */ 80 May also define off_t to a 64-bit type on native Windows.
81 Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku. */
81#include <sys/types.h> 82#include <sys/types.h>
82 83
83/* Solaris 10 and NetBSD 7.0 declare renameat in <unistd.h>, not in <stdio.h>. */ 84/* Solaris 10 and NetBSD 7.0 declare renameat in <unistd.h>, not in <stdio.h>. */
@@ -119,7 +120,7 @@
119 that can be freed by passing them as the Ith argument to the 120 that can be freed by passing them as the Ith argument to the
120 function F. */ 121 function F. */
121#ifndef _GL_ATTRIBUTE_DEALLOC 122#ifndef _GL_ATTRIBUTE_DEALLOC
122# if __GNUC__ >= 11 123# if __GNUC__ >= 11 && !defined __clang__
123# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) 124# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
124# else 125# else
125# define _GL_ATTRIBUTE_DEALLOC(f, i) 126# define _GL_ATTRIBUTE_DEALLOC(f, i)
@@ -154,7 +155,7 @@
154 */ 155 */
155#ifndef _GL_ATTRIBUTE_NOTHROW 156#ifndef _GL_ATTRIBUTE_NOTHROW
156# if defined __cplusplus 157# if defined __cplusplus
157# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 158# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
158# if __cplusplus >= 201103L 159# if __cplusplus >= 201103L
159# define _GL_ATTRIBUTE_NOTHROW noexcept (true) 160# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
160# else 161# else
@@ -177,7 +178,7 @@
177 standardized by ISO C99 and POSIX. 178 standardized by ISO C99 and POSIX.
178 _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD */ 179 _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD */
179/* __gnu_printf__ is supported in GCC >= 4.4. */ 180/* __gnu_printf__ is supported in GCC >= 4.4. */
180#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) 181#if (__GNUC__ + (__GNUC_MINOR__ >= 4) > 4) && !defined __clang__
181# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __gnu_printf__ 182# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __gnu_printf__
182#else 183#else
183# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __printf__ 184# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __printf__
@@ -279,18 +280,64 @@
279#endif 280#endif
280 281
281 282
283#if (defined _WIN32 && !defined __CYGWIN__) && !defined _UCRT
284/* Workarounds against msvcrt bugs. */
285_GL_FUNCDECL_SYS (gl_consolesafe_fwrite, size_t,
286 (const void *ptr, size_t size, size_t nmemb, FILE *fp),
287 _GL_ARG_NONNULL ((1, 4)));
288# if defined __MINGW32__
289_GL_FUNCDECL_SYS (gl_consolesafe_fprintf, int,
290 (FILE *restrict fp, const char *restrict format, ...),
291 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
292 _GL_ARG_NONNULL ((1, 2)));
293_GL_FUNCDECL_SYS (gl_consolesafe_printf, int,
294 (const char *restrict format, ...),
295 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
296 _GL_ARG_NONNULL ((1)));
297_GL_FUNCDECL_SYS (gl_consolesafe_vfprintf, int,
298 (FILE *restrict fp,
299 const char *restrict format, va_list args),
300 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
301 _GL_ARG_NONNULL ((1, 2)));
302_GL_FUNCDECL_SYS (gl_consolesafe_vprintf, int,
303 (const char *restrict format, va_list args),
304 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0)
305 _GL_ARG_NONNULL ((1)));
306# endif
307#endif
308
309
310#if @GNULIB_DZPRINTF@
311/* Prints formatted output to file descriptor FD.
312 Returns the number of bytes written to the file descriptor. Upon
313 failure, returns -1 with errno set.
314 Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
315 Therefore, if the format string is valid and does not use %ls/%lc
316 directives nor widths, the only possible failure codes are ENOMEM
317 and the possible failure codes from write(), excluding EINTR. */
318_GL_FUNCDECL_SYS (dzprintf, off64_t,
319 (int fd, const char *restrict format, ...),
320 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
321 _GL_ARG_NONNULL ((2)));
322_GL_CXXALIAS_SYS (dzprintf, off64_t,
323 (int fd, const char *restrict format, ...));
324#endif
325
282#if @GNULIB_DPRINTF@ 326#if @GNULIB_DPRINTF@
327/* Prints formatted output to file descriptor FD.
328 Returns the number of bytes written to the file descriptor. Upon
329 failure, returns a negative value. */
283# if @REPLACE_DPRINTF@ 330# if @REPLACE_DPRINTF@
284# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 331# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
285# define dprintf rpl_dprintf 332# define dprintf rpl_dprintf
286# endif 333# endif
287_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...) 334_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...),
288 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 335 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
289 _GL_ARG_NONNULL ((2))); 336 _GL_ARG_NONNULL ((2)));
290_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *restrict format, ...)); 337_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *restrict format, ...));
291# else 338# else
292# if !@HAVE_DPRINTF@ 339# if !@HAVE_DPRINTF@
293_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...) 340_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...),
294 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 341 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
295 _GL_ARG_NONNULL ((2))); 342 _GL_ARG_NONNULL ((2)));
296# endif 343# endif
@@ -313,7 +360,7 @@ _GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
313# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 360# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
314# define fclose rpl_fclose 361# define fclose rpl_fclose
315# endif 362# endif
316_GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); 363_GL_FUNCDECL_RPL (fclose, int, (FILE *stream), _GL_ARG_NONNULL ((1)));
317_GL_CXXALIAS_RPL (fclose, int, (FILE *stream)); 364_GL_CXXALIAS_RPL (fclose, int, (FILE *stream));
318# else 365# else
319_GL_CXXALIAS_SYS (fclose, int, (FILE *stream)); 366_GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
@@ -360,9 +407,10 @@ _GL_CXXALIASWARN (fcloseall);
360# define fdopen rpl_fdopen 407# define fdopen rpl_fdopen
361# endif 408# endif
362_GL_FUNCDECL_RPL (fdopen, FILE *, 409_GL_FUNCDECL_RPL (fdopen, FILE *,
363 (int fd, const char *mode) 410 (int fd, const char *mode),
364 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) 411 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
365 _GL_ATTRIBUTE_MALLOC); 412 _GL_ATTRIBUTE_MALLOC
413 _GL_ATTRIBUTE_NODISCARD);
366_GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode)); 414_GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
367# elif defined _WIN32 && !defined __CYGWIN__ 415# elif defined _WIN32 && !defined __CYGWIN__
368# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 416# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -371,36 +419,38 @@ _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
371# endif 419# endif
372_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode)); 420_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode));
373# else 421# else
374# if __GNUC__ >= 11 422# if __GNUC__ >= 11 && !defined __clang__
375/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */ 423/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */
376# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 424# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
377_GL_FUNCDECL_SYS (fdopen, FILE *, 425_GL_FUNCDECL_SYS (fdopen, FILE *,
378 (int fd, const char *mode) 426 (int fd, const char *mode),
379 _GL_ATTRIBUTE_NOTHROW
380 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) 427 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
381 _GL_ATTRIBUTE_MALLOC); 428 _GL_ATTRIBUTE_MALLOC
429 _GL_ATTRIBUTE_NODISCARD)
430 _GL_ATTRIBUTE_NOTHROW;
382# else 431# else
383_GL_FUNCDECL_SYS (fdopen, FILE *, 432_GL_FUNCDECL_SYS (fdopen, FILE *,
384 (int fd, const char *mode) 433 (int fd, const char *mode),
385 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) 434 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
386 _GL_ATTRIBUTE_MALLOC); 435 _GL_ATTRIBUTE_MALLOC
436 _GL_ATTRIBUTE_NODISCARD);
387# endif 437# endif
388# endif 438# endif
389_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); 439_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
390# endif 440# endif
391_GL_CXXALIASWARN (fdopen); 441_GL_CXXALIASWARN (fdopen);
392#else 442#else
393# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fdopen 443# if @GNULIB_FCLOSE@ && (__GNUC__ >= 11 && !defined __clang__) && !defined fdopen
394/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */ 444/* For -Wmismatched-dealloc: Associate fdopen with fclose or rpl_fclose. */
395# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 445# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
396_GL_FUNCDECL_SYS (fdopen, FILE *, 446_GL_FUNCDECL_SYS (fdopen, FILE *,
397 (int fd, const char *mode) 447 (int fd, const char *mode),
398 _GL_ATTRIBUTE_NOTHROW
399 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) 448 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
400 _GL_ATTRIBUTE_MALLOC); 449 _GL_ATTRIBUTE_MALLOC)
450 _GL_ATTRIBUTE_NOTHROW;
401# else 451# else
402_GL_FUNCDECL_SYS (fdopen, FILE *, 452_GL_FUNCDECL_SYS (fdopen, FILE *,
403 (int fd, const char *mode) 453 (int fd, const char *mode),
404 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) 454 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
405 _GL_ATTRIBUTE_MALLOC); 455 _GL_ATTRIBUTE_MALLOC);
406# endif 456# endif
@@ -438,7 +488,7 @@ _GL_CXXALIASWARN (fdopen);
438# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 488# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
439# define fflush rpl_fflush 489# define fflush rpl_fflush
440# endif 490# endif
441_GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream)); 491_GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream), );
442_GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream)); 492_GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream));
443# else 493# else
444_GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream)); 494_GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream));
@@ -459,7 +509,7 @@ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
459# undef fgetc 509# undef fgetc
460# define fgetc rpl_fgetc 510# define fgetc rpl_fgetc
461# endif 511# endif
462_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); 512_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream), _GL_ARG_NONNULL ((1)));
463_GL_CXXALIAS_RPL (fgetc, int, (FILE *stream)); 513_GL_CXXALIAS_RPL (fgetc, int, (FILE *stream));
464# else 514# else
465_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream)); 515_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream));
@@ -476,8 +526,8 @@ _GL_CXXALIASWARN (fgetc);
476# define fgets rpl_fgets 526# define fgets rpl_fgets
477# endif 527# endif
478_GL_FUNCDECL_RPL (fgets, char *, 528_GL_FUNCDECL_RPL (fgets, char *,
479 (char *restrict s, int n, FILE *restrict stream) 529 (char *restrict s, int n, FILE *restrict stream),
480 _GL_ARG_NONNULL ((1, 3))); 530 _GL_ARG_NONNULL ((1, 3)) _GL_ATTRIBUTE_NODISCARD);
481_GL_CXXALIAS_RPL (fgets, char *, 531_GL_CXXALIAS_RPL (fgets, char *,
482 (char *restrict s, int n, FILE *restrict stream)); 532 (char *restrict s, int n, FILE *restrict stream));
483# else 533# else
@@ -513,17 +563,18 @@ _GL_CXXALIASWARN (fileno);
513# define fopen rpl_fopen 563# define fopen rpl_fopen
514# endif 564# endif
515_GL_FUNCDECL_RPL (fopen, FILE *, 565_GL_FUNCDECL_RPL (fopen, FILE *,
516 (const char *restrict filename, const char *restrict mode) 566 (const char *restrict filename, const char *restrict mode),
517 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1) 567 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
518 _GL_ATTRIBUTE_MALLOC); 568 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_NODISCARD);
519_GL_CXXALIAS_RPL (fopen, FILE *, 569_GL_CXXALIAS_RPL (fopen, FILE *,
520 (const char *restrict filename, const char *restrict mode)); 570 (const char *restrict filename, const char *restrict mode));
521# else 571# else
522# if __GNUC__ >= 11 572# if __GNUC__ >= 11 && !defined __clang__
523/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */ 573/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */
524_GL_FUNCDECL_SYS (fopen, FILE *, 574_GL_FUNCDECL_SYS (fopen, FILE *,
525 (const char *restrict filename, const char *restrict mode) 575 (const char *restrict filename, const char *restrict mode),
526 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); 576 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)
577 _GL_ATTRIBUTE_NODISCARD);
527# endif 578# endif
528_GL_CXXALIAS_SYS (fopen, FILE *, 579_GL_CXXALIAS_SYS (fopen, FILE *,
529 (const char *restrict filename, const char *restrict mode)); 580 (const char *restrict filename, const char *restrict mode));
@@ -532,10 +583,10 @@ _GL_CXXALIAS_SYS (fopen, FILE *,
532_GL_CXXALIASWARN (fopen); 583_GL_CXXALIASWARN (fopen);
533# endif 584# endif
534#else 585#else
535# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined fopen 586# if @GNULIB_FCLOSE@ && (__GNUC__ >= 11 && !defined __clang__) && !defined fopen
536/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */ 587/* For -Wmismatched-dealloc: Associate fopen with fclose or rpl_fclose. */
537_GL_FUNCDECL_SYS (fopen, FILE *, 588_GL_FUNCDECL_SYS (fopen, FILE *,
538 (const char *restrict filename, const char *restrict mode) 589 (const char *restrict filename, const char *restrict mode),
539 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); 590 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1));
540# endif 591# endif
541# if defined GNULIB_POSIXCHECK 592# if defined GNULIB_POSIXCHECK
@@ -546,7 +597,26 @@ _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX complian
546# endif 597# endif
547#endif 598#endif
548 599
600#if @GNULIB_FZPRINTF@
601/* Prints formatted output to stream FP.
602 Returns the number of bytes written to the stream. Upon failure,
603 returns -1 with the stream's error indicator set.
604 Failure cause EOVERFLOW can only occur when a width > INT_MAX is used.
605 Therefore, if the format string is valid and does not use %ls/%lc
606 directives nor widths, the only possible failure causes are ENOMEM
607 and the possible failure causes from fwrite(). */
608_GL_FUNCDECL_SYS (fzprintf, off64_t,
609 (FILE *restrict fp, const char *restrict format, ...),
610 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
611 _GL_ARG_NONNULL ((1, 2)));
612_GL_CXXALIAS_SYS (fzprintf, off64_t,
613 (FILE *restrict fp, const char *restrict format, ...));
614#endif
615
549#if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@ 616#if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
617/* Prints formatted output to stream FP.
618 Returns the number of bytes written to the stream. Upon failure,
619 returns a negative value with the stream's error indicator set. */
550# if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \ 620# if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
551 || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) 621 || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
552# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 622# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -555,12 +625,12 @@ _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX complian
555# define GNULIB_overrides_fprintf 1 625# define GNULIB_overrides_fprintf 1
556# if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ 626# if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
557_GL_FUNCDECL_RPL (fprintf, int, 627_GL_FUNCDECL_RPL (fprintf, int,
558 (FILE *restrict fp, const char *restrict format, ...) 628 (FILE *restrict fp, const char *restrict format, ...),
559 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 629 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
560 _GL_ARG_NONNULL ((1, 2))); 630 _GL_ARG_NONNULL ((1, 2)));
561# else 631# else
562_GL_FUNCDECL_RPL (fprintf, int, 632_GL_FUNCDECL_RPL (fprintf, int,
563 (FILE *restrict fp, const char *restrict format, ...) 633 (FILE *restrict fp, const char *restrict format, ...),
564 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3) 634 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
565 _GL_ARG_NONNULL ((1, 2))); 635 _GL_ARG_NONNULL ((1, 2)));
566# endif 636# endif
@@ -573,6 +643,11 @@ _GL_CXXALIAS_SYS (fprintf, int,
573# if __GLIBC__ >= 2 643# if __GLIBC__ >= 2
574_GL_CXXALIASWARN (fprintf); 644_GL_CXXALIASWARN (fprintf);
575# endif 645# endif
646#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO
647# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
648# undef fprintf
649# define fprintf gl_consolesafe_fprintf
650# endif
576#endif 651#endif
577#if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK 652#if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
578# if !GNULIB_overrides_fprintf 653# if !GNULIB_overrides_fprintf
@@ -595,15 +670,17 @@ _GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
595# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 670# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
596# define fpurge rpl_fpurge 671# define fpurge rpl_fpurge
597# endif 672# endif
598_GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); 673_GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream), _GL_ARG_NONNULL ((1)));
599_GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream)); 674_GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream));
600# else 675# else
601# if !@HAVE_DECL_FPURGE@ 676# if !@HAVE_DECL_FPURGE@
602_GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); 677_GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream), _GL_ARG_NONNULL ((1)));
603# endif 678# endif
604_GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream)); 679_GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream));
605# endif 680# endif
681# if __GLIBC__ >= 2
606_GL_CXXALIASWARN (fpurge); 682_GL_CXXALIASWARN (fpurge);
683# endif
607#elif defined GNULIB_POSIXCHECK 684#elif defined GNULIB_POSIXCHECK
608# undef fpurge 685# undef fpurge
609# if HAVE_RAW_DECL_FPURGE 686# if HAVE_RAW_DECL_FPURGE
@@ -618,7 +695,7 @@ _GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
618# undef fputc 695# undef fputc
619# define fputc rpl_fputc 696# define fputc rpl_fputc
620# endif 697# endif
621_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); 698_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream), _GL_ARG_NONNULL ((2)));
622_GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream)); 699_GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
623# else 700# else
624_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream)); 701_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
@@ -635,7 +712,7 @@ _GL_CXXALIASWARN (fputc);
635# define fputs rpl_fputs 712# define fputs rpl_fputs
636# endif 713# endif
637_GL_FUNCDECL_RPL (fputs, int, 714_GL_FUNCDECL_RPL (fputs, int,
638 (const char *restrict string, FILE *restrict stream) 715 (const char *restrict string, FILE *restrict stream),
639 _GL_ARG_NONNULL ((1, 2))); 716 _GL_ARG_NONNULL ((1, 2)));
640_GL_CXXALIAS_RPL (fputs, int, 717_GL_CXXALIAS_RPL (fputs, int,
641 (const char *restrict string, FILE *restrict stream)); 718 (const char *restrict string, FILE *restrict stream));
@@ -656,8 +733,8 @@ _GL_CXXALIASWARN (fputs);
656# endif 733# endif
657_GL_FUNCDECL_RPL (fread, size_t, 734_GL_FUNCDECL_RPL (fread, size_t,
658 (void *restrict ptr, size_t s, size_t n, 735 (void *restrict ptr, size_t s, size_t n,
659 FILE *restrict stream) 736 FILE *restrict stream),
660 _GL_ARG_NONNULL ((4))); 737 _GL_ARG_NONNULL ((4)) _GL_ATTRIBUTE_NODISCARD);
661_GL_CXXALIAS_RPL (fread, size_t, 738_GL_CXXALIAS_RPL (fread, size_t,
662 (void *restrict ptr, size_t s, size_t n, 739 (void *restrict ptr, size_t s, size_t n,
663 FILE *restrict stream)); 740 FILE *restrict stream));
@@ -679,8 +756,8 @@ _GL_CXXALIASWARN (fread);
679# endif 756# endif
680_GL_FUNCDECL_RPL (freopen, FILE *, 757_GL_FUNCDECL_RPL (freopen, FILE *,
681 (const char *restrict filename, const char *restrict mode, 758 (const char *restrict filename, const char *restrict mode,
682 FILE *restrict stream) 759 FILE *restrict stream),
683 _GL_ARG_NONNULL ((2, 3))); 760 _GL_ARG_NONNULL ((2, 3)) _GL_ATTRIBUTE_NODISCARD);
684_GL_CXXALIAS_RPL (freopen, FILE *, 761_GL_CXXALIAS_RPL (freopen, FILE *,
685 (const char *restrict filename, const char *restrict mode, 762 (const char *restrict filename, const char *restrict mode,
686 FILE *restrict stream)); 763 FILE *restrict stream));
@@ -707,9 +784,9 @@ _GL_WARN_ON_USE (freopen,
707# define fscanf rpl_fscanf 784# define fscanf rpl_fscanf
708# endif 785# endif
709_GL_FUNCDECL_RPL (fscanf, int, 786_GL_FUNCDECL_RPL (fscanf, int,
710 (FILE *restrict stream, const char *restrict format, ...) 787 (FILE *restrict stream, const char *restrict format, ...),
711 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3) 788 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3)
712 _GL_ARG_NONNULL ((1, 2))); 789 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
713_GL_CXXALIAS_RPL (fscanf, int, 790_GL_CXXALIAS_RPL (fscanf, int,
714 (FILE *restrict stream, const char *restrict format, ...)); 791 (FILE *restrict stream, const char *restrict format, ...));
715# else 792# else
@@ -763,7 +840,7 @@ _GL_CXXALIASWARN (fscanf);
763# undef fseek 840# undef fseek
764# define fseek rpl_fseek 841# define fseek rpl_fseek
765# endif 842# endif
766_GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence) 843_GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence),
767 _GL_ARG_NONNULL ((1))); 844 _GL_ARG_NONNULL ((1)));
768_GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence)); 845_GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
769# else 846# else
@@ -786,12 +863,12 @@ _GL_CXXALIASWARN (fseek);
786# undef fseeko 863# undef fseeko
787# define fseeko rpl_fseeko 864# define fseeko rpl_fseeko
788# endif 865# endif
789_GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence) 866_GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence),
790 _GL_ARG_NONNULL ((1))); 867 _GL_ARG_NONNULL ((1)));
791_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)); 868_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
792# else 869# else
793# if ! @HAVE_DECL_FSEEKO@ 870# if ! @HAVE_DECL_FSEEKO@
794_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence) 871_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence),
795 _GL_ARG_NONNULL ((1))); 872 _GL_ARG_NONNULL ((1)));
796# endif 873# endif
797_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)); 874_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
@@ -829,7 +906,8 @@ _GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB "
829# undef ftell 906# undef ftell
830# define ftell rpl_ftell 907# define ftell rpl_ftell
831# endif 908# endif
832_GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1))); 909_GL_FUNCDECL_RPL (ftell, long, (FILE *fp),
910 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
833_GL_CXXALIAS_RPL (ftell, long, (FILE *fp)); 911_GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
834# else 912# else
835_GL_CXXALIAS_SYS (ftell, long, (FILE *fp)); 913_GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
@@ -849,11 +927,13 @@ _GL_CXXALIASWARN (ftell);
849# undef ftello 927# undef ftello
850# define ftello rpl_ftello 928# define ftello rpl_ftello
851# endif 929# endif
852_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); 930_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp),
931 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
853_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp)); 932_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp));
854# else 933# else
855# if ! @HAVE_DECL_FTELLO@ 934# if ! @HAVE_DECL_FTELLO@
856_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); 935_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp),
936 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
857# endif 937# endif
858_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp)); 938_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
859# endif 939# endif
@@ -886,7 +966,7 @@ _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
886# endif 966# endif
887_GL_FUNCDECL_RPL (fwrite, size_t, 967_GL_FUNCDECL_RPL (fwrite, size_t,
888 (const void *restrict ptr, size_t s, size_t n, 968 (const void *restrict ptr, size_t s, size_t n,
889 FILE *restrict stream) 969 FILE *restrict stream),
890 _GL_ARG_NONNULL ((1, 4))); 970 _GL_ARG_NONNULL ((1, 4)));
891_GL_CXXALIAS_RPL (fwrite, size_t, 971_GL_CXXALIAS_RPL (fwrite, size_t,
892 (const void *restrict ptr, size_t s, size_t n, 972 (const void *restrict ptr, size_t s, size_t n,
@@ -901,9 +981,9 @@ _GL_CXXALIAS_SYS (fwrite, size_t,
901 which sometimes causes an unwanted diagnostic for fwrite calls. 981 which sometimes causes an unwanted diagnostic for fwrite calls.
902 This affects only function declaration attributes under certain 982 This affects only function declaration attributes under certain
903 versions of gcc and clang, and is not needed for C++. */ 983 versions of gcc and clang, and is not needed for C++. */
904# if (0 < __USE_FORTIFY_LEVEL \ 984# if (0 < __USE_FORTIFY_LEVEL \
905 && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \ 985 && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \
906 && 3 < __GNUC__ + (4 <= __GNUC_MINOR__) \ 986 && (3 < __GNUC__ + (4 <= __GNUC_MINOR__) || defined __clang__) \
907 && !defined __cplusplus) 987 && !defined __cplusplus)
908# undef fwrite 988# undef fwrite
909# undef fwrite_unlocked 989# undef fwrite_unlocked
@@ -922,6 +1002,11 @@ _GL_EXTERN_C size_t __REDIRECT (rpl_fwrite_unlocked,
922# if __GLIBC__ >= 2 1002# if __GLIBC__ >= 2
923_GL_CXXALIASWARN (fwrite); 1003_GL_CXXALIASWARN (fwrite);
924# endif 1004# endif
1005#elif (defined _WIN32 && !defined __CYGWIN__) && !defined _UCRT
1006# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1007# undef fwrite
1008# define fwrite gl_consolesafe_fwrite
1009# endif
925#endif 1010#endif
926 1011
927#if @GNULIB_GETC@ 1012#if @GNULIB_GETC@
@@ -930,7 +1015,7 @@ _GL_CXXALIASWARN (fwrite);
930# undef getc 1015# undef getc
931# define getc rpl_fgetc 1016# define getc rpl_fgetc
932# endif 1017# endif
933_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); 1018_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream), _GL_ARG_NONNULL ((1)));
934_GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream)); 1019_GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream));
935# else 1020# else
936_GL_CXXALIAS_SYS (getc, int, (FILE *stream)); 1021_GL_CXXALIAS_SYS (getc, int, (FILE *stream));
@@ -946,7 +1031,7 @@ _GL_CXXALIASWARN (getc);
946# undef getchar 1031# undef getchar
947# define getchar rpl_getchar 1032# define getchar rpl_getchar
948# endif 1033# endif
949_GL_FUNCDECL_RPL (getchar, int, (void)); 1034_GL_FUNCDECL_RPL (getchar, int, (void), );
950_GL_CXXALIAS_RPL (getchar, int, (void)); 1035_GL_CXXALIAS_RPL (getchar, int, (void));
951# else 1036# else
952_GL_CXXALIAS_SYS (getchar, int, (void)); 1037_GL_CXXALIAS_SYS (getchar, int, (void));
@@ -971,8 +1056,8 @@ _GL_CXXALIASWARN (getchar);
971_GL_FUNCDECL_RPL (getdelim, ssize_t, 1056_GL_FUNCDECL_RPL (getdelim, ssize_t,
972 (char **restrict lineptr, size_t *restrict linesize, 1057 (char **restrict lineptr, size_t *restrict linesize,
973 int delimiter, 1058 int delimiter,
974 FILE *restrict stream) 1059 FILE *restrict stream),
975 _GL_ARG_NONNULL ((1, 2, 4))); 1060 _GL_ARG_NONNULL ((1, 2, 4)) _GL_ATTRIBUTE_NODISCARD);
976_GL_CXXALIAS_RPL (getdelim, ssize_t, 1061_GL_CXXALIAS_RPL (getdelim, ssize_t,
977 (char **restrict lineptr, size_t *restrict linesize, 1062 (char **restrict lineptr, size_t *restrict linesize,
978 int delimiter, 1063 int delimiter,
@@ -982,8 +1067,8 @@ _GL_CXXALIAS_RPL (getdelim, ssize_t,
982_GL_FUNCDECL_SYS (getdelim, ssize_t, 1067_GL_FUNCDECL_SYS (getdelim, ssize_t,
983 (char **restrict lineptr, size_t *restrict linesize, 1068 (char **restrict lineptr, size_t *restrict linesize,
984 int delimiter, 1069 int delimiter,
985 FILE *restrict stream) 1070 FILE *restrict stream),
986 _GL_ARG_NONNULL ((1, 2, 4))); 1071 _GL_ARG_NONNULL ((1, 2, 4)) _GL_ATTRIBUTE_NODISCARD);
987# endif 1072# endif
988_GL_CXXALIAS_SYS (getdelim, ssize_t, 1073_GL_CXXALIAS_SYS (getdelim, ssize_t,
989 (char **restrict lineptr, size_t *restrict linesize, 1074 (char **restrict lineptr, size_t *restrict linesize,
@@ -1015,8 +1100,8 @@ _GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
1015# endif 1100# endif
1016_GL_FUNCDECL_RPL (getline, ssize_t, 1101_GL_FUNCDECL_RPL (getline, ssize_t,
1017 (char **restrict lineptr, size_t *restrict linesize, 1102 (char **restrict lineptr, size_t *restrict linesize,
1018 FILE *restrict stream) 1103 FILE *restrict stream),
1019 _GL_ARG_NONNULL ((1, 2, 3))); 1104 _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD);
1020_GL_CXXALIAS_RPL (getline, ssize_t, 1105_GL_CXXALIAS_RPL (getline, ssize_t,
1021 (char **restrict lineptr, size_t *restrict linesize, 1106 (char **restrict lineptr, size_t *restrict linesize,
1022 FILE *restrict stream)); 1107 FILE *restrict stream));
@@ -1024,8 +1109,8 @@ _GL_CXXALIAS_RPL (getline, ssize_t,
1024# if !@HAVE_DECL_GETLINE@ 1109# if !@HAVE_DECL_GETLINE@
1025_GL_FUNCDECL_SYS (getline, ssize_t, 1110_GL_FUNCDECL_SYS (getline, ssize_t,
1026 (char **restrict lineptr, size_t *restrict linesize, 1111 (char **restrict lineptr, size_t *restrict linesize,
1027 FILE *restrict stream) 1112 FILE *restrict stream),
1028 _GL_ARG_NONNULL ((1, 2, 3))); 1113 _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD);
1029# endif 1114# endif
1030_GL_CXXALIAS_SYS (getline, ssize_t, 1115_GL_CXXALIAS_SYS (getline, ssize_t,
1031 (char **restrict lineptr, size_t *restrict linesize, 1116 (char **restrict lineptr, size_t *restrict linesize,
@@ -1064,7 +1149,7 @@ _GL_CXXALIAS_MDA (getw, int, (FILE *restrict stream));
1064# if @HAVE_DECL_GETW@ 1149# if @HAVE_DECL_GETW@
1065# if defined __APPLE__ && defined __MACH__ 1150# if defined __APPLE__ && defined __MACH__
1066/* The presence of the declaration depends on _POSIX_C_SOURCE. */ 1151/* The presence of the declaration depends on _POSIX_C_SOURCE. */
1067_GL_FUNCDECL_SYS (getw, int, (FILE *restrict stream)); 1152_GL_FUNCDECL_SYS (getw, int, (FILE *restrict stream), );
1068# endif 1153# endif
1069_GL_CXXALIAS_SYS (getw, int, (FILE *restrict stream)); 1154_GL_CXXALIAS_SYS (getw, int, (FILE *restrict stream));
1070# endif 1155# endif
@@ -1074,19 +1159,45 @@ _GL_CXXALIASWARN (getw);
1074# endif 1159# endif
1075#endif 1160#endif
1076 1161
1162#if @GNULIB_OBSTACK_ZPRINTF@
1163struct obstack;
1164/* Grows an obstack with formatted output. Returns the number of
1165 bytes added to OBS. No trailing nul byte is added, and the
1166 object should be closed with obstack_finish before use.
1167 Upon memory allocation error, calls obstack_alloc_failed_handler.
1168 Upon other error, returns -1 with errno set.
1169
1170 Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
1171 Therefore, if the format string is valid and does not use %ls/%lc
1172 directives nor widths, the only possible failure code is through
1173 obstack_alloc_failed_handler. */
1174_GL_FUNCDECL_SYS (obstack_zprintf, ptrdiff_t,
1175 (struct obstack *obs, const char *format, ...),
1176 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1177 _GL_ARG_NONNULL ((1, 2)));
1178_GL_CXXALIAS_SYS (obstack_zprintf, ptrdiff_t,
1179 (struct obstack *obs, const char *format, ...));
1180_GL_FUNCDECL_SYS (obstack_vzprintf, ptrdiff_t,
1181 (struct obstack *obs, const char *format, va_list args),
1182 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1183 _GL_ARG_NONNULL ((1, 2)));
1184_GL_CXXALIAS_SYS (obstack_vzprintf, ptrdiff_t,
1185 (struct obstack *obs, const char *format, va_list args));
1186#endif
1187
1077#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ 1188#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
1078struct obstack; 1189struct obstack;
1079/* Grow an obstack with formatted output. Return the number of 1190/* Grows an obstack with formatted output. Returns the number of
1080 bytes added to OBS. No trailing nul byte is added, and the 1191 bytes added to OBS. No trailing nul byte is added, and the
1081 object should be closed with obstack_finish before use. Upon 1192 object should be closed with obstack_finish before use.
1082 memory allocation error, call obstack_alloc_failed_handler. Upon 1193 Upon memory allocation error, calls obstack_alloc_failed_handler.
1083 other error, return -1. */ 1194 Upon other error, returns -1. */
1084# if @REPLACE_OBSTACK_PRINTF@ 1195# if @REPLACE_OBSTACK_PRINTF@
1085# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1196# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1086# define obstack_printf rpl_obstack_printf 1197# define obstack_printf rpl_obstack_printf
1087# endif 1198# endif
1088_GL_FUNCDECL_RPL (obstack_printf, int, 1199_GL_FUNCDECL_RPL (obstack_printf, int,
1089 (struct obstack *obs, const char *format, ...) 1200 (struct obstack *obs, const char *format, ...),
1090 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1201 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1091 _GL_ARG_NONNULL ((1, 2))); 1202 _GL_ARG_NONNULL ((1, 2)));
1092_GL_CXXALIAS_RPL (obstack_printf, int, 1203_GL_CXXALIAS_RPL (obstack_printf, int,
@@ -1094,7 +1205,7 @@ _GL_CXXALIAS_RPL (obstack_printf, int,
1094# else 1205# else
1095# if !@HAVE_DECL_OBSTACK_PRINTF@ 1206# if !@HAVE_DECL_OBSTACK_PRINTF@
1096_GL_FUNCDECL_SYS (obstack_printf, int, 1207_GL_FUNCDECL_SYS (obstack_printf, int,
1097 (struct obstack *obs, const char *format, ...) 1208 (struct obstack *obs, const char *format, ...),
1098 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1209 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1099 _GL_ARG_NONNULL ((1, 2))); 1210 _GL_ARG_NONNULL ((1, 2)));
1100# endif 1211# endif
@@ -1107,7 +1218,7 @@ _GL_CXXALIASWARN (obstack_printf);
1107# define obstack_vprintf rpl_obstack_vprintf 1218# define obstack_vprintf rpl_obstack_vprintf
1108# endif 1219# endif
1109_GL_FUNCDECL_RPL (obstack_vprintf, int, 1220_GL_FUNCDECL_RPL (obstack_vprintf, int,
1110 (struct obstack *obs, const char *format, va_list args) 1221 (struct obstack *obs, const char *format, va_list args),
1111 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1222 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1112 _GL_ARG_NONNULL ((1, 2))); 1223 _GL_ARG_NONNULL ((1, 2)));
1113_GL_CXXALIAS_RPL (obstack_vprintf, int, 1224_GL_CXXALIAS_RPL (obstack_vprintf, int,
@@ -1115,7 +1226,7 @@ _GL_CXXALIAS_RPL (obstack_vprintf, int,
1115# else 1226# else
1116# if !@HAVE_DECL_OBSTACK_PRINTF@ 1227# if !@HAVE_DECL_OBSTACK_PRINTF@
1117_GL_FUNCDECL_SYS (obstack_vprintf, int, 1228_GL_FUNCDECL_SYS (obstack_vprintf, int,
1118 (struct obstack *obs, const char *format, va_list args) 1229 (struct obstack *obs, const char *format, va_list args),
1119 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1230 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1120 _GL_ARG_NONNULL ((1, 2))); 1231 _GL_ARG_NONNULL ((1, 2)));
1121# endif 1232# endif
@@ -1127,7 +1238,7 @@ _GL_CXXALIASWARN (obstack_vprintf);
1127 1238
1128#if @GNULIB_PCLOSE@ 1239#if @GNULIB_PCLOSE@
1129# if !@HAVE_PCLOSE@ 1240# if !@HAVE_PCLOSE@
1130_GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); 1241_GL_FUNCDECL_SYS (pclose, int, (FILE *stream), _GL_ARG_NONNULL ((1)));
1131# endif 1242# endif
1132_GL_CXXALIAS_SYS (pclose, int, (FILE *stream)); 1243_GL_CXXALIAS_SYS (pclose, int, (FILE *stream));
1133_GL_CXXALIASWARN (pclose); 1244_GL_CXXALIASWARN (pclose);
@@ -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));
@@ -1169,25 +1280,26 @@ _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
1169# define popen rpl_popen 1280# define popen rpl_popen
1170# endif 1281# endif
1171_GL_FUNCDECL_RPL (popen, FILE *, 1282_GL_FUNCDECL_RPL (popen, FILE *,
1172 (const char *cmd, const char *mode) 1283 (const char *cmd, const char *mode),
1173 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1) 1284 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)
1174 _GL_ATTRIBUTE_MALLOC); 1285 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_NODISCARD);
1175_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); 1286_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
1176# else 1287# else
1177# if !@HAVE_POPEN@ || __GNUC__ >= 11 1288# if !@HAVE_POPEN@ || (__GNUC__ >= 11 && !defined __clang__)
1178_GL_FUNCDECL_SYS (popen, FILE *, 1289_GL_FUNCDECL_SYS (popen, FILE *,
1179 (const char *cmd, const char *mode) 1290 (const char *cmd, const char *mode),
1180 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1) 1291 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)
1181 _GL_ATTRIBUTE_MALLOC); 1292 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_NODISCARD);
1182# endif 1293# endif
1183_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); 1294_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
1184# endif 1295# endif
1185_GL_CXXALIASWARN (popen); 1296_GL_CXXALIASWARN (popen);
1186#else 1297#else
1187# if @GNULIB_PCLOSE@ && __GNUC__ >= 11 && !defined popen 1298# if @GNULIB_PCLOSE@ \
1299 && (__GNUC__ >= 11 && !defined __clang__) && !defined popen
1188/* For -Wmismatched-dealloc: Associate popen with pclose or rpl_pclose. */ 1300/* For -Wmismatched-dealloc: Associate popen with pclose or rpl_pclose. */
1189_GL_FUNCDECL_SYS (popen, FILE *, 1301_GL_FUNCDECL_SYS (popen, FILE *,
1190 (const char *cmd, const char *mode) 1302 (const char *cmd, const char *mode),
1191 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1) 1303 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (pclose, 1)
1192 _GL_ATTRIBUTE_MALLOC); 1304 _GL_ATTRIBUTE_MALLOC);
1193# endif 1305# endif
@@ -1200,7 +1312,24 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
1200# endif 1312# endif
1201#endif 1313#endif
1202 1314
1315#if @GNULIB_ZPRINTF@
1316/* Prints formatted output to standard output.
1317 Returns the number of bytes written to standard output. Upon failure,
1318 returns -1 with stdout's error indicator set.
1319 Failure cause EOVERFLOW can only occur when a width > INT_MAX is used.
1320 Therefore, if the format string is valid and does not use %ls/%lc
1321 directives nor widths, the only possible failure causes are ENOMEM
1322 and the possible failure causes from fwrite(). */
1323_GL_FUNCDECL_SYS (zprintf, off64_t, (const char *restrict format, ...),
1324 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
1325 _GL_ARG_NONNULL ((1)));
1326_GL_CXXALIAS_SYS (zprintf, off64_t, (const char *restrict format, ...));
1327#endif
1328
1203#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@ 1329#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
1330/* Prints formatted output to standard output.
1331 Returns the number of bytes written to standard output. Upon failure,
1332 returns a negative value with stdout's error indicator set. */
1204# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \ 1333# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
1205 || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) 1334 || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1206# if defined __GNUC__ || defined __clang__ 1335# if defined __GNUC__ || defined __clang__
@@ -1212,14 +1341,14 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
1212_GL_FUNCDECL_RPL_1 (__printf__, int, 1341_GL_FUNCDECL_RPL_1 (__printf__, int,
1213 (const char *restrict format, ...) 1342 (const char *restrict format, ...)
1214 __asm__ (@ASM_SYMBOL_PREFIX@ 1343 __asm__ (@ASM_SYMBOL_PREFIX@
1215 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) 1344 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)),
1216 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) 1345 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
1217 _GL_ARG_NONNULL ((1))); 1346 _GL_ARG_NONNULL ((1)));
1218# else 1347# else
1219_GL_FUNCDECL_RPL_1 (__printf__, int, 1348_GL_FUNCDECL_RPL_1 (__printf__, int,
1220 (const char *restrict format, ...) 1349 (const char *restrict format, ...)
1221 __asm__ (@ASM_SYMBOL_PREFIX@ 1350 __asm__ (@ASM_SYMBOL_PREFIX@
1222 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) 1351 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)),
1223 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2) 1352 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2)
1224 _GL_ARG_NONNULL ((1))); 1353 _GL_ARG_NONNULL ((1)));
1225# endif 1354# endif
@@ -1229,7 +1358,7 @@ _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
1229# define printf rpl_printf 1358# define printf rpl_printf
1230# endif 1359# endif
1231_GL_FUNCDECL_RPL (printf, int, 1360_GL_FUNCDECL_RPL (printf, int,
1232 (const char *restrict format, ...) 1361 (const char *restrict format, ...),
1233 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) 1362 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2)
1234 _GL_ARG_NONNULL ((1))); 1363 _GL_ARG_NONNULL ((1)));
1235_GL_CXXALIAS_RPL (printf, int, (const char *restrict format, ...)); 1364_GL_CXXALIAS_RPL (printf, int, (const char *restrict format, ...));
@@ -1241,6 +1370,11 @@ _GL_CXXALIAS_SYS (printf, int, (const char *restrict format, ...));
1241# if __GLIBC__ >= 2 1370# if __GLIBC__ >= 2
1242_GL_CXXALIASWARN (printf); 1371_GL_CXXALIASWARN (printf);
1243# endif 1372# endif
1373#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO
1374# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1375# undef printf
1376# define printf gl_consolesafe_printf
1377# endif
1244#endif 1378#endif
1245#if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK 1379#if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1246# if !GNULIB_overrides_printf 1380# if !GNULIB_overrides_printf
@@ -1258,7 +1392,7 @@ _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
1258# undef putc 1392# undef putc
1259# define putc rpl_fputc 1393# define putc rpl_fputc
1260# endif 1394# endif
1261_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); 1395_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)); 1396_GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
1263# else 1397# else
1264_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream)); 1398_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
@@ -1274,7 +1408,7 @@ _GL_CXXALIASWARN (putc);
1274# undef putchar 1408# undef putchar
1275# define putchar rpl_putchar 1409# define putchar rpl_putchar
1276# endif 1410# endif
1277_GL_FUNCDECL_RPL (putchar, int, (int c)); 1411_GL_FUNCDECL_RPL (putchar, int, (int c), );
1278_GL_CXXALIAS_RPL (putchar, int, (int c)); 1412_GL_CXXALIAS_RPL (putchar, int, (int c));
1279# else 1413# else
1280_GL_CXXALIAS_SYS (putchar, int, (int c)); 1414_GL_CXXALIAS_SYS (putchar, int, (int c));
@@ -1290,7 +1424,7 @@ _GL_CXXALIASWARN (putchar);
1290# undef puts 1424# undef puts
1291# define puts rpl_puts 1425# define puts rpl_puts
1292# endif 1426# endif
1293_GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1))); 1427_GL_FUNCDECL_RPL (puts, int, (const char *string), _GL_ARG_NONNULL ((1)));
1294_GL_CXXALIAS_RPL (puts, int, (const char *string)); 1428_GL_CXXALIAS_RPL (puts, int, (const char *string));
1295# else 1429# else
1296_GL_CXXALIAS_SYS (puts, int, (const char *string)); 1430_GL_CXXALIAS_SYS (puts, int, (const char *string));
@@ -1314,7 +1448,7 @@ _GL_CXXALIAS_MDA (putw, int, (int w, FILE *restrict stream));
1314# if @HAVE_DECL_PUTW@ 1448# if @HAVE_DECL_PUTW@
1315# if defined __APPLE__ && defined __MACH__ 1449# if defined __APPLE__ && defined __MACH__
1316/* The presence of the declaration depends on _POSIX_C_SOURCE. */ 1450/* The presence of the declaration depends on _POSIX_C_SOURCE. */
1317_GL_FUNCDECL_SYS (putw, int, (int w, FILE *restrict stream)); 1451_GL_FUNCDECL_SYS (putw, int, (int w, FILE *restrict stream), );
1318# endif 1452# endif
1319_GL_CXXALIAS_SYS (putw, int, (int w, FILE *restrict stream)); 1453_GL_CXXALIAS_SYS (putw, int, (int w, FILE *restrict stream));
1320# endif 1454# endif
@@ -1330,7 +1464,7 @@ _GL_CXXALIASWARN (putw);
1330# undef remove 1464# undef remove
1331# define remove rpl_remove 1465# define remove rpl_remove
1332# endif 1466# endif
1333_GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1))); 1467_GL_FUNCDECL_RPL (remove, int, (const char *name), _GL_ARG_NONNULL ((1)));
1334_GL_CXXALIAS_RPL (remove, int, (const char *name)); 1468_GL_CXXALIAS_RPL (remove, int, (const char *name));
1335# else 1469# else
1336_GL_CXXALIAS_SYS (remove, int, (const char *name)); 1470_GL_CXXALIAS_SYS (remove, int, (const char *name));
@@ -1352,7 +1486,7 @@ _GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - "
1352# define rename rpl_rename 1486# define rename rpl_rename
1353# endif 1487# endif
1354_GL_FUNCDECL_RPL (rename, int, 1488_GL_FUNCDECL_RPL (rename, int,
1355 (const char *old_filename, const char *new_filename) 1489 (const char *old_filename, const char *new_filename),
1356 _GL_ARG_NONNULL ((1, 2))); 1490 _GL_ARG_NONNULL ((1, 2)));
1357_GL_CXXALIAS_RPL (rename, int, 1491_GL_CXXALIAS_RPL (rename, int,
1358 (const char *old_filename, const char *new_filename)); 1492 (const char *old_filename, const char *new_filename));
@@ -1377,14 +1511,14 @@ _GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
1377# define renameat rpl_renameat 1511# define renameat rpl_renameat
1378# endif 1512# endif
1379_GL_FUNCDECL_RPL (renameat, int, 1513_GL_FUNCDECL_RPL (renameat, int,
1380 (int fd1, char const *file1, int fd2, char const *file2) 1514 (int fd1, char const *file1, int fd2, char const *file2),
1381 _GL_ARG_NONNULL ((2, 4))); 1515 _GL_ARG_NONNULL ((2, 4)));
1382_GL_CXXALIAS_RPL (renameat, int, 1516_GL_CXXALIAS_RPL (renameat, int,
1383 (int fd1, char const *file1, int fd2, char const *file2)); 1517 (int fd1, char const *file1, int fd2, char const *file2));
1384# else 1518# else
1385# if !@HAVE_RENAMEAT@ 1519# if !@HAVE_RENAMEAT@
1386_GL_FUNCDECL_SYS (renameat, int, 1520_GL_FUNCDECL_SYS (renameat, int,
1387 (int fd1, char const *file1, int fd2, char const *file2) 1521 (int fd1, char const *file1, int fd2, char const *file2),
1388 _GL_ARG_NONNULL ((2, 4))); 1522 _GL_ARG_NONNULL ((2, 4)));
1389# endif 1523# endif
1390_GL_CXXALIAS_SYS (renameat, int, 1524_GL_CXXALIAS_SYS (renameat, int,
@@ -1410,18 +1544,18 @@ _GL_WARN_ON_USE (renameat, "renameat is not portable - "
1410_GL_FUNCDECL_RPL_1 (__scanf__, int, 1544_GL_FUNCDECL_RPL_1 (__scanf__, int,
1411 (const char *restrict format, ...) 1545 (const char *restrict format, ...)
1412 __asm__ (@ASM_SYMBOL_PREFIX@ 1546 __asm__ (@ASM_SYMBOL_PREFIX@
1413 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)) 1547 _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)),
1414 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) 1548 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
1415 _GL_ARG_NONNULL ((1))); 1549 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1416_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *restrict format, ...)); 1550_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *restrict format, ...));
1417# else 1551# else
1418# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1552# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1419# undef scanf 1553# undef scanf
1420# define scanf rpl_scanf 1554# define scanf rpl_scanf
1421# endif 1555# endif
1422_GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...) 1556_GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...),
1423 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) 1557 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
1424 _GL_ARG_NONNULL ((1))); 1558 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1425_GL_CXXALIAS_RPL (scanf, int, (const char *restrict format, ...)); 1559_GL_CXXALIAS_RPL (scanf, int, (const char *restrict format, ...));
1426# endif 1560# endif
1427# else 1561# else
@@ -1432,7 +1566,31 @@ _GL_CXXALIASWARN (scanf);
1432# endif 1566# endif
1433#endif 1567#endif
1434 1568
1569#if @GNULIB_SNZPRINTF@
1570/* Prints formatted output to string STR. Similar to sprintf, but the
1571 additional parameter SIZE limits how much is written into STR.
1572 STR may be NULL, in which case nothing will be written.
1573 Returns the string length of the formatted string (which may be larger
1574 than SIZE). Upon failure, returns -1 with errno set.
1575 Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
1576 Therefore, if the format string is valid and does not use %ls/%lc
1577 directives nor widths, the only possible failure code is ENOMEM. */
1578_GL_FUNCDECL_SYS (snzprintf, ptrdiff_t,
1579 (char *restrict str, size_t size,
1580 const char *restrict format, ...),
1581 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
1582 _GL_ARG_NONNULL ((3)));
1583_GL_CXXALIAS_SYS (snzprintf, ptrdiff_t,
1584 (char *restrict str, size_t size,
1585 const char *restrict format, ...));
1586#endif
1587
1435#if @GNULIB_SNPRINTF@ 1588#if @GNULIB_SNPRINTF@
1589/* Prints formatted output to string STR. Similar to sprintf, but the
1590 additional parameter SIZE limits how much is written into STR.
1591 STR may be NULL, in which case nothing will be written.
1592 Returns the string length of the formatted string (which may be larger
1593 than SIZE). Upon failure, returns a negative value. */
1436# if @REPLACE_SNPRINTF@ 1594# if @REPLACE_SNPRINTF@
1437# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1595# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1438# define snprintf rpl_snprintf 1596# define snprintf rpl_snprintf
@@ -1440,7 +1598,7 @@ _GL_CXXALIASWARN (scanf);
1440# define GNULIB_overrides_snprintf 1 1598# define GNULIB_overrides_snprintf 1
1441_GL_FUNCDECL_RPL (snprintf, int, 1599_GL_FUNCDECL_RPL (snprintf, int,
1442 (char *restrict str, size_t size, 1600 (char *restrict str, size_t size,
1443 const char *restrict format, ...) 1601 const char *restrict format, ...),
1444 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4) 1602 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
1445 _GL_ARG_NONNULL ((3))); 1603 _GL_ARG_NONNULL ((3)));
1446_GL_CXXALIAS_RPL (snprintf, int, 1604_GL_CXXALIAS_RPL (snprintf, int,
@@ -1450,7 +1608,7 @@ _GL_CXXALIAS_RPL (snprintf, int,
1450# if !@HAVE_DECL_SNPRINTF@ 1608# if !@HAVE_DECL_SNPRINTF@
1451_GL_FUNCDECL_SYS (snprintf, int, 1609_GL_FUNCDECL_SYS (snprintf, int,
1452 (char *restrict str, size_t size, 1610 (char *restrict str, size_t size,
1453 const char *restrict format, ...) 1611 const char *restrict format, ...),
1454 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4) 1612 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4)
1455 _GL_ARG_NONNULL ((3))); 1613 _GL_ARG_NONNULL ((3)));
1456# endif 1614# endif
@@ -1469,6 +1627,23 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
1469# endif 1627# endif
1470#endif 1628#endif
1471 1629
1630#if @GNULIB_SZPRINTF@
1631/* Prints formatted output to string STR.
1632 Returns the string length of the formatted string. Upon failure,
1633 returns -1 with errno set.
1634 Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
1635 Therefore, if the format string is valid and does not use %ls/%lc
1636 directives nor widths, the only possible failure code is ENOMEM. */
1637_GL_FUNCDECL_SYS (szprintf, ptrdiff_t,
1638 (char *restrict str,
1639 const char *restrict format, ...),
1640 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1641 _GL_ARG_NONNULL ((1, 2)));
1642_GL_CXXALIAS_SYS (szprintf, ptrdiff_t,
1643 (char *restrict str,
1644 const char *restrict format, ...));
1645#endif
1646
1472/* Some people would argue that all sprintf uses should be warned about 1647/* Some people would argue that all sprintf uses should be warned about
1473 (for example, OpenBSD issues a link warning for it), 1648 (for example, OpenBSD issues a link warning for it),
1474 since it can cause security holes due to buffer overruns. 1649 since it can cause security holes due to buffer overruns.
@@ -1479,13 +1654,16 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
1479 GNULIB_POSIXCHECK is defined. */ 1654 GNULIB_POSIXCHECK is defined. */
1480 1655
1481#if @GNULIB_SPRINTF_POSIX@ 1656#if @GNULIB_SPRINTF_POSIX@
1657/* Prints formatted output to string STR.
1658 Returns the string length of the formatted string. Upon failure,
1659 returns a negative value. */
1482# if @REPLACE_SPRINTF@ 1660# if @REPLACE_SPRINTF@
1483# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1661# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1484# define sprintf rpl_sprintf 1662# define sprintf rpl_sprintf
1485# endif 1663# endif
1486# define GNULIB_overrides_sprintf 1 1664# define GNULIB_overrides_sprintf 1
1487_GL_FUNCDECL_RPL (sprintf, int, 1665_GL_FUNCDECL_RPL (sprintf, int,
1488 (char *restrict str, const char *restrict format, ...) 1666 (char *restrict str, const char *restrict format, ...),
1489 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1667 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1490 _GL_ARG_NONNULL ((1, 2))); 1668 _GL_ARG_NONNULL ((1, 2)));
1491_GL_CXXALIAS_RPL (sprintf, int, 1669_GL_CXXALIAS_RPL (sprintf, int,
@@ -1526,16 +1704,18 @@ _GL_CXXALIASWARN (tempnam);
1526# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1704# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1527# define tmpfile rpl_tmpfile 1705# define tmpfile rpl_tmpfile
1528# endif 1706# endif
1529_GL_FUNCDECL_RPL (tmpfile, FILE *, (void) 1707_GL_FUNCDECL_RPL (tmpfile, FILE *, (void),
1530 _GL_ATTRIBUTE_DEALLOC (fclose, 1) 1708 _GL_ATTRIBUTE_DEALLOC (fclose, 1)
1531 _GL_ATTRIBUTE_MALLOC); 1709 _GL_ATTRIBUTE_MALLOC
1710 _GL_ATTRIBUTE_NODISCARD);
1532_GL_CXXALIAS_RPL (tmpfile, FILE *, (void)); 1711_GL_CXXALIAS_RPL (tmpfile, FILE *, (void));
1533# else 1712# else
1534# if __GNUC__ >= 11 1713# if __GNUC__ >= 11 && !defined __clang__
1535/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */ 1714/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */
1536_GL_FUNCDECL_SYS (tmpfile, FILE *, (void) 1715_GL_FUNCDECL_SYS (tmpfile, FILE *, (void),
1537 _GL_ATTRIBUTE_DEALLOC (fclose, 1) 1716 _GL_ATTRIBUTE_DEALLOC (fclose, 1)
1538 _GL_ATTRIBUTE_MALLOC); 1717 _GL_ATTRIBUTE_MALLOC
1718 _GL_ATTRIBUTE_NODISCARD);
1539# endif 1719# endif
1540_GL_CXXALIAS_SYS (tmpfile, FILE *, (void)); 1720_GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
1541# endif 1721# endif
@@ -1543,9 +1723,10 @@ _GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
1543_GL_CXXALIASWARN (tmpfile); 1723_GL_CXXALIASWARN (tmpfile);
1544# endif 1724# endif
1545#else 1725#else
1546# if @GNULIB_FCLOSE@ && __GNUC__ >= 11 && !defined tmpfile 1726# if @GNULIB_FCLOSE@ \
1727 && (__GNUC__ >= 11 && !defined __clang__) && !defined tmpfile
1547/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */ 1728/* For -Wmismatched-dealloc: Associate tmpfile with fclose or rpl_fclose. */
1548_GL_FUNCDECL_SYS (tmpfile, FILE *, (void) 1729_GL_FUNCDECL_SYS (tmpfile, FILE *, (void),
1549 _GL_ATTRIBUTE_DEALLOC (fclose, 1) 1730 _GL_ATTRIBUTE_DEALLOC (fclose, 1)
1550 _GL_ATTRIBUTE_MALLOC); 1731 _GL_ATTRIBUTE_MALLOC);
1551# endif 1732# endif
@@ -1558,6 +1739,31 @@ _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
1558# endif 1739# endif
1559#endif 1740#endif
1560 1741
1742#if @GNULIB_VASZPRINTF@
1743/* Prints formatted output to a string dynamically allocated with malloc().
1744 If the memory allocation succeeds, it stores the address of the string in
1745 *RESULT and returns the number of resulting bytes, excluding the trailing
1746 NUL. Upon memory allocation error, or some other error, it returns -1
1747 with errno set.
1748 Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
1749 Therefore, if the format string is valid and does not use %ls/%lc
1750 directives nor widths, the only possible failure code is ENOMEM. */
1751_GL_FUNCDECL_SYS (aszprintf, ptrdiff_t,
1752 (char **result, const char *format, ...),
1753 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1754 _GL_ARG_NONNULL ((1, 2))
1755 _GL_ATTRIBUTE_NODISCARD);
1756_GL_CXXALIAS_SYS (aszprintf, ptrdiff_t,
1757 (char **result, const char *format, ...));
1758_GL_FUNCDECL_SYS (vaszprintf, ptrdiff_t,
1759 (char **result, const char *format, va_list args),
1760 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1761 _GL_ARG_NONNULL ((1, 2))
1762 _GL_ATTRIBUTE_NODISCARD);
1763_GL_CXXALIAS_SYS (vaszprintf, ptrdiff_t,
1764 (char **result, const char *format, va_list args));
1765#endif
1766
1561#if @GNULIB_VASPRINTF@ 1767#if @GNULIB_VASPRINTF@
1562/* Write formatted output to a string dynamically allocated with malloc(). 1768/* Write formatted output to a string dynamically allocated with malloc().
1563 If the memory allocation succeeds, store the address of the string in 1769 If the memory allocation succeeds, store the address of the string in
@@ -1569,17 +1775,19 @@ _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
1569# endif 1775# endif
1570# define GNULIB_overrides_asprintf 1776# define GNULIB_overrides_asprintf
1571_GL_FUNCDECL_RPL (asprintf, int, 1777_GL_FUNCDECL_RPL (asprintf, int,
1572 (char **result, const char *format, ...) 1778 (char **result, const char *format, ...),
1573 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1779 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1574 _GL_ARG_NONNULL ((1, 2))); 1780 _GL_ARG_NONNULL ((1, 2))
1781 _GL_ATTRIBUTE_NODISCARD);
1575_GL_CXXALIAS_RPL (asprintf, int, 1782_GL_CXXALIAS_RPL (asprintf, int,
1576 (char **result, const char *format, ...)); 1783 (char **result, const char *format, ...));
1577# else 1784# else
1578# if !@HAVE_VASPRINTF@ 1785# if !@HAVE_VASPRINTF@
1579_GL_FUNCDECL_SYS (asprintf, int, 1786_GL_FUNCDECL_SYS (asprintf, int,
1580 (char **result, const char *format, ...) 1787 (char **result, const char *format, ...),
1581 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) 1788 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
1582 _GL_ARG_NONNULL ((1, 2))); 1789 _GL_ARG_NONNULL ((1, 2))
1790 _GL_ATTRIBUTE_NODISCARD);
1583# endif 1791# endif
1584_GL_CXXALIAS_SYS (asprintf, int, 1792_GL_CXXALIAS_SYS (asprintf, int,
1585 (char **result, const char *format, ...)); 1793 (char **result, const char *format, ...));
@@ -1591,17 +1799,19 @@ _GL_CXXALIASWARN (asprintf);
1591# endif 1799# endif
1592# define GNULIB_overrides_vasprintf 1 1800# define GNULIB_overrides_vasprintf 1
1593_GL_FUNCDECL_RPL (vasprintf, int, 1801_GL_FUNCDECL_RPL (vasprintf, int,
1594 (char **result, const char *format, va_list args) 1802 (char **result, const char *format, va_list args),
1595 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1803 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1596 _GL_ARG_NONNULL ((1, 2))); 1804 _GL_ARG_NONNULL ((1, 2))
1805 _GL_ATTRIBUTE_NODISCARD);
1597_GL_CXXALIAS_RPL (vasprintf, int, 1806_GL_CXXALIAS_RPL (vasprintf, int,
1598 (char **result, const char *format, va_list args)); 1807 (char **result, const char *format, va_list args));
1599# else 1808# else
1600# if !@HAVE_VASPRINTF@ 1809# if !@HAVE_VASPRINTF@
1601_GL_FUNCDECL_SYS (vasprintf, int, 1810_GL_FUNCDECL_SYS (vasprintf, int,
1602 (char **result, const char *format, va_list args) 1811 (char **result, const char *format, va_list args),
1603 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1812 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1604 _GL_ARG_NONNULL ((1, 2))); 1813 _GL_ARG_NONNULL ((1, 2))
1814 _GL_ATTRIBUTE_NODISCARD);
1605# endif 1815# endif
1606_GL_CXXALIAS_SYS (vasprintf, int, 1816_GL_CXXALIAS_SYS (vasprintf, int,
1607 (char **result, const char *format, va_list args)); 1817 (char **result, const char *format, va_list args));
@@ -1609,13 +1819,32 @@ _GL_CXXALIAS_SYS (vasprintf, int,
1609_GL_CXXALIASWARN (vasprintf); 1819_GL_CXXALIASWARN (vasprintf);
1610#endif 1820#endif
1611 1821
1822#if @GNULIB_VDZPRINTF@
1823/* Prints formatted output to file descriptor FD.
1824 Returns the number of bytes written to the file descriptor. Upon
1825 failure, returns -1 with errno set.
1826 Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
1827 Therefore, if the format string is valid and does not use %ls/%lc
1828 directives nor widths, the only possible failure codes are ENOMEM
1829 and the possible failure codes from write(), excluding EINTR. */
1830_GL_FUNCDECL_SYS (vdzprintf, off64_t,
1831 (int fd, const char *restrict format, va_list args),
1832 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1833 _GL_ARG_NONNULL ((2)));
1834_GL_CXXALIAS_SYS (vdzprintf, off64_t,
1835 (int fd, const char *restrict format, va_list args));
1836#endif
1837
1612#if @GNULIB_VDPRINTF@ 1838#if @GNULIB_VDPRINTF@
1839/* Prints formatted output to file descriptor FD.
1840 Returns the number of bytes written to the file descriptor. Upon
1841 failure, returns a negative value. */
1613# if @REPLACE_VDPRINTF@ 1842# if @REPLACE_VDPRINTF@
1614# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1843# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1615# define vdprintf rpl_vdprintf 1844# define vdprintf rpl_vdprintf
1616# endif 1845# endif
1617_GL_FUNCDECL_RPL (vdprintf, int, 1846_GL_FUNCDECL_RPL (vdprintf, int,
1618 (int fd, const char *restrict format, va_list args) 1847 (int fd, const char *restrict format, va_list args),
1619 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1848 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1620 _GL_ARG_NONNULL ((2))); 1849 _GL_ARG_NONNULL ((2)));
1621_GL_CXXALIAS_RPL (vdprintf, int, 1850_GL_CXXALIAS_RPL (vdprintf, int,
@@ -1623,7 +1852,7 @@ _GL_CXXALIAS_RPL (vdprintf, int,
1623# else 1852# else
1624# if !@HAVE_VDPRINTF@ 1853# if !@HAVE_VDPRINTF@
1625_GL_FUNCDECL_SYS (vdprintf, int, 1854_GL_FUNCDECL_SYS (vdprintf, int,
1626 (int fd, const char *restrict format, va_list args) 1855 (int fd, const char *restrict format, va_list args),
1627 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1856 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1628 _GL_ARG_NONNULL ((2))); 1857 _GL_ARG_NONNULL ((2)));
1629# endif 1858# endif
@@ -1643,7 +1872,28 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
1643# endif 1872# endif
1644#endif 1873#endif
1645 1874
1875#if @GNULIB_VFZPRINTF@
1876/* Prints formatted output to stream FP.
1877 Returns the number of bytes written to the stream. Upon failure,
1878 returns -1 with the stream's error indicator set.
1879 Failure cause EOVERFLOW can only occur when a width > INT_MAX is used.
1880 Therefore, if the format string is valid and does not use %ls/%lc
1881 directives nor widths, the only possible failure causes are ENOMEM
1882 and the possible failure causes from fwrite(). */
1883_GL_FUNCDECL_SYS (vfzprintf, off64_t,
1884 (FILE *restrict fp,
1885 const char *restrict format, va_list args),
1886 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1887 _GL_ARG_NONNULL ((1, 2)));
1888_GL_CXXALIAS_SYS (vfzprintf, off64_t,
1889 (FILE *restrict fp,
1890 const char *restrict format, va_list args));
1891#endif
1892
1646#if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@ 1893#if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
1894/* Prints formatted output to stream FP.
1895 Returns the number of bytes written to the stream. Upon failure,
1896 returns a negative value with the stream's error indicator set. */
1647# if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \ 1897# if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
1648 || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) 1898 || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1649# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1899# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1653,13 +1903,13 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
1653# if @GNULIB_VFPRINTF_POSIX@ 1903# if @GNULIB_VFPRINTF_POSIX@
1654_GL_FUNCDECL_RPL (vfprintf, int, 1904_GL_FUNCDECL_RPL (vfprintf, int,
1655 (FILE *restrict fp, 1905 (FILE *restrict fp,
1656 const char *restrict format, va_list args) 1906 const char *restrict format, va_list args),
1657 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 1907 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1658 _GL_ARG_NONNULL ((1, 2))); 1908 _GL_ARG_NONNULL ((1, 2)));
1659# else 1909# else
1660_GL_FUNCDECL_RPL (vfprintf, int, 1910_GL_FUNCDECL_RPL (vfprintf, int,
1661 (FILE *restrict fp, 1911 (FILE *restrict fp,
1662 const char *restrict format, va_list args) 1912 const char *restrict format, va_list args),
1663 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0) 1913 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0)
1664 _GL_ARG_NONNULL ((1, 2))); 1914 _GL_ARG_NONNULL ((1, 2)));
1665# endif 1915# endif
@@ -1677,6 +1927,11 @@ _GL_CXXALIAS_SYS_CAST (vfprintf, int,
1677# if __GLIBC__ >= 2 1927# if __GLIBC__ >= 2
1678_GL_CXXALIASWARN (vfprintf); 1928_GL_CXXALIASWARN (vfprintf);
1679# endif 1929# endif
1930#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO
1931# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1932# undef vfprintf
1933# define vfprintf gl_consolesafe_vfprintf
1934# endif
1680#endif 1935#endif
1681#if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK 1936#if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1682# if !GNULIB_overrides_vfprintf 1937# if !GNULIB_overrides_vfprintf
@@ -1696,9 +1951,9 @@ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
1696# endif 1951# endif
1697_GL_FUNCDECL_RPL (vfscanf, int, 1952_GL_FUNCDECL_RPL (vfscanf, int,
1698 (FILE *restrict stream, 1953 (FILE *restrict stream,
1699 const char *restrict format, va_list args) 1954 const char *restrict format, va_list args),
1700 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0) 1955 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0)
1701 _GL_ARG_NONNULL ((1, 2))); 1956 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1702_GL_CXXALIAS_RPL (vfscanf, int, 1957_GL_CXXALIAS_RPL (vfscanf, int,
1703 (FILE *restrict stream, 1958 (FILE *restrict stream,
1704 const char *restrict format, va_list args)); 1959 const char *restrict format, va_list args));
@@ -1712,7 +1967,26 @@ _GL_CXXALIASWARN (vfscanf);
1712# endif 1967# endif
1713#endif 1968#endif
1714 1969
1970#if @GNULIB_VZPRINTF@
1971/* Prints formatted output to standard output.
1972 Returns the number of bytes written to standard output. Upon failure,
1973 returns -1 with stdout's error indicator set.
1974 Failure cause EOVERFLOW can only occur when a width > INT_MAX is used.
1975 Therefore, if the format string is valid and does not use %ls/%lc
1976 directives nor widths, the only possible failure causes are ENOMEM
1977 and the possible failure causes from fwrite(). */
1978_GL_FUNCDECL_SYS (vzprintf, off64_t,
1979 (const char *restrict format, va_list args),
1980 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0)
1981 _GL_ARG_NONNULL ((1)));
1982_GL_CXXALIAS_SYS (vzprintf, off64_t,
1983 (const char *restrict format, va_list args));
1984#endif
1985
1715#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@ 1986#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
1987/* Prints formatted output to standard output.
1988 Returns the number of bytes written to standard output. Upon failure,
1989 returns a negative value with stdout's error indicator set. */
1716# if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \ 1990# if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
1717 || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) 1991 || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
1718# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1992# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1720,11 +1994,11 @@ _GL_CXXALIASWARN (vfscanf);
1720# endif 1994# endif
1721# define GNULIB_overrides_vprintf 1 1995# define GNULIB_overrides_vprintf 1
1722# if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ 1996# if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
1723_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args) 1997_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args),
1724 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0) 1998 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0)
1725 _GL_ARG_NONNULL ((1))); 1999 _GL_ARG_NONNULL ((1)));
1726# else 2000# else
1727_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args) 2001_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args),
1728 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0) 2002 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0)
1729 _GL_ARG_NONNULL ((1))); 2003 _GL_ARG_NONNULL ((1)));
1730# endif 2004# endif
@@ -1739,6 +2013,11 @@ _GL_CXXALIAS_SYS_CAST (vprintf, int,
1739# if __GLIBC__ >= 2 2013# if __GLIBC__ >= 2
1740_GL_CXXALIASWARN (vprintf); 2014_GL_CXXALIASWARN (vprintf);
1741# endif 2015# endif
2016#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO
2017# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2018# undef vprintf
2019# define vprintf gl_consolesafe_vprintf
2020# endif
1742#endif 2021#endif
1743#if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK 2022#if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
1744# if !GNULIB_overrides_vprintf 2023# if !GNULIB_overrides_vprintf
@@ -1756,9 +2035,9 @@ _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
1756# undef vscanf 2035# undef vscanf
1757# define vscanf rpl_vscanf 2036# define vscanf rpl_vscanf
1758# endif 2037# endif
1759_GL_FUNCDECL_RPL (vscanf, int, (const char *restrict format, va_list args) 2038_GL_FUNCDECL_RPL (vscanf, int, (const char *restrict format, va_list args),
1760 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0) 2039 _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0)
1761 _GL_ARG_NONNULL ((1))); 2040 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1762_GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args)); 2041_GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args));
1763# else 2042# else
1764_GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args)); 2043_GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args));
@@ -1768,7 +2047,31 @@ _GL_CXXALIASWARN (vscanf);
1768# endif 2047# endif
1769#endif 2048#endif
1770 2049
2050#if @GNULIB_VSNZPRINTF@
2051/* Prints formatted output to string STR. Similar to sprintf, but the
2052 additional parameter SIZE limits how much is written into STR.
2053 STR may be NULL, in which case nothing will be written.
2054 Returns the string length of the formatted string (which may be larger
2055 than SIZE). Upon failure, returns -1 with errno set.
2056 Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
2057 Therefore, if the format string is valid and does not use %ls/%lc
2058 directives nor widths, the only possible failure code is ENOMEM. */
2059_GL_FUNCDECL_SYS (vsnzprintf, ptrdiff_t,
2060 (char *restrict str, size_t size,
2061 const char *restrict format, va_list args),
2062 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
2063 _GL_ARG_NONNULL ((3)));
2064_GL_CXXALIAS_SYS (vsnzprintf, ptrdiff_t,
2065 (char *restrict str, size_t size,
2066 const char *restrict format, va_list args));
2067#endif
2068
1771#if @GNULIB_VSNPRINTF@ 2069#if @GNULIB_VSNPRINTF@
2070/* Prints formatted output to string STR. Similar to vsprintf, but the
2071 additional parameter SIZE limits how much is written into STR.
2072 STR may be NULL, in which case nothing will be written.
2073 Returns the string length of the formatted string (which may be larger
2074 than SIZE). Upon failure, returns a negative value. */
1772# if @REPLACE_VSNPRINTF@ 2075# if @REPLACE_VSNPRINTF@
1773# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2076# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1774# define vsnprintf rpl_vsnprintf 2077# define vsnprintf rpl_vsnprintf
@@ -1776,7 +2079,7 @@ _GL_CXXALIASWARN (vscanf);
1776# define GNULIB_overrides_vsnprintf 1 2079# define GNULIB_overrides_vsnprintf 1
1777_GL_FUNCDECL_RPL (vsnprintf, int, 2080_GL_FUNCDECL_RPL (vsnprintf, int,
1778 (char *restrict str, size_t size, 2081 (char *restrict str, size_t size,
1779 const char *restrict format, va_list args) 2082 const char *restrict format, va_list args),
1780 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) 2083 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
1781 _GL_ARG_NONNULL ((3))); 2084 _GL_ARG_NONNULL ((3)));
1782_GL_CXXALIAS_RPL (vsnprintf, int, 2085_GL_CXXALIAS_RPL (vsnprintf, int,
@@ -1786,7 +2089,7 @@ _GL_CXXALIAS_RPL (vsnprintf, int,
1786# if !@HAVE_DECL_VSNPRINTF@ 2089# if !@HAVE_DECL_VSNPRINTF@
1787_GL_FUNCDECL_SYS (vsnprintf, int, 2090_GL_FUNCDECL_SYS (vsnprintf, int,
1788 (char *restrict str, size_t size, 2091 (char *restrict str, size_t size,
1789 const char *restrict format, va_list args) 2092 const char *restrict format, va_list args),
1790 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) 2093 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0)
1791 _GL_ARG_NONNULL ((3))); 2094 _GL_ARG_NONNULL ((3)));
1792# endif 2095# endif
@@ -1805,7 +2108,27 @@ _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
1805# endif 2108# endif
1806#endif 2109#endif
1807 2110
2111#if @GNULIB_VSZPRINTF@
2112/* Prints formatted output to string STR.
2113 Returns the string length of the formatted string. Upon failure,
2114 returns -1 with errno set.
2115 Failure code EOVERFLOW can only occur when a width > INT_MAX is used.
2116 Therefore, if the format string is valid and does not use %ls/%lc
2117 directives nor widths, the only possible failure code is ENOMEM. */
2118_GL_FUNCDECL_SYS (vszprintf, ptrdiff_t,
2119 (char *restrict str,
2120 const char *restrict format, va_list args),
2121 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
2122 _GL_ARG_NONNULL ((1, 2)));
2123_GL_CXXALIAS_SYS (vszprintf, ptrdiff_t,
2124 (char *restrict str,
2125 const char *restrict format, va_list args));
2126#endif
2127
1808#if @GNULIB_VSPRINTF_POSIX@ 2128#if @GNULIB_VSPRINTF_POSIX@
2129/* Prints formatted output to string STR.
2130 Returns the string length of the formatted string. Upon failure,
2131 returns a negative value. */
1809# if @REPLACE_VSPRINTF@ 2132# if @REPLACE_VSPRINTF@
1810# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2133# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1811# define vsprintf rpl_vsprintf 2134# define vsprintf rpl_vsprintf
@@ -1813,7 +2136,7 @@ _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
1813# define GNULIB_overrides_vsprintf 1 2136# define GNULIB_overrides_vsprintf 1
1814_GL_FUNCDECL_RPL (vsprintf, int, 2137_GL_FUNCDECL_RPL (vsprintf, int,
1815 (char *restrict str, 2138 (char *restrict str,
1816 const char *restrict format, va_list args) 2139 const char *restrict format, va_list args),
1817 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) 2140 _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0)
1818 _GL_ARG_NONNULL ((1, 2))); 2141 _GL_ARG_NONNULL ((1, 2)));
1819_GL_CXXALIAS_RPL (vsprintf, int, 2142_GL_CXXALIAS_RPL (vsprintf, int,
diff --git a/gl/stdlib.c b/gl/stdlib.c
new file mode 100644
index 00000000..6a06f5ba
--- /dev/null
+++ b/gl/stdlib.c
@@ -0,0 +1,21 @@
1/* Inline functions for <stdlib.h>.
2
3 Copyright (C) 2024-2025 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..1342db48 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-2025 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,8 +62,9 @@
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>. */ 65/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>.
51#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS 66 glibc 2.41 defines WCOREDUMP in <sys/wait.h>, not in <stdlib.h>. */
67#if @GNULIB_SYSTEM_POSIX@ && !(defined WEXITSTATUS && defined WCOREDUMP)
52# include <sys/wait.h> 68# include <sys/wait.h>
53#endif 69#endif
54 70
@@ -104,11 +120,30 @@ struct random_data
104# include <unistd.h> 120# include <unistd.h>
105#endif 121#endif
106 122
123#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)
124/* When strtol, strtoll, strtoul, or strtoull is going to be defined as a macro
125 below, this may cause compilation errors later in the libstdc++ header files
126 (that are part of GCC), such as:
127 error: 'rpl_strtol' is not a member of 'std'
128 To avoid this, include the relevant header files here, before these symbols
129 get defined as macros. But do so only on Solaris 11 and AIX (where it is
130 needed), not on mingw (where it would cause other compilation errors). */
131# include <string>
132#endif
133
134_GL_INLINE_HEADER_BEGIN
135#ifndef _GL_STDLIB_INLINE
136# define _GL_STDLIB_INLINE _GL_INLINE
137#endif
138#ifndef _GL_REALLOC_INLINE
139# define _GL_REALLOC_INLINE _GL_INLINE
140#endif
141
107/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers 142/* _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 143 that can be freed by passing them as the Ith argument to the
109 function F. */ 144 function F. */
110#ifndef _GL_ATTRIBUTE_DEALLOC 145#ifndef _GL_ATTRIBUTE_DEALLOC
111# if __GNUC__ >= 11 146# if __GNUC__ >= 11 && !defined __clang__
112# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) 147# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
113# else 148# else
114# define _GL_ATTRIBUTE_DEALLOC(f, i) 149# define _GL_ATTRIBUTE_DEALLOC(f, i)
@@ -133,11 +168,23 @@ struct random_data
133# endif 168# endif
134#endif 169#endif
135 170
171/* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP
172 (a pointer) must not be NULL if the argument NI (an integer) is != 0. */
173/* Applies to: functions. */
174#ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO
175# if __GNUC__ >= 15 && !defined __clang__
176# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) \
177 __attribute__ ((__nonnull_if_nonzero__ (np, ni)))
178# else
179# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni)
180# endif
181#endif
182
136/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. 183/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
137 */ 184 */
138#ifndef _GL_ATTRIBUTE_NOTHROW 185#ifndef _GL_ATTRIBUTE_NOTHROW
139# if defined __cplusplus 186# if defined __cplusplus
140# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 187# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
141# if __cplusplus >= 201103L 188# if __cplusplus >= 201103L
142# define _GL_ATTRIBUTE_NOTHROW noexcept (true) 189# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
143# else 190# else
@@ -188,6 +235,18 @@ struct random_data
188#endif 235#endif
189 236
190 237
238/* Declarations for ISO C N3322. */
239#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
240_GL_EXTERN_C void *bsearch (const void *__key,
241 const void *__base, size_t __nmemb, size_t __size,
242 int (*__compare) (const void *, const void *))
243 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3) _GL_ARG_NONNULL ((5));
244_GL_EXTERN_C void qsort (void *__base, size_t __nmemb, size_t __size,
245 int (*__compare) (const void *, const void *))
246 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2) _GL_ARG_NONNULL ((4));
247#endif
248
249
191#if @GNULIB__EXIT@ 250#if @GNULIB__EXIT@
192/* Terminate the current process with the given return code, without running 251/* Terminate the current process with the given return code, without running
193 the 'atexit' handlers. */ 252 the 'atexit' handlers. */
@@ -196,11 +255,11 @@ struct random_data
196# undef _Exit 255# undef _Exit
197# define _Exit rpl__Exit 256# define _Exit rpl__Exit
198# endif 257# endif
199_GL_FUNCDECL_RPL (_Exit, _Noreturn void, (int status)); 258_GL_FUNCDECL_RPL (_Exit, _Noreturn void, (int status), );
200_GL_CXXALIAS_RPL (_Exit, void, (int status)); 259_GL_CXXALIAS_RPL (_Exit, void, (int status));
201# else 260# else
202# if !@HAVE__EXIT@ 261# if !@HAVE__EXIT@
203_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status)); 262_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status), );
204# endif 263# endif
205_GL_CXXALIAS_SYS (_Exit, void, (int status)); 264_GL_CXXALIAS_SYS (_Exit, void, (int status));
206# endif 265# endif
@@ -216,6 +275,26 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
216#endif 275#endif
217 276
218 277
278#if @GNULIB_ABORT_DEBUG@
279/* Terminates the current process with signal SIGABRT.
280 Note: While the original abort() function is safe to call in signal handlers,
281 the overridden abort() function is not. */
282# if @REPLACE_ABORT@
283# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
284# undef abort
285# define abort rpl_abort
286# endif
287_GL_FUNCDECL_RPL (abort, _Noreturn void, (void), );
288_GL_CXXALIAS_RPL (abort, void, (void));
289# else
290_GL_CXXALIAS_SYS (abort, void, (void));
291# endif
292# if __GLIBC__ >= 2
293_GL_CXXALIASWARN (abort);
294# endif
295#endif
296
297
219#if @GNULIB_FREE_POSIX@ 298#if @GNULIB_FREE_POSIX@
220# if @REPLACE_FREE@ 299# if @REPLACE_FREE@
221# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 300# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -223,9 +302,9 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
223# define free rpl_free 302# define free rpl_free
224# endif 303# endif
225# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2) 304# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
226_GL_FUNCDECL_RPL (free, void, (void *ptr) _GL_ATTRIBUTE_NOTHROW); 305_GL_FUNCDECL_RPL (free, void, (void *ptr), ) _GL_ATTRIBUTE_NOTHROW;
227# else 306# else
228_GL_FUNCDECL_RPL (free, void, (void *ptr)); 307_GL_FUNCDECL_RPL (free, void, (void *ptr), );
229# endif 308# endif
230_GL_CXXALIAS_RPL (free, void, (void *ptr)); 309_GL_CXXALIAS_RPL (free, void, (void *ptr));
231# else 310# else
@@ -237,8 +316,8 @@ _GL_CXXALIASWARN (free);
237#elif defined GNULIB_POSIXCHECK 316#elif defined GNULIB_POSIXCHECK
238# undef free 317# undef free
239/* Assume free is always declared. */ 318/* Assume free is always declared. */
240_GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - " 319_GL_WARN_ON_USE (free, "free is not POSIX:2024 compliant everywhere - "
241 "use gnulib module free for portability"); 320 "use gnulib module free-posix for portability");
242#endif 321#endif
243 322
244 323
@@ -250,22 +329,25 @@ _GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - "
250# define aligned_alloc rpl_aligned_alloc 329# define aligned_alloc rpl_aligned_alloc
251# endif 330# endif
252_GL_FUNCDECL_RPL (aligned_alloc, void *, 331_GL_FUNCDECL_RPL (aligned_alloc, void *,
253 (size_t alignment, size_t size) 332 (size_t alignment, size_t size),
254 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 333 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
334 _GL_ATTRIBUTE_NODISCARD);
255_GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size)); 335_GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size));
256# else 336# else
257# if @HAVE_ALIGNED_ALLOC@ 337# if @HAVE_ALIGNED_ALLOC@
258# if __GNUC__ >= 11 338# if __GNUC__ >= 11 && !defined __clang__
259/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ 339/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
260# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 340# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
261_GL_FUNCDECL_SYS (aligned_alloc, void *, 341_GL_FUNCDECL_SYS (aligned_alloc, void *,
262 (size_t alignment, size_t size) 342 (size_t alignment, size_t size),
263 _GL_ATTRIBUTE_NOTHROW 343 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
264 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 344 _GL_ATTRIBUTE_NODISCARD)
345 _GL_ATTRIBUTE_NOTHROW;
265# else 346# else
266_GL_FUNCDECL_SYS (aligned_alloc, void *, 347_GL_FUNCDECL_SYS (aligned_alloc, void *,
267 (size_t alignment, size_t size) 348 (size_t alignment, size_t size),
268 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 349 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
350 _GL_ATTRIBUTE_NODISCARD);
269# endif 351# endif
270# endif 352# endif
271_GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size)); 353_GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
@@ -275,16 +357,17 @@ _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
275_GL_CXXALIASWARN (aligned_alloc); 357_GL_CXXALIASWARN (aligned_alloc);
276# endif 358# endif
277#else 359#else
278# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined aligned_alloc 360# if @GNULIB_FREE_POSIX@ \
361 && (__GNUC__ >= 11 && !defined __clang__) && !defined aligned_alloc
279/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */ 362/* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free. */
280# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2 363# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
281_GL_FUNCDECL_SYS (aligned_alloc, void *, 364_GL_FUNCDECL_SYS (aligned_alloc, void *,
282 (size_t alignment, size_t size) 365 (size_t alignment, size_t size),
283 _GL_ATTRIBUTE_NOTHROW 366 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
284 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 367 _GL_ATTRIBUTE_NOTHROW;
285# else 368# else
286_GL_FUNCDECL_SYS (aligned_alloc, void *, 369_GL_FUNCDECL_SYS (aligned_alloc, void *,
287 (size_t alignment, size_t size) 370 (size_t alignment, size_t size),
288 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 371 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
289# endif 372# endif
290# endif 373# endif
@@ -301,9 +384,10 @@ _GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - "
301/* Parse a signed decimal integer. 384/* Parse a signed decimal integer.
302 Returns the value of the integer. Errors are not detected. */ 385 Returns the value of the integer. Errors are not detected. */
303# if !@HAVE_ATOLL@ 386# if !@HAVE_ATOLL@
304_GL_FUNCDECL_SYS (atoll, long long, (const char *string) 387_GL_FUNCDECL_SYS (atoll, long long,
305 _GL_ATTRIBUTE_PURE 388 (const char *string),
306 _GL_ARG_NONNULL ((1))); 389 _GL_ATTRIBUTE_PURE
390 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
307# endif 391# endif
308_GL_CXXALIAS_SYS (atoll, long long, (const char *string)); 392_GL_CXXALIAS_SYS (atoll, long long, (const char *string));
309_GL_CXXALIASWARN (atoll); 393_GL_CXXALIASWARN (atoll);
@@ -316,28 +400,32 @@ _GL_WARN_ON_USE (atoll, "atoll is unportable - "
316#endif 400#endif
317 401
318#if @GNULIB_CALLOC_POSIX@ 402#if @GNULIB_CALLOC_POSIX@
319# if (@GNULIB_CALLOC_POSIX@ && @REPLACE_CALLOC_FOR_CALLOC_POSIX@) \ 403# if @REPLACE_CALLOC_FOR_CALLOC_POSIX@ \
320 || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@) 404 || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@)
321# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 405# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
406 || _GL_USE_STDLIB_ALLOC)
322# undef calloc 407# undef calloc
323# define calloc rpl_calloc 408# define calloc rpl_calloc
324# endif 409# endif
325_GL_FUNCDECL_RPL (calloc, void *, 410_GL_FUNCDECL_RPL (calloc, void *,
326 (size_t nmemb, size_t size) 411 (size_t nmemb, size_t size),
327 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 412 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
413 _GL_ATTRIBUTE_NODISCARD);
328_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size)); 414_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
329# else 415# else
330# if __GNUC__ >= 11 416# if __GNUC__ >= 11 && !defined __clang__
331/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ 417/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
332# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 418# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
333_GL_FUNCDECL_SYS (calloc, void *, 419_GL_FUNCDECL_SYS (calloc, void *,
334 (size_t nmemb, size_t size) 420 (size_t nmemb, size_t size),
335 _GL_ATTRIBUTE_NOTHROW 421 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
336 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 422 _GL_ATTRIBUTE_NODISCARD)
423 _GL_ATTRIBUTE_NOTHROW;
337# else 424# else
338_GL_FUNCDECL_SYS (calloc, void *, 425_GL_FUNCDECL_SYS (calloc, void *,
339 (size_t nmemb, size_t size) 426 (size_t nmemb, size_t size),
340 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 427 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
428 _GL_ATTRIBUTE_NODISCARD);
341# endif 429# endif
342# endif 430# endif
343_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size)); 431_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
@@ -346,16 +434,17 @@ _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
346_GL_CXXALIASWARN (calloc); 434_GL_CXXALIASWARN (calloc);
347# endif 435# endif
348#else 436#else
349# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined calloc 437# if @GNULIB_FREE_POSIX@ \
438 && (__GNUC__ >= 11 && !defined __clang__) && !defined calloc
350/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */ 439/* For -Wmismatched-dealloc: Associate calloc with free or rpl_free. */
351# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 440# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
352_GL_FUNCDECL_SYS (calloc, void *, 441_GL_FUNCDECL_SYS (calloc, void *,
353 (size_t nmemb, size_t size) 442 (size_t nmemb, size_t size),
354 _GL_ATTRIBUTE_NOTHROW 443 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
355 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 444 _GL_ATTRIBUTE_NOTHROW;
356# else 445# else
357_GL_FUNCDECL_SYS (calloc, void *, 446_GL_FUNCDECL_SYS (calloc, void *,
358 (size_t nmemb, size_t size) 447 (size_t nmemb, size_t size),
359 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 448 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
360# endif 449# endif
361# endif 450# endif
@@ -373,23 +462,26 @@ _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
373# define canonicalize_file_name rpl_canonicalize_file_name 462# define canonicalize_file_name rpl_canonicalize_file_name
374# endif 463# endif
375_GL_FUNCDECL_RPL (canonicalize_file_name, char *, 464_GL_FUNCDECL_RPL (canonicalize_file_name, char *,
376 (const char *name) 465 (const char *name),
377 _GL_ARG_NONNULL ((1)) 466 _GL_ARG_NONNULL ((1))
378 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 467 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
468 _GL_ATTRIBUTE_NODISCARD);
379_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name)); 469_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
380# else 470# else
381# if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11 471# if !@HAVE_CANONICALIZE_FILE_NAME@ || (__GNUC__ >= 11 && !defined __clang__)
382# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 472# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
383_GL_FUNCDECL_SYS (canonicalize_file_name, char *, 473_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
384 (const char *name) 474 (const char *name),
385 _GL_ATTRIBUTE_NOTHROW
386 _GL_ARG_NONNULL ((1)) 475 _GL_ARG_NONNULL ((1))
387 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 476 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
477 _GL_ATTRIBUTE_NODISCARD)
478 _GL_ATTRIBUTE_NOTHROW;
388# else 479# else
389_GL_FUNCDECL_SYS (canonicalize_file_name, char *, 480_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
390 (const char *name) 481 (const char *name),
391 _GL_ARG_NONNULL ((1)) 482 _GL_ARG_NONNULL ((1))
392 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 483 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
484 _GL_ATTRIBUTE_NODISCARD);
393# endif 485# endif
394# endif 486# endif
395_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name)); 487_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
@@ -400,18 +492,19 @@ _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
400# endif 492# endif
401_GL_CXXALIASWARN (canonicalize_file_name); 493_GL_CXXALIASWARN (canonicalize_file_name);
402#else 494#else
403# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name 495# if @GNULIB_FREE_POSIX@ \
496 && (__GNUC__ >= 11 && !defined __clang__) && !defined canonicalize_file_name
404/* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or 497/* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or
405 rpl_free. */ 498 rpl_free. */
406# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 499# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
407_GL_FUNCDECL_SYS (canonicalize_file_name, char *, 500_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
408 (const char *name) 501 (const char *name),
409 _GL_ATTRIBUTE_NOTHROW
410 _GL_ARG_NONNULL ((1)) 502 _GL_ARG_NONNULL ((1))
411 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 503 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
504 _GL_ATTRIBUTE_NOTHROW;
412# else 505# else
413_GL_FUNCDECL_SYS (canonicalize_file_name, char *, 506_GL_FUNCDECL_SYS (canonicalize_file_name, char *,
414 (const char *name) 507 (const char *name),
415 _GL_ARG_NONNULL ((1)) 508 _GL_ARG_NONNULL ((1))
416 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 509 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
417# endif 510# endif
@@ -503,12 +596,12 @@ _GL_CXXALIASWARN (gcvt);
503# undef getloadavg 596# undef getloadavg
504# define getloadavg rpl_getloadavg 597# define getloadavg rpl_getloadavg
505# endif 598# endif
506_GL_FUNCDECL_RPL (getloadavg, int, (double loadavg[], int nelem) 599_GL_FUNCDECL_RPL (getloadavg, int, (double loadavg[], int nelem),
507 _GL_ARG_NONNULL ((1))); 600 _GL_ARG_NONNULL ((1)));
508_GL_CXXALIAS_RPL (getloadavg, int, (double loadavg[], int nelem)); 601_GL_CXXALIAS_RPL (getloadavg, int, (double loadavg[], int nelem));
509# else 602# else
510# if !@HAVE_DECL_GETLOADAVG@ 603# if !@HAVE_DECL_GETLOADAVG@
511_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem) 604_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem),
512 _GL_ARG_NONNULL ((1))); 605 _GL_ARG_NONNULL ((1)));
513# endif 606# endif
514_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem)); 607_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
@@ -533,17 +626,17 @@ _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
533# define getprogname rpl_getprogname 626# define getprogname rpl_getprogname
534# endif 627# endif
535# if @HAVE_DECL_PROGRAM_INVOCATION_NAME@ 628# if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
536_GL_FUNCDECL_RPL (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE); 629_GL_FUNCDECL_RPL (getprogname, const char *, (void), _GL_ATTRIBUTE_PURE);
537# else 630# else
538_GL_FUNCDECL_RPL (getprogname, const char *, (void)); 631_GL_FUNCDECL_RPL (getprogname, const char *, (void), );
539# endif 632# endif
540_GL_CXXALIAS_RPL (getprogname, const char *, (void)); 633_GL_CXXALIAS_RPL (getprogname, const char *, (void));
541# else 634# else
542# if !@HAVE_GETPROGNAME@ 635# if !@HAVE_GETPROGNAME@
543# if @HAVE_DECL_PROGRAM_INVOCATION_NAME@ 636# if @HAVE_DECL_PROGRAM_INVOCATION_NAME@
544_GL_FUNCDECL_SYS (getprogname, const char *, (void) _GL_ATTRIBUTE_PURE); 637_GL_FUNCDECL_SYS (getprogname, const char *, (void), _GL_ATTRIBUTE_PURE);
545# else 638# else
546_GL_FUNCDECL_SYS (getprogname, const char *, (void)); 639_GL_FUNCDECL_SYS (getprogname, const char *, (void), );
547# endif 640# endif
548# endif 641# endif
549_GL_CXXALIAS_SYS (getprogname, const char *, (void)); 642_GL_CXXALIAS_SYS (getprogname, const char *, (void));
@@ -577,15 +670,15 @@ _GL_WARN_ON_USE (getprogname, "getprogname is unportable - "
577# define getsubopt rpl_getsubopt 670# define getsubopt rpl_getsubopt
578# endif 671# endif
579_GL_FUNCDECL_RPL (getsubopt, int, 672_GL_FUNCDECL_RPL (getsubopt, int,
580 (char **optionp, char *const *tokens, char **valuep) 673 (char **optionp, char *const *tokens, char **valuep),
581 _GL_ARG_NONNULL ((1, 2, 3))); 674 _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD);
582_GL_CXXALIAS_RPL (getsubopt, int, 675_GL_CXXALIAS_RPL (getsubopt, int,
583 (char **optionp, char *const *tokens, char **valuep)); 676 (char **optionp, char *const *tokens, char **valuep));
584# else 677# else
585# if !@HAVE_GETSUBOPT@ 678# if !@HAVE_GETSUBOPT@
586_GL_FUNCDECL_SYS (getsubopt, int, 679_GL_FUNCDECL_SYS (getsubopt, int,
587 (char **optionp, char *const *tokens, char **valuep) 680 (char **optionp, char *const *tokens, char **valuep),
588 _GL_ARG_NONNULL ((1, 2, 3))); 681 _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD);
589# endif 682# endif
590_GL_CXXALIAS_SYS (getsubopt, int, 683_GL_CXXALIAS_SYS (getsubopt, int,
591 (char **optionp, char *const *tokens, char **valuep)); 684 (char **optionp, char *const *tokens, char **valuep));
@@ -605,7 +698,7 @@ _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
605/* Change the ownership and access permission of the slave side of the 698/* Change the ownership and access permission of the slave side of the
606 pseudo-terminal whose master side is specified by FD. */ 699 pseudo-terminal whose master side is specified by FD. */
607# if !@HAVE_GRANTPT@ 700# if !@HAVE_GRANTPT@
608_GL_FUNCDECL_SYS (grantpt, int, (int fd)); 701_GL_FUNCDECL_SYS (grantpt, int, (int fd), );
609# endif 702# endif
610_GL_CXXALIAS_SYS (grantpt, int, (int fd)); 703_GL_CXXALIAS_SYS (grantpt, int, (int fd));
611_GL_CXXALIASWARN (grantpt); 704_GL_CXXALIASWARN (grantpt);
@@ -622,7 +715,7 @@ _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
622 by never specifying a zero size), so it does not need malloc or 715 by never specifying a zero size), so it does not need malloc or
623 realloc to be redefined. */ 716 realloc to be redefined. */
624#if @GNULIB_MALLOC_POSIX@ 717#if @GNULIB_MALLOC_POSIX@
625# if (@GNULIB_MALLOC_POSIX@ && @REPLACE_MALLOC_FOR_MALLOC_POSIX@) \ 718# if @REPLACE_MALLOC_FOR_MALLOC_POSIX@ \
626 || (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@) 719 || (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@)
627# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ 720# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
628 || _GL_USE_STDLIB_ALLOC) 721 || _GL_USE_STDLIB_ALLOC)
@@ -630,21 +723,24 @@ _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
630# define malloc rpl_malloc 723# define malloc rpl_malloc
631# endif 724# endif
632_GL_FUNCDECL_RPL (malloc, void *, 725_GL_FUNCDECL_RPL (malloc, void *,
633 (size_t size) 726 (size_t size),
634 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 727 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
728 _GL_ATTRIBUTE_NODISCARD);
635_GL_CXXALIAS_RPL (malloc, void *, (size_t size)); 729_GL_CXXALIAS_RPL (malloc, void *, (size_t size));
636# else 730# else
637# if __GNUC__ >= 11 731# if __GNUC__ >= 11 && !defined __clang__
638/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ 732/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
639# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 733# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
640_GL_FUNCDECL_SYS (malloc, void *, 734_GL_FUNCDECL_SYS (malloc, void *,
641 (size_t size) 735 (size_t size),
642 _GL_ATTRIBUTE_NOTHROW 736 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
643 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 737 _GL_ATTRIBUTE_NODISCARD)
738 _GL_ATTRIBUTE_NOTHROW;
644# else 739# else
645_GL_FUNCDECL_SYS (malloc, void *, 740_GL_FUNCDECL_SYS (malloc, void *,
646 (size_t size) 741 (size_t size),
647 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 742 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
743 _GL_ATTRIBUTE_NODISCARD);
648# endif 744# endif
649# endif 745# endif
650_GL_CXXALIAS_SYS (malloc, void *, (size_t size)); 746_GL_CXXALIAS_SYS (malloc, void *, (size_t size));
@@ -653,16 +749,17 @@ _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
653_GL_CXXALIASWARN (malloc); 749_GL_CXXALIASWARN (malloc);
654# endif 750# endif
655#else 751#else
656# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined malloc 752# if @GNULIB_FREE_POSIX@ \
753 && (__GNUC__ >= 11 && !defined __clang__) && !defined malloc
657/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */ 754/* For -Wmismatched-dealloc: Associate malloc with free or rpl_free. */
658# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 755# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
659_GL_FUNCDECL_SYS (malloc, void *, 756_GL_FUNCDECL_SYS (malloc, void *,
660 (size_t size) 757 (size_t size),
661 _GL_ATTRIBUTE_NOTHROW 758 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
662 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 759 _GL_ATTRIBUTE_NOTHROW;
663# else 760# else
664_GL_FUNCDECL_SYS (malloc, void *, 761_GL_FUNCDECL_SYS (malloc, void *,
665 (size_t size) 762 (size_t size),
666 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 763 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
667# endif 764# endif
668# endif 765# endif
@@ -674,14 +771,20 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
674# endif 771# endif
675#endif 772#endif
676 773
677/* Return maximum number of bytes of a multibyte character. */ 774/* Return maximum number of bytes in a multibyte character in the
775 current locale. */
678#if @REPLACE_MB_CUR_MAX@ 776#if @REPLACE_MB_CUR_MAX@
679# if !GNULIB_defined_MB_CUR_MAX 777# if !GNULIB_defined_MB_CUR_MAX
680static inline 778_GL_STDLIB_INLINE size_t
681int gl_MB_CUR_MAX (void) 779gl_MB_CUR_MAX (void)
682{ 780{
781# if 0 < @REPLACE_MB_CUR_MAX@
782 return @REPLACE_MB_CUR_MAX@;
783# else
683 /* Turn the value 3 to the value 4, as needed for the UTF-8 encoding. */ 784 /* Turn the value 3 to the value 4, as needed for the UTF-8 encoding. */
684 return MB_CUR_MAX + (MB_CUR_MAX == 3); 785 int gl_mb_cur_max = MB_CUR_MAX;
786 return gl_mb_cur_max == 3 ? 4 : gl_mb_cur_max;
787# endif
685} 788}
686# undef MB_CUR_MAX 789# undef MB_CUR_MAX
687# define MB_CUR_MAX gl_MB_CUR_MAX () 790# define MB_CUR_MAX gl_MB_CUR_MAX ()
@@ -698,7 +801,7 @@ int gl_MB_CUR_MAX (void)
698# endif 801# endif
699_GL_FUNCDECL_RPL (mbstowcs, size_t, 802_GL_FUNCDECL_RPL (mbstowcs, size_t,
700 (wchar_t *restrict dest, const char *restrict src, 803 (wchar_t *restrict dest, const char *restrict src,
701 size_t len) 804 size_t len),
702 _GL_ARG_NONNULL ((2))); 805 _GL_ARG_NONNULL ((2)));
703_GL_CXXALIAS_RPL (mbstowcs, size_t, 806_GL_CXXALIAS_RPL (mbstowcs, size_t,
704 (wchar_t *restrict dest, const char *restrict src, 807 (wchar_t *restrict dest, const char *restrict src,
@@ -727,13 +830,13 @@ _GL_WARN_ON_USE (mbstowcs, "mbstowcs is unportable - "
727# define mbtowc rpl_mbtowc 830# define mbtowc rpl_mbtowc
728# endif 831# endif
729_GL_FUNCDECL_RPL (mbtowc, int, 832_GL_FUNCDECL_RPL (mbtowc, int,
730 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 833 (wchar_t *restrict pwc, const char *restrict s, size_t n), );
731_GL_CXXALIAS_RPL (mbtowc, int, 834_GL_CXXALIAS_RPL (mbtowc, int,
732 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 835 (wchar_t *restrict pwc, const char *restrict s, size_t n));
733# else 836# else
734# if !@HAVE_MBTOWC@ 837# if !@HAVE_MBTOWC@
735_GL_FUNCDECL_SYS (mbtowc, int, 838_GL_FUNCDECL_SYS (mbtowc, int,
736 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 839 (wchar_t *restrict pwc, const char *restrict s, size_t n), );
737# endif 840# endif
738_GL_CXXALIAS_SYS (mbtowc, int, 841_GL_CXXALIAS_SYS (mbtowc, int,
739 (wchar_t *restrict pwc, const char *restrict s, size_t n)); 842 (wchar_t *restrict pwc, const char *restrict s, size_t n));
@@ -756,7 +859,9 @@ _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - "
756 Returns TEMPLATE, or a null pointer if it cannot get a unique name. 859 Returns TEMPLATE, or a null pointer if it cannot get a unique name.
757 The directory is created mode 700. */ 860 The directory is created mode 700. */
758# if !@HAVE_MKDTEMP@ 861# if !@HAVE_MKDTEMP@
759_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1))); 862_GL_FUNCDECL_SYS (mkdtemp, char *,
863 (char * /*template*/),
864 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
760# endif 865# endif
761_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/)); 866_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
762_GL_CXXALIASWARN (mkdtemp); 867_GL_CXXALIASWARN (mkdtemp);
@@ -786,13 +891,13 @@ _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
786# undef mkostemp 891# undef mkostemp
787# define mkostemp rpl_mkostemp 892# define mkostemp rpl_mkostemp
788# endif 893# endif
789_GL_FUNCDECL_RPL (mkostemp, int, (char * /*template*/, int /*flags*/) 894_GL_FUNCDECL_RPL (mkostemp, int, (char * /*template*/, int /*flags*/),
790 _GL_ARG_NONNULL ((1))); 895 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
791_GL_CXXALIAS_RPL (mkostemp, int, (char * /*template*/, int /*flags*/)); 896_GL_CXXALIAS_RPL (mkostemp, int, (char * /*template*/, int /*flags*/));
792# else 897# else
793# if !@HAVE_MKOSTEMP@ 898# if !@HAVE_MKOSTEMP@
794_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/) 899_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/),
795 _GL_ARG_NONNULL ((1))); 900 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
796# endif 901# endif
797_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)); 902_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
798# endif 903# endif
@@ -827,15 +932,15 @@ _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
827# define mkostemps rpl_mkostemps 932# define mkostemps rpl_mkostemps
828# endif 933# endif
829_GL_FUNCDECL_RPL (mkostemps, int, 934_GL_FUNCDECL_RPL (mkostemps, int,
830 (char * /*template*/, int /*suffixlen*/, int /*flags*/) 935 (char * /*template*/, int /*suffixlen*/, int /*flags*/),
831 _GL_ARG_NONNULL ((1))); 936 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
832_GL_CXXALIAS_RPL (mkostemps, int, 937_GL_CXXALIAS_RPL (mkostemps, int,
833 (char * /*template*/, int /*suffixlen*/, int /*flags*/)); 938 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
834# else 939# else
835# if !@HAVE_MKOSTEMPS@ 940# if !@HAVE_MKOSTEMPS@
836_GL_FUNCDECL_SYS (mkostemps, int, 941_GL_FUNCDECL_SYS (mkostemps, int,
837 (char * /*template*/, int /*suffixlen*/, int /*flags*/) 942 (char * /*template*/, int /*suffixlen*/, int /*flags*/),
838 _GL_ARG_NONNULL ((1))); 943 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
839# endif 944# endif
840_GL_CXXALIAS_SYS (mkostemps, int, 945_GL_CXXALIAS_SYS (mkostemps, int,
841 (char * /*template*/, int /*suffixlen*/, int /*flags*/)); 946 (char * /*template*/, int /*suffixlen*/, int /*flags*/));
@@ -865,11 +970,13 @@ _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
865# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 970# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
866# define mkstemp rpl_mkstemp 971# define mkstemp rpl_mkstemp
867# endif 972# endif
868_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); 973_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/),
974 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
869_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/)); 975_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
870# else 976# else
871# if ! @HAVE_MKSTEMP@ 977# if ! @HAVE_MKSTEMP@
872_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1))); 978_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/),
979 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
873# endif 980# endif
874_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/)); 981_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
875# endif 982# endif
@@ -894,8 +1001,8 @@ _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
894 Returns the open file descriptor if successful, otherwise -1 and errno 1001 Returns the open file descriptor if successful, otherwise -1 and errno
895 set. */ 1002 set. */
896# if !@HAVE_MKSTEMPS@ 1003# if !@HAVE_MKSTEMPS@
897_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/) 1004_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/),
898 _GL_ARG_NONNULL ((1))); 1005 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
899# endif 1006# endif
900_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)); 1007_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
901_GL_CXXALIASWARN (mkstemps); 1008_GL_CXXALIASWARN (mkstemps);
@@ -931,8 +1038,8 @@ _GL_CXXALIASWARN (mktemp);
931# define posix_memalign rpl_posix_memalign 1038# define posix_memalign rpl_posix_memalign
932# endif 1039# endif
933_GL_FUNCDECL_RPL (posix_memalign, int, 1040_GL_FUNCDECL_RPL (posix_memalign, int,
934 (void **memptr, size_t alignment, size_t size) 1041 (void **memptr, size_t alignment, size_t size),
935 _GL_ARG_NONNULL ((1))); 1042 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
936_GL_CXXALIAS_RPL (posix_memalign, int, 1043_GL_CXXALIAS_RPL (posix_memalign, int,
937 (void **memptr, size_t alignment, size_t size)); 1044 (void **memptr, size_t alignment, size_t size));
938# else 1045# else
@@ -960,11 +1067,11 @@ _GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - "
960# undef posix_openpt 1067# undef posix_openpt
961# define posix_openpt rpl_posix_openpt 1068# define posix_openpt rpl_posix_openpt
962# endif 1069# endif
963_GL_FUNCDECL_RPL (posix_openpt, int, (int flags)); 1070_GL_FUNCDECL_RPL (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD);
964_GL_CXXALIAS_RPL (posix_openpt, int, (int flags)); 1071_GL_CXXALIAS_RPL (posix_openpt, int, (int flags));
965# else 1072# else
966# if !@HAVE_POSIX_OPENPT@ 1073# if !@HAVE_POSIX_OPENPT@
967_GL_FUNCDECL_SYS (posix_openpt, int, (int flags)); 1074_GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD);
968# endif 1075# endif
969_GL_CXXALIAS_SYS (posix_openpt, int, (int flags)); 1076_GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
970# endif 1077# endif
@@ -987,11 +1094,11 @@ _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
987# undef ptsname 1094# undef ptsname
988# define ptsname rpl_ptsname 1095# define ptsname rpl_ptsname
989# endif 1096# endif
990_GL_FUNCDECL_RPL (ptsname, char *, (int fd)); 1097_GL_FUNCDECL_RPL (ptsname, char *, (int fd), _GL_ATTRIBUTE_NODISCARD);
991_GL_CXXALIAS_RPL (ptsname, char *, (int fd)); 1098_GL_CXXALIAS_RPL (ptsname, char *, (int fd));
992# else 1099# else
993# if !@HAVE_PTSNAME@ 1100# if !@HAVE_PTSNAME@
994_GL_FUNCDECL_SYS (ptsname, char *, (int fd)); 1101_GL_FUNCDECL_SYS (ptsname, char *, (int fd), _GL_ATTRIBUTE_NODISCARD);
995# endif 1102# endif
996_GL_CXXALIAS_SYS (ptsname, char *, (int fd)); 1103_GL_CXXALIAS_SYS (ptsname, char *, (int fd));
997# endif 1104# endif
@@ -1013,11 +1120,11 @@ _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
1013# undef ptsname_r 1120# undef ptsname_r
1014# define ptsname_r rpl_ptsname_r 1121# define ptsname_r rpl_ptsname_r
1015# endif 1122# endif
1016_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len)); 1123_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)); 1124_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
1018# else 1125# else
1019# if !@HAVE_PTSNAME_R@ 1126# if !@HAVE_PTSNAME_R@
1020_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); 1127_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len), );
1021# endif 1128# endif
1022_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len)); 1129_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
1023# endif 1130# endif
@@ -1039,7 +1146,7 @@ _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
1039# undef putenv 1146# undef putenv
1040# define putenv rpl_putenv 1147# define putenv rpl_putenv
1041# endif 1148# endif
1042_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1))); 1149_GL_FUNCDECL_RPL (putenv, int, (char *string), _GL_ARG_NONNULL ((1)));
1043_GL_CXXALIAS_RPL (putenv, int, (char *string)); 1150_GL_CXXALIAS_RPL (putenv, int, (char *string));
1044# elif defined _WIN32 && !defined __CYGWIN__ 1151# elif defined _WIN32 && !defined __CYGWIN__
1045# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1152# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1098,7 +1205,9 @@ typedef int (*_gl_qsort_r_compar_fn) (void const *, void const *, void *);
1098# endif 1205# endif
1099_GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, 1206_GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
1100 _gl_qsort_r_compar_fn compare, 1207 _gl_qsort_r_compar_fn compare,
1101 void *arg) _GL_ARG_NONNULL ((1, 4))); 1208 void *arg),
1209 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
1210 _GL_ARG_NONNULL ((4)));
1102_GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, 1211_GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
1103 _gl_qsort_r_compar_fn compare, 1212 _gl_qsort_r_compar_fn compare,
1104 void *arg)); 1213 void *arg));
@@ -1106,7 +1215,9 @@ _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
1106# if !@HAVE_QSORT_R@ 1215# if !@HAVE_QSORT_R@
1107_GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, 1216_GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
1108 _gl_qsort_r_compar_fn compare, 1217 _gl_qsort_r_compar_fn compare,
1109 void *arg) _GL_ARG_NONNULL ((1, 4))); 1218 void *arg),
1219 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
1220 _GL_ARG_NONNULL ((4)));
1110# endif 1221# endif
1111_GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, 1222_GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
1112 _gl_qsort_r_compar_fn compare, 1223 _gl_qsort_r_compar_fn compare,
@@ -1137,7 +1248,7 @@ _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
1137# undef rand 1248# undef rand
1138# define rand rpl_rand 1249# define rand rpl_rand
1139# endif 1250# endif
1140_GL_FUNCDECL_RPL (rand, int, (void)); 1251_GL_FUNCDECL_RPL (rand, int, (void), );
1141_GL_CXXALIAS_RPL (rand, int, (void)); 1252_GL_CXXALIAS_RPL (rand, int, (void));
1142# else 1253# else
1143_GL_CXXALIAS_SYS (rand, int, (void)); 1254_GL_CXXALIAS_SYS (rand, int, (void));
@@ -1154,11 +1265,11 @@ _GL_CXXALIASWARN (rand);
1154# undef random 1265# undef random
1155# define random rpl_random 1266# define random rpl_random
1156# endif 1267# endif
1157_GL_FUNCDECL_RPL (random, long, (void)); 1268_GL_FUNCDECL_RPL (random, long, (void), );
1158_GL_CXXALIAS_RPL (random, long, (void)); 1269_GL_CXXALIAS_RPL (random, long, (void));
1159# else 1270# else
1160# if !@HAVE_RANDOM@ 1271# if !@HAVE_RANDOM@
1161_GL_FUNCDECL_SYS (random, long, (void)); 1272_GL_FUNCDECL_SYS (random, long, (void), );
1162# endif 1273# endif
1163/* Need to cast, because on Haiku, the return type is 1274/* Need to cast, because on Haiku, the return type is
1164 int. */ 1275 int. */
@@ -1181,11 +1292,11 @@ _GL_WARN_ON_USE (random, "random is unportable - "
1181# undef srandom 1292# undef srandom
1182# define srandom rpl_srandom 1293# define srandom rpl_srandom
1183# endif 1294# endif
1184_GL_FUNCDECL_RPL (srandom, void, (unsigned int seed)); 1295_GL_FUNCDECL_RPL (srandom, void, (unsigned int seed), );
1185_GL_CXXALIAS_RPL (srandom, void, (unsigned int seed)); 1296_GL_CXXALIAS_RPL (srandom, void, (unsigned int seed));
1186# else 1297# else
1187# if !@HAVE_RANDOM@ 1298# if !@HAVE_RANDOM@
1188_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed)); 1299_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed), );
1189# endif 1300# endif
1190/* Need to cast, because on FreeBSD, the first parameter is 1301/* Need to cast, because on FreeBSD, the first parameter is
1191 unsigned long seed. */ 1302 unsigned long seed. */
@@ -1209,14 +1320,14 @@ _GL_WARN_ON_USE (srandom, "srandom is unportable - "
1209# define initstate rpl_initstate 1320# define initstate rpl_initstate
1210# endif 1321# endif
1211_GL_FUNCDECL_RPL (initstate, char *, 1322_GL_FUNCDECL_RPL (initstate, char *,
1212 (unsigned int seed, char *buf, size_t buf_size) 1323 (unsigned int seed, char *buf, size_t buf_size),
1213 _GL_ARG_NONNULL ((2))); 1324 _GL_ARG_NONNULL ((2)));
1214_GL_CXXALIAS_RPL (initstate, char *, 1325_GL_CXXALIAS_RPL (initstate, char *,
1215 (unsigned int seed, char *buf, size_t buf_size)); 1326 (unsigned int seed, char *buf, size_t buf_size));
1216# else 1327# else
1217# if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@ 1328# if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@
1218_GL_FUNCDECL_SYS (initstate, char *, 1329_GL_FUNCDECL_SYS (initstate, char *,
1219 (unsigned int seed, char *buf, size_t buf_size) 1330 (unsigned int seed, char *buf, size_t buf_size),
1220 _GL_ARG_NONNULL ((2))); 1331 _GL_ARG_NONNULL ((2)));
1221# endif 1332# endif
1222/* Need to cast, because on FreeBSD, the first parameter is 1333/* Need to cast, because on FreeBSD, the first parameter is
@@ -1241,11 +1352,11 @@ _GL_WARN_ON_USE (initstate, "initstate is unportable - "
1241# undef setstate 1352# undef setstate
1242# define setstate rpl_setstate 1353# define setstate rpl_setstate
1243# endif 1354# endif
1244_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); 1355_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state), _GL_ARG_NONNULL ((1)));
1245_GL_CXXALIAS_RPL (setstate, char *, (char *arg_state)); 1356_GL_CXXALIAS_RPL (setstate, char *, (char *arg_state));
1246# else 1357# else
1247# if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@ 1358# if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
1248_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1))); 1359_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state), _GL_ARG_NONNULL ((1)));
1249# endif 1360# endif
1250/* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter 1361/* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter
1251 is const char *arg_state. */ 1362 is const char *arg_state. */
@@ -1269,12 +1380,12 @@ _GL_WARN_ON_USE (setstate, "setstate is unportable - "
1269# undef random_r 1380# undef random_r
1270# define random_r rpl_random_r 1381# define random_r rpl_random_r
1271# endif 1382# endif
1272_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result) 1383_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result),
1273 _GL_ARG_NONNULL ((1, 2))); 1384 _GL_ARG_NONNULL ((1, 2)));
1274_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result)); 1385_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
1275# else 1386# else
1276# if !@HAVE_RANDOM_R@ 1387# if !@HAVE_RANDOM_R@
1277_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) 1388_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result),
1278 _GL_ARG_NONNULL ((1, 2))); 1389 _GL_ARG_NONNULL ((1, 2)));
1279# endif 1390# endif
1280_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); 1391_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
@@ -1295,14 +1406,14 @@ _GL_WARN_ON_USE (random_r, "random_r is unportable - "
1295# define srandom_r rpl_srandom_r 1406# define srandom_r rpl_srandom_r
1296# endif 1407# endif
1297_GL_FUNCDECL_RPL (srandom_r, int, 1408_GL_FUNCDECL_RPL (srandom_r, int,
1298 (unsigned int seed, struct random_data *rand_state) 1409 (unsigned int seed, struct random_data *rand_state),
1299 _GL_ARG_NONNULL ((2))); 1410 _GL_ARG_NONNULL ((2)));
1300_GL_CXXALIAS_RPL (srandom_r, int, 1411_GL_CXXALIAS_RPL (srandom_r, int,
1301 (unsigned int seed, struct random_data *rand_state)); 1412 (unsigned int seed, struct random_data *rand_state));
1302# else 1413# else
1303# if !@HAVE_RANDOM_R@ 1414# if !@HAVE_RANDOM_R@
1304_GL_FUNCDECL_SYS (srandom_r, int, 1415_GL_FUNCDECL_SYS (srandom_r, int,
1305 (unsigned int seed, struct random_data *rand_state) 1416 (unsigned int seed, struct random_data *rand_state),
1306 _GL_ARG_NONNULL ((2))); 1417 _GL_ARG_NONNULL ((2)));
1307# endif 1418# endif
1308_GL_CXXALIAS_SYS (srandom_r, int, 1419_GL_CXXALIAS_SYS (srandom_r, int,
@@ -1325,7 +1436,7 @@ _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
1325# endif 1436# endif
1326_GL_FUNCDECL_RPL (initstate_r, int, 1437_GL_FUNCDECL_RPL (initstate_r, int,
1327 (unsigned int seed, char *buf, size_t buf_size, 1438 (unsigned int seed, char *buf, size_t buf_size,
1328 struct random_data *rand_state) 1439 struct random_data *rand_state),
1329 _GL_ARG_NONNULL ((2, 4))); 1440 _GL_ARG_NONNULL ((2, 4)));
1330_GL_CXXALIAS_RPL (initstate_r, int, 1441_GL_CXXALIAS_RPL (initstate_r, int,
1331 (unsigned int seed, char *buf, size_t buf_size, 1442 (unsigned int seed, char *buf, size_t buf_size,
@@ -1334,7 +1445,7 @@ _GL_CXXALIAS_RPL (initstate_r, int,
1334# if !@HAVE_RANDOM_R@ 1445# if !@HAVE_RANDOM_R@
1335_GL_FUNCDECL_SYS (initstate_r, int, 1446_GL_FUNCDECL_SYS (initstate_r, int,
1336 (unsigned int seed, char *buf, size_t buf_size, 1447 (unsigned int seed, char *buf, size_t buf_size,
1337 struct random_data *rand_state) 1448 struct random_data *rand_state),
1338 _GL_ARG_NONNULL ((2, 4))); 1449 _GL_ARG_NONNULL ((2, 4)));
1339# endif 1450# endif
1340/* Need to cast, because on Haiku, the third parameter is 1451/* Need to cast, because on Haiku, the third parameter is
@@ -1359,14 +1470,14 @@ _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
1359# define setstate_r rpl_setstate_r 1470# define setstate_r rpl_setstate_r
1360# endif 1471# endif
1361_GL_FUNCDECL_RPL (setstate_r, int, 1472_GL_FUNCDECL_RPL (setstate_r, int,
1362 (char *arg_state, struct random_data *rand_state) 1473 (char *arg_state, struct random_data *rand_state),
1363 _GL_ARG_NONNULL ((1, 2))); 1474 _GL_ARG_NONNULL ((1, 2)));
1364_GL_CXXALIAS_RPL (setstate_r, int, 1475_GL_CXXALIAS_RPL (setstate_r, int,
1365 (char *arg_state, struct random_data *rand_state)); 1476 (char *arg_state, struct random_data *rand_state));
1366# else 1477# else
1367# if !@HAVE_RANDOM_R@ 1478# if !@HAVE_RANDOM_R@
1368_GL_FUNCDECL_SYS (setstate_r, int, 1479_GL_FUNCDECL_SYS (setstate_r, int,
1369 (char *arg_state, struct random_data *rand_state) 1480 (char *arg_state, struct random_data *rand_state),
1370 _GL_ARG_NONNULL ((1, 2))); 1481 _GL_ARG_NONNULL ((1, 2)));
1371# endif 1482# endif
1372/* Need to cast, because on Haiku, the first parameter is 1483/* Need to cast, because on Haiku, the first parameter is
@@ -1385,28 +1496,44 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
1385 1496
1386 1497
1387#if @GNULIB_REALLOC_POSIX@ 1498#if @GNULIB_REALLOC_POSIX@
1388# if (@GNULIB_REALLOC_POSIX@ && @REPLACE_REALLOC_FOR_REALLOC_POSIX@) \ 1499# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@
1389 || (@GNULIB_REALLOC_GNU@ && @REPLACE_REALLOC_FOR_REALLOC_GNU@) 1500# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@ == 2
1501# define _GL_INLINE_RPL_REALLOC 1
1502# ifdef __cplusplus
1503extern "C" {
1504# endif
1505_GL_REALLOC_INLINE void *
1506rpl_realloc (void *ptr, size_t size)
1507{
1508 return realloc (ptr, size ? size : 1);
1509}
1510# ifdef __cplusplus
1511}
1512# endif
1513# endif
1390# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \ 1514# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
1391 || _GL_USE_STDLIB_ALLOC) 1515 || _GL_USE_STDLIB_ALLOC)
1392# undef realloc 1516# undef realloc
1393# define realloc rpl_realloc 1517# define realloc rpl_realloc
1394# endif 1518# endif
1395_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size) 1519# if !defined _GL_INLINE_RPL_REALLOC
1396 _GL_ATTRIBUTE_DEALLOC_FREE); 1520_GL_FUNCDECL_RPL (realloc, void *,
1521 (void *ptr, size_t size),
1522 _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD);
1523# endif
1397_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size)); 1524_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
1398# else 1525# else
1399# if __GNUC__ >= 11 1526# if __GNUC__ >= 11 && !defined __clang__
1400/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ 1527/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
1401# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 1528# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
1402_GL_FUNCDECL_SYS (realloc, void *, 1529_GL_FUNCDECL_SYS (realloc, void *,
1403 (void *ptr, size_t size) 1530 (void *ptr, size_t size),
1404 _GL_ATTRIBUTE_NOTHROW 1531 _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD)
1405 _GL_ATTRIBUTE_DEALLOC_FREE); 1532 _GL_ATTRIBUTE_NOTHROW;
1406# else 1533# else
1407_GL_FUNCDECL_SYS (realloc, void *, 1534_GL_FUNCDECL_SYS (realloc, void *,
1408 (void *ptr, size_t size) 1535 (void *ptr, size_t size),
1409 _GL_ATTRIBUTE_DEALLOC_FREE); 1536 _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_NODISCARD);
1410# endif 1537# endif
1411# endif 1538# endif
1412_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size)); 1539_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
@@ -1415,16 +1542,17 @@ _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
1415_GL_CXXALIASWARN (realloc); 1542_GL_CXXALIASWARN (realloc);
1416# endif 1543# endif
1417#else 1544#else
1418# if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc 1545# if @GNULIB_FREE_POSIX@ \
1546 && (__GNUC__ >= 11 && !defined __clang__) && !defined realloc
1419/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */ 1547/* For -Wmismatched-dealloc: Associate realloc with free or rpl_free. */
1420# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2 1548# if __GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2
1421_GL_FUNCDECL_SYS (realloc, void *, 1549_GL_FUNCDECL_SYS (realloc, void *,
1422 (void *ptr, size_t size) 1550 (void *ptr, size_t size),
1423 _GL_ATTRIBUTE_NOTHROW 1551 _GL_ATTRIBUTE_DEALLOC_FREE)
1424 _GL_ATTRIBUTE_DEALLOC_FREE); 1552 _GL_ATTRIBUTE_NOTHROW;
1425# else 1553# else
1426_GL_FUNCDECL_SYS (realloc, void *, 1554_GL_FUNCDECL_SYS (realloc, void *,
1427 (void *ptr, size_t size) 1555 (void *ptr, size_t size),
1428 _GL_ATTRIBUTE_DEALLOC_FREE); 1556 _GL_ATTRIBUTE_DEALLOC_FREE);
1429# endif 1557# endif
1430# endif 1558# endif
@@ -1444,13 +1572,15 @@ _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
1444# define reallocarray rpl_reallocarray 1572# define reallocarray rpl_reallocarray
1445# endif 1573# endif
1446_GL_FUNCDECL_RPL (reallocarray, void *, 1574_GL_FUNCDECL_RPL (reallocarray, void *,
1447 (void *ptr, size_t nmemb, size_t size)); 1575 (void *ptr, size_t nmemb, size_t size),
1576 _GL_ATTRIBUTE_NODISCARD);
1448_GL_CXXALIAS_RPL (reallocarray, void *, 1577_GL_CXXALIAS_RPL (reallocarray, void *,
1449 (void *ptr, size_t nmemb, size_t size)); 1578 (void *ptr, size_t nmemb, size_t size));
1450# else 1579# else
1451# if ! @HAVE_REALLOCARRAY@ 1580# if ! @HAVE_REALLOCARRAY@
1452_GL_FUNCDECL_SYS (reallocarray, void *, 1581_GL_FUNCDECL_SYS (reallocarray, void *,
1453 (void *ptr, size_t nmemb, size_t size)); 1582 (void *ptr, size_t nmemb, size_t size),
1583 _GL_ATTRIBUTE_NODISCARD);
1454# endif 1584# endif
1455_GL_CXXALIAS_SYS (reallocarray, void *, 1585_GL_CXXALIAS_SYS (reallocarray, void *,
1456 (void *ptr, size_t nmemb, size_t size)); 1586 (void *ptr, size_t nmemb, size_t size));
@@ -1472,15 +1602,15 @@ _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - "
1472# define realpath rpl_realpath 1602# define realpath rpl_realpath
1473# endif 1603# endif
1474_GL_FUNCDECL_RPL (realpath, char *, 1604_GL_FUNCDECL_RPL (realpath, char *,
1475 (const char *restrict name, char *restrict resolved) 1605 (const char *restrict name, char *restrict resolved),
1476 _GL_ARG_NONNULL ((1))); 1606 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1477_GL_CXXALIAS_RPL (realpath, char *, 1607_GL_CXXALIAS_RPL (realpath, char *,
1478 (const char *restrict name, char *restrict resolved)); 1608 (const char *restrict name, char *restrict resolved));
1479# else 1609# else
1480# if !@HAVE_REALPATH@ 1610# if !@HAVE_REALPATH@
1481_GL_FUNCDECL_SYS (realpath, char *, 1611_GL_FUNCDECL_SYS (realpath, char *,
1482 (const char *restrict name, char *restrict resolved) 1612 (const char *restrict name, char *restrict resolved),
1483 _GL_ARG_NONNULL ((1))); 1613 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1484# endif 1614# endif
1485_GL_CXXALIAS_SYS (realpath, char *, 1615_GL_CXXALIAS_SYS (realpath, char *,
1486 (const char *restrict name, char *restrict resolved)); 1616 (const char *restrict name, char *restrict resolved));
@@ -1498,7 +1628,8 @@ _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
1498/* Test a user response to a question. 1628/* Test a user response to a question.
1499 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */ 1629 Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
1500# if !@HAVE_RPMATCH@ 1630# if !@HAVE_RPMATCH@
1501_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1))); 1631_GL_FUNCDECL_SYS (rpmatch, int, (const char *response),
1632 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1502# endif 1633# endif
1503_GL_CXXALIAS_SYS (rpmatch, int, (const char *response)); 1634_GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
1504_GL_CXXALIASWARN (rpmatch); 1635_GL_CXXALIASWARN (rpmatch);
@@ -1514,7 +1645,8 @@ _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
1514/* Look up NAME in the environment, returning 0 in insecure situations. */ 1645/* Look up NAME in the environment, returning 0 in insecure situations. */
1515# if !@HAVE_SECURE_GETENV@ 1646# if !@HAVE_SECURE_GETENV@
1516_GL_FUNCDECL_SYS (secure_getenv, char *, 1647_GL_FUNCDECL_SYS (secure_getenv, char *,
1517 (char const *name) _GL_ARG_NONNULL ((1))); 1648 (char const *name),
1649 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1518# endif 1650# endif
1519_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name)); 1651_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
1520_GL_CXXALIASWARN (secure_getenv); 1652_GL_CXXALIASWARN (secure_getenv);
@@ -1535,14 +1667,14 @@ _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
1535# define setenv rpl_setenv 1667# define setenv rpl_setenv
1536# endif 1668# endif
1537_GL_FUNCDECL_RPL (setenv, int, 1669_GL_FUNCDECL_RPL (setenv, int,
1538 (const char *name, const char *value, int replace) 1670 (const char *name, const char *value, int replace),
1539 _GL_ARG_NONNULL ((1))); 1671 _GL_ARG_NONNULL ((1)));
1540_GL_CXXALIAS_RPL (setenv, int, 1672_GL_CXXALIAS_RPL (setenv, int,
1541 (const char *name, const char *value, int replace)); 1673 (const char *name, const char *value, int replace));
1542# else 1674# else
1543# if !@HAVE_DECL_SETENV@ 1675# if !@HAVE_DECL_SETENV@
1544_GL_FUNCDECL_SYS (setenv, int, 1676_GL_FUNCDECL_SYS (setenv, int,
1545 (const char *name, const char *value, int replace) 1677 (const char *name, const char *value, int replace),
1546 _GL_ARG_NONNULL ((1))); 1678 _GL_ARG_NONNULL ((1)));
1547# endif 1679# endif
1548_GL_CXXALIAS_SYS (setenv, int, 1680_GL_CXXALIAS_SYS (setenv, int,
@@ -1559,6 +1691,19 @@ _GL_WARN_ON_USE (setenv, "setenv is unportable - "
1559# endif 1691# endif
1560#endif 1692#endif
1561 1693
1694#if @GNULIB_STACK_TRACE@
1695/* Prints a stack trace of the current thread to standard error,
1696 if possible. */
1697# if @CAN_PRINT_STACK_TRACE@
1698_GL_EXTERN_C void print_stack_trace (void);
1699# else
1700# if !GNULIB_defined_print_stack_trace
1701# define print_stack_trace() /* nothing */
1702# define GNULIB_defined_print_stack_trace 1
1703# endif
1704# endif
1705#endif
1706
1562#if @GNULIB_STRTOD@ 1707#if @GNULIB_STRTOD@
1563 /* Parse a double from STRING, updating ENDP if appropriate. */ 1708 /* Parse a double from STRING, updating ENDP if appropriate. */
1564# if @REPLACE_STRTOD@ 1709# if @REPLACE_STRTOD@
@@ -1567,14 +1712,14 @@ _GL_WARN_ON_USE (setenv, "setenv is unportable - "
1567# endif 1712# endif
1568# define GNULIB_defined_strtod_function 1 1713# define GNULIB_defined_strtod_function 1
1569_GL_FUNCDECL_RPL (strtod, double, 1714_GL_FUNCDECL_RPL (strtod, double,
1570 (const char *restrict str, char **restrict endp) 1715 (const char *restrict str, char **restrict endp),
1571 _GL_ARG_NONNULL ((1))); 1716 _GL_ARG_NONNULL ((1)));
1572_GL_CXXALIAS_RPL (strtod, double, 1717_GL_CXXALIAS_RPL (strtod, double,
1573 (const char *restrict str, char **restrict endp)); 1718 (const char *restrict str, char **restrict endp));
1574# else 1719# else
1575# if !@HAVE_STRTOD@ 1720# if !@HAVE_STRTOD@
1576_GL_FUNCDECL_SYS (strtod, double, 1721_GL_FUNCDECL_SYS (strtod, double,
1577 (const char *restrict str, char **restrict endp) 1722 (const char *restrict str, char **restrict endp),
1578 _GL_ARG_NONNULL ((1))); 1723 _GL_ARG_NONNULL ((1)));
1579# endif 1724# endif
1580_GL_CXXALIAS_SYS (strtod, double, 1725_GL_CXXALIAS_SYS (strtod, double,
@@ -1599,14 +1744,14 @@ _GL_WARN_ON_USE (strtod, "strtod is unportable - "
1599# endif 1744# endif
1600# define GNULIB_defined_strtof_function 1 1745# define GNULIB_defined_strtof_function 1
1601_GL_FUNCDECL_RPL (strtof, float, 1746_GL_FUNCDECL_RPL (strtof, float,
1602 (const char *restrict str, char **restrict endp) 1747 (const char *restrict str, char **restrict endp),
1603 _GL_ARG_NONNULL ((1))); 1748 _GL_ARG_NONNULL ((1)));
1604_GL_CXXALIAS_RPL (strtof, float, 1749_GL_CXXALIAS_RPL (strtof, float,
1605 (const char *restrict str, char **restrict endp)); 1750 (const char *restrict str, char **restrict endp));
1606# else 1751# else
1607# if !@HAVE_STRTOF@ 1752# if !@HAVE_STRTOF@
1608_GL_FUNCDECL_SYS (strtof, float, 1753_GL_FUNCDECL_SYS (strtof, float,
1609 (const char *restrict str, char **restrict endp) 1754 (const char *restrict str, char **restrict endp),
1610 _GL_ARG_NONNULL ((1))); 1755 _GL_ARG_NONNULL ((1)));
1611# endif 1756# endif
1612_GL_CXXALIAS_SYS (strtof, float, 1757_GL_CXXALIAS_SYS (strtof, float,
@@ -1631,14 +1776,14 @@ _GL_WARN_ON_USE (strtof, "strtof is unportable - "
1631# endif 1776# endif
1632# define GNULIB_defined_strtold_function 1 1777# define GNULIB_defined_strtold_function 1
1633_GL_FUNCDECL_RPL (strtold, long double, 1778_GL_FUNCDECL_RPL (strtold, long double,
1634 (const char *restrict str, char **restrict endp) 1779 (const char *restrict str, char **restrict endp),
1635 _GL_ARG_NONNULL ((1))); 1780 _GL_ARG_NONNULL ((1)));
1636_GL_CXXALIAS_RPL (strtold, long double, 1781_GL_CXXALIAS_RPL (strtold, long double,
1637 (const char *restrict str, char **restrict endp)); 1782 (const char *restrict str, char **restrict endp));
1638# else 1783# else
1639# if !@HAVE_STRTOLD@ 1784# if !@HAVE_STRTOLD@
1640_GL_FUNCDECL_SYS (strtold, long double, 1785_GL_FUNCDECL_SYS (strtold, long double,
1641 (const char *restrict str, char **restrict endp) 1786 (const char *restrict str, char **restrict endp),
1642 _GL_ARG_NONNULL ((1))); 1787 _GL_ARG_NONNULL ((1)));
1643# endif 1788# endif
1644_GL_CXXALIAS_SYS (strtold, long double, 1789_GL_CXXALIAS_SYS (strtold, long double,
@@ -1669,7 +1814,7 @@ _GL_WARN_ON_USE (strtold, "strtold is unportable - "
1669# define GNULIB_defined_strtol_function 1 1814# define GNULIB_defined_strtol_function 1
1670_GL_FUNCDECL_RPL (strtol, long, 1815_GL_FUNCDECL_RPL (strtol, long,
1671 (const char *restrict string, char **restrict endptr, 1816 (const char *restrict string, char **restrict endptr,
1672 int base) 1817 int base),
1673 _GL_ARG_NONNULL ((1))); 1818 _GL_ARG_NONNULL ((1)));
1674_GL_CXXALIAS_RPL (strtol, long, 1819_GL_CXXALIAS_RPL (strtol, long,
1675 (const char *restrict string, char **restrict endptr, 1820 (const char *restrict string, char **restrict endptr,
@@ -1678,7 +1823,7 @@ _GL_CXXALIAS_RPL (strtol, long,
1678# if !@HAVE_STRTOL@ 1823# if !@HAVE_STRTOL@
1679_GL_FUNCDECL_SYS (strtol, long, 1824_GL_FUNCDECL_SYS (strtol, long,
1680 (const char *restrict string, char **restrict endptr, 1825 (const char *restrict string, char **restrict endptr,
1681 int base) 1826 int base),
1682 _GL_ARG_NONNULL ((1))); 1827 _GL_ARG_NONNULL ((1)));
1683# endif 1828# endif
1684_GL_CXXALIAS_SYS (strtol, long, 1829_GL_CXXALIAS_SYS (strtol, long,
@@ -1712,7 +1857,7 @@ _GL_WARN_ON_USE (strtol, "strtol is unportable - "
1712# define GNULIB_defined_strtoll_function 1 1857# define GNULIB_defined_strtoll_function 1
1713_GL_FUNCDECL_RPL (strtoll, long long, 1858_GL_FUNCDECL_RPL (strtoll, long long,
1714 (const char *restrict string, char **restrict endptr, 1859 (const char *restrict string, char **restrict endptr,
1715 int base) 1860 int base),
1716 _GL_ARG_NONNULL ((1))); 1861 _GL_ARG_NONNULL ((1)));
1717_GL_CXXALIAS_RPL (strtoll, long long, 1862_GL_CXXALIAS_RPL (strtoll, long long,
1718 (const char *restrict string, char **restrict endptr, 1863 (const char *restrict string, char **restrict endptr,
@@ -1721,7 +1866,7 @@ _GL_CXXALIAS_RPL (strtoll, long long,
1721# if !@HAVE_STRTOLL@ 1866# if !@HAVE_STRTOLL@
1722_GL_FUNCDECL_SYS (strtoll, long long, 1867_GL_FUNCDECL_SYS (strtoll, long long,
1723 (const char *restrict string, char **restrict endptr, 1868 (const char *restrict string, char **restrict endptr,
1724 int base) 1869 int base),
1725 _GL_ARG_NONNULL ((1))); 1870 _GL_ARG_NONNULL ((1)));
1726# endif 1871# endif
1727_GL_CXXALIAS_SYS (strtoll, long long, 1872_GL_CXXALIAS_SYS (strtoll, long long,
@@ -1752,7 +1897,7 @@ _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
1752# define GNULIB_defined_strtoul_function 1 1897# define GNULIB_defined_strtoul_function 1
1753_GL_FUNCDECL_RPL (strtoul, unsigned long, 1898_GL_FUNCDECL_RPL (strtoul, unsigned long,
1754 (const char *restrict string, char **restrict endptr, 1899 (const char *restrict string, char **restrict endptr,
1755 int base) 1900 int base),
1756 _GL_ARG_NONNULL ((1))); 1901 _GL_ARG_NONNULL ((1)));
1757_GL_CXXALIAS_RPL (strtoul, unsigned long, 1902_GL_CXXALIAS_RPL (strtoul, unsigned long,
1758 (const char *restrict string, char **restrict endptr, 1903 (const char *restrict string, char **restrict endptr,
@@ -1761,7 +1906,7 @@ _GL_CXXALIAS_RPL (strtoul, unsigned long,
1761# if !@HAVE_STRTOUL@ 1906# if !@HAVE_STRTOUL@
1762_GL_FUNCDECL_SYS (strtoul, unsigned long, 1907_GL_FUNCDECL_SYS (strtoul, unsigned long,
1763 (const char *restrict string, char **restrict endptr, 1908 (const char *restrict string, char **restrict endptr,
1764 int base) 1909 int base),
1765 _GL_ARG_NONNULL ((1))); 1910 _GL_ARG_NONNULL ((1)));
1766# endif 1911# endif
1767_GL_CXXALIAS_SYS (strtoul, unsigned long, 1912_GL_CXXALIAS_SYS (strtoul, unsigned long,
@@ -1795,7 +1940,7 @@ _GL_WARN_ON_USE (strtoul, "strtoul is unportable - "
1795# define GNULIB_defined_strtoull_function 1 1940# define GNULIB_defined_strtoull_function 1
1796_GL_FUNCDECL_RPL (strtoull, unsigned long long, 1941_GL_FUNCDECL_RPL (strtoull, unsigned long long,
1797 (const char *restrict string, char **restrict endptr, 1942 (const char *restrict string, char **restrict endptr,
1798 int base) 1943 int base),
1799 _GL_ARG_NONNULL ((1))); 1944 _GL_ARG_NONNULL ((1)));
1800_GL_CXXALIAS_RPL (strtoull, unsigned long long, 1945_GL_CXXALIAS_RPL (strtoull, unsigned long long,
1801 (const char *restrict string, char **restrict endptr, 1946 (const char *restrict string, char **restrict endptr,
@@ -1804,7 +1949,7 @@ _GL_CXXALIAS_RPL (strtoull, unsigned long long,
1804# if !@HAVE_STRTOULL@ 1949# if !@HAVE_STRTOULL@
1805_GL_FUNCDECL_SYS (strtoull, unsigned long long, 1950_GL_FUNCDECL_SYS (strtoull, unsigned long long,
1806 (const char *restrict string, char **restrict endptr, 1951 (const char *restrict string, char **restrict endptr,
1807 int base) 1952 int base),
1808 _GL_ARG_NONNULL ((1))); 1953 _GL_ARG_NONNULL ((1)));
1809# endif 1954# endif
1810_GL_CXXALIAS_SYS (strtoull, unsigned long long, 1955_GL_CXXALIAS_SYS (strtoull, unsigned long long,
@@ -1824,7 +1969,7 @@ _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
1824/* Unlock the slave side of the pseudo-terminal whose master side is specified 1969/* Unlock the slave side of the pseudo-terminal whose master side is specified
1825 by FD, so that it can be opened. */ 1970 by FD, so that it can be opened. */
1826# if !@HAVE_UNLOCKPT@ 1971# if !@HAVE_UNLOCKPT@
1827_GL_FUNCDECL_SYS (unlockpt, int, (int fd)); 1972_GL_FUNCDECL_SYS (unlockpt, int, (int fd), );
1828# endif 1973# endif
1829_GL_CXXALIAS_SYS (unlockpt, int, (int fd)); 1974_GL_CXXALIAS_SYS (unlockpt, int, (int fd));
1830_GL_CXXALIASWARN (unlockpt); 1975_GL_CXXALIASWARN (unlockpt);
@@ -1843,11 +1988,11 @@ _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
1843# undef unsetenv 1988# undef unsetenv
1844# define unsetenv rpl_unsetenv 1989# define unsetenv rpl_unsetenv
1845# endif 1990# endif
1846_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); 1991_GL_FUNCDECL_RPL (unsetenv, int, (const char *name), _GL_ARG_NONNULL ((1)));
1847_GL_CXXALIAS_RPL (unsetenv, int, (const char *name)); 1992_GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
1848# else 1993# else
1849# if !@HAVE_DECL_UNSETENV@ 1994# if !@HAVE_DECL_UNSETENV@
1850_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1))); 1995_GL_FUNCDECL_SYS (unsetenv, int, (const char *name), _GL_ARG_NONNULL ((1)));
1851# endif 1996# endif
1852_GL_CXXALIAS_SYS (unsetenv, int, (const char *name)); 1997_GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
1853# endif 1998# endif
@@ -1869,7 +2014,7 @@ _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
1869# undef wctomb 2014# undef wctomb
1870# define wctomb rpl_wctomb 2015# define wctomb rpl_wctomb
1871# endif 2016# endif
1872_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc)); 2017_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc), );
1873_GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc)); 2018_GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
1874# else 2019# else
1875_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc)); 2020_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
@@ -1880,6 +2025,8 @@ _GL_CXXALIASWARN (wctomb);
1880#endif 2025#endif
1881 2026
1882 2027
2028_GL_INLINE_HEADER_END
2029
1883#endif /* _@GUARD_PREFIX@_STDLIB_H */ 2030#endif /* _@GUARD_PREFIX@_STDLIB_H */
1884#endif /* _@GUARD_PREFIX@_STDLIB_H */ 2031#endif /* _@GUARD_PREFIX@_STDLIB_H */
1885#endif 2032#endif
diff --git a/gl/str-two-way.h b/gl/str-two-way.h
index cf85e268..d13fb298 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-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 Written by Eric Blake <ebb9@byu.net>, 2008. 4 Written by Eric Blake <ebb9@byu.net>, 2008.
5 5
diff --git a/gl/strcasecmp.c b/gl/strcasecmp.c
index 7939b404..16626d4d 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-2025 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>
diff --git a/gl/strcasestr.c b/gl/strcasestr.c
index b8c0479d..fd0e2c3e 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-2025 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
diff --git a/gl/streq.h b/gl/streq.h
index 8593de6d..1f1ff38f 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-2025 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
diff --git a/gl/strerror-override.c b/gl/strerror-override.c
index b9c1c7ab..3cc25905 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-2025 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..653ea0ad 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-2025 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..72572ae4 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-2025 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,6 +31,12 @@
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
diff --git a/gl/string.in.h b/gl/string.in.h
index 44ec2e7e..25e6a087 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-2025 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>
@@ -79,7 +84,7 @@
79 that can be freed by passing them as the Ith argument to the 84 that can be freed by passing them as the Ith argument to the
80 function F. */ 85 function F. */
81#ifndef _GL_ATTRIBUTE_DEALLOC 86#ifndef _GL_ATTRIBUTE_DEALLOC
82# if __GNUC__ >= 11 87# if __GNUC__ >= 11 && !defined __clang__
83# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) 88# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
84# else 89# else
85# define _GL_ATTRIBUTE_DEALLOC(f, i) 90# define _GL_ATTRIBUTE_DEALLOC(f, i)
@@ -111,11 +116,23 @@
111# endif 116# endif
112#endif 117#endif
113 118
119/* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP
120 (a pointer) must not be NULL if the argument NI (an integer) is != 0. */
121/* Applies to: functions. */
122#ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO
123# if __GNUC__ >= 15 && !defined __clang__
124# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) \
125 __attribute__ ((__nonnull_if_nonzero__ (np, ni)))
126# else
127# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni)
128# endif
129#endif
130
114/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. 131/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
115 */ 132 */
116#ifndef _GL_ATTRIBUTE_NOTHROW 133#ifndef _GL_ATTRIBUTE_NOTHROW
117# if defined __cplusplus 134# if defined __cplusplus
118# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 135# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
119# if __cplusplus >= 201103L 136# if __cplusplus >= 201103L
120# define _GL_ATTRIBUTE_NOTHROW noexcept (true) 137# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
121# else 138# else
@@ -149,6 +166,7 @@
149 166
150/* The definition of _GL_WARN_ON_USE is copied here. */ 167/* The definition of _GL_WARN_ON_USE is copied here. */
151 168
169
152/* Make _GL_ATTRIBUTE_DEALLOC_FREE work, even though <stdlib.h> may not have 170/* Make _GL_ATTRIBUTE_DEALLOC_FREE work, even though <stdlib.h> may not have
153 been included yet. */ 171 been included yet. */
154#if @GNULIB_FREE_POSIX@ 172#if @GNULIB_FREE_POSIX@
@@ -193,12 +211,97 @@ _GL_EXTERN_C void free (void *);
193# endif 211# endif
194#endif 212#endif
195 213
214
215/* Declarations for ISO C N3322. */
216#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
217# ifndef memcpy
218_GL_EXTERN_C void *memcpy (void *__dest, const void *__src, size_t __n)
219# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
220 _GL_ATTRIBUTE_NOTHROW
221# endif
222 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
223 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
224# endif
225# ifndef memccpy
226_GL_EXTERN_C void *memccpy (void *__dest, const void *__src, int __c, size_t __n)
227# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
228 _GL_ATTRIBUTE_NOTHROW
229# endif
230 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 4)
231 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 4);
232# endif
233# ifndef memmove
234_GL_EXTERN_C void *memmove (void *__dest, const void *__src, size_t __n)
235# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
236 _GL_ATTRIBUTE_NOTHROW
237# endif
238 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
239 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
240# endif
241# ifndef strncpy
242_GL_EXTERN_C char *strncpy (char *__dest, const char *__src, size_t __n)
243# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
244 _GL_ATTRIBUTE_NOTHROW
245# endif
246 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
247 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
248# endif
249# ifndef strndup
250_GL_EXTERN_C char *strndup (const char *__s, size_t __n)
251# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
252 _GL_ATTRIBUTE_NOTHROW
253# endif
254 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2);
255# endif
256# ifndef strncat
257_GL_EXTERN_C char *strncat (char *__dest, const char *__src, size_t __n)
258# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
259 _GL_ATTRIBUTE_NOTHROW
260# endif
261 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
262# endif
263# ifndef memcmp
264_GL_EXTERN_C int memcmp (const void *__s1, const void *__s2, size_t __n)
265# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
266 _GL_ATTRIBUTE_NOTHROW
267# endif
268 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
269 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
270# endif
271# ifndef strncmp
272_GL_EXTERN_C int strncmp (const char *__s1, const char *__s2, size_t __n)
273# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
274 _GL_ATTRIBUTE_NOTHROW
275# endif
276 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
277 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
278# endif
279# if !defined memchr && !defined __cplusplus
280_GL_EXTERN_C void *memchr (const void *__s, int __c, size_t __n)
281 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3);
282_GL_EXTERN_C void *memrchr (const void *__s, int __c, size_t __n)
283 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3);
284# endif
285# ifndef memset
286_GL_EXTERN_C void *memset (void *__s, int __c, size_t __n)
287# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
288 _GL_ATTRIBUTE_NOTHROW
289# endif
290 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3);
291# endif
292# ifndef memset_explicit
293_GL_EXTERN_C void *memset_explicit (void *__s, int __c, size_t __n)
294 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3);
295# endif
296#endif
297
298
196/* Clear a block of memory. The compiler will not delete a call to 299/* 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. */ 300 this function, even if the block is dead after the call. */
198#if @GNULIB_EXPLICIT_BZERO@ 301#if @GNULIB_EXPLICIT_BZERO@
199# if ! @HAVE_EXPLICIT_BZERO@ 302# if ! @HAVE_EXPLICIT_BZERO@
200_GL_FUNCDECL_SYS (explicit_bzero, void, 303_GL_FUNCDECL_SYS (explicit_bzero, void,
201 (void *__dest, size_t __n) _GL_ARG_NONNULL ((1))); 304 (void *__dest, size_t __n), _GL_ARG_NONNULL ((1)));
202# endif 305# endif
203_GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n)); 306_GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n));
204_GL_CXXALIASWARN (explicit_bzero); 307_GL_CXXALIASWARN (explicit_bzero);
@@ -210,10 +313,11 @@ _GL_WARN_ON_USE (explicit_bzero, "explicit_bzero is unportable - "
210# endif 313# endif
211#endif 314#endif
212 315
316
213/* Find the index of the least-significant set bit. */ 317/* Find the index of the least-significant set bit. */
214#if @GNULIB_FFSL@ 318#if @GNULIB_FFSL@
215# if !@HAVE_FFSL@ 319# if !@HAVE_FFSL@
216_GL_FUNCDECL_SYS (ffsl, int, (long int i)); 320_GL_FUNCDECL_SYS (ffsl, int, (long int i), );
217# endif 321# endif
218_GL_CXXALIAS_SYS (ffsl, int, (long int i)); 322_GL_CXXALIAS_SYS (ffsl, int, (long int i));
219_GL_CXXALIASWARN (ffsl); 323_GL_CXXALIASWARN (ffsl);
@@ -231,11 +335,11 @@ _GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module");
231# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 335# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
232# define ffsll rpl_ffsll 336# define ffsll rpl_ffsll
233# endif 337# endif
234_GL_FUNCDECL_RPL (ffsll, int, (long long int i)); 338_GL_FUNCDECL_RPL (ffsll, int, (long long int i), );
235_GL_CXXALIAS_RPL (ffsll, int, (long long int i)); 339_GL_CXXALIAS_RPL (ffsll, int, (long long int i));
236# else 340# else
237# if !@HAVE_FFSLL@ 341# if !@HAVE_FFSLL@
238_GL_FUNCDECL_SYS (ffsll, int, (long long int i)); 342_GL_FUNCDECL_SYS (ffsll, int, (long long int i), );
239# endif 343# endif
240_GL_CXXALIAS_SYS (ffsll, int, (long long int i)); 344_GL_CXXALIAS_SYS (ffsll, int, (long long int i));
241# endif 345# endif
@@ -274,9 +378,9 @@ _GL_CXXALIASWARN (memccpy);
274# undef memchr 378# undef memchr
275# define memchr rpl_memchr 379# define memchr rpl_memchr
276# endif 380# endif
277_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n) 381_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n),
278 _GL_ATTRIBUTE_PURE 382 _GL_ATTRIBUTE_PURE
279 _GL_ARG_NONNULL ((1))); 383 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3));
280_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n)); 384_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
281# else 385# else
282 /* On some systems, this function is defined as an overloaded function: 386 /* On some systems, this function is defined as an overloaded function:
@@ -301,8 +405,10 @@ _GL_CXXALIASWARN (memchr);
301#elif defined GNULIB_POSIXCHECK 405#elif defined GNULIB_POSIXCHECK
302# undef memchr 406# undef memchr
303/* Assume memchr is always declared. */ 407/* Assume memchr is always declared. */
304_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - " 408_GL_WARN_ON_USE_CXX (memchr,
305 "use gnulib module memchr for portability" ); 409 const void *, void *, (void const *, int, size_t),
410 "memchr has platform-specific bugs - "
411 "use gnulib module memchr for portability" );
306#endif 412#endif
307 413
308/* Return the first occurrence of NEEDLE in HAYSTACK. */ 414/* Return the first occurrence of NEEDLE in HAYSTACK. */
@@ -313,7 +419,7 @@ _GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
313# endif 419# endif
314_GL_FUNCDECL_RPL (memmem, void *, 420_GL_FUNCDECL_RPL (memmem, void *,
315 (void const *__haystack, size_t __haystack_len, 421 (void const *__haystack, size_t __haystack_len,
316 void const *__needle, size_t __needle_len) 422 void const *__needle, size_t __needle_len),
317 _GL_ATTRIBUTE_PURE 423 _GL_ATTRIBUTE_PURE
318 _GL_ARG_NONNULL ((1, 3))); 424 _GL_ARG_NONNULL ((1, 3)));
319_GL_CXXALIAS_RPL (memmem, void *, 425_GL_CXXALIAS_RPL (memmem, void *,
@@ -323,7 +429,7 @@ _GL_CXXALIAS_RPL (memmem, void *,
323# if ! @HAVE_DECL_MEMMEM@ 429# if ! @HAVE_DECL_MEMMEM@
324_GL_FUNCDECL_SYS (memmem, void *, 430_GL_FUNCDECL_SYS (memmem, void *,
325 (void const *__haystack, size_t __haystack_len, 431 (void const *__haystack, size_t __haystack_len,
326 void const *__needle, size_t __needle_len) 432 void const *__needle, size_t __needle_len),
327 _GL_ATTRIBUTE_PURE 433 _GL_ATTRIBUTE_PURE
328 _GL_ARG_NONNULL ((1, 3))); 434 _GL_ARG_NONNULL ((1, 3)));
329# endif 435# endif
@@ -351,7 +457,7 @@ _GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
351# endif 457# endif
352_GL_FUNCDECL_RPL (mempcpy, void *, 458_GL_FUNCDECL_RPL (mempcpy, void *,
353 (void *restrict __dest, void const *restrict __src, 459 (void *restrict __dest, void const *restrict __src,
354 size_t __n) 460 size_t __n),
355 _GL_ARG_NONNULL ((1, 2))); 461 _GL_ARG_NONNULL ((1, 2)));
356_GL_CXXALIAS_RPL (mempcpy, void *, 462_GL_CXXALIAS_RPL (mempcpy, void *,
357 (void *restrict __dest, void const *restrict __src, 463 (void *restrict __dest, void const *restrict __src,
@@ -360,7 +466,7 @@ _GL_CXXALIAS_RPL (mempcpy, void *,
360# if !@HAVE_MEMPCPY@ 466# if !@HAVE_MEMPCPY@
361_GL_FUNCDECL_SYS (mempcpy, void *, 467_GL_FUNCDECL_SYS (mempcpy, void *,
362 (void *restrict __dest, void const *restrict __src, 468 (void *restrict __dest, void const *restrict __src,
363 size_t __n) 469 size_t __n),
364 _GL_ARG_NONNULL ((1, 2))); 470 _GL_ARG_NONNULL ((1, 2)));
365# endif 471# endif
366_GL_CXXALIAS_SYS (mempcpy, void *, 472_GL_CXXALIAS_SYS (mempcpy, void *,
@@ -381,9 +487,9 @@ _GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
381/* Search backwards through a block for a byte (specified as an int). */ 487/* Search backwards through a block for a byte (specified as an int). */
382#if @GNULIB_MEMRCHR@ 488#if @GNULIB_MEMRCHR@
383# if ! @HAVE_DECL_MEMRCHR@ 489# if ! @HAVE_DECL_MEMRCHR@
384_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t) 490_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t),
385 _GL_ATTRIBUTE_PURE 491 _GL_ATTRIBUTE_PURE
386 _GL_ARG_NONNULL ((1))); 492 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3));
387# endif 493# endif
388 /* On some systems, this function is defined as an overloaded function: 494 /* On some systems, this function is defined as an overloaded function:
389 extern "C++" { const void * std::memrchr (const void *, int, size_t); } 495 extern "C++" { const void * std::memrchr (const void *, int, size_t); }
@@ -420,16 +526,20 @@ _GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
420# define memset_explicit rpl_memset_explicit 526# define memset_explicit rpl_memset_explicit
421# endif 527# endif
422_GL_FUNCDECL_RPL (memset_explicit, void *, 528_GL_FUNCDECL_RPL (memset_explicit, void *,
423 (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1))); 529 (void *__dest, int __c, size_t __n),
530 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3));
424_GL_CXXALIAS_RPL (memset_explicit, void *, (void *__dest, int __c, size_t __n)); 531_GL_CXXALIAS_RPL (memset_explicit, void *, (void *__dest, int __c, size_t __n));
425# else 532# else
426# if !@HAVE_MEMSET_EXPLICIT@ 533# if !@HAVE_MEMSET_EXPLICIT@
427_GL_FUNCDECL_SYS (memset_explicit, void *, 534_GL_FUNCDECL_SYS (memset_explicit, void *,
428 (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1))); 535 (void *__dest, int __c, size_t __n),
536 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3));
429# endif 537# endif
430_GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n)); 538_GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n));
431# endif 539# endif
540# if __GLIBC__ >= 2
432_GL_CXXALIASWARN (memset_explicit); 541_GL_CXXALIASWARN (memset_explicit);
542# endif
433#elif defined GNULIB_POSIXCHECK 543#elif defined GNULIB_POSIXCHECK
434# undef memset_explicit 544# undef memset_explicit
435# if HAVE_RAW_DECL_MEMSET_EXPLICIT 545# if HAVE_RAW_DECL_MEMSET_EXPLICIT
@@ -443,7 +553,7 @@ _GL_WARN_ON_USE (memset_explicit, "memset_explicit is unportable - "
443 occur within N bytes. */ 553 occur within N bytes. */
444#if @GNULIB_RAWMEMCHR@ 554#if @GNULIB_RAWMEMCHR@
445# if ! @HAVE_RAWMEMCHR@ 555# if ! @HAVE_RAWMEMCHR@
446_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in) 556_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in),
447 _GL_ATTRIBUTE_PURE 557 _GL_ATTRIBUTE_PURE
448 _GL_ARG_NONNULL ((1))); 558 _GL_ARG_NONNULL ((1)));
449# endif 559# endif
@@ -481,14 +591,14 @@ _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
481# define stpcpy rpl_stpcpy 591# define stpcpy rpl_stpcpy
482# endif 592# endif
483_GL_FUNCDECL_RPL (stpcpy, char *, 593_GL_FUNCDECL_RPL (stpcpy, char *,
484 (char *restrict __dst, char const *restrict __src) 594 (char *restrict __dst, char const *restrict __src),
485 _GL_ARG_NONNULL ((1, 2))); 595 _GL_ARG_NONNULL ((1, 2)));
486_GL_CXXALIAS_RPL (stpcpy, char *, 596_GL_CXXALIAS_RPL (stpcpy, char *,
487 (char *restrict __dst, char const *restrict __src)); 597 (char *restrict __dst, char const *restrict __src));
488# else 598# else
489# if !@HAVE_STPCPY@ 599# if !@HAVE_STPCPY@
490_GL_FUNCDECL_SYS (stpcpy, char *, 600_GL_FUNCDECL_SYS (stpcpy, char *,
491 (char *restrict __dst, char const *restrict __src) 601 (char *restrict __dst, char const *restrict __src),
492 _GL_ARG_NONNULL ((1, 2))); 602 _GL_ARG_NONNULL ((1, 2)));
493# endif 603# endif
494_GL_CXXALIAS_SYS (stpcpy, char *, 604_GL_CXXALIAS_SYS (stpcpy, char *,
@@ -515,7 +625,7 @@ _GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
515# endif 625# endif
516_GL_FUNCDECL_RPL (stpncpy, char *, 626_GL_FUNCDECL_RPL (stpncpy, char *,
517 (char *restrict __dst, char const *restrict __src, 627 (char *restrict __dst, char const *restrict __src,
518 size_t __n) 628 size_t __n),
519 _GL_ARG_NONNULL ((1, 2))); 629 _GL_ARG_NONNULL ((1, 2)));
520_GL_CXXALIAS_RPL (stpncpy, char *, 630_GL_CXXALIAS_RPL (stpncpy, char *,
521 (char *restrict __dst, char const *restrict __src, 631 (char *restrict __dst, char const *restrict __src,
@@ -524,7 +634,7 @@ _GL_CXXALIAS_RPL (stpncpy, char *,
524# if ! @HAVE_STPNCPY@ 634# if ! @HAVE_STPNCPY@
525_GL_FUNCDECL_SYS (stpncpy, char *, 635_GL_FUNCDECL_SYS (stpncpy, char *,
526 (char *restrict __dst, char const *restrict __src, 636 (char *restrict __dst, char const *restrict __src,
527 size_t __n) 637 size_t __n),
528 _GL_ARG_NONNULL ((1, 2))); 638 _GL_ARG_NONNULL ((1, 2)));
529# endif 639# endif
530_GL_CXXALIAS_SYS (stpncpy, char *, 640_GL_CXXALIAS_SYS (stpncpy, char *,
@@ -560,14 +670,14 @@ _GL_WARN_ON_USE_CXX (strchr,
560# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 670# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
561# define strchrnul rpl_strchrnul 671# define strchrnul rpl_strchrnul
562# endif 672# endif
563_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in) 673_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in),
564 _GL_ATTRIBUTE_PURE 674 _GL_ATTRIBUTE_PURE
565 _GL_ARG_NONNULL ((1))); 675 _GL_ARG_NONNULL ((1)));
566_GL_CXXALIAS_RPL (strchrnul, char *, 676_GL_CXXALIAS_RPL (strchrnul, char *,
567 (const char *str, int ch)); 677 (const char *str, int ch));
568# else 678# else
569# if ! @HAVE_STRCHRNUL@ 679# if ! @HAVE_STRCHRNUL@
570_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in) 680_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in),
571 _GL_ATTRIBUTE_PURE 681 _GL_ATTRIBUTE_PURE
572 _GL_ARG_NONNULL ((1))); 682 _GL_ARG_NONNULL ((1)));
573# endif 683# endif
@@ -606,7 +716,7 @@ _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
606# define strdup rpl_strdup 716# define strdup rpl_strdup
607# endif 717# endif
608_GL_FUNCDECL_RPL (strdup, char *, 718_GL_FUNCDECL_RPL (strdup, char *,
609 (char const *__s) 719 (char const *__s),
610 _GL_ARG_NONNULL ((1)) 720 _GL_ARG_NONNULL ((1))
611 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 721 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
612_GL_CXXALIAS_RPL (strdup, char *, (char const *__s)); 722_GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
@@ -621,16 +731,17 @@ _GL_CXXALIAS_MDA (strdup, char *, (char const *__s));
621 /* strdup exists as a function and as a macro. Get rid of the macro. */ 731 /* strdup exists as a function and as a macro. Get rid of the macro. */
622# undef strdup 732# undef strdup
623# endif 733# endif
624# if (!@HAVE_DECL_STRDUP@ || __GNUC__ >= 11) && !defined strdup 734# if (!@HAVE_DECL_STRDUP@ || (__GNUC__ >= 11 && !defined __clang__)) \
735 && !defined strdup
625# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 736# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
626_GL_FUNCDECL_SYS (strdup, char *, 737_GL_FUNCDECL_SYS (strdup, char *,
627 (char const *__s) 738 (char const *__s),
628 _GL_ATTRIBUTE_NOTHROW
629 _GL_ARG_NONNULL ((1)) 739 _GL_ARG_NONNULL ((1))
630 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 740 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
741 _GL_ATTRIBUTE_NOTHROW;
631# else 742# else
632_GL_FUNCDECL_SYS (strdup, char *, 743_GL_FUNCDECL_SYS (strdup, char *,
633 (char const *__s) 744 (char const *__s),
634 _GL_ARG_NONNULL ((1)) 745 _GL_ARG_NONNULL ((1))
635 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 746 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
636# endif 747# endif
@@ -639,17 +750,17 @@ _GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
639# endif 750# endif
640_GL_CXXALIASWARN (strdup); 751_GL_CXXALIASWARN (strdup);
641#else 752#else
642# if __GNUC__ >= 11 && !defined strdup 753# if (__GNUC__ >= 11 && !defined __clang__) && !defined strdup
643/* For -Wmismatched-dealloc: Associate strdup with free or rpl_free. */ 754/* For -Wmismatched-dealloc: Associate strdup with free or rpl_free. */
644# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 755# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
645_GL_FUNCDECL_SYS (strdup, char *, 756_GL_FUNCDECL_SYS (strdup, char *,
646 (char const *__s) 757 (char const *__s),
647 _GL_ATTRIBUTE_NOTHROW
648 _GL_ARG_NONNULL ((1)) 758 _GL_ARG_NONNULL ((1))
649 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 759 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
760 _GL_ATTRIBUTE_NOTHROW;
650# else 761# else
651_GL_FUNCDECL_SYS (strdup, char *, 762_GL_FUNCDECL_SYS (strdup, char *,
652 (char const *__s) 763 (char const *__s),
653 _GL_ARG_NONNULL ((1)) 764 _GL_ARG_NONNULL ((1))
654 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 765 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
655# endif 766# endif
@@ -688,8 +799,9 @@ _GL_CXXALIASWARN (strdup);
688# define strncat rpl_strncat 799# define strncat rpl_strncat
689# endif 800# endif
690_GL_FUNCDECL_RPL (strncat, char *, 801_GL_FUNCDECL_RPL (strncat, char *,
691 (char *restrict dest, const char *restrict src, size_t n) 802 (char *restrict dest, const char *restrict src, size_t n),
692 _GL_ARG_NONNULL ((1, 2))); 803 _GL_ARG_NONNULL ((1))
804 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
693_GL_CXXALIAS_RPL (strncat, char *, 805_GL_CXXALIAS_RPL (strncat, char *,
694 (char *restrict dest, const char *restrict src, size_t n)); 806 (char *restrict dest, const char *restrict src, size_t n));
695# else 807# else
@@ -707,6 +819,35 @@ _GL_WARN_ON_USE (strncat, "strncat is unportable - "
707# endif 819# endif
708#endif 820#endif
709 821
822/* Copy no more than N bytes of SRC to DST, returning DST. */
823#if @GNULIB_STRNCPY@
824# if @REPLACE_STRNCPY@
825# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
826# undef strncpy
827# define strncpy rpl_strncpy
828# endif
829_GL_FUNCDECL_RPL (strncpy, char *,
830 (char *restrict __dst, char const *restrict __src,
831 size_t __n),
832 _GL_ARG_NONNULL ((1, 2)));
833_GL_CXXALIAS_RPL (strncpy, char *,
834 (char *restrict __dst, char const *restrict __src,
835 size_t __n));
836# else
837_GL_CXXALIAS_SYS (strncpy, char *,
838 (char *restrict __dst, char const *restrict __src,
839 size_t __n));
840# endif
841# if __GLIBC__ >= 2
842_GL_CXXALIASWARN (strncpy);
843# endif
844#elif defined GNULIB_POSIXCHECK
845# if HAVE_RAW_DECL_STRNCPY
846_GL_WARN_ON_USE (strncpy, "strncpy is unportable - "
847 "use gnulib module strncpy for portability");
848# endif
849#endif
850
710/* Return a newly allocated copy of at most N bytes of STRING. */ 851/* Return a newly allocated copy of at most N bytes of STRING. */
711#if @GNULIB_STRNDUP@ 852#if @GNULIB_STRNDUP@
712# if @REPLACE_STRNDUP@ 853# if @REPLACE_STRNDUP@
@@ -715,22 +856,23 @@ _GL_WARN_ON_USE (strncat, "strncat is unportable - "
715# define strndup rpl_strndup 856# define strndup rpl_strndup
716# endif 857# endif
717_GL_FUNCDECL_RPL (strndup, char *, 858_GL_FUNCDECL_RPL (strndup, char *,
718 (char const *__s, size_t __n) 859 (char const *__s, size_t __n),
719 _GL_ARG_NONNULL ((1)) 860 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
720 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 861 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
721_GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n)); 862_GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n));
722# else 863# else
723# if !@HAVE_DECL_STRNDUP@ || (__GNUC__ >= 11 && !defined strndup) 864# if !@HAVE_DECL_STRNDUP@ \
865 || ((__GNUC__ >= 11 && !defined __clang__) && !defined strndup)
724# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 866# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
725_GL_FUNCDECL_SYS (strndup, char *, 867_GL_FUNCDECL_SYS (strndup, char *,
726 (char const *__s, size_t __n) 868 (char const *__s, size_t __n),
727 _GL_ATTRIBUTE_NOTHROW 869 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
728 _GL_ARG_NONNULL ((1)) 870 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
729 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 871 _GL_ATTRIBUTE_NOTHROW;
730# else 872# else
731_GL_FUNCDECL_SYS (strndup, char *, 873_GL_FUNCDECL_SYS (strndup, char *,
732 (char const *__s, size_t __n) 874 (char const *__s, size_t __n),
733 _GL_ARG_NONNULL ((1)) 875 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
734 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 876 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
735# endif 877# endif
736# endif 878# endif
@@ -738,18 +880,18 @@ _GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n));
738# endif 880# endif
739_GL_CXXALIASWARN (strndup); 881_GL_CXXALIASWARN (strndup);
740#else 882#else
741# if __GNUC__ >= 11 && !defined strndup 883# if (__GNUC__ >= 11 && !defined __clang__) && !defined strndup
742/* For -Wmismatched-dealloc: Associate strndup with free or rpl_free. */ 884/* For -Wmismatched-dealloc: Associate strndup with free or rpl_free. */
743# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 885# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
744_GL_FUNCDECL_SYS (strndup, char *, 886_GL_FUNCDECL_SYS (strndup, char *,
745 (char const *__s, size_t __n) 887 (char const *__s, size_t __n),
746 _GL_ATTRIBUTE_NOTHROW 888 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
747 _GL_ARG_NONNULL ((1)) 889 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
748 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 890 _GL_ATTRIBUTE_NOTHROW;
749# else 891# else
750_GL_FUNCDECL_SYS (strndup, char *, 892_GL_FUNCDECL_SYS (strndup, char *,
751 (char const *__s, size_t __n) 893 (char const *__s, size_t __n),
752 _GL_ARG_NONNULL ((1)) 894 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 2)
753 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 895 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
754# endif 896# endif
755# endif 897# endif
@@ -771,13 +913,13 @@ _GL_WARN_ON_USE (strndup, "strndup is unportable - "
771# undef strnlen 913# undef strnlen
772# define strnlen rpl_strnlen 914# define strnlen rpl_strnlen
773# endif 915# endif
774_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen) 916_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen),
775 _GL_ATTRIBUTE_PURE 917 _GL_ATTRIBUTE_PURE
776 _GL_ARG_NONNULL ((1))); 918 _GL_ARG_NONNULL ((1)));
777_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__s, size_t __maxlen)); 919_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__s, size_t __maxlen));
778# else 920# else
779# if ! @HAVE_DECL_STRNLEN@ 921# if ! @HAVE_DECL_STRNLEN@
780_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen) 922_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen),
781 _GL_ATTRIBUTE_PURE 923 _GL_ATTRIBUTE_PURE
782 _GL_ARG_NONNULL ((1))); 924 _GL_ARG_NONNULL ((1)));
783# endif 925# endif
@@ -807,7 +949,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. */ 949/* Find the first occurrence in S of any character in ACCEPT. */
808#if @GNULIB_STRPBRK@ 950#if @GNULIB_STRPBRK@
809# if ! @HAVE_STRPBRK@ 951# if ! @HAVE_STRPBRK@
810_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept) 952_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept),
811 _GL_ATTRIBUTE_PURE 953 _GL_ATTRIBUTE_PURE
812 _GL_ARG_NONNULL ((1, 2))); 954 _GL_ARG_NONNULL ((1, 2)));
813# endif 955# endif
@@ -892,7 +1034,7 @@ _GL_WARN_ON_USE_CXX (strrchr,
892#if @GNULIB_STRSEP@ 1034#if @GNULIB_STRSEP@
893# if ! @HAVE_STRSEP@ 1035# if ! @HAVE_STRSEP@
894_GL_FUNCDECL_SYS (strsep, char *, 1036_GL_FUNCDECL_SYS (strsep, char *,
895 (char **restrict __stringp, char const *restrict __delim) 1037 (char **restrict __stringp, char const *restrict __delim),
896 _GL_ARG_NONNULL ((1, 2))); 1038 _GL_ARG_NONNULL ((1, 2)));
897# endif 1039# endif
898_GL_CXXALIAS_SYS (strsep, char *, 1040_GL_CXXALIAS_SYS (strsep, char *,
@@ -917,7 +1059,7 @@ _GL_WARN_ON_USE (strsep, "strsep is unportable - "
917# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1059# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
918# define strstr rpl_strstr 1060# define strstr rpl_strstr
919# endif 1061# endif
920_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle) 1062_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle),
921 _GL_ATTRIBUTE_PURE 1063 _GL_ATTRIBUTE_PURE
922 _GL_ARG_NONNULL ((1, 2))); 1064 _GL_ARG_NONNULL ((1, 2)));
923_GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle)); 1065_GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle));
@@ -948,11 +1090,13 @@ _GL_CXXALIASWARN (strstr);
948 as a sequence of bytes, not of characters. */ 1090 as a sequence of bytes, not of characters. */
949# undef strstr 1091# undef strstr
950/* Assume strstr is always declared. */ 1092/* Assume strstr is always declared. */
951_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot " 1093_GL_WARN_ON_USE_CXX (strstr,
952 "work correctly on character strings in most " 1094 const char *, char *, (const char *, const char *),
953 "multibyte locales - " 1095 "strstr is quadratic on many systems, and cannot "
954 "use mbsstr if you care about internationalization, " 1096 "work correctly on character strings in most "
955 "or use strstr if you care about speed"); 1097 "multibyte locales - "
1098 "use mbsstr if you care about internationalization, "
1099 "or use strstr if you care about speed");
956#endif 1100#endif
957 1101
958/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive 1102/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
@@ -963,7 +1107,7 @@ _GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot "
963# define strcasestr rpl_strcasestr 1107# define strcasestr rpl_strcasestr
964# endif 1108# endif
965_GL_FUNCDECL_RPL (strcasestr, char *, 1109_GL_FUNCDECL_RPL (strcasestr, char *,
966 (const char *haystack, const char *needle) 1110 (const char *haystack, const char *needle),
967 _GL_ATTRIBUTE_PURE 1111 _GL_ATTRIBUTE_PURE
968 _GL_ARG_NONNULL ((1, 2))); 1112 _GL_ARG_NONNULL ((1, 2)));
969_GL_CXXALIAS_RPL (strcasestr, char *, 1113_GL_CXXALIAS_RPL (strcasestr, char *,
@@ -971,7 +1115,7 @@ _GL_CXXALIAS_RPL (strcasestr, char *,
971# else 1115# else
972# if ! @HAVE_STRCASESTR@ 1116# if ! @HAVE_STRCASESTR@
973_GL_FUNCDECL_SYS (strcasestr, char *, 1117_GL_FUNCDECL_SYS (strcasestr, char *,
974 (const char *haystack, const char *needle) 1118 (const char *haystack, const char *needle),
975 _GL_ATTRIBUTE_PURE 1119 _GL_ATTRIBUTE_PURE
976 _GL_ARG_NONNULL ((1, 2))); 1120 _GL_ARG_NONNULL ((1, 2)));
977# endif 1121# endif
@@ -1038,7 +1182,7 @@ _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
1038# endif 1182# endif
1039_GL_FUNCDECL_RPL (strtok_r, char *, 1183_GL_FUNCDECL_RPL (strtok_r, char *,
1040 (char *restrict s, char const *restrict delim, 1184 (char *restrict s, char const *restrict delim,
1041 char **restrict save_ptr) 1185 char **restrict save_ptr),
1042 _GL_ARG_NONNULL ((2, 3))); 1186 _GL_ARG_NONNULL ((2, 3)));
1043_GL_CXXALIAS_RPL (strtok_r, char *, 1187_GL_CXXALIAS_RPL (strtok_r, char *,
1044 (char *restrict s, char const *restrict delim, 1188 (char *restrict s, char const *restrict delim,
@@ -1050,7 +1194,7 @@ _GL_CXXALIAS_RPL (strtok_r, char *,
1050# if ! @HAVE_DECL_STRTOK_R@ 1194# if ! @HAVE_DECL_STRTOK_R@
1051_GL_FUNCDECL_SYS (strtok_r, char *, 1195_GL_FUNCDECL_SYS (strtok_r, char *,
1052 (char *restrict s, char const *restrict delim, 1196 (char *restrict s, char const *restrict delim,
1053 char **restrict save_ptr) 1197 char **restrict save_ptr),
1054 _GL_ARG_NONNULL ((2, 3))); 1198 _GL_ARG_NONNULL ((2, 3)));
1055# endif 1199# endif
1056_GL_CXXALIAS_SYS (strtok_r, char *, 1200_GL_CXXALIAS_SYS (strtok_r, char *,
@@ -1075,6 +1219,22 @@ _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
1075/* The following functions are not specified by POSIX. They are gnulib 1219/* The following functions are not specified by POSIX. They are gnulib
1076 extensions. */ 1220 extensions. */
1077 1221
1222#if @GNULIB_STR_STARTSWITH@
1223/* Returns true if STRING starts with PREFIX.
1224 Returns false otherwise. */
1225_GL_EXTERN_C bool str_startswith (const char *string, const char *prefix)
1226 _GL_ATTRIBUTE_PURE
1227 _GL_ARG_NONNULL ((1, 2));
1228#endif
1229
1230#if @GNULIB_STR_ENDSWITH@
1231/* Returns true if STRING ends with SUFFIX.
1232 Returns false otherwise. */
1233_GL_EXTERN_C bool str_endswith (const char *string, const char *prefix)
1234 _GL_ATTRIBUTE_PURE
1235 _GL_ARG_NONNULL ((1, 2));
1236#endif
1237
1078#if @GNULIB_MBSLEN@ 1238#if @GNULIB_MBSLEN@
1079/* Return the number of multibyte characters in the character string STRING. 1239/* Return the number of multibyte characters in the character string STRING.
1080 This considers multibyte characters, unlike strlen, which counts bytes. */ 1240 This considers multibyte characters, unlike strlen, which counts bytes. */
@@ -1085,12 +1245,12 @@ _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
1085# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1245# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1086# define mbslen rpl_mbslen 1246# define mbslen rpl_mbslen
1087# endif 1247# endif
1088_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) 1248_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string),
1089 _GL_ATTRIBUTE_PURE 1249 _GL_ATTRIBUTE_PURE
1090 _GL_ARG_NONNULL ((1))); 1250 _GL_ARG_NONNULL ((1)));
1091_GL_CXXALIAS_RPL (mbslen, size_t, (const char *string)); 1251_GL_CXXALIAS_RPL (mbslen, size_t, (const char *string));
1092# else 1252# else
1093_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) 1253_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string),
1094 _GL_ATTRIBUTE_PURE 1254 _GL_ATTRIBUTE_PURE
1095 _GL_ARG_NONNULL ((1))); 1255 _GL_ARG_NONNULL ((1)));
1096_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string)); 1256_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string));
@@ -1117,12 +1277,12 @@ _GL_EXTERN_C size_t mbsnlen (const char *string, size_t len)
1117# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1277# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1118# define mbschr rpl_mbschr /* avoid collision with HP-UX function */ 1278# define mbschr rpl_mbschr /* avoid collision with HP-UX function */
1119# endif 1279# endif
1120_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c) 1280_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c),
1121 _GL_ATTRIBUTE_PURE 1281 _GL_ATTRIBUTE_PURE
1122 _GL_ARG_NONNULL ((1))); 1282 _GL_ARG_NONNULL ((1)));
1123_GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c)); 1283_GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c));
1124# else 1284# else
1125_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c) 1285_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c),
1126 _GL_ATTRIBUTE_PURE 1286 _GL_ATTRIBUTE_PURE
1127 _GL_ARG_NONNULL ((1))); 1287 _GL_ARG_NONNULL ((1)));
1128_GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c)); 1288_GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c));
@@ -1139,12 +1299,12 @@ _GL_CXXALIASWARN (mbschr);
1139# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1299# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1140# define mbsrchr rpl_mbsrchr /* avoid collision with system function */ 1300# define mbsrchr rpl_mbsrchr /* avoid collision with system function */
1141# endif 1301# endif
1142_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c) 1302_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c),
1143 _GL_ATTRIBUTE_PURE 1303 _GL_ATTRIBUTE_PURE
1144 _GL_ARG_NONNULL ((1))); 1304 _GL_ARG_NONNULL ((1)));
1145_GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c)); 1305_GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c));
1146# else 1306# else
1147_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c) 1307_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c),
1148 _GL_ATTRIBUTE_PURE 1308 _GL_ATTRIBUTE_PURE
1149 _GL_ARG_NONNULL ((1))); 1309 _GL_ARG_NONNULL ((1)));
1150_GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c)); 1310_GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c));
@@ -1160,6 +1320,33 @@ _GL_CXXALIASWARN (mbsrchr);
1160_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle) 1320_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
1161 _GL_ATTRIBUTE_PURE 1321 _GL_ATTRIBUTE_PURE
1162 _GL_ARG_NONNULL ((1, 2)); 1322 _GL_ARG_NONNULL ((1, 2));
1323# ifndef _GL_NO_CONST_GENERICS
1324/* Don't silently convert a 'const char *' to a 'char *'. Programmers want
1325 compiler warnings for 'const' related mistakes. */
1326# ifdef __cplusplus
1327extern "C++" { /* needed for AIX */
1328template <typename T>
1329 T * mbsstr_template (T* haystack, const char *needle);
1330template <>
1331 inline char * mbsstr_template (char *haystack, const char *needle)
1332 { return mbsstr (haystack, needle); }
1333template <>
1334 inline const char * mbsstr_template (const char *haystack, const char *needle)
1335 { return mbsstr (haystack, needle); }
1336}
1337# undef mbsstr
1338# define mbsstr mbsstr_template
1339# elif !defined mbsstr
1340# if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
1341 || defined __ICC || defined __TINYC__ \
1342 || (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__)))
1343# define mbsstr(h,n) \
1344 _Generic ((h), \
1345 char const *: (char const *) mbsstr ((h), (n)), \
1346 default : mbsstr ((h), (n)))
1347# endif
1348# endif
1349# endif
1163#endif 1350#endif
1164 1351
1165#if @GNULIB_MBSCASECMP@ 1352#if @GNULIB_MBSCASECMP@
@@ -1201,6 +1388,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) 1388_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
1202 _GL_ATTRIBUTE_PURE 1389 _GL_ATTRIBUTE_PURE
1203 _GL_ARG_NONNULL ((1, 2)); 1390 _GL_ARG_NONNULL ((1, 2));
1391# ifndef _GL_NO_CONST_GENERICS
1392/* Don't silently convert a 'const char *' to a 'char *'. Programmers want
1393 compiler warnings for 'const' related mistakes. */
1394# ifdef __cplusplus
1395extern "C++" { /* needed for AIX */
1396template <typename T>
1397 T * mbspcasecmp_template (T* string, const char *prefix);
1398template <>
1399 inline char * mbspcasecmp_template (char *string, const char *prefix)
1400 { return mbspcasecmp (string, prefix); }
1401template <>
1402 inline const char * mbspcasecmp_template (const char *string, const char *prefix)
1403 { return mbspcasecmp (string, prefix); }
1404}
1405# undef mbspcasecmp
1406# define mbspcasecmp mbspcasecmp_template
1407# elif !defined mbspcasecmp
1408# if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
1409 || defined __ICC || defined __TINYC__ \
1410 || (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__)))
1411# define mbspcasecmp(s,p) \
1412 _Generic ((s), \
1413 char const *: (char const *) mbspcasecmp ((s), (p)), \
1414 default : mbspcasecmp ((s), (p)))
1415# endif
1416# endif
1417# endif
1204#endif 1418#endif
1205 1419
1206#if @GNULIB_MBSCASESTR@ 1420#if @GNULIB_MBSCASESTR@
@@ -1212,6 +1426,33 @@ _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
1212_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle) 1426_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
1213 _GL_ATTRIBUTE_PURE 1427 _GL_ATTRIBUTE_PURE
1214 _GL_ARG_NONNULL ((1, 2)); 1428 _GL_ARG_NONNULL ((1, 2));
1429# ifndef _GL_NO_CONST_GENERICS
1430/* Don't silently convert a 'const char *' to a 'char *'. Programmers want
1431 compiler warnings for 'const' related mistakes. */
1432# ifdef __cplusplus
1433extern "C++" { /* needed for AIX */
1434template <typename T>
1435 T * mbscasestr_template (T* haystack, const char *needle);
1436template <>
1437 inline char * mbscasestr_template (char *haystack, const char *needle)
1438 { return mbscasestr (haystack, needle); }
1439template <>
1440 inline const char * mbscasestr_template (const char *haystack, const char *needle)
1441 { return mbscasestr (haystack, needle); }
1442}
1443# undef mbscasestr
1444# define mbscasestr mbscasestr_template
1445# elif !defined mbscasestr
1446# if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
1447 || defined __ICC || defined __TINYC__ \
1448 || (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__)))
1449# define mbscasestr(h,n) \
1450 _Generic ((h), \
1451 char const *: (char const *) mbscasestr ((h), (n)), \
1452 default : mbscasestr ((h), (n)))
1453# endif
1454# endif
1455# endif
1215#endif 1456#endif
1216 1457
1217#if @GNULIB_MBSCSPN@ 1458#if @GNULIB_MBSCSPN@
@@ -1234,12 +1475,12 @@ _GL_EXTERN_C size_t mbscspn (const char *string, const char *accept)
1234# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1475# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1235# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */ 1476# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
1236# endif 1477# endif
1237_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept) 1478_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept),
1238 _GL_ATTRIBUTE_PURE 1479 _GL_ATTRIBUTE_PURE
1239 _GL_ARG_NONNULL ((1, 2))); 1480 _GL_ARG_NONNULL ((1, 2)));
1240_GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept)); 1481_GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept));
1241# else 1482# else
1242_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept) 1483_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept),
1243 _GL_ATTRIBUTE_PURE 1484 _GL_ATTRIBUTE_PURE
1244 _GL_ARG_NONNULL ((1, 2))); 1485 _GL_ARG_NONNULL ((1, 2)));
1245_GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept)); 1486_GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept));
@@ -1299,6 +1540,26 @@ _GL_EXTERN_C char * mbstok_r (char *restrict string, const char *delim,
1299 _GL_ARG_NONNULL ((2, 3)); 1540 _GL_ARG_NONNULL ((2, 3));
1300#endif 1541#endif
1301 1542
1543#if @GNULIB_MBS_STARTSWITH@
1544/* Returns true if STRING starts with PREFIX.
1545 Returns false otherwise. */
1546_GL_EXTERN_C bool mbs_startswith (const char *string, const char *prefix)
1547 _GL_ATTRIBUTE_PURE
1548 _GL_ARG_NONNULL ((1, 2));
1549/* No extra code is needed for multibyte locales for this function. */
1550# define mbs_startswith str_startswith
1551#endif
1552
1553#if @GNULIB_MBS_ENDSWITH@
1554/* Returns true if STRING ends with SUFFIX.
1555 Returns false otherwise.
1556 Unlike str_endswith(), this function works correctly in multibyte locales.
1557 */
1558_GL_EXTERN_C bool mbs_endswith (const char *string, const char *suffix)
1559 _GL_ATTRIBUTE_PURE
1560 _GL_ARG_NONNULL ((1, 2));
1561#endif
1562
1302/* Map any int, typically from errno, into an error message. */ 1563/* Map any int, typically from errno, into an error message. */
1303#if @GNULIB_STRERROR@ 1564#if @GNULIB_STRERROR@
1304# if @REPLACE_STRERROR@ 1565# if @REPLACE_STRERROR@
@@ -1306,7 +1567,7 @@ _GL_EXTERN_C char * mbstok_r (char *restrict string, const char *delim,
1306# undef strerror 1567# undef strerror
1307# define strerror rpl_strerror 1568# define strerror rpl_strerror
1308# endif 1569# endif
1309_GL_FUNCDECL_RPL (strerror, char *, (int)); 1570_GL_FUNCDECL_RPL (strerror, char *, (int), );
1310_GL_CXXALIAS_RPL (strerror, char *, (int)); 1571_GL_CXXALIAS_RPL (strerror, char *, (int));
1311# else 1572# else
1312_GL_CXXALIAS_SYS (strerror, char *, (int)); 1573_GL_CXXALIAS_SYS (strerror, char *, (int));
@@ -1329,12 +1590,12 @@ _GL_WARN_ON_USE (strerror, "strerror is unportable - "
1329# undef strerror_r 1590# undef strerror_r
1330# define strerror_r rpl_strerror_r 1591# define strerror_r rpl_strerror_r
1331# endif 1592# endif
1332_GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen) 1593_GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen),
1333 _GL_ARG_NONNULL ((2))); 1594 _GL_ARG_NONNULL ((2)));
1334_GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)); 1595_GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen));
1335# else 1596# else
1336# if !@HAVE_DECL_STRERROR_R@ 1597# if !@HAVE_DECL_STRERROR_R@
1337_GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen) 1598_GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen),
1338 _GL_ARG_NONNULL ((2))); 1599 _GL_ARG_NONNULL ((2)));
1339# endif 1600# endif
1340_GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)); 1601_GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen));
@@ -1350,6 +1611,44 @@ _GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - "
1350# endif 1611# endif
1351#endif 1612#endif
1352 1613
1614/* Map any int, typically from errno, into an error message.
1615 With locale_t argument. */
1616#if @GNULIB_STRERROR_L@
1617# if @REPLACE_STRERROR_L@
1618# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1619# undef strerror_l
1620# define strerror_l rpl_strerror_l
1621# endif
1622_GL_FUNCDECL_RPL (strerror_l, char *, (int errnum, locale_t locale),
1623 _GL_ARG_NONNULL ((2)));
1624_GL_CXXALIAS_RPL (strerror_l, char *, (int errnum, locale_t locale));
1625# else
1626# if !@HAVE_STRERROR_L@
1627_GL_FUNCDECL_SYS (strerror_l, char *, (int errnum, locale_t locale),
1628 _GL_ARG_NONNULL ((2)));
1629# endif
1630_GL_CXXALIAS_SYS (strerror_l, char *, (int errnum, locale_t locale));
1631# endif
1632# if __GLIBC__ >= 2
1633_GL_CXXALIASWARN (strerror_l);
1634# endif
1635#elif defined GNULIB_POSIXCHECK
1636# undef strerror_l
1637# if HAVE_RAW_DECL_STRERROR_L
1638_GL_WARN_ON_USE (strerror_l, "strerror_l is unportable - "
1639 "use gnulib module strerror_l for portability");
1640# endif
1641#endif
1642
1643/* Map any int, typically from errno, into an error message. Multithread-safe,
1644 with locale_t argument.
1645 Not portable! Only provided by gnulib. */
1646#if @GNULIB_STRERROR_L@
1647_GL_FUNCDECL_SYS (strerror_l_r, int,
1648 (int errnum, char *buf, size_t buflen, locale_t locale),
1649 _GL_ARG_NONNULL ((2, 4)));
1650#endif
1651
1353/* Return the name of the system error code ERRNUM. */ 1652/* Return the name of the system error code ERRNUM. */
1354#if @GNULIB_STRERRORNAME_NP@ 1653#if @GNULIB_STRERRORNAME_NP@
1355# if @REPLACE_STRERRORNAME_NP@ 1654# if @REPLACE_STRERRORNAME_NP@
@@ -1357,15 +1656,17 @@ _GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - "
1357# undef strerrorname_np 1656# undef strerrorname_np
1358# define strerrorname_np rpl_strerrorname_np 1657# define strerrorname_np rpl_strerrorname_np
1359# endif 1658# endif
1360_GL_FUNCDECL_RPL (strerrorname_np, const char *, (int errnum)); 1659_GL_FUNCDECL_RPL (strerrorname_np, const char *, (int errnum), );
1361_GL_CXXALIAS_RPL (strerrorname_np, const char *, (int errnum)); 1660_GL_CXXALIAS_RPL (strerrorname_np, const char *, (int errnum));
1362# else 1661# else
1363# if !@HAVE_STRERRORNAME_NP@ 1662# if !@HAVE_STRERRORNAME_NP@
1364_GL_FUNCDECL_SYS (strerrorname_np, const char *, (int errnum)); 1663_GL_FUNCDECL_SYS (strerrorname_np, const char *, (int errnum), );
1365# endif 1664# endif
1366_GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum)); 1665_GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum));
1367# endif 1666# endif
1667# if __GLIBC__ >= 2
1368_GL_CXXALIASWARN (strerrorname_np); 1668_GL_CXXALIASWARN (strerrorname_np);
1669# endif
1369#elif defined GNULIB_POSIXCHECK 1670#elif defined GNULIB_POSIXCHECK
1370# undef strerrorname_np 1671# undef strerrorname_np
1371# if HAVE_RAW_DECL_STRERRORNAME_NP 1672# if HAVE_RAW_DECL_STRERRORNAME_NP
@@ -1377,7 +1678,7 @@ _GL_WARN_ON_USE (strerrorname_np, "strerrorname_np is unportable - "
1377/* Return an abbreviation string for the signal number SIG. */ 1678/* Return an abbreviation string for the signal number SIG. */
1378#if @GNULIB_SIGABBREV_NP@ 1679#if @GNULIB_SIGABBREV_NP@
1379# if ! @HAVE_SIGABBREV_NP@ 1680# if ! @HAVE_SIGABBREV_NP@
1380_GL_FUNCDECL_SYS (sigabbrev_np, const char *, (int sig)); 1681_GL_FUNCDECL_SYS (sigabbrev_np, const char *, (int sig), );
1381# endif 1682# endif
1382_GL_CXXALIAS_SYS (sigabbrev_np, const char *, (int sig)); 1683_GL_CXXALIAS_SYS (sigabbrev_np, const char *, (int sig));
1383_GL_CXXALIASWARN (sigabbrev_np); 1684_GL_CXXALIASWARN (sigabbrev_np);
@@ -1392,7 +1693,7 @@ _GL_WARN_ON_USE (sigabbrev_np, "sigabbrev_np is unportable - "
1392/* Return an English description string for the signal number SIG. */ 1693/* Return an English description string for the signal number SIG. */
1393#if @GNULIB_SIGDESCR_NP@ 1694#if @GNULIB_SIGDESCR_NP@
1394# if ! @HAVE_SIGDESCR_NP@ 1695# if ! @HAVE_SIGDESCR_NP@
1395_GL_FUNCDECL_SYS (sigdescr_np, const char *, (int sig)); 1696_GL_FUNCDECL_SYS (sigdescr_np, const char *, (int sig), );
1396# endif 1697# endif
1397_GL_CXXALIAS_SYS (sigdescr_np, const char *, (int sig)); 1698_GL_CXXALIAS_SYS (sigdescr_np, const char *, (int sig));
1398_GL_CXXALIASWARN (sigdescr_np); 1699_GL_CXXALIASWARN (sigdescr_np);
@@ -1409,11 +1710,11 @@ _GL_WARN_ON_USE (sigdescr_np, "sigdescr_np is unportable - "
1409# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1710# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1410# define strsignal rpl_strsignal 1711# define strsignal rpl_strsignal
1411# endif 1712# endif
1412_GL_FUNCDECL_RPL (strsignal, char *, (int __sig)); 1713_GL_FUNCDECL_RPL (strsignal, char *, (int __sig), );
1413_GL_CXXALIAS_RPL (strsignal, char *, (int __sig)); 1714_GL_CXXALIAS_RPL (strsignal, char *, (int __sig));
1414# else 1715# else
1415# if ! @HAVE_DECL_STRSIGNAL@ 1716# if ! @HAVE_DECL_STRSIGNAL@
1416_GL_FUNCDECL_SYS (strsignal, char *, (int __sig)); 1717_GL_FUNCDECL_SYS (strsignal, char *, (int __sig), );
1417# endif 1718# endif
1418/* Need to cast, because on Cygwin 1.5.x systems, the return type is 1719/* Need to cast, because on Cygwin 1.5.x systems, the return type is
1419 'const char *'. */ 1720 'const char *'. */
@@ -1433,13 +1734,13 @@ _GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
1433# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1734# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1434# define strverscmp rpl_strverscmp 1735# define strverscmp rpl_strverscmp
1435# endif 1736# endif
1436_GL_FUNCDECL_RPL (strverscmp, int, (const char *, const char *) 1737_GL_FUNCDECL_RPL (strverscmp, int, (const char *, const char *),
1437 _GL_ATTRIBUTE_PURE 1738 _GL_ATTRIBUTE_PURE
1438 _GL_ARG_NONNULL ((1, 2))); 1739 _GL_ARG_NONNULL ((1, 2)));
1439_GL_CXXALIAS_RPL (strverscmp, int, (const char *, const char *)); 1740_GL_CXXALIAS_RPL (strverscmp, int, (const char *, const char *));
1440# else 1741# else
1441# if !@HAVE_STRVERSCMP@ 1742# if !@HAVE_STRVERSCMP@
1442_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *) 1743_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *),
1443 _GL_ATTRIBUTE_PURE 1744 _GL_ATTRIBUTE_PURE
1444 _GL_ARG_NONNULL ((1, 2))); 1745 _GL_ARG_NONNULL ((1, 2)));
1445# endif 1746# endif
diff --git a/gl/strings.in.h b/gl/strings.in.h
index 2b3e062a..40c891d7 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-2025 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,10 +68,10 @@ 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);
@@ -72,52 +82,152 @@ _GL_WARN_ON_USE (ffs, "ffs is not portable - use the ffs module");
72# endif 82# endif
73#endif 83#endif
74 84
85#if @GNULIB_STRCASECMP@
75/* Compare strings S1 and S2, ignoring case, returning less than, equal to or 86/* 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 87 greater than zero if S1 is lexicographically less than, equal to or greater
77 than S2. 88 than S2.
78 Note: This function does not work in multibyte locales. */ 89 Note: This function does not work in multibyte locales. */
79#if ! @HAVE_STRCASECMP@ 90# if @REPLACE_STRCASECMP@
80extern int strcasecmp (char const *s1, char const *s2) 91# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
81 _GL_ARG_NONNULL ((1, 2)); 92# undef strcasecmp
82#endif 93# define strcasecmp rpl_strcasecmp
83#if defined GNULIB_POSIXCHECK 94# endif
95_GL_FUNCDECL_RPL (strcasecmp, int, (const char *, const char *),
96 _GL_ARG_NONNULL ((1, 2)));
97_GL_CXXALIAS_RPL (strcasecmp, int, (const char *, const char *));
98# else
99# if !@HAVE_STRCASECMP@
100_GL_FUNCDECL_SYS (strcasecmp, int, (const char *, const char *),
101 _GL_ARG_NONNULL ((1, 2)));
102# endif
103_GL_CXXALIAS_SYS (strcasecmp, int, (const char *, const char *));
104# endif
105# if __GLIBC__ >= 2
106_GL_CXXALIASWARN (strcasecmp);
107# endif
108#elif defined GNULIB_POSIXCHECK
84/* strcasecmp() does not work with multibyte strings: 109/* strcasecmp() does not work with multibyte strings:
85 POSIX says that it operates on "strings", and "string" in POSIX is defined 110 POSIX says that it operates on "strings", and "string" in POSIX is defined
86 as a sequence of bytes, not of characters. */ 111 as a sequence of bytes, not of characters. */
87# undef strcasecmp 112# undef strcasecmp
88# if HAVE_RAW_DECL_STRCASECMP 113# if HAVE_RAW_DECL_STRCASECMP
89_GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character " 114_GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character "
90 "strings in multibyte locales - " 115 "strings in multibyte locales and is unportable - "
91 "use mbscasecmp if you care about " 116 "use mbscasecmp if you care about "
92 "internationalization, or use c_strcasecmp , " 117 "internationalization, or use c_strcasecmp "
93 "gnulib module c-strcase) if you want a locale " 118 "(gnulib module c-strcasecmp) if you want a locale "
94 "independent function"); 119 "independent function");
95# endif 120# endif
96#endif 121#endif
97 122
123#if @GNULIB_STRCASECMP_L@
124# if @REPLACE_STRCASECMP_L@
125# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
126# undef strcasecmp_l
127# define strcasecmp_l rpl_strcasecmp_l
128# endif
129_GL_FUNCDECL_RPL (strcasecmp_l, int,
130 (const char *s1, const char *s2, locale_t locale),
131 _GL_ARG_NONNULL ((1, 2, 3)));
132_GL_CXXALIAS_RPL (strcasecmp_l, int,
133 (const char *s1, const char *s2, locale_t locale));
134# else
135# if !@HAVE_STRCASECMP_L@
136_GL_FUNCDECL_SYS (strcasecmp_l, int,
137 (const char *s1, const char *s2, locale_t locale),
138 _GL_ARG_NONNULL ((1, 2, 3)));
139# endif
140_GL_CXXALIAS_SYS (strcasecmp_l, int,
141 (const char *s1, const char *s2, locale_t locale));
142# endif
143# if __GLIBC__ >= 2
144_GL_CXXALIASWARN (strcasecmp_l);
145# endif
146#elif defined GNULIB_POSIXCHECK
147/* strcasecmp_l() does not work with multibyte strings:
148 POSIX says that it operates on "strings", and "string" in POSIX is defined
149 as a sequence of bytes, not of characters. */
150# undef strcasecmp_l
151# if HAVE_RAW_DECL_STRCASECMP_L
152_GL_WARN_ON_USE (strcasecmp_l, "strcasecmp_l cannot work correctly on "
153 "character strings in multibyte locales and is unportable - "
154 "use gnulib module strcasecmp_l for portability");
155# endif
156#endif
157
158#if @GNULIB_STRNCASECMP@
98/* Compare no more than N bytes of strings S1 and S2, ignoring case, 159/* 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 160 returning less than, equal to or greater than zero if S1 is
100 lexicographically less than, equal to or greater than S2. 161 lexicographically less than, equal to or greater than S2.
101 Note: This function cannot work correctly in multibyte locales. */ 162 Note: This function cannot work correctly in multibyte locales. */
102#if ! @HAVE_DECL_STRNCASECMP@ 163# if @REPLACE_STRNCASECMP@
103extern int strncasecmp (char const *s1, char const *s2, size_t n) 164# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
104 _GL_ARG_NONNULL ((1, 2)); 165# undef strncasecmp
105#endif 166# define strncasecmp rpl_strncasecmp
106#if defined GNULIB_POSIXCHECK 167# endif
168_GL_FUNCDECL_RPL (strncasecmp, int, (const char *, const char *, size_t),
169 _GL_ARG_NONNULL ((1, 2)));
170_GL_CXXALIAS_RPL (strncasecmp, int, (const char *, const char *, size_t));
171# else
172# if !@HAVE_DECL_STRNCASECMP@
173_GL_FUNCDECL_SYS (strncasecmp, int, (const char *, const char *, size_t),
174 _GL_ARG_NONNULL ((1, 2)));
175# endif
176_GL_CXXALIAS_SYS (strncasecmp, int, (const char *, const char *, size_t));
177# endif
178# if __GLIBC__ >= 2
179_GL_CXXALIASWARN (strncasecmp);
180# endif
181#elif defined GNULIB_POSIXCHECK
107/* strncasecmp() does not work with multibyte strings: 182/* strncasecmp() does not work with multibyte strings:
108 POSIX says that it operates on "strings", and "string" in POSIX is defined 183 POSIX says that it operates on "strings", and "string" in POSIX is defined
109 as a sequence of bytes, not of characters. */ 184 as a sequence of bytes, not of characters. */
110# undef strncasecmp 185# undef strncasecmp
111# if HAVE_RAW_DECL_STRNCASECMP 186# if HAVE_RAW_DECL_STRNCASECMP
112_GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character " 187_GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character "
113 "strings in multibyte locales - " 188 "strings in multibyte locales and is unportable - "
114 "use mbsncasecmp or mbspcasecmp if you care about " 189 "use mbsncasecmp or mbspcasecmp if you care about "
115 "internationalization, or use c_strncasecmp , " 190 "internationalization, or use c_strncasecmp "
116 "gnulib module c-strcase) if you want a locale " 191 "(gnulib module c-strncasecmp) if you want a locale "
117 "independent function"); 192 "independent function");
118# endif 193# endif
119#endif 194#endif
120 195
196#if @GNULIB_STRNCASECMP_L@
197# if @REPLACE_STRNCASECMP_L@
198# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
199# undef strncasecmp_l
200# define strncasecmp_l rpl_strncasecmp_l
201# endif
202_GL_FUNCDECL_RPL (strncasecmp_l, int,
203 (const char *s1, const char *s2, size_t n, locale_t locale),
204 _GL_ARG_NONNULL ((1, 2, 4)));
205_GL_CXXALIAS_RPL (strncasecmp_l, int,
206 (const char *s1, const char *s2, size_t n, locale_t locale));
207# else
208# if !@HAVE_STRNCASECMP_L@
209_GL_FUNCDECL_SYS (strncasecmp_l, int,
210 (const char *s1, const char *s2, size_t n, locale_t locale),
211 _GL_ARG_NONNULL ((1, 2, 4)));
212# endif
213_GL_CXXALIAS_SYS (strncasecmp_l, int,
214 (const char *s1, const char *s2, size_t n, locale_t locale));
215# endif
216# if __GLIBC__ >= 2
217_GL_CXXALIASWARN (strncasecmp_l);
218# endif
219#elif defined GNULIB_POSIXCHECK
220/* strncasecmp_l() does not work with multibyte strings:
221 POSIX says that it operates on "strings", and "string" in POSIX is defined
222 as a sequence of bytes, not of characters. */
223# undef strncasecmp_l
224# if HAVE_RAW_DECL_STRNCASECMP_L
225_GL_WARN_ON_USE (strncasecmp_l, "strncasecmp_l cannot work correctly on "
226 "character strings in multibyte locales and is unportable - "
227 "use gnulib module strncasecmp_l for portability");
228# endif
229#endif
230
121 231
122#ifdef __cplusplus 232#ifdef __cplusplus
123} 233}
diff --git a/gl/stripslash.c b/gl/stripslash.c
index c127ce7e..d5b07bca 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-2025 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/strncasecmp.c b/gl/strncasecmp.c
index c79161f3..7d7c5b7f 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-2025 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>
diff --git a/gl/strncpy.c b/gl/strncpy.c
new file mode 100644
index 00000000..1b680046
--- /dev/null
+++ b/gl/strncpy.c
@@ -0,0 +1,38 @@
1/* Copy a size-bounded string.
2 Copyright (C) 1999, 2011-2025 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 3 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..5a489d11 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-2025 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
diff --git a/gl/strstr.c b/gl/strstr.c
index 7ea28603..d6953f90 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-2025 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
diff --git a/gl/sys-limits.h b/gl/sys-limits.h
index d2f29d80..a556dfeb 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-2025 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/sys_socket.c b/gl/sys_socket.c
index 672d3aac..efd36610 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-2025 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..8632c66d 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-2025 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
@@ -289,15 +292,17 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
289# undef socket 292# undef socket
290# define socket rpl_socket 293# define socket rpl_socket
291# endif 294# endif
292_GL_FUNCDECL_RPL (socket, int, (int domain, int type, int protocol)); 295_GL_FUNCDECL_RPL (socket, int, (int domain, int type, int protocol), );
293_GL_CXXALIAS_RPL (socket, int, (int domain, int type, int protocol)); 296_GL_CXXALIAS_RPL (socket, int, (int domain, int type, int protocol));
294# else 297# else
295_GL_CXXALIAS_SYS (socket, int, (int domain, int type, int protocol)); 298_GL_CXXALIAS_SYS (socket, int, (int domain, int type, int protocol));
296# endif 299# endif
297_GL_CXXALIASWARN (socket); 300_GL_CXXALIASWARN (socket);
298#elif @HAVE_WINSOCK2_H@ 301#elif @HAVE_WINSOCK2_H@
299# undef socket 302# if !GNULIB_SOCKET
300# define socket socket_used_without_requesting_gnulib_module_socket 303# undef socket
304# define socket socket_used_without_requesting_gnulib_module_socket
305# endif
301#elif defined GNULIB_POSIXCHECK 306#elif defined GNULIB_POSIXCHECK
302# undef socket 307# undef socket
303# if HAVE_RAW_DECL_SOCKET 308# if HAVE_RAW_DECL_SOCKET
@@ -313,7 +318,7 @@ _GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - "
313# define connect rpl_connect 318# define connect rpl_connect
314# endif 319# endif
315_GL_FUNCDECL_RPL (connect, int, 320_GL_FUNCDECL_RPL (connect, int,
316 (int fd, const struct sockaddr *addr, socklen_t addrlen) 321 (int fd, const struct sockaddr *addr, socklen_t addrlen),
317 _GL_ARG_NONNULL ((2))); 322 _GL_ARG_NONNULL ((2)));
318_GL_CXXALIAS_RPL (connect, int, 323_GL_CXXALIAS_RPL (connect, int,
319 (int fd, const struct sockaddr *addr, socklen_t addrlen)); 324 (int fd, const struct sockaddr *addr, socklen_t addrlen));
@@ -326,8 +331,10 @@ _GL_CXXALIAS_SYS_CAST (connect, int,
326# endif 331# endif
327_GL_CXXALIASWARN (connect); 332_GL_CXXALIASWARN (connect);
328#elif @HAVE_WINSOCK2_H@ 333#elif @HAVE_WINSOCK2_H@
329# undef connect 334# if !GNULIB_CONNECT
330# define connect socket_used_without_requesting_gnulib_module_connect 335# undef connect
336# define connect connect_used_without_requesting_gnulib_module_connect
337# endif
331#elif defined GNULIB_POSIXCHECK 338#elif defined GNULIB_POSIXCHECK
332# undef connect 339# undef connect
333# if HAVE_RAW_DECL_CONNECT 340# if HAVE_RAW_DECL_CONNECT
@@ -345,7 +352,7 @@ _GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - "
345_GL_FUNCDECL_RPL (accept, int, 352_GL_FUNCDECL_RPL (accept, int,
346 (int fd, 353 (int fd,
347 struct sockaddr *restrict addr, 354 struct sockaddr *restrict addr,
348 socklen_t *restrict addrlen)); 355 socklen_t *restrict addrlen), );
349_GL_CXXALIAS_RPL (accept, int, 356_GL_CXXALIAS_RPL (accept, int,
350 (int fd, 357 (int fd,
351 struct sockaddr *restrict addr, 358 struct sockaddr *restrict addr,
@@ -362,8 +369,10 @@ _GL_CXXALIAS_SYS_CAST (accept, int,
362_GL_CXXALIASWARN (accept); 369_GL_CXXALIASWARN (accept);
363# endif 370# endif
364#elif @HAVE_WINSOCK2_H@ 371#elif @HAVE_WINSOCK2_H@
365# undef accept 372# if !GNULIB_ACCEPT
366# define accept accept_used_without_requesting_gnulib_module_accept 373# undef accept
374# define accept accept_used_without_requesting_gnulib_module_accept
375# endif
367#elif defined GNULIB_POSIXCHECK 376#elif defined GNULIB_POSIXCHECK
368# undef accept 377# undef accept
369# if HAVE_RAW_DECL_ACCEPT 378# if HAVE_RAW_DECL_ACCEPT
@@ -379,7 +388,7 @@ _GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - "
379# define bind rpl_bind 388# define bind rpl_bind
380# endif 389# endif
381_GL_FUNCDECL_RPL (bind, int, 390_GL_FUNCDECL_RPL (bind, int,
382 (int fd, const struct sockaddr *addr, socklen_t addrlen) 391 (int fd, const struct sockaddr *addr, socklen_t addrlen),
383 _GL_ARG_NONNULL ((2))); 392 _GL_ARG_NONNULL ((2)));
384_GL_CXXALIAS_RPL (bind, int, 393_GL_CXXALIAS_RPL (bind, int,
385 (int fd, const struct sockaddr *addr, socklen_t addrlen)); 394 (int fd, const struct sockaddr *addr, socklen_t addrlen));
@@ -392,8 +401,10 @@ _GL_CXXALIAS_SYS_CAST (bind, int,
392# endif 401# endif
393_GL_CXXALIASWARN (bind); 402_GL_CXXALIASWARN (bind);
394#elif @HAVE_WINSOCK2_H@ 403#elif @HAVE_WINSOCK2_H@
395# undef bind 404# if !GNULIB_BIND
396# define bind bind_used_without_requesting_gnulib_module_bind 405# undef bind
406# define bind bind_used_without_requesting_gnulib_module_bind
407# endif
397#elif defined GNULIB_POSIXCHECK 408#elif defined GNULIB_POSIXCHECK
398# undef bind 409# undef bind
399# if HAVE_RAW_DECL_BIND 410# if HAVE_RAW_DECL_BIND
@@ -410,7 +421,7 @@ _GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - "
410# endif 421# endif
411_GL_FUNCDECL_RPL (getpeername, int, 422_GL_FUNCDECL_RPL (getpeername, int,
412 (int fd, struct sockaddr *restrict addr, 423 (int fd, struct sockaddr *restrict addr,
413 socklen_t *restrict addrlen) 424 socklen_t *restrict addrlen),
414 _GL_ARG_NONNULL ((2, 3))); 425 _GL_ARG_NONNULL ((2, 3)));
415_GL_CXXALIAS_RPL (getpeername, int, 426_GL_CXXALIAS_RPL (getpeername, int,
416 (int fd, struct sockaddr *restrict addr, 427 (int fd, struct sockaddr *restrict addr,
@@ -426,8 +437,10 @@ _GL_CXXALIAS_SYS_CAST (getpeername, int,
426_GL_CXXALIASWARN (getpeername); 437_GL_CXXALIASWARN (getpeername);
427# endif 438# endif
428#elif @HAVE_WINSOCK2_H@ 439#elif @HAVE_WINSOCK2_H@
429# undef getpeername 440# if !GNULIB_GETPEERNAME
430# define getpeername getpeername_used_without_requesting_gnulib_module_getpeername 441# undef getpeername
442# define getpeername getpeername_used_without_requesting_gnulib_module_getpeername
443# endif
431#elif defined GNULIB_POSIXCHECK 444#elif defined GNULIB_POSIXCHECK
432# undef getpeername 445# undef getpeername
433# if HAVE_RAW_DECL_GETPEERNAME 446# if HAVE_RAW_DECL_GETPEERNAME
@@ -444,7 +457,7 @@ _GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - "
444# endif 457# endif
445_GL_FUNCDECL_RPL (getsockname, int, 458_GL_FUNCDECL_RPL (getsockname, int,
446 (int fd, struct sockaddr *restrict addr, 459 (int fd, struct sockaddr *restrict addr,
447 socklen_t *restrict addrlen) 460 socklen_t *restrict addrlen),
448 _GL_ARG_NONNULL ((2, 3))); 461 _GL_ARG_NONNULL ((2, 3)));
449_GL_CXXALIAS_RPL (getsockname, int, 462_GL_CXXALIAS_RPL (getsockname, int,
450 (int fd, struct sockaddr *restrict addr, 463 (int fd, struct sockaddr *restrict addr,
@@ -460,8 +473,10 @@ _GL_CXXALIAS_SYS_CAST (getsockname, int,
460_GL_CXXALIASWARN (getsockname); 473_GL_CXXALIASWARN (getsockname);
461# endif 474# endif
462#elif @HAVE_WINSOCK2_H@ 475#elif @HAVE_WINSOCK2_H@
463# undef getsockname 476# if !GNULIB_GETSOCKNAME
464# define getsockname getsockname_used_without_requesting_gnulib_module_getsockname 477# undef getsockname
478# define getsockname getsockname_used_without_requesting_gnulib_module_getsockname
479# endif
465#elif defined GNULIB_POSIXCHECK 480#elif defined GNULIB_POSIXCHECK
466# undef getsockname 481# undef getsockname
467# if HAVE_RAW_DECL_GETSOCKNAME 482# if HAVE_RAW_DECL_GETSOCKNAME
@@ -478,7 +493,7 @@ _GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - "
478# endif 493# endif
479_GL_FUNCDECL_RPL (getsockopt, int, 494_GL_FUNCDECL_RPL (getsockopt, int,
480 (int fd, int level, int optname, 495 (int fd, int level, int optname,
481 void *restrict optval, socklen_t *restrict optlen) 496 void *restrict optval, socklen_t *restrict optlen),
482 _GL_ARG_NONNULL ((4, 5))); 497 _GL_ARG_NONNULL ((4, 5)));
483_GL_CXXALIAS_RPL (getsockopt, int, 498_GL_CXXALIAS_RPL (getsockopt, int,
484 (int fd, int level, int optname, 499 (int fd, int level, int optname,
@@ -492,8 +507,10 @@ _GL_CXXALIAS_SYS_CAST (getsockopt, int,
492# endif 507# endif
493_GL_CXXALIASWARN (getsockopt); 508_GL_CXXALIASWARN (getsockopt);
494#elif @HAVE_WINSOCK2_H@ 509#elif @HAVE_WINSOCK2_H@
495# undef getsockopt 510# if !GNULIB_GETSOCKOPT
496# define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt 511# undef getsockopt
512# define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
513# endif
497#elif defined GNULIB_POSIXCHECK 514#elif defined GNULIB_POSIXCHECK
498# undef getsockopt 515# undef getsockopt
499# if HAVE_RAW_DECL_GETSOCKOPT 516# if HAVE_RAW_DECL_GETSOCKOPT
@@ -508,15 +525,17 @@ _GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - "
508# undef listen 525# undef listen
509# define listen rpl_listen 526# define listen rpl_listen
510# endif 527# endif
511_GL_FUNCDECL_RPL (listen, int, (int fd, int backlog)); 528_GL_FUNCDECL_RPL (listen, int, (int fd, int backlog), );
512_GL_CXXALIAS_RPL (listen, int, (int fd, int backlog)); 529_GL_CXXALIAS_RPL (listen, int, (int fd, int backlog));
513# else 530# else
514_GL_CXXALIAS_SYS (listen, int, (int fd, int backlog)); 531_GL_CXXALIAS_SYS (listen, int, (int fd, int backlog));
515# endif 532# endif
516_GL_CXXALIASWARN (listen); 533_GL_CXXALIASWARN (listen);
517#elif @HAVE_WINSOCK2_H@ 534#elif @HAVE_WINSOCK2_H@
518# undef listen 535# if !GNULIB_LISTEN
519# define listen listen_used_without_requesting_gnulib_module_listen 536# undef listen
537# define listen listen_used_without_requesting_gnulib_module_listen
538# endif
520#elif defined GNULIB_POSIXCHECK 539#elif defined GNULIB_POSIXCHECK
521# undef listen 540# undef listen
522# if HAVE_RAW_DECL_LISTEN 541# if HAVE_RAW_DECL_LISTEN
@@ -531,7 +550,7 @@ _GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - "
531# undef recv 550# undef recv
532# define recv rpl_recv 551# define recv rpl_recv
533# endif 552# endif
534_GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags) 553_GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags),
535 _GL_ARG_NONNULL ((2))); 554 _GL_ARG_NONNULL ((2)));
536_GL_CXXALIAS_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags)); 555_GL_CXXALIAS_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
537# else 556# else
@@ -542,8 +561,10 @@ _GL_CXXALIAS_SYS_CAST (recv, ssize_t, (int fd, void *buf, size_t len, int flags)
542# endif 561# endif
543_GL_CXXALIASWARN (recv); 562_GL_CXXALIASWARN (recv);
544#elif @HAVE_WINSOCK2_H@ 563#elif @HAVE_WINSOCK2_H@
545# undef recv 564# if !GNULIB_RECV
546# define recv recv_used_without_requesting_gnulib_module_recv 565# undef recv
566# define recv recv_used_without_requesting_gnulib_module_recv
567# endif
547#elif defined GNULIB_POSIXCHECK 568#elif defined GNULIB_POSIXCHECK
548# undef recv 569# undef recv
549# if HAVE_RAW_DECL_RECV 570# if HAVE_RAW_DECL_RECV
@@ -559,7 +580,7 @@ _GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - "
559# define send rpl_send 580# define send rpl_send
560# endif 581# endif
561_GL_FUNCDECL_RPL (send, ssize_t, 582_GL_FUNCDECL_RPL (send, ssize_t,
562 (int fd, const void *buf, size_t len, int flags) 583 (int fd, const void *buf, size_t len, int flags),
563 _GL_ARG_NONNULL ((2))); 584 _GL_ARG_NONNULL ((2)));
564_GL_CXXALIAS_RPL (send, ssize_t, 585_GL_CXXALIAS_RPL (send, ssize_t,
565 (int fd, const void *buf, size_t len, int flags)); 586 (int fd, const void *buf, size_t len, int flags));
@@ -572,8 +593,10 @@ _GL_CXXALIAS_SYS_CAST (send, ssize_t,
572# endif 593# endif
573_GL_CXXALIASWARN (send); 594_GL_CXXALIASWARN (send);
574#elif @HAVE_WINSOCK2_H@ 595#elif @HAVE_WINSOCK2_H@
575# undef send 596# if !GNULIB_SEND
576# define send send_used_without_requesting_gnulib_module_send 597# undef send
598# define send send_used_without_requesting_gnulib_module_send
599# endif
577#elif defined GNULIB_POSIXCHECK 600#elif defined GNULIB_POSIXCHECK
578# undef send 601# undef send
579# if HAVE_RAW_DECL_SEND 602# if HAVE_RAW_DECL_SEND
@@ -591,7 +614,7 @@ _GL_WARN_ON_USE (send, "send is not always POSIX compliant - "
591_GL_FUNCDECL_RPL (recvfrom, ssize_t, 614_GL_FUNCDECL_RPL (recvfrom, ssize_t,
592 (int fd, void *restrict buf, size_t len, int flags, 615 (int fd, void *restrict buf, size_t len, int flags,
593 struct sockaddr *restrict from, 616 struct sockaddr *restrict from,
594 socklen_t *restrict fromlen) 617 socklen_t *restrict fromlen),
595 _GL_ARG_NONNULL ((2))); 618 _GL_ARG_NONNULL ((2)));
596_GL_CXXALIAS_RPL (recvfrom, ssize_t, 619_GL_CXXALIAS_RPL (recvfrom, ssize_t,
597 (int fd, void *restrict buf, size_t len, int flags, 620 (int fd, void *restrict buf, size_t len, int flags,
@@ -609,8 +632,10 @@ _GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t,
609_GL_CXXALIASWARN (recvfrom); 632_GL_CXXALIASWARN (recvfrom);
610# endif 633# endif
611#elif @HAVE_WINSOCK2_H@ 634#elif @HAVE_WINSOCK2_H@
612# undef recvfrom 635# if !GNULIB_RECVFROM
613# define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom 636# undef recvfrom
637# define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
638# endif
614#elif defined GNULIB_POSIXCHECK 639#elif defined GNULIB_POSIXCHECK
615# undef recvfrom 640# undef recvfrom
616# if HAVE_RAW_DECL_RECVFROM 641# if HAVE_RAW_DECL_RECVFROM
@@ -627,7 +652,7 @@ _GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - "
627# endif 652# endif
628_GL_FUNCDECL_RPL (sendto, ssize_t, 653_GL_FUNCDECL_RPL (sendto, ssize_t,
629 (int fd, const void *buf, size_t len, int flags, 654 (int fd, const void *buf, size_t len, int flags,
630 const struct sockaddr *to, socklen_t tolen) 655 const struct sockaddr *to, socklen_t tolen),
631 _GL_ARG_NONNULL ((2))); 656 _GL_ARG_NONNULL ((2)));
632_GL_CXXALIAS_RPL (sendto, ssize_t, 657_GL_CXXALIAS_RPL (sendto, ssize_t,
633 (int fd, const void *buf, size_t len, int flags, 658 (int fd, const void *buf, size_t len, int flags,
@@ -641,8 +666,10 @@ _GL_CXXALIAS_SYS_CAST (sendto, ssize_t,
641# endif 666# endif
642_GL_CXXALIASWARN (sendto); 667_GL_CXXALIASWARN (sendto);
643#elif @HAVE_WINSOCK2_H@ 668#elif @HAVE_WINSOCK2_H@
644# undef sendto 669# if !GNULIB_SENDTO
645# define sendto sendto_used_without_requesting_gnulib_module_sendto 670# undef sendto
671# define sendto sendto_used_without_requesting_gnulib_module_sendto
672# endif
646#elif defined GNULIB_POSIXCHECK 673#elif defined GNULIB_POSIXCHECK
647# undef sendto 674# undef sendto
648# if HAVE_RAW_DECL_SENDTO 675# if HAVE_RAW_DECL_SENDTO
@@ -658,7 +685,7 @@ _GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - "
658# define setsockopt rpl_setsockopt 685# define setsockopt rpl_setsockopt
659# endif 686# endif
660_GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname, 687_GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname,
661 const void * optval, socklen_t optlen) 688 const void * optval, socklen_t optlen),
662 _GL_ARG_NONNULL ((4))); 689 _GL_ARG_NONNULL ((4)));
663_GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname, 690_GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname,
664 const void * optval, socklen_t optlen)); 691 const void * optval, socklen_t optlen));
@@ -671,8 +698,10 @@ _GL_CXXALIAS_SYS_CAST (setsockopt, int,
671# endif 698# endif
672_GL_CXXALIASWARN (setsockopt); 699_GL_CXXALIASWARN (setsockopt);
673#elif @HAVE_WINSOCK2_H@ 700#elif @HAVE_WINSOCK2_H@
674# undef setsockopt 701# if !GNULIB_SETSOCKOPT
675# define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt 702# undef setsockopt
703# define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
704# endif
676#elif defined GNULIB_POSIXCHECK 705#elif defined GNULIB_POSIXCHECK
677# undef setsockopt 706# undef setsockopt
678# if HAVE_RAW_DECL_SETSOCKOPT 707# if HAVE_RAW_DECL_SETSOCKOPT
@@ -687,15 +716,17 @@ _GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - "
687# undef shutdown 716# undef shutdown
688# define shutdown rpl_shutdown 717# define shutdown rpl_shutdown
689# endif 718# endif
690_GL_FUNCDECL_RPL (shutdown, int, (int fd, int how)); 719_GL_FUNCDECL_RPL (shutdown, int, (int fd, int how), );
691_GL_CXXALIAS_RPL (shutdown, int, (int fd, int how)); 720_GL_CXXALIAS_RPL (shutdown, int, (int fd, int how));
692# else 721# else
693_GL_CXXALIAS_SYS (shutdown, int, (int fd, int how)); 722_GL_CXXALIAS_SYS (shutdown, int, (int fd, int how));
694# endif 723# endif
695_GL_CXXALIASWARN (shutdown); 724_GL_CXXALIASWARN (shutdown);
696#elif @HAVE_WINSOCK2_H@ 725#elif @HAVE_WINSOCK2_H@
697# undef shutdown 726# if !GNULIB_SHUTDOWN
698# define shutdown shutdown_used_without_requesting_gnulib_module_shutdown 727# undef shutdown
728# define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
729# endif
699#elif defined GNULIB_POSIXCHECK 730#elif defined GNULIB_POSIXCHECK
700# undef shutdown 731# undef shutdown
701# if HAVE_RAW_DECL_SHUTDOWN 732# if HAVE_RAW_DECL_SHUTDOWN
@@ -716,14 +747,14 @@ _GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
716# endif 747# endif
717_GL_FUNCDECL_RPL (accept4, int, 748_GL_FUNCDECL_RPL (accept4, int,
718 (int sockfd, struct sockaddr *addr, socklen_t *addrlen, 749 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
719 int flags)); 750 int flags), );
720_GL_CXXALIAS_RPL (accept4, int, 751_GL_CXXALIAS_RPL (accept4, int,
721 (int sockfd, struct sockaddr *addr, socklen_t *addrlen, 752 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
722 int flags)); 753 int flags));
723# else 754# else
724_GL_FUNCDECL_SYS (accept4, int, 755_GL_FUNCDECL_SYS (accept4, int,
725 (int sockfd, struct sockaddr *addr, socklen_t *addrlen, 756 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
726 int flags)); 757 int flags), );
727_GL_CXXALIAS_SYS (accept4, int, 758_GL_CXXALIAS_SYS (accept4, int,
728 (int sockfd, struct sockaddr *addr, socklen_t *addrlen, 759 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
729 int flags)); 760 int flags));
diff --git a/gl/sys_stat.in.h b/gl/sys_stat.in.h
index bf08f335..c3c38fd6 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-2025 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__
@@ -478,15 +481,15 @@ _GL_CXXALIASWARN (chmod);
478# define fchmodat rpl_fchmodat 481# define fchmodat rpl_fchmodat
479# endif 482# endif
480_GL_FUNCDECL_RPL (fchmodat, int, 483_GL_FUNCDECL_RPL (fchmodat, int,
481 (int fd, char const *file, mode_t mode, int flag) 484 (int fd, char const *file, mode_t mode, int flag),
482 _GL_ARG_NONNULL ((2))); 485 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
483_GL_CXXALIAS_RPL (fchmodat, int, 486_GL_CXXALIAS_RPL (fchmodat, int,
484 (int fd, char const *file, mode_t mode, int flag)); 487 (int fd, char const *file, mode_t mode, int flag));
485# else 488# else
486# if !@HAVE_FCHMODAT@ 489# if !@HAVE_FCHMODAT@
487_GL_FUNCDECL_SYS (fchmodat, int, 490_GL_FUNCDECL_SYS (fchmodat, int,
488 (int fd, char const *file, mode_t mode, int flag) 491 (int fd, char const *file, mode_t mode, int flag),
489 _GL_ARG_NONNULL ((2))); 492 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
490# endif 493# endif
491_GL_CXXALIAS_SYS (fchmodat, int, 494_GL_CXXALIAS_SYS (fchmodat, int,
492 (int fd, char const *file, mode_t mode, int flag)); 495 (int fd, char const *file, mode_t mode, int flag));
@@ -507,7 +510,8 @@ _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
507# undef fstat 510# undef fstat
508# define fstat rpl_fstat 511# define fstat rpl_fstat
509# endif 512# endif
510_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2))); 513_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf),
514 _GL_ARG_NONNULL ((2)));
511_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf)); 515_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
512# else 516# else
513_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); 517_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
@@ -516,8 +520,10 @@ _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
516_GL_CXXALIASWARN (fstat); 520_GL_CXXALIASWARN (fstat);
517# endif 521# endif
518#elif @GNULIB_OVERRIDES_STRUCT_STAT@ 522#elif @GNULIB_OVERRIDES_STRUCT_STAT@
519# undef fstat 523# if !GNULIB_FSTAT
520# define fstat fstat_used_without_requesting_gnulib_module_fstat 524# undef fstat
525# define fstat fstat_used_without_requesting_gnulib_module_fstat
526# endif
521#elif @WINDOWS_64_BIT_ST_SIZE@ 527#elif @WINDOWS_64_BIT_ST_SIZE@
522/* Above, we define stat to _stati64. */ 528/* Above, we define stat to _stati64. */
523# define fstat _fstati64 529# define fstat _fstati64
@@ -538,7 +544,7 @@ _GL_WARN_ON_USE (fstat, "fstat has portability problems - "
538# endif 544# endif
539_GL_FUNCDECL_RPL (fstatat, int, 545_GL_FUNCDECL_RPL (fstatat, int,
540 (int fd, char const *restrict name, struct stat *restrict st, 546 (int fd, char const *restrict name, struct stat *restrict st,
541 int flags) 547 int flags),
542 _GL_ARG_NONNULL ((2, 3))); 548 _GL_ARG_NONNULL ((2, 3)));
543_GL_CXXALIAS_RPL (fstatat, int, 549_GL_CXXALIAS_RPL (fstatat, int,
544 (int fd, char const *restrict name, struct stat *restrict st, 550 (int fd, char const *restrict name, struct stat *restrict st,
@@ -547,7 +553,7 @@ _GL_CXXALIAS_RPL (fstatat, int,
547# if !@HAVE_FSTATAT@ 553# if !@HAVE_FSTATAT@
548_GL_FUNCDECL_SYS (fstatat, int, 554_GL_FUNCDECL_SYS (fstatat, int,
549 (int fd, char const *restrict name, struct stat *restrict st, 555 (int fd, char const *restrict name, struct stat *restrict st,
550 int flags) 556 int flags),
551 _GL_ARG_NONNULL ((2, 3))); 557 _GL_ARG_NONNULL ((2, 3)));
552# endif 558# endif
553_GL_CXXALIAS_SYS (fstatat, int, 559_GL_CXXALIAS_SYS (fstatat, int,
@@ -556,8 +562,10 @@ _GL_CXXALIAS_SYS (fstatat, int,
556# endif 562# endif
557_GL_CXXALIASWARN (fstatat); 563_GL_CXXALIASWARN (fstatat);
558#elif @GNULIB_OVERRIDES_STRUCT_STAT@ 564#elif @GNULIB_OVERRIDES_STRUCT_STAT@
559# undef fstatat 565# if !GNULIB_FSTATAT
560# define fstatat fstatat_used_without_requesting_gnulib_module_fstatat 566# undef fstatat
567# define fstatat fstatat_used_without_requesting_gnulib_module_fstatat
568# endif
561#elif defined GNULIB_POSIXCHECK 569#elif defined GNULIB_POSIXCHECK
562# undef fstatat 570# undef fstatat
563# if HAVE_RAW_DECL_FSTATAT 571# if HAVE_RAW_DECL_FSTATAT
@@ -577,11 +585,11 @@ _GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
577# undef futimens 585# undef futimens
578# define futimens rpl_futimens 586# define futimens rpl_futimens
579# endif 587# endif
580_GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2])); 588_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])); 589_GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
582# else 590# else
583# if !@HAVE_FUTIMENS@ 591# if !@HAVE_FUTIMENS@
584_GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2])); 592_GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]), );
585# endif 593# endif
586_GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2])); 594_GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
587# endif 595# endif
@@ -600,9 +608,9 @@ _GL_WARN_ON_USE (futimens, "futimens is not portable - "
600#if @GNULIB_GETUMASK@ 608#if @GNULIB_GETUMASK@
601# if !@HAVE_GETUMASK@ 609# if !@HAVE_GETUMASK@
602# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 610# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
603_GL_FUNCDECL_SYS (getumask, mode_t, (void) _GL_ATTRIBUTE_NOTHROW); 611_GL_FUNCDECL_SYS (getumask, mode_t, (void), ) _GL_ATTRIBUTE_NOTHROW;
604# else 612# else
605_GL_FUNCDECL_SYS (getumask, mode_t, (void)); 613_GL_FUNCDECL_SYS (getumask, mode_t, (void), );
606# endif 614# endif
607# endif 615# endif
608_GL_CXXALIAS_SYS (getumask, mode_t, (void)); 616_GL_CXXALIAS_SYS (getumask, mode_t, (void));
@@ -622,7 +630,7 @@ _GL_WARN_ON_USE (getumask, "getumask is not portable - "
622/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME 630/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
623 denotes a symbolic link. */ 631 denotes a symbolic link. */
624# if !@HAVE_LCHMOD@ || defined __hpux 632# if !@HAVE_LCHMOD@ || defined __hpux
625_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode) 633_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode),
626 _GL_ARG_NONNULL ((1))); 634 _GL_ARG_NONNULL ((1)));
627# endif 635# endif
628_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode)); 636_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
@@ -642,7 +650,7 @@ _GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
642# undef mkdir 650# undef mkdir
643# define mkdir rpl_mkdir 651# define mkdir rpl_mkdir
644# endif 652# endif
645_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode) 653_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode),
646 _GL_ARG_NONNULL ((1))); 654 _GL_ARG_NONNULL ((1)));
647_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); 655_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
648# elif defined _WIN32 && !defined __CYGWIN__ 656# elif defined _WIN32 && !defined __CYGWIN__
@@ -667,12 +675,6 @@ _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
667_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); 675_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
668# endif 676# endif
669_GL_CXXALIASWARN (mkdir); 677_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@ 678#elif @GNULIB_MDA_MKDIR@
677/* On native Windows, map 'mkdir' to '_mkdir', so that -loldnames is not 679/* On native Windows, map 'mkdir' to '_mkdir', so that -loldnames is not
678 required. In C++ with GNULIB_NAMESPACE, avoid differences between 680 required. In C++ with GNULIB_NAMESPACE, avoid differences between
@@ -695,12 +697,18 @@ _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
695_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); 697_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
696# endif 698# endif
697_GL_CXXALIASWARN (mkdir); 699_GL_CXXALIASWARN (mkdir);
700#elif defined GNULIB_POSIXCHECK
701# undef mkdir
702# if HAVE_RAW_DECL_MKDIR
703_GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - "
704 "use gnulib module mkdir for portability");
705# endif
698#endif 706#endif
699 707
700 708
701#if @GNULIB_MKDIRAT@ 709#if @GNULIB_MKDIRAT@
702# if !@HAVE_MKDIRAT@ 710# if !@HAVE_MKDIRAT@
703_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode) 711_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode),
704 _GL_ARG_NONNULL ((2))); 712 _GL_ARG_NONNULL ((2)));
705# endif 713# endif
706_GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)); 714_GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
@@ -720,12 +728,12 @@ _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
720# undef mkfifo 728# undef mkfifo
721# define mkfifo rpl_mkfifo 729# define mkfifo rpl_mkfifo
722# endif 730# endif
723_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode) 731_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode),
724 _GL_ARG_NONNULL ((1))); 732 _GL_ARG_NONNULL ((1)));
725_GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode)); 733_GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
726# else 734# else
727# if !@HAVE_MKFIFO@ 735# if !@HAVE_MKFIFO@
728_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode) 736_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode),
729 _GL_ARG_NONNULL ((1))); 737 _GL_ARG_NONNULL ((1)));
730# endif 738# endif
731_GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode)); 739_GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
@@ -746,12 +754,12 @@ _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
746# undef mkfifoat 754# undef mkfifoat
747# define mkfifoat rpl_mkfifoat 755# define mkfifoat rpl_mkfifoat
748# endif 756# endif
749_GL_FUNCDECL_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode) 757_GL_FUNCDECL_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode),
750 _GL_ARG_NONNULL ((2))); 758 _GL_ARG_NONNULL ((2)));
751_GL_CXXALIAS_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode)); 759_GL_CXXALIAS_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode));
752# else 760# else
753# if !@HAVE_MKFIFOAT@ 761# if !@HAVE_MKFIFOAT@
754_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode) 762_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode),
755 _GL_ARG_NONNULL ((2))); 763 _GL_ARG_NONNULL ((2)));
756# endif 764# endif
757_GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)); 765_GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
@@ -774,12 +782,12 @@ _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
774# undef mknod 782# undef mknod
775# define mknod rpl_mknod 783# define mknod rpl_mknod
776# endif 784# endif
777_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev) 785_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev),
778 _GL_ARG_NONNULL ((1))); 786 _GL_ARG_NONNULL ((1)));
779_GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)); 787_GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
780# else 788# else
781# if !@HAVE_MKNOD@ 789# if !@HAVE_MKNOD@
782_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev) 790_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev),
783 _GL_ARG_NONNULL ((1))); 791 _GL_ARG_NONNULL ((1)));
784# endif 792# endif
785/* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */ 793/* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */
@@ -802,14 +810,14 @@ _GL_WARN_ON_USE (mknod, "mknod is not portable - "
802# define mknodat rpl_mknodat 810# define mknodat rpl_mknodat
803# endif 811# endif
804_GL_FUNCDECL_RPL (mknodat, int, 812_GL_FUNCDECL_RPL (mknodat, int,
805 (int fd, char const *file, mode_t mode, dev_t dev) 813 (int fd, char const *file, mode_t mode, dev_t dev),
806 _GL_ARG_NONNULL ((2))); 814 _GL_ARG_NONNULL ((2)));
807_GL_CXXALIAS_RPL (mknodat, int, 815_GL_CXXALIAS_RPL (mknodat, int,
808 (int fd, char const *file, mode_t mode, dev_t dev)); 816 (int fd, char const *file, mode_t mode, dev_t dev));
809# else 817# else
810# if !@HAVE_MKNODAT@ 818# if !@HAVE_MKNODAT@
811_GL_FUNCDECL_SYS (mknodat, int, 819_GL_FUNCDECL_SYS (mknodat, int,
812 (int fd, char const *file, mode_t mode, dev_t dev) 820 (int fd, char const *file, mode_t mode, dev_t dev),
813 _GL_ARG_NONNULL ((2))); 821 _GL_ARG_NONNULL ((2)));
814# endif 822# endif
815_GL_CXXALIAS_SYS (mknodat, int, 823_GL_CXXALIAS_SYS (mknodat, int,
@@ -841,7 +849,11 @@ _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
841# elif @WINDOWS_64_BIT_ST_SIZE@ 849# elif @WINDOWS_64_BIT_ST_SIZE@
842 /* Above, we define stat to _stati64. */ 850 /* Above, we define stat to _stati64. */
843# if defined __MINGW32__ && defined _stati64 851# if defined __MINGW32__ && defined _stati64
844# ifndef _USE_32BIT_TIME_T 852# ifdef _USE_32BIT_TIME_T
853 /* The system headers possibly define _stati64 to _stat32i64. */
854# undef _stat32i64
855# define _stat32i64(name, st) rpl_stat (name, st)
856# else
845 /* The system headers define _stati64 to _stat64. */ 857 /* The system headers define _stati64 to _stat64. */
846# undef _stat64 858# undef _stat64
847# define _stat64(name, st) rpl_stat (name, st) 859# define _stat64(name, st) rpl_stat (name, st)
@@ -916,7 +928,7 @@ _GL_CXXALIAS_RPL_1 (lstat, stat, int,
916# define lstat rpl_lstat 928# define lstat rpl_lstat
917# endif 929# endif
918_GL_FUNCDECL_RPL (lstat, int, 930_GL_FUNCDECL_RPL (lstat, int,
919 (const char *restrict name, struct stat *restrict buf) 931 (const char *restrict name, struct stat *restrict buf),
920 _GL_ARG_NONNULL ((1, 2))); 932 _GL_ARG_NONNULL ((1, 2)));
921_GL_CXXALIAS_RPL (lstat, int, 933_GL_CXXALIAS_RPL (lstat, int,
922 (const char *restrict name, struct stat *restrict buf)); 934 (const char *restrict name, struct stat *restrict buf));
@@ -928,8 +940,10 @@ _GL_CXXALIAS_SYS (lstat, int,
928_GL_CXXALIASWARN (lstat); 940_GL_CXXALIASWARN (lstat);
929# endif 941# endif
930#elif @GNULIB_OVERRIDES_STRUCT_STAT@ 942#elif @GNULIB_OVERRIDES_STRUCT_STAT@
931# undef lstat 943# if !GNULIB_LSTAT
932# define lstat lstat_used_without_requesting_gnulib_module_lstat 944# undef lstat
945# define lstat lstat_used_without_requesting_gnulib_module_lstat
946# endif
933#elif defined GNULIB_POSIXCHECK 947#elif defined GNULIB_POSIXCHECK
934# undef lstat 948# undef lstat
935# if HAVE_RAW_DECL_LSTAT 949# if HAVE_RAW_DECL_LSTAT
@@ -968,14 +982,14 @@ _GL_CXXALIASWARN (umask);
968# define utimensat rpl_utimensat 982# define utimensat rpl_utimensat
969# endif 983# endif
970_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name, 984_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
971 struct timespec const times[2], int flag) 985 struct timespec const times[2], int flag),
972 _GL_ARG_NONNULL ((2))); 986 _GL_ARG_NONNULL ((2)));
973_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name, 987_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
974 struct timespec const times[2], int flag)); 988 struct timespec const times[2], int flag));
975# else 989# else
976# if !@HAVE_UTIMENSAT@ 990# if !@HAVE_UTIMENSAT@
977_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name, 991_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
978 struct timespec const times[2], int flag) 992 struct timespec const times[2], int flag),
979 _GL_ARG_NONNULL ((2))); 993 _GL_ARG_NONNULL ((2)));
980# endif 994# endif
981_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name, 995_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
diff --git a/gl/sys_types.in.h b/gl/sys_types.in.h
index 0a0ccc3c..acf9b2f7 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-2025 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..fec3a70a 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-2025 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..3ff16e3b 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-2025 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));
@@ -159,17 +176,19 @@ _GL_WARN_ON_USE (timespec_get, "timespec_get is unportable - "
159# undef timespec_getres 176# undef timespec_getres
160# define timespec_getres rpl_timespec_getres 177# define timespec_getres rpl_timespec_getres
161# endif 178# endif
162_GL_FUNCDECL_RPL (timespec_getres, int, (struct timespec *ts, int base) 179_GL_FUNCDECL_RPL (timespec_getres, int, (struct timespec *ts, int base),
163 _GL_ARG_NONNULL ((1))); 180 _GL_ARG_NONNULL ((1)));
164_GL_CXXALIAS_RPL (timespec_getres, int, (struct timespec *ts, int base)); 181_GL_CXXALIAS_RPL (timespec_getres, int, (struct timespec *ts, int base));
165# else 182# else
166# if !@HAVE_TIMESPEC_GETRES@ 183# if !@HAVE_TIMESPEC_GETRES@
167_GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base) 184_GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base),
168 _GL_ARG_NONNULL ((1))); 185 _GL_ARG_NONNULL ((1)));
169# endif 186# endif
170_GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base)); 187_GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base));
171# endif 188# endif
189# if __GLIBC__ >= 2
172_GL_CXXALIASWARN (timespec_getres); 190_GL_CXXALIASWARN (timespec_getres);
191# endif
173# elif defined GNULIB_POSIXCHECK 192# elif defined GNULIB_POSIXCHECK
174# undef timespec_getres 193# undef timespec_getres
175# if HAVE_RAW_DECL_TIMESPEC_GETRES 194# if HAVE_RAW_DECL_TIMESPEC_GETRES
@@ -184,7 +203,7 @@ _GL_WARN_ON_USE (timespec_getres, "timespec_getres is unportable - "
184# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 203# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
185# define time rpl_time 204# define time rpl_time
186# endif 205# endif
187_GL_FUNCDECL_RPL (time, time_t, (time_t *__tp)); 206_GL_FUNCDECL_RPL (time, time_t, (time_t *__tp), );
188_GL_CXXALIAS_RPL (time, time_t, (time_t *__tp)); 207_GL_CXXALIAS_RPL (time, time_t, (time_t *__tp));
189# else 208# else
190_GL_CXXALIAS_SYS (time, time_t, (time_t *__tp)); 209_GL_CXXALIAS_SYS (time, time_t, (time_t *__tp));
@@ -209,14 +228,14 @@ _GL_WARN_ON_USE (time, "time has consistency problems - "
209# define nanosleep rpl_nanosleep 228# define nanosleep rpl_nanosleep
210# endif 229# endif
211_GL_FUNCDECL_RPL (nanosleep, int, 230_GL_FUNCDECL_RPL (nanosleep, int,
212 (struct timespec const *__rqtp, struct timespec *__rmtp) 231 (struct timespec const *__rqtp, struct timespec *__rmtp),
213 _GL_ARG_NONNULL ((1))); 232 _GL_ARG_NONNULL ((1)));
214_GL_CXXALIAS_RPL (nanosleep, int, 233_GL_CXXALIAS_RPL (nanosleep, int,
215 (struct timespec const *__rqtp, struct timespec *__rmtp)); 234 (struct timespec const *__rqtp, struct timespec *__rmtp));
216# else 235# else
217# if ! @HAVE_NANOSLEEP@ 236# if ! @HAVE_NANOSLEEP@
218_GL_FUNCDECL_SYS (nanosleep, int, 237_GL_FUNCDECL_SYS (nanosleep, int,
219 (struct timespec const *__rqtp, struct timespec *__rmtp) 238 (struct timespec const *__rqtp, struct timespec *__rmtp),
220 _GL_ARG_NONNULL ((1))); 239 _GL_ARG_NONNULL ((1)));
221# endif 240# endif
222_GL_CXXALIAS_SYS (nanosleep, int, 241_GL_CXXALIAS_SYS (nanosleep, int,
@@ -238,7 +257,7 @@ _GL_WARN_ON_USE (nanosleep, "nanosleep is unportable - "
238# undef tzset 257# undef tzset
239# define tzset rpl_tzset 258# define tzset rpl_tzset
240# endif 259# endif
241_GL_FUNCDECL_RPL (tzset, void, (void)); 260_GL_FUNCDECL_RPL (tzset, void, (void), );
242_GL_CXXALIAS_RPL (tzset, void, (void)); 261_GL_CXXALIAS_RPL (tzset, void, (void));
243# elif defined _WIN32 && !defined __CYGWIN__ 262# elif defined _WIN32 && !defined __CYGWIN__
244# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 263# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -278,7 +297,7 @@ _GL_WARN_ON_USE (tzset, "tzset has portability problems - "
278# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 297# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
279# define mktime rpl_mktime 298# define mktime rpl_mktime
280# endif 299# endif
281_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1))); 300_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp), _GL_ARG_NONNULL ((1)));
282_GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp)); 301_GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp));
283# else 302# else
284_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); 303_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
@@ -304,14 +323,14 @@ _GL_WARN_ON_USE (mktime, "mktime has portability problems - "
304# define localtime_r rpl_localtime_r 323# define localtime_r rpl_localtime_r
305# endif 324# endif
306_GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, 325_GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
307 struct tm *restrict __result) 326 struct tm *restrict __result),
308 _GL_ARG_NONNULL ((1, 2))); 327 _GL_ARG_NONNULL ((1, 2)));
309_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, 328_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
310 struct tm *restrict __result)); 329 struct tm *restrict __result));
311# else 330# else
312# if ! @HAVE_DECL_LOCALTIME_R@ 331# if ! @HAVE_DECL_LOCALTIME_R@
313_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, 332_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
314 struct tm *restrict __result) 333 struct tm *restrict __result),
315 _GL_ARG_NONNULL ((1, 2))); 334 _GL_ARG_NONNULL ((1, 2)));
316# endif 335# endif
317_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, 336_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
@@ -326,14 +345,14 @@ _GL_CXXALIASWARN (localtime_r);
326# define gmtime_r rpl_gmtime_r 345# define gmtime_r rpl_gmtime_r
327# endif 346# endif
328_GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, 347_GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
329 struct tm *restrict __result) 348 struct tm *restrict __result),
330 _GL_ARG_NONNULL ((1, 2))); 349 _GL_ARG_NONNULL ((1, 2)));
331_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, 350_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
332 struct tm *restrict __result)); 351 struct tm *restrict __result));
333# else 352# else
334# if ! @HAVE_DECL_LOCALTIME_R@ 353# if ! @HAVE_DECL_LOCALTIME_R@
335_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, 354_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
336 struct tm *restrict __result) 355 struct tm *restrict __result),
337 _GL_ARG_NONNULL ((1, 2))); 356 _GL_ARG_NONNULL ((1, 2)));
338# endif 357# endif
339_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, 358_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
@@ -364,7 +383,7 @@ _GL_WARN_ON_USE (gmtime_r, "gmtime_r is unportable - "
364# undef localtime 383# undef localtime
365# define localtime rpl_localtime 384# define localtime rpl_localtime
366# endif 385# endif
367_GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer) 386_GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer),
368 _GL_ARG_NONNULL ((1))); 387 _GL_ARG_NONNULL ((1)));
369_GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer)); 388_GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer));
370# else 389# else
@@ -387,7 +406,7 @@ _GL_WARN_ON_USE (localtime, "localtime has portability problems - "
387# undef gmtime 406# undef gmtime
388# define gmtime rpl_gmtime 407# define gmtime rpl_gmtime
389# endif 408# endif
390_GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer) 409_GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer),
391 _GL_ARG_NONNULL ((1))); 410 _GL_ARG_NONNULL ((1)));
392_GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer)); 411_GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer));
393# else 412# else
@@ -403,7 +422,7 @@ _GL_CXXALIASWARN (gmtime);
403# if ! @HAVE_STRPTIME@ 422# if ! @HAVE_STRPTIME@
404_GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf, 423_GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf,
405 char const *restrict __format, 424 char const *restrict __format,
406 struct tm *restrict __tm) 425 struct tm *restrict __tm),
407 _GL_ARG_NONNULL ((1, 2, 3))); 426 _GL_ARG_NONNULL ((1, 2, 3)));
408# endif 427# endif
409_GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, 428_GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
@@ -428,7 +447,7 @@ _GL_WARN_ON_USE (strptime, "strptime is unportable - "
428# ifndef __cplusplus 447# ifndef __cplusplus
429_GL_ATTRIBUTE_DEPRECATED 448_GL_ATTRIBUTE_DEPRECATED
430# endif 449# endif
431_GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp) 450_GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp),
432 _GL_ARG_NONNULL ((1))); 451 _GL_ARG_NONNULL ((1)));
433_GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp)); 452_GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp));
434# else 453# else
@@ -450,7 +469,7 @@ _GL_CXXALIASWARN (ctime);
450# endif 469# endif
451_GL_FUNCDECL_RPL (strftime, size_t, 470_GL_FUNCDECL_RPL (strftime, size_t,
452 (char *restrict __buf, size_t __bufsize, 471 (char *restrict __buf, size_t __bufsize,
453 const char *restrict __fmt, const struct tm *restrict __tp) 472 const char *restrict __fmt, const struct tm *restrict __tp),
454 _GL_ARG_NONNULL ((1, 3, 4))); 473 _GL_ARG_NONNULL ((1, 3, 4)));
455_GL_CXXALIAS_RPL (strftime, size_t, 474_GL_CXXALIAS_RPL (strftime, size_t,
456 (char *restrict __buf, size_t __bufsize, 475 (char *restrict __buf, size_t __bufsize,
@@ -471,14 +490,24 @@ _GL_WARN_ON_USE (strftime, "strftime has portability problems - "
471# endif 490# endif
472# endif 491# endif
473 492
474# if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@ 493# if @GNULIB_TIME_RZ@
475/* Functions that use a first-class time zone data type, instead of 494/* Functions that use a first-class time zone data type, instead of
476 relying on an implicit global time zone. 495 relying on an implicit global time zone.
477 Inspired by NetBSD. */ 496 Inspired by NetBSD. */
478 497
479/* Represents a time zone. 498/* Represents a time zone.
480 (timezone_t) NULL stands for UTC. */ 499 (timezone_t) NULL stands for UTC. */
500# if !@HAVE_TZALLOC@
501# if !GNULIB_defined_timezone_t
502# if !@HAVE_TIMEZONE_T@
481typedef struct tm_zone *timezone_t; 503typedef struct tm_zone *timezone_t;
504# else
505typedef struct tm_zone *rpl_timezone_t;
506# define timezone_t rpl_timezone_t
507# endif
508# define GNULIB_defined_timezone_t 1
509# endif
510# endif
482 511
483/* tzalloc (name) 512/* tzalloc (name)
484 Returns a time zone object for the given time zone NAME. This object 513 Returns a time zone object for the given time zone NAME. This object
@@ -488,37 +517,72 @@ typedef struct tm_zone *timezone_t;
488 would use it the TZ environment variable was unset. 517 would use it the TZ environment variable was unset.
489 May return NULL if NAME is invalid (this is platform dependent) or 518 May return NULL if NAME is invalid (this is platform dependent) or
490 upon memory allocation failure. */ 519 upon memory allocation failure. */
491_GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name)); 520# if !@HAVE_TZALLOC@
521_GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name), );
492_GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name)); 522_GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name));
523# endif
493 524
494/* tzfree (tz) 525/* tzfree (tz)
495 Frees a time zone object. 526 Frees a time zone object.
496 The argument must have been returned by tzalloc(). */ 527 The argument must have been returned by tzalloc(). */
497_GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz)); 528# if !@HAVE_TZALLOC@
529_GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz), );
498_GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz)); 530_GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz));
531# endif
499 532
500/* localtime_rz (tz, &t, &result) 533/* localtime_rz (tz, &t, &result)
501 Converts an absolute time T to a broken-down time RESULT, assuming the 534 Converts an absolute time T to a broken-down time RESULT, assuming the
502 time zone TZ. 535 time zone TZ.
503 This function is like 'localtime_r', but relies on the argument TZ instead 536 This function is like 'localtime_r', but relies on the argument TZ instead
504 of an implicit global time zone. */ 537 of an implicit global time zone. */
538# if @REPLACE_LOCALTIME_RZ@
539# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
540# undef localtime_rz
541# define localtime_rz rpl_localtime_rz
542# endif
543_GL_FUNCDECL_RPL (localtime_rz, struct tm *,
544 (timezone_t __tz, time_t const *restrict __timer,
545 struct tm *restrict __result),
546 _GL_ARG_NONNULL ((2, 3)));
547_GL_CXXALIAS_RPL (localtime_rz, struct tm *,
548 (timezone_t __tz, time_t const *restrict __timer,
549 struct tm *restrict __result));
550# else
551# if !@HAVE_TZALLOC@
505_GL_FUNCDECL_SYS (localtime_rz, struct tm *, 552_GL_FUNCDECL_SYS (localtime_rz, struct tm *,
506 (timezone_t __tz, time_t const *restrict __timer, 553 (timezone_t __tz, time_t const *restrict __timer,
507 struct tm *restrict __result) _GL_ARG_NONNULL ((2, 3))); 554 struct tm *restrict __result),
555 _GL_ARG_NONNULL ((2, 3)));
556# endif
508_GL_CXXALIAS_SYS (localtime_rz, struct tm *, 557_GL_CXXALIAS_SYS (localtime_rz, struct tm *,
509 (timezone_t __tz, time_t const *restrict __timer, 558 (timezone_t __tz, time_t const *restrict __timer,
510 struct tm *restrict __result)); 559 struct tm *restrict __result));
560# endif
511 561
512/* mktime_z (tz, &tm) 562/* mktime_z (tz, &tm)
513 Normalizes the broken-down time TM and converts it to an absolute time, 563 Normalizes the broken-down time TM and converts it to an absolute time,
514 assuming the time zone TZ. Returns the absolute time. 564 assuming the time zone TZ. Returns the absolute time.
515 This function is like 'mktime', but relies on the argument TZ instead 565 This function is like 'mktime', but relies on the argument TZ instead
516 of an implicit global time zone. */ 566 of an implicit global time zone. */
567# if @REPLACE_MKTIME_Z@
568# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
569# undef mktime_z
570# define mktime_z rpl_mktime_z
571# endif
572_GL_FUNCDECL_RPL (mktime_z, time_t,
573 (timezone_t __tz, struct tm *restrict __tm),
574 _GL_ARG_NONNULL ((2)));
575_GL_CXXALIAS_RPL (mktime_z, time_t,
576 (timezone_t __tz, struct tm *restrict __tm));
577# else
578# if !@HAVE_TZALLOC@
517_GL_FUNCDECL_SYS (mktime_z, time_t, 579_GL_FUNCDECL_SYS (mktime_z, time_t,
518 (timezone_t __tz, struct tm *restrict __tm) 580 (timezone_t __tz, struct tm *restrict __tm),
519 _GL_ARG_NONNULL ((2))); 581 _GL_ARG_NONNULL ((2)));
582# endif
520_GL_CXXALIAS_SYS (mktime_z, time_t, 583_GL_CXXALIAS_SYS (mktime_z, time_t,
521 (timezone_t __tz, struct tm *restrict __tm)); 584 (timezone_t __tz, struct tm *restrict __tm));
585# endif
522 586
523/* Time zone abbreviation strings (returned by 'localtime_rz' or 'mktime_z' 587/* 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 588 in the 'tm_zone' member of 'struct tm') are valid as long as
@@ -535,11 +599,11 @@ _GL_CXXALIAS_SYS (mktime_z, time_t,
535# undef timegm 599# undef timegm
536# define timegm rpl_timegm 600# define timegm rpl_timegm
537# endif 601# endif
538_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); 602_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm), _GL_ARG_NONNULL ((1)));
539_GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm)); 603_GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm));
540# else 604# else
541# if ! @HAVE_TIMEGM@ 605# if ! @HAVE_TIMEGM@
542_GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); 606_GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm), _GL_ARG_NONNULL ((1)));
543# endif 607# endif
544_GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm)); 608_GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm));
545# endif 609# endif
diff --git a/gl/time_r.c b/gl/time_r.c
index b724f3b3..15d65d59 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-2025 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..4c2615b9 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-2025 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.h b/gl/uchar.h
new file mode 100644
index 00000000..abc636c5
--- /dev/null
+++ b/gl/uchar.h
@@ -0,0 +1,1456 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* <uchar.h> substitute - 16-bit and 32-bit wide character types.
3 Copyright (C) 2019-2025 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 Bruno Haible <bruno@clisp.org>, 2019. */
19
20/*
21 * ISO C 23 <uchar.h> for platforms that lack it.
22 */
23
24#ifndef _GL_UCHAR_H
25
26#if __GNUC__ >= 3
27#pragma GCC system_header
28#endif
29
30
31/* The include_next requires a split double-inclusion guard. */
32#if (defined __cplusplus ? 0 : 1)
33# if defined __HAIKU__
34/* Work around <https://dev.haiku-os.org/ticket/17040>. */
35# include <stdint.h>
36# endif
37/* On AIX 7.2 with xlclang++, /usr/include/uchar.h produces compilation errors
38 because it contains typedef definitions of char16_t and char32_t, however
39 char16_t and char32_t are keywords in this situation. To work around it,
40 define char16_t and char32_t as macros. */
41# if defined __cplusplus && defined _AIX && defined __ibmxl__ && defined __clang__
42# define char16_t gl_char16_t
43# define char32_t gl_char32_t
44# endif
45# include_next <uchar.h>
46#endif
47
48#ifndef _GL_UCHAR_H
49#define _GL_UCHAR_H
50
51/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_BEGIN_C_LINKAGE,
52 _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
53#if !_GL_CONFIG_H_INCLUDED
54 #error "Please include config.h first."
55#endif
56
57/* Get uint_least16_t, uint_least32_t. */
58#include <stdint.h>
59
60/* Get mbstate_t, size_t. */
61#include <wchar.h>
62
63/* For the inline functions. */
64#include <string.h>
65#include <wctype.h>
66
67/* The __attribute__ feature is available in gcc versions 2.5 and later.
68 The attribute __pure__ was added in gcc 2.96. */
69#ifndef _GL_ATTRIBUTE_PURE
70# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
71# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
72# else
73# define _GL_ATTRIBUTE_PURE /* empty */
74# endif
75#endif
76
77/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
78/* C++ compatible function declaration macros.
79 Copyright (C) 2010-2025 Free Software Foundation, Inc.
80
81 This program is free software: you can redistribute it and/or modify it
82 under the terms of the GNU Lesser General Public License as published
83 by the Free Software Foundation; either version 2 of the License, or
84 (at your option) any later version.
85
86 This program is distributed in the hope that it will be useful,
87 but WITHOUT ANY WARRANTY; without even the implied warranty of
88 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
89 Lesser General Public License for more details.
90
91 You should have received a copy of the GNU Lesser General Public License
92 along with this program. If not, see <https://www.gnu.org/licenses/>. */
93
94#ifndef _GL_CXXDEFS_H
95#define _GL_CXXDEFS_H
96
97/* Begin/end the GNULIB_NAMESPACE namespace. */
98#if defined __cplusplus && defined GNULIB_NAMESPACE
99# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
100# define _GL_END_NAMESPACE }
101#else
102# define _GL_BEGIN_NAMESPACE
103# define _GL_END_NAMESPACE
104#endif
105
106/* The three most frequent use cases of these macros are:
107
108 * For providing a substitute for a function that is missing on some
109 platforms, but is declared and works fine on the platforms on which
110 it exists:
111
112 #if @GNULIB_FOO@
113 # if !@HAVE_FOO@
114 _GL_FUNCDECL_SYS (foo, ...);
115 # endif
116 _GL_CXXALIAS_SYS (foo, ...);
117 _GL_CXXALIASWARN (foo);
118 #elif defined GNULIB_POSIXCHECK
119 ...
120 #endif
121
122 * For providing a replacement for a function that exists on all platforms,
123 but is broken/insufficient and needs to be replaced on some platforms:
124
125 #if @GNULIB_FOO@
126 # if @REPLACE_FOO@
127 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
128 # undef foo
129 # define foo rpl_foo
130 # endif
131 _GL_FUNCDECL_RPL (foo, ...);
132 _GL_CXXALIAS_RPL (foo, ...);
133 # else
134 _GL_CXXALIAS_SYS (foo, ...);
135 # endif
136 _GL_CXXALIASWARN (foo);
137 #elif defined GNULIB_POSIXCHECK
138 ...
139 #endif
140
141 * For providing a replacement for a function that exists on some platforms
142 but is broken/insufficient and needs to be replaced on some of them and
143 is additionally either missing or undeclared on some other platforms:
144
145 #if @GNULIB_FOO@
146 # if @REPLACE_FOO@
147 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
148 # undef foo
149 # define foo rpl_foo
150 # endif
151 _GL_FUNCDECL_RPL (foo, ...);
152 _GL_CXXALIAS_RPL (foo, ...);
153 # else
154 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
155 _GL_FUNCDECL_SYS (foo, ...);
156 # endif
157 _GL_CXXALIAS_SYS (foo, ...);
158 # endif
159 _GL_CXXALIASWARN (foo);
160 #elif defined GNULIB_POSIXCHECK
161 ...
162 #endif
163*/
164
165/* _GL_EXTERN_C declaration;
166 performs the declaration with C linkage. */
167#if defined __cplusplus
168# define _GL_EXTERN_C extern "C"
169#else
170# define _GL_EXTERN_C extern
171#endif
172
173/* _GL_EXTERN_C_FUNC declaration;
174 performs the declaration of a function with C linkage. */
175#if defined __cplusplus
176# define _GL_EXTERN_C_FUNC extern "C"
177#else
178/* In C mode, omit the 'extern' keyword, because attributes in bracket syntax
179 are not allowed between 'extern' and the return type (see gnulib-common.m4).
180 */
181# define _GL_EXTERN_C_FUNC
182#endif
183
184/* _GL_FUNCDECL_RPL (func, rettype, parameters, [attributes]);
185 declares a replacement function, named rpl_func, with the given prototype,
186 consisting of return type, parameters, and attributes.
187 Although attributes are optional, the comma before them is required
188 for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW,
189 if needed, must be placed after the _GL_FUNCDECL_RPL invocation,
190 at the end of the declaration.
191 Examples:
192 _GL_FUNCDECL_RPL (free, void, (void *ptr), ) _GL_ATTRIBUTE_NOTHROW;
193 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...),
194 _GL_ARG_NONNULL ((1)));
195
196 Note: Attributes, such as _GL_ATTRIBUTE_DEPRECATED, are supported in front
197 of a _GL_FUNCDECL_RPL invocation only in C mode, not in C++ mode. (That's
198 because
199 [[...]] extern "C" <declaration>;
200 is invalid syntax in C++.)
201 */
202#define _GL_FUNCDECL_RPL(func,rettype,parameters,...) \
203 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters, __VA_ARGS__)
204#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters,...) \
205 _GL_EXTERN_C_FUNC __VA_ARGS__ rettype rpl_func parameters
206
207/* _GL_FUNCDECL_SYS_NAME (func) expands to plain func if C++, and to
208 parenthesized func otherwise. Parenthesization is needed in C23 if
209 the function is like strchr and so is a qualifier-generic macro
210 that expands to something more complicated. */
211#ifdef __cplusplus
212# define _GL_FUNCDECL_SYS_NAME(func) func
213#else
214# define _GL_FUNCDECL_SYS_NAME(func) (func)
215#endif
216
217/* _GL_FUNCDECL_SYS (func, rettype, parameters, [attributes]);
218 declares the system function, named func, with the given prototype,
219 consisting of return type, parameters, and attributes.
220 Although attributes are optional, the comma before them is required
221 for portability to C17 and earlier. The attribute _GL_ATTRIBUTE_NOTHROW,
222 if needed, must be placed after the _GL_FUNCDECL_RPL invocation,
223 at the end of the declaration.
224 Examples:
225 _GL_FUNCDECL_SYS (getumask, mode_t, (void), ) _GL_ATTRIBUTE_NOTHROW;
226 _GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD);
227 */
228#define _GL_FUNCDECL_SYS(func,rettype,parameters,...) \
229 _GL_EXTERN_C_FUNC __VA_ARGS__ rettype _GL_FUNCDECL_SYS_NAME (func) parameters
230
231/* _GL_CXXALIAS_RPL (func, rettype, parameters);
232 declares a C++ alias called GNULIB_NAMESPACE::func
233 that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
234 Example:
235 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
236
237 Wrapping rpl_func in an object with an inline conversion operator
238 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
239 actually used in the program. */
240#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
241 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
242#if defined __cplusplus && defined GNULIB_NAMESPACE
243# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
244 namespace GNULIB_NAMESPACE \
245 { \
246 static const struct _gl_ ## func ## _wrapper \
247 { \
248 typedef rettype (*type) parameters; \
249 \
250 inline operator type () const \
251 { \
252 return ::rpl_func; \
253 } \
254 } func = {}; \
255 } \
256 _GL_EXTERN_C int _gl_cxxalias_dummy
257#else
258# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
259 _GL_EXTERN_C int _gl_cxxalias_dummy
260#endif
261
262/* _GL_CXXALIAS_MDA (func, rettype, parameters);
263 is to be used when func is a Microsoft deprecated alias, on native Windows.
264 It declares a C++ alias called GNULIB_NAMESPACE::func
265 that redirects to _func, if GNULIB_NAMESPACE is defined.
266 Example:
267 _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
268 */
269#define _GL_CXXALIAS_MDA(func,rettype,parameters) \
270 _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
271
272/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
273 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
274 except that the C function rpl_func may have a slightly different
275 declaration. A cast is used to silence the "invalid conversion" error
276 that would otherwise occur. */
277#if defined __cplusplus && defined GNULIB_NAMESPACE
278# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
279 namespace GNULIB_NAMESPACE \
280 { \
281 static const struct _gl_ ## func ## _wrapper \
282 { \
283 typedef rettype (*type) parameters; \
284 \
285 inline operator type () const \
286 { \
287 return reinterpret_cast<type>(::rpl_func); \
288 } \
289 } func = {}; \
290 } \
291 _GL_EXTERN_C int _gl_cxxalias_dummy
292#else
293# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
294 _GL_EXTERN_C int _gl_cxxalias_dummy
295#endif
296
297/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters);
298 is like _GL_CXXALIAS_MDA (func, rettype, parameters);
299 except that the C function func may have a slightly different declaration.
300 A cast is used to silence the "invalid conversion" error that would
301 otherwise occur. */
302#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \
303 _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters)
304
305/* _GL_CXXALIAS_SYS (func, rettype, parameters);
306 declares a C++ alias called GNULIB_NAMESPACE::func
307 that redirects to the system provided function func, if GNULIB_NAMESPACE
308 is defined.
309 Example:
310 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
311
312 Wrapping func in an object with an inline conversion operator
313 avoids a reference to func unless GNULIB_NAMESPACE::func is
314 actually used in the program. */
315#if defined __cplusplus && defined GNULIB_NAMESPACE
316# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
317 namespace GNULIB_NAMESPACE \
318 { \
319 static const struct _gl_ ## func ## _wrapper \
320 { \
321 typedef rettype (*type) parameters; \
322 \
323 inline operator type () const \
324 { \
325 return ::func; \
326 } \
327 } func = {}; \
328 } \
329 _GL_EXTERN_C int _gl_cxxalias_dummy
330#else
331# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
332 _GL_EXTERN_C int _gl_cxxalias_dummy
333#endif
334
335/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
336 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
337 except that the C function func may have a slightly different declaration.
338 A cast is used to silence the "invalid conversion" error that would
339 otherwise occur. */
340#if defined __cplusplus && defined GNULIB_NAMESPACE
341# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
342 namespace GNULIB_NAMESPACE \
343 { \
344 static const struct _gl_ ## func ## _wrapper \
345 { \
346 typedef rettype (*type) parameters; \
347 \
348 inline operator type () const \
349 { \
350 return reinterpret_cast<type>(::func); \
351 } \
352 } func = {}; \
353 } \
354 _GL_EXTERN_C int _gl_cxxalias_dummy
355#else
356# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
357 _GL_EXTERN_C int _gl_cxxalias_dummy
358#endif
359
360/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
361 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
362 except that the C function is picked among a set of overloaded functions,
363 namely the one with rettype2 and parameters2. Two consecutive casts
364 are used to silence the "cannot find a match" and "invalid conversion"
365 errors that would otherwise occur. */
366#if defined __cplusplus && defined GNULIB_NAMESPACE
367 /* The outer cast must be a reinterpret_cast.
368 The inner cast: When the function is defined as a set of overloaded
369 functions, it works as a static_cast<>, choosing the designated variant.
370 When the function is defined as a single variant, it works as a
371 reinterpret_cast<>. The parenthesized cast syntax works both ways. */
372# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
373 namespace GNULIB_NAMESPACE \
374 { \
375 static const struct _gl_ ## func ## _wrapper \
376 { \
377 typedef rettype (*type) parameters; \
378 \
379 inline operator type () const \
380 { \
381 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \
382 } \
383 } func = {}; \
384 } \
385 _GL_EXTERN_C int _gl_cxxalias_dummy
386#else
387# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
388 _GL_EXTERN_C int _gl_cxxalias_dummy
389#endif
390
391/* _GL_CXXALIASWARN (func);
392 causes a warning to be emitted when ::func is used but not when
393 GNULIB_NAMESPACE::func is used. func must be defined without overloaded
394 variants. */
395#if defined __cplusplus && defined GNULIB_NAMESPACE
396# define _GL_CXXALIASWARN(func) \
397 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
398# define _GL_CXXALIASWARN_1(func,namespace) \
399 _GL_CXXALIASWARN_2 (func, namespace)
400/* To work around GCC bug <https://gcc.gnu.org/PR43881>,
401 we enable the warning only when not optimizing. */
402# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
403# define _GL_CXXALIASWARN_2(func,namespace) \
404 _GL_WARN_ON_USE (func, \
405 "The symbol ::" #func " refers to the system function. " \
406 "Use " #namespace "::" #func " instead.")
407# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING
408# define _GL_CXXALIASWARN_2(func,namespace) \
409 extern __typeof__ (func) func
410# else
411# define _GL_CXXALIASWARN_2(func,namespace) \
412 _GL_EXTERN_C int _gl_cxxalias_dummy
413# endif
414#else
415# define _GL_CXXALIASWARN(func) \
416 _GL_EXTERN_C int _gl_cxxalias_dummy
417#endif
418
419/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
420 causes a warning to be emitted when the given overloaded variant of ::func
421 is used but not when GNULIB_NAMESPACE::func is used. */
422#if defined __cplusplus && defined GNULIB_NAMESPACE
423# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
424 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
425 GNULIB_NAMESPACE)
426# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
427 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
428/* To work around GCC bug <https://gcc.gnu.org/PR43881>,
429 we enable the warning only when not optimizing. */
430# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
431# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
432 _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \
433 "The symbol ::" #func " refers to the system function. " \
434 "Use " #namespace "::" #func " instead.")
435# else
436# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
437 _GL_EXTERN_C int _gl_cxxalias_dummy
438# endif
439#else
440# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
441 _GL_EXTERN_C int _gl_cxxalias_dummy
442#endif
443
444#endif /* _GL_CXXDEFS_H */
445
446/* The definition of _GL_ARG_NONNULL is copied here. */
447/* A C macro for declaring that specific arguments must not be NULL.
448 Copyright (C) 2009-2025 Free Software Foundation, Inc.
449
450 This program is free software: you can redistribute it and/or modify it
451 under the terms of the GNU Lesser General Public License as published
452 by the Free Software Foundation; either version 2 of the License, or
453 (at your option) any later version.
454
455 This program is distributed in the hope that it will be useful,
456 but WITHOUT ANY WARRANTY; without even the implied warranty of
457 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
458 Lesser General Public License for more details.
459
460 You should have received a copy of the GNU Lesser General Public License
461 along with this program. If not, see <https://www.gnu.org/licenses/>. */
462
463/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
464 that the values passed as arguments n, ..., m must be non-NULL pointers.
465 n = 1 stands for the first argument, n = 2 for the second argument etc. */
466#ifndef _GL_ARG_NONNULL
467# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__
468# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
469# else
470# define _GL_ARG_NONNULL(params)
471# endif
472#endif
473
474/* The definition of _GL_WARN_ON_USE is copied here. */
475/* A C macro for emitting warnings if a function is used.
476 Copyright (C) 2010-2025 Free Software Foundation, Inc.
477
478 This program is free software: you can redistribute it and/or modify it
479 under the terms of the GNU Lesser General Public License as published
480 by the Free Software Foundation; either version 2 of the License, or
481 (at your option) any later version.
482
483 This program is distributed in the hope that it will be useful,
484 but WITHOUT ANY WARRANTY; without even the implied warranty of
485 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
486 Lesser General Public License for more details.
487
488 You should have received a copy of the GNU Lesser General Public License
489 along with this program. If not, see <https://www.gnu.org/licenses/>. */
490
491/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
492 for FUNCTION which will then trigger a compiler warning containing
493 the text of "literal string" anywhere that function is called, if
494 supported by the compiler. If the compiler does not support this
495 feature, the macro expands to an unused extern declaration.
496
497 _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
498 attribute used in _GL_WARN_ON_USE. If the compiler does not support
499 this feature, it expands to empty.
500
501 These macros are useful for marking a function as a potential
502 portability trap, with the intent that "literal string" include
503 instructions on the replacement function that should be used
504 instead.
505 _GL_WARN_ON_USE is for functions with 'extern' linkage.
506 _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
507 linkage.
508
509 _GL_WARN_ON_USE should not be used more than once for a given function
510 in a given compilation unit (because this may generate a warning even
511 if the function is never called).
512
513 However, one of the reasons that a function is a portability trap is
514 if it has the wrong signature. Declaring FUNCTION with a different
515 signature in C is a compilation error, so this macro must use the
516 same type as any existing declaration so that programs that avoid
517 the problematic FUNCTION do not fail to compile merely because they
518 included a header that poisoned the function. But this implies that
519 _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
520 have a declaration. Use of this macro implies that there must not
521 be any other macro hiding the declaration of FUNCTION; but
522 undefining FUNCTION first is part of the poisoning process anyway
523 (although for symbols that are provided only via a macro, the result
524 is a compilation error rather than a warning containing
525 "literal string"). Also note that in C++, it is only safe to use if
526 FUNCTION has no overloads.
527
528 For an example, it is possible to poison 'getline' by:
529 - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
530 [getline]) in configure.ac, which potentially defines
531 HAVE_RAW_DECL_GETLINE
532 - adding this code to a header that wraps the system <stdio.h>:
533 #undef getline
534 #if HAVE_RAW_DECL_GETLINE
535 _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
536 "not universally present; use the gnulib module getline");
537 #endif
538
539 It is not possible to directly poison global variables. But it is
540 possible to write a wrapper accessor function, and poison that
541 (less common usage, like &environ, will cause a compilation error
542 rather than issue the nice warning, but the end result of informing
543 the developer about their portability problem is still achieved):
544 #if HAVE_RAW_DECL_ENVIRON
545 static char ***
546 rpl_environ (void) { return &environ; }
547 _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
548 # undef environ
549 # define environ (*rpl_environ ())
550 #endif
551 or better (avoiding contradictory use of 'static' and 'extern'):
552 #if HAVE_RAW_DECL_ENVIRON
553 static char ***
554 _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
555 rpl_environ (void) { return &environ; }
556 # undef environ
557 # define environ (*rpl_environ ())
558 #endif
559 */
560#ifndef _GL_WARN_ON_USE
561
562# if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__
563/* A compiler attribute is available in gcc versions 4.3.0 and later. */
564# define _GL_WARN_ON_USE(function, message) \
565_GL_WARN_EXTERN_C __typeof__ (function) function __attribute__ ((__warning__ (message)))
566# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
567 __attribute__ ((__warning__ (message)))
568# elif __clang_major__ >= 4
569/* Another compiler attribute is available in clang. */
570# define _GL_WARN_ON_USE(function, message) \
571_GL_WARN_EXTERN_C __typeof__ (function) function \
572 __attribute__ ((__diagnose_if__ (1, message, "warning")))
573# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
574 __attribute__ ((__diagnose_if__ (1, message, "warning")))
575# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING
576/* Verify the existence of the function. */
577# define _GL_WARN_ON_USE(function, message) \
578_GL_WARN_EXTERN_C __typeof__ (function) function
579# define _GL_WARN_ON_USE_ATTRIBUTE(message)
580# else /* Unsupported. */
581# define _GL_WARN_ON_USE(function, message) \
582_GL_WARN_EXTERN_C int _gl_warn_on_use
583# define _GL_WARN_ON_USE_ATTRIBUTE(message)
584# endif
585#endif
586
587/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message")
588 is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the
589 function is declared with the given prototype, consisting of return type,
590 parameters, and attributes.
591 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
592 not work in this case. */
593#ifndef _GL_WARN_ON_USE_CXX
594# if !defined __cplusplus
595# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
596 _GL_WARN_ON_USE (function, msg)
597# else
598# if (4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)) && !defined __clang__
599/* A compiler attribute is available in gcc versions 4.3.0 and later. */
600# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
601extern rettype_gcc function parameters_and_attributes \
602 __attribute__ ((__warning__ (msg)))
603# elif __clang_major__ >= 4
604/* Another compiler attribute is available in clang. */
605# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
606extern rettype_clang function parameters_and_attributes \
607 __attribute__ ((__diagnose_if__ (1, msg, "warning")))
608# elif (__GNUC__ >= 3 || defined __clang__) && GNULIB_STRICT_CHECKING
609/* Verify the existence of the function. */
610# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
611extern rettype_gcc function parameters_and_attributes
612# else /* Unsupported. */
613# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
614_GL_WARN_EXTERN_C int _gl_warn_on_use
615# endif
616# endif
617#endif
618
619/* _GL_WARN_EXTERN_C declaration;
620 performs the declaration with C linkage. */
621#ifndef _GL_WARN_EXTERN_C
622# if defined __cplusplus
623# define _GL_WARN_EXTERN_C extern "C"
624# else
625# define _GL_WARN_EXTERN_C extern
626# endif
627#endif
628
629
630_GL_INLINE_HEADER_BEGIN
631
632
633#if !(defined __cplusplus ? 0 || 0 : 1)
634
635/* An 8-bit variant of wchar_t.
636 Note: This type is only mandated by ISO C 23 or newer, and it does
637 denote UTF-8 units. */
638typedef unsigned char char8_t;
639
640#elif 0
641
642typedef unsigned char gl_char8_t;
643# define char8_t gl_char8_t
644
645#endif
646
647#if !(defined __cplusplus ? 0 || 0 : 1)
648
649/* A 16-bit variant of wchar_t.
650 Note: This type is only mandated by ISO C 11 or newer. In ISO C 23
651 and newer, it denotes UTF-16 units; in older versions of ISO C it did
652 so only on platforms on which __STDC_UTF_16__ was defined. */
653typedef uint_least16_t char16_t;
654
655#elif 0
656
657typedef uint_least16_t gl_char16_t;
658# define char16_t gl_char16_t
659
660#endif
661
662#if !(defined __cplusplus ? 0 || 0 : 1)
663
664/* A 32-bit variant of wchar_t.
665 Note: This type is only mandated by ISO C 11 or newer. In ISO C 23
666 and newer, it denotes UTF-32 code points; in older versions of ISO C
667 it did so only on platforms on which __STDC_UTF_32__ was defined.
668 In gnulib, we guarantee that it denotes UTF-32 code points if and
669 only if the module 'uchar-h-c23' is in use. */
670typedef uint_least32_t char32_t;
671
672#elif 0
673
674typedef uint_least32_t gl_char32_t;
675# define char32_t gl_char32_t
676
677#endif
678
679/* Define if a 'char32_t' can hold more characters than a 'wchar_t'. */
680#if 0 /* 32-bit AIX, Cygwin, native Windows */
681# define _GL_SMALL_WCHAR_T 1
682#endif
683
684/* Define if 'wchar_t', like 'char32_t',
685 - is a 32-bit type, and
686 - represents Unicode code points.
687 For this test, we can use __STDC_ISO_10646__ (defined by glibc, musl libc,
688 Cygwin) but need to consider _GL_SMALL_WCHAR_T, so as to exclude Cygwin.
689 We cannot use __STDC_UTF_16__ or __STDC_UTF_32__
690 - because these macros provide info about char16_t and char32_t (not
691 wchar_t!), and
692 - because GCC >= 4.9 defines these macros on all platforms, even on
693 FreeBSD and Solaris.
694 We should better not use __STD_UTF_16__, __STD_UTF_32__ either, because
695 these macros are misspellings, only defined by Android's <uchar.h>. */
696#if defined __STDC_ISO_10646__ && !_GL_SMALL_WCHAR_T
697/* glibc, musl libc */
698# define _GL_WCHAR_T_IS_UCS4 1
699#endif
700#if _GL_WCHAR_T_IS_UCS4
701static_assert (sizeof (char32_t) == sizeof (wchar_t));
702#endif
703
704
705/* Convert a single-byte character to a 32-bit wide character. */
706#if 0
707# if _GL_WCHAR_T_IS_UCS4 && !defined IN_BTOC32
708_GL_BEGIN_C_LINKAGE
709_GL_INLINE _GL_ATTRIBUTE_PURE wint_t
710btoc32 (int c)
711{
712 return
713# if 1 && defined __cplusplus && defined GNULIB_NAMESPACE
714 GNULIB_NAMESPACE::
715# endif
716 btowc (c);
717}
718_GL_END_C_LINKAGE
719# else
720_GL_FUNCDECL_SYS (btoc32, wint_t, (int c), _GL_ATTRIBUTE_PURE);
721# endif
722_GL_CXXALIAS_SYS (btoc32, wint_t, (int c));
723_GL_CXXALIASWARN (btoc32);
724#endif
725
726
727/* Test a specific property of a 32-bit wide character. */
728#if 1
729# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISALNUM
730_GL_BEGIN_C_LINKAGE
731_GL_INLINE int
732c32isalnum (wint_t wc)
733{
734 return
735# if defined __cplusplus && defined GNULIB_NAMESPACE
736 GNULIB_NAMESPACE::
737# endif
738 iswalnum (wc);
739}
740_GL_END_C_LINKAGE
741# else
742_GL_FUNCDECL_SYS (c32isalnum, int, (wint_t wc), );
743# endif
744_GL_CXXALIAS_SYS (c32isalnum, int, (wint_t wc));
745_GL_CXXALIASWARN (c32isalnum);
746#endif
747#if 1
748# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISALPHA
749_GL_BEGIN_C_LINKAGE
750_GL_INLINE int
751c32isalpha (wint_t wc)
752{
753 return
754# if defined __cplusplus && defined GNULIB_NAMESPACE
755 GNULIB_NAMESPACE::
756# endif
757 iswalpha (wc);
758}
759_GL_END_C_LINKAGE
760# else
761_GL_FUNCDECL_SYS (c32isalpha, int, (wint_t wc), );
762# endif
763_GL_CXXALIAS_SYS (c32isalpha, int, (wint_t wc));
764_GL_CXXALIASWARN (c32isalpha);
765#endif
766#if 1
767# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISBLANK
768_GL_BEGIN_C_LINKAGE
769_GL_INLINE int
770c32isblank (wint_t wc)
771{
772 return
773# if defined __cplusplus && defined GNULIB_NAMESPACE
774 GNULIB_NAMESPACE::
775# endif
776 iswblank (wc);
777}
778_GL_END_C_LINKAGE
779# else
780_GL_FUNCDECL_SYS (c32isblank, int, (wint_t wc), );
781# endif
782_GL_CXXALIAS_SYS (c32isblank, int, (wint_t wc));
783_GL_CXXALIASWARN (c32isblank);
784#endif
785#if 1
786# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISCNTRL
787_GL_BEGIN_C_LINKAGE
788_GL_INLINE int
789c32iscntrl (wint_t wc)
790{
791 return
792# if defined __cplusplus && defined GNULIB_NAMESPACE
793 GNULIB_NAMESPACE::
794# endif
795 iswcntrl (wc);
796}
797_GL_END_C_LINKAGE
798# else
799_GL_FUNCDECL_SYS (c32iscntrl, int, (wint_t wc), );
800# endif
801_GL_CXXALIAS_SYS (c32iscntrl, int, (wint_t wc));
802_GL_CXXALIASWARN (c32iscntrl);
803#endif
804#if 1
805# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISDIGIT
806_GL_BEGIN_C_LINKAGE
807_GL_INLINE int
808c32isdigit (wint_t wc)
809{
810 return
811# if 1 && defined __cplusplus && defined GNULIB_NAMESPACE
812 GNULIB_NAMESPACE::
813# endif
814 iswdigit (wc);
815}
816_GL_END_C_LINKAGE
817# else
818_GL_FUNCDECL_SYS (c32isdigit, int, (wint_t wc), );
819# endif
820_GL_CXXALIAS_SYS (c32isdigit, int, (wint_t wc));
821_GL_CXXALIASWARN (c32isdigit);
822#endif
823#if 1
824# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISGRAPH
825_GL_BEGIN_C_LINKAGE
826_GL_INLINE int
827c32isgraph (wint_t wc)
828{
829 return
830# if defined __cplusplus && defined GNULIB_NAMESPACE
831 GNULIB_NAMESPACE::
832# endif
833 iswgraph (wc);
834}
835_GL_END_C_LINKAGE
836# else
837_GL_FUNCDECL_SYS (c32isgraph, int, (wint_t wc), );
838# endif
839_GL_CXXALIAS_SYS (c32isgraph, int, (wint_t wc));
840_GL_CXXALIASWARN (c32isgraph);
841#endif
842#if 1
843# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISLOWER
844_GL_BEGIN_C_LINKAGE
845_GL_INLINE int
846c32islower (wint_t wc)
847{
848 return
849# if defined __cplusplus && defined GNULIB_NAMESPACE
850 GNULIB_NAMESPACE::
851# endif
852 iswlower (wc);
853}
854_GL_END_C_LINKAGE
855# else
856_GL_FUNCDECL_SYS (c32islower, int, (wint_t wc), );
857# endif
858_GL_CXXALIAS_SYS (c32islower, int, (wint_t wc));
859_GL_CXXALIASWARN (c32islower);
860#endif
861#if 1
862# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISPRINT
863_GL_BEGIN_C_LINKAGE
864_GL_INLINE int
865c32isprint (wint_t wc)
866{
867 return
868# if defined __cplusplus && defined GNULIB_NAMESPACE
869 GNULIB_NAMESPACE::
870# endif
871 iswprint (wc);
872}
873_GL_END_C_LINKAGE
874# else
875_GL_FUNCDECL_SYS (c32isprint, int, (wint_t wc), );
876# endif
877_GL_CXXALIAS_SYS (c32isprint, int, (wint_t wc));
878_GL_CXXALIASWARN (c32isprint);
879#endif
880#if 1
881# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISPUNCT
882_GL_BEGIN_C_LINKAGE
883_GL_INLINE int
884c32ispunct (wint_t wc)
885{
886 return
887# if defined __cplusplus && defined GNULIB_NAMESPACE
888 GNULIB_NAMESPACE::
889# endif
890 iswpunct (wc);
891}
892_GL_END_C_LINKAGE
893# else
894_GL_FUNCDECL_SYS (c32ispunct, int, (wint_t wc), );
895# endif
896_GL_CXXALIAS_SYS (c32ispunct, int, (wint_t wc));
897_GL_CXXALIASWARN (c32ispunct);
898#endif
899#if 1
900# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISSPACE
901_GL_BEGIN_C_LINKAGE
902_GL_INLINE int
903c32isspace (wint_t wc)
904{
905 return
906# if defined __cplusplus && defined GNULIB_NAMESPACE
907 GNULIB_NAMESPACE::
908# endif
909 iswspace (wc);
910}
911_GL_END_C_LINKAGE
912# else
913_GL_FUNCDECL_SYS (c32isspace, int, (wint_t wc), );
914# endif
915_GL_CXXALIAS_SYS (c32isspace, int, (wint_t wc));
916_GL_CXXALIASWARN (c32isspace);
917#endif
918#if 1
919# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISUPPER
920_GL_BEGIN_C_LINKAGE
921_GL_INLINE int
922c32isupper (wint_t wc)
923{
924 return
925# if defined __cplusplus && defined GNULIB_NAMESPACE
926 GNULIB_NAMESPACE::
927# endif
928 iswupper (wc);
929}
930_GL_END_C_LINKAGE
931# else
932_GL_FUNCDECL_SYS (c32isupper, int, (wint_t wc), );
933# endif
934_GL_CXXALIAS_SYS (c32isupper, int, (wint_t wc));
935_GL_CXXALIASWARN (c32isupper);
936#endif
937#if 1
938# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32ISXDIGIT
939_GL_BEGIN_C_LINKAGE
940_GL_INLINE int
941c32isxdigit (wint_t wc)
942{
943 return
944# if 1 && defined __cplusplus && defined GNULIB_NAMESPACE
945 GNULIB_NAMESPACE::
946# endif
947 iswxdigit (wc);
948}
949_GL_END_C_LINKAGE
950# else
951_GL_FUNCDECL_SYS (c32isxdigit, int, (wint_t wc), );
952# endif
953_GL_CXXALIAS_SYS (c32isxdigit, int, (wint_t wc));
954_GL_CXXALIASWARN (c32isxdigit);
955#endif
956
957
958/* Case mapping of a 32-bit wide character. */
959#if 1
960# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32TOLOWER
961_GL_BEGIN_C_LINKAGE
962_GL_INLINE wint_t
963c32tolower (wint_t wc)
964{
965 return
966# if defined __cplusplus && defined GNULIB_NAMESPACE
967 GNULIB_NAMESPACE::
968# endif
969 towlower (wc);
970}
971_GL_END_C_LINKAGE
972# else
973_GL_FUNCDECL_SYS (c32tolower, wint_t, (wint_t wc), );
974# endif
975_GL_CXXALIAS_SYS (c32tolower, wint_t, (wint_t wc));
976_GL_CXXALIASWARN (c32tolower);
977#endif
978#if 0
979# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32TOUPPER
980_GL_BEGIN_C_LINKAGE
981_GL_INLINE wint_t
982c32toupper (wint_t wc)
983{
984 return
985# if defined __cplusplus && defined GNULIB_NAMESPACE
986 GNULIB_NAMESPACE::
987# endif
988 towupper (wc);
989}
990_GL_END_C_LINKAGE
991# else
992_GL_FUNCDECL_SYS (c32toupper, wint_t, (wint_t wc), );
993# endif
994_GL_CXXALIAS_SYS (c32toupper, wint_t, (wint_t wc));
995_GL_CXXALIASWARN (c32toupper);
996#endif
997
998
999/* Number of screen columns needed for a 32-bit wide character. */
1000#if 1
1001# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32WIDTH
1002_GL_BEGIN_C_LINKAGE
1003_GL_INLINE int
1004c32width (char32_t wc)
1005{
1006 return
1007# if 1 && defined __cplusplus && defined GNULIB_NAMESPACE
1008 GNULIB_NAMESPACE::
1009# endif
1010 wcwidth (wc);
1011}
1012_GL_END_C_LINKAGE
1013# else
1014_GL_FUNCDECL_SYS (c32width, int, (char32_t wc), );
1015# endif
1016_GL_CXXALIAS_SYS (c32width, int, (char32_t wc));
1017_GL_CXXALIASWARN (c32width);
1018#endif
1019
1020
1021/* Converts a 32-bit wide character to a multibyte character. */
1022#if 0
1023# if 0
1024# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1025# undef c32rtomb
1026# define c32rtomb rpl_c32rtomb
1027# endif
1028_GL_FUNCDECL_RPL (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps), );
1029_GL_CXXALIAS_RPL (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps));
1030# else
1031# if !1
1032_GL_FUNCDECL_SYS (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps), );
1033# endif
1034_GL_CXXALIAS_SYS (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps));
1035# endif
1036# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
1037_GL_CXXALIASWARN (c32rtomb);
1038# endif
1039#elif defined GNULIB_POSIXCHECK
1040# if HAVE_RAW_DECL_C32RTOMB
1041_GL_WARN_ON_USE (c32rtomb, "c32rtomb is not portable - "
1042 "use gnulib module c32rtomb for portability");
1043# endif
1044#endif
1045
1046
1047/* Convert a 32-bit wide string to a string. */
1048#if 0
1049# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32SNRTOMBS
1050_GL_BEGIN_C_LINKAGE
1051_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
1052c32snrtombs (char *dest, const char32_t **srcp, size_t srclen, size_t len,
1053 mbstate_t *ps)
1054{
1055 return
1056# if 0 && defined __cplusplus && defined GNULIB_NAMESPACE
1057 GNULIB_NAMESPACE::
1058# endif
1059 wcsnrtombs (dest, (const wchar_t **) srcp, srclen, len, ps);
1060}
1061_GL_END_C_LINKAGE
1062# else
1063_GL_FUNCDECL_SYS (c32snrtombs, size_t,
1064 (char *dest, const char32_t **srcp, size_t srclen, size_t len,
1065 mbstate_t *ps),
1066 _GL_ARG_NONNULL ((2)));
1067# endif
1068_GL_CXXALIAS_SYS (c32snrtombs, size_t,
1069 (char *dest, const char32_t **srcp, size_t srclen, size_t len,
1070 mbstate_t *ps));
1071_GL_CXXALIASWARN (c32snrtombs);
1072#endif
1073
1074
1075/* Convert a 32-bit wide string to a string. */
1076#if 0
1077# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32SRTOMBS
1078_GL_BEGIN_C_LINKAGE
1079_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
1080c32srtombs (char *dest, const char32_t **srcp, size_t len, mbstate_t *ps)
1081{
1082 return
1083# if 0 && defined __cplusplus && defined GNULIB_NAMESPACE
1084 GNULIB_NAMESPACE::
1085# endif
1086 wcsrtombs (dest, (const wchar_t **) srcp, len, ps);
1087}
1088_GL_END_C_LINKAGE
1089# else
1090_GL_FUNCDECL_SYS (c32srtombs, size_t,
1091 (char *dest, const char32_t **srcp, size_t len,
1092 mbstate_t *ps),
1093 _GL_ARG_NONNULL ((2)));
1094# endif
1095_GL_CXXALIAS_SYS (c32srtombs, size_t,
1096 (char *dest, const char32_t **srcp, size_t len,
1097 mbstate_t *ps));
1098_GL_CXXALIASWARN (c32srtombs);
1099#endif
1100
1101
1102/* Convert a 32-bit wide string to a string. */
1103#if 0
1104# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32STOMBS
1105_GL_BEGIN_C_LINKAGE
1106_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
1107c32stombs (char *dest, const char32_t *src, size_t len)
1108{
1109 mbstate_t state;
1110
1111 mbszero (&state);
1112 return c32srtombs (dest, &src, len, &state);
1113}
1114_GL_END_C_LINKAGE
1115# else
1116_GL_FUNCDECL_SYS (c32stombs, size_t,
1117 (char *dest, const char32_t *src, size_t len),
1118 _GL_ARG_NONNULL ((2)));
1119# endif
1120_GL_CXXALIAS_SYS (c32stombs, size_t,
1121 (char *dest, const char32_t *src, size_t len));
1122_GL_CXXALIASWARN (c32stombs);
1123#endif
1124
1125
1126/* Number of screen columns needed for a size-bounded 32-bit wide string. */
1127#if 0
1128# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32SWIDTH
1129_GL_BEGIN_C_LINKAGE
1130_GL_INLINE _GL_ARG_NONNULL ((1)) int
1131c32swidth (const char32_t *s, size_t n)
1132{
1133 return
1134# if 0 && defined __cplusplus && defined GNULIB_NAMESPACE
1135 GNULIB_NAMESPACE::
1136# endif
1137 wcswidth ((const wchar_t *) s, n);
1138}
1139_GL_END_C_LINKAGE
1140# else
1141_GL_FUNCDECL_SYS (c32swidth, int, (const char32_t *s, size_t n),
1142 _GL_ARG_NONNULL ((1)));
1143# endif
1144_GL_CXXALIAS_SYS (c32swidth, int, (const char32_t *s, size_t n));
1145_GL_CXXALIASWARN (c32swidth);
1146#endif
1147
1148
1149/* Converts a 32-bit wide character to unibyte character.
1150 Returns the single-byte representation of WC if it exists,
1151 or EOF otherwise. */
1152#if 0
1153# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32TOB
1154_GL_BEGIN_C_LINKAGE
1155_GL_INLINE int
1156c32tob (wint_t wc)
1157{
1158 return
1159# if 0 && defined __cplusplus && defined GNULIB_NAMESPACE
1160 GNULIB_NAMESPACE::
1161# endif
1162 wctob (wc);
1163}
1164_GL_END_C_LINKAGE
1165# else
1166_GL_FUNCDECL_SYS (c32tob, int, (wint_t wc), );
1167# endif
1168_GL_CXXALIAS_SYS (c32tob, int, (wint_t wc));
1169_GL_CXXALIASWARN (c32tob);
1170#endif
1171
1172
1173/* Converts a multibyte character to a 32-bit wide character. */
1174#if 1
1175# if 1
1176# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1177# undef mbrtoc32
1178# define mbrtoc32 rpl_mbrtoc32
1179# endif
1180_GL_FUNCDECL_RPL (mbrtoc32, size_t,
1181 (char32_t *pc, const char *s, size_t n, mbstate_t *ps), );
1182_GL_CXXALIAS_RPL (mbrtoc32, size_t,
1183 (char32_t *pc, const char *s, size_t n, mbstate_t *ps));
1184# else
1185# if !1
1186_GL_FUNCDECL_SYS (mbrtoc32, size_t,
1187 (char32_t *pc, const char *s, size_t n, mbstate_t *ps), );
1188# endif
1189_GL_CXXALIAS_SYS (mbrtoc32, size_t,
1190 (char32_t *pc, const char *s, size_t n, mbstate_t *ps));
1191# endif
1192# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
1193_GL_CXXALIASWARN (mbrtoc32);
1194# endif
1195#elif defined GNULIB_POSIXCHECK
1196# if HAVE_RAW_DECL_MBRTOC32
1197_GL_WARN_ON_USE (mbrtoc32, "mbrtoc32 is not portable - "
1198 "use gnulib module mbrtoc32 for portability");
1199# endif
1200#endif
1201
1202
1203/* Converts a multibyte character and returns the next 16-bit wide
1204 character. */
1205#if 0
1206# if 0
1207# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1208# undef mbrtoc16
1209# define mbrtoc16 rpl_mbrtoc16
1210# endif
1211_GL_FUNCDECL_RPL (mbrtoc16, size_t,
1212 (char16_t *pc, const char *s, size_t n, mbstate_t *ps), );
1213_GL_CXXALIAS_RPL (mbrtoc16, size_t,
1214 (char16_t *pc, const char *s, size_t n, mbstate_t *ps));
1215# else
1216# if !1
1217_GL_FUNCDECL_SYS (mbrtoc16, size_t,
1218 (char16_t *pc, const char *s, size_t n, mbstate_t *ps), );
1219# endif
1220_GL_CXXALIAS_SYS (mbrtoc16, size_t,
1221 (char16_t *pc, const char *s, size_t n, mbstate_t *ps));
1222# endif
1223# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
1224_GL_CXXALIASWARN (mbrtoc16);
1225# endif
1226#elif defined GNULIB_POSIXCHECK
1227# if HAVE_RAW_DECL_MBRTOC16
1228_GL_WARN_ON_USE (mbrtoc16, "mbrtoc16 is not portable - "
1229 "use gnulib module mbrtoc16 for portability");
1230# endif
1231#endif
1232
1233
1234/* Convert a string to a 32-bit wide string. */
1235#if 0
1236# if _GL_WCHAR_T_IS_UCS4 && !defined IN_MBSNRTOC32S
1237_GL_BEGIN_C_LINKAGE
1238_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
1239mbsnrtoc32s (char32_t *dest, const char **srcp, size_t srclen, size_t len,
1240 mbstate_t *ps)
1241{
1242 return
1243# if 0 && defined __cplusplus && defined GNULIB_NAMESPACE
1244 GNULIB_NAMESPACE::
1245# endif
1246 mbsnrtowcs ((wchar_t *) dest, srcp, srclen, len, ps);
1247}
1248_GL_END_C_LINKAGE
1249# else
1250_GL_FUNCDECL_SYS (mbsnrtoc32s, size_t,
1251 (char32_t *dest, const char **srcp, size_t srclen, size_t len,
1252 mbstate_t *ps),
1253 _GL_ARG_NONNULL ((2)));
1254# endif
1255_GL_CXXALIAS_SYS (mbsnrtoc32s, size_t,
1256 (char32_t *dest, const char **srcp, size_t srclen, size_t len,
1257 mbstate_t *ps));
1258_GL_CXXALIASWARN (mbsnrtoc32s);
1259#endif
1260
1261
1262/* Convert a string to a 32-bit wide string. */
1263#if 0
1264# if _GL_WCHAR_T_IS_UCS4 && !defined IN_MBSRTOC32S
1265_GL_BEGIN_C_LINKAGE
1266_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
1267mbsrtoc32s (char32_t *dest, const char **srcp, size_t len, mbstate_t *ps)
1268{
1269 return
1270# if 0 && defined __cplusplus && defined GNULIB_NAMESPACE
1271 GNULIB_NAMESPACE::
1272# endif
1273 mbsrtowcs ((wchar_t *) dest, srcp, len, ps);
1274}
1275_GL_END_C_LINKAGE
1276# else
1277_GL_FUNCDECL_SYS (mbsrtoc32s, size_t,
1278 (char32_t *dest, const char **srcp, size_t len,
1279 mbstate_t *ps),
1280 _GL_ARG_NONNULL ((2)));
1281# endif
1282_GL_CXXALIAS_SYS (mbsrtoc32s, size_t,
1283 (char32_t *dest, const char **srcp, size_t len,
1284 mbstate_t *ps));
1285_GL_CXXALIASWARN (mbsrtoc32s);
1286#endif
1287
1288
1289/* Convert a string to a 32-bit wide string. */
1290#if 0
1291# if _GL_WCHAR_T_IS_UCS4 && !defined IN_MBSTOC32S
1292_GL_BEGIN_C_LINKAGE
1293_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
1294mbstoc32s (char32_t *dest, const char *src, size_t len)
1295{
1296 mbstate_t state;
1297
1298 mbszero (&state);
1299 return mbsrtoc32s (dest, &src, len, &state);
1300}
1301_GL_END_C_LINKAGE
1302# else
1303_GL_FUNCDECL_SYS (mbstoc32s, size_t,
1304 (char32_t *dest, const char *src, size_t len),
1305 _GL_ARG_NONNULL ((2)));
1306# endif
1307_GL_CXXALIAS_SYS (mbstoc32s, size_t,
1308 (char32_t *dest, const char *src, size_t len));
1309_GL_CXXALIASWARN (mbstoc32s);
1310#endif
1311
1312
1313#if 0 || 0
1314/* A scalar type. Instances of this type, other than (c32_type_test_t) 0,
1315 represent a character property, sometimes also viewed as a "character class".
1316 It can be applied to 32-bit wide characters. It is the counterpart of
1317 type 'wctype_t' for wide characters.
1318 To test whether a given character has a certain property, use the function
1319 'c32_apply_type_test'. */
1320# if _GL_WCHAR_T_IS_UCS4
1321typedef wctype_t c32_type_test_t;
1322# else
1323typedef /*bool*/int (*c32_type_test_t) (wint_t wc);
1324# endif
1325#endif
1326
1327/* Return a character property with the given name, or (c32_type_test_t) 0
1328 if the designated property does not exist.
1329 This function is the counterpart of function 'wctype' for wide characters.
1330 */
1331#if 0
1332# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_GET_TYPE_TEST
1333_GL_BEGIN_C_LINKAGE
1334_GL_INLINE _GL_ARG_NONNULL ((1)) c32_type_test_t
1335c32_get_type_test (const char *name)
1336{
1337 return
1338# if 1 && defined __cplusplus && defined GNULIB_NAMESPACE
1339 GNULIB_NAMESPACE::
1340# endif
1341 wctype (name);
1342}
1343_GL_END_C_LINKAGE
1344# else
1345_GL_FUNCDECL_SYS (c32_get_type_test, c32_type_test_t, (const char *name),
1346 _GL_ARG_NONNULL ((1)));
1347# endif
1348_GL_CXXALIAS_SYS (c32_get_type_test, c32_type_test_t, (const char *name));
1349_GL_CXXALIASWARN (c32_get_type_test);
1350#endif
1351
1352/* Test whether a given 32-bit wide character has the specified character
1353 property.
1354 Return non-zero if true, zero if false or if the argument is WEOF.
1355 This function is the counterpart of function 'iswctype' for wide characters.
1356 */
1357#if 0
1358# if _GL_WCHAR_T_IS_UCS4
1359# if !defined IN_C32_APPLY_TYPE_TEST
1360_GL_BEGIN_C_LINKAGE
1361_GL_INLINE int
1362c32_apply_type_test (wint_t wc, c32_type_test_t property)
1363{
1364 return
1365# if 1 && defined __cplusplus && defined GNULIB_NAMESPACE
1366 GNULIB_NAMESPACE::
1367# endif
1368 iswctype (wc, property);
1369}
1370_GL_END_C_LINKAGE
1371# else
1372_GL_FUNCDECL_SYS (c32_apply_type_test, int,
1373 (wint_t wc, c32_type_test_t property), );
1374# endif
1375# else
1376_GL_FUNCDECL_SYS (c32_apply_type_test, int,
1377 (wint_t wc, c32_type_test_t property),
1378 _GL_ARG_NONNULL ((2)));
1379# endif
1380_GL_CXXALIAS_SYS (c32_apply_type_test, int,
1381 (wint_t wc, c32_type_test_t property));
1382_GL_CXXALIASWARN (c32_apply_type_test);
1383#endif
1384
1385
1386#if 0 || 0
1387/* A scalar type. Instances of this type, other than (c32_mapping_t) 0,
1388 represent a character mapping. It can be applied to 32-bit wide characters.
1389 It is the counterpart of type 'wctrans_t' for wide characters.
1390 To apply a certain mapping to a given character, use the function
1391 'c32_apply_mapping'. */
1392# if _GL_WCHAR_T_IS_UCS4
1393typedef wctrans_t c32_mapping_t;
1394# else
1395typedef wint_t (*c32_mapping_t) (wint_t wc);
1396# endif
1397#endif
1398
1399/* Return a character mapping with the given name, or (c32_mapping_t) 0
1400 if the designated mapping does not exist.
1401 This function is the counterpart of function 'wctrans' for wide characters.
1402 */
1403#if 0
1404# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_GET_MAPPING
1405_GL_BEGIN_C_LINKAGE
1406_GL_INLINE _GL_ARG_NONNULL ((1)) c32_mapping_t
1407c32_get_mapping (const char *name)
1408{
1409 return
1410# if 0 && defined __cplusplus && defined GNULIB_NAMESPACE
1411 GNULIB_NAMESPACE::
1412# endif
1413 wctrans (name);
1414}
1415_GL_END_C_LINKAGE
1416# else
1417_GL_FUNCDECL_SYS (c32_get_mapping, c32_mapping_t, (const char *name),
1418 _GL_ARG_NONNULL ((1)));
1419# endif
1420_GL_CXXALIAS_SYS (c32_get_mapping, c32_mapping_t, (const char *name));
1421_GL_CXXALIASWARN (c32_get_mapping);
1422#endif
1423
1424/* Apply the specified character mapping to a given 32-bit wide character.
1425 Return the result of this mapping. Return the WC argument unchanged if it is
1426 WEOF.
1427 This function is the counterpart of function 'towctrans' for wide characters.
1428 */
1429#if 0
1430# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_APPLY_MAPPING
1431_GL_BEGIN_C_LINKAGE
1432_GL_INLINE _GL_ARG_NONNULL ((2)) wint_t
1433c32_apply_mapping (wint_t wc, c32_mapping_t mapping)
1434{
1435 return
1436# if 0 && defined __cplusplus && defined GNULIB_NAMESPACE
1437 GNULIB_NAMESPACE::
1438# endif
1439 towctrans (wc, mapping);
1440}
1441_GL_END_C_LINKAGE
1442# else
1443_GL_FUNCDECL_SYS (c32_apply_mapping, wint_t,
1444 (wint_t wc, c32_mapping_t mapping),
1445 _GL_ARG_NONNULL ((2)));
1446# endif
1447_GL_CXXALIAS_SYS (c32_apply_mapping, wint_t,
1448 (wint_t wc, c32_mapping_t mapping));
1449_GL_CXXALIASWARN (c32_apply_mapping);
1450#endif
1451
1452
1453_GL_INLINE_HEADER_END
1454
1455#endif /* _GL_UCHAR_H */
1456#endif /* _GL_UCHAR_H */
diff --git a/gl/uchar.in.h b/gl/uchar.in.h
new file mode 100644
index 00000000..9a65ac37
--- /dev/null
+++ b/gl/uchar.in.h
@@ -0,0 +1,912 @@
1/* <uchar.h> substitute - 16-bit and 32-bit wide character types.
2 Copyright (C) 2019-2025 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# undef c32rtomb
494# if HAVE_RAW_DECL_C32RTOMB
495_GL_WARN_ON_USE (c32rtomb, "c32rtomb is not portable - "
496 "use gnulib module c32rtomb for portability");
497# endif
498#endif
499
500
501/* Convert a 32-bit wide string to a string. */
502#if @GNULIB_C32SNRTOMBS@
503# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32SNRTOMBS
504_GL_BEGIN_C_LINKAGE
505_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
506c32snrtombs (char *dest, const char32_t **srcp, size_t srclen, size_t len,
507 mbstate_t *ps)
508{
509 return
510# if @GNULIB_WCSNRTOMBS@ && defined __cplusplus && defined GNULIB_NAMESPACE
511 GNULIB_NAMESPACE::
512# endif
513 wcsnrtombs (dest, (const wchar_t **) srcp, srclen, len, ps);
514}
515_GL_END_C_LINKAGE
516# else
517_GL_FUNCDECL_SYS (c32snrtombs, size_t,
518 (char *dest, const char32_t **srcp, size_t srclen, size_t len,
519 mbstate_t *ps),
520 _GL_ARG_NONNULL ((2)));
521# endif
522_GL_CXXALIAS_SYS (c32snrtombs, size_t,
523 (char *dest, const char32_t **srcp, size_t srclen, size_t len,
524 mbstate_t *ps));
525_GL_CXXALIASWARN (c32snrtombs);
526#endif
527
528
529/* Convert a 32-bit wide string to a string. */
530#if @GNULIB_C32SRTOMBS@
531# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32SRTOMBS
532_GL_BEGIN_C_LINKAGE
533_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
534c32srtombs (char *dest, const char32_t **srcp, size_t len, mbstate_t *ps)
535{
536 return
537# if @GNULIB_WCSRTOMBS@ && defined __cplusplus && defined GNULIB_NAMESPACE
538 GNULIB_NAMESPACE::
539# endif
540 wcsrtombs (dest, (const wchar_t **) srcp, len, ps);
541}
542_GL_END_C_LINKAGE
543# else
544_GL_FUNCDECL_SYS (c32srtombs, size_t,
545 (char *dest, const char32_t **srcp, size_t len,
546 mbstate_t *ps),
547 _GL_ARG_NONNULL ((2)));
548# endif
549_GL_CXXALIAS_SYS (c32srtombs, size_t,
550 (char *dest, const char32_t **srcp, size_t len,
551 mbstate_t *ps));
552_GL_CXXALIASWARN (c32srtombs);
553#endif
554
555
556/* Convert a 32-bit wide string to a string. */
557#if @GNULIB_C32STOMBS@
558# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32STOMBS
559_GL_BEGIN_C_LINKAGE
560_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
561c32stombs (char *dest, const char32_t *src, size_t len)
562{
563 mbstate_t state;
564
565 mbszero (&state);
566 return c32srtombs (dest, &src, len, &state);
567}
568_GL_END_C_LINKAGE
569# else
570_GL_FUNCDECL_SYS (c32stombs, size_t,
571 (char *dest, const char32_t *src, size_t len),
572 _GL_ARG_NONNULL ((2)));
573# endif
574_GL_CXXALIAS_SYS (c32stombs, size_t,
575 (char *dest, const char32_t *src, size_t len));
576_GL_CXXALIASWARN (c32stombs);
577#endif
578
579
580/* Number of screen columns needed for a size-bounded 32-bit wide string. */
581#if @GNULIB_C32SWIDTH@
582# if (_GL_WCHAR_T_IS_UCS4 && !GNULIB_defined_mbstate_t) && !defined IN_C32SWIDTH
583_GL_BEGIN_C_LINKAGE
584_GL_INLINE _GL_ARG_NONNULL ((1)) int
585c32swidth (const char32_t *s, size_t n)
586{
587 return
588# if @GNULIB_WCSWIDTH@ && defined __cplusplus && defined GNULIB_NAMESPACE
589 GNULIB_NAMESPACE::
590# endif
591 wcswidth ((const wchar_t *) s, n);
592}
593_GL_END_C_LINKAGE
594# else
595_GL_FUNCDECL_SYS (c32swidth, int, (const char32_t *s, size_t n),
596 _GL_ARG_NONNULL ((1)));
597# endif
598_GL_CXXALIAS_SYS (c32swidth, int, (const char32_t *s, size_t n));
599_GL_CXXALIASWARN (c32swidth);
600#endif
601
602
603/* Converts a 32-bit wide character to unibyte character.
604 Returns the single-byte representation of WC if it exists,
605 or EOF otherwise. */
606#if @GNULIB_C32TOB@
607# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32TOB
608_GL_BEGIN_C_LINKAGE
609_GL_INLINE int
610c32tob (wint_t wc)
611{
612 return
613# if @GNULIB_WCTOB@ && defined __cplusplus && defined GNULIB_NAMESPACE
614 GNULIB_NAMESPACE::
615# endif
616 wctob (wc);
617}
618_GL_END_C_LINKAGE
619# else
620_GL_FUNCDECL_SYS (c32tob, int, (wint_t wc), );
621# endif
622_GL_CXXALIAS_SYS (c32tob, int, (wint_t wc));
623_GL_CXXALIASWARN (c32tob);
624#endif
625
626
627/* Converts a multibyte character to a 32-bit wide character. */
628#if @GNULIB_MBRTOC32@
629# if @REPLACE_MBRTOC32@
630# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
631# undef mbrtoc32
632# define mbrtoc32 rpl_mbrtoc32
633# endif
634_GL_FUNCDECL_RPL (mbrtoc32, size_t,
635 (char32_t *pc, const char *s, size_t n, mbstate_t *ps), );
636_GL_CXXALIAS_RPL (mbrtoc32, size_t,
637 (char32_t *pc, const char *s, size_t n, mbstate_t *ps));
638# else
639# if !@HAVE_MBRTOC32@
640_GL_FUNCDECL_SYS (mbrtoc32, size_t,
641 (char32_t *pc, const char *s, size_t n, mbstate_t *ps), );
642# endif
643_GL_CXXALIAS_SYS (mbrtoc32, size_t,
644 (char32_t *pc, const char *s, size_t n, mbstate_t *ps));
645# endif
646# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
647_GL_CXXALIASWARN (mbrtoc32);
648# endif
649#elif defined GNULIB_POSIXCHECK
650# undef mbrtoc32
651# if HAVE_RAW_DECL_MBRTOC32
652_GL_WARN_ON_USE (mbrtoc32, "mbrtoc32 is not portable - "
653 "use gnulib module mbrtoc32 for portability");
654# endif
655#endif
656
657
658/* Converts a multibyte character and returns the next 16-bit wide
659 character. */
660#if @GNULIB_MBRTOC16@
661# if @REPLACE_MBRTOC16@
662# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
663# undef mbrtoc16
664# define mbrtoc16 rpl_mbrtoc16
665# endif
666_GL_FUNCDECL_RPL (mbrtoc16, size_t,
667 (char16_t *pc, const char *s, size_t n, mbstate_t *ps), );
668_GL_CXXALIAS_RPL (mbrtoc16, size_t,
669 (char16_t *pc, const char *s, size_t n, mbstate_t *ps));
670# else
671# if !@HAVE_MBRTOC16@
672_GL_FUNCDECL_SYS (mbrtoc16, size_t,
673 (char16_t *pc, const char *s, size_t n, mbstate_t *ps), );
674# endif
675_GL_CXXALIAS_SYS (mbrtoc16, size_t,
676 (char16_t *pc, const char *s, size_t n, mbstate_t *ps));
677# endif
678# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
679_GL_CXXALIASWARN (mbrtoc16);
680# endif
681#elif defined GNULIB_POSIXCHECK
682# undef mbrtoc16
683# if HAVE_RAW_DECL_MBRTOC16
684_GL_WARN_ON_USE (mbrtoc16, "mbrtoc16 is not portable - "
685 "use gnulib module mbrtoc16 for portability");
686# endif
687#endif
688
689
690/* Convert a string to a 32-bit wide string. */
691#if @GNULIB_MBSNRTOC32S@
692# if _GL_WCHAR_T_IS_UCS4 && !defined IN_MBSNRTOC32S
693_GL_BEGIN_C_LINKAGE
694_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
695mbsnrtoc32s (char32_t *dest, const char **srcp, size_t srclen, size_t len,
696 mbstate_t *ps)
697{
698 return
699# if @GNULIB_MBSNRTOWCS@ && defined __cplusplus && defined GNULIB_NAMESPACE
700 GNULIB_NAMESPACE::
701# endif
702 mbsnrtowcs ((wchar_t *) dest, srcp, srclen, len, ps);
703}
704_GL_END_C_LINKAGE
705# else
706_GL_FUNCDECL_SYS (mbsnrtoc32s, size_t,
707 (char32_t *dest, const char **srcp, size_t srclen, size_t len,
708 mbstate_t *ps),
709 _GL_ARG_NONNULL ((2)));
710# endif
711_GL_CXXALIAS_SYS (mbsnrtoc32s, size_t,
712 (char32_t *dest, const char **srcp, size_t srclen, size_t len,
713 mbstate_t *ps));
714_GL_CXXALIASWARN (mbsnrtoc32s);
715#endif
716
717
718/* Convert a string to a 32-bit wide string. */
719#if @GNULIB_MBSRTOC32S@
720# if _GL_WCHAR_T_IS_UCS4 && !defined IN_MBSRTOC32S
721_GL_BEGIN_C_LINKAGE
722_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
723mbsrtoc32s (char32_t *dest, const char **srcp, size_t len, mbstate_t *ps)
724{
725 return
726# if @GNULIB_MBSRTOWCS@ && defined __cplusplus && defined GNULIB_NAMESPACE
727 GNULIB_NAMESPACE::
728# endif
729 mbsrtowcs ((wchar_t *) dest, srcp, len, ps);
730}
731_GL_END_C_LINKAGE
732# else
733_GL_FUNCDECL_SYS (mbsrtoc32s, size_t,
734 (char32_t *dest, const char **srcp, size_t len,
735 mbstate_t *ps),
736 _GL_ARG_NONNULL ((2)));
737# endif
738_GL_CXXALIAS_SYS (mbsrtoc32s, size_t,
739 (char32_t *dest, const char **srcp, size_t len,
740 mbstate_t *ps));
741_GL_CXXALIASWARN (mbsrtoc32s);
742#endif
743
744
745/* Convert a string to a 32-bit wide string. */
746#if @GNULIB_MBSTOC32S@
747# if _GL_WCHAR_T_IS_UCS4 && !defined IN_MBSTOC32S
748_GL_BEGIN_C_LINKAGE
749_GL_INLINE _GL_ARG_NONNULL ((2)) size_t
750mbstoc32s (char32_t *dest, const char *src, size_t len)
751{
752 mbstate_t state;
753
754 mbszero (&state);
755 return mbsrtoc32s (dest, &src, len, &state);
756}
757_GL_END_C_LINKAGE
758# else
759_GL_FUNCDECL_SYS (mbstoc32s, size_t,
760 (char32_t *dest, const char *src, size_t len),
761 _GL_ARG_NONNULL ((2)));
762# endif
763_GL_CXXALIAS_SYS (mbstoc32s, size_t,
764 (char32_t *dest, const char *src, size_t len));
765_GL_CXXALIASWARN (mbstoc32s);
766#endif
767
768
769#if @GNULIB_C32_GET_TYPE_TEST@ || @GNULIB_C32_APPLY_TYPE_TEST@
770/* A scalar type. Instances of this type, other than (c32_type_test_t) 0,
771 represent a character property, sometimes also viewed as a "character class".
772 It can be applied to 32-bit wide characters. It is the counterpart of
773 type 'wctype_t' for wide characters.
774 To test whether a given character has a certain property, use the function
775 'c32_apply_type_test'. */
776# if _GL_WCHAR_T_IS_UCS4
777typedef wctype_t c32_type_test_t;
778# else
779typedef /*bool*/int (*c32_type_test_t) (wint_t wc);
780# endif
781#endif
782
783/* Return a character property with the given name, or (c32_type_test_t) 0
784 if the designated property does not exist.
785 This function is the counterpart of function 'wctype' for wide characters.
786 */
787#if @GNULIB_C32_GET_TYPE_TEST@
788# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_GET_TYPE_TEST
789_GL_BEGIN_C_LINKAGE
790_GL_INLINE _GL_ARG_NONNULL ((1)) c32_type_test_t
791c32_get_type_test (const char *name)
792{
793 return
794# if @GNULIB_WCTYPE@ && defined __cplusplus && defined GNULIB_NAMESPACE
795 GNULIB_NAMESPACE::
796# endif
797 wctype (name);
798}
799_GL_END_C_LINKAGE
800# else
801_GL_FUNCDECL_SYS (c32_get_type_test, c32_type_test_t, (const char *name),
802 _GL_ARG_NONNULL ((1)));
803# endif
804_GL_CXXALIAS_SYS (c32_get_type_test, c32_type_test_t, (const char *name));
805_GL_CXXALIASWARN (c32_get_type_test);
806#endif
807
808/* Test whether a given 32-bit wide character has the specified character
809 property.
810 Return non-zero if true, zero if false or if the argument is WEOF.
811 This function is the counterpart of function 'iswctype' for wide characters.
812 */
813#if @GNULIB_C32_APPLY_TYPE_TEST@
814# if _GL_WCHAR_T_IS_UCS4
815# if !defined IN_C32_APPLY_TYPE_TEST
816_GL_BEGIN_C_LINKAGE
817_GL_INLINE int
818c32_apply_type_test (wint_t wc, c32_type_test_t property)
819{
820 return
821# if @GNULIB_ISWCTYPE@ && defined __cplusplus && defined GNULIB_NAMESPACE
822 GNULIB_NAMESPACE::
823# endif
824 iswctype (wc, property);
825}
826_GL_END_C_LINKAGE
827# else
828_GL_FUNCDECL_SYS (c32_apply_type_test, int,
829 (wint_t wc, c32_type_test_t property), );
830# endif
831# else
832_GL_FUNCDECL_SYS (c32_apply_type_test, int,
833 (wint_t wc, c32_type_test_t property),
834 _GL_ARG_NONNULL ((2)));
835# endif
836_GL_CXXALIAS_SYS (c32_apply_type_test, int,
837 (wint_t wc, c32_type_test_t property));
838_GL_CXXALIASWARN (c32_apply_type_test);
839#endif
840
841
842#if @GNULIB_C32_GET_MAPPING@ || @GNULIB_C32_APPLY_MAPPING@
843/* A scalar type. Instances of this type, other than (c32_mapping_t) 0,
844 represent a character mapping. It can be applied to 32-bit wide characters.
845 It is the counterpart of type 'wctrans_t' for wide characters.
846 To apply a certain mapping to a given character, use the function
847 'c32_apply_mapping'. */
848# if _GL_WCHAR_T_IS_UCS4
849typedef wctrans_t c32_mapping_t;
850# else
851typedef wint_t (*c32_mapping_t) (wint_t wc);
852# endif
853#endif
854
855/* Return a character mapping with the given name, or (c32_mapping_t) 0
856 if the designated mapping does not exist.
857 This function is the counterpart of function 'wctrans' for wide characters.
858 */
859#if @GNULIB_C32_GET_MAPPING@
860# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_GET_MAPPING
861_GL_BEGIN_C_LINKAGE
862_GL_INLINE _GL_ARG_NONNULL ((1)) c32_mapping_t
863c32_get_mapping (const char *name)
864{
865 return
866# if @GNULIB_WCTRANS@ && defined __cplusplus && defined GNULIB_NAMESPACE
867 GNULIB_NAMESPACE::
868# endif
869 wctrans (name);
870}
871_GL_END_C_LINKAGE
872# else
873_GL_FUNCDECL_SYS (c32_get_mapping, c32_mapping_t, (const char *name),
874 _GL_ARG_NONNULL ((1)));
875# endif
876_GL_CXXALIAS_SYS (c32_get_mapping, c32_mapping_t, (const char *name));
877_GL_CXXALIASWARN (c32_get_mapping);
878#endif
879
880/* Apply the specified character mapping to a given 32-bit wide character.
881 Return the result of this mapping. Return the WC argument unchanged if it is
882 WEOF.
883 This function is the counterpart of function 'towctrans' for wide characters.
884 */
885#if @GNULIB_C32_APPLY_MAPPING@
886# if _GL_WCHAR_T_IS_UCS4 && !defined IN_C32_APPLY_MAPPING
887_GL_BEGIN_C_LINKAGE
888_GL_INLINE _GL_ARG_NONNULL ((2)) wint_t
889c32_apply_mapping (wint_t wc, c32_mapping_t mapping)
890{
891 return
892# if @GNULIB_TOWCTRANS@ && defined __cplusplus && defined GNULIB_NAMESPACE
893 GNULIB_NAMESPACE::
894# endif
895 towctrans (wc, mapping);
896}
897_GL_END_C_LINKAGE
898# else
899_GL_FUNCDECL_SYS (c32_apply_mapping, wint_t,
900 (wint_t wc, c32_mapping_t mapping),
901 _GL_ARG_NONNULL ((2)));
902# endif
903_GL_CXXALIAS_SYS (c32_apply_mapping, wint_t,
904 (wint_t wc, c32_mapping_t mapping));
905_GL_CXXALIASWARN (c32_apply_mapping);
906#endif
907
908
909_GL_INLINE_HEADER_END
910
911#endif /* _@GUARD_PREFIX@_UCHAR_H */
912#endif /* _@GUARD_PREFIX@_UCHAR_H */
diff --git a/gl/unicase.h b/gl/unicase.h
new file mode 100644
index 00000000..507a83d0
--- /dev/null
+++ b/gl/unicase.h
@@ -0,0 +1,472 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* Unicode character case mappings.
3 Copyright (C) 2002, 2009-2025 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#ifndef _UNICASE_H
19#define _UNICASE_H
20
21#include "unitypes.h"
22
23/* Get bool. */
24#include <stdbool.h>
25
26/* Get size_t. */
27#include <stddef.h>
28
29/* Get uninorm_t. */
30#include "uninorm.h"
31
32#if 0
33# include <unistring/woe32dll.h>
34#else
35# define LIBUNISTRING_DLL_VARIABLE
36#endif
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42/* ========================================================================= */
43
44/* Character case mappings.
45 These mappings are locale and context independent.
46 WARNING! These functions are not sufficient for languages such as German.
47 Better use the functions below that treat an entire string at once and are
48 language aware. */
49
50/* Return the uppercase mapping of a Unicode character. */
51extern ucs4_t
52 uc_toupper (ucs4_t uc)
53 _UC_ATTRIBUTE_CONST;
54
55/* Return the lowercase mapping of a Unicode character. */
56extern ucs4_t
57 uc_tolower (ucs4_t uc)
58 _UC_ATTRIBUTE_CONST;
59
60/* Return the titlecase mapping of a Unicode character. */
61extern ucs4_t
62 uc_totitle (ucs4_t uc)
63 _UC_ATTRIBUTE_CONST;
64
65/* ========================================================================= */
66
67/* String case mappings. */
68
69/* These functions are locale dependent. The iso639_language argument
70 identifies the language (e.g. "tr" for Turkish). NULL means to use
71 locale independent case mappings. */
72
73/* Return the ISO 639 language code of the current locale.
74 Return "" if it is unknown, or in the "C" locale. */
75extern const char *
76 uc_locale_language (void)
77 _UC_ATTRIBUTE_PURE;
78
79/* Conventions:
80
81 All functions prefixed with u8_ operate on UTF-8 encoded strings.
82 Their unit is an uint8_t (1 byte).
83
84 All functions prefixed with u16_ operate on UTF-16 encoded strings.
85 Their unit is an uint16_t (a 2-byte word).
86
87 All functions prefixed with u32_ operate on UCS-4 encoded strings.
88 Their unit is an uint32_t (a 4-byte word).
89
90 All argument pairs (s, n) denote a Unicode string s[0..n-1] with exactly
91 n units.
92
93 Functions returning a string result take a (resultbuf, lengthp) argument
94 pair. If resultbuf is not NULL and the result fits into *lengthp units,
95 it is put in resultbuf, and resultbuf is returned. Otherwise, a freshly
96 allocated string is returned. In both cases, *lengthp is set to the
97 length (number of units) of the returned string. In case of error,
98 NULL is returned and errno is set. */
99
100/* Return the uppercase mapping of a string.
101 The nf argument identifies the normalization form to apply after the
102 case-mapping. It can also be NULL, for no normalization. */
103extern uint8_t *
104 u8_toupper (const uint8_t *s, size_t n, const char *iso639_language,
105 uninorm_t nf,
106 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
107extern uint16_t *
108 u16_toupper (const uint16_t *s, size_t n, const char *iso639_language,
109 uninorm_t nf,
110 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
111extern uint32_t *
112 u32_toupper (const uint32_t *s, size_t n, const char *iso639_language,
113 uninorm_t nf,
114 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
115
116/* Return the lowercase mapping of a string.
117 The nf argument identifies the normalization form to apply after the
118 case-mapping. It can also be NULL, for no normalization. */
119extern uint8_t *
120 u8_tolower (const uint8_t *s, size_t n, const char *iso639_language,
121 uninorm_t nf,
122 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
123extern uint16_t *
124 u16_tolower (const uint16_t *s, size_t n, const char *iso639_language,
125 uninorm_t nf,
126 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
127extern uint32_t *
128 u32_tolower (const uint32_t *s, size_t n, const char *iso639_language,
129 uninorm_t nf,
130 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
131
132/* Return the titlecase mapping of a string.
133 The nf argument identifies the normalization form to apply after the
134 case-mapping. It can also be NULL, for no normalization. */
135extern uint8_t *
136 u8_totitle (const uint8_t *s, size_t n, const char *iso639_language,
137 uninorm_t nf,
138 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
139extern uint16_t *
140 u16_totitle (const uint16_t *s, size_t n, const char *iso639_language,
141 uninorm_t nf,
142 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
143extern uint32_t *
144 u32_totitle (const uint32_t *s, size_t n, const char *iso639_language,
145 uninorm_t nf,
146 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
147
148/* The case-mapping context given by a prefix string. */
149typedef struct casing_prefix_context
150 {
151 /* These fields are private, undocumented. */
152 uint32_t last_char_except_ignorable;
153 uint32_t last_char_normal_or_above;
154 }
155 casing_prefix_context_t;
156/* The case-mapping context of the empty prefix string. */
157extern LIBUNISTRING_DLL_VARIABLE const casing_prefix_context_t unicase_empty_prefix_context;
158/* Return the case-mapping context of a given prefix string. */
159extern casing_prefix_context_t
160 u8_casing_prefix_context (const uint8_t *s, size_t n);
161extern casing_prefix_context_t
162 u16_casing_prefix_context (const uint16_t *s, size_t n);
163extern casing_prefix_context_t
164 u32_casing_prefix_context (const uint32_t *s, size_t n);
165/* Return the case-mapping context of the prefix concat(A, S), given the
166 case-mapping context of the prefix A. */
167extern casing_prefix_context_t
168 u8_casing_prefixes_context (const uint8_t *s, size_t n,
169 casing_prefix_context_t a_context);
170extern casing_prefix_context_t
171 u16_casing_prefixes_context (const uint16_t *s, size_t n,
172 casing_prefix_context_t a_context);
173extern casing_prefix_context_t
174 u32_casing_prefixes_context (const uint32_t *s, size_t n,
175 casing_prefix_context_t a_context);
176
177/* The case-mapping context given by a suffix string. */
178typedef struct casing_suffix_context
179 {
180 /* These fields are private, undocumented. */
181 uint32_t first_char_except_ignorable;
182 uint32_t bits;
183 }
184 casing_suffix_context_t;
185/* The case-mapping context of the empty suffix string. */
186extern LIBUNISTRING_DLL_VARIABLE const casing_suffix_context_t unicase_empty_suffix_context;
187/* Return the case-mapping context of a given suffix string. */
188extern casing_suffix_context_t
189 u8_casing_suffix_context (const uint8_t *s, size_t n);
190extern casing_suffix_context_t
191 u16_casing_suffix_context (const uint16_t *s, size_t n);
192extern casing_suffix_context_t
193 u32_casing_suffix_context (const uint32_t *s, size_t n);
194/* Return the case-mapping context of the suffix concat(S, A), given the
195 case-mapping context of the suffix A. */
196extern casing_suffix_context_t
197 u8_casing_suffixes_context (const uint8_t *s, size_t n,
198 casing_suffix_context_t a_context);
199extern casing_suffix_context_t
200 u16_casing_suffixes_context (const uint16_t *s, size_t n,
201 casing_suffix_context_t a_context);
202extern casing_suffix_context_t
203 u32_casing_suffixes_context (const uint32_t *s, size_t n,
204 casing_suffix_context_t a_context);
205
206/* Return the uppercase mapping of a string that is surrounded by a prefix
207 and a suffix. */
208extern uint8_t *
209 u8_ct_toupper (const uint8_t *s, size_t n,
210 casing_prefix_context_t prefix_context,
211 casing_suffix_context_t suffix_context,
212 const char *iso639_language,
213 uninorm_t nf,
214 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
215extern uint16_t *
216 u16_ct_toupper (const uint16_t *s, size_t n,
217 casing_prefix_context_t prefix_context,
218 casing_suffix_context_t suffix_context,
219 const char *iso639_language,
220 uninorm_t nf,
221 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
222extern uint32_t *
223 u32_ct_toupper (const uint32_t *s, size_t n,
224 casing_prefix_context_t prefix_context,
225 casing_suffix_context_t suffix_context,
226 const char *iso639_language,
227 uninorm_t nf,
228 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
229
230/* Return the lowercase mapping of a string that is surrounded by a prefix
231 and a suffix. */
232extern uint8_t *
233 u8_ct_tolower (const uint8_t *s, size_t n,
234 casing_prefix_context_t prefix_context,
235 casing_suffix_context_t suffix_context,
236 const char *iso639_language,
237 uninorm_t nf,
238 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
239extern uint16_t *
240 u16_ct_tolower (const uint16_t *s, size_t n,
241 casing_prefix_context_t prefix_context,
242 casing_suffix_context_t suffix_context,
243 const char *iso639_language,
244 uninorm_t nf,
245 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
246extern uint32_t *
247 u32_ct_tolower (const uint32_t *s, size_t n,
248 casing_prefix_context_t prefix_context,
249 casing_suffix_context_t suffix_context,
250 const char *iso639_language,
251 uninorm_t nf,
252 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
253
254/* Return the titlecase mapping of a string that is surrounded by a prefix
255 and a suffix. */
256extern uint8_t *
257 u8_ct_totitle (const uint8_t *s, size_t n,
258 casing_prefix_context_t prefix_context,
259 casing_suffix_context_t suffix_context,
260 const char *iso639_language,
261 uninorm_t nf,
262 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
263extern uint16_t *
264 u16_ct_totitle (const uint16_t *s, size_t n,
265 casing_prefix_context_t prefix_context,
266 casing_suffix_context_t suffix_context,
267 const char *iso639_language,
268 uninorm_t nf,
269 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
270extern uint32_t *
271 u32_ct_totitle (const uint32_t *s, size_t n,
272 casing_prefix_context_t prefix_context,
273 casing_suffix_context_t suffix_context,
274 const char *iso639_language,
275 uninorm_t nf,
276 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
277
278/* Return the case folded string.
279 Comparing uN_casefold (S1) and uN_casefold (S2) with uN_cmp2() is equivalent
280 to comparing S1 and S2 with uN_casecmp().
281 The nf argument identifies the normalization form to apply after the
282 case-mapping. It can also be NULL, for no normalization. */
283extern uint8_t *
284 u8_casefold (const uint8_t *s, size_t n, const char *iso639_language,
285 uninorm_t nf,
286 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
287extern uint16_t *
288 u16_casefold (const uint16_t *s, size_t n, const char *iso639_language,
289 uninorm_t nf,
290 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
291extern uint32_t *
292 u32_casefold (const uint32_t *s, size_t n, const char *iso639_language,
293 uninorm_t nf,
294 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
295/* Likewise, for a string that is surrounded by a prefix and a suffix. */
296extern uint8_t *
297 u8_ct_casefold (const uint8_t *s, size_t n,
298 casing_prefix_context_t prefix_context,
299 casing_suffix_context_t suffix_context,
300 const char *iso639_language,
301 uninorm_t nf,
302 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
303extern uint16_t *
304 u16_ct_casefold (const uint16_t *s, size_t n,
305 casing_prefix_context_t prefix_context,
306 casing_suffix_context_t suffix_context,
307 const char *iso639_language,
308 uninorm_t nf,
309 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
310extern uint32_t *
311 u32_ct_casefold (const uint32_t *s, size_t n,
312 casing_prefix_context_t prefix_context,
313 casing_suffix_context_t suffix_context,
314 const char *iso639_language,
315 uninorm_t nf,
316 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
317
318/* Compare S1 and S2, ignoring differences in case and normalization.
319 The nf argument identifies the normalization form to apply after the
320 case-mapping. It can also be NULL, for no normalization.
321 If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2, and
322 return 0. Upon failure, return -1 with errno set. */
323extern int
324 u8_casecmp (const uint8_t *s1, size_t n1,
325 const uint8_t *s2, size_t n2,
326 const char *iso639_language, uninorm_t nf, int *resultp);
327extern int
328 u16_casecmp (const uint16_t *s1, size_t n1,
329 const uint16_t *s2, size_t n2,
330 const char *iso639_language, uninorm_t nf, int *resultp);
331extern int
332 u32_casecmp (const uint32_t *s1, size_t n1,
333 const uint32_t *s2, size_t n2,
334 const char *iso639_language, uninorm_t nf, int *resultp);
335extern int
336 ulc_casecmp (const char *s1, size_t n1,
337 const char *s2, size_t n2,
338 const char *iso639_language, uninorm_t nf, int *resultp);
339
340/* Convert the string S of length N to a NUL-terminated byte sequence, in such
341 a way that comparing uN_casexfrm (S1) and uN_casexfrm (S2) with the gnulib
342 function memcmp2() is equivalent to comparing S1 and S2 with uN_casecoll().
343 NF must be either UNINORM_NFC, UNINORM_NFKC, or NULL for no normalization. */
344extern char *
345 u8_casexfrm (const uint8_t *s, size_t n, const char *iso639_language,
346 uninorm_t nf,
347 char *_UC_RESTRICT resultbuf, size_t *lengthp);
348extern char *
349 u16_casexfrm (const uint16_t *s, size_t n, const char *iso639_language,
350 uninorm_t nf,
351 char *_UC_RESTRICT resultbuf, size_t *lengthp);
352extern char *
353 u32_casexfrm (const uint32_t *s, size_t n, const char *iso639_language,
354 uninorm_t nf,
355 char *_UC_RESTRICT resultbuf, size_t *lengthp);
356extern char *
357 ulc_casexfrm (const char *s, size_t n, const char *iso639_language,
358 uninorm_t nf,
359 char *_UC_RESTRICT resultbuf, size_t *lengthp);
360
361/* Compare S1 and S2, ignoring differences in case and normalization, using the
362 collation rules of the current locale.
363 The nf argument identifies the normalization form to apply after the
364 case-mapping. It must be either UNINORM_NFC or UNINORM_NFKC. It can also
365 be NULL, for no normalization.
366 If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2, and
367 return 0. Upon failure, return -1 with errno set. */
368extern int
369 u8_casecoll (const uint8_t *s1, size_t n1,
370 const uint8_t *s2, size_t n2,
371 const char *iso639_language, uninorm_t nf, int *resultp);
372extern int
373 u16_casecoll (const uint16_t *s1, size_t n1,
374 const uint16_t *s2, size_t n2,
375 const char *iso639_language, uninorm_t nf, int *resultp);
376extern int
377 u32_casecoll (const uint32_t *s1, size_t n1,
378 const uint32_t *s2, size_t n2,
379 const char *iso639_language, uninorm_t nf, int *resultp);
380extern int
381 ulc_casecoll (const char *s1, size_t n1,
382 const char *s2, size_t n2,
383 const char *iso639_language, uninorm_t nf, int *resultp);
384
385
386/* Set *RESULTP to true if mapping NFD(S) to upper case is a no-op, or to false
387 otherwise, and return 0. Upon failure, return -1 with errno set. */
388extern int
389 u8_is_uppercase (const uint8_t *s, size_t n,
390 const char *iso639_language,
391 bool *resultp);
392extern int
393 u16_is_uppercase (const uint16_t *s, size_t n,
394 const char *iso639_language,
395 bool *resultp);
396extern int
397 u32_is_uppercase (const uint32_t *s, size_t n,
398 const char *iso639_language,
399 bool *resultp);
400
401/* Set *RESULTP to true if mapping NFD(S) to lower case is a no-op, or to false
402 otherwise, and return 0. Upon failure, return -1 with errno set. */
403extern int
404 u8_is_lowercase (const uint8_t *s, size_t n,
405 const char *iso639_language,
406 bool *resultp);
407extern int
408 u16_is_lowercase (const uint16_t *s, size_t n,
409 const char *iso639_language,
410 bool *resultp);
411extern int
412 u32_is_lowercase (const uint32_t *s, size_t n,
413 const char *iso639_language,
414 bool *resultp);
415
416/* Set *RESULTP to true if mapping NFD(S) to title case is a no-op, or to false
417 otherwise, and return 0. Upon failure, return -1 with errno set. */
418extern int
419 u8_is_titlecase (const uint8_t *s, size_t n,
420 const char *iso639_language,
421 bool *resultp);
422extern int
423 u16_is_titlecase (const uint16_t *s, size_t n,
424 const char *iso639_language,
425 bool *resultp);
426extern int
427 u32_is_titlecase (const uint32_t *s, size_t n,
428 const char *iso639_language,
429 bool *resultp);
430
431/* Set *RESULTP to true if applying case folding to NFD(S) is a no-op, or to
432 false otherwise, and return 0. Upon failure, return -1 with errno set. */
433extern int
434 u8_is_casefolded (const uint8_t *s, size_t n,
435 const char *iso639_language,
436 bool *resultp);
437extern int
438 u16_is_casefolded (const uint16_t *s, size_t n,
439 const char *iso639_language,
440 bool *resultp);
441extern int
442 u32_is_casefolded (const uint32_t *s, size_t n,
443 const char *iso639_language,
444 bool *resultp);
445
446/* Set *RESULTP to true if case matters for S, that is, if mapping NFD(S) to
447 either upper case or lower case or title case is not a no-op.
448 Set *RESULTP to false if NFD(S) maps to itself under the upper case mapping,
449 under the lower case mapping, and under the title case mapping; in other
450 words, when NFD(S) consists entirely of caseless characters.
451 Upon failure, return -1 with errno set. */
452extern int
453 u8_is_cased (const uint8_t *s, size_t n,
454 const char *iso639_language,
455 bool *resultp);
456extern int
457 u16_is_cased (const uint16_t *s, size_t n,
458 const char *iso639_language,
459 bool *resultp);
460extern int
461 u32_is_cased (const uint32_t *s, size_t n,
462 const char *iso639_language,
463 bool *resultp);
464
465
466/* ========================================================================= */
467
468#ifdef __cplusplus
469}
470#endif
471
472#endif /* _UNICASE_H */
diff --git a/gl/unicase.in.h b/gl/unicase.in.h
new file mode 100644
index 00000000..c6df04b3
--- /dev/null
+++ b/gl/unicase.in.h
@@ -0,0 +1,471 @@
1/* Unicode character case mappings.
2 Copyright (C) 2002, 2009-2025 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/.deps/.dirstamp b/gl/unicase/.deps/.dirstamp
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/gl/unicase/.deps/.dirstamp
diff --git a/gl/unicase/.deps/libgnu_a-tolower.Po b/gl/unicase/.deps/libgnu_a-tolower.Po
new file mode 100644
index 00000000..1ba6bacb
--- /dev/null
+++ b/gl/unicase/.deps/libgnu_a-tolower.Po
@@ -0,0 +1,49 @@
1unicase/libgnu_a-tolower.o: unicase/tolower.c /usr/include/stdc-predef.h \
2 ../config.h unicase.h unitypes.h \
3 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \
4 /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
5 /usr/include/features.h /usr/include/features-time64.h \
6 /usr/include/x86_64-linux-gnu/bits/wordsize.h \
7 /usr/include/x86_64-linux-gnu/bits/timesize.h \
8 /usr/include/x86_64-linux-gnu/sys/cdefs.h \
9 /usr/include/x86_64-linux-gnu/bits/long-double.h \
10 /usr/include/x86_64-linux-gnu/gnu/stubs.h \
11 /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
12 /usr/include/x86_64-linux-gnu/bits/types.h \
13 /usr/include/x86_64-linux-gnu/bits/typesizes.h \
14 /usr/include/x86_64-linux-gnu/bits/time64.h \
15 /usr/include/x86_64-linux-gnu/bits/wchar.h \
16 /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
17 /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
18 /usr/include/x86_64-linux-gnu/bits/stdint-least.h \
19 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \
20 /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h uninorm.h \
21 unicase/tolower.h unicase/simple-mapping.h
22/usr/include/stdc-predef.h:
23../config.h:
24unicase.h:
25unitypes.h:
26/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h:
27/usr/include/stdint.h:
28/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:
29/usr/include/features.h:
30/usr/include/features-time64.h:
31/usr/include/x86_64-linux-gnu/bits/wordsize.h:
32/usr/include/x86_64-linux-gnu/bits/timesize.h:
33/usr/include/x86_64-linux-gnu/sys/cdefs.h:
34/usr/include/x86_64-linux-gnu/bits/long-double.h:
35/usr/include/x86_64-linux-gnu/gnu/stubs.h:
36/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
37/usr/include/x86_64-linux-gnu/bits/types.h:
38/usr/include/x86_64-linux-gnu/bits/typesizes.h:
39/usr/include/x86_64-linux-gnu/bits/time64.h:
40/usr/include/x86_64-linux-gnu/bits/wchar.h:
41/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:
42/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h:
43/usr/include/x86_64-linux-gnu/bits/stdint-least.h:
44/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h:
45stddef.h:
46/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:
47uninorm.h:
48unicase/tolower.h:
49unicase/simple-mapping.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..0c4c75b3
--- /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-2025 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..a1c898ef
--- /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-2025 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..794f4c0c
--- /dev/null
+++ b/gl/unicase/tolower.h
@@ -0,0 +1,743 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* Simple character mapping of Unicode characters. */
3/* Generated automatically by gen-uni-tables.c for Unicode 16.0.0. */
4
5/* Copyright (C) 2000-2024 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[36 << 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, -1, -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, 4480, -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, 0, 0,
576 1, 0, 0, 0, 0, 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 34, 34, 34, 34, 34, 34, 34, 34,
727 34, 34, 34, 34, 34, 34, 34, 34,
728 34, 34, 34, 34, 34, 34, 34, 34,
729 34, 34, 34, 34, 34, 34, 34, 34,
730 34, 34, 0, 0, 0, 0, 0, 0,
731 0, 0, 0, 0, 0, 0, 0, 0,
732 0, 0, 0, 0, 0, 0, 0, 0,
733 0, 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 }
743};
diff --git a/gl/unictype.h b/gl/unictype.h
new file mode 100644
index 00000000..78072c2a
--- /dev/null
+++ b/gl/unictype.h
@@ -0,0 +1,1148 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* Unicode character classification and properties.
3 Copyright (C) 2002, 2005-2025 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#ifndef _UNICTYPE_H
19#define _UNICTYPE_H
20
21#include "unitypes.h"
22
23/* Get bool. */
24#include <stdbool.h>
25
26/* Get size_t. */
27#include <stddef.h>
28
29#if 0
30# include <unistring/woe32dll.h>
31#else
32# define LIBUNISTRING_DLL_VARIABLE
33#endif
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39/* ========================================================================= */
40
41/* Field 1 of Unicode Character Database: Character name.
42 See "uniname.h". */
43
44/* ========================================================================= */
45
46/* Field 2 of Unicode Character Database: General category. */
47
48/* Data type denoting a General category value. This is not just a bitmask,
49 but rather a bitmask and a pointer to the lookup table, so that programs
50 that use only the predefined bitmasks (i.e. don't combine bitmasks with &
51 and |) don't have a link-time dependency towards the big general table. */
52typedef struct
53{
54 uint32_t bitmask : 31;
55 /*bool*/ unsigned int generic : 1;
56 union
57 {
58 const void *table; /* when generic is 0 */
59 bool (*lookup_fn) (ucs4_t uc, uint32_t bitmask); /* when generic is 1 */
60 } lookup;
61}
62uc_general_category_t;
63
64/* Bits and bit masks denoting General category values. UnicodeData-3.2.0.html
65 says a 32-bit integer will always suffice to represent them.
66 These bit masks can only be used with the uc_is_general_category_withtable
67 function. */
68enum
69{
70 UC_CATEGORY_MASK_L = 0x0000001f,
71 UC_CATEGORY_MASK_LC = 0x00000007,
72 UC_CATEGORY_MASK_Lu = 0x00000001,
73 UC_CATEGORY_MASK_Ll = 0x00000002,
74 UC_CATEGORY_MASK_Lt = 0x00000004,
75 UC_CATEGORY_MASK_Lm = 0x00000008,
76 UC_CATEGORY_MASK_Lo = 0x00000010,
77 UC_CATEGORY_MASK_M = 0x000000e0,
78 UC_CATEGORY_MASK_Mn = 0x00000020,
79 UC_CATEGORY_MASK_Mc = 0x00000040,
80 UC_CATEGORY_MASK_Me = 0x00000080,
81 UC_CATEGORY_MASK_N = 0x00000700,
82 UC_CATEGORY_MASK_Nd = 0x00000100,
83 UC_CATEGORY_MASK_Nl = 0x00000200,
84 UC_CATEGORY_MASK_No = 0x00000400,
85 UC_CATEGORY_MASK_P = 0x0003f800,
86 UC_CATEGORY_MASK_Pc = 0x00000800,
87 UC_CATEGORY_MASK_Pd = 0x00001000,
88 UC_CATEGORY_MASK_Ps = 0x00002000,
89 UC_CATEGORY_MASK_Pe = 0x00004000,
90 UC_CATEGORY_MASK_Pi = 0x00008000,
91 UC_CATEGORY_MASK_Pf = 0x00010000,
92 UC_CATEGORY_MASK_Po = 0x00020000,
93 UC_CATEGORY_MASK_S = 0x003c0000,
94 UC_CATEGORY_MASK_Sm = 0x00040000,
95 UC_CATEGORY_MASK_Sc = 0x00080000,
96 UC_CATEGORY_MASK_Sk = 0x00100000,
97 UC_CATEGORY_MASK_So = 0x00200000,
98 UC_CATEGORY_MASK_Z = 0x01c00000,
99 UC_CATEGORY_MASK_Zs = 0x00400000,
100 UC_CATEGORY_MASK_Zl = 0x00800000,
101 UC_CATEGORY_MASK_Zp = 0x01000000,
102 UC_CATEGORY_MASK_C = 0x3e000000,
103 UC_CATEGORY_MASK_Cc = 0x02000000,
104 UC_CATEGORY_MASK_Cf = 0x04000000,
105 UC_CATEGORY_MASK_Cs = 0x08000000,
106 UC_CATEGORY_MASK_Co = 0x10000000,
107 UC_CATEGORY_MASK_Cn = 0x20000000
108};
109
110/* Predefined General category values. */
111extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_L;
112extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_LC;
113extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Lu;
114extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Ll;
115extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Lt;
116extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Lm;
117extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Lo;
118extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_M;
119extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Mn;
120extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Mc;
121extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Me;
122extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_N;
123extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Nd;
124extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Nl;
125extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_No;
126extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_P;
127extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Pc;
128extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Pd;
129extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Ps;
130extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Pe;
131extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Pi;
132extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Pf;
133extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Po;
134extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_S;
135extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Sm;
136extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Sc;
137extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Sk;
138extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_So;
139extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Z;
140extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Zs;
141extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Zl;
142extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Zp;
143extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_C;
144extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Cc;
145extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Cf;
146extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Cs;
147extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Co;
148extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_CATEGORY_Cn;
149/* Non-public. */
150extern const uc_general_category_t _UC_CATEGORY_NONE;
151
152/* Alias names for predefined General category values. */
153#define UC_LETTER UC_CATEGORY_L
154#define UC_CASED_LETTER UC_CATEGORY_LC
155#define UC_UPPERCASE_LETTER UC_CATEGORY_Lu
156#define UC_LOWERCASE_LETTER UC_CATEGORY_Ll
157#define UC_TITLECASE_LETTER UC_CATEGORY_Lt
158#define UC_MODIFIER_LETTER UC_CATEGORY_Lm
159#define UC_OTHER_LETTER UC_CATEGORY_Lo
160#define UC_MARK UC_CATEGORY_M
161#define UC_NON_SPACING_MARK UC_CATEGORY_Mn
162#define UC_COMBINING_SPACING_MARK UC_CATEGORY_Mc
163#define UC_ENCLOSING_MARK UC_CATEGORY_Me
164#define UC_NUMBER UC_CATEGORY_N
165#define UC_DECIMAL_DIGIT_NUMBER UC_CATEGORY_Nd
166#define UC_LETTER_NUMBER UC_CATEGORY_Nl
167#define UC_OTHER_NUMBER UC_CATEGORY_No
168#define UC_PUNCTUATION UC_CATEGORY_P
169#define UC_CONNECTOR_PUNCTUATION UC_CATEGORY_Pc
170#define UC_DASH_PUNCTUATION UC_CATEGORY_Pd
171#define UC_OPEN_PUNCTUATION UC_CATEGORY_Ps /* a.k.a. UC_START_PUNCTUATION */
172#define UC_CLOSE_PUNCTUATION UC_CATEGORY_Pe /* a.k.a. UC_END_PUNCTUATION */
173#define UC_INITIAL_QUOTE_PUNCTUATION UC_CATEGORY_Pi
174#define UC_FINAL_QUOTE_PUNCTUATION UC_CATEGORY_Pf
175#define UC_OTHER_PUNCTUATION UC_CATEGORY_Po
176#define UC_SYMBOL UC_CATEGORY_S
177#define UC_MATH_SYMBOL UC_CATEGORY_Sm
178#define UC_CURRENCY_SYMBOL UC_CATEGORY_Sc
179#define UC_MODIFIER_SYMBOL UC_CATEGORY_Sk
180#define UC_OTHER_SYMBOL UC_CATEGORY_So
181#define UC_SEPARATOR UC_CATEGORY_Z
182#define UC_SPACE_SEPARATOR UC_CATEGORY_Zs
183#define UC_LINE_SEPARATOR UC_CATEGORY_Zl
184#define UC_PARAGRAPH_SEPARATOR UC_CATEGORY_Zp
185#define UC_OTHER UC_CATEGORY_C
186#define UC_CONTROL UC_CATEGORY_Cc
187#define UC_FORMAT UC_CATEGORY_Cf
188#define UC_SURROGATE UC_CATEGORY_Cs /* all of them are invalid characters */
189#define UC_PRIVATE_USE UC_CATEGORY_Co
190#define UC_UNASSIGNED UC_CATEGORY_Cn /* some of them are invalid characters */
191
192/* Return the union of two general categories.
193 This corresponds to the unions of the two sets of characters. */
194extern uc_general_category_t
195 uc_general_category_or (uc_general_category_t category1,
196 uc_general_category_t category2);
197
198/* Return the intersection of two general categories as bit masks.
199 This *does*not* correspond to the intersection of the two sets of
200 characters. */
201extern uc_general_category_t
202 uc_general_category_and (uc_general_category_t category1,
203 uc_general_category_t category2);
204
205/* Return the intersection of a general category with the complement of a
206 second general category, as bit masks.
207 This *does*not* correspond to the intersection with complement, when
208 viewing the categories as sets of characters. */
209extern uc_general_category_t
210 uc_general_category_and_not (uc_general_category_t category1,
211 uc_general_category_t category2);
212
213/* Return the name of a general category. */
214extern const char *
215 uc_general_category_name (uc_general_category_t category)
216 _UC_ATTRIBUTE_PURE;
217
218/* Return the long name of a general category. */
219extern const char *
220 uc_general_category_long_name (uc_general_category_t category)
221 _UC_ATTRIBUTE_PURE;
222
223/* Return the general category given by name, e.g. "Lu", or by long name,
224 e.g. "Uppercase Letter". */
225extern uc_general_category_t
226 uc_general_category_byname (const char *category_name)
227 _UC_ATTRIBUTE_PURE;
228
229/* Return the general category of a Unicode character. */
230extern uc_general_category_t
231 uc_general_category (ucs4_t uc)
232 _UC_ATTRIBUTE_PURE;
233
234/* Test whether a Unicode character belongs to a given category.
235 The CATEGORY argument can be the combination of several predefined
236 general categories. */
237extern bool
238 uc_is_general_category (ucs4_t uc, uc_general_category_t category)
239 _UC_ATTRIBUTE_PURE;
240/* Likewise. This function uses a big table comprising all categories. */
241extern bool
242 uc_is_general_category_withtable (ucs4_t uc, uint32_t bitmask)
243 _UC_ATTRIBUTE_CONST;
244
245/* ========================================================================= */
246
247/* Field 3 of Unicode Character Database: Canonical combining class. */
248
249/* The possible results of uc_combining_class (0..255) are described in
250 UCD.html. The list here is not definitive; more values can be added
251 in future versions. */
252enum
253{
254 UC_CCC_NR = 0, /* Not Reordered */
255 UC_CCC_OV = 1, /* Overlay */
256 UC_CCC_NK = 7, /* Nukta */
257 UC_CCC_KV = 8, /* Kana Voicing */
258 UC_CCC_VR = 9, /* Virama */
259 UC_CCC_ATBL = 200, /* Attached Below Left */
260 UC_CCC_ATB = 202, /* Attached Below */
261 UC_CCC_ATA = 214, /* Attached Above */
262 UC_CCC_ATAR = 216, /* Attached Above Right */
263 UC_CCC_BL = 218, /* Below Left */
264 UC_CCC_B = 220, /* Below */
265 UC_CCC_BR = 222, /* Below Right */
266 UC_CCC_L = 224, /* Left */
267 UC_CCC_R = 226, /* Right */
268 UC_CCC_AL = 228, /* Above Left */
269 UC_CCC_A = 230, /* Above */
270 UC_CCC_AR = 232, /* Above Right */
271 UC_CCC_DB = 233, /* Double Below */
272 UC_CCC_DA = 234, /* Double Above */
273 UC_CCC_IS = 240 /* Iota Subscript */
274};
275
276/* Return the canonical combining class of a Unicode character. */
277extern int
278 uc_combining_class (ucs4_t uc)
279 _UC_ATTRIBUTE_CONST;
280
281/* Return the name of a canonical combining class. */
282extern const char *
283 uc_combining_class_name (int ccc)
284 _UC_ATTRIBUTE_CONST;
285
286/* Return the long name of a canonical combining class. */
287extern const char *
288 uc_combining_class_long_name (int ccc)
289 _UC_ATTRIBUTE_CONST;
290
291/* Return the canonical combining class given by name, e.g. "BL", or by long
292 name, e.g. "Below Left". */
293extern int
294 uc_combining_class_byname (const char *ccc_name)
295 _UC_ATTRIBUTE_PURE;
296
297/* ========================================================================= */
298
299/* Field 4 of Unicode Character Database: Bidi class.
300 Before Unicode 4.0, this field was called "Bidirectional category". */
301
302enum
303{
304 UC_BIDI_L, /* Left-to-Right */
305 UC_BIDI_LRE, /* Left-to-Right Embedding */
306 UC_BIDI_LRO, /* Left-to-Right Override */
307 UC_BIDI_R, /* Right-to-Left */
308 UC_BIDI_AL, /* Right-to-Left Arabic */
309 UC_BIDI_RLE, /* Right-to-Left Embedding */
310 UC_BIDI_RLO, /* Right-to-Left Override */
311 UC_BIDI_PDF, /* Pop Directional Format */
312 UC_BIDI_EN, /* European Number */
313 UC_BIDI_ES, /* European Number Separator */
314 UC_BIDI_ET, /* European Number Terminator */
315 UC_BIDI_AN, /* Arabic Number */
316 UC_BIDI_CS, /* Common Number Separator */
317 UC_BIDI_NSM, /* Non-Spacing Mark */
318 UC_BIDI_BN, /* Boundary Neutral */
319 UC_BIDI_B, /* Paragraph Separator */
320 UC_BIDI_S, /* Segment Separator */
321 UC_BIDI_WS, /* Whitespace */
322 UC_BIDI_ON, /* Other Neutral */
323 UC_BIDI_LRI, /* Left-to-Right Isolate */
324 UC_BIDI_RLI, /* Right-to-Left Isolate */
325 UC_BIDI_FSI, /* First Strong Isolate */
326 UC_BIDI_PDI /* Pop Directional Isolate */
327};
328
329/* Return the name of a bidi class. */
330extern const char *
331 uc_bidi_class_name (int bidi_class)
332 _UC_ATTRIBUTE_CONST;
333/* Same; obsolete function name. */
334extern const char *
335 uc_bidi_category_name (int category)
336 _UC_ATTRIBUTE_CONST;
337
338/* Return the long name of a bidi class. */
339extern const char *
340 uc_bidi_class_long_name (int bidi_class)
341 _UC_ATTRIBUTE_CONST;
342
343/* Return the bidi class given by name, e.g. "LRE", or by long name, e.g.
344 "Left-to-Right Embedding". */
345extern int
346 uc_bidi_class_byname (const char *bidi_class_name)
347 _UC_ATTRIBUTE_PURE;
348/* Same; obsolete function name. */
349extern int
350 uc_bidi_category_byname (const char *category_name)
351 _UC_ATTRIBUTE_PURE;
352
353/* Return the bidi class of a Unicode character. */
354extern int
355 uc_bidi_class (ucs4_t uc)
356 _UC_ATTRIBUTE_CONST;
357/* Same; obsolete function name. */
358extern int
359 uc_bidi_category (ucs4_t uc)
360 _UC_ATTRIBUTE_CONST;
361
362/* Test whether a Unicode character belongs to a given bidi class. */
363extern bool
364 uc_is_bidi_class (ucs4_t uc, int bidi_class)
365 _UC_ATTRIBUTE_CONST;
366/* Same; obsolete function name. */
367extern bool
368 uc_is_bidi_category (ucs4_t uc, int category)
369 _UC_ATTRIBUTE_CONST;
370
371/* ========================================================================= */
372
373/* Field 5 of Unicode Character Database: Character decomposition mapping.
374 See "uninorm.h". */
375
376/* ========================================================================= */
377
378/* Field 6 of Unicode Character Database: Decimal digit value. */
379
380/* Return the decimal digit value of a Unicode character. */
381extern int
382 uc_decimal_value (ucs4_t uc)
383 _UC_ATTRIBUTE_CONST;
384
385/* ========================================================================= */
386
387/* Field 7 of Unicode Character Database: Digit value. */
388
389/* Return the digit value of a Unicode character. */
390extern int
391 uc_digit_value (ucs4_t uc)
392 _UC_ATTRIBUTE_CONST;
393
394/* ========================================================================= */
395
396/* Field 8 of Unicode Character Database: Numeric value. */
397
398/* Return the numeric value of a Unicode character. */
399typedef struct
400{
401 int numerator;
402 int denominator;
403}
404uc_fraction_t;
405extern uc_fraction_t
406 uc_numeric_value (ucs4_t uc)
407 _UC_ATTRIBUTE_CONST;
408
409/* ========================================================================= */
410
411/* Field 9 of Unicode Character Database: Mirrored. */
412
413/* Return the mirrored character of a Unicode character UC in *PUC. */
414extern bool
415 uc_mirror_char (ucs4_t uc, ucs4_t *puc);
416
417/* ========================================================================= */
418
419/* Field 10 of Unicode Character Database: Unicode 1.0 Name.
420 Not available in this library. */
421
422/* ========================================================================= */
423
424/* Field 11 of Unicode Character Database: ISO 10646 comment.
425 Not available in this library. */
426
427/* ========================================================================= */
428
429/* Field 12, 13, 14 of Unicode Character Database: Uppercase mapping,
430 lowercase mapping, titlecase mapping. See "unicase.h". */
431
432/* ========================================================================= */
433
434/* Field 2 of the file ArabicShaping.txt in the Unicode Character Database. */
435
436/* Possible joining types. */
437enum
438{
439 UC_JOINING_TYPE_U, /* Non_Joining */
440 UC_JOINING_TYPE_T, /* Transparent */
441 UC_JOINING_TYPE_C, /* Join_Causing */
442 UC_JOINING_TYPE_L, /* Left_Joining */
443 UC_JOINING_TYPE_R, /* Right_Joining */
444 UC_JOINING_TYPE_D /* Dual_Joining */
445};
446
447/* Return the name of a joining type. */
448extern const char *
449 uc_joining_type_name (int joining_type)
450 _UC_ATTRIBUTE_CONST;
451
452/* Return the long name of a joining type. */
453extern const char *
454 uc_joining_type_long_name (int joining_type)
455 _UC_ATTRIBUTE_CONST;
456
457/* Return the joining type given by name, e.g. "D", or by long name, e.g.
458 "Dual Joining". */
459extern int
460 uc_joining_type_byname (const char *joining_type_name)
461 _UC_ATTRIBUTE_PURE;
462
463/* Return the joining type of a Unicode character. */
464extern int
465 uc_joining_type (ucs4_t uc)
466 _UC_ATTRIBUTE_CONST;
467
468/* ========================================================================= */
469
470/* Field 3 of the file ArabicShaping.txt in the Unicode Character Database. */
471
472/* Possible joining groups.
473 This enumeration may be extended in the future. */
474enum
475{
476 UC_JOINING_GROUP_NONE, /* No_Joining_Group */
477 UC_JOINING_GROUP_AIN, /* Ain */
478 UC_JOINING_GROUP_ALAPH, /* Alaph */
479 UC_JOINING_GROUP_ALEF, /* Alef */
480 UC_JOINING_GROUP_BEH, /* Beh */
481 UC_JOINING_GROUP_BETH, /* Beth */
482 UC_JOINING_GROUP_BURUSHASKI_YEH_BARREE, /* Burushaski_Yeh_Barree */
483 UC_JOINING_GROUP_DAL, /* Dal */
484 UC_JOINING_GROUP_DALATH_RISH, /* Dalath_Rish */
485 UC_JOINING_GROUP_E, /* E */
486 UC_JOINING_GROUP_FARSI_YEH, /* Farsi_Yeh */
487 UC_JOINING_GROUP_FE, /* Fe */
488 UC_JOINING_GROUP_FEH, /* Feh */
489 UC_JOINING_GROUP_FINAL_SEMKATH, /* Final_Semkath */
490 UC_JOINING_GROUP_GAF, /* Gaf */
491 UC_JOINING_GROUP_GAMAL, /* Gamal */
492 UC_JOINING_GROUP_HAH, /* Hah */
493 UC_JOINING_GROUP_HE, /* He */
494 UC_JOINING_GROUP_HEH, /* Heh */
495 UC_JOINING_GROUP_HEH_GOAL, /* Heh_Goal */
496 UC_JOINING_GROUP_HETH, /* Heth */
497 UC_JOINING_GROUP_KAF, /* Kaf */
498 UC_JOINING_GROUP_KAPH, /* Kaph */
499 UC_JOINING_GROUP_KHAPH, /* Khaph */
500 UC_JOINING_GROUP_KNOTTED_HEH, /* Knotted_Heh */
501 UC_JOINING_GROUP_LAM, /* Lam */
502 UC_JOINING_GROUP_LAMADH, /* Lamadh */
503 UC_JOINING_GROUP_MEEM, /* Meem */
504 UC_JOINING_GROUP_MIM, /* Mim */
505 UC_JOINING_GROUP_NOON, /* Noon */
506 UC_JOINING_GROUP_NUN, /* Nun */
507 UC_JOINING_GROUP_NYA, /* Nya */
508 UC_JOINING_GROUP_PE, /* Pe */
509 UC_JOINING_GROUP_QAF, /* Qaf */
510 UC_JOINING_GROUP_QAPH, /* Qaph */
511 UC_JOINING_GROUP_REH, /* Reh */
512 UC_JOINING_GROUP_REVERSED_PE, /* Reversed_Pe */
513 UC_JOINING_GROUP_SAD, /* Sad */
514 UC_JOINING_GROUP_SADHE, /* Sadhe */
515 UC_JOINING_GROUP_SEEN, /* Seen */
516 UC_JOINING_GROUP_SEMKATH, /* Semkath */
517 UC_JOINING_GROUP_SHIN, /* Shin */
518 UC_JOINING_GROUP_SWASH_KAF, /* Swash_Kaf */
519 UC_JOINING_GROUP_SYRIAC_WAW, /* Syriac_Waw */
520 UC_JOINING_GROUP_TAH, /* Tah */
521 UC_JOINING_GROUP_TAW, /* Taw */
522 UC_JOINING_GROUP_TEH_MARBUTA, /* Teh_Marbuta */
523 UC_JOINING_GROUP_TEH_MARBUTA_GOAL, /* Teh_Marbuta_Goal */
524 UC_JOINING_GROUP_TETH, /* Teth */
525 UC_JOINING_GROUP_WAW, /* Waw */
526 UC_JOINING_GROUP_YEH, /* Yeh */
527 UC_JOINING_GROUP_YEH_BARREE, /* Yeh_Barree */
528 UC_JOINING_GROUP_YEH_WITH_TAIL, /* Yeh_With_Tail */
529 UC_JOINING_GROUP_YUDH, /* Yudh */
530 UC_JOINING_GROUP_YUDH_HE, /* Yudh_He */
531 UC_JOINING_GROUP_ZAIN, /* Zain */
532 UC_JOINING_GROUP_ZHAIN, /* Zhain */
533 UC_JOINING_GROUP_ROHINGYA_YEH, /* Rohingya_Yeh */
534 UC_JOINING_GROUP_STRAIGHT_WAW, /* Straight_Waw */
535 UC_JOINING_GROUP_MANICHAEAN_ALEPH, /* Manichaean_Aleph */
536 UC_JOINING_GROUP_MANICHAEAN_BETH, /* Manichaean_Beth */
537 UC_JOINING_GROUP_MANICHAEAN_GIMEL, /* Manichaean_Gimel */
538 UC_JOINING_GROUP_MANICHAEAN_DALETH, /* Manichaean_Daleth */
539 UC_JOINING_GROUP_MANICHAEAN_WAW, /* Manichaean_Waw */
540 UC_JOINING_GROUP_MANICHAEAN_ZAYIN, /* Manichaean_Zayin */
541 UC_JOINING_GROUP_MANICHAEAN_HETH, /* Manichaean_Heth */
542 UC_JOINING_GROUP_MANICHAEAN_TETH, /* Manichaean_Teth */
543 UC_JOINING_GROUP_MANICHAEAN_YODH, /* Manichaean_Yodh */
544 UC_JOINING_GROUP_MANICHAEAN_KAPH, /* Manichaean_Kaph */
545 UC_JOINING_GROUP_MANICHAEAN_LAMEDH, /* Manichaean_Lamedh */
546 UC_JOINING_GROUP_MANICHAEAN_DHAMEDH, /* Manichaean_Dhamedh */
547 UC_JOINING_GROUP_MANICHAEAN_THAMEDH, /* Manichaean_Thamedh */
548 UC_JOINING_GROUP_MANICHAEAN_MEM, /* Manichaean_Mem */
549 UC_JOINING_GROUP_MANICHAEAN_NUN, /* Manichaean_Nun */
550 UC_JOINING_GROUP_MANICHAEAN_SAMEKH, /* Manichaean_Aleph */
551 UC_JOINING_GROUP_MANICHAEAN_AYIN, /* Manichaean_Ayin */
552 UC_JOINING_GROUP_MANICHAEAN_PE, /* Manichaean_Pe */
553 UC_JOINING_GROUP_MANICHAEAN_SADHE, /* Manichaean_Sadhe */
554 UC_JOINING_GROUP_MANICHAEAN_QOPH, /* Manichaean_Qoph */
555 UC_JOINING_GROUP_MANICHAEAN_RESH, /* Manichaean_Resh */
556 UC_JOINING_GROUP_MANICHAEAN_TAW, /* Manichaean_Taw */
557 UC_JOINING_GROUP_MANICHAEAN_ONE, /* Manichaean_One */
558 UC_JOINING_GROUP_MANICHAEAN_FIVE, /* Manichaean_Five */
559 UC_JOINING_GROUP_MANICHAEAN_TEN, /* Manichaean_Ten */
560 UC_JOINING_GROUP_MANICHAEAN_TWENTY, /* Manichaean_Twenty */
561 UC_JOINING_GROUP_MANICHAEAN_HUNDRED, /* Manichaean_Hundred */
562 UC_JOINING_GROUP_AFRICAN_FEH, /* African_Feh */
563 UC_JOINING_GROUP_AFRICAN_QAF, /* African_Qaf */
564 UC_JOINING_GROUP_AFRICAN_NOON, /* African_Noon */
565 UC_JOINING_GROUP_MALAYALAM_NGA, /* Malayalam_Nga */
566 UC_JOINING_GROUP_MALAYALAM_JA, /* Malayalam_Ja */
567 UC_JOINING_GROUP_MALAYALAM_NYA, /* Malayalam_Nya */
568 UC_JOINING_GROUP_MALAYALAM_TTA, /* Malayalam_Tta */
569 UC_JOINING_GROUP_MALAYALAM_NNA, /* Malayalam_Nna */
570 UC_JOINING_GROUP_MALAYALAM_NNNA, /* Malayalam_Nnna */
571 UC_JOINING_GROUP_MALAYALAM_BHA, /* Malayalam_Bha */
572 UC_JOINING_GROUP_MALAYALAM_RA, /* Malayalam_Ra */
573 UC_JOINING_GROUP_MALAYALAM_LLA, /* Malayalam_Lla */
574 UC_JOINING_GROUP_MALAYALAM_LLLA, /* Malayalam_Llla */
575 UC_JOINING_GROUP_MALAYALAM_SSA, /* Malayalam_Ssa */
576 UC_JOINING_GROUP_HANIFI_ROHINGYA_PA, /* Hanifi_Rohingya_Pa */
577 UC_JOINING_GROUP_HANIFI_ROHINGYA_KINNA_YA, /* Hanifi_Rohingya_Kinna_Ya */
578 UC_JOINING_GROUP_THIN_YEH, /* Thin_Yeh */
579 UC_JOINING_GROUP_VERTICAL_TAIL, /* Vertical_Tail */
580 UC_JOINING_GROUP_KASHMIRI_YEH, /* Kashmiri_Yeh */
581 UC_JOINING_GROUP_THIN_NOON /* Thin_Noon */
582};
583
584/* Return the name of a joining group. */
585extern const char *
586 uc_joining_group_name (int joining_group)
587 _UC_ATTRIBUTE_CONST;
588
589/* Return the joining group given by name, e.g. "Teh_Marbuta". */
590extern int
591 uc_joining_group_byname (const char *joining_group_name)
592 _UC_ATTRIBUTE_PURE;
593
594/* Return the joining group of a Unicode character. */
595extern int
596 uc_joining_group (ucs4_t uc)
597 _UC_ATTRIBUTE_CONST;
598
599/* ========================================================================= */
600
601/* Common API for properties. */
602
603/* Data type denoting a property. This is not just a number, but rather a
604 pointer to the test functions, so that programs that use only few of the
605 properties don't have a link-time dependency towards all the tables. */
606typedef struct
607{
608 bool (*test_fn) (ucs4_t uc);
609}
610uc_property_t;
611
612/* Predefined properties. */
613/* General. */
614extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_WHITE_SPACE;
615extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_ALPHABETIC;
616extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_OTHER_ALPHABETIC;
617extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_NOT_A_CHARACTER;
618extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT;
619extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT;
620extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_DEPRECATED;
621extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_LOGICAL_ORDER_EXCEPTION;
622extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_VARIATION_SELECTOR;
623extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_PRIVATE_USE;
624extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_UNASSIGNED_CODE_VALUE;
625/* Case. */
626extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_UPPERCASE;
627extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_OTHER_UPPERCASE;
628extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_LOWERCASE;
629extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_OTHER_LOWERCASE;
630extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_TITLECASE;
631extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_CASED;
632extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_CASE_IGNORABLE;
633extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_CHANGES_WHEN_LOWERCASED;
634extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_CHANGES_WHEN_UPPERCASED;
635extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_CHANGES_WHEN_TITLECASED;
636extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_CHANGES_WHEN_CASEFOLDED;
637extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_CHANGES_WHEN_CASEMAPPED;
638extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_SOFT_DOTTED;
639/* Identifiers. */
640extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_ID_START;
641extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_OTHER_ID_START;
642extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_ID_CONTINUE;
643extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_OTHER_ID_CONTINUE;
644extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_XID_START;
645extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_XID_CONTINUE;
646extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_ID_COMPAT_MATH_START;
647extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_ID_COMPAT_MATH_CONTINUE;
648extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_PATTERN_WHITE_SPACE;
649extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_PATTERN_SYNTAX;
650/* Shaping and rendering. */
651extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_JOIN_CONTROL;
652extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_GRAPHEME_BASE;
653extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_GRAPHEME_EXTEND;
654extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_OTHER_GRAPHEME_EXTEND;
655extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_GRAPHEME_LINK;
656extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_MODIFIER_COMBINING_MARK;
657/* Bidi. */
658extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_CONTROL;
659extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_LEFT_TO_RIGHT;
660extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT;
661extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT;
662extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_EUROPEAN_DIGIT;
663extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_EUR_NUM_SEPARATOR;
664extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_EUR_NUM_TERMINATOR;
665extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_ARABIC_DIGIT;
666extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_COMMON_SEPARATOR;
667extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_BLOCK_SEPARATOR;
668extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_SEGMENT_SEPARATOR;
669extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_WHITESPACE;
670extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_NON_SPACING_MARK;
671extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_BOUNDARY_NEUTRAL;
672extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_PDF;
673extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE;
674extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_BIDI_OTHER_NEUTRAL;
675/* Numeric. */
676extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_HEX_DIGIT;
677extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_ASCII_HEX_DIGIT;
678/* CJK. */
679extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_IDEOGRAPHIC;
680extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_UNIFIED_IDEOGRAPH;
681extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_RADICAL;
682extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_IDS_UNARY_OPERATOR;
683extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_IDS_BINARY_OPERATOR;
684extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_IDS_TRINARY_OPERATOR;
685/* Emoji. */
686extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_EMOJI;
687extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_EMOJI_PRESENTATION;
688extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_EMOJI_MODIFIER;
689extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_EMOJI_MODIFIER_BASE;
690extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_EMOJI_COMPONENT;
691extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_EXTENDED_PICTOGRAPHIC;
692/* Misc. */
693extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_ZERO_WIDTH;
694extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_SPACE;
695extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_NON_BREAK;
696extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_ISO_CONTROL;
697extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_FORMAT_CONTROL;
698extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_PREPENDED_CONCATENATION_MARK;
699extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_DASH;
700extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_HYPHEN;
701extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_PUNCTUATION;
702extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_LINE_SEPARATOR;
703extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_PARAGRAPH_SEPARATOR;
704extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_QUOTATION_MARK;
705extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_SENTENCE_TERMINAL;
706extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_TERMINAL_PUNCTUATION;
707extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_CURRENCY_SYMBOL;
708extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_MATH;
709extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_OTHER_MATH;
710extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_PAIRED_PUNCTUATION;
711extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_LEFT_OF_PAIR;
712extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_COMBINING;
713extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_COMPOSITE;
714extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_DECIMAL_DIGIT;
715extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_NUMERIC;
716extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_DIACRITIC;
717extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_EXTENDER;
718extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_IGNORABLE_CONTROL;
719extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_PROPERTY_REGIONAL_INDICATOR;
720
721/* Return the property given by name, e.g. "White space". */
722extern uc_property_t
723 uc_property_byname (const char *property_name);
724
725/* Test whether a property is valid. */
726#define uc_property_is_valid(property) ((property).test_fn != NULL)
727
728/* Test whether a Unicode character has a given property. */
729extern bool
730 uc_is_property (ucs4_t uc, uc_property_t property);
731extern bool uc_is_property_white_space (ucs4_t uc)
732 _UC_ATTRIBUTE_CONST;
733extern bool uc_is_property_alphabetic (ucs4_t uc)
734 _UC_ATTRIBUTE_CONST;
735extern bool uc_is_property_other_alphabetic (ucs4_t uc)
736 _UC_ATTRIBUTE_CONST;
737extern bool uc_is_property_not_a_character (ucs4_t uc)
738 _UC_ATTRIBUTE_CONST;
739extern bool uc_is_property_default_ignorable_code_point (ucs4_t uc)
740 _UC_ATTRIBUTE_CONST;
741extern bool uc_is_property_other_default_ignorable_code_point (ucs4_t uc)
742 _UC_ATTRIBUTE_CONST;
743extern bool uc_is_property_deprecated (ucs4_t uc)
744 _UC_ATTRIBUTE_CONST;
745extern bool uc_is_property_logical_order_exception (ucs4_t uc)
746 _UC_ATTRIBUTE_CONST;
747extern bool uc_is_property_variation_selector (ucs4_t uc)
748 _UC_ATTRIBUTE_CONST;
749extern bool uc_is_property_private_use (ucs4_t uc)
750 _UC_ATTRIBUTE_CONST;
751extern bool uc_is_property_unassigned_code_value (ucs4_t uc)
752 _UC_ATTRIBUTE_CONST;
753extern bool uc_is_property_uppercase (ucs4_t uc)
754 _UC_ATTRIBUTE_CONST;
755extern bool uc_is_property_other_uppercase (ucs4_t uc)
756 _UC_ATTRIBUTE_CONST;
757extern bool uc_is_property_lowercase (ucs4_t uc)
758 _UC_ATTRIBUTE_CONST;
759extern bool uc_is_property_other_lowercase (ucs4_t uc)
760 _UC_ATTRIBUTE_CONST;
761extern bool uc_is_property_titlecase (ucs4_t uc)
762 _UC_ATTRIBUTE_CONST;
763extern bool uc_is_property_cased (ucs4_t uc)
764 _UC_ATTRIBUTE_CONST;
765extern bool uc_is_property_case_ignorable (ucs4_t uc)
766 _UC_ATTRIBUTE_CONST;
767extern bool uc_is_property_changes_when_lowercased (ucs4_t uc)
768 _UC_ATTRIBUTE_CONST;
769extern bool uc_is_property_changes_when_uppercased (ucs4_t uc)
770 _UC_ATTRIBUTE_CONST;
771extern bool uc_is_property_changes_when_titlecased (ucs4_t uc)
772 _UC_ATTRIBUTE_CONST;
773extern bool uc_is_property_changes_when_casefolded (ucs4_t uc)
774 _UC_ATTRIBUTE_CONST;
775extern bool uc_is_property_changes_when_casemapped (ucs4_t uc)
776 _UC_ATTRIBUTE_CONST;
777extern bool uc_is_property_soft_dotted (ucs4_t uc)
778 _UC_ATTRIBUTE_CONST;
779extern bool uc_is_property_id_start (ucs4_t uc)
780 _UC_ATTRIBUTE_CONST;
781extern bool uc_is_property_other_id_start (ucs4_t uc)
782 _UC_ATTRIBUTE_CONST;
783extern bool uc_is_property_id_continue (ucs4_t uc)
784 _UC_ATTRIBUTE_CONST;
785extern bool uc_is_property_other_id_continue (ucs4_t uc)
786 _UC_ATTRIBUTE_CONST;
787extern bool uc_is_property_xid_start (ucs4_t uc)
788 _UC_ATTRIBUTE_CONST;
789extern bool uc_is_property_xid_continue (ucs4_t uc)
790 _UC_ATTRIBUTE_CONST;
791extern bool uc_is_property_id_compat_math_start (ucs4_t uc)
792 _UC_ATTRIBUTE_CONST;
793extern bool uc_is_property_id_compat_math_continue (ucs4_t uc)
794 _UC_ATTRIBUTE_CONST;
795extern bool uc_is_property_pattern_white_space (ucs4_t uc)
796 _UC_ATTRIBUTE_CONST;
797extern bool uc_is_property_pattern_syntax (ucs4_t uc)
798 _UC_ATTRIBUTE_CONST;
799extern bool uc_is_property_join_control (ucs4_t uc)
800 _UC_ATTRIBUTE_CONST;
801extern bool uc_is_property_grapheme_base (ucs4_t uc)
802 _UC_ATTRIBUTE_CONST;
803extern bool uc_is_property_grapheme_extend (ucs4_t uc)
804 _UC_ATTRIBUTE_CONST;
805extern bool uc_is_property_other_grapheme_extend (ucs4_t uc)
806 _UC_ATTRIBUTE_CONST;
807extern bool uc_is_property_grapheme_link (ucs4_t uc)
808 _UC_ATTRIBUTE_CONST;
809extern bool uc_is_property_modifier_combining_mark (ucs4_t uc)
810 _UC_ATTRIBUTE_CONST;
811extern bool uc_is_property_bidi_control (ucs4_t uc)
812 _UC_ATTRIBUTE_CONST;
813extern bool uc_is_property_bidi_left_to_right (ucs4_t uc)
814 _UC_ATTRIBUTE_CONST;
815extern bool uc_is_property_bidi_hebrew_right_to_left (ucs4_t uc)
816 _UC_ATTRIBUTE_CONST;
817extern bool uc_is_property_bidi_arabic_right_to_left (ucs4_t uc)
818 _UC_ATTRIBUTE_CONST;
819extern bool uc_is_property_bidi_european_digit (ucs4_t uc)
820 _UC_ATTRIBUTE_CONST;
821extern bool uc_is_property_bidi_eur_num_separator (ucs4_t uc)
822 _UC_ATTRIBUTE_CONST;
823extern bool uc_is_property_bidi_eur_num_terminator (ucs4_t uc)
824 _UC_ATTRIBUTE_CONST;
825extern bool uc_is_property_bidi_arabic_digit (ucs4_t uc)
826 _UC_ATTRIBUTE_CONST;
827extern bool uc_is_property_bidi_common_separator (ucs4_t uc)
828 _UC_ATTRIBUTE_CONST;
829extern bool uc_is_property_bidi_block_separator (ucs4_t uc)
830 _UC_ATTRIBUTE_CONST;
831extern bool uc_is_property_bidi_segment_separator (ucs4_t uc)
832 _UC_ATTRIBUTE_CONST;
833extern bool uc_is_property_bidi_whitespace (ucs4_t uc)
834 _UC_ATTRIBUTE_CONST;
835extern bool uc_is_property_bidi_non_spacing_mark (ucs4_t uc)
836 _UC_ATTRIBUTE_CONST;
837extern bool uc_is_property_bidi_boundary_neutral (ucs4_t uc)
838 _UC_ATTRIBUTE_CONST;
839extern bool uc_is_property_bidi_pdf (ucs4_t uc)
840 _UC_ATTRIBUTE_CONST;
841extern bool uc_is_property_bidi_embedding_or_override (ucs4_t uc)
842 _UC_ATTRIBUTE_CONST;
843extern bool uc_is_property_bidi_other_neutral (ucs4_t uc)
844 _UC_ATTRIBUTE_CONST;
845extern bool uc_is_property_hex_digit (ucs4_t uc)
846 _UC_ATTRIBUTE_CONST;
847extern bool uc_is_property_ascii_hex_digit (ucs4_t uc)
848 _UC_ATTRIBUTE_CONST;
849extern bool uc_is_property_ideographic (ucs4_t uc)
850 _UC_ATTRIBUTE_CONST;
851extern bool uc_is_property_unified_ideograph (ucs4_t uc)
852 _UC_ATTRIBUTE_CONST;
853extern bool uc_is_property_radical (ucs4_t uc)
854 _UC_ATTRIBUTE_CONST;
855extern bool uc_is_property_ids_unary_operator (ucs4_t uc)
856 _UC_ATTRIBUTE_CONST;
857extern bool uc_is_property_ids_binary_operator (ucs4_t uc)
858 _UC_ATTRIBUTE_CONST;
859extern bool uc_is_property_ids_trinary_operator (ucs4_t uc)
860 _UC_ATTRIBUTE_CONST;
861extern bool uc_is_property_emoji (ucs4_t uc)
862 _UC_ATTRIBUTE_CONST;
863extern bool uc_is_property_emoji_presentation (ucs4_t uc)
864 _UC_ATTRIBUTE_CONST;
865extern bool uc_is_property_emoji_modifier (ucs4_t uc)
866 _UC_ATTRIBUTE_CONST;
867extern bool uc_is_property_emoji_modifier_base (ucs4_t uc)
868 _UC_ATTRIBUTE_CONST;
869extern bool uc_is_property_emoji_component (ucs4_t uc)
870 _UC_ATTRIBUTE_CONST;
871extern bool uc_is_property_extended_pictographic (ucs4_t uc)
872 _UC_ATTRIBUTE_CONST;
873extern bool uc_is_property_zero_width (ucs4_t uc)
874 _UC_ATTRIBUTE_CONST;
875extern bool uc_is_property_space (ucs4_t uc)
876 _UC_ATTRIBUTE_CONST;
877extern bool uc_is_property_non_break (ucs4_t uc)
878 _UC_ATTRIBUTE_CONST;
879extern bool uc_is_property_iso_control (ucs4_t uc)
880 _UC_ATTRIBUTE_CONST;
881extern bool uc_is_property_format_control (ucs4_t uc)
882 _UC_ATTRIBUTE_CONST;
883extern bool uc_is_property_prepended_concatenation_mark (ucs4_t uc)
884 _UC_ATTRIBUTE_CONST;
885extern bool uc_is_property_dash (ucs4_t uc)
886 _UC_ATTRIBUTE_CONST;
887extern bool uc_is_property_hyphen (ucs4_t uc)
888 _UC_ATTRIBUTE_CONST;
889extern bool uc_is_property_punctuation (ucs4_t uc)
890 _UC_ATTRIBUTE_CONST;
891extern bool uc_is_property_line_separator (ucs4_t uc)
892 _UC_ATTRIBUTE_CONST;
893extern bool uc_is_property_paragraph_separator (ucs4_t uc)
894 _UC_ATTRIBUTE_CONST;
895extern bool uc_is_property_quotation_mark (ucs4_t uc)
896 _UC_ATTRIBUTE_CONST;
897extern bool uc_is_property_sentence_terminal (ucs4_t uc)
898 _UC_ATTRIBUTE_CONST;
899extern bool uc_is_property_terminal_punctuation (ucs4_t uc)
900 _UC_ATTRIBUTE_CONST;
901extern bool uc_is_property_currency_symbol (ucs4_t uc)
902 _UC_ATTRIBUTE_CONST;
903extern bool uc_is_property_math (ucs4_t uc)
904 _UC_ATTRIBUTE_CONST;
905extern bool uc_is_property_other_math (ucs4_t uc)
906 _UC_ATTRIBUTE_CONST;
907extern bool uc_is_property_paired_punctuation (ucs4_t uc)
908 _UC_ATTRIBUTE_CONST;
909extern bool uc_is_property_left_of_pair (ucs4_t uc)
910 _UC_ATTRIBUTE_CONST;
911extern bool uc_is_property_combining (ucs4_t uc)
912 _UC_ATTRIBUTE_CONST;
913extern bool uc_is_property_composite (ucs4_t uc)
914 _UC_ATTRIBUTE_CONST;
915extern bool uc_is_property_decimal_digit (ucs4_t uc)
916 _UC_ATTRIBUTE_CONST;
917extern bool uc_is_property_numeric (ucs4_t uc)
918 _UC_ATTRIBUTE_CONST;
919extern bool uc_is_property_diacritic (ucs4_t uc)
920 _UC_ATTRIBUTE_CONST;
921extern bool uc_is_property_extender (ucs4_t uc)
922 _UC_ATTRIBUTE_CONST;
923extern bool uc_is_property_ignorable_control (ucs4_t uc)
924 _UC_ATTRIBUTE_CONST;
925extern bool uc_is_property_regional_indicator (ucs4_t uc)
926 _UC_ATTRIBUTE_CONST;
927
928/* ========================================================================= */
929
930/* Other attributes. */
931
932/* ------------------------------------------------------------------------- */
933
934/* Indic_Conjunct_Break (InCB): from the file DerivedCoreProperties.txt
935 in the Unicode Character Database. */
936
937/* Possible values of the Indic_Conjunct_Break attribute.
938 This enumeration may be extended in the future. */
939enum
940{
941 UC_INDIC_CONJUNCT_BREAK_NONE, /* None */
942 UC_INDIC_CONJUNCT_BREAK_CONSONANT, /* Consonant */
943 UC_INDIC_CONJUNCT_BREAK_LINKER, /* Linker */
944 UC_INDIC_CONJUNCT_BREAK_EXTEND /* Extend */
945};
946
947/* Return the name of an Indic_Conjunct_Break value. */
948extern const char *
949 uc_indic_conjunct_break_name (int indic_conjunct_break)
950 _UC_ATTRIBUTE_CONST;
951
952/* Return the Indic_Conjunct_Break value given by name, e.g. "Consonant". */
953extern int
954 uc_indic_conjunct_break_byname (const char *indic_conjunct_break_name)
955 _UC_ATTRIBUTE_PURE;
956
957/* Return the Indic_Conjunct_Break attribute of a Unicode character. */
958extern int
959 uc_indic_conjunct_break (ucs4_t uc)
960 _UC_ATTRIBUTE_CONST;
961
962/* ========================================================================= */
963
964/* Subdivision of the Unicode characters into scripts. */
965
966typedef struct
967{
968 unsigned int code : 21;
969 unsigned int start : 1;
970 unsigned int end : 1;
971}
972uc_interval_t;
973typedef struct
974{
975 unsigned int nintervals;
976 const uc_interval_t *intervals;
977 const char *name;
978}
979uc_script_t;
980
981/* Return the script of a Unicode character. */
982extern const uc_script_t *
983 uc_script (ucs4_t uc)
984 _UC_ATTRIBUTE_CONST;
985
986/* Return the script given by name, e.g. "HAN". */
987extern const uc_script_t *
988 uc_script_byname (const char *script_name)
989 _UC_ATTRIBUTE_PURE;
990
991/* Test whether a Unicode character belongs to a given script. */
992extern bool
993 uc_is_script (ucs4_t uc, const uc_script_t *script)
994 _UC_ATTRIBUTE_PURE;
995
996/* Get the list of all scripts. */
997extern void
998 uc_all_scripts (const uc_script_t **scripts, size_t *count);
999
1000/* ========================================================================= */
1001
1002/* Subdivision of the Unicode character range into blocks. */
1003
1004typedef struct
1005{
1006 ucs4_t start;
1007 ucs4_t end;
1008 const char *name;
1009}
1010uc_block_t;
1011
1012/* Return the block a character belongs to. */
1013extern const uc_block_t *
1014 uc_block (ucs4_t uc)
1015 _UC_ATTRIBUTE_CONST;
1016
1017/* Test whether a Unicode character belongs to a given block. */
1018extern bool
1019 uc_is_block (ucs4_t uc, const uc_block_t *block)
1020 _UC_ATTRIBUTE_PURE;
1021
1022/* Get the list of all blocks. */
1023extern void
1024 uc_all_blocks (const uc_block_t **blocks, size_t *count);
1025
1026/* ========================================================================= */
1027
1028/* Properties taken from language standards. */
1029
1030/* Test whether a Unicode character is considered whitespace in ISO C 99. */
1031extern bool
1032 uc_is_c_whitespace (ucs4_t uc)
1033 _UC_ATTRIBUTE_CONST;
1034
1035/* Test whether a Unicode character is considered whitespace in Java. */
1036extern bool
1037 uc_is_java_whitespace (ucs4_t uc)
1038 _UC_ATTRIBUTE_CONST;
1039
1040enum
1041{
1042 UC_IDENTIFIER_START, /* valid as first or subsequent character */
1043 UC_IDENTIFIER_VALID, /* valid as subsequent character only */
1044 UC_IDENTIFIER_INVALID, /* not valid */
1045 UC_IDENTIFIER_IGNORABLE /* ignorable (Java only) */
1046};
1047
1048/* Return the categorization of a Unicode character w.r.t. the ISO C 99
1049 identifier syntax. */
1050extern int
1051 uc_c_ident_category (ucs4_t uc)
1052 _UC_ATTRIBUTE_CONST;
1053
1054/* Return the categorization of a Unicode character w.r.t. the Java
1055 identifier syntax. */
1056extern int
1057 uc_java_ident_category (ucs4_t uc)
1058 _UC_ATTRIBUTE_CONST;
1059
1060/* ========================================================================= */
1061
1062/* Like ISO C <ctype.h> and <wctype.h>. These functions are deprecated,
1063 because this set of functions was designed with ASCII in mind and cannot
1064 reflect the more diverse reality of the Unicode character set. But they
1065 can be a quick-and-dirty porting aid when migrating from wchar_t APIs
1066 to Unicode strings. */
1067
1068/* Test for any character for which 'uc_is_alpha' or 'uc_is_digit' is true. */
1069extern bool
1070 uc_is_alnum (ucs4_t uc)
1071 _UC_ATTRIBUTE_CONST;
1072
1073/* Test for any character for which 'uc_is_upper' or 'uc_is_lower' is true,
1074 or any character that is one of a locale-specific set of characters for
1075 which none of 'uc_is_cntrl', 'uc_is_digit', 'uc_is_punct', or 'uc_is_space'
1076 is true. */
1077extern bool
1078 uc_is_alpha (ucs4_t uc)
1079 _UC_ATTRIBUTE_CONST;
1080
1081/* Test for any control character. */
1082extern bool
1083 uc_is_cntrl (ucs4_t uc)
1084 _UC_ATTRIBUTE_CONST;
1085
1086/* Test for any character that corresponds to a decimal-digit character. */
1087extern bool
1088 uc_is_digit (ucs4_t uc)
1089 _UC_ATTRIBUTE_CONST;
1090
1091/* Test for any character for which 'uc_is_print' is true and 'uc_is_space'
1092 is false. */
1093extern bool
1094 uc_is_graph (ucs4_t uc)
1095 _UC_ATTRIBUTE_CONST;
1096
1097/* Test for any character that corresponds to a lowercase letter or is one
1098 of a locale-specific set of characters for which none of 'uc_is_cntrl',
1099 'uc_is_digit', 'uc_is_punct', or 'uc_is_space' is true. */
1100extern bool
1101 uc_is_lower (ucs4_t uc)
1102 _UC_ATTRIBUTE_CONST;
1103
1104/* Test for any printing character. */
1105extern bool
1106 uc_is_print (ucs4_t uc)
1107 _UC_ATTRIBUTE_CONST;
1108
1109/* Test for any printing character that is one of a locale-specific set of
1110 characters for which neither 'uc_is_space' nor 'uc_is_alnum' is true. */
1111extern bool
1112 uc_is_punct (ucs4_t uc)
1113 _UC_ATTRIBUTE_CONST;
1114
1115/* Test for any character that corresponds to a locale-specific set of
1116 characters for which none of 'uc_is_alnum', 'uc_is_graph', or 'uc_is_punct'
1117 is true. */
1118extern bool
1119 uc_is_space (ucs4_t uc)
1120 _UC_ATTRIBUTE_CONST;
1121
1122/* Test for any character that corresponds to an uppercase letter or is one
1123 of a locale-specific set of character for which none of 'uc_is_cntrl',
1124 'uc_is_digit', 'uc_is_punct', or 'uc_is_space' is true. */
1125extern bool
1126 uc_is_upper (ucs4_t uc)
1127 _UC_ATTRIBUTE_CONST;
1128
1129/* Test for any character that corresponds to a hexadecimal-digit
1130 character. */
1131extern bool
1132 uc_is_xdigit (ucs4_t uc)
1133 _UC_ATTRIBUTE_CONST;
1134
1135/* GNU extension. */
1136/* Test for any character that corresponds to a standard blank character or
1137 a locale-specific set of characters for which 'uc_is_alnum' is false. */
1138extern bool
1139 uc_is_blank (ucs4_t uc)
1140 _UC_ATTRIBUTE_CONST;
1141
1142/* ========================================================================= */
1143
1144#ifdef __cplusplus
1145}
1146#endif
1147
1148#endif /* _UNICTYPE_H */
diff --git a/gl/unictype.in.h b/gl/unictype.in.h
new file mode 100644
index 00000000..3818da91
--- /dev/null
+++ b/gl/unictype.in.h
@@ -0,0 +1,1146 @@
1/* Unicode character classification and properties.
2 Copyright (C) 2002, 2005-2025 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};
581
582/* Return the name of a joining group. */
583extern const char *
584 uc_joining_group_name (int joining_group)
585 _UC_ATTRIBUTE_CONST;
586
587/* Return the joining group given by name, e.g. "Teh_Marbuta". */
588extern int
589 uc_joining_group_byname (const char *joining_group_name)
590 _UC_ATTRIBUTE_PURE;
591
592/* Return the joining group of a Unicode character. */
593extern int
594 uc_joining_group (ucs4_t uc)
595 _UC_ATTRIBUTE_CONST;
596
597/* ========================================================================= */
598
599/* Common API for properties. */
600
601/* Data type denoting a property. This is not just a number, but rather a
602 pointer to the test functions, so that programs that use only few of the
603 properties don't have a link-time dependency towards all the tables. */
604typedef struct
605{
606 bool (*test_fn) (ucs4_t uc);
607}
608uc_property_t;
609
610/* Predefined properties. */
611/* General. */
612extern @GNULIB_UNICTYPE_PROPERTY_WHITE_SPACE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_WHITE_SPACE;
613extern @GNULIB_UNICTYPE_PROPERTY_ALPHABETIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ALPHABETIC;
614extern @GNULIB_UNICTYPE_PROPERTY_OTHER_ALPHABETIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_ALPHABETIC;
615extern @GNULIB_UNICTYPE_PROPERTY_NOT_A_CHARACTER_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_NOT_A_CHARACTER;
616extern @GNULIB_UNICTYPE_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT;
617extern @GNULIB_UNICTYPE_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT;
618extern @GNULIB_UNICTYPE_PROPERTY_DEPRECATED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DEPRECATED;
619extern @GNULIB_UNICTYPE_PROPERTY_LOGICAL_ORDER_EXCEPTION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_LOGICAL_ORDER_EXCEPTION;
620extern @GNULIB_UNICTYPE_PROPERTY_VARIATION_SELECTOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_VARIATION_SELECTOR;
621extern @GNULIB_UNICTYPE_PROPERTY_PRIVATE_USE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PRIVATE_USE;
622extern @GNULIB_UNICTYPE_PROPERTY_UNASSIGNED_CODE_VALUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_UNASSIGNED_CODE_VALUE;
623/* Case. */
624extern @GNULIB_UNICTYPE_PROPERTY_UPPERCASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_UPPERCASE;
625extern @GNULIB_UNICTYPE_PROPERTY_OTHER_UPPERCASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_UPPERCASE;
626extern @GNULIB_UNICTYPE_PROPERTY_LOWERCASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_LOWERCASE;
627extern @GNULIB_UNICTYPE_PROPERTY_OTHER_LOWERCASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_LOWERCASE;
628extern @GNULIB_UNICTYPE_PROPERTY_TITLECASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_TITLECASE;
629extern @GNULIB_UNICTYPE_PROPERTY_CASED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CASED;
630extern @GNULIB_UNICTYPE_PROPERTY_CASE_IGNORABLE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CASE_IGNORABLE;
631extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_LOWERCASED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_LOWERCASED;
632extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_UPPERCASED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_UPPERCASED;
633extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_TITLECASED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_TITLECASED;
634extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEFOLDED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_CASEFOLDED;
635extern @GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEMAPPED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CHANGES_WHEN_CASEMAPPED;
636extern @GNULIB_UNICTYPE_PROPERTY_SOFT_DOTTED_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_SOFT_DOTTED;
637/* Identifiers. */
638extern @GNULIB_UNICTYPE_PROPERTY_ID_START_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ID_START;
639extern @GNULIB_UNICTYPE_PROPERTY_OTHER_ID_START_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_ID_START;
640extern @GNULIB_UNICTYPE_PROPERTY_ID_CONTINUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ID_CONTINUE;
641extern @GNULIB_UNICTYPE_PROPERTY_OTHER_ID_CONTINUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_ID_CONTINUE;
642extern @GNULIB_UNICTYPE_PROPERTY_XID_START_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_XID_START;
643extern @GNULIB_UNICTYPE_PROPERTY_XID_CONTINUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_XID_CONTINUE;
644extern @GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_START_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ID_COMPAT_MATH_START;
645extern @GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_CONTINUE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ID_COMPAT_MATH_CONTINUE;
646extern @GNULIB_UNICTYPE_PROPERTY_PATTERN_WHITE_SPACE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PATTERN_WHITE_SPACE;
647extern @GNULIB_UNICTYPE_PROPERTY_PATTERN_SYNTAX_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PATTERN_SYNTAX;
648/* Shaping and rendering. */
649extern @GNULIB_UNICTYPE_PROPERTY_JOIN_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_JOIN_CONTROL;
650extern @GNULIB_UNICTYPE_PROPERTY_GRAPHEME_BASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_GRAPHEME_BASE;
651extern @GNULIB_UNICTYPE_PROPERTY_GRAPHEME_EXTEND_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_GRAPHEME_EXTEND;
652extern @GNULIB_UNICTYPE_PROPERTY_OTHER_GRAPHEME_EXTEND_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_GRAPHEME_EXTEND;
653extern @GNULIB_UNICTYPE_PROPERTY_GRAPHEME_LINK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_GRAPHEME_LINK;
654extern @GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_MODIFIER_COMBINING_MARK;
655/* Bidi. */
656extern @GNULIB_UNICTYPE_PROPERTY_BIDI_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_CONTROL;
657extern @GNULIB_UNICTYPE_PROPERTY_BIDI_LEFT_TO_RIGHT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_LEFT_TO_RIGHT;
658extern @GNULIB_UNICTYPE_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT;
659extern @GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT;
660extern @GNULIB_UNICTYPE_PROPERTY_BIDI_EUROPEAN_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_EUROPEAN_DIGIT;
661extern @GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_EUR_NUM_SEPARATOR;
662extern @GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_TERMINATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_EUR_NUM_TERMINATOR;
663extern @GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_ARABIC_DIGIT;
664extern @GNULIB_UNICTYPE_PROPERTY_BIDI_COMMON_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_COMMON_SEPARATOR;
665extern @GNULIB_UNICTYPE_PROPERTY_BIDI_BLOCK_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_BLOCK_SEPARATOR;
666extern @GNULIB_UNICTYPE_PROPERTY_BIDI_SEGMENT_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_SEGMENT_SEPARATOR;
667extern @GNULIB_UNICTYPE_PROPERTY_BIDI_WHITESPACE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_WHITESPACE;
668extern @GNULIB_UNICTYPE_PROPERTY_BIDI_NON_SPACING_MARK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_NON_SPACING_MARK;
669extern @GNULIB_UNICTYPE_PROPERTY_BIDI_BOUNDARY_NEUTRAL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_BOUNDARY_NEUTRAL;
670extern @GNULIB_UNICTYPE_PROPERTY_BIDI_PDF_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_PDF;
671extern @GNULIB_UNICTYPE_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE;
672extern @GNULIB_UNICTYPE_PROPERTY_BIDI_OTHER_NEUTRAL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_BIDI_OTHER_NEUTRAL;
673/* Numeric. */
674extern @GNULIB_UNICTYPE_PROPERTY_HEX_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_HEX_DIGIT;
675extern @GNULIB_UNICTYPE_PROPERTY_ASCII_HEX_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ASCII_HEX_DIGIT;
676/* CJK. */
677extern @GNULIB_UNICTYPE_PROPERTY_IDEOGRAPHIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IDEOGRAPHIC;
678extern @GNULIB_UNICTYPE_PROPERTY_UNIFIED_IDEOGRAPH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_UNIFIED_IDEOGRAPH;
679extern @GNULIB_UNICTYPE_PROPERTY_RADICAL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_RADICAL;
680extern @GNULIB_UNICTYPE_PROPERTY_IDS_UNARY_OPERATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IDS_UNARY_OPERATOR;
681extern @GNULIB_UNICTYPE_PROPERTY_IDS_BINARY_OPERATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IDS_BINARY_OPERATOR;
682extern @GNULIB_UNICTYPE_PROPERTY_IDS_TRINARY_OPERATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IDS_TRINARY_OPERATOR;
683/* Emoji. */
684extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI;
685extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_PRESENTATION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI_PRESENTATION;
686extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI_MODIFIER;
687extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_BASE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI_MODIFIER_BASE;
688extern @GNULIB_UNICTYPE_PROPERTY_EMOJI_COMPONENT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EMOJI_COMPONENT;
689extern @GNULIB_UNICTYPE_PROPERTY_EXTENDED_PICTOGRAPHIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EXTENDED_PICTOGRAPHIC;
690/* Misc. */
691extern @GNULIB_UNICTYPE_PROPERTY_ZERO_WIDTH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ZERO_WIDTH;
692extern @GNULIB_UNICTYPE_PROPERTY_SPACE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_SPACE;
693extern @GNULIB_UNICTYPE_PROPERTY_NON_BREAK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_NON_BREAK;
694extern @GNULIB_UNICTYPE_PROPERTY_ISO_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_ISO_CONTROL;
695extern @GNULIB_UNICTYPE_PROPERTY_FORMAT_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_FORMAT_CONTROL;
696extern @GNULIB_UNICTYPE_PROPERTY_PREPENDED_CONCATENATION_MARK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PREPENDED_CONCATENATION_MARK;
697extern @GNULIB_UNICTYPE_PROPERTY_DASH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DASH;
698extern @GNULIB_UNICTYPE_PROPERTY_HYPHEN_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_HYPHEN;
699extern @GNULIB_UNICTYPE_PROPERTY_PUNCTUATION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PUNCTUATION;
700extern @GNULIB_UNICTYPE_PROPERTY_LINE_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_LINE_SEPARATOR;
701extern @GNULIB_UNICTYPE_PROPERTY_PARAGRAPH_SEPARATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PARAGRAPH_SEPARATOR;
702extern @GNULIB_UNICTYPE_PROPERTY_QUOTATION_MARK_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_QUOTATION_MARK;
703extern @GNULIB_UNICTYPE_PROPERTY_SENTENCE_TERMINAL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_SENTENCE_TERMINAL;
704extern @GNULIB_UNICTYPE_PROPERTY_TERMINAL_PUNCTUATION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_TERMINAL_PUNCTUATION;
705extern @GNULIB_UNICTYPE_PROPERTY_CURRENCY_SYMBOL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_CURRENCY_SYMBOL;
706extern @GNULIB_UNICTYPE_PROPERTY_MATH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_MATH;
707extern @GNULIB_UNICTYPE_PROPERTY_OTHER_MATH_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_OTHER_MATH;
708extern @GNULIB_UNICTYPE_PROPERTY_PAIRED_PUNCTUATION_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_PAIRED_PUNCTUATION;
709extern @GNULIB_UNICTYPE_PROPERTY_LEFT_OF_PAIR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_LEFT_OF_PAIR;
710extern @GNULIB_UNICTYPE_PROPERTY_COMBINING_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_COMBINING;
711extern @GNULIB_UNICTYPE_PROPERTY_COMPOSITE_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_COMPOSITE;
712extern @GNULIB_UNICTYPE_PROPERTY_DECIMAL_DIGIT_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DECIMAL_DIGIT;
713extern @GNULIB_UNICTYPE_PROPERTY_NUMERIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_NUMERIC;
714extern @GNULIB_UNICTYPE_PROPERTY_DIACRITIC_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_DIACRITIC;
715extern @GNULIB_UNICTYPE_PROPERTY_EXTENDER_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_EXTENDER;
716extern @GNULIB_UNICTYPE_PROPERTY_IGNORABLE_CONTROL_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_IGNORABLE_CONTROL;
717extern @GNULIB_UNICTYPE_PROPERTY_REGIONAL_INDICATOR_DLL_VARIABLE@ const uc_property_t UC_PROPERTY_REGIONAL_INDICATOR;
718
719/* Return the property given by name, e.g. "White space". */
720extern uc_property_t
721 uc_property_byname (const char *property_name);
722
723/* Test whether a property is valid. */
724#define uc_property_is_valid(property) ((property).test_fn != NULL)
725
726/* Test whether a Unicode character has a given property. */
727extern bool
728 uc_is_property (ucs4_t uc, uc_property_t property);
729extern bool uc_is_property_white_space (ucs4_t uc)
730 _UC_ATTRIBUTE_CONST;
731extern bool uc_is_property_alphabetic (ucs4_t uc)
732 _UC_ATTRIBUTE_CONST;
733extern bool uc_is_property_other_alphabetic (ucs4_t uc)
734 _UC_ATTRIBUTE_CONST;
735extern bool uc_is_property_not_a_character (ucs4_t uc)
736 _UC_ATTRIBUTE_CONST;
737extern bool uc_is_property_default_ignorable_code_point (ucs4_t uc)
738 _UC_ATTRIBUTE_CONST;
739extern bool uc_is_property_other_default_ignorable_code_point (ucs4_t uc)
740 _UC_ATTRIBUTE_CONST;
741extern bool uc_is_property_deprecated (ucs4_t uc)
742 _UC_ATTRIBUTE_CONST;
743extern bool uc_is_property_logical_order_exception (ucs4_t uc)
744 _UC_ATTRIBUTE_CONST;
745extern bool uc_is_property_variation_selector (ucs4_t uc)
746 _UC_ATTRIBUTE_CONST;
747extern bool uc_is_property_private_use (ucs4_t uc)
748 _UC_ATTRIBUTE_CONST;
749extern bool uc_is_property_unassigned_code_value (ucs4_t uc)
750 _UC_ATTRIBUTE_CONST;
751extern bool uc_is_property_uppercase (ucs4_t uc)
752 _UC_ATTRIBUTE_CONST;
753extern bool uc_is_property_other_uppercase (ucs4_t uc)
754 _UC_ATTRIBUTE_CONST;
755extern bool uc_is_property_lowercase (ucs4_t uc)
756 _UC_ATTRIBUTE_CONST;
757extern bool uc_is_property_other_lowercase (ucs4_t uc)
758 _UC_ATTRIBUTE_CONST;
759extern bool uc_is_property_titlecase (ucs4_t uc)
760 _UC_ATTRIBUTE_CONST;
761extern bool uc_is_property_cased (ucs4_t uc)
762 _UC_ATTRIBUTE_CONST;
763extern bool uc_is_property_case_ignorable (ucs4_t uc)
764 _UC_ATTRIBUTE_CONST;
765extern bool uc_is_property_changes_when_lowercased (ucs4_t uc)
766 _UC_ATTRIBUTE_CONST;
767extern bool uc_is_property_changes_when_uppercased (ucs4_t uc)
768 _UC_ATTRIBUTE_CONST;
769extern bool uc_is_property_changes_when_titlecased (ucs4_t uc)
770 _UC_ATTRIBUTE_CONST;
771extern bool uc_is_property_changes_when_casefolded (ucs4_t uc)
772 _UC_ATTRIBUTE_CONST;
773extern bool uc_is_property_changes_when_casemapped (ucs4_t uc)
774 _UC_ATTRIBUTE_CONST;
775extern bool uc_is_property_soft_dotted (ucs4_t uc)
776 _UC_ATTRIBUTE_CONST;
777extern bool uc_is_property_id_start (ucs4_t uc)
778 _UC_ATTRIBUTE_CONST;
779extern bool uc_is_property_other_id_start (ucs4_t uc)
780 _UC_ATTRIBUTE_CONST;
781extern bool uc_is_property_id_continue (ucs4_t uc)
782 _UC_ATTRIBUTE_CONST;
783extern bool uc_is_property_other_id_continue (ucs4_t uc)
784 _UC_ATTRIBUTE_CONST;
785extern bool uc_is_property_xid_start (ucs4_t uc)
786 _UC_ATTRIBUTE_CONST;
787extern bool uc_is_property_xid_continue (ucs4_t uc)
788 _UC_ATTRIBUTE_CONST;
789extern bool uc_is_property_id_compat_math_start (ucs4_t uc)
790 _UC_ATTRIBUTE_CONST;
791extern bool uc_is_property_id_compat_math_continue (ucs4_t uc)
792 _UC_ATTRIBUTE_CONST;
793extern bool uc_is_property_pattern_white_space (ucs4_t uc)
794 _UC_ATTRIBUTE_CONST;
795extern bool uc_is_property_pattern_syntax (ucs4_t uc)
796 _UC_ATTRIBUTE_CONST;
797extern bool uc_is_property_join_control (ucs4_t uc)
798 _UC_ATTRIBUTE_CONST;
799extern bool uc_is_property_grapheme_base (ucs4_t uc)
800 _UC_ATTRIBUTE_CONST;
801extern bool uc_is_property_grapheme_extend (ucs4_t uc)
802 _UC_ATTRIBUTE_CONST;
803extern bool uc_is_property_other_grapheme_extend (ucs4_t uc)
804 _UC_ATTRIBUTE_CONST;
805extern bool uc_is_property_grapheme_link (ucs4_t uc)
806 _UC_ATTRIBUTE_CONST;
807extern bool uc_is_property_modifier_combining_mark (ucs4_t uc)
808 _UC_ATTRIBUTE_CONST;
809extern bool uc_is_property_bidi_control (ucs4_t uc)
810 _UC_ATTRIBUTE_CONST;
811extern bool uc_is_property_bidi_left_to_right (ucs4_t uc)
812 _UC_ATTRIBUTE_CONST;
813extern bool uc_is_property_bidi_hebrew_right_to_left (ucs4_t uc)
814 _UC_ATTRIBUTE_CONST;
815extern bool uc_is_property_bidi_arabic_right_to_left (ucs4_t uc)
816 _UC_ATTRIBUTE_CONST;
817extern bool uc_is_property_bidi_european_digit (ucs4_t uc)
818 _UC_ATTRIBUTE_CONST;
819extern bool uc_is_property_bidi_eur_num_separator (ucs4_t uc)
820 _UC_ATTRIBUTE_CONST;
821extern bool uc_is_property_bidi_eur_num_terminator (ucs4_t uc)
822 _UC_ATTRIBUTE_CONST;
823extern bool uc_is_property_bidi_arabic_digit (ucs4_t uc)
824 _UC_ATTRIBUTE_CONST;
825extern bool uc_is_property_bidi_common_separator (ucs4_t uc)
826 _UC_ATTRIBUTE_CONST;
827extern bool uc_is_property_bidi_block_separator (ucs4_t uc)
828 _UC_ATTRIBUTE_CONST;
829extern bool uc_is_property_bidi_segment_separator (ucs4_t uc)
830 _UC_ATTRIBUTE_CONST;
831extern bool uc_is_property_bidi_whitespace (ucs4_t uc)
832 _UC_ATTRIBUTE_CONST;
833extern bool uc_is_property_bidi_non_spacing_mark (ucs4_t uc)
834 _UC_ATTRIBUTE_CONST;
835extern bool uc_is_property_bidi_boundary_neutral (ucs4_t uc)
836 _UC_ATTRIBUTE_CONST;
837extern bool uc_is_property_bidi_pdf (ucs4_t uc)
838 _UC_ATTRIBUTE_CONST;
839extern bool uc_is_property_bidi_embedding_or_override (ucs4_t uc)
840 _UC_ATTRIBUTE_CONST;
841extern bool uc_is_property_bidi_other_neutral (ucs4_t uc)
842 _UC_ATTRIBUTE_CONST;
843extern bool uc_is_property_hex_digit (ucs4_t uc)
844 _UC_ATTRIBUTE_CONST;
845extern bool uc_is_property_ascii_hex_digit (ucs4_t uc)
846 _UC_ATTRIBUTE_CONST;
847extern bool uc_is_property_ideographic (ucs4_t uc)
848 _UC_ATTRIBUTE_CONST;
849extern bool uc_is_property_unified_ideograph (ucs4_t uc)
850 _UC_ATTRIBUTE_CONST;
851extern bool uc_is_property_radical (ucs4_t uc)
852 _UC_ATTRIBUTE_CONST;
853extern bool uc_is_property_ids_unary_operator (ucs4_t uc)
854 _UC_ATTRIBUTE_CONST;
855extern bool uc_is_property_ids_binary_operator (ucs4_t uc)
856 _UC_ATTRIBUTE_CONST;
857extern bool uc_is_property_ids_trinary_operator (ucs4_t uc)
858 _UC_ATTRIBUTE_CONST;
859extern bool uc_is_property_emoji (ucs4_t uc)
860 _UC_ATTRIBUTE_CONST;
861extern bool uc_is_property_emoji_presentation (ucs4_t uc)
862 _UC_ATTRIBUTE_CONST;
863extern bool uc_is_property_emoji_modifier (ucs4_t uc)
864 _UC_ATTRIBUTE_CONST;
865extern bool uc_is_property_emoji_modifier_base (ucs4_t uc)
866 _UC_ATTRIBUTE_CONST;
867extern bool uc_is_property_emoji_component (ucs4_t uc)
868 _UC_ATTRIBUTE_CONST;
869extern bool uc_is_property_extended_pictographic (ucs4_t uc)
870 _UC_ATTRIBUTE_CONST;
871extern bool uc_is_property_zero_width (ucs4_t uc)
872 _UC_ATTRIBUTE_CONST;
873extern bool uc_is_property_space (ucs4_t uc)
874 _UC_ATTRIBUTE_CONST;
875extern bool uc_is_property_non_break (ucs4_t uc)
876 _UC_ATTRIBUTE_CONST;
877extern bool uc_is_property_iso_control (ucs4_t uc)
878 _UC_ATTRIBUTE_CONST;
879extern bool uc_is_property_format_control (ucs4_t uc)
880 _UC_ATTRIBUTE_CONST;
881extern bool uc_is_property_prepended_concatenation_mark (ucs4_t uc)
882 _UC_ATTRIBUTE_CONST;
883extern bool uc_is_property_dash (ucs4_t uc)
884 _UC_ATTRIBUTE_CONST;
885extern bool uc_is_property_hyphen (ucs4_t uc)
886 _UC_ATTRIBUTE_CONST;
887extern bool uc_is_property_punctuation (ucs4_t uc)
888 _UC_ATTRIBUTE_CONST;
889extern bool uc_is_property_line_separator (ucs4_t uc)
890 _UC_ATTRIBUTE_CONST;
891extern bool uc_is_property_paragraph_separator (ucs4_t uc)
892 _UC_ATTRIBUTE_CONST;
893extern bool uc_is_property_quotation_mark (ucs4_t uc)
894 _UC_ATTRIBUTE_CONST;
895extern bool uc_is_property_sentence_terminal (ucs4_t uc)
896 _UC_ATTRIBUTE_CONST;
897extern bool uc_is_property_terminal_punctuation (ucs4_t uc)
898 _UC_ATTRIBUTE_CONST;
899extern bool uc_is_property_currency_symbol (ucs4_t uc)
900 _UC_ATTRIBUTE_CONST;
901extern bool uc_is_property_math (ucs4_t uc)
902 _UC_ATTRIBUTE_CONST;
903extern bool uc_is_property_other_math (ucs4_t uc)
904 _UC_ATTRIBUTE_CONST;
905extern bool uc_is_property_paired_punctuation (ucs4_t uc)
906 _UC_ATTRIBUTE_CONST;
907extern bool uc_is_property_left_of_pair (ucs4_t uc)
908 _UC_ATTRIBUTE_CONST;
909extern bool uc_is_property_combining (ucs4_t uc)
910 _UC_ATTRIBUTE_CONST;
911extern bool uc_is_property_composite (ucs4_t uc)
912 _UC_ATTRIBUTE_CONST;
913extern bool uc_is_property_decimal_digit (ucs4_t uc)
914 _UC_ATTRIBUTE_CONST;
915extern bool uc_is_property_numeric (ucs4_t uc)
916 _UC_ATTRIBUTE_CONST;
917extern bool uc_is_property_diacritic (ucs4_t uc)
918 _UC_ATTRIBUTE_CONST;
919extern bool uc_is_property_extender (ucs4_t uc)
920 _UC_ATTRIBUTE_CONST;
921extern bool uc_is_property_ignorable_control (ucs4_t uc)
922 _UC_ATTRIBUTE_CONST;
923extern bool uc_is_property_regional_indicator (ucs4_t uc)
924 _UC_ATTRIBUTE_CONST;
925
926/* ========================================================================= */
927
928/* Other attributes. */
929
930/* ------------------------------------------------------------------------- */
931
932/* Indic_Conjunct_Break (InCB): from the file DerivedCoreProperties.txt
933 in the Unicode Character Database. */
934
935/* Possible values of the Indic_Conjunct_Break attribute.
936 This enumeration may be extended in the future. */
937enum
938{
939 UC_INDIC_CONJUNCT_BREAK_NONE, /* None */
940 UC_INDIC_CONJUNCT_BREAK_CONSONANT, /* Consonant */
941 UC_INDIC_CONJUNCT_BREAK_LINKER, /* Linker */
942 UC_INDIC_CONJUNCT_BREAK_EXTEND /* Extend */
943};
944
945/* Return the name of an Indic_Conjunct_Break value. */
946extern const char *
947 uc_indic_conjunct_break_name (int indic_conjunct_break)
948 _UC_ATTRIBUTE_CONST;
949
950/* Return the Indic_Conjunct_Break value given by name, e.g. "Consonant". */
951extern int
952 uc_indic_conjunct_break_byname (const char *indic_conjunct_break_name)
953 _UC_ATTRIBUTE_PURE;
954
955/* Return the Indic_Conjunct_Break attribute of a Unicode character. */
956extern int
957 uc_indic_conjunct_break (ucs4_t uc)
958 _UC_ATTRIBUTE_CONST;
959
960/* ========================================================================= */
961
962/* Subdivision of the Unicode characters into scripts. */
963
964typedef struct
965{
966 unsigned int code : 21;
967 unsigned int start : 1;
968 unsigned int end : 1;
969}
970uc_interval_t;
971typedef struct
972{
973 unsigned int nintervals;
974 const uc_interval_t *intervals;
975 const char *name;
976}
977uc_script_t;
978
979/* Return the script of a Unicode character. */
980extern const uc_script_t *
981 uc_script (ucs4_t uc)
982 _UC_ATTRIBUTE_CONST;
983
984/* Return the script given by name, e.g. "HAN". */
985extern const uc_script_t *
986 uc_script_byname (const char *script_name)
987 _UC_ATTRIBUTE_PURE;
988
989/* Test whether a Unicode character belongs to a given script. */
990extern bool
991 uc_is_script (ucs4_t uc, const uc_script_t *script)
992 _UC_ATTRIBUTE_PURE;
993
994/* Get the list of all scripts. */
995extern void
996 uc_all_scripts (const uc_script_t **scripts, size_t *count);
997
998/* ========================================================================= */
999
1000/* Subdivision of the Unicode character range into blocks. */
1001
1002typedef struct
1003{
1004 ucs4_t start;
1005 ucs4_t end;
1006 const char *name;
1007}
1008uc_block_t;
1009
1010/* Return the block a character belongs to. */
1011extern const uc_block_t *
1012 uc_block (ucs4_t uc)
1013 _UC_ATTRIBUTE_CONST;
1014
1015/* Test whether a Unicode character belongs to a given block. */
1016extern bool
1017 uc_is_block (ucs4_t uc, const uc_block_t *block)
1018 _UC_ATTRIBUTE_PURE;
1019
1020/* Get the list of all blocks. */
1021extern void
1022 uc_all_blocks (const uc_block_t **blocks, size_t *count);
1023
1024/* ========================================================================= */
1025
1026/* Properties taken from language standards. */
1027
1028/* Test whether a Unicode character is considered whitespace in ISO C 99. */
1029extern bool
1030 uc_is_c_whitespace (ucs4_t uc)
1031 _UC_ATTRIBUTE_CONST;
1032
1033/* Test whether a Unicode character is considered whitespace in Java. */
1034extern bool
1035 uc_is_java_whitespace (ucs4_t uc)
1036 _UC_ATTRIBUTE_CONST;
1037
1038enum
1039{
1040 UC_IDENTIFIER_START, /* valid as first or subsequent character */
1041 UC_IDENTIFIER_VALID, /* valid as subsequent character only */
1042 UC_IDENTIFIER_INVALID, /* not valid */
1043 UC_IDENTIFIER_IGNORABLE /* ignorable (Java only) */
1044};
1045
1046/* Return the categorization of a Unicode character w.r.t. the ISO C 99
1047 identifier syntax. */
1048extern int
1049 uc_c_ident_category (ucs4_t uc)
1050 _UC_ATTRIBUTE_CONST;
1051
1052/* Return the categorization of a Unicode character w.r.t. the Java
1053 identifier syntax. */
1054extern int
1055 uc_java_ident_category (ucs4_t uc)
1056 _UC_ATTRIBUTE_CONST;
1057
1058/* ========================================================================= */
1059
1060/* Like ISO C <ctype.h> and <wctype.h>. These functions are deprecated,
1061 because this set of functions was designed with ASCII in mind and cannot
1062 reflect the more diverse reality of the Unicode character set. But they
1063 can be a quick-and-dirty porting aid when migrating from wchar_t APIs
1064 to Unicode strings. */
1065
1066/* Test for any character for which 'uc_is_alpha' or 'uc_is_digit' is true. */
1067extern bool
1068 uc_is_alnum (ucs4_t uc)
1069 _UC_ATTRIBUTE_CONST;
1070
1071/* Test for any character for which 'uc_is_upper' or 'uc_is_lower' is true,
1072 or any character that is one of a locale-specific set of characters for
1073 which none of 'uc_is_cntrl', 'uc_is_digit', 'uc_is_punct', or 'uc_is_space'
1074 is true. */
1075extern bool
1076 uc_is_alpha (ucs4_t uc)
1077 _UC_ATTRIBUTE_CONST;
1078
1079/* Test for any control character. */
1080extern bool
1081 uc_is_cntrl (ucs4_t uc)
1082 _UC_ATTRIBUTE_CONST;
1083
1084/* Test for any character that corresponds to a decimal-digit character. */
1085extern bool
1086 uc_is_digit (ucs4_t uc)
1087 _UC_ATTRIBUTE_CONST;
1088
1089/* Test for any character for which 'uc_is_print' is true and 'uc_is_space'
1090 is false. */
1091extern bool
1092 uc_is_graph (ucs4_t uc)
1093 _UC_ATTRIBUTE_CONST;
1094
1095/* Test for any character that corresponds to a lowercase letter or is one
1096 of a locale-specific set of characters for which none of 'uc_is_cntrl',
1097 'uc_is_digit', 'uc_is_punct', or 'uc_is_space' is true. */
1098extern bool
1099 uc_is_lower (ucs4_t uc)
1100 _UC_ATTRIBUTE_CONST;
1101
1102/* Test for any printing character. */
1103extern bool
1104 uc_is_print (ucs4_t uc)
1105 _UC_ATTRIBUTE_CONST;
1106
1107/* Test for any printing character that is one of a locale-specific set of
1108 characters for which neither 'uc_is_space' nor 'uc_is_alnum' is true. */
1109extern bool
1110 uc_is_punct (ucs4_t uc)
1111 _UC_ATTRIBUTE_CONST;
1112
1113/* Test for any character that corresponds to a locale-specific set of
1114 characters for which none of 'uc_is_alnum', 'uc_is_graph', or 'uc_is_punct'
1115 is true. */
1116extern bool
1117 uc_is_space (ucs4_t uc)
1118 _UC_ATTRIBUTE_CONST;
1119
1120/* Test for any character that corresponds to an uppercase letter or is one
1121 of a locale-specific set of character for which none of 'uc_is_cntrl',
1122 'uc_is_digit', 'uc_is_punct', or 'uc_is_space' is true. */
1123extern bool
1124 uc_is_upper (ucs4_t uc)
1125 _UC_ATTRIBUTE_CONST;
1126
1127/* Test for any character that corresponds to a hexadecimal-digit
1128 character. */
1129extern bool
1130 uc_is_xdigit (ucs4_t uc)
1131 _UC_ATTRIBUTE_CONST;
1132
1133/* GNU extension. */
1134/* Test for any character that corresponds to a standard blank character or
1135 a locale-specific set of characters for which 'uc_is_alnum' is false. */
1136extern bool
1137 uc_is_blank (ucs4_t uc)
1138 _UC_ATTRIBUTE_CONST;
1139
1140/* ========================================================================= */
1141
1142#ifdef __cplusplus
1143}
1144#endif
1145
1146#endif /* _UNICTYPE_H */
diff --git a/gl/unictype/.deps/.dirstamp b/gl/unictype/.deps/.dirstamp
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/gl/unictype/.deps/.dirstamp
diff --git a/gl/unictype/.deps/libgnu_a-ctype_alnum.Po b/gl/unictype/.deps/libgnu_a-ctype_alnum.Po
new file mode 100644
index 00000000..429d1968
--- /dev/null
+++ b/gl/unictype/.deps/libgnu_a-ctype_alnum.Po
@@ -0,0 +1,48 @@
1unictype/libgnu_a-ctype_alnum.o: unictype/ctype_alnum.c \
2 /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \
3 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \
4 /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
5 /usr/include/features.h /usr/include/features-time64.h \
6 /usr/include/x86_64-linux-gnu/bits/wordsize.h \
7 /usr/include/x86_64-linux-gnu/bits/timesize.h \
8 /usr/include/x86_64-linux-gnu/sys/cdefs.h \
9 /usr/include/x86_64-linux-gnu/bits/long-double.h \
10 /usr/include/x86_64-linux-gnu/gnu/stubs.h \
11 /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
12 /usr/include/x86_64-linux-gnu/bits/types.h \
13 /usr/include/x86_64-linux-gnu/bits/typesizes.h \
14 /usr/include/x86_64-linux-gnu/bits/time64.h \
15 /usr/include/x86_64-linux-gnu/bits/wchar.h \
16 /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
17 /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
18 /usr/include/x86_64-linux-gnu/bits/stdint-least.h \
19 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \
20 /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \
21 unictype/ctype_alnum.h
22/usr/include/stdc-predef.h:
23../config.h:
24unictype.h:
25unitypes.h:
26/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h:
27/usr/include/stdint.h:
28/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:
29/usr/include/features.h:
30/usr/include/features-time64.h:
31/usr/include/x86_64-linux-gnu/bits/wordsize.h:
32/usr/include/x86_64-linux-gnu/bits/timesize.h:
33/usr/include/x86_64-linux-gnu/sys/cdefs.h:
34/usr/include/x86_64-linux-gnu/bits/long-double.h:
35/usr/include/x86_64-linux-gnu/gnu/stubs.h:
36/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
37/usr/include/x86_64-linux-gnu/bits/types.h:
38/usr/include/x86_64-linux-gnu/bits/typesizes.h:
39/usr/include/x86_64-linux-gnu/bits/time64.h:
40/usr/include/x86_64-linux-gnu/bits/wchar.h:
41/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:
42/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h:
43/usr/include/x86_64-linux-gnu/bits/stdint-least.h:
44/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h:
45stddef.h:
46/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:
47unictype/bitmap.h:
48unictype/ctype_alnum.h:
diff --git a/gl/unictype/.deps/libgnu_a-ctype_alpha.Po b/gl/unictype/.deps/libgnu_a-ctype_alpha.Po
new file mode 100644
index 00000000..f2d01713
--- /dev/null
+++ b/gl/unictype/.deps/libgnu_a-ctype_alpha.Po
@@ -0,0 +1,48 @@
1unictype/libgnu_a-ctype_alpha.o: unictype/ctype_alpha.c \
2 /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \
3 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \
4 /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
5 /usr/include/features.h /usr/include/features-time64.h \
6 /usr/include/x86_64-linux-gnu/bits/wordsize.h \
7 /usr/include/x86_64-linux-gnu/bits/timesize.h \
8 /usr/include/x86_64-linux-gnu/sys/cdefs.h \
9 /usr/include/x86_64-linux-gnu/bits/long-double.h \
10 /usr/include/x86_64-linux-gnu/gnu/stubs.h \
11 /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
12 /usr/include/x86_64-linux-gnu/bits/types.h \
13 /usr/include/x86_64-linux-gnu/bits/typesizes.h \
14 /usr/include/x86_64-linux-gnu/bits/time64.h \
15 /usr/include/x86_64-linux-gnu/bits/wchar.h \
16 /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
17 /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
18 /usr/include/x86_64-linux-gnu/bits/stdint-least.h \
19 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \
20 /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \
21 unictype/ctype_alpha.h
22/usr/include/stdc-predef.h:
23../config.h:
24unictype.h:
25unitypes.h:
26/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h:
27/usr/include/stdint.h:
28/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:
29/usr/include/features.h:
30/usr/include/features-time64.h:
31/usr/include/x86_64-linux-gnu/bits/wordsize.h:
32/usr/include/x86_64-linux-gnu/bits/timesize.h:
33/usr/include/x86_64-linux-gnu/sys/cdefs.h:
34/usr/include/x86_64-linux-gnu/bits/long-double.h:
35/usr/include/x86_64-linux-gnu/gnu/stubs.h:
36/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
37/usr/include/x86_64-linux-gnu/bits/types.h:
38/usr/include/x86_64-linux-gnu/bits/typesizes.h:
39/usr/include/x86_64-linux-gnu/bits/time64.h:
40/usr/include/x86_64-linux-gnu/bits/wchar.h:
41/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:
42/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h:
43/usr/include/x86_64-linux-gnu/bits/stdint-least.h:
44/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h:
45stddef.h:
46/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:
47unictype/bitmap.h:
48unictype/ctype_alpha.h:
diff --git a/gl/unictype/.deps/libgnu_a-ctype_blank.Po b/gl/unictype/.deps/libgnu_a-ctype_blank.Po
new file mode 100644
index 00000000..82be4126
--- /dev/null
+++ b/gl/unictype/.deps/libgnu_a-ctype_blank.Po
@@ -0,0 +1,48 @@
1unictype/libgnu_a-ctype_blank.o: unictype/ctype_blank.c \
2 /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \
3 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \
4 /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
5 /usr/include/features.h /usr/include/features-time64.h \
6 /usr/include/x86_64-linux-gnu/bits/wordsize.h \
7 /usr/include/x86_64-linux-gnu/bits/timesize.h \
8 /usr/include/x86_64-linux-gnu/sys/cdefs.h \
9 /usr/include/x86_64-linux-gnu/bits/long-double.h \
10 /usr/include/x86_64-linux-gnu/gnu/stubs.h \
11 /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
12 /usr/include/x86_64-linux-gnu/bits/types.h \
13 /usr/include/x86_64-linux-gnu/bits/typesizes.h \
14 /usr/include/x86_64-linux-gnu/bits/time64.h \
15 /usr/include/x86_64-linux-gnu/bits/wchar.h \
16 /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
17 /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
18 /usr/include/x86_64-linux-gnu/bits/stdint-least.h \
19 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \
20 /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \
21 unictype/ctype_blank.h
22/usr/include/stdc-predef.h:
23../config.h:
24unictype.h:
25unitypes.h:
26/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h:
27/usr/include/stdint.h:
28/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:
29/usr/include/features.h:
30/usr/include/features-time64.h:
31/usr/include/x86_64-linux-gnu/bits/wordsize.h:
32/usr/include/x86_64-linux-gnu/bits/timesize.h:
33/usr/include/x86_64-linux-gnu/sys/cdefs.h:
34/usr/include/x86_64-linux-gnu/bits/long-double.h:
35/usr/include/x86_64-linux-gnu/gnu/stubs.h:
36/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
37/usr/include/x86_64-linux-gnu/bits/types.h:
38/usr/include/x86_64-linux-gnu/bits/typesizes.h:
39/usr/include/x86_64-linux-gnu/bits/time64.h:
40/usr/include/x86_64-linux-gnu/bits/wchar.h:
41/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:
42/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h:
43/usr/include/x86_64-linux-gnu/bits/stdint-least.h:
44/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h:
45stddef.h:
46/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:
47unictype/bitmap.h:
48unictype/ctype_blank.h:
diff --git a/gl/unictype/.deps/libgnu_a-ctype_cntrl.Po b/gl/unictype/.deps/libgnu_a-ctype_cntrl.Po
new file mode 100644
index 00000000..dfb2233d
--- /dev/null
+++ b/gl/unictype/.deps/libgnu_a-ctype_cntrl.Po
@@ -0,0 +1,48 @@
1unictype/libgnu_a-ctype_cntrl.o: unictype/ctype_cntrl.c \
2 /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \
3 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \
4 /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
5 /usr/include/features.h /usr/include/features-time64.h \
6 /usr/include/x86_64-linux-gnu/bits/wordsize.h \
7 /usr/include/x86_64-linux-gnu/bits/timesize.h \
8 /usr/include/x86_64-linux-gnu/sys/cdefs.h \
9 /usr/include/x86_64-linux-gnu/bits/long-double.h \
10 /usr/include/x86_64-linux-gnu/gnu/stubs.h \
11 /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
12 /usr/include/x86_64-linux-gnu/bits/types.h \
13 /usr/include/x86_64-linux-gnu/bits/typesizes.h \
14 /usr/include/x86_64-linux-gnu/bits/time64.h \
15 /usr/include/x86_64-linux-gnu/bits/wchar.h \
16 /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
17 /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
18 /usr/include/x86_64-linux-gnu/bits/stdint-least.h \
19 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \
20 /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \
21 unictype/ctype_cntrl.h
22/usr/include/stdc-predef.h:
23../config.h:
24unictype.h:
25unitypes.h:
26/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h:
27/usr/include/stdint.h:
28/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:
29/usr/include/features.h:
30/usr/include/features-time64.h:
31/usr/include/x86_64-linux-gnu/bits/wordsize.h:
32/usr/include/x86_64-linux-gnu/bits/timesize.h:
33/usr/include/x86_64-linux-gnu/sys/cdefs.h:
34/usr/include/x86_64-linux-gnu/bits/long-double.h:
35/usr/include/x86_64-linux-gnu/gnu/stubs.h:
36/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
37/usr/include/x86_64-linux-gnu/bits/types.h:
38/usr/include/x86_64-linux-gnu/bits/typesizes.h:
39/usr/include/x86_64-linux-gnu/bits/time64.h:
40/usr/include/x86_64-linux-gnu/bits/wchar.h:
41/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:
42/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h:
43/usr/include/x86_64-linux-gnu/bits/stdint-least.h:
44/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h:
45stddef.h:
46/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:
47unictype/bitmap.h:
48unictype/ctype_cntrl.h:
diff --git a/gl/unictype/.deps/libgnu_a-ctype_digit.Po b/gl/unictype/.deps/libgnu_a-ctype_digit.Po
new file mode 100644
index 00000000..d243fcc1
--- /dev/null
+++ b/gl/unictype/.deps/libgnu_a-ctype_digit.Po
@@ -0,0 +1,48 @@
1unictype/libgnu_a-ctype_digit.o: unictype/ctype_digit.c \
2 /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \
3 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \
4 /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
5 /usr/include/features.h /usr/include/features-time64.h \
6 /usr/include/x86_64-linux-gnu/bits/wordsize.h \
7 /usr/include/x86_64-linux-gnu/bits/timesize.h \
8 /usr/include/x86_64-linux-gnu/sys/cdefs.h \
9 /usr/include/x86_64-linux-gnu/bits/long-double.h \
10 /usr/include/x86_64-linux-gnu/gnu/stubs.h \
11 /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
12 /usr/include/x86_64-linux-gnu/bits/types.h \
13 /usr/include/x86_64-linux-gnu/bits/typesizes.h \
14 /usr/include/x86_64-linux-gnu/bits/time64.h \
15 /usr/include/x86_64-linux-gnu/bits/wchar.h \
16 /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
17 /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
18 /usr/include/x86_64-linux-gnu/bits/stdint-least.h \
19 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \
20 /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \
21 unictype/ctype_digit.h
22/usr/include/stdc-predef.h:
23../config.h:
24unictype.h:
25unitypes.h:
26/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h:
27/usr/include/stdint.h:
28/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:
29/usr/include/features.h:
30/usr/include/features-time64.h:
31/usr/include/x86_64-linux-gnu/bits/wordsize.h:
32/usr/include/x86_64-linux-gnu/bits/timesize.h:
33/usr/include/x86_64-linux-gnu/sys/cdefs.h:
34/usr/include/x86_64-linux-gnu/bits/long-double.h:
35/usr/include/x86_64-linux-gnu/gnu/stubs.h:
36/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
37/usr/include/x86_64-linux-gnu/bits/types.h:
38/usr/include/x86_64-linux-gnu/bits/typesizes.h:
39/usr/include/x86_64-linux-gnu/bits/time64.h:
40/usr/include/x86_64-linux-gnu/bits/wchar.h:
41/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:
42/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h:
43/usr/include/x86_64-linux-gnu/bits/stdint-least.h:
44/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h:
45stddef.h:
46/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:
47unictype/bitmap.h:
48unictype/ctype_digit.h:
diff --git a/gl/unictype/.deps/libgnu_a-ctype_graph.Po b/gl/unictype/.deps/libgnu_a-ctype_graph.Po
new file mode 100644
index 00000000..9850fe6f
--- /dev/null
+++ b/gl/unictype/.deps/libgnu_a-ctype_graph.Po
@@ -0,0 +1,48 @@
1unictype/libgnu_a-ctype_graph.o: unictype/ctype_graph.c \
2 /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \
3 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \
4 /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
5 /usr/include/features.h /usr/include/features-time64.h \
6 /usr/include/x86_64-linux-gnu/bits/wordsize.h \
7 /usr/include/x86_64-linux-gnu/bits/timesize.h \
8 /usr/include/x86_64-linux-gnu/sys/cdefs.h \
9 /usr/include/x86_64-linux-gnu/bits/long-double.h \
10 /usr/include/x86_64-linux-gnu/gnu/stubs.h \
11 /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
12 /usr/include/x86_64-linux-gnu/bits/types.h \
13 /usr/include/x86_64-linux-gnu/bits/typesizes.h \
14 /usr/include/x86_64-linux-gnu/bits/time64.h \
15 /usr/include/x86_64-linux-gnu/bits/wchar.h \
16 /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
17 /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
18 /usr/include/x86_64-linux-gnu/bits/stdint-least.h \
19 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \
20 /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \
21 unictype/ctype_graph.h
22/usr/include/stdc-predef.h:
23../config.h:
24unictype.h:
25unitypes.h:
26/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h:
27/usr/include/stdint.h:
28/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:
29/usr/include/features.h:
30/usr/include/features-time64.h:
31/usr/include/x86_64-linux-gnu/bits/wordsize.h:
32/usr/include/x86_64-linux-gnu/bits/timesize.h:
33/usr/include/x86_64-linux-gnu/sys/cdefs.h:
34/usr/include/x86_64-linux-gnu/bits/long-double.h:
35/usr/include/x86_64-linux-gnu/gnu/stubs.h:
36/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
37/usr/include/x86_64-linux-gnu/bits/types.h:
38/usr/include/x86_64-linux-gnu/bits/typesizes.h:
39/usr/include/x86_64-linux-gnu/bits/time64.h:
40/usr/include/x86_64-linux-gnu/bits/wchar.h:
41/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:
42/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h:
43/usr/include/x86_64-linux-gnu/bits/stdint-least.h:
44/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h:
45stddef.h:
46/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:
47unictype/bitmap.h:
48unictype/ctype_graph.h:
diff --git a/gl/unictype/.deps/libgnu_a-ctype_lower.Po b/gl/unictype/.deps/libgnu_a-ctype_lower.Po
new file mode 100644
index 00000000..6447d3e4
--- /dev/null
+++ b/gl/unictype/.deps/libgnu_a-ctype_lower.Po
@@ -0,0 +1,48 @@
1unictype/libgnu_a-ctype_lower.o: unictype/ctype_lower.c \
2 /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \
3 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \
4 /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
5 /usr/include/features.h /usr/include/features-time64.h \
6 /usr/include/x86_64-linux-gnu/bits/wordsize.h \
7 /usr/include/x86_64-linux-gnu/bits/timesize.h \
8 /usr/include/x86_64-linux-gnu/sys/cdefs.h \
9 /usr/include/x86_64-linux-gnu/bits/long-double.h \
10 /usr/include/x86_64-linux-gnu/gnu/stubs.h \
11 /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
12 /usr/include/x86_64-linux-gnu/bits/types.h \
13 /usr/include/x86_64-linux-gnu/bits/typesizes.h \
14 /usr/include/x86_64-linux-gnu/bits/time64.h \
15 /usr/include/x86_64-linux-gnu/bits/wchar.h \
16 /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
17 /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
18 /usr/include/x86_64-linux-gnu/bits/stdint-least.h \
19 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \
20 /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \
21 unictype/ctype_lower.h
22/usr/include/stdc-predef.h:
23../config.h:
24unictype.h:
25unitypes.h:
26/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h:
27/usr/include/stdint.h:
28/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:
29/usr/include/features.h:
30/usr/include/features-time64.h:
31/usr/include/x86_64-linux-gnu/bits/wordsize.h:
32/usr/include/x86_64-linux-gnu/bits/timesize.h:
33/usr/include/x86_64-linux-gnu/sys/cdefs.h:
34/usr/include/x86_64-linux-gnu/bits/long-double.h:
35/usr/include/x86_64-linux-gnu/gnu/stubs.h:
36/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
37/usr/include/x86_64-linux-gnu/bits/types.h:
38/usr/include/x86_64-linux-gnu/bits/typesizes.h:
39/usr/include/x86_64-linux-gnu/bits/time64.h:
40/usr/include/x86_64-linux-gnu/bits/wchar.h:
41/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:
42/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h:
43/usr/include/x86_64-linux-gnu/bits/stdint-least.h:
44/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h:
45stddef.h:
46/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:
47unictype/bitmap.h:
48unictype/ctype_lower.h:
diff --git a/gl/unictype/.deps/libgnu_a-ctype_print.Po b/gl/unictype/.deps/libgnu_a-ctype_print.Po
new file mode 100644
index 00000000..f592e16c
--- /dev/null
+++ b/gl/unictype/.deps/libgnu_a-ctype_print.Po
@@ -0,0 +1,48 @@
1unictype/libgnu_a-ctype_print.o: unictype/ctype_print.c \
2 /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \
3 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \
4 /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
5 /usr/include/features.h /usr/include/features-time64.h \
6 /usr/include/x86_64-linux-gnu/bits/wordsize.h \
7 /usr/include/x86_64-linux-gnu/bits/timesize.h \
8 /usr/include/x86_64-linux-gnu/sys/cdefs.h \
9 /usr/include/x86_64-linux-gnu/bits/long-double.h \
10 /usr/include/x86_64-linux-gnu/gnu/stubs.h \
11 /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
12 /usr/include/x86_64-linux-gnu/bits/types.h \
13 /usr/include/x86_64-linux-gnu/bits/typesizes.h \
14 /usr/include/x86_64-linux-gnu/bits/time64.h \
15 /usr/include/x86_64-linux-gnu/bits/wchar.h \
16 /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
17 /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
18 /usr/include/x86_64-linux-gnu/bits/stdint-least.h \
19 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \
20 /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \
21 unictype/ctype_print.h
22/usr/include/stdc-predef.h:
23../config.h:
24unictype.h:
25unitypes.h:
26/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h:
27/usr/include/stdint.h:
28/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:
29/usr/include/features.h:
30/usr/include/features-time64.h:
31/usr/include/x86_64-linux-gnu/bits/wordsize.h:
32/usr/include/x86_64-linux-gnu/bits/timesize.h:
33/usr/include/x86_64-linux-gnu/sys/cdefs.h:
34/usr/include/x86_64-linux-gnu/bits/long-double.h:
35/usr/include/x86_64-linux-gnu/gnu/stubs.h:
36/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
37/usr/include/x86_64-linux-gnu/bits/types.h:
38/usr/include/x86_64-linux-gnu/bits/typesizes.h:
39/usr/include/x86_64-linux-gnu/bits/time64.h:
40/usr/include/x86_64-linux-gnu/bits/wchar.h:
41/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:
42/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h:
43/usr/include/x86_64-linux-gnu/bits/stdint-least.h:
44/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h:
45stddef.h:
46/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:
47unictype/bitmap.h:
48unictype/ctype_print.h:
diff --git a/gl/unictype/.deps/libgnu_a-ctype_punct.Po b/gl/unictype/.deps/libgnu_a-ctype_punct.Po
new file mode 100644
index 00000000..245e5396
--- /dev/null
+++ b/gl/unictype/.deps/libgnu_a-ctype_punct.Po
@@ -0,0 +1,48 @@
1unictype/libgnu_a-ctype_punct.o: unictype/ctype_punct.c \
2 /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \
3 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \
4 /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
5 /usr/include/features.h /usr/include/features-time64.h \
6 /usr/include/x86_64-linux-gnu/bits/wordsize.h \
7 /usr/include/x86_64-linux-gnu/bits/timesize.h \
8 /usr/include/x86_64-linux-gnu/sys/cdefs.h \
9 /usr/include/x86_64-linux-gnu/bits/long-double.h \
10 /usr/include/x86_64-linux-gnu/gnu/stubs.h \
11 /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
12 /usr/include/x86_64-linux-gnu/bits/types.h \
13 /usr/include/x86_64-linux-gnu/bits/typesizes.h \
14 /usr/include/x86_64-linux-gnu/bits/time64.h \
15 /usr/include/x86_64-linux-gnu/bits/wchar.h \
16 /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
17 /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
18 /usr/include/x86_64-linux-gnu/bits/stdint-least.h \
19 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \
20 /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \
21 unictype/ctype_punct.h
22/usr/include/stdc-predef.h:
23../config.h:
24unictype.h:
25unitypes.h:
26/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h:
27/usr/include/stdint.h:
28/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:
29/usr/include/features.h:
30/usr/include/features-time64.h:
31/usr/include/x86_64-linux-gnu/bits/wordsize.h:
32/usr/include/x86_64-linux-gnu/bits/timesize.h:
33/usr/include/x86_64-linux-gnu/sys/cdefs.h:
34/usr/include/x86_64-linux-gnu/bits/long-double.h:
35/usr/include/x86_64-linux-gnu/gnu/stubs.h:
36/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
37/usr/include/x86_64-linux-gnu/bits/types.h:
38/usr/include/x86_64-linux-gnu/bits/typesizes.h:
39/usr/include/x86_64-linux-gnu/bits/time64.h:
40/usr/include/x86_64-linux-gnu/bits/wchar.h:
41/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:
42/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h:
43/usr/include/x86_64-linux-gnu/bits/stdint-least.h:
44/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h:
45stddef.h:
46/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:
47unictype/bitmap.h:
48unictype/ctype_punct.h:
diff --git a/gl/unictype/.deps/libgnu_a-ctype_space.Po b/gl/unictype/.deps/libgnu_a-ctype_space.Po
new file mode 100644
index 00000000..2b51c518
--- /dev/null
+++ b/gl/unictype/.deps/libgnu_a-ctype_space.Po
@@ -0,0 +1,48 @@
1unictype/libgnu_a-ctype_space.o: unictype/ctype_space.c \
2 /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \
3 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \
4 /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
5 /usr/include/features.h /usr/include/features-time64.h \
6 /usr/include/x86_64-linux-gnu/bits/wordsize.h \
7 /usr/include/x86_64-linux-gnu/bits/timesize.h \
8 /usr/include/x86_64-linux-gnu/sys/cdefs.h \
9 /usr/include/x86_64-linux-gnu/bits/long-double.h \
10 /usr/include/x86_64-linux-gnu/gnu/stubs.h \
11 /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
12 /usr/include/x86_64-linux-gnu/bits/types.h \
13 /usr/include/x86_64-linux-gnu/bits/typesizes.h \
14 /usr/include/x86_64-linux-gnu/bits/time64.h \
15 /usr/include/x86_64-linux-gnu/bits/wchar.h \
16 /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
17 /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
18 /usr/include/x86_64-linux-gnu/bits/stdint-least.h \
19 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \
20 /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \
21 unictype/ctype_space.h
22/usr/include/stdc-predef.h:
23../config.h:
24unictype.h:
25unitypes.h:
26/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h:
27/usr/include/stdint.h:
28/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:
29/usr/include/features.h:
30/usr/include/features-time64.h:
31/usr/include/x86_64-linux-gnu/bits/wordsize.h:
32/usr/include/x86_64-linux-gnu/bits/timesize.h:
33/usr/include/x86_64-linux-gnu/sys/cdefs.h:
34/usr/include/x86_64-linux-gnu/bits/long-double.h:
35/usr/include/x86_64-linux-gnu/gnu/stubs.h:
36/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
37/usr/include/x86_64-linux-gnu/bits/types.h:
38/usr/include/x86_64-linux-gnu/bits/typesizes.h:
39/usr/include/x86_64-linux-gnu/bits/time64.h:
40/usr/include/x86_64-linux-gnu/bits/wchar.h:
41/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:
42/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h:
43/usr/include/x86_64-linux-gnu/bits/stdint-least.h:
44/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h:
45stddef.h:
46/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:
47unictype/bitmap.h:
48unictype/ctype_space.h:
diff --git a/gl/unictype/.deps/libgnu_a-ctype_upper.Po b/gl/unictype/.deps/libgnu_a-ctype_upper.Po
new file mode 100644
index 00000000..3395834f
--- /dev/null
+++ b/gl/unictype/.deps/libgnu_a-ctype_upper.Po
@@ -0,0 +1,48 @@
1unictype/libgnu_a-ctype_upper.o: unictype/ctype_upper.c \
2 /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \
3 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \
4 /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
5 /usr/include/features.h /usr/include/features-time64.h \
6 /usr/include/x86_64-linux-gnu/bits/wordsize.h \
7 /usr/include/x86_64-linux-gnu/bits/timesize.h \
8 /usr/include/x86_64-linux-gnu/sys/cdefs.h \
9 /usr/include/x86_64-linux-gnu/bits/long-double.h \
10 /usr/include/x86_64-linux-gnu/gnu/stubs.h \
11 /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
12 /usr/include/x86_64-linux-gnu/bits/types.h \
13 /usr/include/x86_64-linux-gnu/bits/typesizes.h \
14 /usr/include/x86_64-linux-gnu/bits/time64.h \
15 /usr/include/x86_64-linux-gnu/bits/wchar.h \
16 /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
17 /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
18 /usr/include/x86_64-linux-gnu/bits/stdint-least.h \
19 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \
20 /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \
21 unictype/ctype_upper.h
22/usr/include/stdc-predef.h:
23../config.h:
24unictype.h:
25unitypes.h:
26/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h:
27/usr/include/stdint.h:
28/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:
29/usr/include/features.h:
30/usr/include/features-time64.h:
31/usr/include/x86_64-linux-gnu/bits/wordsize.h:
32/usr/include/x86_64-linux-gnu/bits/timesize.h:
33/usr/include/x86_64-linux-gnu/sys/cdefs.h:
34/usr/include/x86_64-linux-gnu/bits/long-double.h:
35/usr/include/x86_64-linux-gnu/gnu/stubs.h:
36/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
37/usr/include/x86_64-linux-gnu/bits/types.h:
38/usr/include/x86_64-linux-gnu/bits/typesizes.h:
39/usr/include/x86_64-linux-gnu/bits/time64.h:
40/usr/include/x86_64-linux-gnu/bits/wchar.h:
41/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:
42/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h:
43/usr/include/x86_64-linux-gnu/bits/stdint-least.h:
44/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h:
45stddef.h:
46/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:
47unictype/bitmap.h:
48unictype/ctype_upper.h:
diff --git a/gl/unictype/.deps/libgnu_a-ctype_xdigit.Po b/gl/unictype/.deps/libgnu_a-ctype_xdigit.Po
new file mode 100644
index 00000000..3c05b331
--- /dev/null
+++ b/gl/unictype/.deps/libgnu_a-ctype_xdigit.Po
@@ -0,0 +1,48 @@
1unictype/libgnu_a-ctype_xdigit.o: unictype/ctype_xdigit.c \
2 /usr/include/stdc-predef.h ../config.h unictype.h unitypes.h \
3 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \
4 /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
5 /usr/include/features.h /usr/include/features-time64.h \
6 /usr/include/x86_64-linux-gnu/bits/wordsize.h \
7 /usr/include/x86_64-linux-gnu/bits/timesize.h \
8 /usr/include/x86_64-linux-gnu/sys/cdefs.h \
9 /usr/include/x86_64-linux-gnu/bits/long-double.h \
10 /usr/include/x86_64-linux-gnu/gnu/stubs.h \
11 /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
12 /usr/include/x86_64-linux-gnu/bits/types.h \
13 /usr/include/x86_64-linux-gnu/bits/typesizes.h \
14 /usr/include/x86_64-linux-gnu/bits/time64.h \
15 /usr/include/x86_64-linux-gnu/bits/wchar.h \
16 /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
17 /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
18 /usr/include/x86_64-linux-gnu/bits/stdint-least.h \
19 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h stddef.h \
20 /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h unictype/bitmap.h \
21 unictype/ctype_xdigit.h
22/usr/include/stdc-predef.h:
23../config.h:
24unictype.h:
25unitypes.h:
26/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h:
27/usr/include/stdint.h:
28/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:
29/usr/include/features.h:
30/usr/include/features-time64.h:
31/usr/include/x86_64-linux-gnu/bits/wordsize.h:
32/usr/include/x86_64-linux-gnu/bits/timesize.h:
33/usr/include/x86_64-linux-gnu/sys/cdefs.h:
34/usr/include/x86_64-linux-gnu/bits/long-double.h:
35/usr/include/x86_64-linux-gnu/gnu/stubs.h:
36/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
37/usr/include/x86_64-linux-gnu/bits/types.h:
38/usr/include/x86_64-linux-gnu/bits/typesizes.h:
39/usr/include/x86_64-linux-gnu/bits/time64.h:
40/usr/include/x86_64-linux-gnu/bits/wchar.h:
41/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:
42/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h:
43/usr/include/x86_64-linux-gnu/bits/stdint-least.h:
44/usr/lib/gcc/x86_64-linux-gnu/15/include/stdbool.h:
45stddef.h:
46/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:
47unictype/bitmap.h:
48unictype/ctype_xdigit.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..869ac066
--- /dev/null
+++ b/gl/unictype/bitmap.h
@@ -0,0 +1,48 @@
1/* Three-level bitmap lookup.
2 Copyright (C) 2000-2002, 2005-2007, 2009-2025 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..f58f4310
--- /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-2025 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..3ee771ab
--- /dev/null
+++ b/gl/unictype/ctype_alnum.h
@@ -0,0 +1,897 @@
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 16.0.0. */
4
5/* Copyright (C) 2000-2024 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[85 << 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) + 928,
238 5 + 512 * sizeof (short) / sizeof (int) + 336,
239 5 + 512 * sizeof (short) / sizeof (int) + 336,
240 5 + 512 * sizeof (short) / sizeof (int) + 944,
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) + 960,
258 5 + 512 * sizeof (short) / sizeof (int) + 976,
259 5 + 512 * sizeof (short) / sizeof (int) + 992,
260 -1,
261 -1,
262 -1,
263 -1,
264 5 + 512 * sizeof (short) / sizeof (int) + 1008,
265 -1,
266 -1,
267 -1,
268 -1,
269 -1,
270 -1,
271 -1,
272 5 + 512 * sizeof (short) / sizeof (int) + 1024,
273 -1,
274 -1,
275 -1,
276 5 + 512 * sizeof (short) / sizeof (int) + 1040,
277 5 + 512 * sizeof (short) / sizeof (int) + 1056,
278 -1,
279 -1,
280 -1,
281 5 + 512 * sizeof (short) / sizeof (int) + 1072,
282 5 + 512 * sizeof (short) / sizeof (int) + 1088,
283 5 + 512 * sizeof (short) / sizeof (int) + 1104,
284 5 + 512 * sizeof (short) / sizeof (int) + 1120,
285 5 + 512 * sizeof (short) / sizeof (int) + 1136,
286 5 + 512 * sizeof (short) / sizeof (int) + 1152,
287 -1,
288 -1,
289 5 + 512 * sizeof (short) / sizeof (int) + 1168,
290 5 + 512 * sizeof (short) / sizeof (int) + 1184,
291 -1,
292 -1,
293 -1,
294 -1,
295 5 + 512 * sizeof (short) / sizeof (int) + 1200,
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) + 1216,
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) + 1232,
390 5 + 512 * sizeof (short) / sizeof (int) + 1248,
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) + 1264,
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) + 1280,
416 5 + 512 * sizeof (short) / sizeof (int) + 336,
417 5 + 512 * sizeof (short) / sizeof (int) + 1296,
418 -1,
419 -1,
420 -1,
421 -1,
422 5 + 512 * sizeof (short) / sizeof (int) + 336,
423 5 + 512 * sizeof (short) / sizeof (int) + 1312,
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) + 1328,
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) + 1344,
444 -1,
445 -1,
446 -1,
447 -1,
448 -1,
449 -1,
450 -1,
451 -1,
452 -1,
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 0x00007EFFU, 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, 0x27000000U, 0x0000FFC3U,
581 0xFFFDDFE1U, 0x23EFFDFFU, 0x60000000U, 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, 0x1FEB3FFFU, 0xFFFC0000U,
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, 0x00000000U, 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, 0x0000001CU, 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, 0x000003FFU, 0x00000000U, 0x00000000U,
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, 0x00000000U, 0x00000000U, 0x00000000U,
786 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000107FFU, 0x00000000U,
787 0xFFF80000U, 0x00000000U, 0x00000000U, 0x0000000BU,
788 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
789 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
790 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
791 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU,
792 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
793 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x80000000U,
794 0x000001FFU, 0x00000000U, 0x00000000U, 0x00000000U,
795 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
796 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
797 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
798 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
799 0x00000000U, 0x00000000U, 0x00000000U, 0x6FEF0000U,
800 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
801 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
802 0xFFFFFFFFU, 0x00040007U, 0x00270000U, 0xFFFF00F0U,
803 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
804 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
805 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0FFFFFFFU,
806 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
807 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
808 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFF07FFU,
809 0x03FF01FFU, 0x00000000U, 0x00000000U, 0x00000000U,
810 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
811 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
812 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
813 0x00000000U, 0x00000000U, 0xFFC00000U, 0x03FFFFFFU,
814 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
815 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
816 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFDFFFFFU, 0xFFFFFFFFU,
817 0xDFFFFFFFU, 0xEBFFDE64U, 0xFFFFFFEFU, 0xFFFFFFFFU,
818 0xDFDFE7BFU, 0x7BFFFFFFU, 0xFFFDFC5FU, 0xFFFFFFFFU,
819 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
820 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
821 0xFFFFFFFFU, 0xFFFFFF3FU, 0xF7FFFFFDU, 0xF7FFFFFFU,
822 0xFFDFFFFFU, 0xFFDFFFFFU, 0xFFFF7FFFU, 0xFFFF7FFFU,
823 0xFFFFFDFFU, 0xFFFFFDFFU, 0xFFFFCFF7U, 0xFFFFFFFFU,
824 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
825 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
826 0x7FFFFFFFU, 0x000007E0U, 0x00000000U, 0x00000000U,
827 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
828 0x00000000U, 0xFFFF0000U, 0xFFFFFFFFU, 0x00003FFFU,
829 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
830 0xFFFFFFFFU, 0x3F801FFFU, 0x000043FFU, 0x00000000U,
831 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
832 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
833 0xFFFF0000U, 0x00003FFFU, 0xFFFFFFFFU, 0x03FF0FFFU,
834 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
835 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
836 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
837 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x03FF0FFFU,
838 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
839 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x07FF3FFFU,
840 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
841 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
842 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
843 0x00000000U, 0x00000000U, 0x00000000U, 0x7FFF6F7FU,
844 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
845 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000001FU, 0x00000000U,
846 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF080FU, 0x00000000U,
847 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
848 0xFFFFFFEFU, 0x0AF7FE96U, 0xAA96EA84U, 0x5EF7F796U,
849 0x0FFFFBFFU, 0x0FFFFBEEU, 0x00000000U, 0x00000000U,
850 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
851 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
852 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
853 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
854 0xFFFF0000U, 0xFFFF1FFFU, 0xFFFF03FFU, 0xFFFF03FFU,
855 0x000007FFU, 0x00000020U, 0x00000000U, 0xFFFFFFC0U,
856 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
857 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
858 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
859 0x00000000U, 0x00000000U, 0x00000000U, 0x03FF0000U,
860 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
861 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U,
862 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
863 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
864 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
865 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
866 0xFFFFFFFFU, 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
867 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
868 0x3FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
869 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
870 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
871 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
872 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
873 0xFFFFFFFFU, 0xFFFF0003U, 0xFFFFFFFFU, 0xFFFFFFFFU,
874 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
875 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
876 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
877 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
878 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
879 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF0001U,
880 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x00000000U,
881 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
882 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
883 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
884 0x3FFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
885 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
886 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
887 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
888 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
889 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
890 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF07FFU, 0xFFFFFFFFU,
891 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
892 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
893 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
894 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
895 0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U, 0x00000000U
896 }
897};
diff --git a/gl/unictype/ctype_alpha.c b/gl/unictype/ctype_alpha.c
new file mode 100644
index 00000000..c422fec6
--- /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-2025 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..cd129cb9
--- /dev/null
+++ b/gl/unictype/ctype_alpha.h
@@ -0,0 +1,897 @@
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 16.0.0. */
4
5/* Copyright (C) 2000-2024 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[85 << 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) + 928,
238 5 + 512 * sizeof (short) / sizeof (int) + 336,
239 5 + 512 * sizeof (short) / sizeof (int) + 336,
240 5 + 512 * sizeof (short) / sizeof (int) + 944,
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) + 960,
258 5 + 512 * sizeof (short) / sizeof (int) + 976,
259 5 + 512 * sizeof (short) / sizeof (int) + 992,
260 -1,
261 -1,
262 -1,
263 -1,
264 5 + 512 * sizeof (short) / sizeof (int) + 1008,
265 -1,
266 -1,
267 -1,
268 -1,
269 -1,
270 -1,
271 -1,
272 5 + 512 * sizeof (short) / sizeof (int) + 1024,
273 -1,
274 -1,
275 -1,
276 5 + 512 * sizeof (short) / sizeof (int) + 1040,
277 5 + 512 * sizeof (short) / sizeof (int) + 1056,
278 -1,
279 -1,
280 -1,
281 5 + 512 * sizeof (short) / sizeof (int) + 1072,
282 5 + 512 * sizeof (short) / sizeof (int) + 1088,
283 5 + 512 * sizeof (short) / sizeof (int) + 1104,
284 5 + 512 * sizeof (short) / sizeof (int) + 1120,
285 5 + 512 * sizeof (short) / sizeof (int) + 1136,
286 5 + 512 * sizeof (short) / sizeof (int) + 1152,
287 -1,
288 -1,
289 5 + 512 * sizeof (short) / sizeof (int) + 1168,
290 5 + 512 * sizeof (short) / sizeof (int) + 1184,
291 -1,
292 -1,
293 -1,
294 -1,
295 5 + 512 * sizeof (short) / sizeof (int) + 1200,
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) + 1216,
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) + 1232,
390 5 + 512 * sizeof (short) / sizeof (int) + 1248,
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) + 1264,
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) + 1280,
416 5 + 512 * sizeof (short) / sizeof (int) + 336,
417 5 + 512 * sizeof (short) / sizeof (int) + 1296,
418 -1,
419 -1,
420 -1,
421 -1,
422 5 + 512 * sizeof (short) / sizeof (int) + 336,
423 5 + 512 * sizeof (short) / sizeof (int) + 1312,
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) + 1328,
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) + 1344,
444 -1,
445 -1,
446 -1,
447 -1,
448 -1,
449 -1,
450 -1,
451 -1,
452 -1,
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 0x00007EFFU, 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, 0x27000000U, 0x0000FFC3U,
581 0xFFFDDFE1U, 0x23EFFDFFU, 0x60000000U, 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, 0x1FEB3FFFU, 0xFFFC0000U,
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, 0x00000000U, 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, 0x0000001CU, 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, 0x000003FFU, 0x00000000U, 0x00000000U,
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, 0x00000000U, 0x00000000U, 0x00000000U,
786 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000107FFU, 0x00000000U,
787 0xFFF80000U, 0x00000000U, 0x00000000U, 0x0000000BU,
788 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
789 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
790 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
791 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU,
792 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
793 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x80000000U,
794 0x000001FFU, 0x00000000U, 0x00000000U, 0x00000000U,
795 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
796 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
797 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
798 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
799 0x00000000U, 0x00000000U, 0x00000000U, 0x6FEF0000U,
800 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
801 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
802 0xFFFFFFFFU, 0x00040007U, 0x00270000U, 0xFFFF00F0U,
803 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
804 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
805 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0FFFFFFFU,
806 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
807 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
808 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFF07FFU,
809 0x03FF01FFU, 0x00000000U, 0x00000000U, 0x00000000U,
810 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
811 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
812 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
813 0x00000000U, 0x00000000U, 0xFFC00000U, 0x03FFFFFFU,
814 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
815 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
816 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFDFFFFFU, 0xFFFFFFFFU,
817 0xDFFFFFFFU, 0xEBFFDE64U, 0xFFFFFFEFU, 0xFFFFFFFFU,
818 0xDFDFE7BFU, 0x7BFFFFFFU, 0xFFFDFC5FU, 0xFFFFFFFFU,
819 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
820 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
821 0xFFFFFFFFU, 0xFFFFFF3FU, 0xF7FFFFFDU, 0xF7FFFFFFU,
822 0xFFDFFFFFU, 0xFFDFFFFFU, 0xFFFF7FFFU, 0xFFFF7FFFU,
823 0xFFFFFDFFU, 0xFFFFFDFFU, 0xFFFFCFF7U, 0xFFFFFFFFU,
824 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
825 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
826 0x7FFFFFFFU, 0x000007E0U, 0x00000000U, 0x00000000U,
827 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
828 0x00000000U, 0xFFFF0000U, 0xFFFFFFFFU, 0x00003FFFU,
829 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
830 0xFFFFFFFFU, 0x3F801FFFU, 0x000043FFU, 0x00000000U,
831 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
832 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
833 0xFFFF0000U, 0x00003FFFU, 0xFFFFFFFFU, 0x03FF0FFFU,
834 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
835 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
836 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
837 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x03FF0FFFU,
838 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
839 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x07FF3FFFU,
840 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
841 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
842 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
843 0x00000000U, 0x00000000U, 0x00000000U, 0x7FFF6F7FU,
844 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
845 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000001FU, 0x00000000U,
846 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FF080FU, 0x00000000U,
847 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
848 0xFFFFFFEFU, 0x0AF7FE96U, 0xAA96EA84U, 0x5EF7F796U,
849 0x0FFFFBFFU, 0x0FFFFBEEU, 0x00000000U, 0x00000000U,
850 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
851 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
852 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
853 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
854 0xFFFF0000U, 0xFFFF1FFFU, 0xFFFF03FFU, 0xFFFF03FFU,
855 0x000007FFU, 0x00000020U, 0x00000000U, 0xFFFFFFC0U,
856 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
857 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
858 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
859 0x00000000U, 0x00000000U, 0x00000000U, 0x03FF0000U,
860 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
861 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U,
862 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
863 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
864 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
865 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
866 0xFFFFFFFFU, 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
867 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
868 0x3FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
869 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
870 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
871 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
872 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
873 0xFFFFFFFFU, 0xFFFF0003U, 0xFFFFFFFFU, 0xFFFFFFFFU,
874 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
875 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
876 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
877 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
878 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
879 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF0001U,
880 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x00000000U,
881 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
882 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
883 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
884 0x3FFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
885 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
886 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
887 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
888 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
889 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
890 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF07FFU, 0xFFFFFFFFU,
891 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
892 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
893 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
894 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
895 0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U, 0x00000000U
896 }
897};
diff --git a/gl/unictype/ctype_blank.c b/gl/unictype/ctype_blank.c
new file mode 100644
index 00000000..25a08013
--- /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-2025 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..23fac0f3
--- /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 16.0.0. */
4
5/* Copyright (C) 2000-2024 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..eb7467dd
--- /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-2025 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..58df7e76
--- /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 16.0.0. */
4
5/* Copyright (C) 2000-2024 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..a82b3bb0
--- /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-2025 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..2f7d1822
--- /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 16.0.0. */
4
5/* Copyright (C) 2000-2024 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..2c41c794
--- /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-2025 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..5627ad0f
--- /dev/null
+++ b/gl/unictype/ctype_graph.h
@@ -0,0 +1,1202 @@
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 16.0.0. */
4
5/* Copyright (C) 2000-2024 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[94 << 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) + 912,
251 18 + 768 * sizeof (short) / sizeof (int) + 160,
252 18 + 768 * sizeof (short) / sizeof (int) + 160,
253 18 + 768 * sizeof (short) / sizeof (int) + 928,
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) + 944,
271 18 + 768 * sizeof (short) / sizeof (int) + 960,
272 18 + 768 * sizeof (short) / sizeof (int) + 976,
273 -1,
274 -1,
275 -1,
276 -1,
277 18 + 768 * sizeof (short) / sizeof (int) + 992,
278 -1,
279 -1,
280 -1,
281 -1,
282 -1,
283 -1,
284 -1,
285 18 + 768 * sizeof (short) / sizeof (int) + 1008,
286 18 + 768 * sizeof (short) / sizeof (int) + 1024,
287 18 + 768 * sizeof (short) / sizeof (int) + 1040,
288 18 + 768 * sizeof (short) / sizeof (int) + 1056,
289 18 + 768 * sizeof (short) / sizeof (int) + 1072,
290 18 + 768 * sizeof (short) / sizeof (int) + 1088,
291 18 + 768 * sizeof (short) / sizeof (int) + 160,
292 18 + 768 * sizeof (short) / sizeof (int) + 1104,
293 -1,
294 18 + 768 * sizeof (short) / sizeof (int) + 1120,
295 18 + 768 * sizeof (short) / sizeof (int) + 1136,
296 18 + 768 * sizeof (short) / sizeof (int) + 1152,
297 18 + 768 * sizeof (short) / sizeof (int) + 1168,
298 18 + 768 * sizeof (short) / sizeof (int) + 1184,
299 18 + 768 * sizeof (short) / sizeof (int) + 1200,
300 -1,
301 18 + 768 * sizeof (short) / sizeof (int) + 1216,
302 18 + 768 * sizeof (short) / sizeof (int) + 1232,
303 18 + 768 * sizeof (short) / sizeof (int) + 1248,
304 18 + 768 * sizeof (short) / sizeof (int) + 1264,
305 18 + 768 * sizeof (short) / sizeof (int) + 160,
306 18 + 768 * sizeof (short) / sizeof (int) + 1280,
307 18 + 768 * sizeof (short) / sizeof (int) + 1296,
308 18 + 768 * sizeof (short) / sizeof (int) + 1312,
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) + 1328,
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) + 1344,
403 18 + 768 * sizeof (short) / sizeof (int) + 1360,
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) + 1376,
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) + 1392,
429 18 + 768 * sizeof (short) / sizeof (int) + 160,
430 18 + 768 * sizeof (short) / sizeof (int) + 1408,
431 -1,
432 -1,
433 -1,
434 -1,
435 18 + 768 * sizeof (short) / sizeof (int) + 160,
436 18 + 768 * sizeof (short) / sizeof (int) + 1424,
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) + 1440,
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) + 1456,
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 -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) + 1472,
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) + 1488
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 0xFF837FFFU, 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, 0x27603DDFU, 0xFF80FFCFU,
850 0xFFFDDFFFU, 0xF3EFFDFFU, 0x60603DDFU, 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, 0x00007FFFU, 0x00000000U,
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, 0xFFFF0001U, 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 0xFFBFFFFFU, 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, 0x1FEB3FFFU, 0xFFFC0000U,
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, 0xFFF80007U, 0xFFFFFFFFU,
941 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
942 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
943 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
944 0xFFFCFFFFU, 0xFFFFFFFFU, 0x000080FFU, 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, 0x00000000U, 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, 0x0000001CU, 0xF0000000U,
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, 0x00000000U,
1004 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x03FF0003U,
1005 0xFFFFFDFFU, 0xFF7FFFFFU, 0xFFFF003FU, 0xFFFF1FFFU,
1006 0xFFFCFFFFU, 0x007FFEFFU, 0x00000000U, 0x00000000U,
1007 0xFFFFFB7FU, 0xB47FFFFFU, 0x03FF00FFU, 0xFFFFFDBFU,
1008 0x01FB7FFFU, 0x000003FFU, 0x00000000U, 0x00000000U,
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, 0x00000000U, 0x00000000U, 0x00000000U,
1051 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF87FFU, 0xFFFFFFFFU,
1052 0xFFFF80FFU, 0x00000000U, 0x00000000U, 0x0003001FU,
1053 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1054 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1055 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1056 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU,
1057 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1058 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x80000000U,
1059 0x000001FFU, 0x00000000U, 0x00000000U, 0x00000000U,
1060 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1061 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1062 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1063 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1064 0x00000000U, 0x00000000U, 0x00000000U, 0x6FEF0000U,
1065 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1066 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1067 0xFFFFFFFFU, 0x00040007U, 0x00270000U, 0xFFFF00F0U,
1068 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1069 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1070 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0FFFFFFFU,
1071 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1072 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1073 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFF07FFU,
1074 0xF3FF01FFU, 0x0000000FU, 0x00000000U, 0x00000000U,
1075 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1076 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1077 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1078 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU,
1079 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1080 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1081 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1082 0xFFFFFFFFU, 0x000FFFFFU, 0x00000000U, 0x00000000U,
1083 0xFFFFFFFFU, 0xFFFF3FFFU, 0xFFFF007FU, 0xFFFFFFFFU,
1084 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U,
1085 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1086 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU,
1087 0xFFFFFFFFU, 0xFFFFFE7FU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1088 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000007FFU,
1089 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000003FU, 0x00000000U,
1090 0x00000000U, 0x00000000U, 0x000FFFFFU, 0x000FFFFFU,
1091 0xFFFFFFFFU, 0xFFFFFFFFU, 0x007FFFFFU, 0x01FFFFFFU,
1092 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1093 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFDFFFFFU, 0xFFFFFFFFU,
1094 0xDFFFFFFFU, 0xEBFFDE64U, 0xFFFFFFEFU, 0xFFFFFFFFU,
1095 0xDFDFE7BFU, 0x7BFFFFFFU, 0xFFFDFC5FU, 0xFFFFFFFFU,
1096 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1097 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1098 0xFFFFFFFFU, 0xFFFFFF3FU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1099 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1100 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFCFFFU, 0xFFFFFFFFU,
1101 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1102 0xF8000FFFU, 0x0000FFFEU, 0x00000000U, 0x00000000U,
1103 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1104 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1105 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1106 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1107 0x7FFFFFFFU, 0x000007E0U, 0x00000000U, 0x00000000U,
1108 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1109 0xF9FFFF7FU, 0xFFFF07DBU, 0xFFFFFFFFU, 0x00003FFFU,
1110 0x00008000U, 0x00000000U, 0x00000000U, 0x00000000U,
1111 0xFFFFFFFFU, 0x3FFF1FFFU, 0x0000C3FFU, 0x00000000U,
1112 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1113 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1114 0xFFFF0000U, 0x00007FFFU, 0xFFFFFFFFU, 0x83FFFFFFU,
1115 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1116 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1117 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1118 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x03FFFFFFU,
1119 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1120 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x87FFFFFFU,
1121 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1122 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1123 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1124 0x00000000U, 0x00000000U, 0x00000000U, 0x7FFF6F7FU,
1125 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1126 0xFFFFFFFFU, 0xFFFFFFFFU, 0x007FFF9FU, 0x00000000U,
1127 0xFFFFFFFFU, 0xFFFFFFFFU, 0xC3FF0FFFU, 0x00000000U,
1128 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1129 0x00000000U, 0x00000000U, 0x00000000U, 0xFFFE0000U,
1130 0xFFFFFFFFU, 0x001FFFFFU, 0x00000000U, 0x00000000U,
1131 0xFFFFFFFEU, 0x3FFFFFFFU, 0x00000000U, 0x00000000U,
1132 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1133 0xFFFFFFEFU, 0x0AF7FE96U, 0xAA96EA84U, 0x5EF7F796U,
1134 0x0FFFFBFFU, 0x0FFFFBEEU, 0x00000000U, 0x00030000U,
1135 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1136 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1137 0xFFFFFFFFU, 0xFFFF0FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1138 0x000FFFFFU, 0xFFFE7FFFU, 0xFFFEFFFEU, 0x003FFFFFU,
1139 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1140 0xFFFFFFFFU, 0x00003FFFU, 0x00000000U, 0xFFFFFFC0U,
1141 0xFFFF0007U, 0x0FFFFFFFU, 0x000301FFU, 0x0000003FU,
1142 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1143 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1144 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1145 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1146 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF0FFFFFFU, 0x1FFF1FFFU,
1147 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF87FFFFFU,
1148 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00010FFFU,
1149 0xFFFF0FFFU, 0xFFFFFFFFU, 0x03FF00FFU, 0xFFFFFFFFU,
1150 0xFFFF00FFU, 0x0FFF3FFFU, 0x00000003U, 0x00000000U,
1151 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1152 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1153 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000FFFFFU, 0x1FFF3FFFU,
1154 0xFFFF83FFU, 0xFFFFFFFFU, 0x9FFFC07FU, 0x01FF03FFU,
1155 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1156 0xFFF7FFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU,
1157 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1158 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U,
1159 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1160 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1161 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1162 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1163 0xFFFFFFFFU, 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1164 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1165 0x3FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1166 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1167 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1168 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1169 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1170 0xFFFFFFFFU, 0xFFFF0003U, 0xFFFFFFFFU, 0xFFFFFFFFU,
1171 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1172 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1173 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1174 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1175 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1176 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF0001U,
1177 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x00000000U,
1178 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1179 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1180 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1181 0x3FFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
1182 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1183 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1184 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1185 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1186 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1187 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF07FFU, 0xFFFFFFFFU,
1188 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1189 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1190 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1191 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1192 0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U, 0x00000000U,
1193 0x00000002U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1194 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1195 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1196 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU,
1197 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1198 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1199 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1200 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU
1201 }
1202};
diff --git a/gl/unictype/ctype_lower.c b/gl/unictype/ctype_lower.c
new file mode 100644
index 00000000..99a05e09
--- /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-2025 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..cbf7d26d
--- /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 16.0.0. */
4
5/* Copyright (C) 2000-2024 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, 0x0A82250AU, 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, 0x00000000U, 0x00000000U, 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..0197d496
--- /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-2025 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..b7007828
--- /dev/null
+++ b/gl/unictype/ctype_print.h
@@ -0,0 +1,1202 @@
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 16.0.0. */
4
5/* Copyright (C) 2000-2024 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[94 << 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) + 912,
251 18 + 768 * sizeof (short) / sizeof (int) + 160,
252 18 + 768 * sizeof (short) / sizeof (int) + 160,
253 18 + 768 * sizeof (short) / sizeof (int) + 928,
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) + 944,
271 18 + 768 * sizeof (short) / sizeof (int) + 960,
272 18 + 768 * sizeof (short) / sizeof (int) + 976,
273 -1,
274 -1,
275 -1,
276 -1,
277 18 + 768 * sizeof (short) / sizeof (int) + 992,
278 -1,
279 -1,
280 -1,
281 -1,
282 -1,
283 -1,
284 -1,
285 18 + 768 * sizeof (short) / sizeof (int) + 1008,
286 18 + 768 * sizeof (short) / sizeof (int) + 1024,
287 18 + 768 * sizeof (short) / sizeof (int) + 1040,
288 18 + 768 * sizeof (short) / sizeof (int) + 1056,
289 18 + 768 * sizeof (short) / sizeof (int) + 1072,
290 18 + 768 * sizeof (short) / sizeof (int) + 1088,
291 18 + 768 * sizeof (short) / sizeof (int) + 160,
292 18 + 768 * sizeof (short) / sizeof (int) + 1104,
293 -1,
294 18 + 768 * sizeof (short) / sizeof (int) + 1120,
295 18 + 768 * sizeof (short) / sizeof (int) + 1136,
296 18 + 768 * sizeof (short) / sizeof (int) + 1152,
297 18 + 768 * sizeof (short) / sizeof (int) + 1168,
298 18 + 768 * sizeof (short) / sizeof (int) + 1184,
299 18 + 768 * sizeof (short) / sizeof (int) + 1200,
300 -1,
301 18 + 768 * sizeof (short) / sizeof (int) + 1216,
302 18 + 768 * sizeof (short) / sizeof (int) + 1232,
303 18 + 768 * sizeof (short) / sizeof (int) + 1248,
304 18 + 768 * sizeof (short) / sizeof (int) + 1264,
305 18 + 768 * sizeof (short) / sizeof (int) + 160,
306 18 + 768 * sizeof (short) / sizeof (int) + 1280,
307 18 + 768 * sizeof (short) / sizeof (int) + 1296,
308 18 + 768 * sizeof (short) / sizeof (int) + 1312,
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) + 1328,
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) + 1344,
403 18 + 768 * sizeof (short) / sizeof (int) + 1360,
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) + 1376,
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) + 1392,
429 18 + 768 * sizeof (short) / sizeof (int) + 160,
430 18 + 768 * sizeof (short) / sizeof (int) + 1408,
431 -1,
432 -1,
433 -1,
434 -1,
435 18 + 768 * sizeof (short) / sizeof (int) + 160,
436 18 + 768 * sizeof (short) / sizeof (int) + 1424,
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) + 1440,
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) + 1456,
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 -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) + 1472,
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) + 1488
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 0xFF837FFFU, 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, 0x27603DDFU, 0xFF80FFCFU,
850 0xFFFDDFFFU, 0xF3EFFDFFU, 0x60603DDFU, 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, 0x00007FFFU, 0x00000000U,
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, 0xFFFF0001U, 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 0xFFBFFFFFU, 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, 0x1FEB3FFFU, 0xFFFC0000U,
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, 0xFFF80007U, 0xFFFFFFFFU,
941 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
942 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
943 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
944 0xFFFCFFFFU, 0xFFFFFFFFU, 0x000080FFU, 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, 0x00000000U, 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, 0x0000001CU, 0xF0000000U,
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, 0x00000000U,
1004 0x00000000U, 0x00000000U, 0xFFFFFFFFU, 0x03FF0003U,
1005 0xFFFFFDFFU, 0xFF7FFFFFU, 0xFFFF003FU, 0xFFFF1FFFU,
1006 0xFFFCFFFFU, 0x007FFEFFU, 0x00000000U, 0x00000000U,
1007 0xFFFFFB7FU, 0xB47FFFFFU, 0x03FF00FFU, 0xFFFFFDBFU,
1008 0x01FB7FFFU, 0x000003FFU, 0x00000000U, 0x00000000U,
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, 0x00000000U, 0x00000000U, 0x00000000U,
1051 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF87FFU, 0xFFFFFFFFU,
1052 0xFFFF80FFU, 0x00000000U, 0x00000000U, 0x0003001FU,
1053 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1054 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1055 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1056 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00FFFFFFU,
1057 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1058 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU, 0x80000000U,
1059 0x000001FFU, 0x00000000U, 0x00000000U, 0x00000000U,
1060 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1061 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1062 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1063 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1064 0x00000000U, 0x00000000U, 0x00000000U, 0x6FEF0000U,
1065 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1066 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1067 0xFFFFFFFFU, 0x00040007U, 0x00270000U, 0xFFFF00F0U,
1068 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1069 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1070 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0FFFFFFFU,
1071 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1072 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1073 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x1FFF07FFU,
1074 0xF3FF01FFU, 0x0000000FU, 0x00000000U, 0x00000000U,
1075 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1076 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1077 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1078 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU,
1079 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1080 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1081 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1082 0xFFFFFFFFU, 0x000FFFFFU, 0x00000000U, 0x00000000U,
1083 0xFFFFFFFFU, 0xFFFF3FFFU, 0xFFFF007FU, 0xFFFFFFFFU,
1084 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000000FU, 0x00000000U,
1085 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1086 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x003FFFFFU,
1087 0xFFFFFFFFU, 0xFFFFFE7FU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1088 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000007FFU,
1089 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000003FU, 0x00000000U,
1090 0x00000000U, 0x00000000U, 0x000FFFFFU, 0x000FFFFFU,
1091 0xFFFFFFFFU, 0xFFFFFFFFU, 0x007FFFFFU, 0x01FFFFFFU,
1092 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1093 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFDFFFFFU, 0xFFFFFFFFU,
1094 0xDFFFFFFFU, 0xEBFFDE64U, 0xFFFFFFEFU, 0xFFFFFFFFU,
1095 0xDFDFE7BFU, 0x7BFFFFFFU, 0xFFFDFC5FU, 0xFFFFFFFFU,
1096 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1097 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1098 0xFFFFFFFFU, 0xFFFFFF3FU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1099 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1100 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFCFFFU, 0xFFFFFFFFU,
1101 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1102 0xF8000FFFU, 0x0000FFFEU, 0x00000000U, 0x00000000U,
1103 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1104 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1105 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1106 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1107 0x7FFFFFFFU, 0x000007E0U, 0x00000000U, 0x00000000U,
1108 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1109 0xF9FFFF7FU, 0xFFFF07DBU, 0xFFFFFFFFU, 0x00003FFFU,
1110 0x00008000U, 0x00000000U, 0x00000000U, 0x00000000U,
1111 0xFFFFFFFFU, 0x3FFF1FFFU, 0x0000C3FFU, 0x00000000U,
1112 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1113 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1114 0xFFFF0000U, 0x00007FFFU, 0xFFFFFFFFU, 0x83FFFFFFU,
1115 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1116 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1117 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1118 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x03FFFFFFU,
1119 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1120 0x00000000U, 0x00000000U, 0xFFFF0000U, 0x87FFFFFFU,
1121 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1122 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1123 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1124 0x00000000U, 0x00000000U, 0x00000000U, 0x7FFF6F7FU,
1125 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1126 0xFFFFFFFFU, 0xFFFFFFFFU, 0x007FFF9FU, 0x00000000U,
1127 0xFFFFFFFFU, 0xFFFFFFFFU, 0xC3FF0FFFU, 0x00000000U,
1128 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1129 0x00000000U, 0x00000000U, 0x00000000U, 0xFFFE0000U,
1130 0xFFFFFFFFU, 0x001FFFFFU, 0x00000000U, 0x00000000U,
1131 0xFFFFFFFEU, 0x3FFFFFFFU, 0x00000000U, 0x00000000U,
1132 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1133 0xFFFFFFEFU, 0x0AF7FE96U, 0xAA96EA84U, 0x5EF7F796U,
1134 0x0FFFFBFFU, 0x0FFFFBEEU, 0x00000000U, 0x00030000U,
1135 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1136 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1137 0xFFFFFFFFU, 0xFFFF0FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1138 0x000FFFFFU, 0xFFFE7FFFU, 0xFFFEFFFEU, 0x003FFFFFU,
1139 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1140 0xFFFFFFFFU, 0x00003FFFU, 0x00000000U, 0xFFFFFFC0U,
1141 0xFFFF0007U, 0x0FFFFFFFU, 0x000301FFU, 0x0000003FU,
1142 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1143 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1144 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1145 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1146 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF0FFFFFFU, 0x1FFF1FFFU,
1147 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF87FFFFFU,
1148 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00010FFFU,
1149 0xFFFF0FFFU, 0xFFFFFFFFU, 0x03FF00FFU, 0xFFFFFFFFU,
1150 0xFFFF00FFU, 0x0FFF3FFFU, 0x00000003U, 0x00000000U,
1151 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1152 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1153 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000FFFFFU, 0x1FFF3FFFU,
1154 0xFFFF83FFU, 0xFFFFFFFFU, 0x9FFFC07FU, 0x01FF03FFU,
1155 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1156 0xFFF7FFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU,
1157 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1158 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x00000000U,
1159 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1160 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1161 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1162 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1163 0xFFFFFFFFU, 0x03FFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1164 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1165 0x3FFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1166 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1167 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1168 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1169 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1170 0xFFFFFFFFU, 0xFFFF0003U, 0xFFFFFFFFU, 0xFFFFFFFFU,
1171 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1172 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1173 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1174 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1175 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1176 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF0001U,
1177 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU, 0x00000000U,
1178 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1179 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1180 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1181 0x3FFFFFFFU, 0x00000000U, 0x00000000U, 0x00000000U,
1182 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1183 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1184 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1185 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1186 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1187 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFF07FFU, 0xFFFFFFFFU,
1188 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1189 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1190 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1191 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1192 0xFFFFFFFFU, 0x0000FFFFU, 0x00000000U, 0x00000000U,
1193 0x00000002U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1194 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
1195 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1196 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU,
1197 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1198 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1199 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
1200 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU
1201 }
1202};
diff --git a/gl/unictype/ctype_punct.c b/gl/unictype/ctype_punct.c
new file mode 100644
index 00000000..f2d647de
--- /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-2025 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..cb252114
--- /dev/null
+++ b/gl/unictype/ctype_punct.h
@@ -0,0 +1,870 @@
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 16.0.0. */
4
5/* Copyright (C) 2000-2024 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[75 << 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 -1,
299 18 + 512 * sizeof (short) / sizeof (int) + 1040,
300 -1,
301 18 + 512 * sizeof (short) / sizeof (int) + 1056,
302 18 + 512 * sizeof (short) / sizeof (int) + 1072,
303 18 + 512 * sizeof (short) / sizeof (int) + 1088,
304 18 + 512 * sizeof (short) / sizeof (int) + 1104,
305 18 + 512 * sizeof (short) / sizeof (int) + 272,
306 18 + 512 * sizeof (short) / sizeof (int) + 1120,
307 18 + 512 * sizeof (short) / sizeof (int) + 1136,
308 18 + 512 * sizeof (short) / sizeof (int) + 1152,
309 -1,
310 -1,
311 18 + 512 * sizeof (short) / sizeof (int) + 1168,
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) + 1184
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, 0x00007FFFU, 0x00000000U,
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, 0xFFFF0001U, 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 0xFFBFFFFFU, 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, 0x00000007U, 0x00000000U,
693 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
694 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
695 0x00000000U, 0xC0000000U, 0x0000FFFFU, 0x00000000U,
696 0x00000000U, 0x00000000U, 0x00008000U, 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, 0x00000000U, 0xF0000000U,
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, 0x00000000U,
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, 0x00000000U,
795 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
796 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
797 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
798 0xFFFFFFFFU, 0x000FFFFFU, 0x00000000U, 0x00000000U,
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, 0x007FFF80U, 0x00000000U,
831 0x00000000U, 0x00000000U, 0xC00007F0U, 0x00000000U,
832 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
833 0x00000000U, 0x00000000U, 0x00000000U, 0xFFFE0000U,
834 0xFFFFFFFFU, 0x001FFFFFU, 0x00000000U, 0x00000000U,
835 0xFFFFFFFEU, 0x3FFFFFFFU, 0x00000000U, 0x00000000U,
836 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
837 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
838 0x00000000U, 0x00000000U, 0x00000000U, 0x00030000U,
839 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
840 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
841 0xFFFFFFFFU, 0xFFFF0FFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
842 0x000FFFFFU, 0xFFFE7FFFU, 0xFFFEFFFEU, 0x003FFFFFU,
843 0x0000FFFFU, 0x0000E000U, 0x0000FC00U, 0x0000FC00U,
844 0xFFFFF800U, 0x00003FDFU, 0x00000000U, 0x00000000U,
845 0xFFFF0007U, 0x0FFFFFFFU, 0x000301FFU, 0x0000003FU,
846 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
847 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
848 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
849 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
850 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF0FFFFFFU, 0x1FFF1FFFU,
851 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xF87FFFFFU,
852 0xFFFFFFFFU, 0xFFFFFFFFU, 0x03FFFFFFU, 0x00010FFFU,
853 0xFFFF0FFFU, 0xFFFFFFFFU, 0x03FF00FFU, 0xFFFFFFFFU,
854 0xFFFF00FFU, 0x0FFF3FFFU, 0x00000003U, 0x00000000U,
855 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
856 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
857 0xFFFFFFFFU, 0xFFFFFFFFU, 0x000FFFFFU, 0x1FFF3FFFU,
858 0xFFFF83FFU, 0xFFFFFFFFU, 0x9FFFC07FU, 0x01FF03FFU,
859 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
860 0xFFF7FFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU,
861 0x00000002U, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
862 0x00000000U, 0x00000000U, 0x00000000U, 0x00000000U,
863 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
864 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x0000FFFFU,
865 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
866 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
867 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU,
868 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0x3FFFFFFFU
869 }
870};
diff --git a/gl/unictype/ctype_space.c b/gl/unictype/ctype_space.c
new file mode 100644
index 00000000..4c032398
--- /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-2025 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..93ed2467
--- /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 16.0.0. */
4
5/* Copyright (C) 2000-2024 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..af2c3fe6
--- /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-2025 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..ef527809
--- /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 16.0.0. */
4
5/* Copyright (C) 2000-2024 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, 0x15411AF5U, 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, 0x00000000U, 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..ee4b2ea4
--- /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-2025 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..c0b2ac05
--- /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 16.0.0. */
4
5/* Copyright (C) 2000-2024 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.h b/gl/uninorm.h
new file mode 100644
index 00000000..f6815c49
--- /dev/null
+++ b/gl/uninorm.h
@@ -0,0 +1,256 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* Normalization forms (composition and decomposition) of Unicode strings.
3 Copyright (C) 2001-2002, 2009-2025 Free Software Foundation, Inc.
4 Written by Bruno Haible <bruno@clisp.org>, 2009.
5
6 This file is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation; either version 2.1 of the
9 License, or (at your option) any later version.
10
11 This file is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with this program. If not, see <https://www.gnu.org/licenses/>. */
18
19#ifndef _UNINORM_H
20#define _UNINORM_H
21
22/* Get size_t. */
23#include <stddef.h>
24
25#include "unitypes.h"
26
27#if 0
28# include <unistring/woe32dll.h>
29#else
30# define LIBUNISTRING_DLL_VARIABLE
31#endif
32
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38
39/* Conventions:
40
41 All functions prefixed with u8_ operate on UTF-8 encoded strings.
42 Their unit is an uint8_t (1 byte).
43
44 All functions prefixed with u16_ operate on UTF-16 encoded strings.
45 Their unit is an uint16_t (a 2-byte word).
46
47 All functions prefixed with u32_ operate on UCS-4 encoded strings.
48 Their unit is an uint32_t (a 4-byte word).
49
50 All argument pairs (s, n) denote a Unicode string s[0..n-1] with exactly
51 n units.
52
53 Functions returning a string result take a (resultbuf, lengthp) argument
54 pair. If resultbuf is not NULL and the result fits into *lengthp units,
55 it is put in resultbuf, and resultbuf is returned. Otherwise, a freshly
56 allocated string is returned. In both cases, *lengthp is set to the
57 length (number of units) of the returned string. In case of error,
58 NULL is returned and errno is set. */
59
60
61enum
62{
63 UC_DECOMP_CANONICAL,/* Canonical decomposition. */
64 UC_DECOMP_FONT, /* <font> A font variant (e.g. a blackletter form). */
65 UC_DECOMP_NOBREAK, /* <noBreak> A no-break version of a space or hyphen. */
66 UC_DECOMP_INITIAL, /* <initial> An initial presentation form (Arabic). */
67 UC_DECOMP_MEDIAL, /* <medial> A medial presentation form (Arabic). */
68 UC_DECOMP_FINAL, /* <final> A final presentation form (Arabic). */
69 UC_DECOMP_ISOLATED,/* <isolated> An isolated presentation form (Arabic). */
70 UC_DECOMP_CIRCLE, /* <circle> An encircled form. */
71 UC_DECOMP_SUPER, /* <super> A superscript form. */
72 UC_DECOMP_SUB, /* <sub> A subscript form. */
73 UC_DECOMP_VERTICAL,/* <vertical> A vertical layout presentation form. */
74 UC_DECOMP_WIDE, /* <wide> A wide (or zenkaku) compatibility character. */
75 UC_DECOMP_NARROW, /* <narrow> A narrow (or hankaku) compatibility character. */
76 UC_DECOMP_SMALL, /* <small> A small variant form (CNS compatibility). */
77 UC_DECOMP_SQUARE, /* <square> A CJK squared font variant. */
78 UC_DECOMP_FRACTION,/* <fraction> A vulgar fraction form. */
79 UC_DECOMP_COMPAT /* <compat> Otherwise unspecified compatibility character. */
80};
81
82/* Maximum size of decomposition of a single Unicode character. */
83#define UC_DECOMPOSITION_MAX_LENGTH 32
84
85/* Return the character decomposition mapping of a Unicode character.
86 DECOMPOSITION must point to an array of at least UC_DECOMPOSITION_MAX_LENGTH
87 ucs_t elements.
88 When a decomposition exists, DECOMPOSITION[0..N-1] and *DECOMP_TAG are
89 filled and N is returned. Otherwise -1 is returned. */
90extern int
91 uc_decomposition (ucs4_t uc, int *decomp_tag, ucs4_t *decomposition);
92
93/* Return the canonical character decomposition mapping of a Unicode character.
94 DECOMPOSITION must point to an array of at least UC_DECOMPOSITION_MAX_LENGTH
95 ucs_t elements.
96 When a decomposition exists, DECOMPOSITION[0..N-1] is filled and N is
97 returned. Otherwise -1 is returned. */
98extern int
99 uc_canonical_decomposition (ucs4_t uc, ucs4_t *decomposition);
100
101
102/* Attempt to combine the Unicode characters uc1, uc2.
103 uc1 is known to have canonical combining class 0.
104 Return the combination of uc1 and uc2, if it exists.
105 Return 0 otherwise.
106 Not all decompositions can be recombined using this function. See the
107 Unicode file CompositionExclusions.txt for details. */
108extern ucs4_t
109 uc_composition (ucs4_t uc1, ucs4_t uc2)
110 _UC_ATTRIBUTE_CONST;
111
112
113/* An object of type uninorm_t denotes a Unicode normalization form. */
114struct unicode_normalization_form;
115typedef const struct unicode_normalization_form *uninorm_t;
116
117/* UNINORM_NFD: Normalization form D: canonical decomposition. */
118extern LIBUNISTRING_DLL_VARIABLE const struct unicode_normalization_form uninorm_nfd;
119#define UNINORM_NFD (&uninorm_nfd)
120
121/* UNINORM_NFC: Normalization form C: canonical decomposition, then
122 canonical composition. */
123extern LIBUNISTRING_DLL_VARIABLE const struct unicode_normalization_form uninorm_nfc;
124#define UNINORM_NFC (&uninorm_nfc)
125
126/* UNINORM_NFKD: Normalization form KD: compatibility decomposition. */
127extern LIBUNISTRING_DLL_VARIABLE const struct unicode_normalization_form uninorm_nfkd;
128#define UNINORM_NFKD (&uninorm_nfkd)
129
130/* UNINORM_NFKC: Normalization form KC: compatibility decomposition, then
131 canonical composition. */
132extern LIBUNISTRING_DLL_VARIABLE const struct unicode_normalization_form uninorm_nfkc;
133#define UNINORM_NFKC (&uninorm_nfkc)
134
135/* Test whether a normalization form does compatibility decomposition. */
136#define uninorm_is_compat_decomposing(nf) \
137 ((* (const unsigned int *) (nf) >> 0) & 1)
138
139/* Test whether a normalization form includes canonical composition. */
140#define uninorm_is_composing(nf) \
141 ((* (const unsigned int *) (nf) >> 1) & 1)
142
143/* Return the decomposing variant of a normalization form.
144 This maps NFC,NFD -> NFD and NFKC,NFKD -> NFKD. */
145extern uninorm_t
146 uninorm_decomposing_form (uninorm_t nf)
147 _UC_ATTRIBUTE_PURE;
148
149
150/* Return the specified normalization form of a string. */
151extern uint8_t *
152 u8_normalize (uninorm_t nf, const uint8_t *s, size_t n,
153 uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
154extern uint16_t *
155 u16_normalize (uninorm_t nf, const uint16_t *s, size_t n,
156 uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
157extern uint32_t *
158 u32_normalize (uninorm_t nf, const uint32_t *s, size_t n,
159 uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
160
161
162/* Compare S1 and S2, ignoring differences in normalization.
163 NF must be either UNINORM_NFD or UNINORM_NFKD.
164 If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2, and
165 return 0. Upon failure, return -1 with errno set. */
166extern int
167 u8_normcmp (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2,
168 uninorm_t nf, int *resultp);
169extern int
170 u16_normcmp (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2,
171 uninorm_t nf, int *resultp);
172extern int
173 u32_normcmp (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2,
174 uninorm_t nf, int *resultp);
175
176
177/* Converts the string S of length N to a NUL-terminated byte sequence, in such
178 a way that comparing uN_normxfrm (S1) and uN_normxfrm (S2) with uN_cmp2() is
179 equivalent to comparing S1 and S2 with uN_normcoll().
180 NF must be either UNINORM_NFC or UNINORM_NFKC. */
181extern char *
182 u8_normxfrm (const uint8_t *s, size_t n, uninorm_t nf,
183 char *resultbuf, size_t *lengthp);
184extern char *
185 u16_normxfrm (const uint16_t *s, size_t n, uninorm_t nf,
186 char *resultbuf, size_t *lengthp);
187extern char *
188 u32_normxfrm (const uint32_t *s, size_t n, uninorm_t nf,
189 char *resultbuf, size_t *lengthp);
190
191
192/* Compare S1 and S2, ignoring differences in normalization, using the
193 collation rules of the current locale.
194 NF must be either UNINORM_NFC or UNINORM_NFKC.
195 If successful, set *RESULTP to -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2, and
196 return 0. Upon failure, return -1 with errno set. */
197extern int
198 u8_normcoll (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2,
199 uninorm_t nf, int *resultp);
200extern int
201 u16_normcoll (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2,
202 uninorm_t nf, int *resultp);
203extern int
204 u32_normcoll (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2,
205 uninorm_t nf, int *resultp);
206
207
208/* Normalization of a stream of Unicode characters.
209
210 A "stream of Unicode characters" is essentially a function that accepts an
211 ucs4_t argument repeatedly, optionally combined with a function that
212 "flushes" the stream. */
213
214/* Data type of a stream of Unicode characters that normalizes its input
215 according to a given normalization form and passes the normalized character
216 sequence to the encapsulated stream of Unicode characters. */
217struct uninorm_filter;
218
219/* Bring data buffered in the filter to its destination, the encapsulated
220 stream, then close and free the filter.
221 Return 0 if successful, or -1 with errno set upon failure. */
222extern int
223 uninorm_filter_free (struct uninorm_filter *filter);
224
225/* Create and return a normalization filter for Unicode characters.
226 The pair (stream_func, stream_data) is the encapsulated stream.
227 stream_func (stream_data, uc) receives the Unicode character uc
228 and returns 0 if successful, or -1 with errno set upon failure.
229 Return the new filter, or NULL with errno set upon failure. */
230extern struct uninorm_filter *
231 uninorm_filter_create (uninorm_t nf,
232 int (*stream_func) (void *stream_data, ucs4_t uc),
233 void *stream_data)
234 _GL_ATTRIBUTE_DEALLOC (uninorm_filter_free, 1);
235
236/* Stuff a Unicode character into a normalizing filter.
237 Return 0 if successful, or -1 with errno set upon failure. */
238extern int
239 uninorm_filter_write (struct uninorm_filter *filter, ucs4_t uc);
240
241/* Bring data buffered in the filter to its destination, the encapsulated
242 stream.
243 Return 0 if successful, or -1 with errno set upon failure.
244 Note! If after calling this function, additional characters are written
245 into the filter, the resulting character sequence in the encapsulated stream
246 will not necessarily be normalized. */
247extern int
248 uninorm_filter_flush (struct uninorm_filter *filter);
249
250
251#ifdef __cplusplus
252}
253#endif
254
255
256#endif /* _UNINORM_H */
diff --git a/gl/uninorm.in.h b/gl/uninorm.in.h
new file mode 100644
index 00000000..76ab32b6
--- /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-2025 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..e6625589 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-2025 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..9f057d30 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-2025 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,24 @@
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
107/* FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, Solaris 11.4, and glibc 2.41
108 do not define O_CLOEXEC in <unistd.h>. */
98/* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in 109/* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in
99 <unistd.h>. */ 110 <unistd.h>. */
100/* But avoid namespace pollution on glibc systems. */ 111/* But avoid namespace pollution on glibc systems. */
101#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \ 112#if ! defined O_CLOEXEC \
102 && (defined __CYGWIN__ || defined __ANDROID__) \ 113 || ((@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \
103 && ! defined __GLIBC__ 114 && (defined __CYGWIN__ || defined __ANDROID__) \
115 && ! defined __GLIBC__)
104# include <fcntl.h> 116# include <fcntl.h>
105#endif 117#endif
106 118
@@ -117,15 +129,6 @@
117# undef __need_system_stdlib_h 129# undef __need_system_stdlib_h
118#endif 130#endif
119 131
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>. */ 132/* Native Windows platforms declare _execl*, _execv* in <process.h>. */
130#if defined _WIN32 && !defined __CYGWIN__ 133#if defined _WIN32 && !defined __CYGWIN__
131# include <process.h> 134# include <process.h>
@@ -159,8 +162,9 @@
159#endif 162#endif
160 163
161/* MSVC defines off_t in <sys/types.h>. 164/* MSVC defines off_t in <sys/types.h>.
162 May also define off_t to a 64-bit type on native Windows. */ 165 May also define off_t to a 64-bit type on native Windows.
163/* Get off_t, ssize_t, mode_t. */ 166 Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku. */
167/* Get off_t, off64_t, ssize_t, mode_t. */
164#include <sys/types.h> 168#include <sys/types.h>
165 169
166/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 170/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -180,6 +184,9 @@ _GL_INLINE_HEADER_BEGIN
180#ifndef _GL_UNISTD_INLINE 184#ifndef _GL_UNISTD_INLINE
181# define _GL_UNISTD_INLINE _GL_INLINE 185# define _GL_UNISTD_INLINE _GL_INLINE
182#endif 186#endif
187#ifndef _GL_GETPAGESIZE_INLINE
188# define _GL_GETPAGESIZE_INLINE _GL_INLINE
189#endif
183 190
184/* Hide some function declarations from <winsock2.h>. */ 191/* Hide some function declarations from <winsock2.h>. */
185 192
@@ -286,7 +293,7 @@ _GL_INLINE_HEADER_BEGIN
286# undef access 293# undef access
287# define access rpl_access 294# define access rpl_access
288# endif 295# endif
289_GL_FUNCDECL_RPL (access, int, (const char *file, int mode) 296_GL_FUNCDECL_RPL (access, int, (const char *file, int mode),
290 _GL_ARG_NONNULL ((1))); 297 _GL_ARG_NONNULL ((1)));
291_GL_CXXALIAS_RPL (access, int, (const char *file, int mode)); 298_GL_CXXALIAS_RPL (access, int, (const char *file, int mode));
292# elif defined _WIN32 && !defined __CYGWIN__ 299# elif defined _WIN32 && !defined __CYGWIN__
@@ -339,7 +346,7 @@ _GL_CXXALIASWARN (chdir);
339#elif defined GNULIB_POSIXCHECK 346#elif defined GNULIB_POSIXCHECK
340# undef chdir 347# undef chdir
341# if HAVE_RAW_DECL_CHDIR 348# if HAVE_RAW_DECL_CHDIR
342_GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - " 349_GL_WARN_ON_USE (chdir, "chdir is not always in <unistd.h> - "
343 "use gnulib module chdir for portability"); 350 "use gnulib module chdir for portability");
344# endif 351# endif
345#elif @GNULIB_MDA_CHDIR@ 352#elif @GNULIB_MDA_CHDIR@
@@ -370,13 +377,13 @@ _GL_CXXALIASWARN (chdir);
370# undef chown 377# undef chown
371# define chown rpl_chown 378# define chown rpl_chown
372# endif 379# endif
373_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid) 380_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid),
374 _GL_ARG_NONNULL ((1))); 381 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
375_GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)); 382_GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
376# else 383# else
377# if !@HAVE_CHOWN@ 384# if !@HAVE_CHOWN@
378_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid) 385_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid),
379 _GL_ARG_NONNULL ((1))); 386 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
380# endif 387# endif
381_GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)); 388_GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
382# endif 389# endif
@@ -398,7 +405,7 @@ _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
398# undef close 405# undef close
399# define close rpl_close 406# define close rpl_close
400# endif 407# endif
401_GL_FUNCDECL_RPL (close, int, (int fd)); 408_GL_FUNCDECL_RPL (close, int, (int fd), );
402_GL_CXXALIAS_RPL (close, int, (int fd)); 409_GL_CXXALIAS_RPL (close, int, (int fd));
403# elif defined _WIN32 && !defined __CYGWIN__ 410# elif defined _WIN32 && !defined __CYGWIN__
404# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 411# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -411,8 +418,10 @@ _GL_CXXALIAS_SYS (close, int, (int fd));
411# endif 418# endif
412_GL_CXXALIASWARN (close); 419_GL_CXXALIASWARN (close);
413#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ 420#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
414# undef close 421# if !GNULIB_CLOSE
415# define close close_used_without_requesting_gnulib_module_close 422# undef close
423# define close close_used_without_requesting_gnulib_module_close
424# endif
416#elif defined GNULIB_POSIXCHECK 425#elif defined GNULIB_POSIXCHECK
417# undef close 426# undef close
418/* Assume close is always declared. */ 427/* Assume close is always declared. */
@@ -443,7 +452,7 @@ _GL_CXXALIASWARN (close);
443# endif 452# endif
444_GL_FUNCDECL_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos, 453_GL_FUNCDECL_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos,
445 int ofd, off_t *opos, 454 int ofd, off_t *opos,
446 size_t len, unsigned flags)); 455 size_t len, unsigned flags), );
447_GL_CXXALIAS_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos, 456_GL_CXXALIAS_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos,
448 int ofd, off_t *opos, 457 int ofd, off_t *opos,
449 size_t len, unsigned flags)); 458 size_t len, unsigned flags));
@@ -451,13 +460,15 @@ _GL_CXXALIAS_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos,
451# if !@HAVE_COPY_FILE_RANGE@ 460# if !@HAVE_COPY_FILE_RANGE@
452_GL_FUNCDECL_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, 461_GL_FUNCDECL_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
453 int ofd, off_t *opos, 462 int ofd, off_t *opos,
454 size_t len, unsigned flags)); 463 size_t len, unsigned flags), );
455# endif 464# endif
456_GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, 465_GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
457 int ofd, off_t *opos, 466 int ofd, off_t *opos,
458 size_t len, unsigned flags)); 467 size_t len, unsigned flags));
459# endif 468# endif
469# if __GLIBC__ >= 2
460_GL_CXXALIASWARN (copy_file_range); 470_GL_CXXALIASWARN (copy_file_range);
471# endif
461#elif defined GNULIB_POSIXCHECK 472#elif defined GNULIB_POSIXCHECK
462# undef copy_file_range 473# undef copy_file_range
463# if HAVE_RAW_DECL_COPY_FILE_RANGE 474# if HAVE_RAW_DECL_COPY_FILE_RANGE
@@ -473,7 +484,7 @@ _GL_WARN_ON_USE (copy_file_range,
473# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 484# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
474# define dup rpl_dup 485# define dup rpl_dup
475# endif 486# endif
476_GL_FUNCDECL_RPL (dup, int, (int oldfd)); 487_GL_FUNCDECL_RPL (dup, int, (int oldfd), _GL_ATTRIBUTE_NODISCARD);
477_GL_CXXALIAS_RPL (dup, int, (int oldfd)); 488_GL_CXXALIAS_RPL (dup, int, (int oldfd));
478# elif defined _WIN32 && !defined __CYGWIN__ 489# elif defined _WIN32 && !defined __CYGWIN__
479# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 490# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -518,7 +529,7 @@ _GL_CXXALIASWARN (dup);
518# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 529# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
519# define dup2 rpl_dup2 530# define dup2 rpl_dup2
520# endif 531# endif
521_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd)); 532_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd), );
522_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd)); 533_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
523# elif defined _WIN32 && !defined __CYGWIN__ 534# elif defined _WIN32 && !defined __CYGWIN__
524# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 535# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -567,11 +578,11 @@ _GL_CXXALIASWARN (dup2);
567# undef dup3 578# undef dup3
568# define dup3 rpl_dup3 579# define dup3 rpl_dup3
569# endif 580# endif
570_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags)); 581_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags), );
571_GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags)); 582_GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
572# else 583# else
573# if !@HAVE_DUP3@ 584# if !@HAVE_DUP3@
574_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags)); 585_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags), );
575# endif 586# endif
576_GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags)); 587_GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
577# endif 588# endif
@@ -636,7 +647,7 @@ rpl_environ (void)
636/* Like access(), except that it uses the effective user id and group id of 647/* Like access(), except that it uses the effective user id and group id of
637 the current process. */ 648 the current process. */
638# if !@HAVE_EUIDACCESS@ 649# if !@HAVE_EUIDACCESS@
639_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode) 650_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode),
640 _GL_ARG_NONNULL ((1))); 651 _GL_ARG_NONNULL ((1)));
641# endif 652# endif
642_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode)); 653_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
@@ -661,7 +672,7 @@ _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
661# undef execl 672# undef execl
662# define execl rpl_execl 673# define execl rpl_execl
663# endif 674# endif
664_GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...) 675_GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...),
665 _GL_ARG_NONNULL ((1))); 676 _GL_ARG_NONNULL ((1)));
666_GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...)); 677_GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...));
667# else 678# else
@@ -696,7 +707,7 @@ _GL_CXXALIASWARN (execl);
696# undef execle 707# undef execle
697# define execle rpl_execle 708# define execle rpl_execle
698# endif 709# endif
699_GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...) 710_GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...),
700 _GL_ARG_NONNULL ((1))); 711 _GL_ARG_NONNULL ((1)));
701_GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...)); 712_GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...));
702# else 713# else
@@ -732,7 +743,7 @@ _GL_CXXALIASWARN (execle);
732# undef execlp 743# undef execlp
733# define execlp rpl_execlp 744# define execlp rpl_execlp
734# endif 745# endif
735_GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...) 746_GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...),
736 _GL_ARG_NONNULL ((1))); 747 _GL_ARG_NONNULL ((1)));
737_GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...)); 748_GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...));
738# else 749# else
@@ -769,7 +780,7 @@ _GL_CXXALIASWARN (execlp);
769# undef execv 780# undef execv
770# define execv rpl_execv 781# define execv rpl_execv
771# endif 782# endif
772_GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv) 783_GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv),
773 _GL_ARG_NONNULL ((1, 2))); 784 _GL_ARG_NONNULL ((1, 2)));
774_GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv)); 785_GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv));
775# else 786# else
@@ -806,7 +817,7 @@ _GL_CXXALIASWARN (execv);
806# define execve rpl_execve 817# define execve rpl_execve
807# endif 818# endif
808_GL_FUNCDECL_RPL (execve, int, 819_GL_FUNCDECL_RPL (execve, int,
809 (const char *program, char * const *argv, char * const *env) 820 (const char *program, char * const *argv, char * const *env),
810 _GL_ARG_NONNULL ((1, 2))); 821 _GL_ARG_NONNULL ((1, 2)));
811_GL_CXXALIAS_RPL (execve, int, 822_GL_CXXALIAS_RPL (execve, int,
812 (const char *program, char * const *argv, char * const *env)); 823 (const char *program, char * const *argv, char * const *env));
@@ -846,7 +857,7 @@ _GL_CXXALIASWARN (execve);
846# undef execvp 857# undef execvp
847# define execvp rpl_execvp 858# define execvp rpl_execvp
848# endif 859# endif
849_GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv) 860_GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv),
850 _GL_ARG_NONNULL ((1, 2))); 861 _GL_ARG_NONNULL ((1, 2)));
851_GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv)); 862_GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv));
852# else 863# else
@@ -883,14 +894,14 @@ _GL_CXXALIASWARN (execvp);
883# define execvpe rpl_execvpe 894# define execvpe rpl_execvpe
884# endif 895# endif
885_GL_FUNCDECL_RPL (execvpe, int, 896_GL_FUNCDECL_RPL (execvpe, int,
886 (const char *program, char * const *argv, char * const *env) 897 (const char *program, char * const *argv, char * const *env),
887 _GL_ARG_NONNULL ((1, 2))); 898 _GL_ARG_NONNULL ((1, 2)));
888_GL_CXXALIAS_RPL (execvpe, int, 899_GL_CXXALIAS_RPL (execvpe, int,
889 (const char *program, char * const *argv, char * const *env)); 900 (const char *program, char * const *argv, char * const *env));
890# else 901# else
891# if !@HAVE_DECL_EXECVPE@ 902# if !@HAVE_DECL_EXECVPE@
892_GL_FUNCDECL_SYS (execvpe, int, 903_GL_FUNCDECL_SYS (execvpe, int,
893 (const char *program, char * const *argv, char * const *env) 904 (const char *program, char * const *argv, char * const *env),
894 _GL_ARG_NONNULL ((1, 2))); 905 _GL_ARG_NONNULL ((1, 2)));
895# endif 906# endif
896_GL_CXXALIAS_SYS (execvpe, int, 907_GL_CXXALIAS_SYS (execvpe, int,
@@ -921,7 +932,7 @@ _GL_CXXALIAS_MDA_CAST (execvpe, intptr_t,
921# elif @HAVE_EXECVPE@ 932# elif @HAVE_EXECVPE@
922# if !@HAVE_DECL_EXECVPE@ 933# if !@HAVE_DECL_EXECVPE@
923_GL_FUNCDECL_SYS (execvpe, int, 934_GL_FUNCDECL_SYS (execvpe, int,
924 (const char *program, char * const *argv, char * const *env) 935 (const char *program, char * const *argv, char * const *env),
925 _GL_ARG_NONNULL ((1, 2))); 936 _GL_ARG_NONNULL ((1, 2)));
926# endif 937# endif
927_GL_CXXALIAS_SYS (execvpe, int, 938_GL_CXXALIAS_SYS (execvpe, int,
@@ -940,15 +951,15 @@ _GL_CXXALIASWARN (execvpe);
940# define faccessat rpl_faccessat 951# define faccessat rpl_faccessat
941# endif 952# endif
942_GL_FUNCDECL_RPL (faccessat, int, 953_GL_FUNCDECL_RPL (faccessat, int,
943 (int fd, char const *name, int mode, int flag) 954 (int fd, char const *name, int mode, int flag),
944 _GL_ARG_NONNULL ((2))); 955 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
945_GL_CXXALIAS_RPL (faccessat, int, 956_GL_CXXALIAS_RPL (faccessat, int,
946 (int fd, char const *name, int mode, int flag)); 957 (int fd, char const *name, int mode, int flag));
947# else 958# else
948# if !@HAVE_FACCESSAT@ 959# if !@HAVE_FACCESSAT@
949_GL_FUNCDECL_SYS (faccessat, int, 960_GL_FUNCDECL_SYS (faccessat, int,
950 (int fd, char const *file, int mode, int flag) 961 (int fd, char const *file, int mode, int flag),
951 _GL_ARG_NONNULL ((2))); 962 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
952# endif 963# endif
953_GL_CXXALIAS_SYS (faccessat, int, 964_GL_CXXALIAS_SYS (faccessat, int,
954 (int fd, char const *file, int mode, int flag)); 965 (int fd, char const *file, int mode, int flag));
@@ -976,11 +987,11 @@ _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
976# undef fchdir 987# undef fchdir
977# define fchdir rpl_fchdir 988# define fchdir rpl_fchdir
978# endif 989# endif
979_GL_FUNCDECL_RPL (fchdir, int, (int /*fd*/)); 990_GL_FUNCDECL_RPL (fchdir, int, (int /*fd*/), _GL_ATTRIBUTE_NODISCARD);
980_GL_CXXALIAS_RPL (fchdir, int, (int /*fd*/)); 991_GL_CXXALIAS_RPL (fchdir, int, (int /*fd*/));
981# else 992# else
982# if !@HAVE_FCHDIR@ || !@HAVE_DECL_FCHDIR@ 993# if !@HAVE_FCHDIR@ || !@HAVE_DECL_FCHDIR@
983_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); 994_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/), _GL_ATTRIBUTE_NODISCARD);
984# endif 995# endif
985_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); 996_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
986# endif 997# endif
@@ -1009,15 +1020,15 @@ _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
1009# define fchownat rpl_fchownat 1020# define fchownat rpl_fchownat
1010# endif 1021# endif
1011_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file, 1022_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
1012 uid_t owner, gid_t group, int flag) 1023 uid_t owner, gid_t group, int flag),
1013 _GL_ARG_NONNULL ((2))); 1024 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1014_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file, 1025_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
1015 uid_t owner, gid_t group, int flag)); 1026 uid_t owner, gid_t group, int flag));
1016# else 1027# else
1017# if !@HAVE_FCHOWNAT@ 1028# if !@HAVE_FCHOWNAT@
1018_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file, 1029_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
1019 uid_t owner, gid_t group, int flag) 1030 uid_t owner, gid_t group, int flag),
1020 _GL_ARG_NONNULL ((2))); 1031 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1021# endif 1032# endif
1022_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file, 1033_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
1023 uid_t owner, gid_t group, int flag)); 1034 uid_t owner, gid_t group, int flag));
@@ -1042,11 +1053,11 @@ _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
1042# undef fdatasync 1053# undef fdatasync
1043# define fdatasync rpl_fdatasync 1054# define fdatasync rpl_fdatasync
1044# endif 1055# endif
1045_GL_FUNCDECL_RPL (fdatasync, int, (int fd)); 1056_GL_FUNCDECL_RPL (fdatasync, int, (int fd), );
1046_GL_CXXALIAS_RPL (fdatasync, int, (int fd)); 1057_GL_CXXALIAS_RPL (fdatasync, int, (int fd));
1047# else 1058# else
1048# if !@HAVE_FDATASYNC@|| !@HAVE_DECL_FDATASYNC@ 1059# if !@HAVE_FDATASYNC@|| !@HAVE_DECL_FDATASYNC@
1049_GL_FUNCDECL_SYS (fdatasync, int, (int fd)); 1060_GL_FUNCDECL_SYS (fdatasync, int, (int fd), );
1050# endif 1061# endif
1051_GL_CXXALIAS_SYS (fdatasync, int, (int fd)); 1062_GL_CXXALIAS_SYS (fdatasync, int, (int fd));
1052# endif 1063# endif
@@ -1068,7 +1079,7 @@ _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
1068 See POSIX:2008 specification 1079 See POSIX:2008 specification
1069 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */ 1080 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
1070# if !@HAVE_FSYNC@ 1081# if !@HAVE_FSYNC@
1071_GL_FUNCDECL_SYS (fsync, int, (int fd)); 1082_GL_FUNCDECL_SYS (fsync, int, (int fd), );
1072# endif 1083# endif
1073_GL_CXXALIAS_SYS (fsync, int, (int fd)); 1084_GL_CXXALIAS_SYS (fsync, int, (int fd));
1074_GL_CXXALIASWARN (fsync); 1085_GL_CXXALIASWARN (fsync);
@@ -1091,13 +1102,17 @@ _GL_WARN_ON_USE (fsync, "fsync is unportable - "
1091# undef ftruncate 1102# undef ftruncate
1092# define ftruncate rpl_ftruncate 1103# define ftruncate rpl_ftruncate
1093# endif 1104# endif
1094_GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length)); 1105_GL_FUNCDECL_RPL (ftruncate, int,
1095_GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length)); 1106 (int fd, off_t length), _GL_ATTRIBUTE_NODISCARD);
1107_GL_CXXALIAS_RPL (ftruncate, int,
1108 (int fd, off_t length));
1096# else 1109# else
1097# if !@HAVE_FTRUNCATE@ 1110# if !@HAVE_FTRUNCATE@
1098_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); 1111_GL_FUNCDECL_SYS (ftruncate, int,
1112 (int fd, off_t length), _GL_ATTRIBUTE_NODISCARD);
1099# endif 1113# endif
1100_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); 1114_GL_CXXALIAS_SYS (ftruncate, int,
1115 (int fd, off_t length));
1101# endif 1116# endif
1102# if __GLIBC__ >= 2 1117# if __GLIBC__ >= 2
1103_GL_CXXALIASWARN (ftruncate); 1118_GL_CXXALIASWARN (ftruncate);
@@ -1126,7 +1141,8 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
1126# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1141# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1127# define getcwd rpl_getcwd 1142# define getcwd rpl_getcwd
1128# endif 1143# endif
1129_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size)); 1144_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size),
1145 _GL_ATTRIBUTE_NODISCARD);
1130_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size)); 1146_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
1131# elif defined _WIN32 && !defined __CYGWIN__ 1147# elif defined _WIN32 && !defined __CYGWIN__
1132# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1148# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1181,15 +1197,19 @@ _GL_CXXALIASWARN (getcwd);
1181# undef getdomainname 1197# undef getdomainname
1182# define getdomainname rpl_getdomainname 1198# define getdomainname rpl_getdomainname
1183# endif 1199# endif
1184_GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len) 1200_GL_FUNCDECL_RPL (getdomainname, int,
1185 _GL_ARG_NONNULL ((1))); 1201 (char *name, size_t len),
1186_GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len)); 1202 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1203_GL_CXXALIAS_RPL (getdomainname, int,
1204 (char *name, size_t len));
1187# else 1205# else
1188# if !@HAVE_DECL_GETDOMAINNAME@ 1206# if !@HAVE_DECL_GETDOMAINNAME@
1189_GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len) 1207_GL_FUNCDECL_SYS (getdomainname, int,
1190 _GL_ARG_NONNULL ((1))); 1208 (char *name, size_t len),
1209 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1191# endif 1210# endif
1192_GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len)); 1211_GL_CXXALIAS_SYS (getdomainname, int,
1212 (char *name, size_t len));
1193# endif 1213# endif
1194# if __GLIBC__ >= 2 1214# if __GLIBC__ >= 2
1195_GL_CXXALIASWARN (getdomainname); 1215_GL_CXXALIASWARN (getdomainname);
@@ -1211,11 +1231,11 @@ _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
1211# undef getdtablesize 1231# undef getdtablesize
1212# define getdtablesize rpl_getdtablesize 1232# define getdtablesize rpl_getdtablesize
1213# endif 1233# endif
1214_GL_FUNCDECL_RPL (getdtablesize, int, (void)); 1234_GL_FUNCDECL_RPL (getdtablesize, int, (void), );
1215_GL_CXXALIAS_RPL (getdtablesize, int, (void)); 1235_GL_CXXALIAS_RPL (getdtablesize, int, (void));
1216# else 1236# else
1217# if !@HAVE_GETDTABLESIZE@ 1237# if !@HAVE_GETDTABLESIZE@
1218_GL_FUNCDECL_SYS (getdtablesize, int, (void)); 1238_GL_FUNCDECL_SYS (getdtablesize, int, (void), );
1219# endif 1239# endif
1220/* Need to cast, because on AIX, the parameter list is 1240/* Need to cast, because on AIX, the parameter list is
1221 (...). */ 1241 (...). */
@@ -1238,13 +1258,17 @@ _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
1238# undef getentropy 1258# undef getentropy
1239# define getentropy rpl_getentropy 1259# define getentropy rpl_getentropy
1240# endif 1260# endif
1241_GL_FUNCDECL_RPL (getentropy, int, (void *buffer, size_t length)); 1261_GL_FUNCDECL_RPL (getentropy, int,
1242_GL_CXXALIAS_RPL (getentropy, int, (void *buffer, size_t length)); 1262 (void *buffer, size_t length), _GL_ATTRIBUTE_NODISCARD);
1263_GL_CXXALIAS_RPL (getentropy, int,
1264 (void *buffer, size_t length));
1243# else 1265# else
1244# if !@HAVE_GETENTROPY@ 1266# if !@HAVE_GETENTROPY@
1245_GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length)); 1267_GL_FUNCDECL_SYS (getentropy, int,
1268 (void *buffer, size_t length), _GL_ATTRIBUTE_NODISCARD);
1246# endif 1269# endif
1247_GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length)); 1270_GL_CXXALIAS_SYS (getentropy, int,
1271 (void *buffer, size_t length));
1248# endif 1272# endif
1249# if __GLIBC__ >= 2 1273# if __GLIBC__ >= 2
1250_GL_CXXALIASWARN (getentropy); 1274_GL_CXXALIASWARN (getentropy);
@@ -1269,13 +1293,17 @@ _GL_WARN_ON_USE (getentropy, "getentropy is unportable - "
1269# undef getgroups 1293# undef getgroups
1270# define getgroups rpl_getgroups 1294# define getgroups rpl_getgroups
1271# endif 1295# endif
1272_GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups)); 1296_GL_FUNCDECL_RPL (getgroups, int,
1273_GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups)); 1297 (int n, gid_t *groups), _GL_ATTRIBUTE_NODISCARD);
1298_GL_CXXALIAS_RPL (getgroups, int,
1299 (int n, gid_t *groups));
1274# else 1300# else
1275# if !@HAVE_GETGROUPS@ 1301# if !@HAVE_GETGROUPS@
1276_GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups)); 1302_GL_FUNCDECL_SYS (getgroups, int,
1303 (int n, gid_t *groups), _GL_ATTRIBUTE_NODISCARD);
1277# endif 1304# endif
1278_GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups)); 1305_GL_CXXALIAS_SYS (getgroups, int,
1306 (int n, gid_t *groups));
1279# endif 1307# endif
1280_GL_CXXALIASWARN (getgroups); 1308_GL_CXXALIASWARN (getgroups);
1281#elif defined GNULIB_POSIXCHECK 1309#elif defined GNULIB_POSIXCHECK
@@ -1300,12 +1328,12 @@ _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
1300# undef gethostname 1328# undef gethostname
1301# define gethostname rpl_gethostname 1329# define gethostname rpl_gethostname
1302# endif 1330# endif
1303_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len) 1331_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len),
1304 _GL_ARG_NONNULL ((1))); 1332 _GL_ARG_NONNULL ((1)));
1305_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len)); 1333_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
1306# else 1334# else
1307# if !@HAVE_GETHOSTNAME@ 1335# if !@HAVE_GETHOSTNAME@
1308_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len) 1336_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len),
1309 _GL_ARG_NONNULL ((1))); 1337 _GL_ARG_NONNULL ((1)));
1310# endif 1338# endif
1311/* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second 1339/* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
@@ -1315,8 +1343,10 @@ _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
1315# endif 1343# endif
1316_GL_CXXALIASWARN (gethostname); 1344_GL_CXXALIASWARN (gethostname);
1317#elif @UNISTD_H_HAVE_WINSOCK2_H@ 1345#elif @UNISTD_H_HAVE_WINSOCK2_H@
1318# undef gethostname 1346# if !GNULIB_GETHOSTNAME
1319# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname 1347# undef gethostname
1348# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
1349# endif
1320#elif defined GNULIB_POSIXCHECK 1350#elif defined GNULIB_POSIXCHECK
1321# undef gethostname 1351# undef gethostname
1322# if HAVE_RAW_DECL_GETHOSTNAME 1352# if HAVE_RAW_DECL_GETHOSTNAME
@@ -1337,11 +1367,21 @@ _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
1337 ${LOGNAME-$USER} on Unix platforms, 1367 ${LOGNAME-$USER} on Unix platforms,
1338 $USERNAME on native Windows platforms. 1368 $USERNAME on native Windows platforms.
1339 */ 1369 */
1340# if !@HAVE_DECL_GETLOGIN@ 1370# if @REPLACE_GETLOGIN@
1341_GL_FUNCDECL_SYS (getlogin, char *, (void)); 1371# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1342# endif 1372# define getlogin rpl_getlogin
1373# endif
1374_GL_FUNCDECL_RPL (getlogin, char *, (void), );
1375_GL_CXXALIAS_RPL (getlogin, char *, (void));
1376# else
1377# if !@HAVE_DECL_GETLOGIN@
1378_GL_FUNCDECL_SYS (getlogin, char *, (void), );
1379# endif
1343_GL_CXXALIAS_SYS (getlogin, char *, (void)); 1380_GL_CXXALIAS_SYS (getlogin, char *, (void));
1381# endif
1382# if __GLIBC__ >= 2
1344_GL_CXXALIASWARN (getlogin); 1383_GL_CXXALIASWARN (getlogin);
1384# endif
1345#elif defined GNULIB_POSIXCHECK 1385#elif defined GNULIB_POSIXCHECK
1346# undef getlogin 1386# undef getlogin
1347# if HAVE_RAW_DECL_GETLOGIN 1387# if HAVE_RAW_DECL_GETLOGIN
@@ -1370,12 +1410,12 @@ _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
1370# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1410# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1371# define getlogin_r rpl_getlogin_r 1411# define getlogin_r rpl_getlogin_r
1372# endif 1412# endif
1373_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size) 1413_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size),
1374 _GL_ARG_NONNULL ((1))); 1414 _GL_ARG_NONNULL ((1)));
1375_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size)); 1415_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
1376# else 1416# else
1377# if !@HAVE_DECL_GETLOGIN_R@ 1417# if !@HAVE_DECL_GETLOGIN_R@
1378_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) 1418_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size),
1379 _GL_ARG_NONNULL ((1))); 1419 _GL_ARG_NONNULL ((1)));
1380# endif 1420# endif
1381/* Need to cast, because on Solaris 10 systems, the second argument is 1421/* Need to cast, because on Solaris 10 systems, the second argument is
@@ -1399,13 +1439,13 @@ _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
1399# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1439# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1400# define getpagesize rpl_getpagesize 1440# define getpagesize rpl_getpagesize
1401# endif 1441# endif
1402_GL_FUNCDECL_RPL (getpagesize, int, (void)); 1442_GL_FUNCDECL_RPL (getpagesize, int, (void), );
1403_GL_CXXALIAS_RPL (getpagesize, int, (void)); 1443_GL_CXXALIAS_RPL (getpagesize, int, (void));
1404# else 1444# else
1405/* On HP-UX, getpagesize exists, but it is not declared in <unistd.h> even if 1445/* 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. */ 1446 the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */
1407# if defined __hpux 1447# if defined __hpux
1408_GL_FUNCDECL_SYS (getpagesize, int, (void)); 1448_GL_FUNCDECL_SYS (getpagesize, int, (void), );
1409# endif 1449# endif
1410# if !@HAVE_GETPAGESIZE@ 1450# if !@HAVE_GETPAGESIZE@
1411# if !defined getpagesize 1451# if !defined getpagesize
@@ -1456,7 +1496,7 @@ _GL_FUNCDECL_SYS (getpagesize, int, (void));
1456# define getpagesize() _gl_getpagesize () 1496# define getpagesize() _gl_getpagesize ()
1457# else 1497# else
1458# if !GNULIB_defined_getpagesize_function 1498# if !GNULIB_defined_getpagesize_function
1459_GL_UNISTD_INLINE int 1499_GL_GETPAGESIZE_INLINE int
1460getpagesize () 1500getpagesize ()
1461{ 1501{
1462 return _gl_getpagesize (); 1502 return _gl_getpagesize ();
@@ -1492,12 +1532,12 @@ _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
1492# undef getpass 1532# undef getpass
1493# define getpass rpl_getpass 1533# define getpass rpl_getpass
1494# endif 1534# endif
1495_GL_FUNCDECL_RPL (getpass, char *, (const char *prompt) 1535_GL_FUNCDECL_RPL (getpass, char *, (const char *prompt),
1496 _GL_ARG_NONNULL ((1))); 1536 _GL_ARG_NONNULL ((1)));
1497_GL_CXXALIAS_RPL (getpass, char *, (const char *prompt)); 1537_GL_CXXALIAS_RPL (getpass, char *, (const char *prompt));
1498# else 1538# else
1499# if !@HAVE_GETPASS@ 1539# if !@HAVE_GETPASS@
1500_GL_FUNCDECL_SYS (getpass, char *, (const char *prompt) 1540_GL_FUNCDECL_SYS (getpass, char *, (const char *prompt),
1501 _GL_ARG_NONNULL ((1))); 1541 _GL_ARG_NONNULL ((1)));
1502# endif 1542# endif
1503_GL_CXXALIAS_SYS (getpass, char *, (const char *prompt)); 1543_GL_CXXALIAS_SYS (getpass, char *, (const char *prompt));
@@ -1530,12 +1570,21 @@ _GL_CXXALIASWARN (getpid);
1530 1570
1531 1571
1532#if @GNULIB_GETUSERSHELL@ 1572#if @GNULIB_GETUSERSHELL@
1573# if @REPLACE_GETUSERSHELL@
1533/* Return the next valid login shell on the system, or NULL when the end of 1574/* Return the next valid login shell on the system, or NULL when the end of
1534 the list has been reached. */ 1575 the list has been reached. */
1535# if !@HAVE_DECL_GETUSERSHELL@ 1576# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1536_GL_FUNCDECL_SYS (getusershell, char *, (void)); 1577# undef getusershell
1537# endif 1578# define getusershell rpl_getusershell
1579# endif
1580_GL_FUNCDECL_RPL (getusershell, char *, (void), );
1581_GL_CXXALIAS_RPL (getusershell, char *, (void));
1582# else
1583# if !@HAVE_DECL_GETUSERSHELL@
1584_GL_FUNCDECL_SYS (getusershell, char *, (void), );
1585# endif
1538_GL_CXXALIAS_SYS (getusershell, char *, (void)); 1586_GL_CXXALIAS_SYS (getusershell, char *, (void));
1587# endif
1539_GL_CXXALIASWARN (getusershell); 1588_GL_CXXALIASWARN (getusershell);
1540#elif defined GNULIB_POSIXCHECK 1589#elif defined GNULIB_POSIXCHECK
1541# undef getusershell 1590# undef getusershell
@@ -1547,10 +1596,19 @@ _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
1547 1596
1548#if @GNULIB_GETUSERSHELL@ 1597#if @GNULIB_GETUSERSHELL@
1549/* Rewind to pointer that is advanced at each getusershell() call. */ 1598/* Rewind to pointer that is advanced at each getusershell() call. */
1550# if !@HAVE_DECL_GETUSERSHELL@ 1599# if @REPLACE_GETUSERSHELL@
1551_GL_FUNCDECL_SYS (setusershell, void, (void)); 1600# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1552# endif 1601# undef setusershell
1602# define setusershell rpl_setusershell
1603# endif
1604_GL_FUNCDECL_RPL (setusershell, void, (void), );
1605_GL_CXXALIAS_RPL (setusershell, void, (void));
1606# else
1607# if !@HAVE_DECL_GETUSERSHELL@
1608_GL_FUNCDECL_SYS (setusershell, void, (void), );
1609# endif
1553_GL_CXXALIAS_SYS (setusershell, void, (void)); 1610_GL_CXXALIAS_SYS (setusershell, void, (void));
1611# endif
1554_GL_CXXALIASWARN (setusershell); 1612_GL_CXXALIASWARN (setusershell);
1555#elif defined GNULIB_POSIXCHECK 1613#elif defined GNULIB_POSIXCHECK
1556# undef setusershell 1614# undef setusershell
@@ -1563,10 +1621,19 @@ _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
1563#if @GNULIB_GETUSERSHELL@ 1621#if @GNULIB_GETUSERSHELL@
1564/* Free the pointer that is advanced at each getusershell() call and 1622/* Free the pointer that is advanced at each getusershell() call and
1565 associated resources. */ 1623 associated resources. */
1566# if !@HAVE_DECL_GETUSERSHELL@ 1624# if @REPLACE_GETUSERSHELL@
1567_GL_FUNCDECL_SYS (endusershell, void, (void)); 1625# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1568# endif 1626# undef endusershell
1627# define endusershell rpl_endusershell
1628# endif
1629_GL_FUNCDECL_RPL (endusershell, void, (void), );
1630_GL_CXXALIAS_RPL (endusershell, void, (void));
1631# else
1632# if !@HAVE_DECL_GETUSERSHELL@
1633_GL_FUNCDECL_SYS (endusershell, void, (void), );
1634# endif
1569_GL_CXXALIAS_SYS (endusershell, void, (void)); 1635_GL_CXXALIAS_SYS (endusershell, void, (void));
1636# endif
1570_GL_CXXALIASWARN (endusershell); 1637_GL_CXXALIASWARN (endusershell);
1571#elif defined GNULIB_POSIXCHECK 1638#elif defined GNULIB_POSIXCHECK
1572# undef endusershell 1639# undef endusershell
@@ -1580,7 +1647,7 @@ _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
1580#if @GNULIB_GROUP_MEMBER@ 1647#if @GNULIB_GROUP_MEMBER@
1581/* Determine whether group id is in calling user's group list. */ 1648/* Determine whether group id is in calling user's group list. */
1582# if !@HAVE_GROUP_MEMBER@ 1649# if !@HAVE_GROUP_MEMBER@
1583_GL_FUNCDECL_SYS (group_member, int, (gid_t gid)); 1650_GL_FUNCDECL_SYS (group_member, int, (gid_t gid), );
1584# endif 1651# endif
1585_GL_CXXALIAS_SYS (group_member, int, (gid_t gid)); 1652_GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
1586_GL_CXXALIASWARN (group_member); 1653_GL_CXXALIASWARN (group_member);
@@ -1600,7 +1667,7 @@ _GL_WARN_ON_USE (group_member, "group_member is unportable - "
1600# define isatty rpl_isatty 1667# define isatty rpl_isatty
1601# endif 1668# endif
1602# define GNULIB_defined_isatty 1 1669# define GNULIB_defined_isatty 1
1603_GL_FUNCDECL_RPL (isatty, int, (int fd)); 1670_GL_FUNCDECL_RPL (isatty, int, (int fd), );
1604_GL_CXXALIAS_RPL (isatty, int, (int fd)); 1671_GL_CXXALIAS_RPL (isatty, int, (int fd));
1605# elif defined _WIN32 && !defined __CYGWIN__ 1672# elif defined _WIN32 && !defined __CYGWIN__
1606# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1673# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1646,13 +1713,13 @@ _GL_CXXALIASWARN (isatty);
1646# undef lchown 1713# undef lchown
1647# define lchown rpl_lchown 1714# define lchown rpl_lchown
1648# endif 1715# endif
1649_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group) 1716_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group),
1650 _GL_ARG_NONNULL ((1))); 1717 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1651_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)); 1718_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
1652# else 1719# else
1653# if !@HAVE_LCHOWN@ 1720# if !@HAVE_LCHOWN@
1654_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group) 1721_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group),
1655 _GL_ARG_NONNULL ((1))); 1722 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1656# endif 1723# endif
1657_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)); 1724_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
1658# endif 1725# endif
@@ -1675,13 +1742,13 @@ _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
1675# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1742# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1676# define link rpl_link 1743# define link rpl_link
1677# endif 1744# endif
1678_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2) 1745_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2),
1679 _GL_ARG_NONNULL ((1, 2))); 1746 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1680_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2)); 1747_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
1681# else 1748# else
1682# if !@HAVE_LINK@ 1749# if !@HAVE_LINK@
1683_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2) 1750_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2),
1684 _GL_ARG_NONNULL ((1, 2))); 1751 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1685# endif 1752# endif
1686_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2)); 1753_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
1687# endif 1754# endif
@@ -1706,8 +1773,8 @@ _GL_WARN_ON_USE (link, "link is unportable - "
1706# endif 1773# endif
1707_GL_FUNCDECL_RPL (linkat, int, 1774_GL_FUNCDECL_RPL (linkat, int,
1708 (int fd1, const char *path1, int fd2, const char *path2, 1775 (int fd1, const char *path1, int fd2, const char *path2,
1709 int flag) 1776 int flag),
1710 _GL_ARG_NONNULL ((2, 4))); 1777 _GL_ARG_NONNULL ((2, 4)) _GL_ATTRIBUTE_NODISCARD);
1711_GL_CXXALIAS_RPL (linkat, int, 1778_GL_CXXALIAS_RPL (linkat, int,
1712 (int fd1, const char *path1, int fd2, const char *path2, 1779 (int fd1, const char *path1, int fd2, const char *path2,
1713 int flag)); 1780 int flag));
@@ -1715,8 +1782,8 @@ _GL_CXXALIAS_RPL (linkat, int,
1715# if !@HAVE_LINKAT@ 1782# if !@HAVE_LINKAT@
1716_GL_FUNCDECL_SYS (linkat, int, 1783_GL_FUNCDECL_SYS (linkat, int,
1717 (int fd1, const char *path1, int fd2, const char *path2, 1784 (int fd1, const char *path1, int fd2, const char *path2,
1718 int flag) 1785 int flag),
1719 _GL_ARG_NONNULL ((2, 4))); 1786 _GL_ARG_NONNULL ((2, 4)) _GL_ATTRIBUTE_NODISCARD);
1720# endif 1787# endif
1721_GL_CXXALIAS_SYS (linkat, int, 1788_GL_CXXALIAS_SYS (linkat, int,
1722 (int fd1, const char *path1, int fd2, const char *path2, 1789 (int fd1, const char *path1, int fd2, const char *path2,
@@ -1743,7 +1810,7 @@ _GL_WARN_ON_USE (linkat, "linkat is unportable - "
1743# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1810# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1744# define lseek rpl_lseek 1811# define lseek rpl_lseek
1745# endif 1812# endif
1746_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence)); 1813_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)); 1814_GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
1748# elif defined _WIN32 && !defined __CYGWIN__ 1815# elif defined _WIN32 && !defined __CYGWIN__
1749# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1816# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1783,7 +1850,8 @@ _GL_CXXALIASWARN (lseek);
1783 Store the read-end as fd[0] and the write-end as fd[1]. 1850 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. */ 1851 Return 0 upon success, or -1 with errno set upon failure. */
1785# if !@HAVE_PIPE@ 1852# if !@HAVE_PIPE@
1786_GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1))); 1853_GL_FUNCDECL_SYS (pipe, int, (int fd[2]),
1854 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1787# endif 1855# endif
1788_GL_CXXALIAS_SYS (pipe, int, (int fd[2])); 1856_GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
1789_GL_CXXALIASWARN (pipe); 1857_GL_CXXALIASWARN (pipe);
@@ -1810,10 +1878,12 @@ _GL_WARN_ON_USE (pipe, "pipe is unportable - "
1810# undef pipe2 1878# undef pipe2
1811# define pipe2 rpl_pipe2 1879# define pipe2 rpl_pipe2
1812# endif 1880# endif
1813_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); 1881_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags),
1882 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1814_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags)); 1883_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
1815# else 1884# else
1816_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); 1885_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags),
1886 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1817_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags)); 1887_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
1818# endif 1888# endif
1819# if __GLIBC__ >= 2 1889# if __GLIBC__ >= 2
@@ -1840,15 +1910,15 @@ _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
1840# define pread rpl_pread 1910# define pread rpl_pread
1841# endif 1911# endif
1842_GL_FUNCDECL_RPL (pread, ssize_t, 1912_GL_FUNCDECL_RPL (pread, ssize_t,
1843 (int fd, void *buf, size_t bufsize, off_t offset) 1913 (int fd, void *buf, size_t bufsize, off_t offset),
1844 _GL_ARG_NONNULL ((2))); 1914 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1845_GL_CXXALIAS_RPL (pread, ssize_t, 1915_GL_CXXALIAS_RPL (pread, ssize_t,
1846 (int fd, void *buf, size_t bufsize, off_t offset)); 1916 (int fd, void *buf, size_t bufsize, off_t offset));
1847# else 1917# else
1848# if !@HAVE_PREAD@ 1918# if !@HAVE_PREAD@
1849_GL_FUNCDECL_SYS (pread, ssize_t, 1919_GL_FUNCDECL_SYS (pread, ssize_t,
1850 (int fd, void *buf, size_t bufsize, off_t offset) 1920 (int fd, void *buf, size_t bufsize, off_t offset),
1851 _GL_ARG_NONNULL ((2))); 1921 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1852# endif 1922# endif
1853_GL_CXXALIAS_SYS (pread, ssize_t, 1923_GL_CXXALIAS_SYS (pread, ssize_t,
1854 (int fd, void *buf, size_t bufsize, off_t offset)); 1924 (int fd, void *buf, size_t bufsize, off_t offset));
@@ -1877,15 +1947,15 @@ _GL_WARN_ON_USE (pread, "pread is unportable - "
1877# define pwrite rpl_pwrite 1947# define pwrite rpl_pwrite
1878# endif 1948# endif
1879_GL_FUNCDECL_RPL (pwrite, ssize_t, 1949_GL_FUNCDECL_RPL (pwrite, ssize_t,
1880 (int fd, const void *buf, size_t bufsize, off_t offset) 1950 (int fd, const void *buf, size_t bufsize, off_t offset),
1881 _GL_ARG_NONNULL ((2))); 1951 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1882_GL_CXXALIAS_RPL (pwrite, ssize_t, 1952_GL_CXXALIAS_RPL (pwrite, ssize_t,
1883 (int fd, const void *buf, size_t bufsize, off_t offset)); 1953 (int fd, const void *buf, size_t bufsize, off_t offset));
1884# else 1954# else
1885# if !@HAVE_PWRITE@ 1955# if !@HAVE_PWRITE@
1886_GL_FUNCDECL_SYS (pwrite, ssize_t, 1956_GL_FUNCDECL_SYS (pwrite, ssize_t,
1887 (int fd, const void *buf, size_t bufsize, off_t offset) 1957 (int fd, const void *buf, size_t bufsize, off_t offset),
1888 _GL_ARG_NONNULL ((2))); 1958 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1889# endif 1959# endif
1890_GL_CXXALIAS_SYS (pwrite, ssize_t, 1960_GL_CXXALIAS_SYS (pwrite, ssize_t,
1891 (int fd, const void *buf, size_t bufsize, off_t offset)); 1961 (int fd, const void *buf, size_t bufsize, off_t offset));
@@ -1911,8 +1981,9 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1911# undef read 1981# undef read
1912# define read rpl_read 1982# define read rpl_read
1913# endif 1983# endif
1914_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count) 1984
1915 _GL_ARG_NONNULL ((2))); 1985_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count),
1986 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1916_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count)); 1987_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
1917# elif defined _WIN32 && !defined __CYGWIN__ 1988# elif defined _WIN32 && !defined __CYGWIN__
1918# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1989# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1933,11 +2004,7 @@ _GL_CXXALIASWARN (read);
1933# undef read 2004# undef read
1934# define read _read 2005# define read _read
1935# endif 2006# endif
1936# ifdef __MINGW32__ 2007_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 2008# else
1942_GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count)); 2009_GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count));
1943# endif 2010# endif
@@ -1957,8 +2024,8 @@ _GL_CXXALIASWARN (read);
1957# endif 2024# endif
1958_GL_FUNCDECL_RPL (readlink, ssize_t, 2025_GL_FUNCDECL_RPL (readlink, ssize_t,
1959 (const char *restrict file, 2026 (const char *restrict file,
1960 char *restrict buf, size_t bufsize) 2027 char *restrict buf, size_t bufsize),
1961 _GL_ARG_NONNULL ((1, 2))); 2028 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1962_GL_CXXALIAS_RPL (readlink, ssize_t, 2029_GL_CXXALIAS_RPL (readlink, ssize_t,
1963 (const char *restrict file, 2030 (const char *restrict file,
1964 char *restrict buf, size_t bufsize)); 2031 char *restrict buf, size_t bufsize));
@@ -1966,8 +2033,8 @@ _GL_CXXALIAS_RPL (readlink, ssize_t,
1966# if !@HAVE_READLINK@ 2033# if !@HAVE_READLINK@
1967_GL_FUNCDECL_SYS (readlink, ssize_t, 2034_GL_FUNCDECL_SYS (readlink, ssize_t,
1968 (const char *restrict file, 2035 (const char *restrict file,
1969 char *restrict buf, size_t bufsize) 2036 char *restrict buf, size_t bufsize),
1970 _GL_ARG_NONNULL ((1, 2))); 2037 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1971# endif 2038# endif
1972_GL_CXXALIAS_SYS (readlink, ssize_t, 2039_GL_CXXALIAS_SYS (readlink, ssize_t,
1973 (const char *restrict file, 2040 (const char *restrict file,
@@ -1990,8 +2057,8 @@ _GL_WARN_ON_USE (readlink, "readlink is unportable - "
1990# endif 2057# endif
1991_GL_FUNCDECL_RPL (readlinkat, ssize_t, 2058_GL_FUNCDECL_RPL (readlinkat, ssize_t,
1992 (int fd, char const *restrict file, 2059 (int fd, char const *restrict file,
1993 char *restrict buf, size_t len) 2060 char *restrict buf, size_t len),
1994 _GL_ARG_NONNULL ((2, 3))); 2061 _GL_ARG_NONNULL ((2, 3)) _GL_ATTRIBUTE_NODISCARD);
1995_GL_CXXALIAS_RPL (readlinkat, ssize_t, 2062_GL_CXXALIAS_RPL (readlinkat, ssize_t,
1996 (int fd, char const *restrict file, 2063 (int fd, char const *restrict file,
1997 char *restrict buf, size_t len)); 2064 char *restrict buf, size_t len));
@@ -1999,8 +2066,8 @@ _GL_CXXALIAS_RPL (readlinkat, ssize_t,
1999# if !@HAVE_READLINKAT@ 2066# if !@HAVE_READLINKAT@
2000_GL_FUNCDECL_SYS (readlinkat, ssize_t, 2067_GL_FUNCDECL_SYS (readlinkat, ssize_t,
2001 (int fd, char const *restrict file, 2068 (int fd, char const *restrict file,
2002 char *restrict buf, size_t len) 2069 char *restrict buf, size_t len),
2003 _GL_ARG_NONNULL ((2, 3))); 2070 _GL_ARG_NONNULL ((2, 3)) _GL_ATTRIBUTE_NODISCARD);
2004# endif 2071# endif
2005_GL_CXXALIAS_SYS (readlinkat, ssize_t, 2072_GL_CXXALIAS_SYS (readlinkat, ssize_t,
2006 (int fd, char const *restrict file, 2073 (int fd, char const *restrict file,
@@ -2024,7 +2091,7 @@ _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
2024# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2091# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2025# define rmdir rpl_rmdir 2092# define rmdir rpl_rmdir
2026# endif 2093# endif
2027_GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1))); 2094_GL_FUNCDECL_RPL (rmdir, int, (char const *name), _GL_ARG_NONNULL ((1)));
2028_GL_CXXALIAS_RPL (rmdir, int, (char const *name)); 2095_GL_CXXALIAS_RPL (rmdir, int, (char const *name));
2029# elif defined _WIN32 && !defined __CYGWIN__ 2096# elif defined _WIN32 && !defined __CYGWIN__
2030# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2097# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -2073,18 +2140,22 @@ _GL_CXXALIASWARN (rmdir);
2073# undef sethostname 2140# undef sethostname
2074# define sethostname rpl_sethostname 2141# define sethostname rpl_sethostname
2075# endif 2142# endif
2076_GL_FUNCDECL_RPL (sethostname, int, (const char *name, size_t len) 2143_GL_FUNCDECL_RPL (sethostname, int,
2077 _GL_ARG_NONNULL ((1))); 2144 (const char *name, size_t len),
2078_GL_CXXALIAS_RPL (sethostname, int, (const char *name, size_t len)); 2145 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2146_GL_CXXALIAS_RPL (sethostname, int,
2147 (const char *name, size_t len));
2079# else 2148# else
2080# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@ 2149# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
2081_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len) 2150_GL_FUNCDECL_SYS (sethostname, int,
2082 _GL_ARG_NONNULL ((1))); 2151 (const char *name, size_t len),
2152 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2083# endif 2153# endif
2084/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5 2154/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
2085 and FreeBSD 6.4 the second parameter is int. On Solaris 11 2155 and FreeBSD 6.4 the second parameter is int. On Solaris 11
2086 2011-10, the first parameter is not const. */ 2156 2011-10, the first parameter is not const. */
2087_GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len)); 2157_GL_CXXALIAS_SYS_CAST (sethostname, int,
2158 (const char *name, size_t len));
2088# endif 2159# endif
2089# if __GLIBC__ >= 2 2160# if __GLIBC__ >= 2
2090_GL_CXXALIASWARN (sethostname); 2161_GL_CXXALIASWARN (sethostname);
@@ -2108,11 +2179,11 @@ _GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
2108# undef sleep 2179# undef sleep
2109# define sleep rpl_sleep 2180# define sleep rpl_sleep
2110# endif 2181# endif
2111_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n)); 2182_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n), );
2112_GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n)); 2183_GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
2113# else 2184# else
2114# if !@HAVE_SLEEP@ 2185# if !@HAVE_SLEEP@
2115_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n)); 2186_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n), );
2116# endif 2187# endif
2117_GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n)); 2188_GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
2118# endif 2189# endif
@@ -2157,15 +2228,19 @@ _GL_CXXALIASWARN (swab);
2157# undef symlink 2228# undef symlink
2158# define symlink rpl_symlink 2229# define symlink rpl_symlink
2159# endif 2230# endif
2160_GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file) 2231_GL_FUNCDECL_RPL (symlink, int,
2161 _GL_ARG_NONNULL ((1, 2))); 2232 (char const *contents, char const *file),
2162_GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file)); 2233 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
2234_GL_CXXALIAS_RPL (symlink, int,
2235 (char const *contents, char const *file));
2163# else 2236# else
2164# if !@HAVE_SYMLINK@ 2237# if !@HAVE_SYMLINK@
2165_GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file) 2238_GL_FUNCDECL_SYS (symlink, int,
2166 _GL_ARG_NONNULL ((1, 2))); 2239 (char const *contents, char const *file),
2240 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
2167# endif 2241# endif
2168_GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file)); 2242_GL_CXXALIAS_SYS (symlink, int,
2243 (char const *contents, char const *file));
2169# endif 2244# endif
2170_GL_CXXALIASWARN (symlink); 2245_GL_CXXALIASWARN (symlink);
2171#elif defined GNULIB_POSIXCHECK 2246#elif defined GNULIB_POSIXCHECK
@@ -2184,15 +2259,15 @@ _GL_WARN_ON_USE (symlink, "symlink is not portable - "
2184# define symlinkat rpl_symlinkat 2259# define symlinkat rpl_symlinkat
2185# endif 2260# endif
2186_GL_FUNCDECL_RPL (symlinkat, int, 2261_GL_FUNCDECL_RPL (symlinkat, int,
2187 (char const *contents, int fd, char const *file) 2262 (char const *contents, int fd, char const *file),
2188 _GL_ARG_NONNULL ((1, 3))); 2263 _GL_ARG_NONNULL ((1, 3)) _GL_ATTRIBUTE_NODISCARD);
2189_GL_CXXALIAS_RPL (symlinkat, int, 2264_GL_CXXALIAS_RPL (symlinkat, int,
2190 (char const *contents, int fd, char const *file)); 2265 (char const *contents, int fd, char const *file));
2191# else 2266# else
2192# if !@HAVE_SYMLINKAT@ 2267# if !@HAVE_SYMLINKAT@
2193_GL_FUNCDECL_SYS (symlinkat, int, 2268_GL_FUNCDECL_SYS (symlinkat, int,
2194 (char const *contents, int fd, char const *file) 2269 (char const *contents, int fd, char const *file),
2195 _GL_ARG_NONNULL ((1, 3))); 2270 _GL_ARG_NONNULL ((1, 3)) _GL_ATTRIBUTE_NODISCARD);
2196# endif 2271# endif
2197_GL_CXXALIAS_SYS (symlinkat, int, 2272_GL_CXXALIAS_SYS (symlinkat, int,
2198 (char const *contents, int fd, char const *file)); 2273 (char const *contents, int fd, char const *file));
@@ -2219,13 +2294,13 @@ _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
2219# undef truncate 2294# undef truncate
2220# define truncate rpl_truncate 2295# define truncate rpl_truncate
2221# endif 2296# endif
2222_GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length) 2297_GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length),
2223 _GL_ARG_NONNULL ((1))); 2298 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2224_GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length)); 2299_GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length));
2225# else 2300# else
2226# if !@HAVE_DECL_TRUNCATE@ 2301# if !@HAVE_DECL_TRUNCATE@
2227_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length) 2302_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length),
2228 _GL_ARG_NONNULL ((1))); 2303 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2229# endif 2304# endif
2230_GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length)); 2305_GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length));
2231# endif 2306# endif
@@ -2250,13 +2325,15 @@ _GL_WARN_ON_USE (truncate, "truncate is unportable - "
2250# define ttyname_r rpl_ttyname_r 2325# define ttyname_r rpl_ttyname_r
2251# endif 2326# endif
2252_GL_FUNCDECL_RPL (ttyname_r, int, 2327_GL_FUNCDECL_RPL (ttyname_r, int,
2253 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); 2328 (int fd, char *buf, size_t buflen),
2329 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
2254_GL_CXXALIAS_RPL (ttyname_r, int, 2330_GL_CXXALIAS_RPL (ttyname_r, int,
2255 (int fd, char *buf, size_t buflen)); 2331 (int fd, char *buf, size_t buflen));
2256# else 2332# else
2257# if !@HAVE_DECL_TTYNAME_R@ 2333# if !@HAVE_DECL_TTYNAME_R@
2258_GL_FUNCDECL_SYS (ttyname_r, int, 2334_GL_FUNCDECL_SYS (ttyname_r, int,
2259 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); 2335 (int fd, char *buf, size_t buflen),
2336 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
2260# endif 2337# endif
2261_GL_CXXALIAS_SYS (ttyname_r, int, 2338_GL_CXXALIAS_SYS (ttyname_r, int,
2262 (int fd, char *buf, size_t buflen)); 2339 (int fd, char *buf, size_t buflen));
@@ -2279,7 +2356,7 @@ _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
2279# undef unlink 2356# undef unlink
2280# define unlink rpl_unlink 2357# define unlink rpl_unlink
2281# endif 2358# endif
2282_GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1))); 2359_GL_FUNCDECL_RPL (unlink, int, (char const *file), _GL_ARG_NONNULL ((1)));
2283_GL_CXXALIAS_RPL (unlink, int, (char const *file)); 2360_GL_CXXALIAS_RPL (unlink, int, (char const *file));
2284# elif defined _WIN32 && !defined __CYGWIN__ 2361# elif defined _WIN32 && !defined __CYGWIN__
2285# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2362# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -2320,12 +2397,12 @@ _GL_CXXALIASWARN (unlink);
2320# undef unlinkat 2397# undef unlinkat
2321# define unlinkat rpl_unlinkat 2398# define unlinkat rpl_unlinkat
2322# endif 2399# endif
2323_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag) 2400_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag),
2324 _GL_ARG_NONNULL ((2))); 2401 _GL_ARG_NONNULL ((2)));
2325_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag)); 2402_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
2326# else 2403# else
2327# if !@HAVE_UNLINKAT@ 2404# if !@HAVE_UNLINKAT@
2328_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag) 2405_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag),
2329 _GL_ARG_NONNULL ((2))); 2406 _GL_ARG_NONNULL ((2)));
2330# endif 2407# endif
2331_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag)); 2408_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
@@ -2343,18 +2420,18 @@ _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
2343#if @GNULIB_USLEEP@ 2420#if @GNULIB_USLEEP@
2344/* Pause the execution of the current thread for N microseconds. 2421/* Pause the execution of the current thread for N microseconds.
2345 Returns 0 on completion, or -1 on range error. 2422 Returns 0 on completion, or -1 on range error.
2346 See the POSIX:2001 specification 2423 See the POSIX.1-2004 specification
2347 <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */ 2424 <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */
2348# if @REPLACE_USLEEP@ 2425# if @REPLACE_USLEEP@
2349# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2426# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2350# undef usleep 2427# undef usleep
2351# define usleep rpl_usleep 2428# define usleep rpl_usleep
2352# endif 2429# endif
2353_GL_FUNCDECL_RPL (usleep, int, (useconds_t n)); 2430_GL_FUNCDECL_RPL (usleep, int, (useconds_t n), );
2354_GL_CXXALIAS_RPL (usleep, int, (useconds_t n)); 2431_GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
2355# else 2432# else
2356# if !@HAVE_USLEEP@ 2433# if !@HAVE_USLEEP@
2357_GL_FUNCDECL_SYS (usleep, int, (useconds_t n)); 2434_GL_FUNCDECL_SYS (usleep, int, (useconds_t n), );
2358# endif 2435# endif
2359/* Need to cast, because on Haiku, the first parameter is 2436/* Need to cast, because on Haiku, the first parameter is
2360 unsigned int n. */ 2437 unsigned int n. */
@@ -2379,17 +2456,21 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - "
2379# undef write 2456# undef write
2380# define write rpl_write 2457# define write rpl_write
2381# endif 2458# endif
2382_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count) 2459_GL_FUNCDECL_RPL (write, ssize_t,
2383 _GL_ARG_NONNULL ((2))); 2460 (int fd, const void *buf, size_t count),
2384_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count)); 2461 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
2462_GL_CXXALIAS_RPL (write, ssize_t,
2463 (int fd, const void *buf, size_t count));
2385# elif defined _WIN32 && !defined __CYGWIN__ 2464# elif defined _WIN32 && !defined __CYGWIN__
2386# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2465# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2387# undef write 2466# undef write
2388# define write _write 2467# define write _write
2389# endif 2468# endif
2390_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count)); 2469_GL_CXXALIAS_MDA (write, ssize_t,
2470 (int fd, const void *buf, size_t count));
2391# else 2471# else
2392_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count)); 2472_GL_CXXALIAS_SYS (write, ssize_t,
2473 (int fd, const void *buf, size_t count));
2393# endif 2474# endif
2394_GL_CXXALIASWARN (write); 2475_GL_CXXALIASWARN (write);
2395#elif @GNULIB_MDA_WRITE@ 2476#elif @GNULIB_MDA_WRITE@
@@ -2401,13 +2482,11 @@ _GL_CXXALIASWARN (write);
2401# undef write 2482# undef write
2402# define write _write 2483# define write _write
2403# endif 2484# endif
2404# ifdef __MINGW32__ 2485_GL_CXXALIAS_MDA_CAST (write, ssize_t,
2405_GL_CXXALIAS_MDA (write, int, (int fd, const void *buf, unsigned int count)); 2486 (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 2487# else
2410_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count)); 2488_GL_CXXALIAS_SYS (write, ssize_t,
2489 (int fd, const void *buf, size_t count));
2411# endif 2490# endif
2412_GL_CXXALIASWARN (write); 2491_GL_CXXALIASWARN (write);
2413#endif 2492#endif
diff --git a/gl/unitypes.h b/gl/unitypes.h
new file mode 100644
index 00000000..83a91750
--- /dev/null
+++ b/gl/unitypes.h
@@ -0,0 +1,72 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* Elementary types and macros for the GNU UniString library.
3 Copyright (C) 2002, 2005-2006, 2009-2025 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#ifndef _UNITYPES_H
19#define _UNITYPES_H
20
21/* Get uint8_t, uint16_t, uint32_t. */
22#include <stdint.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28
29/* Type representing a Unicode character. */
30typedef uint32_t ucs4_t;
31
32/* Attribute of a function whose result depends only on the arguments
33 (not pointers!) and which has no side effects. */
34#ifndef _UC_ATTRIBUTE_CONST
35# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) || defined __clang__
36# define _UC_ATTRIBUTE_CONST __attribute__ ((__const__))
37# else
38# define _UC_ATTRIBUTE_CONST
39# endif
40#endif
41
42/* Attribute of a function whose result depends only on the arguments
43 (possibly pointers) and global memory, and which has no side effects. */
44#ifndef _UC_ATTRIBUTE_PURE
45# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
46# define _UC_ATTRIBUTE_PURE __attribute__ ((__pure__))
47# else
48# define _UC_ATTRIBUTE_PURE
49# endif
50#endif
51
52/* Qualifier in a function declaration, that asserts that the caller must
53 pass a pointer to a different object in the specified pointer argument
54 than in the other pointer arguments. */
55#ifndef _UC_RESTRICT
56# if defined __restrict \
57 || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \
58 || __clang_major__ >= 3
59# define _UC_RESTRICT __restrict
60# elif 199901L <= __STDC_VERSION__ || defined restrict
61# define _UC_RESTRICT restrict
62# else
63# define _UC_RESTRICT
64# endif
65#endif
66
67
68#ifdef __cplusplus
69}
70#endif
71
72#endif /* _UNITYPES_H */
diff --git a/gl/unitypes.in.h b/gl/unitypes.in.h
new file mode 100644
index 00000000..776d90e9
--- /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-2025 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.h b/gl/uniwidth.h
new file mode 100644
index 00000000..b88df2bf
--- /dev/null
+++ b/gl/uniwidth.h
@@ -0,0 +1,73 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* Display width functions.
3 Copyright (C) 2001-2002, 2005, 2007, 2009-2025 Free Software Foundation,
4 Inc.
5
6 This file is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation; either version 2.1 of the
9 License, or (at your option) any later version.
10
11 This file is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with this program. If not, see <https://www.gnu.org/licenses/>. */
18
19#ifndef _UNIWIDTH_H
20#define _UNIWIDTH_H
21
22#include "unitypes.h"
23
24/* Get size_t. */
25#include <stddef.h>
26
27/* Get locale_charset() declaration. */
28#include "localcharset.h"
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34
35/* Display width. */
36
37/* These functions are locale dependent. The encoding argument identifies
38 the encoding (e.g. "ISO-8859-2" for Polish). */
39
40/* Determine number of column positions required for UC. */
41extern int
42 uc_width (ucs4_t uc, const char *encoding)
43 _UC_ATTRIBUTE_PURE;
44
45/* Determine number of column positions required for first N units
46 (or fewer if S ends before this) in S. */
47extern int
48 u8_width (const uint8_t *s, size_t n, const char *encoding)
49 _UC_ATTRIBUTE_PURE;
50extern int
51 u16_width (const uint16_t *s, size_t n, const char *encoding)
52 _UC_ATTRIBUTE_PURE;
53extern int
54 u32_width (const uint32_t *s, size_t n, const char *encoding)
55 _UC_ATTRIBUTE_PURE;
56
57/* Determine number of column positions required for S. */
58extern int
59 u8_strwidth (const uint8_t *s, const char *encoding)
60 _UC_ATTRIBUTE_PURE;
61extern int
62 u16_strwidth (const uint16_t *s, const char *encoding)
63 _UC_ATTRIBUTE_PURE;
64extern int
65 u32_strwidth (const uint32_t *s, const char *encoding)
66 _UC_ATTRIBUTE_PURE;
67
68
69#ifdef __cplusplus
70}
71#endif
72
73#endif /* _UNIWIDTH_H */
diff --git a/gl/uniwidth.in.h b/gl/uniwidth.in.h
new file mode 100644
index 00000000..49c7ce05
--- /dev/null
+++ b/gl/uniwidth.in.h
@@ -0,0 +1,72 @@
1/* Display width functions.
2 Copyright (C) 2001-2002, 2005, 2007, 2009-2025 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/.deps/.dirstamp b/gl/uniwidth/.deps/.dirstamp
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/gl/uniwidth/.deps/.dirstamp
diff --git a/gl/uniwidth/.deps/libgnu_a-width.Po b/gl/uniwidth/.deps/libgnu_a-width.Po
new file mode 100644
index 00000000..f3f0e3fd
--- /dev/null
+++ b/gl/uniwidth/.deps/libgnu_a-width.Po
@@ -0,0 +1,60 @@
1uniwidth/libgnu_a-width.o: uniwidth/width.c /usr/include/stdc-predef.h \
2 ../config.h uniwidth.h unitypes.h \
3 /usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h /usr/include/stdint.h \
4 /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
5 /usr/include/features.h /usr/include/features-time64.h \
6 /usr/include/x86_64-linux-gnu/bits/wordsize.h \
7 /usr/include/x86_64-linux-gnu/bits/timesize.h \
8 /usr/include/x86_64-linux-gnu/sys/cdefs.h \
9 /usr/include/x86_64-linux-gnu/bits/long-double.h \
10 /usr/include/x86_64-linux-gnu/gnu/stubs.h \
11 /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
12 /usr/include/x86_64-linux-gnu/bits/types.h \
13 /usr/include/x86_64-linux-gnu/bits/typesizes.h \
14 /usr/include/x86_64-linux-gnu/bits/time64.h \
15 /usr/include/x86_64-linux-gnu/bits/wchar.h \
16 /usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
17 /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
18 /usr/include/x86_64-linux-gnu/bits/stdint-least.h stddef.h \
19 /usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h localcharset.h \
20 uniwidth/cjk.h streq.h string.h /usr/include/string.h \
21 /usr/include/x86_64-linux-gnu/bits/types/locale_t.h \
22 /usr/include/x86_64-linux-gnu/bits/types/__locale_t.h strings.h \
23 /usr/include/strings.h uniwidth/width0.h uniwidth/width2.h \
24 unictype/bitmap.h
25/usr/include/stdc-predef.h:
26../config.h:
27uniwidth.h:
28unitypes.h:
29/usr/lib/gcc/x86_64-linux-gnu/15/include/stdint.h:
30/usr/include/stdint.h:
31/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:
32/usr/include/features.h:
33/usr/include/features-time64.h:
34/usr/include/x86_64-linux-gnu/bits/wordsize.h:
35/usr/include/x86_64-linux-gnu/bits/timesize.h:
36/usr/include/x86_64-linux-gnu/sys/cdefs.h:
37/usr/include/x86_64-linux-gnu/bits/long-double.h:
38/usr/include/x86_64-linux-gnu/gnu/stubs.h:
39/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
40/usr/include/x86_64-linux-gnu/bits/types.h:
41/usr/include/x86_64-linux-gnu/bits/typesizes.h:
42/usr/include/x86_64-linux-gnu/bits/time64.h:
43/usr/include/x86_64-linux-gnu/bits/wchar.h:
44/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:
45/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h:
46/usr/include/x86_64-linux-gnu/bits/stdint-least.h:
47stddef.h:
48/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:
49localcharset.h:
50uniwidth/cjk.h:
51streq.h:
52string.h:
53/usr/include/string.h:
54/usr/include/x86_64-linux-gnu/bits/types/locale_t.h:
55/usr/include/x86_64-linux-gnu/bits/types/__locale_t.h:
56strings.h:
57/usr/include/strings.h:
58uniwidth/width0.h:
59uniwidth/width2.h:
60unictype/bitmap.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..af41f637
--- /dev/null
+++ b/gl/uniwidth/cjk.h
@@ -0,0 +1,37 @@
1/* Test for CJK encoding.
2 Copyright (C) 2001-2002, 2005-2007, 2009-2025 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..c99a74cb
--- /dev/null
+++ b/gl/uniwidth/width.c
@@ -0,0 +1,95 @@
1/* Determine display width of Unicode character.
2 Copyright (C) 2001-2002, 2006-2025 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/bugzilla/show_bug.cgi?id=21750>
46 <https://sourceware.org/bugzilla/show_bug.cgi?id=26120>
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..2edbe240
--- /dev/null
+++ b/gl/uniwidth/width0.h
@@ -0,0 +1,495 @@
1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2/* Table of non-spacing or control characters. */
3/* Generated automatically by gen-uni-tables.c for Unicode 16.0.0. */
4
5/* Copyright (C) 2000-2024 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[49*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, 0x7f, 0x00, 0x00, 0x00, 0x00, 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, 0xf0, /* 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, 0x00, 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 /* 0x1e800-0x1e9ff */
454 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e800-0x1e83f */
455 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e840-0x1e87f */
456 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e880-0x1e8bf */
457 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e8c0-0x1e8ff */
458 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e900-0x1e93f */
459 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e940-0x1e97f */
460 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1e980-0x1e9bf */
461 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0x1e9c0-0x1e9ff */
462};
463static const signed char nonspacing_table_ind[248] = {
464 0, 1, 2, 3, 4, 5, 6, 7, /* 0x0000-0x0fff */
465 8, 9, -1, 10, 11, 12, 13, -1, /* 0x1000-0x1fff */
466 14, -1, -1, -1, -1, -1, 15, -1, /* 0x2000-0x2fff */
467 16, -1, -1, -1, -1, -1, -1, -1, /* 0x3000-0x3fff */
468 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x4000-0x4fff */
469 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x5000-0x5fff */
470 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x6000-0x6fff */
471 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x7000-0x7fff */
472 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x8000-0x8fff */
473 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x9000-0x9fff */
474 -1, -1, -1, 17, 18, 19, -1, -1, /* 0xa000-0xafff */
475 -1, -1, -1, -1, -1, -1, -1, -1, /* 0xb000-0xbfff */
476 -1, -1, -1, -1, -1, -1, -1, -1, /* 0xc000-0xcfff */
477 -1, -1, -1, 20, -1, -1, -1, -1, /* 0xd000-0xdfff */
478 -1, -1, -1, -1, -1, -1, -1, -1, /* 0xe000-0xefff */
479 -1, -1, -1, -1, -1, 21, -1, 22, /* 0xf000-0xffff */
480 23, 24, -1, -1, -1, 25, 26, 27, /* 0x10000-0x10fff */
481 28, 29, 30, 31, 32, 33, 34, 35, /* 0x11000-0x11fff */
482 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x12000-0x12fff */
483 -1, -1, 36, -1, -1, -1, -1, -1, /* 0x13000-0x13fff */
484 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x14000-0x14fff */
485 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x15000-0x15fff */
486 37, -1, -1, -1, -1, 38, -1, 39, /* 0x16000-0x16fff */
487 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x17000-0x17fff */
488 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x18000-0x18fff */
489 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x19000-0x19fff */
490 -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1a000-0x1afff */
491 -1, -1, -1, -1, -1, -1, 40, -1, /* 0x1b000-0x1bfff */
492 -1, -1, -1, -1, -1, -1, -1, 41, /* 0x1c000-0x1cfff */
493 42, 43, -1, -1, -1, 44, -1, -1, /* 0x1d000-0x1dfff */
494 45, 46, 47, -1, 48, -1, -1, -1 /* 0x1e000-0x1efff */
495};
diff --git a/gl/uniwidth/width2.h b/gl/uniwidth/width2.h
new file mode 100644
index 00000000..f919989b
--- /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 16.0.0. */
4
5/* Copyright (C) 2000-2024 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..69ea6641 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-2025 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/unsetenv.c b/gl/unsetenv.c
index d8ada2aa..d38ed37a 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-2025 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
@@ -57,7 +57,6 @@ int
57unsetenv (const char *name) 57unsetenv (const char *name)
58{ 58{
59 size_t len; 59 size_t len;
60 char **ep;
61 60
62 if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) 61 if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
63 { 62 {
@@ -67,9 +66,37 @@ unsetenv (const char *name)
67 66
68 len = strlen (name); 67 len = strlen (name);
69 68
69#if HAVE_DECL__PUTENV /* native Windows */
70 /* The Microsoft documentation
71 <https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/putenv-wputenv>
72 says:
73 "Don't change an environment entry directly: instead,
74 use _putenv or _wputenv to change it."
75 Note: Microsoft's _putenv updates not only the contents of _environ but
76 also the contents of _wenviron, so that both are in kept in sync.
77
78 The way to remove an environment variable is to pass to _putenv a string
79 of the form "NAME=". (NB: This is a different convention than with glibc
80 putenv, which expects a string of the form "NAME"!) */
81 {
82 int putenv_result;
83 char *name_ = malloc (len + 2);
84 if (name_ == NULL)
85 return -1;
86 memcpy (name_, name, len);
87 name_[len] = '=';
88 name_[len + 1] = 0;
89 putenv_result = _putenv (name_);
90 /* In this particular case it is OK to free() the argument passed to
91 _putenv. */
92 free (name_);
93 return putenv_result;
94 }
95#else
96
70 LOCK; 97 LOCK;
71 98
72 ep = __environ; 99 char **ep = __environ;
73 while (*ep != NULL) 100 while (*ep != NULL)
74 if (!strncmp (*ep, name, len) && (*ep)[len] == '=') 101 if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
75 { 102 {
@@ -87,6 +114,7 @@ unsetenv (const char *name)
87 UNLOCK; 114 UNLOCK;
88 115
89 return 0; 116 return 0;
117#endif
90} 118}
91 119
92#ifdef _LIBC 120#ifdef _LIBC
diff --git a/gl/vasnprintf.c b/gl/vasnprintf.c
index de204458..f46e8701 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-2025 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
@@ -182,6 +184,20 @@
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 (strcmp (&stackbuf[1], "\302") == 0)
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 (strcmp (&tmp[1], "\302") == 0)
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,7 +732,7 @@ 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 {
@@ -469,7 +744,7 @@ multiply (mpn_t src1, mpn_t src2, mpn_t *dest)
469 dlen = len1 + len2; 744 dlen = len1 + len2;
470 dp = (mp_limb_t *) malloc (dlen * sizeof (mp_limb_t)); 745 dp = (mp_limb_t *) malloc (dlen * sizeof (mp_limb_t));
471 if (dp == NULL) 746 if (dp == NULL)
472 return NULL; 747 return NOMEM_PTR;
473 for (k = len2; k > 0; ) 748 for (k = len2; k > 0; )
474 dp[--k] = 0; 749 dp[--k] = 0;
475 for (i = 0; i < len1; i++) 750 for (i = 0; i < len1; i++)
@@ -500,8 +775,8 @@ multiply (mpn_t src1, mpn_t src2, mpn_t *dest)
500 the remainder. 775 the remainder.
501 Finally, round-to-even is performed: If r > b/2 or if r = b/2 and q is odd, 776 Finally, round-to-even is performed: If r > b/2 or if r = b/2 and q is odd,
502 q is incremented. 777 q is incremented.
503 Return the allocated memory in case of success, NULL in case of memory 778 Return the allocated memory (possibly NULL) in case of success, NOMEM_PTR
504 allocation failure. */ 779 in case of memory allocation failure. */
505static void * 780static void *
506divide (mpn_t a, mpn_t b, mpn_t *q) 781divide (mpn_t a, mpn_t b, mpn_t *q)
507{ 782{
@@ -572,7 +847,7 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
572 final rounding of q.) */ 847 final rounding of q.) */
573 roomptr = (mp_limb_t *) malloc ((a_len + 2) * sizeof (mp_limb_t)); 848 roomptr = (mp_limb_t *) malloc ((a_len + 2) * sizeof (mp_limb_t));
574 if (roomptr == NULL) 849 if (roomptr == NULL)
575 return NULL; 850 return NOMEM_PTR;
576 851
577 /* Normalise a. */ 852 /* Normalise a. */
578 while (a_len > 0 && a_ptr[a_len - 1] == 0) 853 while (a_len > 0 && a_ptr[a_len - 1] == 0)
@@ -708,7 +983,7 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
708 if (tmp_roomptr == NULL) 983 if (tmp_roomptr == NULL)
709 { 984 {
710 free (roomptr); 985 free (roomptr);
711 return NULL; 986 return NOMEM_PTR;
712 } 987 }
713 { 988 {
714 const mp_limb_t *sourceptr = b_ptr; 989 const mp_limb_t *sourceptr = b_ptr;
@@ -930,7 +1205,7 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
930/* Avoid pointless GCC warning "argument 1 value '18446744073709551615' exceeds 1205/* Avoid pointless GCC warning "argument 1 value '18446744073709551615' exceeds
931 maximum object size 9223372036854775807", triggered by the use of xsum as 1206 maximum object size 9223372036854775807", triggered by the use of xsum as
932 argument of malloc. */ 1207 argument of malloc. */
933# if __GNUC__ >= 7 1208# if _GL_GNUC_PREREQ (7, 0)
934# pragma GCC diagnostic push 1209# pragma GCC diagnostic push
935# pragma GCC diagnostic ignored "-Walloc-size-larger-than=" 1210# pragma GCC diagnostic ignored "-Walloc-size-larger-than="
936# endif 1211# endif
@@ -991,7 +1266,7 @@ convert_to_decimal (mpn_t a, size_t extra_zeroes)
991 return c_ptr; 1266 return c_ptr;
992} 1267}
993 1268
994# if __GNUC__ >= 7 1269# if _GL_GNUC_PREREQ (7, 0)
995# pragma GCC diagnostic pop 1270# pragma GCC diagnostic pop
996# endif 1271# endif
997 1272
@@ -1015,7 +1290,7 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
1015 if (m.limbs == NULL) 1290 if (m.limbs == NULL)
1016 return NULL; 1291 return NULL;
1017 /* Split into exponential part and mantissa. */ 1292 /* Split into exponential part and mantissa. */
1018 y = frexpl (x, &exp); 1293 y = safe_frexpl (x, &exp);
1019 if (!(y >= 0.0L && y < 1.0L)) 1294 if (!(y >= 0.0L && y < 1.0L))
1020 abort (); 1295 abort ();
1021 /* x = 2^exp * y = 2^(exp - LDBL_MANT_BIT) * (y * 2^LDBL_MANT_BIT), and the 1296 /* x = 2^exp * y = 2^(exp - LDBL_MANT_BIT) * (y * 2^LDBL_MANT_BIT), and the
@@ -1306,7 +1581,7 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
1306 mpn_t denominator; 1581 mpn_t denominator;
1307 void *tmp_memory; 1582 void *tmp_memory;
1308 tmp_memory = multiply (m, pow5, &numerator); 1583 tmp_memory = multiply (m, pow5, &numerator);
1309 if (tmp_memory == NULL) 1584 if (tmp_memory == NOMEM_PTR)
1310 { 1585 {
1311 free (pow5_ptr); 1586 free (pow5_ptr);
1312 free (memory); 1587 free (memory);
@@ -1379,7 +1654,7 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
1379 1654
1380 /* Here y = round (x * 10^n) = z * 10^extra_zeroes. */ 1655 /* Here y = round (x * 10^n) = z * 10^extra_zeroes. */
1381 1656
1382 if (z_memory == NULL) 1657 if (z_memory == NOMEM_PTR)
1383 return NULL; 1658 return NULL;
1384 digits = convert_to_decimal (z, extra_zeroes); 1659 digits = convert_to_decimal (z, extra_zeroes);
1385 free (z_memory); 1660 free (z_memory);
@@ -1442,7 +1717,7 @@ floorlog10l (long double x)
1442 double l; 1717 double l;
1443 1718
1444 /* Split into exponential part and mantissa. */ 1719 /* Split into exponential part and mantissa. */
1445 y = frexpl (x, &exp); 1720 y = safe_frexpl (x, &exp);
1446 if (!(y >= 0.0L && y < 1.0L)) 1721 if (!(y >= 0.0L && y < 1.0L))
1447 abort (); 1722 abort ();
1448 if (y == 0.0L) 1723 if (y == 0.0L)
@@ -1801,8 +2076,17 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion,
1801 } 2076 }
1802 if (tmp_length < precision) 2077 if (tmp_length < precision)
1803 tmp_length = precision; 2078 tmp_length = precision;
1804 /* Multiply by 2, as an estimate for FLAG_GROUP. */ 2079 /* Account for thousands separators. */
1805 tmp_length = xsum (tmp_length, tmp_length); 2080 if (flags & FLAG_GROUP)
2081 {
2082 /* A thousands separator needs to be inserted at most every 2 digits.
2083 This is the case in the ta_IN locale. */
2084# if WIDE_CHAR_VERSION
2085 tmp_length = xsum (tmp_length, tmp_length / 2 * THOUSEP_WCHAR_MAXLEN);
2086# else
2087 tmp_length = xsum (tmp_length, tmp_length / 2 * THOUSEP_CHAR_MAXLEN);
2088# endif
2089 }
1806 /* Add 1, to account for a leading sign. */ 2090 /* Add 1, to account for a leading sign. */
1807 tmp_length = xsum (tmp_length, 1); 2091 tmp_length = xsum (tmp_length, 1);
1808 break; 2092 break;
@@ -2050,12 +2334,18 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion,
2050 tmp_length = xsum (tmp_length, 2); 2334 tmp_length = xsum (tmp_length, 2);
2051 break; 2335 break;
2052 2336
2337 case 'e': case 'E':
2338 tmp_length =
2339 12; /* sign, decimal point, exponent etc. */
2340 tmp_length = xsum (tmp_length, precision);
2341 break;
2342
2053 case 'f': case 'F': 2343 case 'f': case 'F':
2054 if (type == TYPE_LONGDOUBLE) 2344 if (type == TYPE_LONGDOUBLE)
2055 tmp_length = 2345 tmp_length =
2056 (unsigned int) (LDBL_MAX_EXP 2346 (unsigned int) (LDBL_MAX_EXP
2057 * 0.30103 /* binary -> decimal */ 2347 * 0.30103 /* binary -> decimal */
2058 * 2 /* estimate for FLAG_GROUP */ 2348 * 0.5 * 3 /* estimate for FLAG_GROUP */
2059 ) 2349 )
2060 + 1 /* turn floor into ceil */ 2350 + 1 /* turn floor into ceil */
2061 + 10; /* sign, decimal point etc. */ 2351 + 10; /* sign, decimal point etc. */
@@ -2063,17 +2353,20 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion,
2063 tmp_length = 2353 tmp_length =
2064 (unsigned int) (DBL_MAX_EXP 2354 (unsigned int) (DBL_MAX_EXP
2065 * 0.30103 /* binary -> decimal */ 2355 * 0.30103 /* binary -> decimal */
2066 * 2 /* estimate for FLAG_GROUP */ 2356 * 0.5 * 3 /* estimate for FLAG_GROUP */
2067 ) 2357 )
2068 + 1 /* turn floor into ceil */ 2358 + 1 /* turn floor into ceil */
2069 + 10; /* sign, decimal point etc. */ 2359 + 10; /* sign, decimal point etc. */
2070 tmp_length = xsum (tmp_length, precision); 2360 tmp_length = xsum (tmp_length, precision);
2071 break; 2361 break;
2072 2362
2073 case 'e': case 'E': case 'g': case 'G': 2363 case 'g': case 'G':
2074 tmp_length = 2364 tmp_length =
2075 12; /* sign, decimal point, exponent etc. */ 2365 12; /* sign, decimal point, exponent etc. */
2076 tmp_length = xsum (tmp_length, precision); 2366 tmp_length = xsum (tmp_length,
2367 precision
2368 * 0.5 * 3 /* estimate for FLAG_GROUP */
2369 );
2077 break; 2370 break;
2078 2371
2079 case 'a': case 'A': 2372 case 'a': case 'A':
@@ -2111,10 +2404,9 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion,
2111 break; 2404 break;
2112 2405
2113 case 's': 2406 case 's':
2114# if HAVE_WCHAR_T
2115 if (type == TYPE_WIDE_STRING) 2407 if (type == TYPE_WIDE_STRING)
2116 { 2408 {
2117# if WIDE_CHAR_VERSION 2409# if WIDE_CHAR_VERSION
2118 /* ISO C says about %ls in fwprintf: 2410 /* ISO C says about %ls in fwprintf:
2119 "If the precision is not specified or is greater than the size 2411 "If the precision is not specified or is greater than the size
2120 of the array, the array shall contain a null wide character." 2412 of the array, the array shall contain a null wide character."
@@ -2125,7 +2417,7 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion,
2125 tmp_length = local_wcsnlen (arg, precision); 2417 tmp_length = local_wcsnlen (arg, precision);
2126 else 2418 else
2127 tmp_length = local_wcslen (arg); 2419 tmp_length = local_wcslen (arg);
2128# else 2420# else
2129 /* ISO C says about %ls in fprintf: 2421 /* ISO C says about %ls in fprintf:
2130 "If a precision is specified, no more than that many bytes are 2422 "If a precision is specified, no more than that many bytes are
2131 written (including shift sequences, if any), and the array 2423 written (including shift sequences, if any), and the array
@@ -2136,10 +2428,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. */ 2428 So if there is a precision, we must not use wcslen. */
2137 /* This case has already been handled separately in VASNPRINTF. */ 2429 /* This case has already been handled separately in VASNPRINTF. */
2138 abort (); 2430 abort ();
2139# endif 2431# endif
2140 } 2432 }
2141 else 2433 else
2142# endif
2143 { 2434 {
2144# if WIDE_CHAR_VERSION 2435# if WIDE_CHAR_VERSION
2145 /* ISO C says about %s in fwprintf: 2436 /* ISO C says about %s in fwprintf:
@@ -2226,7 +2517,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2226 TCHAR_T *buf; 2517 TCHAR_T *buf;
2227 TCHAR_T *buf_malloced; 2518 TCHAR_T *buf_malloced;
2228 const FCHAR_T *cp; 2519 const FCHAR_T *cp;
2229 size_t i; 2520 size_t di;
2230 DIRECTIVE *dp; 2521 DIRECTIVE *dp;
2231 /* Output string accumulator. */ 2522 /* Output string accumulator. */
2232 DCHAR_T *result; 2523 DCHAR_T *result;
@@ -2290,7 +2581,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2290#define ENSURE_ALLOCATION(needed) \ 2581#define ENSURE_ALLOCATION(needed) \
2291 ENSURE_ALLOCATION_ELSE((needed), goto out_of_memory; ) 2582 ENSURE_ALLOCATION_ELSE((needed), goto out_of_memory; )
2292 2583
2293 for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++) 2584 for (cp = format, di = 0, dp = &d.dir[0]; ; cp = dp->dir_end, di++, dp++)
2294 { 2585 {
2295 if (cp != dp->dir_start) 2586 if (cp != dp->dir_start)
2296 { 2587 {
@@ -2313,7 +2604,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2313 while (--n > 0); 2604 while (--n > 0);
2314 } 2605 }
2315 } 2606 }
2316 if (i == d.count) 2607 if (di == d.count)
2317 break; 2608 break;
2318 2609
2319 /* Execute a single directive. */ 2610 /* Execute a single directive. */
@@ -2423,6 +2714,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2423 width = xsum (xtimes (width, 10), *digitp++ - '0'); 2714 width = xsum (xtimes (width, 10), *digitp++ - '0');
2424 while (digitp != dp->width_end); 2715 while (digitp != dp->width_end);
2425 } 2716 }
2717 if (width > (size_t) INT_MAX)
2718 goto overflow;
2426 has_width = 1; 2719 has_width = 1;
2427 } 2720 }
2428 2721
@@ -2501,7 +2794,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2501 { 2794 {
2502 /* Use the entire string. */ 2795 /* Use the entire string. */
2503 arg_end = arg + u8_strlen (arg); 2796 arg_end = arg + u8_strlen (arg);
2504 /* The number of characters doesn't matter. */ 2797 /* The number of characters doesn't matter,
2798 because !has_width and therefore width==0. */
2505 characters = 0; 2799 characters = 0;
2506 } 2800 }
2507 2801
@@ -2542,7 +2836,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2542 if (converted != result + length) 2836 if (converted != result + length)
2543 { 2837 {
2544 ENSURE_ALLOCATION_ELSE (xsum (length, converted_len), 2838 ENSURE_ALLOCATION_ELSE (xsum (length, converted_len),
2545 { free (converted); goto out_of_memory; }); 2839 { free (converted); goto out_of_memory; });
2546 DCHAR_CPY (result + length, converted, converted_len); 2840 DCHAR_CPY (result + length, converted, converted_len);
2547 free (converted); 2841 free (converted);
2548 } 2842 }
@@ -2603,7 +2897,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2603 { 2897 {
2604 /* Use the entire string. */ 2898 /* Use the entire string. */
2605 arg_end = arg + u16_strlen (arg); 2899 arg_end = arg + u16_strlen (arg);
2606 /* The number of characters doesn't matter. */ 2900 /* The number of characters doesn't matter,
2901 because !has_width and therefore width==0. */
2607 characters = 0; 2902 characters = 0;
2608 } 2903 }
2609 2904
@@ -2644,7 +2939,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2644 if (converted != result + length) 2939 if (converted != result + length)
2645 { 2940 {
2646 ENSURE_ALLOCATION_ELSE (xsum (length, converted_len), 2941 ENSURE_ALLOCATION_ELSE (xsum (length, converted_len),
2647 { free (converted); goto out_of_memory; }); 2942 { free (converted); goto out_of_memory; });
2648 DCHAR_CPY (result + length, converted, converted_len); 2943 DCHAR_CPY (result + length, converted, converted_len);
2649 free (converted); 2944 free (converted);
2650 } 2945 }
@@ -2705,7 +3000,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2705 { 3000 {
2706 /* Use the entire string. */ 3001 /* Use the entire string. */
2707 arg_end = arg + u32_strlen (arg); 3002 arg_end = arg + u32_strlen (arg);
2708 /* The number of characters doesn't matter. */ 3003 /* The number of characters doesn't matter,
3004 because !has_width and therefore width==0. */
2709 characters = 0; 3005 characters = 0;
2710 } 3006 }
2711 3007
@@ -2746,7 +3042,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2746 if (converted != result + length) 3042 if (converted != result + length)
2747 { 3043 {
2748 ENSURE_ALLOCATION_ELSE (xsum (length, converted_len), 3044 ENSURE_ALLOCATION_ELSE (xsum (length, converted_len),
2749 { free (converted); goto out_of_memory; }); 3045 { free (converted); goto out_of_memory; });
2750 DCHAR_CPY (result + length, converted, converted_len); 3046 DCHAR_CPY (result + length, converted, converted_len);
2751 free (converted); 3047 free (converted);
2752 } 3048 }
@@ -2769,7 +3065,190 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2769 } 3065 }
2770 } 3066 }
2771#endif 3067#endif
2772#if WIDE_CHAR_VERSION && (!DCHAR_IS_TCHAR || NEED_WPRINTF_DIRECTIVE_LC) 3068#if !WIDE_CHAR_VERSION && (PTRDIFF_MAX > INT_MAX)
3069 else if (dp->conversion == 's'
3070 && a.arg[dp->arg_index].type != TYPE_WIDE_STRING)
3071 {
3072 /* %s in vasnprintf. See the specification of fprintf.
3073 We handle it ourselves here, because the string may be longer
3074 than INT_MAX characters, whence snprintf or sprintf would
3075 fail to process it. */
3076 int flags = dp->flags;
3077 int has_width;
3078 size_t width;
3079 int has_precision;
3080 size_t precision;
3081
3082 has_width = 0;
3083 width = 0;
3084 if (dp->width_start != dp->width_end)
3085 {
3086 if (dp->width_arg_index != ARG_NONE)
3087 {
3088 int arg;
3089
3090 if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
3091 abort ();
3092 arg = a.arg[dp->width_arg_index].a.a_int;
3093 width = arg;
3094 if (arg < 0)
3095 {
3096 /* "A negative field width is taken as a '-' flag
3097 followed by a positive field width." */
3098 flags |= FLAG_LEFT;
3099 width = -width;
3100 }
3101 }
3102 else
3103 {
3104 const FCHAR_T *digitp = dp->width_start;
3105
3106 do
3107 width = xsum (xtimes (width, 10), *digitp++ - '0');
3108 while (digitp != dp->width_end);
3109 }
3110 if (width > (size_t) INT_MAX)
3111 goto overflow;
3112 has_width = 1;
3113 }
3114
3115 has_precision = 0;
3116 precision = 6;
3117 if (dp->precision_start != dp->precision_end)
3118 {
3119 if (dp->precision_arg_index != ARG_NONE)
3120 {
3121 int arg;
3122
3123 if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
3124 abort ();
3125 arg = a.arg[dp->precision_arg_index].a.a_int;
3126 /* "A negative precision is taken as if the precision
3127 were omitted." */
3128 if (arg >= 0)
3129 {
3130 precision = arg;
3131 has_precision = 1;
3132 }
3133 }
3134 else
3135 {
3136 const FCHAR_T *digitp = dp->precision_start + 1;
3137
3138 precision = 0;
3139 while (digitp != dp->precision_end)
3140 precision = xsum (xtimes (precision, 10), *digitp++ - '0');
3141 has_precision = 1;
3142 }
3143 }
3144
3145 {
3146 const char *arg = a.arg[dp->arg_index].a.a_string;
3147 size_t bytes;
3148# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
3149 size_t characters;
3150# endif
3151# if !DCHAR_IS_TCHAR
3152 /* This code assumes that TCHAR_T is 'char'. */
3153 static_assert (sizeof (TCHAR_T) == 1);
3154 DCHAR_T *tmpdst;
3155 size_t tmpdst_len;
3156# endif
3157 size_t w;
3158
3159 if (has_precision)
3160 {
3161 /* Use only at most PRECISION bytes, from the left. */
3162 bytes = local_strnlen (arg, precision);
3163 }
3164 else
3165 {
3166 /* Use the entire string, and count the number of
3167 bytes. */
3168 bytes = strlen (arg);
3169 }
3170
3171# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
3172 if (has_width)
3173 characters = mbsnlen (arg, bytes);
3174 else
3175 {
3176 /* The number of characters doesn't matter,
3177 because !has_width and therefore width==0. */
3178 characters = 0;
3179 }
3180# endif
3181
3182# if !DCHAR_IS_TCHAR
3183 /* Convert from TCHAR_T[] to DCHAR_T[]. */
3184 tmpdst =
3185 DCHAR_CONV_FROM_ENCODING (locale_charset (),
3186 iconveh_question_mark,
3187 arg, bytes,
3188 NULL,
3189 NULL, &tmpdst_len);
3190 if (tmpdst == NULL)
3191 goto fail_with_errno;
3192# endif
3193
3194 if (has_width)
3195 {
3196# if ENABLE_UNISTDIO
3197 /* Outside POSIX, it's preferable to compare the width
3198 against the number of _characters_ of the converted
3199 value. */
3200# if DCHAR_IS_TCHAR
3201 w = characters;
3202# else
3203 w = DCHAR_MBSNLEN (tmpdst, tmpdst_len);
3204# endif
3205# else
3206 /* The width is compared against the number of _bytes_
3207 of the converted value, says POSIX. */
3208 w = bytes;
3209# endif
3210 }
3211 else
3212 /* w doesn't matter. */
3213 w = 0;
3214
3215 {
3216# if DCHAR_IS_TCHAR
3217 size_t total = bytes + (w < width ? width - w : 0);
3218 ENSURE_ALLOCATION (xsum (length, total));
3219# else
3220 size_t total = tmpdst_len + (w < width ? width - w : 0);
3221 ENSURE_ALLOCATION_ELSE (xsum (length, total),
3222 { free (tmpdst); goto out_of_memory; });
3223# endif
3224
3225 if (w < width && !(flags & FLAG_LEFT))
3226 {
3227 size_t n = width - w;
3228 DCHAR_SET (result + length, ' ', n);
3229 length += n;
3230 }
3231
3232# if DCHAR_IS_TCHAR
3233 memcpy (result + length, arg, bytes);
3234 length += bytes;
3235# else
3236 DCHAR_CPY (result + length, tmpdst, tmpdst_len);
3237 free (tmpdst);
3238 length += tmpdst_len;
3239# endif
3240
3241 if (w < width && (flags & FLAG_LEFT))
3242 {
3243 size_t n = width - w;
3244 DCHAR_SET (result + length, ' ', n);
3245 length += n;
3246 }
3247 }
3248 }
3249 }
3250#endif
3251#if WIDE_CHAR_VERSION && ((PTRDIFF_MAX > INT_MAX) || !DCHAR_IS_TCHAR || NEED_WPRINTF_DIRECTIVE_LC)
2773 else if ((dp->conversion == 's' 3252 else if ((dp->conversion == 's'
2774 && a.arg[dp->arg_index].type == TYPE_WIDE_STRING) 3253 && a.arg[dp->arg_index].type == TYPE_WIDE_STRING)
2775 || (dp->conversion == 'c' 3254 || (dp->conversion == 'c'
@@ -2810,6 +3289,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2810 width = xsum (xtimes (width, 10), *digitp++ - '0'); 3289 width = xsum (xtimes (width, 10), *digitp++ - '0');
2811 while (digitp != dp->width_end); 3290 while (digitp != dp->width_end);
2812 } 3291 }
3292 if (width > (size_t) INT_MAX)
3293 goto overflow;
2813 } 3294 }
2814 3295
2815 { 3296 {
@@ -2912,7 +3393,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2912 } 3393 }
2913 } 3394 }
2914#endif 3395#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 3396#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' 3397 else if (dp->conversion == 's'
2917# if WIDE_CHAR_VERSION 3398# if WIDE_CHAR_VERSION
2918 && a.arg[dp->arg_index].type != TYPE_WIDE_STRING 3399 && a.arg[dp->arg_index].type != TYPE_WIDE_STRING
@@ -2965,6 +3446,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
2965 width = xsum (xtimes (width, 10), *digitp++ - '0'); 3446 width = xsum (xtimes (width, 10), *digitp++ - '0');
2966 while (digitp != dp->width_end); 3447 while (digitp != dp->width_end);
2967 } 3448 }
3449 if (width > (size_t) INT_MAX)
3450 goto overflow;
2968 has_width = 1; 3451 has_width = 1;
2969 } 3452 }
2970 3453
@@ -3145,11 +3628,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3145 { 3628 {
3146 const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string; 3629 const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
3147 const wchar_t *arg_end; 3630 const wchar_t *arg_end;
3631 size_t bytes;
3632# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
3148 size_t characters; 3633 size_t characters;
3634# endif
3149# if !DCHAR_IS_TCHAR 3635# if !DCHAR_IS_TCHAR
3150 /* This code assumes that TCHAR_T is 'char'. */ 3636 /* This code assumes that TCHAR_T is 'char'. */
3151 static_assert (sizeof (TCHAR_T) == 1); 3637 static_assert (sizeof (TCHAR_T) == 1);
3152 TCHAR_T *tmpsrc;
3153 DCHAR_T *tmpdst; 3638 DCHAR_T *tmpdst;
3154 size_t tmpdst_len; 3639 size_t tmpdst_len;
3155# endif 3640# endif
@@ -3164,7 +3649,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3164 mbszero (&state); 3649 mbszero (&state);
3165# endif 3650# endif
3166 arg_end = arg; 3651 arg_end = arg;
3652 bytes = 0;
3653# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
3167 characters = 0; 3654 characters = 0;
3655# endif
3168 while (precision > 0) 3656 while (precision > 0)
3169 { 3657 {
3170 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ 3658 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
@@ -3180,7 +3668,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3180 if (precision < (unsigned int) count) 3668 if (precision < (unsigned int) count)
3181 break; 3669 break;
3182 arg_end++; 3670 arg_end++;
3183 characters += count; 3671 bytes += count;
3672# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
3673 characters += mbsnlen (cbuf, count);
3674# endif
3184 precision -= count; 3675 precision -= count;
3185 } 3676 }
3186 } 3677 }
@@ -3197,7 +3688,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3197 mbszero (&state); 3688 mbszero (&state);
3198# endif 3689# endif
3199 arg_end = arg; 3690 arg_end = arg;
3691 bytes = 0;
3692# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
3200 characters = 0; 3693 characters = 0;
3694# endif
3201 for (;;) 3695 for (;;)
3202 { 3696 {
3203 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ 3697 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
@@ -3211,7 +3705,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3211 /* Cannot convert. */ 3705 /* Cannot convert. */
3212 goto fail_with_EILSEQ; 3706 goto fail_with_EILSEQ;
3213 arg_end++; 3707 arg_end++;
3214 characters += count; 3708 bytes += count;
3709# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
3710 characters += mbsnlen (cbuf, count);
3711# endif
3215 } 3712 }
3216 } 3713 }
3217# if DCHAR_IS_TCHAR 3714# if DCHAR_IS_TCHAR
@@ -3219,56 +3716,64 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3219 { 3716 {
3220 /* Use the entire string. */ 3717 /* Use the entire string. */
3221 arg_end = arg + local_wcslen (arg); 3718 arg_end = arg + local_wcslen (arg);
3222 /* The number of bytes doesn't matter. */ 3719 /* The number of bytes and characters doesn't matter,
3720 because !has_width and therefore width==0. */
3721 bytes = 0;
3722# if ENABLE_UNISTDIO
3223 characters = 0; 3723 characters = 0;
3724# endif
3224 } 3725 }
3225# endif 3726# endif
3226 3727
3227# if !DCHAR_IS_TCHAR 3728# 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 { 3729 {
3233 TCHAR_T *tmpptr = tmpsrc; 3730 TCHAR_T *tmpsrc;
3234 size_t remaining; 3731
3732 /* Convert the string into a piece of temporary memory. */
3733 tmpsrc = (TCHAR_T *) malloc (bytes * sizeof (TCHAR_T));
3734 if (tmpsrc == NULL)
3735 goto out_of_memory;
3736 {
3737 TCHAR_T *tmpptr = tmpsrc;
3738 size_t remaining;
3235# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t 3739# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
3236 mbstate_t state; 3740 mbstate_t state;
3237 mbszero (&state); 3741 mbszero (&state);
3238# endif 3742# endif
3239 for (remaining = characters; remaining > 0; ) 3743 for (remaining = bytes; remaining > 0; )
3240 { 3744 {
3241 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ 3745 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
3242 int count; 3746 int count;
3243 3747
3244 if (*arg == 0) 3748 if (*arg == 0)
3245 abort (); 3749 abort ();
3246 count = local_wcrtomb (cbuf, *arg, &state); 3750 count = local_wcrtomb (cbuf, *arg, &state);
3247 if (count <= 0) 3751 if (count <= 0)
3248 /* Inconsistency. */ 3752 /* Inconsistency. */
3249 abort (); 3753 abort ();
3250 memcpy (tmpptr, cbuf, count); 3754 memcpy (tmpptr, cbuf, count);
3251 tmpptr += count; 3755 tmpptr += count;
3252 arg++; 3756 arg++;
3253 remaining -= count; 3757 remaining -= count;
3758 }
3759 if (!(arg == arg_end))
3760 abort ();
3761 }
3762
3763 /* Convert from TCHAR_T[] to DCHAR_T[]. */
3764 tmpdst =
3765 DCHAR_CONV_FROM_ENCODING (locale_charset (),
3766 iconveh_question_mark,
3767 tmpsrc, bytes,
3768 NULL,
3769 NULL, &tmpdst_len);
3770 if (tmpdst == NULL)
3771 {
3772 free (tmpsrc);
3773 goto fail_with_errno;
3254 } 3774 }
3255 if (!(arg == arg_end)) 3775 free (tmpsrc);
3256 abort ();
3257 } 3776 }
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 3777# endif
3273 3778
3274 if (has_width) 3779 if (has_width)
@@ -3277,11 +3782,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3277 /* Outside POSIX, it's preferable to compare the width 3782 /* Outside POSIX, it's preferable to compare the width
3278 against the number of _characters_ of the converted 3783 against the number of _characters_ of the converted
3279 value. */ 3784 value. */
3280 w = DCHAR_MBSNLEN (result + length, characters); 3785# if DCHAR_IS_TCHAR
3786 w = characters;
3787# else
3788 w = DCHAR_MBSNLEN (tmpdst, tmpdst_len);
3789# endif
3281# else 3790# else
3282 /* The width is compared against the number of _bytes_ 3791 /* The width is compared against the number of _bytes_
3283 of the converted value, says POSIX. */ 3792 of the converted value, says POSIX. */
3284 w = characters; 3793 w = bytes;
3285# endif 3794# endif
3286 } 3795 }
3287 else 3796 else
@@ -3291,7 +3800,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3291 if (w < width && !(flags & FLAG_LEFT)) 3800 if (w < width && !(flags & FLAG_LEFT))
3292 { 3801 {
3293 size_t n = width - w; 3802 size_t n = width - w;
3803# if DCHAR_IS_TCHAR
3294 ENSURE_ALLOCATION (xsum (length, n)); 3804 ENSURE_ALLOCATION (xsum (length, n));
3805# else
3806 ENSURE_ALLOCATION_ELSE (xsum (length, n),
3807 { free (tmpdst); goto out_of_memory; });
3808# endif
3295 DCHAR_SET (result + length, ' ', n); 3809 DCHAR_SET (result + length, ' ', n);
3296 length += n; 3810 length += n;
3297 } 3811 }
@@ -3305,8 +3819,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3305 mbstate_t state; 3819 mbstate_t state;
3306 mbszero (&state); 3820 mbszero (&state);
3307# endif 3821# endif
3308 ENSURE_ALLOCATION (xsum (length, characters)); 3822 ENSURE_ALLOCATION (xsum (length, bytes));
3309 for (remaining = characters; remaining > 0; ) 3823 for (remaining = bytes; remaining > 0; )
3310 { 3824 {
3311 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ 3825 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
3312 int count; 3826 int count;
@@ -3350,7 +3864,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3350 } 3864 }
3351# else 3865# else
3352 ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len), 3866 ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len),
3353 { free (tmpdst); goto out_of_memory; }); 3867 { free (tmpdst); goto out_of_memory; });
3354 DCHAR_CPY (result + length, tmpdst, tmpdst_len); 3868 DCHAR_CPY (result + length, tmpdst, tmpdst_len);
3355 free (tmpdst); 3869 free (tmpdst);
3356 length += tmpdst_len; 3870 length += tmpdst_len;
@@ -3406,17 +3920,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3406 width = xsum (xtimes (width, 10), *digitp++ - '0'); 3920 width = xsum (xtimes (width, 10), *digitp++ - '0');
3407 while (digitp != dp->width_end); 3921 while (digitp != dp->width_end);
3408 } 3922 }
3923 if (width > (size_t) INT_MAX)
3924 goto overflow;
3409 has_width = 1; 3925 has_width = 1;
3410 } 3926 }
3411 3927
3412 /* %lc in vasnprintf. See the specification of fprintf. */ 3928 /* %lc in vasnprintf. See the specification of fprintf. */
3413 { 3929 {
3414 wchar_t arg = (wchar_t) a.arg[dp->arg_index].a.a_wide_char; 3930 wchar_t arg = (wchar_t) a.arg[dp->arg_index].a.a_wide_char;
3931 size_t bytes;
3932# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
3415 size_t characters; 3933 size_t characters;
3934# endif
3416# if !DCHAR_IS_TCHAR 3935# if !DCHAR_IS_TCHAR
3417 /* This code assumes that TCHAR_T is 'char'. */ 3936 /* This code assumes that TCHAR_T is 'char'. */
3418 static_assert (sizeof (TCHAR_T) == 1); 3937 static_assert (sizeof (TCHAR_T) == 1);
3419 TCHAR_T tmpsrc[64]; /* Assume MB_CUR_MAX <= 64. */
3420 DCHAR_T *tmpdst; 3938 DCHAR_T *tmpdst;
3421 size_t tmpdst_len; 3939 size_t tmpdst_len;
3422# endif 3940# endif
@@ -3427,7 +3945,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3427# endif 3945# endif
3428 { 3946 {
3429 /* Count the number of bytes. */ 3947 /* Count the number of bytes. */
3430 characters = 0;
3431 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ 3948 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
3432 int count; 3949 int count;
3433# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t 3950# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
@@ -3439,43 +3956,54 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3439 if (count < 0) 3956 if (count < 0)
3440 /* Cannot convert. */ 3957 /* Cannot convert. */
3441 goto fail_with_EILSEQ; 3958 goto fail_with_EILSEQ;
3442 characters = count; 3959 bytes = count;
3960# if ENABLE_UNISTDIO && DCHAR_IS_TCHAR
3961 characters = mbsnlen (cbuf, count);
3962# endif
3443 } 3963 }
3444# if DCHAR_IS_TCHAR 3964# if DCHAR_IS_TCHAR
3445 else 3965 else
3446 { 3966 {
3447 /* The number of bytes doesn't matter. */ 3967 /* The number of bytes and characters doesn't matter,
3968 because !has_width and therefore width==0. */
3969 bytes = 0;
3970# if ENABLE_UNISTDIO
3448 characters = 0; 3971 characters = 0;
3972# endif
3449 } 3973 }
3450# endif 3974# endif
3451 3975
3452# if !DCHAR_IS_TCHAR 3976# if !DCHAR_IS_TCHAR
3453 /* Convert the string into a piece of temporary memory. */ 3977 {
3454 if (characters > 0) 3978 TCHAR_T tmpsrc[64]; /* Assume MB_CUR_MAX <= 64. */
3455 { 3979
3456 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */ 3980 /* Convert the string into a piece of temporary memory. */
3457 int count; 3981 if (bytes > 0)
3982 {
3983 char cbuf[64]; /* Assume MB_CUR_MAX <= 64. */
3984 int count;
3458# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t 3985# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
3459 mbstate_t state; 3986 mbstate_t state;
3460 mbszero (&state); 3987 mbszero (&state);
3461# endif 3988# endif
3462 3989
3463 count = local_wcrtomb (cbuf, arg, &state); 3990 count = local_wcrtomb (cbuf, arg, &state);
3464 if (count <= 0) 3991 if (count <= 0)
3465 /* Inconsistency. */ 3992 /* Inconsistency. */
3466 abort (); 3993 abort ();
3467 memcpy (tmpsrc, cbuf, count); 3994 memcpy (tmpsrc, cbuf, count);
3468 } 3995 }
3469 3996
3470 /* Convert from TCHAR_T[] to DCHAR_T[]. */ 3997 /* Convert from TCHAR_T[] to DCHAR_T[]. */
3471 tmpdst = 3998 tmpdst =
3472 DCHAR_CONV_FROM_ENCODING (locale_charset (), 3999 DCHAR_CONV_FROM_ENCODING (locale_charset (),
3473 iconveh_question_mark, 4000 iconveh_question_mark,
3474 tmpsrc, characters, 4001 tmpsrc, bytes,
3475 NULL, 4002 NULL,
3476 NULL, &tmpdst_len); 4003 NULL, &tmpdst_len);
3477 if (tmpdst == NULL) 4004 if (tmpdst == NULL)
3478 goto fail_with_errno; 4005 goto fail_with_errno;
4006 }
3479# endif 4007# endif
3480 4008
3481 if (has_width) 4009 if (has_width)
@@ -3484,11 +4012,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3484 /* Outside POSIX, it's preferable to compare the width 4012 /* Outside POSIX, it's preferable to compare the width
3485 against the number of _characters_ of the converted 4013 against the number of _characters_ of the converted
3486 value. */ 4014 value. */
3487 w = DCHAR_MBSNLEN (result + length, characters); 4015# if DCHAR_IS_TCHAR
4016 w = characters;
4017# else
4018 w = DCHAR_MBSNLEN (tmpdst, tmpdst_len);
4019# endif
3488# else 4020# else
3489 /* The width is compared against the number of _bytes_ 4021 /* The width is compared against the number of _bytes_
3490 of the converted value, says POSIX. */ 4022 of the converted value, says POSIX. */
3491 w = characters; 4023 w = bytes;
3492# endif 4024# endif
3493 } 4025 }
3494 else 4026 else
@@ -3498,7 +4030,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3498 if (w < width && !(flags & FLAG_LEFT)) 4030 if (w < width && !(flags & FLAG_LEFT))
3499 { 4031 {
3500 size_t n = width - w; 4032 size_t n = width - w;
4033# if DCHAR_IS_TCHAR
3501 ENSURE_ALLOCATION (xsum (length, n)); 4034 ENSURE_ALLOCATION (xsum (length, n));
4035# else
4036 ENSURE_ALLOCATION_ELSE (xsum (length, n),
4037 { free (tmpdst); goto out_of_memory; });
4038# endif
3502 DCHAR_SET (result + length, ' ', n); 4039 DCHAR_SET (result + length, ' ', n);
3503 length += n; 4040 length += n;
3504 } 4041 }
@@ -3507,8 +4044,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3507 if (has_width) 4044 if (has_width)
3508 { 4045 {
3509 /* We know the number of bytes in advance. */ 4046 /* We know the number of bytes in advance. */
3510 ENSURE_ALLOCATION (xsum (length, characters)); 4047 ENSURE_ALLOCATION (xsum (length, bytes));
3511 if (characters > 0) 4048 if (bytes > 0)
3512 { 4049 {
3513 int count; 4050 int count;
3514# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t 4051# if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
@@ -3542,7 +4079,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3542 } 4079 }
3543# else 4080# else
3544 ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len), 4081 ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len),
3545 { free (tmpdst); goto out_of_memory; }); 4082 { free (tmpdst); goto out_of_memory; });
3546 DCHAR_CPY (result + length, tmpdst, tmpdst_len); 4083 DCHAR_CPY (result + length, tmpdst, tmpdst_len);
3547 free (tmpdst); 4084 free (tmpdst);
3548 length += tmpdst_len; 4085 length += tmpdst_len;
@@ -3594,6 +4131,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3594 width = xsum (xtimes (width, 10), *digitp++ - '0'); 4131 width = xsum (xtimes (width, 10), *digitp++ - '0');
3595 while (digitp != dp->width_end); 4132 while (digitp != dp->width_end);
3596 } 4133 }
4134 if (width > (size_t) INT_MAX)
4135 goto overflow;
3597 } 4136 }
3598 4137
3599 /* %c in vasnwprintf. See the specification of fwprintf. */ 4138 /* %c in vasnwprintf. See the specification of fwprintf. */
@@ -3608,24 +4147,26 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3608 /* Invalid or incomplete multibyte character. */ 4147 /* Invalid or incomplete multibyte character. */
3609 goto fail_with_EILSEQ; 4148 goto fail_with_EILSEQ;
3610 4149
3611 if (1 < width && !(flags & FLAG_LEFT)) 4150 {
3612 { 4151 size_t total = (1 < width ? width : 1);
3613 size_t n = width - 1; 4152 ENSURE_ALLOCATION (xsum (length, total));
3614 ENSURE_ALLOCATION (xsum (length, n)); 4153
3615 DCHAR_SET (result + length, ' ', n); 4154 if (1 < width && !(flags & FLAG_LEFT))
3616 length += n; 4155 {
3617 } 4156 size_t n = width - 1;
4157 DCHAR_SET (result + length, ' ', n);
4158 length += n;
4159 }
3618 4160
3619 ENSURE_ALLOCATION (xsum (length, 1)); 4161 result[length++] = wc;
3620 result[length++] = wc;
3621 4162
3622 if (1 < width && (flags & FLAG_LEFT)) 4163 if (1 < width && (flags & FLAG_LEFT))
3623 { 4164 {
3624 size_t n = width - 1; 4165 size_t n = width - 1;
3625 ENSURE_ALLOCATION (xsum (length, n)); 4166 DCHAR_SET (result + length, ' ', n);
3626 DCHAR_SET (result + length, ' ', n); 4167 length += n;
3627 length += n; 4168 }
3628 } 4169 }
3629 } 4170 }
3630 } 4171 }
3631#endif 4172#endif
@@ -3682,6 +4223,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3682 width = xsum (xtimes (width, 10), *digitp++ - '0'); 4223 width = xsum (xtimes (width, 10), *digitp++ - '0');
3683 while (digitp != dp->width_end); 4224 while (digitp != dp->width_end);
3684 } 4225 }
4226 if (width > (size_t) INT_MAX)
4227 goto overflow;
3685 has_width = 1; 4228 has_width = 1;
3686 } 4229 }
3687 4230
@@ -3933,7 +4476,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3933 { 4476 {
3934 size_t n = xsum (length, count); 4477 size_t n = xsum (length, count);
3935 4478
3936 ENSURE_ALLOCATION (n); 4479 ENSURE_ALLOCATION_ELSE (n,
4480 { if (tmp != tmpbuf) free (tmp); goto out_of_memory; });
3937 } 4481 }
3938 4482
3939 /* Append the result. */ 4483 /* Append the result. */
@@ -3996,6 +4540,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
3996 width = xsum (xtimes (width, 10), *digitp++ - '0'); 4540 width = xsum (xtimes (width, 10), *digitp++ - '0');
3997 while (digitp != dp->width_end); 4541 while (digitp != dp->width_end);
3998 } 4542 }
4543 if (width > (size_t) INT_MAX)
4544 goto overflow;
3999 } 4545 }
4000 4546
4001 has_precision = 0; 4547 has_precision = 0;
@@ -4423,7 +4969,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4423 { 4969 {
4424 size_t n = xsum (length, count); 4970 size_t n = xsum (length, count);
4425 4971
4426 ENSURE_ALLOCATION (n); 4972 ENSURE_ALLOCATION_ELSE (n,
4973 { if (tmp != tmpbuf) free (tmp); goto out_of_memory; });
4427 } 4974 }
4428 4975
4429 /* Append the result. */ 4976 /* Append the result. */
@@ -4501,6 +5048,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4501 width = xsum (xtimes (width, 10), *digitp++ - '0'); 5048 width = xsum (xtimes (width, 10), *digitp++ - '0');
4502 while (digitp != dp->width_end); 5049 while (digitp != dp->width_end);
4503 } 5050 }
5051 if (width > (size_t) INT_MAX)
5052 goto overflow;
4504 } 5053 }
4505 5054
4506 has_precision = 0; 5055 has_precision = 0;
@@ -4587,6 +5136,17 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4587 } 5136 }
4588 } 5137 }
4589# endif 5138# endif
5139 /* Account for thousands separators. */
5140 if (flags & FLAG_GROUP)
5141 {
5142 /* A thousands separator needs to be inserted at most every 2 digits.
5143 This is the case in the ta_IN locale. */
5144# if WIDE_CHAR_VERSION
5145 tmp_length = xsum (tmp_length, tmp_length / 2 * THOUSEP_WCHAR_MAXLEN);
5146# else
5147 tmp_length = xsum (tmp_length, tmp_length / 2 * THOUSEP_CHAR_MAXLEN);
5148# endif
5149 }
4590 /* Account for sign, decimal point etc. */ 5150 /* Account for sign, decimal point etc. */
4591 tmp_length = xsum (tmp_length, 12); 5151 tmp_length = xsum (tmp_length, 12);
4592 5152
@@ -4682,12 +5242,84 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4682 ndigits = strlen (digits); 5242 ndigits = strlen (digits);
4683 5243
4684 if (ndigits > precision) 5244 if (ndigits > precision)
4685 do 5245 {
4686 { 5246 /* Number of digits before the decimal point. */
4687 --ndigits; 5247 size_t intpart_digits = ndigits - precision;
4688 *p++ = digits[ndigits]; 5248
4689 } 5249 const DCHAR_T *thousep = NULL;
4690 while (ndigits > precision); 5250 DCHAR_T thousep_buf[10];
5251# if !WIDE_CHAR_VERSION
5252 size_t thousep_len = 0;
5253# endif
5254 const signed char *grouping;
5255 size_t insert = 0;
5256
5257 if ((flags & FLAG_GROUP) && (intpart_digits > 1))
5258 {
5259 /* Determine the thousands separator and
5260 the grouping rule of the current locale. */
5261# if WIDE_CHAR_VERSION
5262 /* DCHAR_T is wchar_t. */
5263 thousep = thousands_separator_wchar (thousep_buf);
5264# define thousep_len 1
5265# elif defined DCHAR_CONV_FROM_ENCODING
5266 /* DCHAR_T is uintN_t. */
5267 thousep = thousands_separator_DCHAR (thousep_buf);
5268 thousep_len = DCHAR_STRLEN (thousep);
5269# else
5270 /* DCHAR_T is char. */
5271 thousep = thousands_separator_char (thousep_buf);
5272 thousep_len = strlen (thousep);
5273# endif
5274 if (*thousep == 0)
5275 thousep = NULL;
5276 if (thousep != NULL)
5277 {
5278 grouping = grouping_rule ();
5279 insert =
5280 num_thousands_separators (grouping, intpart_digits);
5281 }
5282 }
5283
5284 const char *digitp = digits + precision;
5285 DCHAR_T *p_before_intpart = p;
5286 p += intpart_digits + insert * thousep_len;
5287 DCHAR_T *p_after_intpart = p;
5288 if (insert > 0) /* implies (flag & FLAG_GROUP) && (thousep != NULL) */
5289 {
5290 const signed char *g = grouping;
5291 for (;;)
5292 {
5293 int h = *g;
5294 if (h <= 0)
5295 abort ();
5296 int i = h;
5297 do
5298 *--p = *digitp++;
5299 while (--i > 0);
5300# if WIDE_CHAR_VERSION
5301 *--p = thousep[0];
5302# else
5303 p -= thousep_len;
5304 DCHAR_CPY (p, thousep, thousep_len);
5305# endif
5306 insert--;
5307 if (insert == 0)
5308 break;
5309 if (g[1] != 0)
5310 g++;
5311 }
5312 }
5313 for (;;)
5314 {
5315 *--p = *digitp++;
5316 if (p == p_before_intpart)
5317 break;
5318 }
5319 p = p_after_intpart;
5320 ndigits = precision;
5321# undef thousep_len
5322 }
4691 else 5323 else
4692 *p++ = '0'; 5324 *p++ = '0';
4693 /* Here ndigits <= precision. */ 5325 /* Here ndigits <= precision. */
@@ -4940,10 +5572,84 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
4940 digits without trailing zeroes. */ 5572 digits without trailing zeroes. */
4941 if (exponent >= 0) 5573 if (exponent >= 0)
4942 { 5574 {
4943 size_t ecount = exponent + 1; 5575 /* Number of digits before the decimal point. */
4944 /* Note: count <= precision = ndigits. */ 5576 size_t intpart_digits = exponent + 1;
4945 for (; ecount > 0; ecount--) 5577 /* Note: intpart_digits <= precision = ndigits. */
4946 *p++ = digits[--ndigits]; 5578
5579 const DCHAR_T *thousep = NULL;
5580 DCHAR_T thousep_buf[10];
5581# if !WIDE_CHAR_VERSION
5582 size_t thousep_len = 0;
5583# endif
5584 const signed char *grouping;
5585 size_t insert = 0;
5586
5587 if ((flags & FLAG_GROUP) && (intpart_digits > 1))
5588 {
5589 /* Determine the thousands separator and
5590 the grouping rule of the current locale. */
5591# if WIDE_CHAR_VERSION
5592 /* DCHAR_T is wchar_t. */
5593 thousep = thousands_separator_wchar (thousep_buf);
5594# define thousep_len 1
5595# elif defined DCHAR_CONV_FROM_ENCODING
5596 /* DCHAR_T is uintN_t. */
5597 thousep = thousands_separator_DCHAR (thousep_buf);
5598 thousep_len = DCHAR_STRLEN (thousep);
5599# else
5600 /* DCHAR_T is char. */
5601 thousep = thousands_separator_char (thousep_buf);
5602 thousep_len = strlen (thousep);
5603# endif
5604 if (*thousep == 0)
5605 thousep = NULL;
5606 if (thousep != NULL)
5607 {
5608 grouping = grouping_rule ();
5609 insert =
5610 num_thousands_separators (grouping, intpart_digits);
5611 }
5612 }
5613
5614 const char *digitp = digits + ndigits - intpart_digits;
5615 DCHAR_T *p_before_intpart = p;
5616 p += intpart_digits + insert * thousep_len;
5617 DCHAR_T *p_after_intpart = p;
5618 if (insert > 0) /* implies (flag & FLAG_GROUP) && (thousep != NULL) */
5619 {
5620 const signed char *g = grouping;
5621 for (;;)
5622 {
5623 int h = *g;
5624 if (h <= 0)
5625 abort ();
5626 int i = h;
5627 do
5628 *--p = *digitp++;
5629 while (--i > 0);
5630# if WIDE_CHAR_VERSION
5631 *--p = thousep[0];
5632# else
5633 p -= thousep_len;
5634 DCHAR_CPY (p, thousep, thousep_len);
5635# endif
5636 insert--;
5637 if (insert == 0)
5638 break;
5639 if (g[1] != 0)
5640 g++;
5641 }
5642 }
5643 for (;;)
5644 {
5645 *--p = *digitp++;
5646 if (p == p_before_intpart)
5647 break;
5648 }
5649 p = p_after_intpart;
5650 ndigits -= intpart_digits;
5651# undef thousep_len
5652
4947 if ((flags & FLAG_ALT) || ndigits > nzeroes) 5653 if ((flags & FLAG_ALT) || ndigits > nzeroes)
4948 { 5654 {
4949 *p++ = decimal_point_char (); 5655 *p++ = decimal_point_char ();
@@ -5144,12 +5850,84 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5144 ndigits = strlen (digits); 5850 ndigits = strlen (digits);
5145 5851
5146 if (ndigits > precision) 5852 if (ndigits > precision)
5147 do 5853 {
5148 { 5854 /* Number of digits before the decimal point. */
5149 --ndigits; 5855 size_t intpart_digits = ndigits - precision;
5150 *p++ = digits[ndigits]; 5856
5151 } 5857 const DCHAR_T *thousep = NULL;
5152 while (ndigits > precision); 5858 DCHAR_T thousep_buf[10];
5859# if !WIDE_CHAR_VERSION
5860 size_t thousep_len = 0;
5861# endif
5862 const signed char *grouping;
5863 size_t insert = 0;
5864
5865 if ((flags & FLAG_GROUP) && (intpart_digits > 1))
5866 {
5867 /* Determine the thousands separator and
5868 the grouping rule of the current locale. */
5869# if WIDE_CHAR_VERSION
5870 /* DCHAR_T is wchar_t. */
5871 thousep = thousands_separator_wchar (thousep_buf);
5872# define thousep_len 1
5873# elif defined DCHAR_CONV_FROM_ENCODING
5874 /* DCHAR_T is uintN_t. */
5875 thousep = thousands_separator_DCHAR (thousep_buf);
5876 thousep_len = DCHAR_STRLEN (thousep);
5877# else
5878 /* DCHAR_T is char. */
5879 thousep = thousands_separator_char (thousep_buf);
5880 thousep_len = strlen (thousep);
5881# endif
5882 if (*thousep == 0)
5883 thousep = NULL;
5884 if (thousep != NULL)
5885 {
5886 grouping = grouping_rule ();
5887 insert =
5888 num_thousands_separators (grouping, intpart_digits);
5889 }
5890 }
5891
5892 const char *digitp = digits + precision;
5893 DCHAR_T *p_before_intpart = p;
5894 p += intpart_digits + insert * thousep_len;
5895 DCHAR_T *p_after_intpart = p;
5896 if (insert > 0) /* implies (flag & FLAG_GROUP) && (thousep != NULL) */
5897 {
5898 const signed char *g = grouping;
5899 for (;;)
5900 {
5901 int h = *g;
5902 if (h <= 0)
5903 abort ();
5904 int i = h;
5905 do
5906 *--p = *digitp++;
5907 while (--i > 0);
5908# if WIDE_CHAR_VERSION
5909 *--p = thousep[0];
5910# else
5911 p -= thousep_len;
5912 DCHAR_CPY (p, thousep, thousep_len);
5913# endif
5914 insert--;
5915 if (insert == 0)
5916 break;
5917 if (g[1] != 0)
5918 g++;
5919 }
5920 }
5921 for (;;)
5922 {
5923 *--p = *digitp++;
5924 if (p == p_before_intpart)
5925 break;
5926 }
5927 p = p_after_intpart;
5928 ndigits = precision;
5929# undef thousep_len
5930 }
5153 else 5931 else
5154 *p++ = '0'; 5932 *p++ = '0';
5155 /* Here ndigits <= precision. */ 5933 /* Here ndigits <= precision. */
@@ -5410,10 +6188,84 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5410 digits without trailing zeroes. */ 6188 digits without trailing zeroes. */
5411 if (exponent >= 0) 6189 if (exponent >= 0)
5412 { 6190 {
5413 size_t ecount = exponent + 1; 6191 /* Number of digits before the decimal point. */
5414 /* Note: ecount <= precision = ndigits. */ 6192 size_t intpart_digits = exponent + 1;
5415 for (; ecount > 0; ecount--) 6193 /* Note: intpart_digits <= precision = ndigits. */
5416 *p++ = digits[--ndigits]; 6194
6195 const DCHAR_T *thousep = NULL;
6196 DCHAR_T thousep_buf[10];
6197# if !WIDE_CHAR_VERSION
6198 size_t thousep_len = 0;
6199# endif
6200 const signed char *grouping;
6201 size_t insert = 0;
6202
6203 if ((flags & FLAG_GROUP) && (intpart_digits > 1))
6204 {
6205 /* Determine the thousands separator and
6206 the grouping rule of the current locale. */
6207# if WIDE_CHAR_VERSION
6208 /* DCHAR_T is wchar_t. */
6209 thousep = thousands_separator_wchar (thousep_buf);
6210# define thousep_len 1
6211# elif defined DCHAR_CONV_FROM_ENCODING
6212 /* DCHAR_T is uintN_t. */
6213 thousep = thousands_separator_DCHAR (thousep_buf);
6214 thousep_len = DCHAR_STRLEN (thousep);
6215# else
6216 /* DCHAR_T is char. */
6217 thousep = thousands_separator_char (thousep_buf);
6218 thousep_len = strlen (thousep);
6219# endif
6220 if (*thousep == 0)
6221 thousep = NULL;
6222 if (thousep != NULL)
6223 {
6224 grouping = grouping_rule ();
6225 insert =
6226 num_thousands_separators (grouping, intpart_digits);
6227 }
6228 }
6229
6230 const char *digitp = digits + ndigits - intpart_digits;
6231 DCHAR_T *p_before_intpart = p;
6232 p += intpart_digits + insert * thousep_len;
6233 DCHAR_T *p_after_intpart = p;
6234 if (insert > 0) /* implies (flag & FLAG_GROUP) && (thousep != NULL) */
6235 {
6236 const signed char *g = grouping;
6237 for (;;)
6238 {
6239 int h = *g;
6240 if (h <= 0)
6241 abort ();
6242 int i = h;
6243 do
6244 *--p = *digitp++;
6245 while (--i > 0);
6246# if WIDE_CHAR_VERSION
6247 *--p = thousep[0];
6248# else
6249 p -= thousep_len;
6250 DCHAR_CPY (p, thousep, thousep_len);
6251# endif
6252 insert--;
6253 if (insert == 0)
6254 break;
6255 if (g[1] != 0)
6256 g++;
6257 }
6258 }
6259 for (;;)
6260 {
6261 *--p = *digitp++;
6262 if (p == p_before_intpart)
6263 break;
6264 }
6265 p = p_after_intpart;
6266 ndigits -= intpart_digits;
6267# undef thousep_len
6268
5417 if ((flags & FLAG_ALT) || ndigits > nzeroes) 6269 if ((flags & FLAG_ALT) || ndigits > nzeroes)
5418 { 6270 {
5419 *p++ = decimal_point_char (); 6271 *p++ = decimal_point_char ();
@@ -5606,7 +6458,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5606 { 6458 {
5607 size_t n = xsum (length, count); 6459 size_t n = xsum (length, count);
5608 6460
5609 ENSURE_ALLOCATION (n); 6461 ENSURE_ALLOCATION_ELSE (n,
6462 { if (tmp != tmpbuf) free (tmp); goto out_of_memory; });
5610 } 6463 }
5611 6464
5612 /* Append the result. */ 6465 /* Append the result. */
@@ -5620,13 +6473,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5620 { 6473 {
5621 arg_type type = a.arg[dp->arg_index].type; 6474 arg_type type = a.arg[dp->arg_index].type;
5622 int flags = dp->flags; 6475 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 6476#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
5624 int has_width; 6477 int has_width;
5625#endif 6478#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 6479#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
5627 size_t width; 6480 size_t width;
5628#endif 6481#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 6482#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
5630 int has_precision; 6483 int has_precision;
5631 size_t precision; 6484 size_t precision;
5632#endif 6485#endif
@@ -5635,9 +6488,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5635#else 6488#else
5636# define prec_ourselves 0 6489# define prec_ourselves 0
5637#endif 6490#endif
6491#if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION || NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT
6492 int group_ourselves;
6493#else
6494# define group_ourselves 0
6495#endif
5638#if (WIDE_CHAR_VERSION && MUSL_LIBC) || NEED_PRINTF_FLAG_LEFTADJUST 6496#if (WIDE_CHAR_VERSION && MUSL_LIBC) || NEED_PRINTF_FLAG_LEFTADJUST
5639# define pad_ourselves 1 6497# 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 6498#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; 6499 int pad_ourselves;
5642#else 6500#else
5643# define pad_ourselves 0 6501# define pad_ourselves 0
@@ -5652,10 +6510,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5652 TCHAR_T *tmp; 6510 TCHAR_T *tmp;
5653#endif 6511#endif
5654 6512
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 6513#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; 6514 has_width = 0;
5657#endif 6515#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 6516#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; 6517 width = 0;
5660 if (dp->width_start != dp->width_end) 6518 if (dp->width_start != dp->width_end)
5661 { 6519 {
@@ -5683,13 +6541,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5683 width = xsum (xtimes (width, 10), *digitp++ - '0'); 6541 width = xsum (xtimes (width, 10), *digitp++ - '0');
5684 while (digitp != dp->width_end); 6542 while (digitp != dp->width_end);
5685 } 6543 }
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 6544 if (width > (size_t) INT_MAX)
6545 goto overflow;
6546# define WIDTH_IS_CHECKED 1
6547# 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; 6548 has_width = 1;
5688# endif 6549# endif
5689 } 6550 }
5690#endif 6551#endif
5691 6552
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 6553#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; 6554 has_precision = 0;
5694 precision = 6; 6555 precision = 6;
5695 if (dp->precision_start != dp->precision_end) 6556 if (dp->precision_start != dp->precision_end)
@@ -5754,8 +6615,37 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5754 } 6615 }
5755#endif 6616#endif
5756 6617
6618 /* Decide whether to add the thousands separators ourselves. */
6619#if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION || NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT
6620 if (flags & FLAG_GROUP)
6621 {
6622 switch (dp->conversion)
6623 {
6624 case 'd': case 'i': case 'u':
6625# if NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT
6626 group_ourselves = 1;
6627# else
6628 group_ourselves = prec_ourselves;
6629# endif
6630 break;
6631 case 'f': case 'F': case 'g': case 'G':
6632# if NEED_PRINTF_FLAG_GROUPING
6633 group_ourselves = 1;
6634# else
6635 group_ourselves = prec_ourselves;
6636# endif
6637 break;
6638 default:
6639 group_ourselves = 0;
6640 break;
6641 }
6642 }
6643 else
6644 group_ourselves = 0;
6645#endif
6646
5757 /* Decide whether to perform the padding ourselves. */ 6647 /* 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) 6648#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) 6649 switch (dp->conversion)
5760 { 6650 {
5761# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO 6651# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
@@ -5772,7 +6662,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5772 pad_ourselves = 1; 6662 pad_ourselves = 1;
5773 break; 6663 break;
5774 default: 6664 default:
5775 pad_ourselves = prec_ourselves; 6665 pad_ourselves = prec_ourselves | group_ourselves;
5776 break; 6666 break;
5777 } 6667 }
5778#endif 6668#endif
@@ -5805,14 +6695,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5805 sprintf. */ 6695 sprintf. */
5806 fbp = buf; 6696 fbp = buf;
5807 *fbp++ = '%'; 6697 *fbp++ = '%';
5808#if NEED_PRINTF_FLAG_GROUPING 6698 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++ = '\''; 6699 *fbp++ = '\'';
5815#endif
5816 if (flags & FLAG_LEFT) 6700 if (flags & FLAG_LEFT)
5817 *fbp++ = '-'; 6701 *fbp++ = '-';
5818 if (flags & FLAG_SHOWSIGN) 6702 if (flags & FLAG_SHOWSIGN)
@@ -5832,6 +6716,43 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5832 if (dp->width_start != dp->width_end) 6716 if (dp->width_start != dp->width_end)
5833 { 6717 {
5834 size_t n = dp->width_end - dp->width_start; 6718 size_t n = dp->width_end - dp->width_start;
6719#if !WIDTH_IS_CHECKED
6720 size_t width;
6721 /* Reject an out-of-range width.
6722 The underlying SNPRINTF already does this on some
6723 platforms (glibc, musl, macOS, FreeBSD, NetBSD,
6724 OpenBSD, Cygwin, Solaris, MSVC). However, on others
6725 (AIX, mingw), it doesn't; thus this vasnprintf
6726 invocation would succeed and produce a wrong result.
6727 So, this is redundant on some platforms, but it's a
6728 quick check anyway. */
6729 if (dp->width_arg_index != ARG_NONE)
6730 {
6731 int arg;
6732
6733 if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
6734 abort ();
6735 arg = a.arg[dp->width_arg_index].a.a_int;
6736 width = arg;
6737 if (arg < 0)
6738 {
6739 /* "A negative field width is taken as a '-' flag
6740 followed by a positive field width." */
6741 width = -width;
6742 }
6743 }
6744 else
6745 {
6746 const FCHAR_T *digitp = dp->width_start;
6747
6748 width = 0;
6749 do
6750 width = xsum (xtimes (width, 10), *digitp++ - '0');
6751 while (digitp != dp->width_end);
6752 }
6753 if (width > (size_t) INT_MAX)
6754 goto overflow;
6755#endif
5835 /* The width specification is known to consist only 6756 /* The width specification is known to consist only
5836 of standard ASCII characters. */ 6757 of standard ASCII characters. */
5837 if (sizeof (FCHAR_T) == sizeof (TCHAR_T)) 6758 if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
@@ -5870,7 +6791,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5870 } 6791 }
5871 } 6792 }
5872 6793
5873 switch (type) 6794 switch (+type)
5874 { 6795 {
5875 case TYPE_LONGLONGINT: 6796 case TYPE_LONGLONGINT:
5876 case TYPE_ULONGLONGINT: 6797 case TYPE_ULONGLONGINT:
@@ -5984,9 +6905,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
5984 #if HAVE_WINT_T 6905 #if HAVE_WINT_T
5985 case TYPE_WIDE_CHAR: 6906 case TYPE_WIDE_CHAR:
5986 #endif 6907 #endif
5987 #if HAVE_WCHAR_T
5988 case TYPE_WIDE_STRING: 6908 case TYPE_WIDE_STRING:
5989 #endif
5990 *fbp++ = 'l'; 6909 *fbp++ = 'l';
5991 break; 6910 break;
5992 case TYPE_LONGDOUBLE: 6911 case TYPE_LONGDOUBLE:
@@ -6168,7 +7087,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6168#endif 7087#endif
6169 7088
6170 errno = 0; 7089 errno = 0;
6171 switch (type) 7090 switch (+type)
6172 { 7091 {
6173 case TYPE_SCHAR: 7092 case TYPE_SCHAR:
6174 { 7093 {
@@ -6358,14 +7277,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6358 SNPRINTF_BUF (arg); 7277 SNPRINTF_BUF (arg);
6359 } 7278 }
6360 break; 7279 break;
6361#if HAVE_WCHAR_T
6362 case TYPE_WIDE_STRING: 7280 case TYPE_WIDE_STRING:
6363 { 7281 {
6364 const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string; 7282 const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
6365 SNPRINTF_BUF (arg); 7283 SNPRINTF_BUF (arg);
6366 } 7284 }
6367 break; 7285 break;
6368#endif
6369 case TYPE_POINTER: 7286 case TYPE_POINTER:
6370 { 7287 {
6371 void *arg = a.arg[dp->arg_index].a.a_pointer; 7288 void *arg = a.arg[dp->arg_index].a.a_pointer;
@@ -6539,10 +7456,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6539 || *prec_ptr == ' ')) 7456 || *prec_ptr == ' '))
6540 prefix_count = 1; 7457 prefix_count = 1;
6541 /* Put the additional zeroes after the 0x prefix if 7458 /* Put the additional zeroes after the 0x prefix if
6542 (flags & FLAG_ALT) || (dp->conversion == 'p'). */ 7459 (flags & FLAG_ALT) || (dp->conversion == 'p'), or
7460 after the 0b prefix if (flags & FLAG_ALT). */
6543 else if (count >= 2 7461 else if (count >= 2
6544 && prec_ptr[0] == '0' 7462 && prec_ptr[0] == '0'
6545 && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X')) 7463 && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X'
7464 || prec_ptr[1] == 'b'
7465 || prec_ptr[1] == 'B'))
6546 prefix_count = 2; 7466 prefix_count = 2;
6547 7467
6548 move = count - prefix_count; 7468 move = count - prefix_count;
@@ -6591,6 +7511,135 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6591 } 7511 }
6592#endif 7512#endif
6593 7513
7514#if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION || NEED_PRINTF_FLAG_GROUPING || NEED_PRINTF_FLAG_GROUPING_INT
7515 if (group_ourselves) /* implies (flags & FLAG_GROUP) */
7516 /* Handle the grouping. */
7517 switch (dp->conversion)
7518 {
7519 /* These are the only conversion to which grouping
7520 applies. */
7521 case 'd': case 'i': case 'u':
7522 case 'f': case 'F': case 'g': case 'G':
7523 {
7524 /* Determine the thousands separator of the current
7525 locale. */
7526 const TCHAR_T *thousep;
7527 TCHAR_T thousep_buf[10];
7528
7529# if WIDE_CHAR_VERSION && DCHAR_IS_TCHAR
7530 /* TCHAR_T is wchar_t. */
7531 thousep = thousands_separator_wchar (thousep_buf);
7532# else
7533 /* TCHAR_T is char. */
7534 thousep = thousands_separator_char (thousep_buf);
7535# endif
7536
7537 /* Nothing to do in locales where thousep is the empty
7538 string. */
7539 if (*thousep != 0)
7540 {
7541 /* Since FLAG_LOCALIZED is only supported on glibc
7542 systems, here we can assume that all digits are
7543 the ASCII digits '0'..'9'. */
7544 TCHAR_T *number_ptr =
7545# if USE_SNPRINTF
7546 (TCHAR_T *) (result + length);
7547# else
7548 tmp;
7549# endif
7550 TCHAR_T *end_ptr = number_ptr + count;
7551
7552 /* Find where the leading digits start. */
7553 TCHAR_T *digits_ptr = number_ptr;
7554 if (count >= 1
7555 && (*digits_ptr == '-' || *digits_ptr == '+'
7556 || *digits_ptr == ' '))
7557 digits_ptr++;
7558
7559 /* Find where the leading digits end. */
7560 TCHAR_T *digits_end_ptr;
7561 switch (dp->conversion)
7562 {
7563 case 'd': case 'i': case 'u':
7564 digits_end_ptr = end_ptr;
7565 break;
7566 case 'f': case 'F': case 'g': case 'G':
7567 {
7568 TCHAR_T decimal_point = decimal_point_char ();
7569 for (digits_end_ptr = digits_ptr;
7570 digits_end_ptr < end_ptr;
7571 digits_end_ptr++)
7572 if (*digits_end_ptr == decimal_point
7573 || *digits_end_ptr == 'e')
7574 break;
7575 }
7576 break;
7577 }
7578
7579 /* Determine the number of thousands separators
7580 to insert. */
7581 const signed char *grouping = grouping_rule ();
7582 size_t insert =
7583 num_thousands_separators (grouping, digits_end_ptr - digits_ptr);
7584 if (insert > 0)
7585 {
7586# if WIDE_CHAR_VERSION && DCHAR_IS_TCHAR
7587# define thousep_len 1
7588# else
7589 size_t thousep_len = strlen (thousep);
7590# endif
7591# if USE_SNPRINTF
7592 size_t digits_offset = digits_ptr - number_ptr;
7593 size_t digits_end_offset = digits_end_ptr - number_ptr;
7594 size_t n =
7595 xsum (length,
7596 (count + insert * thousep_len + TCHARS_PER_DCHAR - 1)
7597 / TCHARS_PER_DCHAR);
7598 length += (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR;
7599 ENSURE_ALLOCATION (n);
7600 length -= (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR;
7601 number_ptr = (TCHAR_T *) (result + length);
7602 end_ptr = number_ptr + count;
7603 digits_ptr = number_ptr + digits_offset;
7604 digits_end_ptr = number_ptr + digits_end_offset;
7605# endif
7606
7607 count += insert * thousep_len;
7608
7609 const TCHAR_T *p = end_ptr;
7610 TCHAR_T *q = end_ptr + insert * thousep_len;
7611 while (p > digits_end_ptr)
7612 *--q = *--p;
7613 const signed char *g = grouping;
7614 for (;;)
7615 {
7616 int h = *g;
7617 if (h <= 0)
7618 abort ();
7619 int i = h;
7620 do
7621 *--q = *--p;
7622 while (--i > 0);
7623# if WIDE_CHAR_VERSION && DCHAR_IS_TCHAR
7624 *--q = *thousep;
7625# else
7626 q -= thousep_len;
7627 memcpy (q, thousep, thousep_len);
7628# endif
7629 insert--;
7630 if (insert == 0)
7631 break;
7632 if (g[1] != 0)
7633 g++;
7634 }
7635 /* Here q == p. Done with the insertions. */
7636 }
7637 }
7638 }
7639 break;
7640 }
7641#endif
7642
6594#if !USE_SNPRINTF 7643#if !USE_SNPRINTF
6595 if (count >= tmp_length) 7644 if (count >= tmp_length)
6596 /* tmp_length was incorrectly calculated - fix the 7645 /* tmp_length was incorrectly calculated - fix the
@@ -6601,6 +7650,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6601#if !DCHAR_IS_TCHAR 7650#if !DCHAR_IS_TCHAR
6602 /* Convert from TCHAR_T[] to DCHAR_T[]. */ 7651 /* Convert from TCHAR_T[] to DCHAR_T[]. */
6603 if (dp->conversion == 'c' || dp->conversion == 's' 7652 if (dp->conversion == 'c' || dp->conversion == 's'
7653 || (flags & FLAG_GROUP)
6604# if __GLIBC__ >= 2 && !defined __UCLIBC__ 7654# if __GLIBC__ >= 2 && !defined __UCLIBC__
6605 || (flags & FLAG_LOCALIZED) 7655 || (flags & FLAG_LOCALIZED)
6606# endif 7656# endif
@@ -6677,7 +7727,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6677 goto fail_with_errno; 7727 goto fail_with_errno;
6678# endif 7728# endif
6679 ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len), 7729 ENSURE_ALLOCATION_ELSE (xsum (length, tmpdst_len),
6680 { free (tmpdst); goto out_of_memory; }); 7730 { free (tmpdst); goto out_of_memory; });
6681 DCHAR_CPY (result + length, tmpdst, tmpdst_len); 7731 DCHAR_CPY (result + length, tmpdst, tmpdst_len);
6682 free (tmpdst); 7732 free (tmpdst);
6683 count = tmpdst_len; 7733 count = tmpdst_len;
@@ -6742,7 +7792,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6742 /* Here count <= allocated - length. */ 7792 /* Here count <= allocated - length. */
6743 7793
6744 /* Perform padding. */ 7794 /* 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 7795#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) 7796 if (pad_ourselves && has_width)
6747 { 7797 {
6748 size_t w; 7798 size_t w;
@@ -6751,6 +7801,23 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6751 against the number of _characters_ of the converted 7801 against the number of _characters_ of the converted
6752 value. */ 7802 value. */
6753 w = DCHAR_MBSNLEN (result + length, count); 7803 w = DCHAR_MBSNLEN (result + length, count);
7804# elif __GLIBC__ >= 2
7805 /* glibc prefers to compare the width against the number
7806 of characters as well, but only for numeric conversion
7807 specifiers. See
7808 <https://sourceware.org/bugzilla/show_bug.cgi?id=28943>
7809 <https://sourceware.org/bugzilla/show_bug.cgi?id=30883>
7810 <https://sourceware.org/bugzilla/show_bug.cgi?id=31542> */
7811 switch (dp->conversion)
7812 {
7813 case 'd': case 'i': case 'u':
7814 case 'f': case 'F': case 'g': case 'G':
7815 w = DCHAR_MBSNLEN (result + length, count);
7816 break;
7817 default:
7818 w = count;
7819 break;
7820 }
6754# else 7821# else
6755 /* The width is compared against the number of _bytes_ 7822 /* The width is compared against the number of _bytes_
6756 of the converted value, says POSIX. */ 7823 of the converted value, says POSIX. */
@@ -6929,17 +7996,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
6929 not have this limitation. */ 7996 not have this limitation. */
6930 return result; 7997 return result;
6931 7998
6932#if USE_SNPRINTF
6933 overflow: 7999 overflow:
6934 errno = EOVERFLOW; 8000 errno = EOVERFLOW;
6935 goto fail_with_errno; 8001 goto fail_with_errno;
6936#endif
6937 8002
6938 out_of_memory: 8003 out_of_memory:
6939 errno = ENOMEM; 8004 errno = ENOMEM;
6940 goto fail_with_errno; 8005 goto fail_with_errno;
6941 8006
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) 8007#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: 8008 fail_with_EILSEQ:
6944 errno = EILSEQ; 8009 errno = EILSEQ;
6945 goto fail_with_errno; 8010 goto fail_with_errno;
diff --git a/gl/vasnprintf.h b/gl/vasnprintf.h
index 7ed9145c..ccd60e5e 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-2025 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..30aa4469 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-2025 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..3b01d7c2 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-2025 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..d3d7ef7a 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-2025 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..f6e6b1d4
--- /dev/null
+++ b/gl/vsnzprintf.c
@@ -0,0 +1,65 @@
1/* Formatted output to strings.
2 Copyright (C) 2004, 2006-2025 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 char *output;
37 size_t len;
38 size_t lenbuf = size;
39
40 output = vasnprintf (str, &lenbuf, format, args);
41 len = lenbuf;
42
43 if (!output)
44 return -1;
45
46 if (output != str)
47 {
48 if (size)
49 {
50 size_t pruned_len = (len < size ? len : size - 1);
51 memcpy (str, output, pruned_len);
52 str[pruned_len] = '\0';
53 }
54
55 free (output);
56 }
57
58 if (len > PTRDIFF_MAX)
59 {
60 errno = ENOMEM;
61 return -1;
62 }
63
64 return len;
65}
diff --git a/gl/w32sock.h b/gl/w32sock.h
index 166a5f77..d7087a28 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-2025 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..c0072412 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-2025 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..a6c52eb9 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-2025 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
@@ -37,7 +37,7 @@
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) 40 || defined _@GUARD_PREFIX@_ALREADY_INCLUDING_WCHAR_H)
41/* Special invocation convention: 41/* Special invocation convention:
42 - Inside glibc and uClibc header files, but not MinGW. 42 - Inside glibc and uClibc header files, but not MinGW.
43 - On HP-UX 11.00 we have a sequence of nested includes 43 - On HP-UX 11.00 we have a sequence of nested includes
@@ -53,13 +53,16 @@
53 <wctype.h> is completely included or is still being included. */ 53 <wctype.h> is completely included or is still being included. */
54 54
55#@INCLUDE_NEXT@ @NEXT_WCHAR_H@ 55#@INCLUDE_NEXT@ @NEXT_WCHAR_H@
56/* The glibc 2.5 /usr/include/wchar.h defines __need_wint_t but never undefines
57 it. We need to do that here. */
58#undef __need_wint_t
56 59
57#else 60#else
58/* Normal invocation convention. */ 61/* Normal invocation convention. */
59 62
60#ifndef _@GUARD_PREFIX@_WCHAR_H 63#ifndef _@GUARD_PREFIX@_WCHAR_H
61 64
62#define _GL_ALREADY_INCLUDING_WCHAR_H 65#define _@GUARD_PREFIX@_ALREADY_INCLUDING_WCHAR_H
63 66
64#if @HAVE_FEATURES_H@ 67#if @HAVE_FEATURES_H@
65# include <features.h> /* for __GLIBC__ */ 68# include <features.h> /* for __GLIBC__ */
@@ -79,7 +82,7 @@
79# @INCLUDE_NEXT@ @NEXT_WCHAR_H@ 82# @INCLUDE_NEXT@ @NEXT_WCHAR_H@
80#endif 83#endif
81 84
82#undef _GL_ALREADY_INCLUDING_WCHAR_H 85#undef _@GUARD_PREFIX@_ALREADY_INCLUDING_WCHAR_H
83 86
84#ifndef _@GUARD_PREFIX@_WCHAR_H 87#ifndef _@GUARD_PREFIX@_WCHAR_H
85#define _@GUARD_PREFIX@_WCHAR_H 88#define _@GUARD_PREFIX@_WCHAR_H
@@ -95,7 +98,7 @@
95 that can be freed by passing them as the Ith argument to the 98 that can be freed by passing them as the Ith argument to the
96 function F. */ 99 function F. */
97#ifndef _GL_ATTRIBUTE_DEALLOC 100#ifndef _GL_ATTRIBUTE_DEALLOC
98# if __GNUC__ >= 11 101# if __GNUC__ >= 11 && !defined __clang__
99# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) 102# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
100# else 103# else
101# define _GL_ATTRIBUTE_DEALLOC(f, i) 104# define _GL_ATTRIBUTE_DEALLOC(f, i)
@@ -137,11 +140,23 @@
137# endif 140# endif
138#endif 141#endif
139 142
143/* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP
144 (a pointer) must not be NULL if the argument NI (an integer) is != 0. */
145/* Applies to: functions. */
146#ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO
147# if __GNUC__ >= 15 && !defined __clang__
148# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) \
149 __attribute__ ((__nonnull_if_nonzero__ (np, ni)))
150# else
151# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni)
152# endif
153#endif
154
140/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. 155/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
141 */ 156 */
142#ifndef _GL_ATTRIBUTE_NOTHROW 157#ifndef _GL_ATTRIBUTE_NOTHROW
143# if defined __cplusplus 158# if defined __cplusplus
144# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major >= 4 159# if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 2) || __clang_major__ >= 4
145# if __cplusplus >= 201103L 160# if __cplusplus >= 201103L
146# define _GL_ATTRIBUTE_NOTHROW noexcept (true) 161# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
147# else 162# else
@@ -198,11 +213,12 @@ typedef unsigned int rpl_wint_t;
198/* Override mbstate_t if it is too small. 213/* Override mbstate_t if it is too small.
199 On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for 214 On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
200 implementing mbrtowc for encodings like UTF-8. 215 implementing mbrtowc for encodings like UTF-8.
201 On AIX and MSVC, mbrtowc needs to be overridden, but mbstate_t exists and is 216 On AIX, MSVC, and OpenBSD 6.0, mbrtowc needs to be overridden, but
202 large enough and overriding it would cause problems in C++ mode. */ 217 mbstate_t exists and is large enough and overriding it would cause problems
218 in C++ mode. */
203#if !(((defined _WIN32 && !defined __CYGWIN__) || @HAVE_MBSINIT@) && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@ 219#if !(((defined _WIN32 && !defined __CYGWIN__) || @HAVE_MBSINIT@) && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
204# if !GNULIB_defined_mbstate_t 220# if !GNULIB_defined_mbstate_t
205# if !(defined _AIX || defined _MSC_VER) 221# if !(defined _AIX || defined _MSC_VER || defined __OpenBSD__)
206typedef int rpl_mbstate_t; 222typedef int rpl_mbstate_t;
207# undef mbstate_t 223# undef mbstate_t
208# define mbstate_t rpl_mbstate_t 224# define mbstate_t rpl_mbstate_t
@@ -262,6 +278,55 @@ _GL_EXTERN_C void free (void *);
262#endif 278#endif
263 279
264 280
281/* Declarations for ISO C N3322. */
282#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
283_GL_EXTERN_C wchar_t *wmemcpy (wchar_t *__dest, const wchar_t *__src, size_t __n)
284# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
285 _GL_ATTRIBUTE_NOTHROW
286# endif
287 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
288 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
289_GL_EXTERN_C wchar_t *wmemmove (wchar_t *__dest, const wchar_t *__src, size_t __n)
290# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
291 _GL_ATTRIBUTE_NOTHROW
292# endif
293 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
294 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
295_GL_EXTERN_C wchar_t *wcsncpy (wchar_t *__dest, const wchar_t *__src, size_t __n)
296# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
297 _GL_ATTRIBUTE_NOTHROW
298# endif
299 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
300 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
301_GL_EXTERN_C wchar_t *wcsncat (wchar_t *__dest, const wchar_t *__src, size_t __n)
302# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
303 _GL_ATTRIBUTE_NOTHROW
304# endif
305 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
306_GL_EXTERN_C int wmemcmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
307# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
308 _GL_ATTRIBUTE_NOTHROW
309# endif
310 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
311 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
312_GL_EXTERN_C int wcsncmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
313# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
314 _GL_ATTRIBUTE_NOTHROW
315# endif
316 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
317 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3);
318# ifndef __cplusplus
319_GL_EXTERN_C wchar_t *wmemchr (const wchar_t *__s, wchar_t __wc, size_t __n)
320 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3);
321# endif
322_GL_EXTERN_C wchar_t *wmemset (wchar_t *__s, wchar_t __wc, size_t __n)
323# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
324 _GL_ATTRIBUTE_NOTHROW
325# endif
326 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3);
327#endif
328
329
265/* Convert a single-byte character to a wide character. */ 330/* Convert a single-byte character to a wide character. */
266#if @GNULIB_BTOWC@ 331#if @GNULIB_BTOWC@
267# if @REPLACE_BTOWC@ 332# if @REPLACE_BTOWC@
@@ -269,11 +334,11 @@ _GL_EXTERN_C void free (void *);
269# undef btowc 334# undef btowc
270# define btowc rpl_btowc 335# define btowc rpl_btowc
271# endif 336# endif
272_GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); 337_GL_FUNCDECL_RPL (btowc, wint_t, (int c), _GL_ATTRIBUTE_PURE);
273_GL_CXXALIAS_RPL (btowc, wint_t, (int c)); 338_GL_CXXALIAS_RPL (btowc, wint_t, (int c));
274# else 339# else
275# if !@HAVE_BTOWC@ 340# if !@HAVE_BTOWC@
276_GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE); 341_GL_FUNCDECL_SYS (btowc, wint_t, (int c), _GL_ATTRIBUTE_PURE);
277# endif 342# endif
278/* Need to cast, because on mingw, the return type is 'unsigned short'. */ 343/* Need to cast, because on mingw, the return type is 'unsigned short'. */
279_GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c)); 344_GL_CXXALIAS_SYS_CAST (btowc, wint_t, (int c));
@@ -297,12 +362,12 @@ _GL_WARN_ON_USE (btowc, "btowc is unportable - "
297# undef wctob 362# undef wctob
298# define wctob rpl_wctob 363# define wctob rpl_wctob
299# endif 364# endif
300_GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE); 365_GL_FUNCDECL_RPL (wctob, int, (wint_t wc), _GL_ATTRIBUTE_PURE);
301_GL_CXXALIAS_RPL (wctob, int, (wint_t wc)); 366_GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
302# else 367# else
303# if !defined wctob && !@HAVE_DECL_WCTOB@ 368# if !defined wctob && !@HAVE_DECL_WCTOB@
304/* wctob is provided by gnulib, or wctob exists but is not declared. */ 369/* wctob is provided by gnulib, or wctob exists but is not declared. */
305_GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE); 370_GL_FUNCDECL_SYS (wctob, int, (wint_t wc), _GL_ATTRIBUTE_PURE);
306# endif 371# endif
307_GL_CXXALIAS_SYS (wctob, int, (wint_t wc)); 372_GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
308# endif 373# endif
@@ -325,11 +390,11 @@ _GL_WARN_ON_USE (wctob, "wctob is unportable - "
325# undef mbsinit 390# undef mbsinit
326# define mbsinit rpl_mbsinit 391# define mbsinit rpl_mbsinit
327# endif 392# endif
328_GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps)); 393_GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps), );
329_GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps)); 394_GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps));
330# else 395# else
331# if !@HAVE_MBSINIT@ 396# if !@HAVE_MBSINIT@
332_GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps)); 397_GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps), );
333# endif 398# endif
334_GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps)); 399_GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
335# endif 400# endif
@@ -531,16 +596,19 @@ _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
531# define _GL_MBSTATE_ZERO_SIZE sizeof (mbstate_t) 596# define _GL_MBSTATE_ZERO_SIZE sizeof (mbstate_t)
532# endif 597# endif
533_GL_BEGIN_C_LINKAGE 598_GL_BEGIN_C_LINKAGE
534# if defined IN_MBSZERO 599# if !GNULIB_defined_mbszero
600# if defined IN_MBSZERO
535_GL_EXTERN_INLINE 601_GL_EXTERN_INLINE
536# else 602# else
537_GL_INLINE 603_GL_INLINE
538# endif 604# endif
539_GL_ARG_NONNULL ((1)) void 605_GL_ARG_NONNULL ((1)) void
540mbszero (mbstate_t *ps) 606mbszero (mbstate_t *ps)
541{ 607{
542 memset (ps, 0, _GL_MBSTATE_ZERO_SIZE); 608 memset (ps, 0, _GL_MBSTATE_ZERO_SIZE);
543} 609}
610# define GNULIB_defined_mbszero 1
611# endif
544_GL_END_C_LINKAGE 612_GL_END_C_LINKAGE
545_GL_CXXALIAS_SYS (mbszero, void, (mbstate_t *ps)); 613_GL_CXXALIAS_SYS (mbszero, void, (mbstate_t *ps));
546_GL_CXXALIASWARN (mbszero); 614_GL_CXXALIASWARN (mbszero);
@@ -556,7 +624,7 @@ _GL_CXXALIASWARN (mbszero);
556# endif 624# endif
557_GL_FUNCDECL_RPL (mbrtowc, size_t, 625_GL_FUNCDECL_RPL (mbrtowc, size_t,
558 (wchar_t *restrict pwc, const char *restrict s, size_t n, 626 (wchar_t *restrict pwc, const char *restrict s, size_t n,
559 mbstate_t *restrict ps)); 627 mbstate_t *restrict ps), );
560_GL_CXXALIAS_RPL (mbrtowc, size_t, 628_GL_CXXALIAS_RPL (mbrtowc, size_t,
561 (wchar_t *restrict pwc, const char *restrict s, size_t n, 629 (wchar_t *restrict pwc, const char *restrict s, size_t n,
562 mbstate_t *restrict ps)); 630 mbstate_t *restrict ps));
@@ -564,7 +632,7 @@ _GL_CXXALIAS_RPL (mbrtowc, size_t,
564# if !@HAVE_MBRTOWC@ 632# if !@HAVE_MBRTOWC@
565_GL_FUNCDECL_SYS (mbrtowc, size_t, 633_GL_FUNCDECL_SYS (mbrtowc, size_t,
566 (wchar_t *restrict pwc, const char *restrict s, size_t n, 634 (wchar_t *restrict pwc, const char *restrict s, size_t n,
567 mbstate_t *restrict ps)); 635 mbstate_t *restrict ps), );
568# endif 636# endif
569_GL_CXXALIAS_SYS (mbrtowc, size_t, 637_GL_CXXALIAS_SYS (mbrtowc, size_t,
570 (wchar_t *restrict pwc, const char *restrict s, size_t n, 638 (wchar_t *restrict pwc, const char *restrict s, size_t n,
@@ -590,13 +658,13 @@ _GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
590# define mbrlen rpl_mbrlen 658# define mbrlen rpl_mbrlen
591# endif 659# endif
592_GL_FUNCDECL_RPL (mbrlen, size_t, 660_GL_FUNCDECL_RPL (mbrlen, size_t,
593 (const char *restrict s, size_t n, mbstate_t *restrict ps)); 661 (const char *restrict s, size_t n, mbstate_t *restrict ps), );
594_GL_CXXALIAS_RPL (mbrlen, size_t, 662_GL_CXXALIAS_RPL (mbrlen, size_t,
595 (const char *restrict s, size_t n, mbstate_t *restrict ps)); 663 (const char *restrict s, size_t n, mbstate_t *restrict ps));
596# else 664# else
597# if !@HAVE_MBRLEN@ 665# if !@HAVE_MBRLEN@
598_GL_FUNCDECL_SYS (mbrlen, size_t, 666_GL_FUNCDECL_SYS (mbrlen, size_t,
599 (const char *restrict s, size_t n, mbstate_t *restrict ps)); 667 (const char *restrict s, size_t n, mbstate_t *restrict ps), );
600# endif 668# endif
601_GL_CXXALIAS_SYS (mbrlen, size_t, 669_GL_CXXALIAS_SYS (mbrlen, size_t,
602 (const char *restrict s, size_t n, mbstate_t *restrict ps)); 670 (const char *restrict s, size_t n, mbstate_t *restrict ps));
@@ -623,7 +691,7 @@ _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
623_GL_FUNCDECL_RPL (mbsrtowcs, size_t, 691_GL_FUNCDECL_RPL (mbsrtowcs, size_t,
624 (wchar_t *restrict dest, 692 (wchar_t *restrict dest,
625 const char **restrict srcp, size_t len, 693 const char **restrict srcp, size_t len,
626 mbstate_t *restrict ps) 694 mbstate_t *restrict ps),
627 _GL_ARG_NONNULL ((2))); 695 _GL_ARG_NONNULL ((2)));
628_GL_CXXALIAS_RPL (mbsrtowcs, size_t, 696_GL_CXXALIAS_RPL (mbsrtowcs, size_t,
629 (wchar_t *restrict dest, 697 (wchar_t *restrict dest,
@@ -634,7 +702,7 @@ _GL_CXXALIAS_RPL (mbsrtowcs, size_t,
634_GL_FUNCDECL_SYS (mbsrtowcs, size_t, 702_GL_FUNCDECL_SYS (mbsrtowcs, size_t,
635 (wchar_t *restrict dest, 703 (wchar_t *restrict dest,
636 const char **restrict srcp, size_t len, 704 const char **restrict srcp, size_t len,
637 mbstate_t *restrict ps) 705 mbstate_t *restrict ps),
638 _GL_ARG_NONNULL ((2))); 706 _GL_ARG_NONNULL ((2)));
639# endif 707# endif
640_GL_CXXALIAS_SYS (mbsrtowcs, size_t, 708_GL_CXXALIAS_SYS (mbsrtowcs, size_t,
@@ -664,7 +732,7 @@ _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
664_GL_FUNCDECL_RPL (mbsnrtowcs, size_t, 732_GL_FUNCDECL_RPL (mbsnrtowcs, size_t,
665 (wchar_t *restrict dest, 733 (wchar_t *restrict dest,
666 const char **restrict srcp, size_t srclen, size_t len, 734 const char **restrict srcp, size_t srclen, size_t len,
667 mbstate_t *restrict ps) 735 mbstate_t *restrict ps),
668 _GL_ARG_NONNULL ((2))); 736 _GL_ARG_NONNULL ((2)));
669_GL_CXXALIAS_RPL (mbsnrtowcs, size_t, 737_GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
670 (wchar_t *restrict dest, 738 (wchar_t *restrict dest,
@@ -675,7 +743,7 @@ _GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
675_GL_FUNCDECL_SYS (mbsnrtowcs, size_t, 743_GL_FUNCDECL_SYS (mbsnrtowcs, size_t,
676 (wchar_t *restrict dest, 744 (wchar_t *restrict dest,
677 const char **restrict srcp, size_t srclen, size_t len, 745 const char **restrict srcp, size_t srclen, size_t len,
678 mbstate_t *restrict ps) 746 mbstate_t *restrict ps),
679 _GL_ARG_NONNULL ((2))); 747 _GL_ARG_NONNULL ((2)));
680# endif 748# endif
681_GL_CXXALIAS_SYS (mbsnrtowcs, size_t, 749_GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
@@ -703,13 +771,13 @@ _GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
703# define wcrtomb rpl_wcrtomb 771# define wcrtomb rpl_wcrtomb
704# endif 772# endif
705_GL_FUNCDECL_RPL (wcrtomb, size_t, 773_GL_FUNCDECL_RPL (wcrtomb, size_t,
706 (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); 774 (char *restrict s, wchar_t wc, mbstate_t *restrict ps), );
707_GL_CXXALIAS_RPL (wcrtomb, size_t, 775_GL_CXXALIAS_RPL (wcrtomb, size_t,
708 (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); 776 (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
709# else 777# else
710# if !@HAVE_WCRTOMB@ 778# if !@HAVE_WCRTOMB@
711_GL_FUNCDECL_SYS (wcrtomb, size_t, 779_GL_FUNCDECL_SYS (wcrtomb, size_t,
712 (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); 780 (char *restrict s, wchar_t wc, mbstate_t *restrict ps), );
713# endif 781# endif
714_GL_CXXALIAS_SYS (wcrtomb, size_t, 782_GL_CXXALIAS_SYS (wcrtomb, size_t,
715 (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); 783 (char *restrict s, wchar_t wc, mbstate_t *restrict ps));
@@ -736,7 +804,7 @@ _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
736_GL_FUNCDECL_RPL (wcsrtombs, size_t, 804_GL_FUNCDECL_RPL (wcsrtombs, size_t,
737 (char *restrict dest, const wchar_t **restrict srcp, 805 (char *restrict dest, const wchar_t **restrict srcp,
738 size_t len, 806 size_t len,
739 mbstate_t *restrict ps) 807 mbstate_t *restrict ps),
740 _GL_ARG_NONNULL ((2))); 808 _GL_ARG_NONNULL ((2)));
741_GL_CXXALIAS_RPL (wcsrtombs, size_t, 809_GL_CXXALIAS_RPL (wcsrtombs, size_t,
742 (char *restrict dest, const wchar_t **restrict srcp, 810 (char *restrict dest, const wchar_t **restrict srcp,
@@ -747,7 +815,7 @@ _GL_CXXALIAS_RPL (wcsrtombs, size_t,
747_GL_FUNCDECL_SYS (wcsrtombs, size_t, 815_GL_FUNCDECL_SYS (wcsrtombs, size_t,
748 (char *restrict dest, const wchar_t **restrict srcp, 816 (char *restrict dest, const wchar_t **restrict srcp,
749 size_t len, 817 size_t len,
750 mbstate_t *restrict ps) 818 mbstate_t *restrict ps),
751 _GL_ARG_NONNULL ((2))); 819 _GL_ARG_NONNULL ((2)));
752# endif 820# endif
753_GL_CXXALIAS_SYS (wcsrtombs, size_t, 821_GL_CXXALIAS_SYS (wcsrtombs, size_t,
@@ -778,7 +846,7 @@ _GL_FUNCDECL_RPL (wcsnrtombs, size_t,
778 (char *restrict dest, 846 (char *restrict dest,
779 const wchar_t **restrict srcp, size_t srclen, 847 const wchar_t **restrict srcp, size_t srclen,
780 size_t len, 848 size_t len,
781 mbstate_t *restrict ps) 849 mbstate_t *restrict ps),
782 _GL_ARG_NONNULL ((2))); 850 _GL_ARG_NONNULL ((2)));
783_GL_CXXALIAS_RPL (wcsnrtombs, size_t, 851_GL_CXXALIAS_RPL (wcsnrtombs, size_t,
784 (char *restrict dest, 852 (char *restrict dest,
@@ -791,7 +859,7 @@ _GL_FUNCDECL_SYS (wcsnrtombs, size_t,
791 (char *restrict dest, 859 (char *restrict dest,
792 const wchar_t **restrict srcp, size_t srclen, 860 const wchar_t **restrict srcp, size_t srclen,
793 size_t len, 861 size_t len,
794 mbstate_t *restrict ps) 862 mbstate_t *restrict ps),
795 _GL_ARG_NONNULL ((2))); 863 _GL_ARG_NONNULL ((2)));
796# endif 864# endif
797_GL_CXXALIAS_SYS (wcsnrtombs, size_t, 865_GL_CXXALIAS_SYS (wcsnrtombs, size_t,
@@ -819,12 +887,12 @@ _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
819# undef wcwidth 887# undef wcwidth
820# define wcwidth rpl_wcwidth 888# define wcwidth rpl_wcwidth
821# endif 889# endif
822_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); 890_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t), _GL_ATTRIBUTE_PURE);
823_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t)); 891_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
824# else 892# else
825# if !@HAVE_DECL_WCWIDTH@ 893# if !@HAVE_DECL_WCWIDTH@
826/* wcwidth exists but is not declared. */ 894/* wcwidth exists but is not declared. */
827_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE); 895_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t), _GL_ATTRIBUTE_PURE);
828# endif 896# endif
829_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t)); 897_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
830# endif 898# endif
@@ -843,8 +911,9 @@ _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
843/* Search N wide characters of S for C. */ 911/* Search N wide characters of S for C. */
844#if @GNULIB_WMEMCHR@ 912#if @GNULIB_WMEMCHR@
845# if !@HAVE_WMEMCHR@ 913# if !@HAVE_WMEMCHR@
846_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n) 914_GL_FUNCDECL_SYS (wmemchr, wchar_t *,
847 _GL_ATTRIBUTE_PURE); 915 (const wchar_t *s, wchar_t c, size_t n),
916 _GL_ATTRIBUTE_PURE _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3));
848# endif 917# endif
849 /* On some systems, this function is defined as an overloaded function: 918 /* On some systems, this function is defined as an overloaded function:
850 extern "C++" { 919 extern "C++" {
@@ -855,11 +924,12 @@ _GL_CXXALIAS_SYS_CAST2 (wmemchr,
855 wchar_t *, (const wchar_t *, wchar_t, size_t), 924 wchar_t *, (const wchar_t *, wchar_t, size_t),
856 const wchar_t *, (const wchar_t *, wchar_t, size_t)); 925 const wchar_t *, (const wchar_t *, wchar_t, size_t));
857# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 926# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
858 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 927 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) \
928 && !defined __clang__
859_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); 929_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
860_GL_CXXALIASWARN1 (wmemchr, const wchar_t *, 930_GL_CXXALIASWARN1 (wmemchr, const wchar_t *,
861 (const wchar_t *s, wchar_t c, size_t n)); 931 (const wchar_t *s, wchar_t c, size_t n));
862# elif __GLIBC__ >= 2 932# elif __GLIBC__ >= 2 && !defined __CORRECT_ISO_CPP_WCHAR_H_PROTO
863_GL_CXXALIASWARN (wmemchr); 933_GL_CXXALIASWARN (wmemchr);
864# endif 934# endif
865#elif defined GNULIB_POSIXCHECK 935#elif defined GNULIB_POSIXCHECK
@@ -879,15 +949,19 @@ _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
879# define wmemcmp rpl_wmemcmp 949# define wmemcmp rpl_wmemcmp
880# endif 950# endif
881_GL_FUNCDECL_RPL (wmemcmp, int, 951_GL_FUNCDECL_RPL (wmemcmp, int,
882 (const wchar_t *s1, const wchar_t *s2, size_t n) 952 (const wchar_t *s1, const wchar_t *s2, size_t n),
883 _GL_ATTRIBUTE_PURE); 953 _GL_ATTRIBUTE_PURE
954 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
955 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
884_GL_CXXALIAS_RPL (wmemcmp, int, 956_GL_CXXALIAS_RPL (wmemcmp, int,
885 (const wchar_t *s1, const wchar_t *s2, size_t n)); 957 (const wchar_t *s1, const wchar_t *s2, size_t n));
886# else 958# else
887# if !@HAVE_WMEMCMP@ 959# if !@HAVE_WMEMCMP@
888_GL_FUNCDECL_SYS (wmemcmp, int, 960_GL_FUNCDECL_SYS (wmemcmp, int,
889 (const wchar_t *s1, const wchar_t *s2, size_t n) 961 (const wchar_t *s1, const wchar_t *s2, size_t n),
890 _GL_ATTRIBUTE_PURE); 962 _GL_ATTRIBUTE_PURE
963 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
964 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
891# endif 965# endif
892_GL_CXXALIAS_SYS (wmemcmp, int, 966_GL_CXXALIAS_SYS (wmemcmp, int,
893 (const wchar_t *s1, const wchar_t *s2, size_t n)); 967 (const wchar_t *s1, const wchar_t *s2, size_t n));
@@ -909,7 +983,9 @@ _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
909# if !@HAVE_WMEMCPY@ 983# if !@HAVE_WMEMCPY@
910_GL_FUNCDECL_SYS (wmemcpy, wchar_t *, 984_GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
911 (wchar_t *restrict dest, 985 (wchar_t *restrict dest,
912 const wchar_t *restrict src, size_t n)); 986 const wchar_t *restrict src, size_t n),
987 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
988 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
913# endif 989# endif
914_GL_CXXALIAS_SYS (wmemcpy, wchar_t *, 990_GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
915 (wchar_t *restrict dest, 991 (wchar_t *restrict dest,
@@ -931,7 +1007,9 @@ _GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - "
931#if @GNULIB_WMEMMOVE@ 1007#if @GNULIB_WMEMMOVE@
932# if !@HAVE_WMEMMOVE@ 1008# if !@HAVE_WMEMMOVE@
933_GL_FUNCDECL_SYS (wmemmove, wchar_t *, 1009_GL_FUNCDECL_SYS (wmemmove, wchar_t *,
934 (wchar_t *dest, const wchar_t *src, size_t n)); 1010 (wchar_t *dest, const wchar_t *src, size_t n),
1011 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
1012 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
935# endif 1013# endif
936_GL_CXXALIAS_SYS (wmemmove, wchar_t *, 1014_GL_CXXALIAS_SYS (wmemmove, wchar_t *,
937 (wchar_t *dest, const wchar_t *src, size_t n)); 1015 (wchar_t *dest, const wchar_t *src, size_t n));
@@ -957,7 +1035,7 @@ _GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
957# endif 1035# endif
958_GL_FUNCDECL_RPL (wmempcpy, wchar_t *, 1036_GL_FUNCDECL_RPL (wmempcpy, wchar_t *,
959 (wchar_t *restrict dest, 1037 (wchar_t *restrict dest,
960 const wchar_t *restrict src, size_t n)); 1038 const wchar_t *restrict src, size_t n), );
961_GL_CXXALIAS_RPL (wmempcpy, wchar_t *, 1039_GL_CXXALIAS_RPL (wmempcpy, wchar_t *,
962 (wchar_t *restrict dest, 1040 (wchar_t *restrict dest,
963 const wchar_t *restrict src, size_t n)); 1041 const wchar_t *restrict src, size_t n));
@@ -965,7 +1043,7 @@ _GL_CXXALIAS_RPL (wmempcpy, wchar_t *,
965# if !@HAVE_WMEMPCPY@ 1043# if !@HAVE_WMEMPCPY@
966_GL_FUNCDECL_SYS (wmempcpy, wchar_t *, 1044_GL_FUNCDECL_SYS (wmempcpy, wchar_t *,
967 (wchar_t *restrict dest, 1045 (wchar_t *restrict dest,
968 const wchar_t *restrict src, size_t n)); 1046 const wchar_t *restrict src, size_t n), );
969# endif 1047# endif
970_GL_CXXALIAS_SYS (wmempcpy, wchar_t *, 1048_GL_CXXALIAS_SYS (wmempcpy, wchar_t *,
971 (wchar_t *restrict dest, 1049 (wchar_t *restrict dest,
@@ -986,7 +1064,8 @@ _GL_WARN_ON_USE (wmempcpy, "wmempcpy is unportable - "
986/* Set N wide characters of S to C. */ 1064/* Set N wide characters of S to C. */
987#if @GNULIB_WMEMSET@ 1065#if @GNULIB_WMEMSET@
988# if !@HAVE_WMEMSET@ 1066# if !@HAVE_WMEMSET@
989_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); 1067_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n),
1068 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3));
990# endif 1069# endif
991_GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n)); 1070_GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
992# if __GLIBC__ >= 2 1071# if __GLIBC__ >= 2
@@ -1004,7 +1083,7 @@ _GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
1004/* Return the number of wide characters in S. */ 1083/* Return the number of wide characters in S. */
1005#if @GNULIB_WCSLEN@ 1084#if @GNULIB_WCSLEN@
1006# if !@HAVE_WCSLEN@ 1085# if !@HAVE_WCSLEN@
1007_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE); 1086_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s), _GL_ATTRIBUTE_PURE);
1008# endif 1087# endif
1009_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s)); 1088_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
1010# if __GLIBC__ >= 2 1089# if __GLIBC__ >= 2
@@ -1025,7 +1104,7 @@ _GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
1025 namespace, not in the global namespace. So, force a declaration in 1104 namespace, not in the global namespace. So, force a declaration in
1026 the global namespace. */ 1105 the global namespace. */
1027# if !@HAVE_WCSNLEN@ || (defined __sun && defined __cplusplus) 1106# if !@HAVE_WCSNLEN@ || (defined __sun && defined __cplusplus)
1028_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen) 1107_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen),
1029 _GL_ATTRIBUTE_PURE); 1108 _GL_ATTRIBUTE_PURE);
1030# endif 1109# endif
1031_GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)); 1110_GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
@@ -1043,7 +1122,7 @@ _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
1043#if @GNULIB_WCSCPY@ 1122#if @GNULIB_WCSCPY@
1044# if !@HAVE_WCSCPY@ 1123# if !@HAVE_WCSCPY@
1045_GL_FUNCDECL_SYS (wcscpy, wchar_t *, 1124_GL_FUNCDECL_SYS (wcscpy, wchar_t *,
1046 (wchar_t *restrict dest, const wchar_t *restrict src)); 1125 (wchar_t *restrict dest, const wchar_t *restrict src), );
1047# endif 1126# endif
1048_GL_CXXALIAS_SYS (wcscpy, wchar_t *, 1127_GL_CXXALIAS_SYS (wcscpy, wchar_t *,
1049 (wchar_t *restrict dest, const wchar_t *restrict src)); 1128 (wchar_t *restrict dest, const wchar_t *restrict src));
@@ -1066,7 +1145,7 @@ _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
1066 the global namespace. */ 1145 the global namespace. */
1067# if !@HAVE_WCPCPY@ || (defined __sun && defined __cplusplus) 1146# if !@HAVE_WCPCPY@ || (defined __sun && defined __cplusplus)
1068_GL_FUNCDECL_SYS (wcpcpy, wchar_t *, 1147_GL_FUNCDECL_SYS (wcpcpy, wchar_t *,
1069 (wchar_t *restrict dest, const wchar_t *restrict src)); 1148 (wchar_t *restrict dest, const wchar_t *restrict src), );
1070# endif 1149# endif
1071_GL_CXXALIAS_SYS (wcpcpy, wchar_t *, 1150_GL_CXXALIAS_SYS (wcpcpy, wchar_t *,
1072 (wchar_t *restrict dest, const wchar_t *restrict src)); 1151 (wchar_t *restrict dest, const wchar_t *restrict src));
@@ -1085,7 +1164,9 @@ _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
1085# if !@HAVE_WCSNCPY@ 1164# if !@HAVE_WCSNCPY@
1086_GL_FUNCDECL_SYS (wcsncpy, wchar_t *, 1165_GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
1087 (wchar_t *restrict dest, 1166 (wchar_t *restrict dest,
1088 const wchar_t *restrict src, size_t n)); 1167 const wchar_t *restrict src, size_t n),
1168 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
1169 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
1089# endif 1170# endif
1090_GL_CXXALIAS_SYS (wcsncpy, wchar_t *, 1171_GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
1091 (wchar_t *restrict dest, 1172 (wchar_t *restrict dest,
@@ -1111,7 +1192,7 @@ _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
1111# if !@HAVE_WCPNCPY@ || (defined __sun && defined __cplusplus) 1192# if !@HAVE_WCPNCPY@ || (defined __sun && defined __cplusplus)
1112_GL_FUNCDECL_SYS (wcpncpy, wchar_t *, 1193_GL_FUNCDECL_SYS (wcpncpy, wchar_t *,
1113 (wchar_t *restrict dest, 1194 (wchar_t *restrict dest,
1114 const wchar_t *restrict src, size_t n)); 1195 const wchar_t *restrict src, size_t n), );
1115# endif 1196# endif
1116_GL_CXXALIAS_SYS (wcpncpy, wchar_t *, 1197_GL_CXXALIAS_SYS (wcpncpy, wchar_t *,
1117 (wchar_t *restrict dest, 1198 (wchar_t *restrict dest,
@@ -1130,7 +1211,7 @@ _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
1130#if @GNULIB_WCSCAT@ 1211#if @GNULIB_WCSCAT@
1131# if !@HAVE_WCSCAT@ 1212# if !@HAVE_WCSCAT@
1132_GL_FUNCDECL_SYS (wcscat, wchar_t *, 1213_GL_FUNCDECL_SYS (wcscat, wchar_t *,
1133 (wchar_t *restrict dest, const wchar_t *restrict src)); 1214 (wchar_t *restrict dest, const wchar_t *restrict src), );
1134# endif 1215# endif
1135_GL_CXXALIAS_SYS (wcscat, wchar_t *, 1216_GL_CXXALIAS_SYS (wcscat, wchar_t *,
1136 (wchar_t *restrict dest, const wchar_t *restrict src)); 1217 (wchar_t *restrict dest, const wchar_t *restrict src));
@@ -1148,14 +1229,31 @@ _GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
1148 1229
1149/* Append no more than N wide characters of SRC onto DEST. */ 1230/* Append no more than N wide characters of SRC onto DEST. */
1150#if @GNULIB_WCSNCAT@ 1231#if @GNULIB_WCSNCAT@
1151# if !@HAVE_WCSNCAT@ 1232# if @REPLACE_WCSNCAT@
1152_GL_FUNCDECL_SYS (wcsncat, wchar_t *, 1233# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1234# undef wcsncat
1235# define wcsncat rpl_wcsncat
1236# endif
1237_GL_FUNCDECL_RPL (wcsncat, wchar_t *,
1238 (wchar_t *restrict dest, const wchar_t *restrict src,
1239 size_t n),
1240 _GL_ARG_NONNULL ((1))
1241 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
1242_GL_CXXALIAS_RPL (wcsncat, wchar_t *,
1153 (wchar_t *restrict dest, const wchar_t *restrict src, 1243 (wchar_t *restrict dest, const wchar_t *restrict src,
1154 size_t n)); 1244 size_t n));
1155# endif 1245# else
1246# if !@HAVE_WCSNCAT@
1247_GL_FUNCDECL_SYS (wcsncat, wchar_t *,
1248 (wchar_t *restrict dest, const wchar_t *restrict src,
1249 size_t n),
1250 _GL_ARG_NONNULL ((1))
1251 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
1252# endif
1156_GL_CXXALIAS_SYS (wcsncat, wchar_t *, 1253_GL_CXXALIAS_SYS (wcsncat, wchar_t *,
1157 (wchar_t *restrict dest, const wchar_t *restrict src, 1254 (wchar_t *restrict dest, const wchar_t *restrict src,
1158 size_t n)); 1255 size_t n));
1256# endif
1159# if __GLIBC__ >= 2 1257# if __GLIBC__ >= 2
1160_GL_CXXALIASWARN (wcsncat); 1258_GL_CXXALIASWARN (wcsncat);
1161# endif 1259# endif
@@ -1175,12 +1273,12 @@ _GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
1175# undef wcscmp 1273# undef wcscmp
1176# define wcscmp rpl_wcscmp 1274# define wcscmp rpl_wcscmp
1177# endif 1275# endif
1178_GL_FUNCDECL_RPL (wcscmp, int, (const wchar_t *s1, const wchar_t *s2) 1276_GL_FUNCDECL_RPL (wcscmp, int, (const wchar_t *s1, const wchar_t *s2),
1179 _GL_ATTRIBUTE_PURE); 1277 _GL_ATTRIBUTE_PURE);
1180_GL_CXXALIAS_RPL (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); 1278_GL_CXXALIAS_RPL (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
1181# else 1279# else
1182# if !@HAVE_WCSCMP@ 1280# if !@HAVE_WCSCMP@
1183_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2) 1281_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2),
1184 _GL_ATTRIBUTE_PURE); 1282 _GL_ATTRIBUTE_PURE);
1185# endif 1283# endif
1186_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)); 1284_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
@@ -1205,15 +1303,19 @@ _GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
1205# define wcsncmp rpl_wcsncmp 1303# define wcsncmp rpl_wcsncmp
1206# endif 1304# endif
1207_GL_FUNCDECL_RPL (wcsncmp, int, 1305_GL_FUNCDECL_RPL (wcsncmp, int,
1208 (const wchar_t *s1, const wchar_t *s2, size_t n) 1306 (const wchar_t *s1, const wchar_t *s2, size_t n),
1209 _GL_ATTRIBUTE_PURE); 1307 _GL_ATTRIBUTE_PURE
1308 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
1309 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
1210_GL_CXXALIAS_RPL (wcsncmp, int, 1310_GL_CXXALIAS_RPL (wcsncmp, int,
1211 (const wchar_t *s1, const wchar_t *s2, size_t n)); 1311 (const wchar_t *s1, const wchar_t *s2, size_t n));
1212# else 1312# else
1213# if !@HAVE_WCSNCMP@ 1313# if !@HAVE_WCSNCMP@
1214_GL_FUNCDECL_SYS (wcsncmp, int, 1314_GL_FUNCDECL_SYS (wcsncmp, int,
1215 (const wchar_t *s1, const wchar_t *s2, size_t n) 1315 (const wchar_t *s1, const wchar_t *s2, size_t n),
1216 _GL_ATTRIBUTE_PURE); 1316 _GL_ATTRIBUTE_PURE
1317 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (1, 3)
1318 _GL_ATTRIBUTE_NONNULL_IF_NONZERO (2, 3));
1217# endif 1319# endif
1218_GL_CXXALIAS_SYS (wcsncmp, int, 1320_GL_CXXALIAS_SYS (wcsncmp, int,
1219 (const wchar_t *s1, const wchar_t *s2, size_t n)); 1321 (const wchar_t *s1, const wchar_t *s2, size_t n));
@@ -1236,7 +1338,7 @@ _GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
1236 namespace, not in the global namespace. So, force a declaration in 1338 namespace, not in the global namespace. So, force a declaration in
1237 the global namespace. */ 1339 the global namespace. */
1238# if !@HAVE_WCSCASECMP@ || (defined __sun && defined __cplusplus) 1340# if !@HAVE_WCSCASECMP@ || (defined __sun && defined __cplusplus)
1239_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2) 1341_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2),
1240 _GL_ATTRIBUTE_PURE); 1342 _GL_ATTRIBUTE_PURE);
1241# endif 1343# endif
1242_GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)); 1344_GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
@@ -1257,7 +1359,7 @@ _GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
1257 the global namespace. */ 1359 the global namespace. */
1258# if !@HAVE_WCSNCASECMP@ || (defined __sun && defined __cplusplus) 1360# if !@HAVE_WCSNCASECMP@ || (defined __sun && defined __cplusplus)
1259_GL_FUNCDECL_SYS (wcsncasecmp, int, 1361_GL_FUNCDECL_SYS (wcsncasecmp, int,
1260 (const wchar_t *s1, const wchar_t *s2, size_t n) 1362 (const wchar_t *s1, const wchar_t *s2, size_t n),
1261 _GL_ATTRIBUTE_PURE); 1363 _GL_ATTRIBUTE_PURE);
1262# endif 1364# endif
1263_GL_CXXALIAS_SYS (wcsncasecmp, int, 1365_GL_CXXALIAS_SYS (wcsncasecmp, int,
@@ -1276,7 +1378,7 @@ _GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
1276 category of the current locale. */ 1378 category of the current locale. */
1277#if @GNULIB_WCSCOLL@ 1379#if @GNULIB_WCSCOLL@
1278# if !@HAVE_WCSCOLL@ 1380# if !@HAVE_WCSCOLL@
1279_GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); 1381_GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2), );
1280# endif 1382# endif
1281_GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2)); 1383_GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
1282# if __GLIBC__ >= 2 1384# if __GLIBC__ >= 2
@@ -1297,7 +1399,7 @@ _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
1297#if @GNULIB_WCSXFRM@ 1399#if @GNULIB_WCSXFRM@
1298# if !@HAVE_WCSXFRM@ 1400# if !@HAVE_WCSXFRM@
1299_GL_FUNCDECL_SYS (wcsxfrm, size_t, 1401_GL_FUNCDECL_SYS (wcsxfrm, size_t,
1300 (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n)); 1402 (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n), );
1301# endif 1403# endif
1302_GL_CXXALIAS_SYS (wcsxfrm, size_t, 1404_GL_CXXALIAS_SYS (wcsxfrm, size_t,
1303 (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n)); 1405 (wchar_t *restrict s1, const wchar_t *restrict s2, size_t n));
@@ -1325,15 +1427,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:: 1427/* 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 1428 namespace, not in the global namespace. So, force a declaration in
1327 the global namespace. */ 1429 the global namespace. */
1328# if !@HAVE_WCSDUP@ || (defined __sun && defined __cplusplus) || __GNUC__ >= 11 1430# if !@HAVE_WCSDUP@ || (defined __sun && defined __cplusplus) \
1431 || (__GNUC__ >= 11 && !defined __clang__)
1329# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 1432# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
1330_GL_FUNCDECL_SYS (wcsdup, wchar_t *, 1433_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1331 (const wchar_t *s) 1434 (const wchar_t *s),
1332 _GL_ATTRIBUTE_NOTHROW 1435 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
1333 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 1436 _GL_ATTRIBUTE_NOTHROW;
1334# else 1437# else
1335_GL_FUNCDECL_SYS (wcsdup, wchar_t *, 1438_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1336 (const wchar_t *s) 1439 (const wchar_t *s),
1337 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 1440 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
1338# endif 1441# endif
1339# endif 1442# endif
@@ -1341,16 +1444,16 @@ _GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
1341# endif 1444# endif
1342_GL_CXXALIASWARN (wcsdup); 1445_GL_CXXALIASWARN (wcsdup);
1343#else 1446#else
1344# if __GNUC__ >= 11 && !defined wcsdup 1447# if (__GNUC__ >= 11 && !defined __clang__) && !defined wcsdup
1345/* For -Wmismatched-dealloc: Associate wcsdup with free or rpl_free. */ 1448/* For -Wmismatched-dealloc: Associate wcsdup with free or rpl_free. */
1346# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 1449# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
1347_GL_FUNCDECL_SYS (wcsdup, wchar_t *, 1450_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1348 (const wchar_t *s) 1451 (const wchar_t *s),
1349 _GL_ATTRIBUTE_NOTHROW 1452 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
1350 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 1453 _GL_ATTRIBUTE_NOTHROW;
1351# else 1454# else
1352_GL_FUNCDECL_SYS (wcsdup, wchar_t *, 1455_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1353 (const wchar_t *s) 1456 (const wchar_t *s),
1354 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 1457 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
1355# endif 1458# endif
1356# endif 1459# endif
@@ -1373,12 +1476,12 @@ _GL_CXXALIAS_MDA (wcsdup, wchar_t *, (const wchar_t *s));
1373# else 1476# else
1374# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2 1477# if __GLIBC__ + (__GLIBC_MINOR__ >= 2) > 2
1375_GL_FUNCDECL_SYS (wcsdup, wchar_t *, 1478_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1376 (const wchar_t *s) 1479 (const wchar_t *s),
1377 _GL_ATTRIBUTE_NOTHROW 1480 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE)
1378 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 1481 _GL_ATTRIBUTE_NOTHROW;
1379# else 1482# else
1380_GL_FUNCDECL_SYS (wcsdup, wchar_t *, 1483_GL_FUNCDECL_SYS (wcsdup, wchar_t *,
1381 (const wchar_t *s) 1484 (const wchar_t *s),
1382 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE); 1485 _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
1383# endif 1486# endif
1384# if @HAVE_DECL_WCSDUP@ 1487# if @HAVE_DECL_WCSDUP@
@@ -1395,7 +1498,7 @@ _GL_CXXALIASWARN (wcsdup);
1395/* Find the first occurrence of WC in WCS. */ 1498/* Find the first occurrence of WC in WCS. */
1396#if @GNULIB_WCSCHR@ 1499#if @GNULIB_WCSCHR@
1397# if !@HAVE_WCSCHR@ 1500# if !@HAVE_WCSCHR@
1398_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc) 1501_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc),
1399 _GL_ATTRIBUTE_PURE); 1502 _GL_ATTRIBUTE_PURE);
1400# endif 1503# endif
1401 /* On some systems, this function is defined as an overloaded function: 1504 /* On some systems, this function is defined as an overloaded function:
@@ -1407,10 +1510,11 @@ _GL_CXXALIAS_SYS_CAST2 (wcschr,
1407 wchar_t *, (const wchar_t *, wchar_t), 1510 wchar_t *, (const wchar_t *, wchar_t),
1408 const wchar_t *, (const wchar_t *, wchar_t)); 1511 const wchar_t *, (const wchar_t *, wchar_t));
1409# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1512# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1410 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1513 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) \
1514 && !defined __clang__
1411_GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc)); 1515_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)); 1516_GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
1413# elif __GLIBC__ >= 2 1517# elif __GLIBC__ >= 2 && !defined __CORRECT_ISO_CPP_WCHAR_H_PROTO
1414_GL_CXXALIASWARN (wcschr); 1518_GL_CXXALIASWARN (wcschr);
1415# endif 1519# endif
1416#elif defined GNULIB_POSIXCHECK 1520#elif defined GNULIB_POSIXCHECK
@@ -1425,7 +1529,7 @@ _GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
1425/* Find the last occurrence of WC in WCS. */ 1529/* Find the last occurrence of WC in WCS. */
1426#if @GNULIB_WCSRCHR@ 1530#if @GNULIB_WCSRCHR@
1427# if !@HAVE_WCSRCHR@ 1531# if !@HAVE_WCSRCHR@
1428_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc) 1532_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc),
1429 _GL_ATTRIBUTE_PURE); 1533 _GL_ATTRIBUTE_PURE);
1430# endif 1534# endif
1431 /* On some systems, this function is defined as an overloaded function: 1535 /* On some systems, this function is defined as an overloaded function:
@@ -1437,10 +1541,11 @@ _GL_CXXALIAS_SYS_CAST2 (wcsrchr,
1437 wchar_t *, (const wchar_t *, wchar_t), 1541 wchar_t *, (const wchar_t *, wchar_t),
1438 const wchar_t *, (const wchar_t *, wchar_t)); 1542 const wchar_t *, (const wchar_t *, wchar_t));
1439# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1543# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1440 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1544 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) \
1545 && !defined __clang__
1441_GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc)); 1546_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)); 1547_GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
1443# elif __GLIBC__ >= 2 1548# elif __GLIBC__ >= 2 && !defined __CORRECT_ISO_CPP_WCHAR_H_PROTO
1444_GL_CXXALIASWARN (wcsrchr); 1549_GL_CXXALIASWARN (wcsrchr);
1445# endif 1550# endif
1446#elif defined GNULIB_POSIXCHECK 1551#elif defined GNULIB_POSIXCHECK
@@ -1456,7 +1561,7 @@ _GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
1456 of wide characters not in REJECT. */ 1561 of wide characters not in REJECT. */
1457#if @GNULIB_WCSCSPN@ 1562#if @GNULIB_WCSCSPN@
1458# if !@HAVE_WCSCSPN@ 1563# if !@HAVE_WCSCSPN@
1459_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject) 1564_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject),
1460 _GL_ATTRIBUTE_PURE); 1565 _GL_ATTRIBUTE_PURE);
1461# endif 1566# endif
1462_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)); 1567_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
@@ -1476,7 +1581,7 @@ _GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
1476 of wide characters in ACCEPT. */ 1581 of wide characters in ACCEPT. */
1477#if @GNULIB_WCSSPN@ 1582#if @GNULIB_WCSSPN@
1478# if !@HAVE_WCSSPN@ 1583# if !@HAVE_WCSSPN@
1479_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept) 1584_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept),
1480 _GL_ATTRIBUTE_PURE); 1585 _GL_ATTRIBUTE_PURE);
1481# endif 1586# endif
1482_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)); 1587_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
@@ -1496,7 +1601,7 @@ _GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
1496#if @GNULIB_WCSPBRK@ 1601#if @GNULIB_WCSPBRK@
1497# if !@HAVE_WCSPBRK@ 1602# if !@HAVE_WCSPBRK@
1498_GL_FUNCDECL_SYS (wcspbrk, wchar_t *, 1603_GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
1499 (const wchar_t *wcs, const wchar_t *accept) 1604 (const wchar_t *wcs, const wchar_t *accept),
1500 _GL_ATTRIBUTE_PURE); 1605 _GL_ATTRIBUTE_PURE);
1501# endif 1606# endif
1502 /* On some systems, this function is defined as an overloaded function: 1607 /* On some systems, this function is defined as an overloaded function:
@@ -1508,12 +1613,13 @@ _GL_CXXALIAS_SYS_CAST2 (wcspbrk,
1508 wchar_t *, (const wchar_t *, const wchar_t *), 1613 wchar_t *, (const wchar_t *, const wchar_t *),
1509 const wchar_t *, (const wchar_t *, const wchar_t *)); 1614 const wchar_t *, (const wchar_t *, const wchar_t *));
1510# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1615# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1511 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1616 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) \
1617 && !defined __clang__
1512_GL_CXXALIASWARN1 (wcspbrk, wchar_t *, 1618_GL_CXXALIASWARN1 (wcspbrk, wchar_t *,
1513 (wchar_t *wcs, const wchar_t *accept)); 1619 (wchar_t *wcs, const wchar_t *accept));
1514_GL_CXXALIASWARN1 (wcspbrk, const wchar_t *, 1620_GL_CXXALIASWARN1 (wcspbrk, const wchar_t *,
1515 (const wchar_t *wcs, const wchar_t *accept)); 1621 (const wchar_t *wcs, const wchar_t *accept));
1516# elif __GLIBC__ >= 2 1622# elif __GLIBC__ >= 2 && !defined __CORRECT_ISO_CPP_WCHAR_H_PROTO
1517_GL_CXXALIASWARN (wcspbrk); 1623_GL_CXXALIASWARN (wcspbrk);
1518# endif 1624# endif
1519#elif defined GNULIB_POSIXCHECK 1625#elif defined GNULIB_POSIXCHECK
@@ -1534,7 +1640,7 @@ _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
1534# endif 1640# endif
1535_GL_FUNCDECL_RPL (wcsstr, wchar_t *, 1641_GL_FUNCDECL_RPL (wcsstr, wchar_t *,
1536 (const wchar_t *restrict haystack, 1642 (const wchar_t *restrict haystack,
1537 const wchar_t *restrict needle) 1643 const wchar_t *restrict needle),
1538 _GL_ATTRIBUTE_PURE); 1644 _GL_ATTRIBUTE_PURE);
1539_GL_CXXALIAS_RPL (wcsstr, wchar_t *, 1645_GL_CXXALIAS_RPL (wcsstr, wchar_t *,
1540 (const wchar_t *restrict haystack, 1646 (const wchar_t *restrict haystack,
@@ -1543,7 +1649,7 @@ _GL_CXXALIAS_RPL (wcsstr, wchar_t *,
1543# if !@HAVE_WCSSTR@ 1649# if !@HAVE_WCSSTR@
1544_GL_FUNCDECL_SYS (wcsstr, wchar_t *, 1650_GL_FUNCDECL_SYS (wcsstr, wchar_t *,
1545 (const wchar_t *restrict haystack, 1651 (const wchar_t *restrict haystack,
1546 const wchar_t *restrict needle) 1652 const wchar_t *restrict needle),
1547 _GL_ATTRIBUTE_PURE); 1653 _GL_ATTRIBUTE_PURE);
1548# endif 1654# endif
1549 /* On some systems, this function is defined as an overloaded function: 1655 /* On some systems, this function is defined as an overloaded function:
@@ -1558,14 +1664,15 @@ _GL_CXXALIAS_SYS_CAST2 (wcsstr,
1558 (const wchar_t *restrict, const wchar_t *restrict)); 1664 (const wchar_t *restrict, const wchar_t *restrict));
1559# endif 1665# endif
1560# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ 1666# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
1561 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) 1667 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) \
1668 && !defined __clang__
1562_GL_CXXALIASWARN1 (wcsstr, wchar_t *, 1669_GL_CXXALIASWARN1 (wcsstr, wchar_t *,
1563 (wchar_t *restrict haystack, 1670 (wchar_t *restrict haystack,
1564 const wchar_t *restrict needle)); 1671 const wchar_t *restrict needle));
1565_GL_CXXALIASWARN1 (wcsstr, const wchar_t *, 1672_GL_CXXALIASWARN1 (wcsstr, const wchar_t *,
1566 (const wchar_t *restrict haystack, 1673 (const wchar_t *restrict haystack,
1567 const wchar_t *restrict needle)); 1674 const wchar_t *restrict needle));
1568# elif __GLIBC__ >= 2 1675# elif __GLIBC__ >= 2 && !defined __CORRECT_ISO_CPP_WCHAR_H_PROTO
1569_GL_CXXALIASWARN (wcsstr); 1676_GL_CXXALIASWARN (wcsstr);
1570# endif 1677# endif
1571#elif defined GNULIB_POSIXCHECK 1678#elif defined GNULIB_POSIXCHECK
@@ -1586,7 +1693,7 @@ _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
1586# endif 1693# endif
1587_GL_FUNCDECL_RPL (wcstok, wchar_t *, 1694_GL_FUNCDECL_RPL (wcstok, wchar_t *,
1588 (wchar_t *restrict wcs, const wchar_t *restrict delim, 1695 (wchar_t *restrict wcs, const wchar_t *restrict delim,
1589 wchar_t **restrict ptr)); 1696 wchar_t **restrict ptr), );
1590_GL_CXXALIAS_RPL (wcstok, wchar_t *, 1697_GL_CXXALIAS_RPL (wcstok, wchar_t *,
1591 (wchar_t *restrict wcs, const wchar_t *restrict delim, 1698 (wchar_t *restrict wcs, const wchar_t *restrict delim,
1592 wchar_t **restrict ptr)); 1699 wchar_t **restrict ptr));
@@ -1594,7 +1701,7 @@ _GL_CXXALIAS_RPL (wcstok, wchar_t *,
1594# if !@HAVE_WCSTOK@ 1701# if !@HAVE_WCSTOK@
1595_GL_FUNCDECL_SYS (wcstok, wchar_t *, 1702_GL_FUNCDECL_SYS (wcstok, wchar_t *,
1596 (wchar_t *restrict wcs, const wchar_t *restrict delim, 1703 (wchar_t *restrict wcs, const wchar_t *restrict delim,
1597 wchar_t **restrict ptr)); 1704 wchar_t **restrict ptr), );
1598# endif 1705# endif
1599_GL_CXXALIAS_SYS (wcstok, wchar_t *, 1706_GL_CXXALIAS_SYS (wcstok, wchar_t *,
1600 (wchar_t *restrict wcs, const wchar_t *restrict delim, 1707 (wchar_t *restrict wcs, const wchar_t *restrict delim,
@@ -1620,12 +1727,12 @@ _GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
1620# undef wcswidth 1727# undef wcswidth
1621# define wcswidth rpl_wcswidth 1728# define wcswidth rpl_wcswidth
1622# endif 1729# endif
1623_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n) 1730_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n),
1624 _GL_ATTRIBUTE_PURE); 1731 _GL_ATTRIBUTE_PURE);
1625_GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n)); 1732_GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n));
1626# else 1733# else
1627# if !@HAVE_WCSWIDTH@ 1734# if !@HAVE_WCSWIDTH@
1628_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n) 1735_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n),
1629 _GL_ATTRIBUTE_PURE); 1736 _GL_ATTRIBUTE_PURE);
1630# endif 1737# endif
1631_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n)); 1738_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
@@ -1653,7 +1760,7 @@ _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
1653_GL_FUNCDECL_RPL (wcsftime, size_t, 1760_GL_FUNCDECL_RPL (wcsftime, size_t,
1654 (wchar_t *restrict __buf, size_t __bufsize, 1761 (wchar_t *restrict __buf, size_t __bufsize,
1655 const wchar_t *restrict __fmt, 1762 const wchar_t *restrict __fmt,
1656 const struct tm *restrict __tp) 1763 const struct tm *restrict __tp),
1657 _GL_ARG_NONNULL ((1, 3, 4))); 1764 _GL_ARG_NONNULL ((1, 3, 4)));
1658_GL_CXXALIAS_RPL (wcsftime, size_t, 1765_GL_CXXALIAS_RPL (wcsftime, size_t,
1659 (wchar_t *restrict __buf, size_t __bufsize, 1766 (wchar_t *restrict __buf, size_t __bufsize,
@@ -1664,7 +1771,7 @@ _GL_CXXALIAS_RPL (wcsftime, size_t,
1664_GL_FUNCDECL_SYS (wcsftime, size_t, 1771_GL_FUNCDECL_SYS (wcsftime, size_t,
1665 (wchar_t *restrict __buf, size_t __bufsize, 1772 (wchar_t *restrict __buf, size_t __bufsize,
1666 const wchar_t *restrict __fmt, 1773 const wchar_t *restrict __fmt,
1667 const struct tm *restrict __tp) 1774 const struct tm *restrict __tp),
1668 _GL_ARG_NONNULL ((1, 3, 4))); 1775 _GL_ARG_NONNULL ((1, 3, 4)));
1669# endif 1776# endif
1670_GL_CXXALIAS_SYS (wcsftime, size_t, 1777_GL_CXXALIAS_SYS (wcsftime, size_t,
@@ -1698,7 +1805,7 @@ _GL_WARN_ON_USE (wcsftime, "wcsftime is unportable - "
1698 Possible errno values include: 1805 Possible errno values include:
1699 - ERANGE if SIZE is too small. 1806 - ERANGE if SIZE is too small.
1700 - ENOMEM if the memory could no be allocated. */ 1807 - ENOMEM if the memory could no be allocated. */
1701_GL_FUNCDECL_SYS (wgetcwd, wchar_t *, (wchar_t *buf, size_t size)); 1808_GL_FUNCDECL_SYS (wgetcwd, wchar_t *, (wchar_t *buf, size_t size), );
1702#endif 1809#endif
1703 1810
1704 1811
diff --git a/gl/wcrtomb.c b/gl/wcrtomb.c
index 197b020e..c9ebcf0c 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-2025 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/wctype-h.c b/gl/wctype-h.c
index 7e4ff13a..098014a9 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-2025 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..8bb83be7 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-2025 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.c b/gl/wctype.c
index 914f6847..b421ad38 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-2025 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..aa4a8e7d 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-2025 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
@@ -478,9 +478,9 @@ towupper
478# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 478# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
479# define iswblank rpl_iswblank 479# define iswblank rpl_iswblank
480# endif 480# endif
481_GL_FUNCDECL_RPL (iswblank, int, (wint_t wc)); 481_GL_FUNCDECL_RPL (iswblank, int, (wint_t wc), );
482# else 482# else
483_GL_FUNCDECL_SYS (iswblank, int, (wint_t wc)); 483_GL_FUNCDECL_SYS (iswblank, int, (wint_t wc), );
484# endif 484# endif
485# endif 485# endif
486 486
@@ -490,7 +490,7 @@ _GL_FUNCDECL_SYS (iswblank, int, (wint_t wc));
490# undef iswdigit 490# undef iswdigit
491# define iswdigit rpl_iswdigit 491# define iswdigit rpl_iswdigit
492# endif 492# endif
493_GL_FUNCDECL_RPL (iswdigit, int, (wint_t wc)); 493_GL_FUNCDECL_RPL (iswdigit, int, (wint_t wc), );
494# endif 494# endif
495# endif 495# endif
496 496
@@ -500,7 +500,7 @@ _GL_FUNCDECL_RPL (iswdigit, int, (wint_t wc));
500# undef iswpunct 500# undef iswpunct
501# define iswpunct rpl_iswpunct 501# define iswpunct rpl_iswpunct
502# endif 502# endif
503_GL_FUNCDECL_RPL (iswpunct, int, (wint_t wc)); 503_GL_FUNCDECL_RPL (iswpunct, int, (wint_t wc), );
504# endif 504# endif
505# endif 505# endif
506 506
@@ -510,7 +510,7 @@ _GL_FUNCDECL_RPL (iswpunct, int, (wint_t wc));
510# undef iswxdigit 510# undef iswxdigit
511# define iswxdigit rpl_iswxdigit 511# define iswxdigit rpl_iswxdigit
512# endif 512# endif
513_GL_FUNCDECL_RPL (iswxdigit, int, (wint_t wc)); 513_GL_FUNCDECL_RPL (iswxdigit, int, (wint_t wc), );
514# endif 514# endif
515# endif 515# endif
516 516
@@ -659,12 +659,12 @@ typedef void *rpl_wctype_t;
659# undef wctype 659# undef wctype
660# define wctype rpl_wctype 660# define wctype rpl_wctype
661# endif 661# endif
662_GL_FUNCDECL_RPL (wctype, wctype_t, (const char *name) 662_GL_FUNCDECL_RPL (wctype, wctype_t, (const char *name),
663 _GL_ARG_NONNULL ((1))); 663 _GL_ARG_NONNULL ((1)));
664_GL_CXXALIAS_RPL (wctype, wctype_t, (const char *name)); 664_GL_CXXALIAS_RPL (wctype, wctype_t, (const char *name));
665# else 665# else
666# if !@HAVE_WCTYPE_T@ 666# if !@HAVE_WCTYPE_T@
667_GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name) 667_GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name),
668 _GL_ARG_NONNULL ((1))); 668 _GL_ARG_NONNULL ((1)));
669# endif 669# endif
670_GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name)); 670_GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name));
@@ -689,11 +689,11 @@ _GL_WARN_ON_USE (wctype, "wctype is unportable - "
689# undef iswctype 689# undef iswctype
690# define iswctype rpl_iswctype 690# define iswctype rpl_iswctype
691# endif 691# endif
692_GL_FUNCDECL_RPL (iswctype, int, (wint_t wc, wctype_t desc)); 692_GL_FUNCDECL_RPL (iswctype, int, (wint_t wc, wctype_t desc), );
693_GL_CXXALIAS_RPL (iswctype, int, (wint_t wc, wctype_t desc)); 693_GL_CXXALIAS_RPL (iswctype, int, (wint_t wc, wctype_t desc));
694# else 694# else
695# if !@HAVE_WCTYPE_T@ 695# if !@HAVE_WCTYPE_T@
696_GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc)); 696_GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc), );
697# endif 697# endif
698_GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc)); 698_GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc));
699# endif 699# endif
@@ -741,12 +741,12 @@ typedef void *rpl_wctrans_t;
741# undef wctrans 741# undef wctrans
742# define wctrans rpl_wctrans 742# define wctrans rpl_wctrans
743# endif 743# endif
744_GL_FUNCDECL_RPL (wctrans, wctrans_t, (const char *name) 744_GL_FUNCDECL_RPL (wctrans, wctrans_t, (const char *name),
745 _GL_ARG_NONNULL ((1))); 745 _GL_ARG_NONNULL ((1)));
746_GL_CXXALIAS_RPL (wctrans, wctrans_t, (const char *name)); 746_GL_CXXALIAS_RPL (wctrans, wctrans_t, (const char *name));
747# else 747# else
748# if !@HAVE_WCTRANS_T@ 748# if !@HAVE_WCTRANS_T@
749_GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name) 749_GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name),
750 _GL_ARG_NONNULL ((1))); 750 _GL_ARG_NONNULL ((1)));
751# endif 751# endif
752_GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name)); 752_GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name));
@@ -771,11 +771,11 @@ _GL_WARN_ON_USE (wctrans, "wctrans is unportable - "
771# undef towctrans 771# undef towctrans
772# define towctrans rpl_towctrans 772# define towctrans rpl_towctrans
773# endif 773# endif
774_GL_FUNCDECL_RPL (towctrans, wint_t, (wint_t wc, wctrans_t desc)); 774_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)); 775_GL_CXXALIAS_RPL (towctrans, wint_t, (wint_t wc, wctrans_t desc));
776# else 776# else
777# if !@HAVE_WCTRANS_T@ 777# if !@HAVE_WCTRANS_T@
778_GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); 778_GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc), );
779# endif 779# endif
780_GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc)); 780_GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc));
781# endif 781# endif
diff --git a/gl/wcwidth.c b/gl/wcwidth.c
new file mode 100644
index 00000000..6e7141d0
--- /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-2025 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..4f45e5bb 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-2025 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..87b75735 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-2025 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..dc6b41e0 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-2025 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..bd9e672a 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-2025 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..b27ae538 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-2025 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..09341d56 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-2025 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..25a883d4 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-2025 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..313f14ca 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-2025 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.h b/gl/windows-rwlock.h
index 08d67750..b1b4063a 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-2025 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..db1ee8ff 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-2025 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", 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..0f66bd06 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-2025 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..438e5caa 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-2025 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..8a715807 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-2025 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
@@ -64,7 +64,7 @@ void *
64xrealloc (void *p, size_t s) 64xrealloc (void *p, size_t s)
65{ 65{
66 void *r = realloc (p, s); 66 void *r = realloc (p, s);
67 if (!r && (!p || s)) 67 if (!r)
68 xalloc_die (); 68 xalloc_die ();
69 return r; 69 return r;
70} 70}
@@ -82,7 +82,7 @@ void *
82xreallocarray (void *p, size_t n, size_t s) 82xreallocarray (void *p, size_t n, size_t s)
83{ 83{
84 void *r = reallocarray (p, n, s); 84 void *r = reallocarray (p, n, s);
85 if (!r && (!p || (n && s))) 85 if (!r)
86 xalloc_die (); 86 xalloc_die ();
87 return r; 87 return r;
88} 88}
diff --git a/gl/xsize.c b/gl/xsize.c
index 87744675..cd75b606 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-2025 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/xsize.h b/gl/xsize.h
index 619c0edc..ee9c5680 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-2025 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) \